Bladeren bron

排查飞书消息发送代码逻辑

syh 5 jaren geleden
bovenliggende
commit
c32185ff8a

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/WpsUtil.java

@@ -1,6 +1,6 @@
 package org.jeecg.modules.wps.util;
 
-import org.jeecg.modules.wps.util.file.FileUtil;
+import cn.com.ctop.common.module.file.FileUtil;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.stereotype.Component;
 

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

@@ -2,7 +2,6 @@ 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.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -48,12 +47,14 @@ public class SampleTest {
 
     @Test
     public void testOceanEngineJob() {
-       List<UserAllocation>tokens = userAllocationService.getByParams(107L,null,null);
-       Date startDate = DateUtils.getDate();
-       tokens.forEach(token -> {
-           CtopOauthToken getToken  = oauthTokenService.getTokenByAccountId(token.getAccountId());
-           reportService.getAdvertiserReport(getToken,startDate,startDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-       });
+       CtopOauthToken token = oauthTokenService.getTokenByAccountId(1657505911879694L);
+       CtopOauthToken token1 = oauthTokenService.getTokenByAccountId(1666111623537678L);
+       for(int i=20;i<80;i++){
+           Date startDate = DateUtils.addDay(new Date(),-i);
+           System.out.println(DateUtils.formatDate(startDate));
+           reportService.getAdvertiserReport(token,startDate,startDate,CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
+           reportService.getAdvertiserReport(token1,startDate,startDate,CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
+       }
     }
 
     @Autowired

+ 5 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/AccountWarningServiceImpl.java

@@ -65,13 +65,11 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
                 if (!Check.isNull(nowCost) && nowCost.compareTo(new BigDecimal(0)) != 0) {
                     BigDecimal lastHourCost = hourlyAccountMapper.getCost(accountId, maxHour - 1, statDate);
                     if (!Check.isNull(lastHourCost) && lastHourCost.compareTo(new BigDecimal(0)) != 0) {
-                        if (!Check.isNull(userAllocation)) {
-                            BigDecimal subtract = nowCost.subtract(lastHourCost);
-                            BigDecimal divide = nowCost.divide(lastHourCost, 2, RoundingMode.HALF_UP);
-                            if (subtract.compareTo(warningAmount) > -1 && divide.compareTo(warningProportion) > -1) {
-                                sendMessage(accountId, userAllocation.getAuthName(), maxHour, nowCost, userAllocation.getProjectId(), userAllocation.getProjectName());
-                                sendFeishuMessage(accountId, userAllocation.getAuthName(), maxHour, nowCost, userAllocation.getProjectId(), userAllocation.getProjectName());
-                            }
+                        BigDecimal subtract = nowCost.subtract(lastHourCost);
+                        BigDecimal divide = nowCost.divide(lastHourCost, 2, RoundingMode.HALF_UP);
+                        if (subtract.compareTo(warningAmount) > -1 && divide.compareTo(warningProportion) > -1) {
+                            sendMessage(accountId, userAllocation.getAuthName(), maxHour, nowCost, userAllocation.getProjectId(), userAllocation.getProjectName());
+                            sendFeishuMessage(accountId, userAllocation.getAuthName(), maxHour, nowCost, userAllocation.getProjectId(), userAllocation.getProjectName());
                         }
                     }
                 }