From 4a11a41d7207d72275845e9097c1b22237e16838 Mon Sep 17 00:00:00 2001 From: "LAPTOP-0SF788NU\\admin" <3306174053@qq.com> Date: Thu, 2 Nov 2023 15:51:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=A1=E5=87=AD=E8=AF=81=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E4=BF=AE=E6=94=B9=20=E9=93=B6=E8=A1=8C=E5=9B=9E?= =?UTF-8?q?=E5=8D=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/voucher/VoucherController.java | 11 +++++++---- .../service/bankslip/BankSlipServiceImpl.java | 5 ----- .../accounting/service/voucher/VoucherService.java | 2 +- .../service/voucher/VoucherServiceImpl.java | 7 +++---- 4 files changed, 11 insertions(+), 14 deletions(-) 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 3a01ccfc..a07d165e 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 @@ -97,10 +97,13 @@ public class VoucherController { @Operation(summary = "删除会计凭证") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('accounting:voucher:delete')") - public CommonResult deleteVoucher(@RequestParam("id") Long id) { - VoucherDO voucher = voucherService.getVoucher(id); - if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())){ - return error("该凭证已归档,请勿删除!"); + public CommonResult deleteVoucher(@RequestParam("id") Long[] id) { + List listId = new ArrayList(Arrays.asList(id)) ; + List voucherList = voucherService.getVoucherList(listId); + for (VoucherDO voucher : voucherList) { + if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())){ + return error("凭证号:"+voucher.getVoucherNum()+" 该凭证已归档,请勿删除!"); + } } voucherService.deleteVoucher(id); return success(true); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/bankslip/BankSlipServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/bankslip/BankSlipServiceImpl.java index 2647e809..b1099f4d 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/bankslip/BankSlipServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/bankslip/BankSlipServiceImpl.java @@ -124,11 +124,6 @@ public class BankSlipServiceImpl implements BankSlipService { @Override public BankSlipDO jsonToJavaObject(BankReceiptDO bankReceiptDO, MultipartFile multipartFile) throws IOException { BankSlipDO bankSlipDO = new BankSlipDO(); - String invoiceDateStr = bankReceiptDO.getWords_result().get交易日期().get(0).getWord().replace("年", "-").replaceAll("月", "-").replaceAll("日", "").trim(); - LocalDate parse = LocalDate.parse(invoiceDateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")); - LocalDateTime date = parse.atStartOfDay();; - bankSlipDO.setTradTime(date); - // 将日期字符串解析为 LocalDate 对象 //这里用中文是因为调用百度ocr银行回单的接口返回的数据json都是中文的 bankSlipDO .setBank(bankReceiptDO.getWords_result().get标题().get(0)) diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherService.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherService.java index a1c1894c..9c204ed2 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherService.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherService.java @@ -40,7 +40,7 @@ public interface VoucherService { * * @param id 编号 */ - void deleteVoucher(Long id); + void deleteVoucher(Long[] id); /** * 获得会计凭证 diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java index 0f034f25..992fbb0f 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java @@ -118,11 +118,10 @@ public class VoucherServiceImpl implements VoucherService { } @Override - public void deleteVoucher(Long id) { - // 校验存在 - validateVoucherExists(id); + public void deleteVoucher(Long[] id) { + ArrayList listId = new ArrayList(Arrays.asList(id)) ; // 删除 - voucherMapper.deleteById(id); + voucherMapper.deleteBatchIds(listId); } private void validateVoucherExists(Long id) {