Commit 1a7d10f8 by jianan

出账检核总保费

parent 83222b93
...@@ -641,6 +641,28 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -641,6 +641,28 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if (fortuneStatistics.getAvailableOutAmount() == null) { if (fortuneStatistics.getAvailableOutAmount() == null) {
fortuneStatistics.setAvailableOutAmount(BigDecimal.ZERO); fortuneStatistics.setAvailableOutAmount(BigDecimal.ZERO);
} }
// 计算总保费
if (CollectionUtils.isNotEmpty(fortuneIdList)) {
List<Fortune> fortuneList = this.listByIds(fortuneIdList);
Map<String, BigDecimal> exchangeRateMap = new HashMap<>();
for (Fortune fortune : fortuneList) {
exchangeRateMap.put(fortune.getPolicyNo(), fortune.getExchangeRate());
}
Set<String> policyNoSet = fortuneList.stream().map(Fortune::getPolicyNo).collect(Collectors.toSet());
// 查询总保费
List<Policy> policyList = policyService.lambdaQuery().in(Policy::getPolicyNo, policyNoSet).list();
BigDecimal totalPremium = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(policyList)) {
for (Policy policy : policyList) {
BigDecimal exchangeRate = exchangeRateMap.getOrDefault(policy.getPolicyNo(), BigDecimal.ONE);
totalPremium = totalPremium.add(policy.getTotalPaymentPremium().multiply(exchangeRate));
}
fortuneStatistics.setTotalPremium(totalPremium);
}
}
return fortuneStatistics; return fortuneStatistics;
} }
......
...@@ -71,8 +71,7 @@ ...@@ -71,8 +71,7 @@
),0) AS pendingOutAmount, ),0) AS pendingOutAmount,
SUM(CASE WHEN f.status in ('6','1') THEN f.current_payment_hkd_amount ELSE 0 END) AS availableOutAmount, SUM(CASE WHEN f.status in ('6','1') THEN f.current_payment_hkd_amount ELSE 0 END) AS availableOutAmount,
COUNT(DISTINCT f.policy_no) AS totalPolicyCount, COUNT(DISTINCT f.policy_no) AS totalPolicyCount,
MAX(ce.expected_amount) AS totalInAmount, MAX(ce.expected_amount) AS totalInAmount
MAX(ce.premium) AS totalPremium
FROM fortune f FROM fortune f
LEFT JOIN commission_expected ce ON f.commission_expected_biz_id = ce.commission_expected_biz_id LEFT JOIN commission_expected ce ON f.commission_expected_biz_id = ce.commission_expected_biz_id
WHERE 1 = 1 WHERE 1 = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment