Explorar el Código

1.控制台钱包数据调整

wuhp hace 1 año
padre
commit
ea3417d90e

+ 56 - 26
src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java

@@ -281,39 +281,69 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
         pageVo.setPageSize(deptBalanceVo.getPageSize());
         IPage<SysPartnerConsoleDto> sysUserListPage = deptBalanceMapper.getWalletAgent(page, deptBalanceVo);
         List<SysPartnerConsoleDto> records = sysUserListPage.getRecords();
-        if (!records.isEmpty()) {
+
+        if(deptBalanceVo.getManagementSource().equals("3")){
+            if (!records.isEmpty()) {
+                for (SysPartnerConsoleDto record : records) {
+                    String userId = record.getUserId();
+                    //总收入
+                    BigDecimal sumAmount =BigDecimal.ZERO;
+                    //已提现
+                    BigDecimal ytxAmount =BigDecimal.ZERO;
+                    //提现中
+                    BigDecimal sxAmount =BigDecimal.ZERO;
+                    //未提现
+                    BigDecimal wtxAmount =BigDecimal.ZERO;
+                    MySumAmountQueryDto mySumAmountQueryDto = new MySumAmountQueryDto();
+                    //如果是电销组长,将组员的数据算进来
+                    if ("72".equals(record.getRoleId()) && "3".equals(record.getManagementSource())) {
+                        mySumAmountQueryDto.setGroupFlag(true);
+                        List<String> userList = sysUserService.getGroupByUserId(userId);
+                        //sumAmount= deptBalanceMapper.getDxWalletAgentAmount(userList,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                        SysUserAccount sysUserAccountEntity = sysUserAccountService.getById(record.getUserId());
+                        // 已提现金额   查询历史表中的审核状态为3的数据
+                        ytxAmount = insFeeOrderNewService.findMyAmountYTXmountByDates(record.getUserId(), "3",true,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                        // 提现中
+                        sxAmount = insFeeOrderNewService.findMyAmountYTXmountByDates(record.getUserId(), "2",true,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                        // 可提现
+                        wtxAmount= (sysUserAccountEntity==null || sysUserAccountEntity.getSumAmount()==null)?BigDecimal.ZERO:sysUserAccountEntity.getSumAmount();
+                        //总的 =  已提现金额+  可提现金额 +  提现中
+                        sumAmount = wtxAmount.add(sxAmount).add(ytxAmount);
+                    }
+                    record.setWithdrawn(ytxAmount);
+                    record.setNotWithdrawn(wtxAmount);
+                    record.setTotalIncome(sumAmount);
+                    record.setWithdrawingAmount(sxAmount);
+                }
+            }
+        }else {
             for (SysPartnerConsoleDto record : records) {
                 String userId = record.getUserId();
-                //总收入
-                BigDecimal sumAmount =BigDecimal.ZERO;
-                //已提现
-                BigDecimal ytxAmount =BigDecimal.ZERO;
-                //提现中
-                BigDecimal sxAmount =BigDecimal.ZERO;
-                //未提现
-                BigDecimal wtxAmount =BigDecimal.ZERO;
+                HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getWalletAgentAmount(userId,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+//              总金额
+                if (orderAmount != null && !orderAmount.isEmpty()) {
+                    record.setTotalIncome(orderAmount.get("totalIncome"));
+                }
+//                          已提现
+                BigDecimal ysTXAmount= insFeeOrderNewService.findMyAmountYTXmountByDate(record.getUserId(),"3",deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+//                          未提现
                 MySumAmountQueryDto mySumAmountQueryDto = new MySumAmountQueryDto();
-                //如果是电销组长,将组员的数据算进来
-                if ("72".equals(record.getRoleId()) && "3".equals(record.getManagementSource())) {
-                    mySumAmountQueryDto.setGroupFlag(true);
-                    List<String> userList = sysUserService.getGroupByUserId(userId);
-                    //sumAmount= deptBalanceMapper.getDxWalletAgentAmount(userList,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-                    SysUserAccount sysUserAccountEntity = sysUserAccountService.getById(record.getUserId());
-                    // 已提现金额   查询历史表中的审核状态为3的数据
-                    ytxAmount = insFeeOrderNewService.findMyAmountYTXmountByDates(record.getUserId(), "3",true,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-                    // 提现中
-                    sxAmount = insFeeOrderNewService.findMyAmountYTXmountByDates(record.getUserId(), "2",true,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-                    // 可提现
-                    wtxAmount= (sysUserAccountEntity==null || sysUserAccountEntity.getSumAmount()==null)?BigDecimal.ZERO:sysUserAccountEntity.getSumAmount();
-                    //总的 =  已提现金额+  可提现金额 +  提现中
-                    sumAmount = wtxAmount.add(sxAmount).add(ytxAmount);
+                mySumAmountQueryDto.setAuditstatus("1");
+                SysUserAccount sysUserAccountEntity = sysUserAccountService.getById(record.getUserId());
+                BigDecimal ssKTAmount =BigDecimal.ZERO;
+                BigDecimal txzTXAmount= insFeeOrderNewService.findMyAmountYTXmountByDate(record.getUserId(),"2",deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+
+                if(sysUserAccountEntity!=null){
+                    ssKTAmount = sysUserAccountEntity.getSumAmount()==null?BigDecimal.ZERO: sysUserAccountEntity.getSumAmount();
                 }
-                record.setWithdrawn(ytxAmount);
-                record.setNotWithdrawn(wtxAmount);
+                BigDecimal sumAmount=ysTXAmount.add(ssKTAmount).add(txzTXAmount);
+                record.setWithdrawn(ysTXAmount);
+                record.setNotWithdrawn(ssKTAmount);
                 record.setTotalIncome(sumAmount);
-                record.setWithdrawingAmount(sxAmount);
+                record.setWithdrawingAmount(txzTXAmount);
             }
         }
+
         return sysUserListPage;
     }
 }