|
|
@@ -112,124 +112,6 @@ public class FeeCenterUpdateRecordServiceImpl extends ServiceImpl<FeeCenterUpdat
|
|
|
throw new RuntimeException("未查到费用明细");
|
|
|
}
|
|
|
String exrateType = currencyUtils.standardCurrency(feeCenter.getBranchId());
|
|
|
- String branchId;
|
|
|
- Date billDate;
|
|
|
- if ("SE,SI".contains(feeCenter.getBusinessType())) {
|
|
|
- Bills bills = billsMapper.selectById(feeCenter.getPid());
|
|
|
- if (bills == null) {
|
|
|
- throw new RuntimeException("未查到费用明细所在单据信息");
|
|
|
- }
|
|
|
- if ("SE".equals(bills.getBusinessType())) {
|
|
|
- billDate = bills.getEtd();
|
|
|
- } else {
|
|
|
- billDate = bills.getActualEta();
|
|
|
- }
|
|
|
- branchId = bills.getBranchId();
|
|
|
- }else if ("ASE,ASI".contains(feeCenter.getBusinessType())) {
|
|
|
- Amends bills = amendsMapper.selectById(feeCenter.getPid());
|
|
|
- if (bills == null) {
|
|
|
- throw new RuntimeException("未查到费用明细所在单据信息");
|
|
|
- }
|
|
|
- if ("SE".equals(bills.getBusinessType())) {
|
|
|
- billDate = bills.getEtd();
|
|
|
- } else {
|
|
|
- billDate = feeCenter.getBillDate();
|
|
|
- }
|
|
|
- branchId = bills.getBranchId();
|
|
|
- } else {
|
|
|
- throw new RuntimeException("未查到费用明细所在单据信息");
|
|
|
- }
|
|
|
- if ("1,2,3".contains(feeCenter.getAuditStatus())) {
|
|
|
- throw new RuntimeException("费用明细审核未通过");
|
|
|
- }
|
|
|
- if ("5,6".contains(feeCenter.getAuditStatus())) {
|
|
|
- throw new RuntimeException("该条费用明细正在审核中");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotNull(billDate)) {
|
|
|
- LocalDate date = billDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
- int year = date.getYear();
|
|
|
- int month = date.getMonthValue();
|
|
|
- FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
- .eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinPeriod::getBranchId, branchId)
|
|
|
- .eq(FinPeriod::getIsDeleted, 0)
|
|
|
- .eq(FinPeriod::getPeriodYear, year)
|
|
|
- .eq(FinPeriod::getPeriodMonth, month));
|
|
|
- if (finPeriod != null) {
|
|
|
- if (1 == finPeriod.getIsClosed()) {
|
|
|
- throw new RuntimeException(year + "年" + month + "月账期已结转,保存失败");
|
|
|
- }
|
|
|
- if (1 == finPeriod.getLockingStatus()) {
|
|
|
- throw new RuntimeException(year + "年" + month + "月账期已锁定,保存失败");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<FinInvoicesItems> finInvoicesItems = finInvoicesItemsMapper.selectList(new LambdaQueryWrapper<FinInvoicesItems>()
|
|
|
- .eq(FinInvoicesItems::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinInvoicesItems::getIsDeleted, 0)
|
|
|
- .eq(FinInvoicesItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
- if (!finInvoicesItems.isEmpty()) {
|
|
|
- List<Long> finInvoicesIds = finInvoicesItems.stream().map(FinInvoicesItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- String finInvoices = finInvoicesMapper.selectList(new LambdaQueryWrapper<FinInvoices>()
|
|
|
- .eq(FinInvoices::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinInvoices::getIsDeleted, 0)
|
|
|
- .in(FinInvoices::getId, finInvoicesIds)).stream().map(FinInvoices::getBillNo).collect(Collectors.joining(","));
|
|
|
- throw new RuntimeException("账单已生成发票单,撤销失败! 发票单号为:" + finInvoices);
|
|
|
- }
|
|
|
- List<FinStlBillsItems> finStlBillsItemsCHK = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
- .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
- .eq(FinStlBillsItems::getItemType, "CHK")
|
|
|
- .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
- if (!finStlBillsItemsCHK.isEmpty()) {
|
|
|
- List<Long> finStlBillsIds = finStlBillsItemsCHK.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
- .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBills::getIsDeleted, 0)
|
|
|
- .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
- throw new RuntimeException("账单已生成对账单,撤销失败! 对账单号为:" + finStlBills);
|
|
|
- }
|
|
|
- List<FinStlBillsItems> finStlBillsItemsSTLD = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
- .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
- .eq(FinStlBillsItems::getItemType, "STL")
|
|
|
- .eq(FinStlBillsItems::getDc, "D")
|
|
|
- .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
- if (!finStlBillsItemsSTLD.isEmpty()) {
|
|
|
- List<Long> finStlBillsIds = finStlBillsItemsSTLD.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
- .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBills::getIsDeleted, 0)
|
|
|
- .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
- throw new RuntimeException("账单已生成收款单,撤销失败! 收款单号为:" + finStlBills);
|
|
|
- }
|
|
|
- List<FinStlBillsItems> finStlBillsItemsSTLC = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
- .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
- .eq(FinStlBillsItems::getItemType, "STL")
|
|
|
- .eq(FinStlBillsItems::getDc, "C")
|
|
|
- .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
- if (!finStlBillsItemsSTLC.isEmpty()) {
|
|
|
- List<Long> finStlBillsIds = finStlBillsItemsSTLC.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
- .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBills::getIsDeleted, 0)
|
|
|
- .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
- throw new RuntimeException("账单已生成付款单,撤销失败! 付款单号为:" + finStlBills);
|
|
|
- }
|
|
|
- List<FinStlBillsItems> finStlBillsItemsFFSQ = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
- .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
- .eq(FinStlBillsItems::getItemType, "FFSQ")
|
|
|
- .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
- if (!finStlBillsItemsFFSQ.isEmpty()) {
|
|
|
- List<Long> finStlBillsIds = finStlBillsItemsFFSQ.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
- .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinStlBills::getIsDeleted, 0)
|
|
|
- .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
- throw new RuntimeException("账单已付费申请,撤销失败! 付费申请单号为:" + finStlBills);
|
|
|
- }
|
|
|
if ("0".equals(feeCenterUpdateRecord.getType())) {
|
|
|
feeCenter.setAuditStatus("5");
|
|
|
} else {
|
|
|
@@ -250,7 +132,6 @@ public class FeeCenterUpdateRecordServiceImpl extends ServiceImpl<FeeCenterUpdat
|
|
|
if ("0".equals(feeCenterUpdateRecord.getType())) {
|
|
|
// 金额
|
|
|
BigDecimal amount = feeCenterUpdateRecord.getAmountUpdate();
|
|
|
-
|
|
|
//计算字段null值处理
|
|
|
feeCenterUpdateRecord.setQuantityUpdate(ObjectUtils.isNotNull(feeCenterUpdateRecord.getQuantityUpdate()) ? feeCenterUpdateRecord.getQuantityUpdate() : new BigDecimal("0.00"));
|
|
|
feeCenterUpdateRecord.setPriceUpdate(ObjectUtils.isNotNull(feeCenterUpdateRecord.getPriceUpdate()) ? feeCenterUpdateRecord.getPriceUpdate() : new BigDecimal("0.00"));
|
|
|
@@ -405,4 +286,134 @@ public class FeeCenterUpdateRecordServiceImpl extends ServiceImpl<FeeCenterUpdat
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R applyUpdateCheck(FeeCenterUpdateRecord feeCenterUpdateRecord) {
|
|
|
+ if (feeCenterUpdateRecord.getItemId() == null) {
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
+ }
|
|
|
+ FeeCenter feeCenter = feeCenterService.getById(feeCenterUpdateRecord.getItemId());
|
|
|
+ if (feeCenter == null) {
|
|
|
+ throw new RuntimeException("未查到费用明细");
|
|
|
+ }
|
|
|
+ String branchId;
|
|
|
+ Date billDate;
|
|
|
+ if ("SE,SI".contains(feeCenter.getBusinessType())) {
|
|
|
+ Bills bills = billsMapper.selectById(feeCenter.getPid());
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未查到费用明细所在单据信息");
|
|
|
+ }
|
|
|
+ if ("SE".equals(bills.getBusinessType())) {
|
|
|
+ billDate = bills.getEtd();
|
|
|
+ } else {
|
|
|
+ billDate = bills.getActualEta();
|
|
|
+ }
|
|
|
+ branchId = bills.getBranchId();
|
|
|
+ }else if ("ASE,ASI".contains(feeCenter.getBusinessType())) {
|
|
|
+ Amends bills = amendsMapper.selectById(feeCenter.getPid());
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未查到费用明细所在单据信息");
|
|
|
+ }
|
|
|
+ if ("SE".equals(bills.getBusinessType())) {
|
|
|
+ billDate = bills.getEtd();
|
|
|
+ } else {
|
|
|
+ billDate = feeCenter.getBillDate();
|
|
|
+ }
|
|
|
+ branchId = bills.getBranchId();
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("未查到费用明细所在单据信息");
|
|
|
+ }
|
|
|
+ if ("1,2,3".contains(feeCenter.getAuditStatus())) {
|
|
|
+ throw new RuntimeException("费用明细审核未通过");
|
|
|
+ }
|
|
|
+ if ("5,6".contains(feeCenter.getAuditStatus())) {
|
|
|
+ throw new RuntimeException("该条费用明细正在审核中");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(billDate)) {
|
|
|
+ LocalDate date = billDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
+ int year = date.getYear();
|
|
|
+ int month = date.getMonthValue();
|
|
|
+ FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
+ .eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinPeriod::getBranchId, branchId)
|
|
|
+ .eq(FinPeriod::getIsDeleted, 0)
|
|
|
+ .eq(FinPeriod::getPeriodYear, year)
|
|
|
+ .eq(FinPeriod::getPeriodMonth, month));
|
|
|
+ if (finPeriod != null) {
|
|
|
+ if (1 == finPeriod.getIsClosed()) {
|
|
|
+ throw new RuntimeException(year + "年" + month + "月账期已结转,保存失败");
|
|
|
+ }
|
|
|
+ if (1 == finPeriod.getLockingStatus()) {
|
|
|
+ throw new RuntimeException(year + "年" + month + "月账期已锁定,保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<FinInvoicesItems> finInvoicesItems = finInvoicesItemsMapper.selectList(new LambdaQueryWrapper<FinInvoicesItems>()
|
|
|
+ .eq(FinInvoicesItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinInvoicesItems::getIsDeleted, 0)
|
|
|
+ .eq(FinInvoicesItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
+ if (!finInvoicesItems.isEmpty()) {
|
|
|
+ List<Long> finInvoicesIds = finInvoicesItems.stream().map(FinInvoicesItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ String finInvoices = finInvoicesMapper.selectList(new LambdaQueryWrapper<FinInvoices>()
|
|
|
+ .eq(FinInvoices::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinInvoices::getIsDeleted, 0)
|
|
|
+ .in(FinInvoices::getId, finInvoicesIds)).stream().map(FinInvoices::getBillNo).collect(Collectors.joining(","));
|
|
|
+ throw new RuntimeException("账单已生成发票单,撤销失败! 发票单号为:" + finInvoices);
|
|
|
+ }
|
|
|
+ List<FinStlBillsItems> finStlBillsItemsCHK = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
+ .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
+ .eq(FinStlBillsItems::getItemType, "CHK")
|
|
|
+ .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
+ if (!finStlBillsItemsCHK.isEmpty()) {
|
|
|
+ List<Long> finStlBillsIds = finStlBillsItemsCHK.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
+ .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBills::getIsDeleted, 0)
|
|
|
+ .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
+ throw new RuntimeException("账单已生成对账单,撤销失败! 对账单号为:" + finStlBills);
|
|
|
+ }
|
|
|
+ List<FinStlBillsItems> finStlBillsItemsSTLD = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
+ .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
+ .eq(FinStlBillsItems::getItemType, "STL")
|
|
|
+ .eq(FinStlBillsItems::getDc, "D")
|
|
|
+ .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
+ if (!finStlBillsItemsSTLD.isEmpty()) {
|
|
|
+ List<Long> finStlBillsIds = finStlBillsItemsSTLD.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
+ .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBills::getIsDeleted, 0)
|
|
|
+ .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
+ throw new RuntimeException("账单已生成收款单,撤销失败! 收款单号为:" + finStlBills);
|
|
|
+ }
|
|
|
+ List<FinStlBillsItems> finStlBillsItemsSTLC = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
+ .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
+ .eq(FinStlBillsItems::getItemType, "STL")
|
|
|
+ .eq(FinStlBillsItems::getDc, "C")
|
|
|
+ .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
+ if (!finStlBillsItemsSTLC.isEmpty()) {
|
|
|
+ List<Long> finStlBillsIds = finStlBillsItemsSTLC.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
+ .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBills::getIsDeleted, 0)
|
|
|
+ .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
+ throw new RuntimeException("账单已生成付款单,撤销失败! 付款单号为:" + finStlBills);
|
|
|
+ }
|
|
|
+ List<FinStlBillsItems> finStlBillsItemsFFSQ = finStlBillsItemsMapper.selectList(new LambdaQueryWrapper<FinStlBillsItems>()
|
|
|
+ .eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBillsItems::getIsDeleted, 0)
|
|
|
+ .eq(FinStlBillsItems::getItemType, "FFSQ")
|
|
|
+ .eq(FinStlBillsItems::getAccBillId, feeCenter.getAccBillId()));
|
|
|
+ if (!finStlBillsItemsFFSQ.isEmpty()) {
|
|
|
+ List<Long> finStlBillsIds = finStlBillsItemsFFSQ.stream().map(FinStlBillsItems::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ String finStlBills = finStlBillsMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
|
|
|
+ .eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinStlBills::getIsDeleted, 0)
|
|
|
+ .in(FinStlBills::getId, finStlBillsIds)).stream().map(FinStlBills::getBillNo).collect(Collectors.joining(","));
|
|
|
+ throw new RuntimeException("账单已付费申请,撤销失败! 付费申请单号为:" + finStlBills);
|
|
|
+ }
|
|
|
+ return R.data("true");
|
|
|
+ }
|
|
|
+
|
|
|
}
|