|
@@ -9,6 +9,8 @@ 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;
|
|
@@ -17,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;
|
|
@@ -34,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;
|
|
@@ -1742,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();
|
|
|
+ }
|
|
|
|
|
|
}
|