|
|
@@ -107,35 +107,35 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
|
|
|
BigDecimal allWithdrawn = BigDecimal.ZERO;//已体现
|
|
|
BigDecimal allNotWithdrawn = BigDecimal.ZERO;//未提现
|
|
|
// 查询机构负责人
|
|
|
- List<SysRelationPerson> byUserIdList = this.sysRelationPersonMapper.getByAgencyLeaderId(item.getUserId());
|
|
|
- List<String> collect = byUserIdList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
|
|
|
- if (!collect.isEmpty()) {
|
|
|
+
|
|
|
+ List<SysAgencyLeader> deptLeader = sysAgencyLeaderService.lambdaQuery().eq(SysAgencyLeader::getSuggestId, item.getUserId()).list();
|
|
|
+
|
|
|
// 机构负责人
|
|
|
- List<SysAgencyLeader> deptLeader = sysAgencyLeaderService.getByUserIdList(collect);
|
|
|
- for (SysAgencyLeader itemLeader : deptLeader) {
|
|
|
- String deptId = itemLeader.getDeptId();
|
|
|
- if (StringUtils.isNotEmpty(deptId)) {
|
|
|
- HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId);
|
|
|
- if (orderAmount != null && !orderAmount.isEmpty()) {
|
|
|
- allTotalIncome = this.calculateTotal(orderAmount.get("totalIncome"), allTotalIncome, null); // 总保费
|
|
|
- allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);//机构管理费
|
|
|
- }
|
|
|
- SysUser sysUser = new SysUser();
|
|
|
- sysUser.setDeptId(deptId);
|
|
|
+ for (SysAgencyLeader itemLeader : deptLeader) {
|
|
|
+ String deptId = itemLeader.getDeptId();
|
|
|
+ if (StringUtils.isNotEmpty(deptId)) {
|
|
|
+ String proportional = item.getProportional();
|
|
|
+ HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId);
|
|
|
+
|
|
|
+ if (orderAmount != null && !orderAmount.isEmpty()) {
|
|
|
+ allTotalIncome = this.calculateTotal(orderAmount.get("totalIncome").multiply(new BigDecimal(proportional).divide(new BigDecimal(100))), allTotalIncome, null); // 总保费
|
|
|
+ allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);//机构管理费
|
|
|
+ }
|
|
|
+ SysUser sysUser = new SysUser();
|
|
|
+ sysUser.setDeptId(deptId);
|
|
|
// 机构下的userId
|
|
|
- List<SysUserVO> listByDeptId = sysUserService.findListByDeptId(sysUser);
|
|
|
- List<String> institutionId = listByDeptId.stream().map(SysUserVO::getId).collect(Collectors.toList());
|
|
|
+ List<SysUserVO> listByDeptId = sysUserService.findListByDeptId(sysUser);
|
|
|
+ List<String> institutionId = listByDeptId.stream().map(SysUserVO::getId).collect(Collectors.toList());
|
|
|
// 已提现
|
|
|
- SysAmountAuditingVo sysAmountAuditingVo = new SysAmountAuditingVo();
|
|
|
- sysAmountAuditingVo.setUserIdList(institutionId);
|
|
|
- sysAmountAuditingVo.setAuditingStatus("3");
|
|
|
- BigDecimal withdrawn = sysAmountAuditingService.querySumAmount(sysAmountAuditingVo);
|
|
|
- allWithdrawn = this.calculateTotal(withdrawn, allWithdrawn, null);
|
|
|
+ SysAmountAuditingVo sysAmountAuditingVo = new SysAmountAuditingVo();
|
|
|
+ sysAmountAuditingVo.setUserIdList(institutionId);
|
|
|
+ sysAmountAuditingVo.setAuditingStatus("3");
|
|
|
+ BigDecimal withdrawn = sysAmountAuditingService.querySumAmount(sysAmountAuditingVo);
|
|
|
+ allWithdrawn = this.calculateTotal(withdrawn, allWithdrawn, null);
|
|
|
// 未提现
|
|
|
- sysAmountAuditingVo.setAuditingStatus("2");
|
|
|
- BigDecimal notWithdrawn = sysAmountAuditingService.querySumAmount(sysAmountAuditingVo);
|
|
|
- allNotWithdrawn = this.calculateTotal(notWithdrawn, allNotWithdrawn, null);
|
|
|
- }
|
|
|
+ sysAmountAuditingVo.setAuditingStatus("2");
|
|
|
+ BigDecimal notWithdrawn = sysAmountAuditingService.querySumAmount(sysAmountAuditingVo);
|
|
|
+ allNotWithdrawn = this.calculateTotal(notWithdrawn, allNotWithdrawn, null);
|
|
|
}
|
|
|
}
|
|
|
item.setTotalIncome(allTotalIncome);
|