From 1f52046a3aa326e686ecc89a258c96047d803731 Mon Sep 17 00:00:00 2001 From: JiilingLee <462362@qq.com> Date: Sun, 8 Oct 2023 13:39:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=AD=E8=AF=81=E6=96=B0=E5=A2=9E=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E5=87=AD=E8=AF=81=E5=8F=B7=E9=87=8D=E5=A4=8D=EF=BC=8C?= =?UTF-8?q?=E5=87=AD=E8=AF=81=E8=AF=A6=E6=83=85=E6=A0=B9=E6=8D=AELineNum?= =?UTF-8?q?=E5=8D=87=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/voucher/VoucherController.java | 8 ++++++++ .../voucherdetails/VoucherDetailsServiceImpl.java | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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 1dd5870b..bcc33321 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 @@ -16,6 +16,8 @@ import java.io.IOException; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -41,6 +43,12 @@ public class VoucherController { @Operation(summary = "创建会计凭证") @PreAuthorize("@ss.hasPermission('accounting:voucher:create')") public CommonResult createVoucher(@Valid @RequestBody VoucherCreateReqVO createReqVO) { + VoucherExportReqVO vo = new VoucherExportReqVO(); + vo.setVoucherNum(createReqVO.getVoucherNum()); + List voucherList = voucherService.getVoucherList(vo); + if (voucherList.size()>0){ + return error("凭证号重复!"); + } return success(voucherService.createVoucher(createReqVO)); } diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java index 36a1fe5f..9dbd9eea 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java @@ -1,10 +1,14 @@ package cn.iocoder.yudao.module.accounting.service.voucherdetails; import org.springframework.stereotype.Service; + import javax.annotation.Resource; + import org.springframework.validation.annotation.Validated; import java.util.*; +import java.util.stream.Collectors; + import cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo.*; import cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -71,7 +75,12 @@ public class VoucherDetailsServiceImpl implements VoucherDetailsService { @Override public PageResult getVoucherDetailsPage(VoucherDetailsPageReqVO pageReqVO) { - return voucherDetailsMapper.selectPage(pageReqVO); + PageResult voucherDetailsDOPageResult = voucherDetailsMapper.selectPage(pageReqVO); + //根据LineNum升序 + List list = voucherDetailsDOPageResult.getList(); + List resultList = list.stream().sorted(Comparator.comparing(VoucherDetailsDO::getLineNum, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList()); + voucherDetailsDOPageResult.setList(resultList); + return voucherDetailsDOPageResult; } @Override