|
|
@@ -827,12 +827,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
String partnerCompanyId = splitArr[0];
|
|
|
String year = splitArr[1];
|
|
|
String month = splitArr[2];
|
|
|
+ String invoiceType = splitArr[3];
|
|
|
List<FollowCompanyFeeVO> voList = entry.getValue();
|
|
|
|
|
|
FollowCompanyFeeVO vo = new FollowCompanyFeeVO();
|
|
|
vo.setPartnerCompanyId(partnerCompanyId);
|
|
|
vo.setYear(year);
|
|
|
vo.setMonth(month);
|
|
|
+ vo.setInvoiceType(invoiceType);
|
|
|
vo.setCompanyName(getCompanyName(partnerCompanyId, companyMap));
|
|
|
|
|
|
// 汇总当前分组所有followId、settlementId
|
|
|
@@ -904,9 +906,16 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 构建分组Key:partnerCompanyId_year_month
|
|
|
+ * 构建分组Key:partnerCompanyId_year_month_invoiceType
|
|
|
*/
|
|
|
private String buildGroupKey(FollowCompanyFeeVO vo) {
|
|
|
+ return StrUtil.format("{}_{}_{}_{}", vo.getPartnerCompanyId(), vo.getYear(), vo.getMonth(), vo.getInvoiceType());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构建分组Key:partnerCompanyId_year_month
|
|
|
+ */
|
|
|
+ private String buildFillGroupKey(FollowCompanyFeeVO vo) {
|
|
|
return StrUtil.format("{}_{}_{}", vo.getPartnerCompanyId(), vo.getYear(), vo.getMonth());
|
|
|
}
|
|
|
|
|
|
@@ -1023,7 +1032,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 现有结果集Key缓存
|
|
|
Map<String, FollowCompanyFeeVO> existVoMap = resultList.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
- this::buildGroupKey,
|
|
|
+ this::buildFillGroupKey,
|
|
|
Function.identity(),
|
|
|
(oldVal, newVal) -> oldVal
|
|
|
));
|
|
|
@@ -3437,7 +3446,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
* @return PtlAgreementCostRatioVo 返回计算后的协议成本比例配置对象,包含各险种的入口比例、手续费比例、跟单费比例等
|
|
|
*/
|
|
|
private PtlAgreementCostRatioVo calRatio(InsPlyIncome insPlyIncome, BatchModifyVo batchModifyVo) {
|
|
|
- log.info("batchModifyVo.转换百分比之前的数据=【{}】", JSONUtil.toJsonStr(batchModifyVo));
|
|
|
+ log.info("batchModifyVo.转换百分比之前的数据=[{}]", JSONUtil.toJsonStr(batchModifyVo));
|
|
|
PtlAgreementCostRatioVo vo = new PtlAgreementCostRatioVo();
|
|
|
vo.setOrderNo(insPlyIncome.getOrderNo());
|
|
|
|
|
|
@@ -3445,7 +3454,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// vo.setJqAdditionalRatio(insPlyIncome.getJqAdditionalRatio());
|
|
|
// vo.setSyAdditionalRatio(insPlyIncome.getSyAdditionalRatio());
|
|
|
// vo.setJyAdditionalRatio(insPlyIncome.getJyAdditionalRatio());
|
|
|
-
|
|
|
+ vo.setJyCommissionRatio(batchModifyVo.getJySuperviseCostsProportion());
|
|
|
+ vo.setJyFollowRatio(batchModifyVo.getJyOtherCostsProportion());
|
|
|
this.calCommissionAndFollowAndInlet(vo, batchModifyVo, insPlyIncome);
|
|
|
|
|
|
// 出口比例
|
|
|
@@ -4525,12 +4535,16 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
.map(InsPlyIncomeInvoiceSettlement::getActualReceivedAmount)
|
|
|
.filter(Objects::nonNull)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- BigDecimal settlementPaymentDifference = insPlyIncomeInvoiceSettlements.stream()
|
|
|
- .map(InsPlyIncomeInvoiceSettlement::getSettlementPaymentDifference)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+// BigDecimal settlementPaymentDifference = insPlyIncomeInvoiceSettlements.stream()
|
|
|
+// .map(InsPlyIncomeInvoiceSettlement::getSettlementPaymentDifference)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
BigDecimal receivableSupervisePremium = action.getReceivableSupervisePremium() != null ? action.getReceivableSupervisePremium(): BigDecimal.ZERO;
|
|
|
+
|
|
|
// BigDecimal overinflatedAmount = action.getOverinflatedAmount() != null? action.getOverinflatedAmount(): BigDecimal.ZERO;
|
|
|
+ // 回款差计算逻辑调整 2026年7月14日09:29:08
|
|
|
+ BigDecimal settlementPaymentDifference = BigDecimalUtil.subtract(settlementAmount,receivableSupervisePremium);
|
|
|
// 待结算金额 = 开票金额 - 已收金额
|
|
|
BigDecimal remainSettlementAmount = receivableSupervisePremium.subtract(BigDecimalUtil.add(settlementAmount, settlementPaymentDifference));
|
|
|
// 设置已结算的金额
|
|
|
@@ -4543,6 +4557,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
action.setRemainSettlementAmount( remainSettlementAmount);
|
|
|
action.setCompanyAllName(allCompanyHierarchyPaths.get(Objects.toString(action.getCompanyId(),"")));
|
|
|
action.setSettlementStatus(settlementStatusName);
|
|
|
+
|
|
|
// 回款差额
|
|
|
action.setSettlementPaymentDifference(settlementPaymentDifference);
|
|
|
|
|
|
@@ -5322,24 +5337,32 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 1. 先将有数据的保险公司进行汇总
|
|
|
// 累计应收金额, 应收手续费(手续费)
|
|
|
List<CompanySuperviseSettlementReportDto> allCompaniesIncomeDatas = baseMapper.queryCumulativeAccountsReceivable(systemCode, queryVo);
|
|
|
-
|
|
|
- // 车险
|
|
|
- if("10".equals(queryVo.getAccountsReceivable())){
|
|
|
- // 默认情况下,superviseFee 得到的就是车险的手续费
|
|
|
- allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().toList();
|
|
|
- }else if("20".equals(queryVo.getAccountsReceivable())){
|
|
|
- allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
|
|
|
- // 统计非车的手续费
|
|
|
- action.setSuperviseFee(action.getSuperviseFee4Other());
|
|
|
- }).toList();
|
|
|
- }else if(StrUtil.isEmpty(queryVo.getAccountsReceivable())){
|
|
|
- // 统计总的手续费
|
|
|
+ // 结算状态在上面的sql进行过筛选了,后面就不再筛选了
|
|
|
+ queryVo.setStatus(null);
|
|
|
+ if("20".equals(queryVo.getAccountsReceivable())){
|
|
|
allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
|
|
|
// 统计非车的手续费
|
|
|
- action.setSuperviseFee(action.getTotalReceivable());
|
|
|
+ action.setSuperviseFee(action.getSuperviseFee4Other());
|
|
|
}).toList();
|
|
|
}
|
|
|
|
|
|
+ // 车险
|
|
|
+// if("10".equals(queryVo.getAccountsReceivable())){
|
|
|
+// // 默认情况下,superviseFee 得到的就是车险的手续费
|
|
|
+// allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().toList();
|
|
|
+// }else if("20".equals(queryVo.getAccountsReceivable())){
|
|
|
+// allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
|
|
|
+// // 统计非车的手续费
|
|
|
+// action.setSuperviseFee(action.getSuperviseFee4Other());
|
|
|
+// }).toList();
|
|
|
+// }else if(StrUtil.isEmpty(queryVo.getAccountsReceivable())){
|
|
|
+// // 统计总的手续费
|
|
|
+//// allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
|
|
|
+//// // 统计非车的手续费
|
|
|
+//// action.setSuperviseFee(action.getTotalReceivable());
|
|
|
+//// }).toList();
|
|
|
+// }
|
|
|
+
|
|
|
// for test, 查看一家公司的数据,将不可变对象变成 可变对象
|
|
|
// allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().filter(action-> "1738811735599338932".equals(action.getCompanyId())).toList();
|
|
|
// allCompaniesIncomeDatas = new ArrayList<>(allCompaniesIncomeDatas);
|