|
|
@@ -26,6 +26,10 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.los.Util.CurrencyUtils;
|
|
|
+import org.springblade.los.business.amends.entity.Amends;
|
|
|
+import org.springblade.los.business.amends.mapper.AmendsMapper;
|
|
|
+import org.springblade.los.business.sea.entity.Bills;
|
|
|
+import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
import org.springblade.los.check.dto.LosAuditProecessDTO;
|
|
|
import org.springblade.los.check.entity.LosAuditPathsActs;
|
|
|
import org.springblade.los.check.entity.LosAuditPathsLevels;
|
|
|
@@ -86,6 +90,10 @@ public class FeeCenterUpdateRecordServiceImpl extends ServiceImpl<FeeCenterUpdat
|
|
|
|
|
|
private final FinPeriodMapper finPeriodMapper;
|
|
|
|
|
|
+ private final BillsMapper billsMapper;
|
|
|
+
|
|
|
+ private final AmendsMapper amendsMapper;
|
|
|
+
|
|
|
private final CurrencyUtils currencyUtils;
|
|
|
|
|
|
@Override
|
|
|
@@ -100,23 +108,50 @@ public class FeeCenterUpdateRecordServiceImpl extends ServiceImpl<FeeCenterUpdat
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
}
|
|
|
FeeCenter feeCenter = feeCenterService.getById(feeCenterUpdateRecord.getItemId());
|
|
|
- String exrateType = currencyUtils.standardCurrency(feeCenter.getBranchId());
|
|
|
if (feeCenter == null) {
|
|
|
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(feeCenter.getBillDate())) {
|
|
|
- LocalDate date = feeCenter.getBillDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
+ 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, feeCenter.getBillDate())
|
|
|
+ .eq(FinPeriod::getBranchId, branchId)
|
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
|
.eq(FinPeriod::getPeriodMonth, month));
|