凭证新增校验凭证号重复,凭证详情根据LineNum升序

new
JiilingLee 1 year ago
parent 9cca34a28c
commit 1f52046a3a

@ -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<Long> createVoucher(@Valid @RequestBody VoucherCreateReqVO createReqVO) {
VoucherExportReqVO vo = new VoucherExportReqVO();
vo.setVoucherNum(createReqVO.getVoucherNum());
List<VoucherDO> voucherList = voucherService.getVoucherList(vo);
if (voucherList.size()>0){
return error("凭证号重复!");
}
return success(voucherService.createVoucher(createReqVO));
}

@ -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<VoucherDetailsDO> getVoucherDetailsPage(VoucherDetailsPageReqVO pageReqVO) {
return voucherDetailsMapper.selectPage(pageReqVO);
PageResult<VoucherDetailsDO> voucherDetailsDOPageResult = voucherDetailsMapper.selectPage(pageReqVO);
//根据LineNum升序
List<VoucherDetailsDO> list = voucherDetailsDOPageResult.getList();
List<VoucherDetailsDO> resultList = list.stream().sorted(Comparator.comparing(VoucherDetailsDO::getLineNum, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
voucherDetailsDOPageResult.setList(resultList);
return voucherDetailsDOPageResult;
}
@Override

Loading…
Cancel
Save