|
|
@@ -802,7 +802,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
Map<String, List<FollowCompanyFeeVO>> followGroupMap = followCompanyFeeVos.stream()
|
|
|
.collect(Collectors.groupingBy(this::buildGroupKey));
|
|
|
|
|
|
- // 【核心优化】提前收集所有需要查询的ID,批量查询,彻底解决循环N+1
|
|
|
+ // 提前收集所有需要查询的ID,批量查询,彻底解决循环N+1
|
|
|
Set<String> allFollowIds = new HashSet<>();
|
|
|
Set<String> allSettlementIds = new HashSet<>();
|
|
|
followGroupMap.values().forEach(list -> {
|
|
|
@@ -841,7 +841,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
BigDecimal receivablePremium = Optional.ofNullable(firstFollow)
|
|
|
.map(InsFeeFollowOrder::getReceivablePremium)
|
|
|
.orElse(BigDecimal.ZERO);
|
|
|
+ // 对账金额
|
|
|
+ BigDecimal reconciliationAmount = Optional.ofNullable(firstFollow)
|
|
|
+ .map(InsFeeFollowOrder::getReconciliationAmount)
|
|
|
+ .orElse(BigDecimal.ZERO);
|
|
|
vo.setTotalReceivable(receivablePremium);
|
|
|
+ vo.setTotalReconciliationAmount(reconciliationAmount);
|
|
|
|
|
|
// 已开票总额
|
|
|
BigDecimal totalInvoiced = followIds.stream()
|
|
|
@@ -850,7 +855,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
.map(InsFeeFollowOrder::getInvoiced)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
vo.setTotalInvoiced(totalInvoiced);
|
|
|
- vo.setTotalUnInvoiced(receivablePremium.subtract(totalInvoiced));
|
|
|
+ // 根据需求,未开票总金额 = 对账金额 - 已开票金额
|
|
|
+ vo.setTotalUnInvoiced(reconciliationAmount.subtract(totalInvoiced));
|
|
|
|
|
|
// 已结算总额
|
|
|
BigDecimal totalSettlementAmount = settlementIds.stream()
|
|
|
@@ -1111,7 +1117,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
platformCompanyFeeVo.setTotalPaymentDifference(BigDecimal.ZERO);
|
|
|
}
|
|
|
//platformCompanyFeeVo.setTotalUnSettlementAmount(BigDecimalUtil.subtract(BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalReceivable(),platformCompanyFeeVo.getTotalSettlementAmount()), platformCompanyFeeVo.getTotalPaymentDifference()));
|
|
|
- platformCompanyFeeVo.setTotalUnSettlementAmount(BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalReceivable(),platformCompanyFeeVo.getTotalSettlementAmount()));
|
|
|
+ platformCompanyFeeVo.setTotalUnSettlementAmount(BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalReceivable(),BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalSettlementAmount(),platformCompanyFeeVo.getTotalPaymentDifference())));
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(settlementReportQueryVo.getStatus())){
|
|
|
if ("1".equals(settlementReportQueryVo.getStatus())){
|
|
|
@@ -3971,12 +3977,31 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
if (StrUtil.isEmpty(search)) {
|
|
|
return true;
|
|
|
}
|
|
|
+ List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
+ HttpResult parentIds = null;
|
|
|
+ if (companyIds.size() <= 2){
|
|
|
+ parentIds = esmInsCompanyClient.getParentIds(companyIds);
|
|
|
+ }
|
|
|
if ("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)) {
|
|
|
- List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
+ if (null != parentIds && parentIds.isSuccess()){
|
|
|
+ List<String> data = (List<String>) parentIds.getData();
|
|
|
+ if (CollUtil.isNotEmpty(data) && data.contains(insPlyIncome.getPartnerCompanyId())){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
return companyIds.contains(insPlyIncome.getPartnerCompanyId());
|
|
|
}
|
|
|
if ("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)) {
|
|
|
- List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
+ if (null != parentIds && parentIds.isSuccess()){
|
|
|
+ List<String> data = (List<String>) parentIds.getData();
|
|
|
+ if (CollUtil.isNotEmpty(data) && !data.contains(insPlyIncome.getPartnerCompanyId())){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
return !companyIds.contains(insPlyIncome.getPartnerCompanyId());
|
|
|
}
|
|
|
return true;
|