From bc56870059cca013649077af0e53891cba8dbfd1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期日, 04 八月 2024 09:43:41 +0800
Subject: [PATCH] 代理新功能完善

---
 src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java b/src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java
index 09e1df1..f60eecf 100644
--- a/src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java
+++ b/src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java
@@ -10,10 +10,7 @@
 import com.taoke.autopay.exception.KeyVerifyException;
 import com.taoke.autopay.exception.WxOrderCountException;
 import com.taoke.autopay.factory.OrderFactory;
-import com.taoke.autopay.service.KeyOrderService;
-import com.taoke.autopay.service.SystemConfigService;
-import com.taoke.autopay.service.WxUserOrderCountService;
-import com.taoke.autopay.service.WxUserSettingService;
+import com.taoke.autopay.service.*;
 import com.taoke.autopay.service.agent.ChannelAgentService;
 import com.taoke.autopay.service.agent.ChannelAgentSharingRatioService;
 import com.taoke.autopay.utils.*;
@@ -56,6 +53,9 @@
 
     @Resource
     private ChannelAgentSharingRatioService channelAgentSharingRatioService;
+
+    @Resource
+    private ClientInfoService clientInfoService;
 
 
     @Override
@@ -193,6 +193,7 @@
         Map<OrderChannelEnum, BigDecimal> shareMoneyMap = channelAgentSharingRatioService.getShareMoneyMap(query.agentId);
         List<ChannelOrderStatistic> channelOrderStatisticList = keyOrderMapper.statisticChannelOrders(query);
         BigDecimal totalMoney = new BigDecimal(0);
+        long totalOrderCount=0;
         for (ChannelOrderStatistic s : channelOrderStatisticList) {
 
             for (OrderChannelEnum channel : OrderChannelEnum.values()) {
@@ -204,11 +205,13 @@
                     break;
                 }
             }
+            totalOrderCount+=s.getCount();
         }
         long userCount = keyOrderMapper.countUser(query);
         ChannelOrderStatistic statistic = new ChannelOrderStatistic();
-        statistic.setCount(userCount);
+        statistic.setUserCount(userCount);
         statistic.setMoney(totalMoney);
+        statistic.setCount(totalOrderCount);
         return statistic;
     }
 
@@ -232,6 +235,15 @@
         if (list == null || list.size() == 0) {
             return null;
         }
+        // 鎺掗櫎閲嶆柊鍒嗛厤鐨勮澶�
+        List<Long> excludeIds =   clientInfoService.getRePayClientIds();
+        for(int i=0;i<list.size();i++){
+            if(excludeIds.contains(list.get(i).getUid())){
+                list.remove(i);
+                i--;
+            }
+        }
+
         // count灏忎簬2鐩存帴瑙嗕负0
         for (OrderDistributeCountInfo info : list) {
             if (info.getCount() < 2) {
@@ -278,7 +290,7 @@
     }
 
     @Override
-    public DYOrderDto verifyKey(String orderNoDesc, String orderStatus, String money) throws KeyVerifyException {
+    public DYOrderDto verifyKey(String orderNoDesc, String orderStatus, String money, Long uid) throws KeyVerifyException {
         int orderType = Constant.ORDER_TYPE_UNKNOWN;
         if (orderNoDesc.contains("鎶栭煶")||orderNoDesc.contains("涓婃捣鏍肩墿鑷村搧")) {
             orderType = Constant.ORDER_TYPE_DY;
@@ -286,6 +298,28 @@
             orderType = Constant.ORDER_TYPE_KS;
         }
 
+        if (uid != null) {
+            WxUserSettings settings = wxUserSettingService.getUserSettings(uid);
+
+            OrderCountTypeEnum orderCountType=OrderCountTypeEnum.SUBMIT_TOKEN_COUNT;
+            switch (orderType){
+                case  Constant.ORDER_TYPE_DY:
+                    orderCountType = OrderCountTypeEnum.DY_ORDER_PAY;
+                    break;
+                case Constant.ORDER_TYPE_KS:
+                    orderCountType = OrderCountTypeEnum.KS_ORDER_PAY;
+                    break;
+            }
+
+            try {
+                wxUserOrderCountService.isOrderCountLimit(uid, orderCountType, TimeUtil.getGernalTime(System.currentTimeMillis(),"yyyy-MM-dd"), 1, settings.getTotalOrderCountPerDay());
+            } catch (WxOrderCountException e) {
+                e.printStackTrace();
+            }
+        }
+
+
+
         String orderNo = "";
         // 鍖归厤杩炵画鐨勬暟瀛�
         Pattern pattern = Pattern.compile("\\d+");

--
Gitblit v1.8.0