yumeng 1 rok temu
rodzic
commit
6af4c99b8b

+ 16 - 33
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -135,43 +135,26 @@ public class TestController {
     @GetMapping(value = "/getData")
     public void getDate(String startDate, String endDate) throws Exception {
 
+        List<Long> list = new ArrayList<>();
+       list.add(1762865266399262L);
+       list.add(1762865060862030L);
+       list.add(1766565266301966L);
+       list.add(1769112767260813L);
 
-//        Map<Long, Long> itemMap = activityItemListService.getItemMap();
-//        System.err.println(itemMap);
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            JSONObject json = ikuaishouSupplyChainService.seleById(accountId);
+            System.err.println(json);
+            Long id = json.getLong("id");
+            Long accountId1 = json.getLong("accountId");
+            String transferor = json.getString("transferor");
+            String username = json.getString("username");
+            ikuaishouSupplyChainService.updateAllocation(accountId1,transferor,username);
+            ikuaishouSupplyChainService.deleteTraById(id);
 
-        List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
-        if (Check.isNull(cookies)) {
-            log.error("cookie数据为空");
-            return;
         }
-        List<String> days = DateUtils.getDays(startDate, endDate);
-        JSONArray hourList = KuaishouHourEnum.getHourList();
-        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
-        Map<Long, Long> itemMap = activityItemListService.getItemMap();
-        for (int z = 0; z < days.size(); z++) {
-            String date = days.get(z);
-            for (int i = 0; i < hourList.size(); i++) {
-                String hour = hourList.getString(i);
-                for (int j = 0; j < minSecList.size(); j++) {
-                    JSONObject minSecJson = minSecList.getJSONObject(j);
-                    String startTime = minSecJson.getString("startTime");
-                    String endTime = minSecJson.getString("endTime");
-                    String start = date + hour + startTime;
-                    String end = date + hour + endTime;
-                    System.err.println("开始时间:" + start);
-                    System.err.println("结束时间:" + end);
-                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    Long orderCreateTimeStart = sdf.parse(start).getTime();
-                    Long orderCreateTimeEnd = sdf.parse(end).getTime();
-                    for (int p = 0; p < cookies.size(); p++) {
-                        JSONObject cookieJson = cookies.get(p);
-                        String cookie = cookieJson.getString("cookie");
-                        ikuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-                    }
 
-                }
-            }
-        }
+
     }
 
 

+ 26 - 7
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -3,11 +3,10 @@ package org.jeecg;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.OauthAgentToken;
-import cn.com.ctop.common.module.service.IBindAccountLoginService;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IOauthAgentTokenService;
-import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord;
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouUnitLevelOperationRecordMapper;
@@ -111,10 +110,30 @@ public class SampleTest {
     private IOauthAgentTokenService agentTokenService;
     @Autowired
     private KuaiShouDailyAgentMapper agentMapper;
-
+    @Autowired
+    private MailLogMapper mailLogMapper;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private CorpWexinUtils corpWexinUtils;
     @Test
     public void loadKuaishouCookie() throws ParseException {
-        List<Long> appList = new ArrayList<>();
+      //  sendMessageService.sendMessage("461857c245f54ba5813bcb5900a23092","Test");
+
+        StringBuilder text = new StringBuilder();
+        text.append("较昨日同时段消耗预警").append("<br/>")
+                .append("您的项目:" + "测试" + "下的,").append("<br/>")
+                .append("账号:").append(1768734101677063L + ",").append("授权名称为:" + "新拍掌柜-汇创-1户").append("<br/>")
+                .append("账户所属人:" + "苏爽").append("<br/>")
+                .append("相较于昨日 " + 18 + "时").append("<br/>")
+                .append("出现消耗暴涨,").append("消耗金额为:" + 10000).append("<br/>")
+                .append("请您及时查看!");
+        List<JSONObject> wexinIds = mailLogMapper.selectBytaDanceWeiXinIdListByAccountId(1768734101677063L);
+        corpWexinUtils.sendMessage(wexinIds, text.toString());
+
+
+
+      /*  List<Long> appList = new ArrayList<>();
         appList.add(27L);
         appList.add(165893351L);
         for (int i = 0; i < appList.size(); i++) {
@@ -122,7 +141,7 @@ public class SampleTest {
             OauthAgentToken agentToken = agentTokenService.getTokenByAppId(appId);
             System.err.println(agentToken);
            // getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
-        }
+        }*/
     }
 
 

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouSupplyChainMapper.java

@@ -24,4 +24,10 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
     void replaceSettlement(@Param(value = "adds") List<KuaishouSupplyChainSettlement> supplyChains);
 
     List<JSONObject> getDataList(@Param("statDate") Long statDate);
+
+    JSONObject seleById(@Param("accountId") Long accountId);
+
+    int updateAllocation(@Param("accountId1") Long accountId1, @Param("transferor") String transferor, @Param("username") String username);
+
+    void deleteTraById(@Param("id") Long id);
 }

+ 27 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouSupplyChainMapper.xml

@@ -81,6 +81,8 @@
             )
         </foreach>
     </insert>
+
+
     <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">
 
         select  id ,cookie  from ruixuan.kuaishou_supply_chain_cookie
@@ -116,5 +118,30 @@
       where t.itemPrice >= 6
       order by t.validOrderNum desc
     </select>
+    <select id="seleById" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
+        select
+        id,
+        account_id as 'accountId',
+        transferor,
+       (select realname from sys_user where id = t1.transferor) as 'username'
+from ctop_transfer_account t1
+where account_id = #{accountId}
+
+
+  and status in (0, 1)
+
+order by create_time desc limit 1
+    </select>
+
+    <update id="updateAllocation">
+update ctop_user_allocation set user_name = #{username},
+user_id = #{transferor}
+where account_id = #{accountId1}
+    </update>
+
+    <delete id="deleteTraById" parameterType="java.lang.Long">
+        delete from ctop_transfer_account where id = #{id}
+    </delete>
+
 
 </mapper>

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouSupplyChainService.java

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.batch.service;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -21,4 +22,10 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
     void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
 
     List<JSONObject> getDataList(Long statDate);
+
+    JSONObject seleById(Long accountId);
+
+    int updateAllocation( Long accountId1, String transferor, String username);
+
+    void deleteTraById(Long id);
 }

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouSupplyChainServiceImpl.java

@@ -189,6 +189,21 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         return supplyChainMapper.getDataList(statDate);
     }
 
+    @Override
+    public JSONObject seleById(Long accountId) {
+        return supplyChainMapper.seleById(accountId);
+    }
+
+    @Override
+    public int updateAllocation(Long accountId1, String transferor, String username) {
+        return supplyChainMapper.updateAllocation(accountId1,transferor,username);
+    }
+
+    @Override
+    public void deleteTraById(Long id) {
+        supplyChainMapper.deleteTraById(id);
+    }
+
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();
         for (char ch : content.toCharArray()) {