|
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
@@ -96,6 +97,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsFeeFollowOrderMapper insFeeFollowOrderMapper;
|
|
private InsFeeFollowOrderMapper insFeeFollowOrderMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsFeeFollowOrderReconciliationMapper insFeeFollowOrderReconciliationMapper;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsPlyFollowInvoiceLinkMapper insPlyFollowInvoiceLinkMapper;
|
|
private InsPlyFollowInvoiceLinkMapper insPlyFollowInvoiceLinkMapper;
|
|
|
|
|
|
|
@@ -324,7 +328,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
List<InsPlyIncomeOrder> res = page.getRecords().stream()
|
|
List<InsPlyIncomeOrder> res = page.getRecords().stream()
|
|
|
.map(action -> new InsPlyIncomeOrder(action.getId(), action.getOrderNo())).toList();
|
|
.map(action -> new InsPlyIncomeOrder(action.getId(), action.getOrderNo())).toList();
|
|
|
BigDecimal totalAmount = page.getRecords().stream()
|
|
BigDecimal totalAmount = page.getRecords().stream()
|
|
|
- .map(action -> new BigDecimal(Objects.toString(action.getJyReceivablePremium(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
+ .map(action -> new BigDecimal(Objects.toString(action.getReceivableAmount(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
InsPlyIncomeVO vo = new InsPlyIncomeVO(null, res,Objects.toString(totalAmount,"0"));
|
|
InsPlyIncomeVO vo = new InsPlyIncomeVO(null, res,Objects.toString(totalAmount,"0"));
|
|
|
log.info("获取私有/平台协议手续费应收列表的id集合。receivableQueryVo=[{}]. ids.size=[{}]", JSONUtil.toJsonStr(receivableQueryVo), CollUtil.size(res));
|
|
log.info("获取私有/平台协议手续费应收列表的id集合。receivableQueryVo=[{}]. ids.size=[{}]", JSONUtil.toJsonStr(receivableQueryVo), CollUtil.size(res));
|
|
@@ -1478,7 +1482,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
default -> null;
|
|
default -> null;
|
|
|
};
|
|
};
|
|
|
// 四舍五入
|
|
// 四舍五入
|
|
|
- return result.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
|
+// return result.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -3762,6 +3767,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public InvoiceingResult followInvoicing(FollowInvoiceVo vo) {
|
|
public InvoiceingResult followInvoicing(FollowInvoiceVo vo) {
|
|
|
log.info("跟单费开票业务开始:参数=[{}]", JSONUtil.toJsonStr(vo));
|
|
log.info("跟单费开票业务开始:参数=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
|
|
+ if (!NumberUtil.isNumber(vo.getTaxPoint())){
|
|
|
|
|
+ throw new SystemException("请输入正确的税点");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 校验明细列表
|
|
// 校验明细列表
|
|
|
List<InsFeeFollowOrderVo> details = vo.getDetails();
|
|
List<InsFeeFollowOrderVo> details = vo.getDetails();
|
|
@@ -3918,10 +3926,10 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
return CollUtil.newArrayList();
|
|
return CollUtil.newArrayList();
|
|
|
}
|
|
}
|
|
|
if (StrUtil.isBlank(followInvoicePageListVo.getSearchList().stream().filter(search -> "signYear".equals(search.getName())).findAny().get().getSearch())){
|
|
if (StrUtil.isBlank(followInvoicePageListVo.getSearchList().stream().filter(search -> "signYear".equals(search.getName())).findAny().get().getSearch())){
|
|
|
- return CollUtil.newArrayList();
|
|
|
|
|
|
|
+ throw new SystemException("请选择年份!");
|
|
|
}
|
|
}
|
|
|
if (!StrUtil.contains(followInvoicePageListVo.getSearchList().stream().filter(search -> "signYear".equals(search.getName())).findAny().get().getSearch(), ",")){
|
|
if (!StrUtil.contains(followInvoicePageListVo.getSearchList().stream().filter(search -> "signYear".equals(search.getName())).findAny().get().getSearch(), ",")){
|
|
|
- return CollUtil.newArrayList();
|
|
|
|
|
|
|
+ throw new SystemException("请选择年份!");
|
|
|
}
|
|
}
|
|
|
FollowInvoicePageListVo.SearchVO searchYear = followInvoicePageListVo.getSearchList().stream().filter(search -> "signYear".equals(search.getName())).findFirst().orElse(new FollowInvoicePageListVo.SearchVO());
|
|
FollowInvoicePageListVo.SearchVO searchYear = followInvoicePageListVo.getSearchList().stream().filter(search -> "signYear".equals(search.getName())).findFirst().orElse(new FollowInvoicePageListVo.SearchVO());
|
|
|
Integer startYear = Integer.parseInt(searchYear.getSearch().split(",")[0]);
|
|
Integer startYear = Integer.parseInt(searchYear.getSearch().split(",")[0]);
|
|
@@ -3949,8 +3957,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
.collect(Collectors.toMap(FollowInvoicePageListVo.SearchVO::getName, Function.identity(), (oldItem, newItem) -> oldItem));
|
|
.collect(Collectors.toMap(FollowInvoicePageListVo.SearchVO::getName, Function.identity(), (oldItem, newItem) -> oldItem));
|
|
|
Set<String> names = searchVOMap.keySet();
|
|
Set<String> names = searchVOMap.keySet();
|
|
|
|
|
|
|
|
- // 保险公司
|
|
|
|
|
- Predicate<InsPlyIncomeDto> companyIdPredicate = insPlyIncome -> {
|
|
|
|
|
|
|
+ // 分支保险公司
|
|
|
|
|
+ Predicate<InsPlyIncomeDto> partnerCompanyIdPredicate = insPlyIncome -> {
|
|
|
if (!names.contains(FollowInvoicePageListVo.SearchVO.companyId)) {
|
|
if (!names.contains(FollowInvoicePageListVo.SearchVO.companyId)) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -3965,21 +3973,21 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}
|
|
}
|
|
|
if ("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)) {
|
|
if ("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)) {
|
|
|
List<String> companyIds = Arrays.asList(search.split(","));
|
|
List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
- return companyIds.contains(insPlyIncome.getCompanyId());
|
|
|
|
|
|
|
+ return companyIds.contains(insPlyIncome.getPartnerCompanyId());
|
|
|
}
|
|
}
|
|
|
if ("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)) {
|
|
if ("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)) {
|
|
|
List<String> companyIds = Arrays.asList(search.split(","));
|
|
List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
- return !companyIds.contains(insPlyIncome.getCompanyId());
|
|
|
|
|
|
|
+ return !companyIds.contains(insPlyIncome.getPartnerCompanyId());
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// AND / OR 组合逻辑(和代码A完全一致)
|
|
// AND / OR 组合逻辑(和代码A完全一致)
|
|
|
if ("and".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
|
|
if ("and".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
|
|
|
- Predicate<InsPlyIncomeDto> and = companyIdPredicate;
|
|
|
|
|
|
|
+ Predicate<InsPlyIncomeDto> and = partnerCompanyIdPredicate;
|
|
|
filterIncomes = incomes.stream().filter(and).toList();
|
|
filterIncomes = incomes.stream().filter(and).toList();
|
|
|
} else if ("or".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
|
|
} else if ("or".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
|
|
|
- Predicate<InsPlyIncomeDto> or = companyIdPredicate;
|
|
|
|
|
|
|
+ Predicate<InsPlyIncomeDto> or = partnerCompanyIdPredicate;
|
|
|
filterIncomes = incomes.stream().filter(or).toList();
|
|
filterIncomes = incomes.stream().filter(or).toList();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -4163,6 +4171,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
String partnerCompanyId,
|
|
String partnerCompanyId,
|
|
|
Map<Integer, BigDecimal> monthReceivableMap,
|
|
Map<Integer, BigDecimal> monthReceivableMap,
|
|
|
Map<String, BigDecimal> invoicedMap) {
|
|
Map<String, BigDecimal> invoicedMap) {
|
|
|
|
|
+
|
|
|
|
|
+ String systemCode = baseController.getSystemCode();
|
|
|
// 获取当月应收保费,默认为0
|
|
// 获取当月应收保费,默认为0
|
|
|
BigDecimal receivable = monthReceivableMap.getOrDefault(month, BigDecimal.ZERO);
|
|
BigDecimal receivable = monthReceivableMap.getOrDefault(month, BigDecimal.ZERO);
|
|
|
// 获取当月已开票金额,默认为0
|
|
// 获取当月已开票金额,默认为0
|
|
@@ -4185,6 +4195,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
queryWrapper.eq("year", year)
|
|
queryWrapper.eq("year", year)
|
|
|
.eq("month", month)
|
|
.eq("month", month)
|
|
|
.eq("partner_company_id", partnerCompanyId)
|
|
.eq("partner_company_id", partnerCompanyId)
|
|
|
|
|
+ .eq("system_code", systemCode)
|
|
|
.last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
|
|
.last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
|
|
|
InsFeeFollowOrder dbOrder = insFeeFollowOrderMapper.selectOne(queryWrapper);
|
|
InsFeeFollowOrder dbOrder = insFeeFollowOrderMapper.selectOne(queryWrapper);
|
|
|
if (dbOrder != null) {
|
|
if (dbOrder != null) {
|
|
@@ -4196,10 +4207,23 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 现在按wwq的要求改成:未开票金额 = 对账金额 - 已开票金额
|
|
// 现在按wwq的要求改成:未开票金额 = 对账金额 - 已开票金额
|
|
|
vo.setUninvoiced(dbOrder.getReconciliationAmount().subtract(invoiced));
|
|
vo.setUninvoiced(dbOrder.getReconciliationAmount().subtract(invoiced));
|
|
|
} else {
|
|
} else {
|
|
|
- // 数据库无记录,使用默认值或DTO里的值
|
|
|
|
|
- vo.setReconciliationAmount(null);
|
|
|
|
|
- vo.setFalselyIncreasedDifference(null);
|
|
|
|
|
- vo.setFalselyIncreasedReason(null);
|
|
|
|
|
|
|
+ QueryWrapper<InsFeeFollowOrderReconciliation> insFeeFollowOrderReconciliationQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ insFeeFollowOrderReconciliationQueryWrapper.eq("year", year)
|
|
|
|
|
+ .eq("month", month)
|
|
|
|
|
+ .eq("partner_company_id", partnerCompanyId)
|
|
|
|
|
+ .eq("system_code", systemCode)
|
|
|
|
|
+ .last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
|
|
|
|
|
+ InsFeeFollowOrderReconciliation insFeeFollowOrderReconciliation = insFeeFollowOrderReconciliationMapper.selectOne(insFeeFollowOrderReconciliationQueryWrapper);
|
|
|
|
|
+ if (null != insFeeFollowOrderReconciliation){
|
|
|
|
|
+ vo.setReconciliationAmount(insFeeFollowOrderReconciliation.getReconciliationAmount());
|
|
|
|
|
+ vo.setFalselyIncreasedDifference(insFeeFollowOrderReconciliation.getFalselyIncreasedDifference());
|
|
|
|
|
+ vo.setFalselyIncreasedReason(insFeeFollowOrderReconciliation.getFalselyIncreasedReason());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ // 数据库无记录,使用默认值或DTO里的值
|
|
|
|
|
+ vo.setReconciliationAmount(null);
|
|
|
|
|
+ vo.setFalselyIncreasedDifference(null);
|
|
|
|
|
+ vo.setFalselyIncreasedReason(null);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|
|
@@ -4422,7 +4446,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
BigDecimal receivableSupervisePremium = action.getReceivableSupervisePremium() != null ? action.getReceivableSupervisePremium(): BigDecimal.ZERO;
|
|
BigDecimal receivableSupervisePremium = action.getReceivableSupervisePremium() != null ? action.getReceivableSupervisePremium(): BigDecimal.ZERO;
|
|
|
// BigDecimal overinflatedAmount = action.getOverinflatedAmount() != null? action.getOverinflatedAmount(): BigDecimal.ZERO;
|
|
// BigDecimal overinflatedAmount = action.getOverinflatedAmount() != null? action.getOverinflatedAmount(): BigDecimal.ZERO;
|
|
|
// 待结算金额 = 开票金额 - 已收金额
|
|
// 待结算金额 = 开票金额 - 已收金额
|
|
|
- BigDecimal remainSettlementAmount = receivableSupervisePremium.subtract(settlementAmount);
|
|
|
|
|
|
|
+ BigDecimal remainSettlementAmount = receivableSupervisePremium.subtract(BigDecimalUtil.add(settlementAmount, settlementPaymentDifference));
|
|
|
// 设置已结算的金额
|
|
// 设置已结算的金额
|
|
|
action.setSettlementAmount(settlementAmount);
|
|
action.setSettlementAmount(settlementAmount);
|
|
|
// 设置待结算金额
|
|
// 设置待结算金额
|
|
@@ -5366,7 +5390,11 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
List<CalRes> sxfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), CollUtil.newArrayList("1", "3"));
|
|
List<CalRes> sxfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), CollUtil.newArrayList("1", "3"));
|
|
|
List<CalRes> gdfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), CollUtil.newArrayList("2", "4"));
|
|
List<CalRes> gdfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), CollUtil.newArrayList("2", "4"));
|
|
|
Map<String, BigDecimal> sxfSettledAmountMap = CollUtil.isNotEmpty(sxfList) ? sxfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getSettlement, (o1,o2)->o1)) : new HashMap<>();
|
|
Map<String, BigDecimal> sxfSettledAmountMap = CollUtil.isNotEmpty(sxfList) ? sxfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getSettlement, (o1,o2)->o1)) : new HashMap<>();
|
|
|
|
|
+ // 手续费的回款差额汇总
|
|
|
|
|
+ Map<String, BigDecimal> sxfSettledDiffAmountMap = CollUtil.isNotEmpty(sxfList) ? sxfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getOverinflatedAmount, (o1,o2)->o1)) : new HashMap<>();
|
|
|
Map<String, BigDecimal> gdfSettledAmountMap = CollUtil.isNotEmpty(gdfList) ? gdfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getSettlement, (o1,o2)->o1)) : new HashMap<>();
|
|
Map<String, BigDecimal> gdfSettledAmountMap = CollUtil.isNotEmpty(gdfList) ? gdfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getSettlement, (o1,o2)->o1)) : new HashMap<>();
|
|
|
|
|
+ // 跟单费的回款差额汇总
|
|
|
|
|
+ Map<String, BigDecimal> gdfSettledDiffAmountMap = CollUtil.isNotEmpty(gdfList) ? gdfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getOverinflatedAmount, (o1,o2)->o1)) : new HashMap<>();
|
|
|
|
|
|
|
|
// 计算已开票和未开票
|
|
// 计算已开票和未开票
|
|
|
for (String companyId : companyMap.keySet()) {
|
|
for (String companyId : companyMap.keySet()) {
|
|
@@ -5383,16 +5411,17 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
|
|
CompanySuperviseSettlementReportDto dto;
|
|
CompanySuperviseSettlementReportDto dto;
|
|
|
dto = companyMap.get(companyId);
|
|
dto = companyMap.get(companyId);
|
|
|
- companySuperviseSettlementReportDto.setSxfUnInvoicedAmount(BigDecimalUtil.subtract(new BigDecimal(dto.getSuperviseFee()),sxf).toString());
|
|
|
|
|
- companySuperviseSettlementReportDto.setGdfUnInvoicedAmount(BigDecimalUtil.subtract(new BigDecimal(dto.getFollowFee()),gdf).toString());
|
|
|
|
|
|
|
+ companySuperviseSettlementReportDto.setSxfUnInvoicedAmount(BigDecimalUtil.subtract(new BigDecimal(dto.getSuperviseFee()),BigDecimalUtil.subtract(sxf, new BigDecimal(dto.getTotalOverinflatedAmount()))).toString());
|
|
|
|
|
+ companySuperviseSettlementReportDto.setGdfUnInvoicedAmount(BigDecimalUtil.subtract(new BigDecimal(dto.getFollowFee()),BigDecimalUtil.subtract(gdf,new BigDecimal(dto.getTotalOverinflatedAmount()))).toString());
|
|
|
companySuperviseSettlementReportDto.setPtUnInvoicedAmount(BigDecimal.ZERO.toString());
|
|
companySuperviseSettlementReportDto.setPtUnInvoicedAmount(BigDecimal.ZERO.toString());
|
|
|
|
|
|
|
|
BigDecimal sxfS = sxfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal sxfS = sxfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
BigDecimal gdfS = gdfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal gdfS = gdfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
BigDecimal overinflatedAmount = sxfOverinflatedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal overinflatedAmount = sxfOverinflatedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
companySuperviseSettlementReportDto.setSxfSettledAmount(Objects.toString(sxfS, BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setSxfSettledAmount(Objects.toString(sxfS, BigDecimal.ZERO+""));
|
|
|
- companySuperviseSettlementReportDto.setSxfUnSettledAmount(BigDecimalUtil.subtract(sxf,sxfS).toString());
|
|
|
|
|
|
|
+ companySuperviseSettlementReportDto.setSxfUnSettledAmount(BigDecimalUtil.subtract(sxf,BigDecimalUtil.add(sxfS,sxfSettledDiffAmountMap.getOrDefault(companyId, BigDecimal.ZERO))).toString());
|
|
|
companySuperviseSettlementReportDto.setTotalOverinflatedAmount(Objects.toString(overinflatedAmount, BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setTotalOverinflatedAmount(Objects.toString(overinflatedAmount, BigDecimal.ZERO+""));
|
|
|
|
|
+ companySuperviseSettlementReportDto.setSettlementPaymentDifference(Objects.toString(sxfSettledDiffAmountMap.getOrDefault(companyId, BigDecimal.ZERO)) );
|
|
|
|
|
|
|
|
companySuperviseSettlementReportDto.setGdfSettledAmount(Objects.toString(gdfS, BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setGdfSettledAmount(Objects.toString(gdfS, BigDecimal.ZERO+""));
|
|
|
companySuperviseSettlementReportDto.setGdfUnSettledAmount(BigDecimalUtil.subtract(gdf,gdfS).toString());
|
|
companySuperviseSettlementReportDto.setGdfUnSettledAmount(BigDecimalUtil.subtract(gdf,gdfS).toString());
|
|
@@ -5551,6 +5580,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
tree.putExtra("gdfSettledAmount",dto.getGdfSettledAmount());
|
|
tree.putExtra("gdfSettledAmount",dto.getGdfSettledAmount());
|
|
|
tree.putExtra("gdfUnSettledAmount",dto.getGdfUnSettledAmount());
|
|
tree.putExtra("gdfUnSettledAmount",dto.getGdfUnSettledAmount());
|
|
|
tree.putExtra("totalOverinflatedAmount",dto.getTotalOverinflatedAmount());
|
|
tree.putExtra("totalOverinflatedAmount",dto.getTotalOverinflatedAmount());
|
|
|
|
|
+ tree.putExtra("settlementPaymentDifference",dto.getSettlementPaymentDifference());
|
|
|
});
|
|
});
|
|
|
log.info("树形结构构建:一级数据[{}]个", CollUtil.size(build));
|
|
log.info("树形结构构建:一级数据[{}]个", CollUtil.size(build));
|
|
|
return build;
|
|
return build;
|
|
@@ -5948,6 +5978,19 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
String userName = baseController.getUserName();
|
|
String userName = baseController.getUserName();
|
|
|
String systemCode = baseController.getSystemCode();
|
|
String systemCode = baseController.getSystemCode();
|
|
|
log.info("租户[{}]下的用户[{}]标识发票[{}]为结算完成", systemCode, userName, invoiceId);
|
|
log.info("租户[{}]下的用户[{}]标识发票[{}]为结算完成", systemCode, userName, invoiceId);
|
|
|
|
|
+
|
|
|
|
|
+ List<InsPlyIncomeInvoiceSettlement> insPlyIncomeInvoiceSettlements = insPlyIncomeInvoiceSettlementMapper.querySettlementRecent(invoiceId);
|
|
|
|
|
+ InsPlyIncomeInvoice insPlyIncomeInvoice = insPlyIncomeInvoiceMapper.selectById(invoiceId);
|
|
|
|
|
+
|
|
|
|
|
+ // 标记结算完成的时候,将未结算金额汇总 到最后一次结算的回款差额里面 lipf 2026年7月7日10:53:47
|
|
|
|
|
+ BigDecimal settlementAmount = insPlyIncomeInvoiceSettlements.stream().map(action-> BigDecimalUtil.add(action.getSettlementPaymentDifference(), action.getActualReceivedAmount()))
|
|
|
|
|
+ .reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
+ BigDecimal subtract = BigDecimalUtil.subtract(insPlyIncomeInvoice.getReceivableSupervisePremium(), settlementAmount);
|
|
|
|
|
+ if(subtract.compareTo(BigDecimal.ZERO) != 0){
|
|
|
|
|
+ InsPlyIncomeInvoiceSettlement insPlyIncomeInvoiceSettlement = insPlyIncomeInvoiceSettlements.get(0);
|
|
|
|
|
+ insPlyIncomeInvoiceSettlement.setSettlementPaymentDifference(BigDecimalUtil.add(subtract,insPlyIncomeInvoiceSettlement.getSettlementPaymentDifference()));
|
|
|
|
|
+ insPlyIncomeInvoiceSettlementMapper.updateById(insPlyIncomeInvoiceSettlement);
|
|
|
|
|
+ }
|
|
|
return insPlyIncomeInvoiceMapper.update(null, new LambdaUpdateWrapper<InsPlyIncomeInvoice>()
|
|
return insPlyIncomeInvoiceMapper.update(null, new LambdaUpdateWrapper<InsPlyIncomeInvoice>()
|
|
|
.set(InsPlyIncomeInvoice::getStatus,"1")
|
|
.set(InsPlyIncomeInvoice::getStatus,"1")
|
|
|
.set(InsPlyIncomeInvoice::getUpdateBy,userName)
|
|
.set(InsPlyIncomeInvoice::getUpdateBy,userName)
|