Browse Source

Merge remote-tracking branch 'origin/master'

yumeng 1 năm trước cách đây
mục cha
commit
774dc6a82e

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

@@ -1,11 +1,16 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.KuaiShouOcpxActionTypeConfig;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 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.HttpUtils;
+import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.crawler.modules.core.service.CrawlerDouyinMusicTaskService;
 import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
 import cn.com.ctop.kuaishou.modules.batch.Enums.KuaishouHourEnum;
@@ -14,12 +19,26 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
+import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
+import cn.com.ctop.manage.modules.edu.entity.EduLesson;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
+import cn.com.ctop.oa.modules.service.IWechatDepartmentService;
+import cn.com.ctop.oa.modules.service.IWechatNoListService;
+import cn.com.ctop.oa.modules.service.IWechatUserListService;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceVideoEtlInfo;
+import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.enums.NoEn;
 import lombok.extern.slf4j.Slf4j;
@@ -31,6 +50,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
@@ -209,8 +232,8 @@ public class TestController {
 
     }
 
-
-
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
 
 
  /*   @GetMapping(value = "/updateMaterial")
@@ -1601,7 +1624,8 @@ public class TestController {
     private IKuaishouStrategyService kuaishouStrategyService;
     static ExecutorService executorServic1e = Executors.newFixedThreadPool(5);
 
-    *//**
+    */
+    /**
      * 勿动勿删,煜一人群报表数据拉取接口。
      *
      * @param
@@ -1738,17 +1762,142 @@ public class TestController {
             log.info("数据更新完成");
         }
     }
-
+    */
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
 
     @GetMapping("getMaterialListDemo")
-    public void getMaterialList() {
+    public void getMaterialList(Long accountId) {
 
-        CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(1696831659659278L);
-        token.setAccessToken("2d25790930310af270d2160652111ccf263d3b4f");
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, new Date(), new Date());
+        kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, DateUtils.addDay(new Date(), -2), DateUtils.addDay(new Date(), -1));
+        reportDailyGroupService.getAdvertiserGroupReportDaily(token, DateUtils.addDay(new Date(), -2), DateUtils.addDay(new Date(), -1));
+        kuaishouInterfaceService.getAdvertiserReportDaily(token, DateUtils.addDay(new Date(), -2), new Date(), null);
+        kuaishouInterfaceService.getAdvertiserReportHourly(token, new Date(), new Date());
+//        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+//        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+//        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
+//        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
+//        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+//        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), yesterday, yesterday, "HOURLY", 1);
+    }
 
