凭证详情-过滤掉已归档的凭证号

new
zk 1 year ago
parent 80d4aad89b
commit 32d52702bd

@ -22,7 +22,9 @@ import cn.iocoder.yudao.module.accounting.service.invoices.InvoicesService;
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -44,6 +46,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
@ -79,7 +82,7 @@ public class VoucherController {
VoucherExportReqVO vo = new VoucherExportReqVO();
vo.setVoucherNum(createReqVO.getVoucherNum());
List<VoucherDO> voucherList = voucherService.getVoucherList(vo);
if (voucherList.size()>0){
if (voucherList.size() > 0) {
return error("凭证号重复!");
}
return success(voucherService.createVoucher(createReqVO));
@ -98,11 +101,11 @@ public class VoucherController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('accounting:voucher:delete')")
public CommonResult<Boolean> deleteVoucher(@RequestParam("id") Long[] id) {
List<Long> listId = new ArrayList(Arrays.asList(id)) ;
List<Long> listId = new ArrayList(Arrays.asList(id));
List<VoucherDO> voucherList = voucherService.getVoucherList(listId);
for (VoucherDO voucher : voucherList) {
if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())){
return error("凭证号:"+voucher.getVoucherNum()+" 该凭证已归档,请勿删除!");
for (VoucherDO voucher : voucherList) {
if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())) {
return error("凭证号:" + voucher.getVoucherNum() + " 该凭证已归档,请勿删除!");
}
}
voucherService.deleteVoucher(id);
@ -134,7 +137,7 @@ public class VoucherController {
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
PageResult<VoucherRespVO> voucherRespVOPageResult = VoucherConvert.INSTANCE.convertPage(pageResult);
String jsonString = JSONObject.toJSONString(voucherRespVOPageResult);
passwordsService.jsonToXmlConverter(response,pageVO.getInputPassword(),jsonString);
passwordsService.jsonToXmlConverter(response, pageVO.getInputPassword(), jsonString);
}
@GetMapping("/page")
@ -142,14 +145,14 @@ public class VoucherController {
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
public CommonResult<PageResult<VoucherRespVO>> getVoucherPage(@Valid VoucherPageReqVO pageVO) {
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
int i=0;
int i = 0;
//完整性检查
//完整性检查,并设置会计凭证的完整性
List<VoucherDO> list = pageResult.getList();
for (VoucherDO voucherDO:list
) {
for (VoucherDO voucherDO : list
) {
//如果未归档才检查完整性
if(!voucherDO.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())) {
if (!voucherDO.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())) {
String remark = " ";
Long id = voucherDO.getId();
AttachmentExportReqVO attachmentExportReqVO = new AttachmentExportReqVO();
@ -193,7 +196,7 @@ public class VoucherController {
voucherUpdateReqVO.setCherks(voucherDO.getCherks());
voucherUpdateReqVO.setRemark(remark);
voucherService.updateVoucher(voucherUpdateReqVO);
}else {
} else {
VoucherUpdateReqVO voucherUpdateReqVO = new VoucherUpdateReqVO();
voucherUpdateReqVO.setId(voucherDO.getId());
voucherUpdateReqVO.setCherks(Integer.valueOf(AccountingStatusEnum.COMPLETE.getValue()));
@ -201,9 +204,10 @@ public class VoucherController {
voucherService.updateVoucher(voucherUpdateReqVO);
}
}
//查询未归档的会计凭证返回前端
pageVO.setFileStatus(String.valueOf(0));
PageResult<VoucherDO> pageResult2 = voucherService.getVoucherPage(pageVO);
return success(VoucherConvert.INSTANCE.convertPage(pageResult2));
}
@ -212,7 +216,7 @@ public class VoucherController {
@PreAuthorize("@ss.hasPermission('accounting:voucher:export')")
@OperateLog(type = EXPORT)
public void exportVoucherExcel(@Valid VoucherExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<VoucherDO> list = voucherService.getVoucherList(exportReqVO);
// 导出 Excel
List<VoucherExcelVO> datas = VoucherConvert.INSTANCE.convertList02(list);

Loading…
Cancel
Save