From cc5cf127da76d03ce7086da4d70f34b20e9803e0 Mon Sep 17 00:00:00 2001
From: admin <1101184511@qq.com>
Date: 星期三, 30 七月 2025 01:57:55 +0800
Subject: [PATCH] 功能完善

---
 src/test/java/com/taoke/autopay/WxUserTests.java |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/src/test/java/com/taoke/autopay/WxUserTests.java b/src/test/java/com/taoke/autopay/WxUserTests.java
index 5d60aa0..4bf546e 100644
--- a/src/test/java/com/taoke/autopay/WxUserTests.java
+++ b/src/test/java/com/taoke/autopay/WxUserTests.java
@@ -1,7 +1,14 @@
 package com.taoke.autopay;
 
+import com.taoke.autopay.dao.WxUserOrderCountMapper;
+import com.taoke.autopay.entity.OrderChannelEnum;
+import com.taoke.autopay.entity.OrderCountTypeEnum;
+import com.taoke.autopay.exception.WxOrderCountException;
+import com.taoke.autopay.service.UserSettingService;
+import com.taoke.autopay.service.WxUserOrderCountService;
 import com.taoke.autopay.service.WxUserService;
 import com.taoke.autopay.utils.Constant;
+import com.taoke.autopay.utils.TimeUtil;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
 
@@ -20,9 +27,51 @@
     @Resource
     private WxUserService wxUserService;
 
+    @Resource
+    private UserSettingService userSettingService;
+
     @Test
-    public void addWxUser(){
+    public void addWxUser() {
 //        wxUserService.login("1231231231231234");
     }
 
+    @Test
+    public void getPercount() {
+        int[] tc = new int[]{1000, 500, 400, 300, 200, 100};
+        for (int t : tc) {
+            System.out.println("============================");
+            System.out.println(t + "=>" + userSettingService.getLimitCountByTotalCount(Constant.ORDER_TYPE_KS, t, OrderChannelEnum.bps));
+        }
+    }
+    @Resource
+    private WxUserOrderCountService wxUserOrderCountService;
+
+    @Resource
+    private WxUserOrderCountMapper wxUserOrderCountMapper;
+
+    @Test
+    public void testAdd() throws WxOrderCountException {
+        long uid = 2L;
+        String day="20240926";
+        OrderChannelEnum orderChannel= OrderChannelEnum.bps;
+        long todayCount = wxUserOrderCountService.sum(uid, null,orderChannel, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT));
+        long totalCount =  wxUserOrderCountService.sum(uid, null,orderChannel,null);
+        int maxPayCount =  userSettingService.getLimitCountByTotalCount(2, totalCount, orderChannel);
+        if(todayCount>=maxPayCount){
+            ;
+        }
+
+//        wxUserOrderCountService.addOrderCount(uid, OrderCountTypeEnum.SUBMIT_TOKEN_COUNT,null, day, 1,null);
+//        wxUserOrderCountService.addOrderCount(uid,null,OrderChannelEnum.bps, day, 1,null);
+//        wxUserOrderCountService.addOrderCount(uid,OrderCountTypeEnum.DY_ORDER_PAY,OrderChannelEnum.bps, day, 1,null);
+    }
+
+    @Test
+    public void test1() throws WxOrderCountException {
+        WxUserOrderCountMapper.DaoQuery daoQuery=new WxUserOrderCountMapper.DaoQuery();
+        daoQuery.uid = 45678942L;
+        System.out.println(wxUserOrderCountMapper.sumOrderCount(daoQuery));
+    }
+
+
 }

--
Gitblit v1.8.0