Ver código fonte

运营端钱包统计

xucaiqin 2 anos atrás
pai
commit
fc6d9db65e

+ 10 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/operate/OperateWalletController.java

@@ -50,6 +50,16 @@ public class OperateWalletController {
     }
 
 
+    /**
+     * 提现记录 分类统计
+     *
+     * @param cashPageReq
+     * @return
+     */
+    @GetMapping("cashCount")
+    public HttpResult cashCount(CashPageReq cashPageReq) {
+        return HttpResult.ok(walletService.cashCount2(cashPageReq));
+    }
 
     /**
      * 预付列表

+ 44 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java

@@ -882,6 +882,50 @@ public class WalletService {
         return new ArrayList<>();
     }
 
+    /**
+     * 提现分类页签统计
+     *
+     * @param cashPageReq
+     * @return
+     */
+    public Object cashCount2(CashPageReq cashPageReq) {
+        log.info("运营端提现分类页签统计:{}", JSONObject.toJSONString(cashPageReq));
+        List<String> all = walletRelationService.getAll();
+        if (CollectionUtils.isEmpty(all)) {
+            return null;
+        }
+        ChannelEnum channelEnum = null;
+        if (StringUtils.isNotBlank(cashPageReq.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(cashPageReq.getChannel());
+            if (Objects.isNull(channelEnum)) {
+                throw new BusinessException("支付通道不存在");
+            }
+        }
+        List<CashCount> res = new ArrayList<>();
+        List<CashCount> total = new ArrayList<>();
+        for (String uid : all) {
+            R<List<CashCount>> listR = payCenterService.withdrawCategory(uid, channelEnum);
+            if (listR.getStatus()) {
+                List<CashCount> data = listR.getData();
+                if (!CollectionUtils.isEmpty(data)) {
+                    total.addAll(data);
+                }
+            }
+        }
+        Map<String, List<CashCount>> collect = total.stream().collect(Collectors.groupingBy(CashCount::getValue, Collectors.toList()));
+        for (Map.Entry<String, List<CashCount>> map : collect.entrySet()) {
+            Map<String, Long> map1 = collect.get(map.getKey()).stream().collect(Collectors.groupingBy(CashCount::getName, Collectors.summingLong(CashCount::getTotal)));
+            for (Map.Entry<String, Long> one : map1.entrySet()) {
+                CashCount cashCount = new CashCount();
+                cashCount.setName(one.getKey());
+                cashCount.setValue(map.getKey());
+                cashCount.setTotal(one.getValue());
+                res.add(cashCount);
+            }
+        }
+        return res;
+    }
+
     /**
      * 预付记录
      *