From 74425edd15be37bc44d8e5242ca0f89731131892 Mon Sep 17 00:00:00 2001 From: JiilingLee <462362@qq.com> Date: Tue, 10 Oct 2023 15:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=95=B4=E6=80=A7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attachment/AttachmentController.java | 2 +- .../admin/voucher/VoucherController.java | 76 ++++++++++++++++++- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/attachment/AttachmentController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/attachment/AttachmentController.java index 780b85ec..4095bc40 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/attachment/AttachmentController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/attachment/AttachmentController.java @@ -54,7 +54,7 @@ public class AttachmentController { @PostMapping("/upload") @Operation(summary = "上传会计附件") @Parameter(name = "multipartFile", description = "文件", required = true) - @PreAuthorize("@ss.hasPermission('accounting:other:create')") + @PreAuthorize("@ss.hasPermission('accounting:attachment:create')") public CommonResult upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException { String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream())); FilePageReqVO pageReqVO = new FilePageReqVO(); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/voucher/VoucherController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/voucher/VoucherController.java index bcc33321..d55466c8 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/voucher/VoucherController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/voucher/VoucherController.java @@ -1,5 +1,18 @@ package cn.iocoder.yudao.module.accounting.controller.admin.voucher; +import cn.iocoder.yudao.module.accounting.controller.admin.attachment.vo.AttachmentCreateReqVO; +import cn.iocoder.yudao.module.accounting.controller.admin.attachment.vo.AttachmentExportReqVO; +import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExportReqVO; +import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExportReqVO; +import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesExportReqVO; +import cn.iocoder.yudao.module.accounting.dal.dataobject.attachment.AttachmentDO; +import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO; +import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO; +import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO; +import cn.iocoder.yudao.module.accounting.service.attachment.AttachmentService; +import cn.iocoder.yudao.module.accounting.service.bankslip.BankSlipService; +import cn.iocoder.yudao.module.accounting.service.flow.FlowService; +import cn.iocoder.yudao.module.accounting.service.invoices.InvoicesService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -38,6 +51,15 @@ public class VoucherController { @Resource private VoucherService voucherService; + @Resource + private AttachmentService attachmentService; + @Resource + private BankSlipService bankSlipService; + @Resource + private InvoicesService invoicesService; + @Resource + private FlowService flowService; + @PostMapping("/create") @Operation(summary = "创建会计凭证") @@ -92,7 +114,59 @@ public class VoucherController { @PreAuthorize("@ss.hasPermission('accounting:voucher:query')") public CommonResult> getVoucherPage(@Valid VoucherPageReqVO pageVO) { PageResult pageResult = voucherService.getVoucherPage(pageVO); - return success(VoucherConvert.INSTANCE.convertPage(pageResult)); + int i=0; + String remark=""; + //完整性检查 + List list = pageResult.getList(); + for (VoucherDO voucherDO:list + ) { + Long id = voucherDO.getId(); + AttachmentExportReqVO attachmentExportReqVO = new AttachmentExportReqVO(); + attachmentExportReqVO.setVoucherId(id); + List attachmentList = attachmentService.getAttachmentList(attachmentExportReqVO); + if (attachmentList.size()<1){ + remark=remark+"缺少附件"; + }else { + i++; + } + FlowExportReqVO flowExportReqVO = new FlowExportReqVO(); + flowExportReqVO.setVoucherId(id); + List flowList = flowService.getFlowList(flowExportReqVO); + if (flowList.size()<1){ + remark=remark+";缺少审批流程"; + }else { + i++; + } + InvoicesExportReqVO invoicesExportReqVO = new InvoicesExportReqVO().setVoucherId(id); + List invoicesList = invoicesService.getInvoicesList(invoicesExportReqVO); + if (invoicesList.size()<1){ + remark=remark+";缺少电子发票"; + }else { + i++; + } + BankSlipExportReqVO bankSlipExportReqVO = new BankSlipExportReqVO(); + bankSlipExportReqVO.setVoucherId(id); + List bankSlipList = bankSlipService.getBankSlipList(bankSlipExportReqVO); + if (bankSlipList.size()<1){ + remark=remark+";缺少银行回单"; + }else { + i++; + } + if(i!=4){ + voucherDO.setCherks(0); + }else { + voucherDO.setCherks(1); + } + VoucherUpdateReqVO voucherUpdateReqVO = new VoucherUpdateReqVO(); + voucherUpdateReqVO.setId(id); + voucherUpdateReqVO.setCherks(voucherDO.getCherks()); + voucherUpdateReqVO.setRemark(remark); + voucherService.updateVoucher(voucherUpdateReqVO); + } + + + PageResult pageResult2 = voucherService.getVoucherPage(pageVO); + return success(VoucherConvert.INSTANCE.convertPage(pageResult2)); } @GetMapping("/export-excel")