-        advertiserDataService.getMaterialList(token);
-    }*/
+    @Autowired
+    private IKuaiShouGroupService ruleKuaiShouPlanService;
+
+    @GetMapping("execute")
+    public void kuaishouDailyTaoTeAudienceReportAggregationJob(Long id) throws Exception {
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(id);
+        ruleKuaiShouPlanService.getGroupList(token.getAccessToken(), id);
+        ;
+    }
+
+    @GetMapping("kuaishouNowDateGroup")
+    public void kuaishouNowDateGroup(Long id) throws Exception {
+        //1:查询当日数据
+        Date nowDate = new Date();
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(id);
+        kuaishouInterfaceService.getGroupList(token, nowDate, nowDate);
+    }
 
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private IKuaiShouOcpxActionTypeConfigService kuaiShouOcpxActionTypeConfigService;
+
+    //         /test/updateProjectBid
+    @GetMapping("updateProjectBid")
+    public String updateProjectBid() throws Exception {
+
+        List<KuaiShouOcpxActionTypeConfig> list1 = kuaiShouOcpxActionTypeConfigService.list();
+        Map<Integer, String> map = new HashMap<>();
+        for (KuaiShouOcpxActionTypeConfig cf : list1) {
+            map.put(cf.getOcpxActionType(), cf.getOcpxActionName());
+        }
+        /**
+         *[{"maxValue":2000,"ocpxCode":53,"ocpxName":"表单提交"},{"maxValue":2000,"ocpxCode":394,"ocpxName":"订单提交"}]
+         */
+        QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media_id", 2);
+        List<Project> list = projectService.list(queryWrapper);
+        for (Project project : list) {
+            String ocpxActionType = project.getOcpxActionType();
+            JSONArray array = JSONArray.parseArray(ocpxActionType);
+            if ("[0]".equals("ocpxActionType") || Check.isNull(ocpxActionType)) {
+                project.setOcpxActionType("[]");
+            } else if (!Check.isNull(array) && ocpxActionType.length() < 21) {
+                JSONArray ocpxArray = new JSONArray();
+                for (int i = 0; i < array.size(); i++) {
+                    JSONObject ocpx = new JSONObject();
+                    Integer ocpxType = array.getInteger(i);
+                    ocpx.put("ocpxCode", ocpxType);
+                    ocpx.put("ocpxName", map.get(ocpxType));
+                    ocpx.put("maxValue", project.getMaxBid());
+                    ocpxArray.add(ocpx);
+                }
+                if (!ocpxArray.isEmpty()) {
+                    project.setOcpxActionType(ocpxArray.toJSONString());
+                }
+            }
+
+            JSONArray bidArray = JSONArray.parseArray(project.getBidType());
+            if (bidArray == null || !bidArray.contains(2)) {
+                project.setMaxBid(0L);
+            }
+            projectService.saveOrUpdate(project);
+        }
+        return "ok";
+    }
+
+    @Autowired
+    private IRuleKuaiShouPlanService ruleKuaiShouPlanService1;
+    /**
+     * 快手规则引擎定向数据
+     *
+     * @throws Exception
+     */
+    @Autowired
+    private IRuleDataTargetKuaishouService ruleDataTargetKuaishouService;
+
+    @GetMapping("getTargetData")
+    public void getTargetData() throws Exception {
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(10853318L);
+        Map<String, Object> params = new HashMap<>();
+        params.put("account_id", token.getAccountId());
+        ruleDataTargetKuaishouService.removeByMap(params);
+        ruleKuaiShouPlanService1.cleanRuleDataTarget(token.getAccountId(), token.getAccessToken(), 1);
+    }
+
+
+    @Autowired
+    private IWechatDepartmentService wechatDepartmentService;
+    @Autowired
+    private IWechatNoListService wechatNoListService;
+
+    //更新人员和部门
+    @GetMapping("getUser")
+    public void getUser() {
+        //汇创
+        wechatUserInfoService.getUserList();
+    }
+
+    //获取考勤数据
+    @GetMapping("getCheckinData")
+    public void getCheckinData(String start, String end) {
+        wechatCheckinDataService.getCheckinData(start + " 00:00:00", end + " 23:59:59");
+    }
+
+    //获取异常审核数据
+    @GetMapping("getNoList")
+    public void getNoList(String start, String end) {
+        //汇创
+        wechatNoListService.getNoDateByNo(start + " 00:00:00", end + " 23:59:59", "0");
+    }
+
+    @GetMapping("getLiveToken")
+    public void getLiveToken() throws Exception {
+        refreshTokenService.getLiveKuaiShouAgentRefresh();
+    }
 
 }

+ 43 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/RuiXuanBytedanceJob.java

@@ -0,0 +1,43 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 睿选-头条相关定时
+ */
+@Component
+public class RuiXuanBytedanceJob {
+
+    public final static String URL = "http://ruixuan.api.tjyourong.com.cn/bytedance";
+
+    /**
+     * 新增团长活动列表
+     */
+    @XxlJob("bytedanceColonelActivityJob")
+    public void bytedanceColonelActivityJob() throws Exception {
+        HttpUtils.httpGet(URL + "/addBytedanceColonelActivityList", null, null);
+        XxlJobHelper.log(" --------团长活动列表,执行完成-------- ");
+    }
+
+    /**
+     * 新增团长订单
+     */
+    @XxlJob("bytedanceInstituteOrderColonel")
+    public void bytedanceInstituteOrderColonel() throws Exception {
+        String today = DateUtils.date2Str();
+        String yesterday = DateUtils.getLastDay(today, 1);
+        Map<String, Object> paramMap = new HashMap<String, Object>();
+        paramMap.put("startTime", yesterday);
+        paramMap.put("endTime", today);
+        HttpUtils.httpGet(URL + "/addBytedanceInstituteOrderColonel", paramMap, null);
+        XxlJobHelper.log(" --------团长订单列表,执行完成-------- ");
+    }
+}

+ 20 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/CheckPromoterJob.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.stereotype.Component;
+
+/**
+ * 达人补全定时
+ */
+@Component
+public class CheckPromoterJob {
+
+    @XxlJob("checkPromoterJob")
+    public void execute() throws Exception {
+        HttpUtils.httpGet("http://ruixuan.api.tjyourong.com.cn/kuaishou/promoter/supplementInfo", null, null);
+        XxlJobHelper.log(" --------达人补全,执行完成-------- ");
+    }
+}

+ 20 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/CheckPromoterStatusJob.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.stereotype.Component;
+
+/**
+ * 申样达人单品出单大于等于50单  定时任务直接审核通过,无需上传作业
+ */
+@Component
+public class CheckPromoterStatusJob {
+
+    @XxlJob("checkPromoterStatusJob")
+    public void execute() throws Exception {
+        HttpUtils.httpGet("http://ruixuan.api.tjyourong.com.cn/itemCollectSamples/updateStatusToApproved", null, null);
+        XxlJobHelper.log(" --------申样达人单品出单大于等于50单 定时任务直接审核通过,无需上传作业-------- ");
+    }
+}