Ver código fonte

Merge remote-tracking branch 'origin/master'

syh 5 anos atrás
pai
commit
c7541bad91

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -169,7 +169,8 @@ public class UserAllocationController {
             }
 
             String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)) {
+            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)
+                    && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
             queryWrapper.orderByDesc("create_time");

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanRealTimeLoadJob.java

@@ -35,7 +35,7 @@ public class BytedancePlanRealTimeLoadJob implements Job {
             public void run() {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-                executorService = Executors.newFixedThreadPool(8);
+                executorService = Executors.newFixedThreadPool(4);
                 String nowDate = DateUtils.date2Str();
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {

+ 23 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -11,6 +12,8 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -30,19 +33,22 @@ public class KuaishouNowDateGroupJob implements Job {
 
 
         Thread thread = new Thread() {
+            @SneakyThrows
             @Override
             public void run() {
                 //1:查询当日数据
-                Date nowDate  = DateUtils.getDate();
+                Date endDate  = DateUtils.getDate();
+                String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
+                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+                Date startDate = sim.parse(anotherDay);
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-                executorService = Executors.newFixedThreadPool(8);
+                executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
                             try {
-                                //1:获取全量广告组数据
-                                kuaishouInterfaceService.getGroupList(token, nowDate, nowDate);
+                                kuaishouInterfaceService.getGroupList(token, startDate, endDate);
                             } catch (Exception e) {
                                 e.printStackTrace();
                             } finally {
@@ -58,4 +64,17 @@ public class KuaishouNowDateGroupJob implements Job {
 
 
     }
+
+   /* public static void main(String[] args) throws ParseException {
+        Date nowDate  = DateUtils.getDate();
+        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(nowDate), -1);
+
+
+
+        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+        Date endDate = sim.parse(anotherDay);
+        String s = DateUtils.formatDate(endDate);
+        System.err.println(s);
+
+    }*/
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -1435,7 +1435,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", token.getAccessToken());
-        headers.put("Content-Type", " application/json");
+        headers.put("Content-Type", "application/json");
 
         String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
         JSONObject resultJson = JSONObject.parseObject(result);