|
|
@@ -217,6 +217,36 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
|
|
|
.eq(SysRelationPerson::getType, 1));
|
|
|
item.setIndirectStudio(indirectStudioList.size());
|
|
|
|
|
|
+
|
|
|
+ List<String> userIds1 = getUserIds(sysRelationPersonList2);
|
|
|
+ BigDecimal sumPremium1 = BigDecimal.ZERO;
|
|
|
+ BigDecimal extractFee1 = BigDecimal.ZERO;
|
|
|
+ if (CollectionUtil.isNotEmpty(userIds1)) {
|
|
|
+ for (String id : userIds1) {
|
|
|
+ //费用
|
|
|
+ List<SysPremiumDetails> sysPremiumDetail = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>()
|
|
|
+ .eq(SysPremiumDetails::getUserId, userId)
|
|
|
+ .eq(SysPremiumDetails::getIssuerId,id)
|
|
|
+ .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
|
|
|
+ SysPremiumDetails::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
|
|
|
+ .eq(SysPremiumDetails::getStatus, 1)
|
|
|
+ .eq(deptBalanceVo.getIndustrySector() != null, SysPremiumDetails::getIndustrySector, deptBalanceVo.getIndustrySector()));
|
|
|
+
|
|
|
+ if (CollectionUtil.isNotEmpty(sysPremiumDetail)) {
|
|
|
+ Map<String, List<SysPremiumDetails>> map = sysPremiumDetail.stream().sorted(Comparator.comparing(SysPremiumDetails::getId))
|
|
|
+ .collect(Collectors.groupingBy(SysPremiumDetails::getCompanyId));
|
|
|
+ for (String s : map.keySet()) {
|
|
|
+ List<SysPremiumDetails> sysPremiumDetails1 = map.get(s);
|
|
|
+ sumPremium1 = sumPremium1.add(sysPremiumDetails1.get(0).getSumpremium());
|
|
|
+ }
|
|
|
+
|
|
|
+// sumPremium1 = sumPremium1.add(sysPremiumDetail.get(0).getSumpremium());
|
|
|
+ extractFee1 = extractFee1.add(sysPremiumDetail.stream().map(SysPremiumDetails::getExtractFee).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.setTotalIncome(sumPremium1);
|
|
|
+ item.setCommission(extractFee1);
|
|
|
if (sysRelationPersonList2.size() > 0) {
|
|
|
List<String> ids = sysRelationPersonList2.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
|
|
|
List<SysAgencyLeader> leaderList = sysAgencyLeaderMapper.selectList(new LambdaQueryWrapper<SysAgencyLeader>()
|
|
|
@@ -358,6 +388,19 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
|
|
|
mySumAmountQueryDto.setGroupFlag(true);
|
|
|
}
|
|
|
|
|
|
+ deptBalanceVo.setUserId(record.getUserId());
|
|
|
+ HashMap<String, BigDecimal> incomeIndication = deptBalanceMapper.getIncomeIndication(deptBalanceVo);
|
|
|
+
|
|
|
+ if(incomeIndication!=null){
|
|
|
+ if(deptBalanceVo.getManagementSource().equals("2")){
|
|
|
+ record.setTotalIncome(incomeIndication.get("totalAmount"));
|
|
|
+ }else {
|
|
|
+ record.setTotalIncome(BigDecimalUtils.nullToZero(incomeIndication.get("totalAmount")).divide(new BigDecimal(10)));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ record.setTotalIncome(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
//如果是电销组长,将组员的数据算进来
|
|
|
mySumAmountQueryDto.setGroupFlag(true);
|
|
|
List<String> userList = sysUserService.getGroupByUserId(userId);
|
|
|
@@ -373,7 +416,7 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
|
|
|
sumAmount = wtxAmount.add(sxAmount).add(ytxAmount);
|
|
|
record.setWithdrawn(ytxAmount);
|
|
|
record.setNotWithdrawn(wtxAmount);
|
|
|
- record.setTotalIncome(sumAmount);
|
|
|
+// record.setTotalIncome(sumAmount);
|
|
|
record.setWithdrawingAmount(sxAmount);
|
|
|
}
|
|
|
}
|