Commit c278d1d0 by zhangxingmin

Merge remote-tracking branch 'origin/test' into test

parents 80590225 1a7d10f8
......@@ -641,6 +641,28 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if (fortuneStatistics.getAvailableOutAmount() == null) {
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;
}
......
......@@ -71,8 +71,7 @@
),0) AS pendingOutAmount,
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,
MAX(ce.expected_amount) AS totalInAmount,
MAX(ce.premium) AS totalPremium
MAX(ce.expected_amount) AS totalInAmount
FROM fortune f
LEFT JOIN commission_expected ce ON f.commission_expected_biz_id = ce.commission_expected_biz_id
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