Browse Source

清除无用的头条图片报表数据清洗逻辑

syh 4 years ago
parent
commit
000bcf303c

+ 12 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAdvertiserStrategyController.java

@@ -1,5 +1,6 @@
-package cn.com.ctop.kuaishou.modules.ai.controller;
+package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.common.module.utils.QueryGenerator;
@@ -13,7 +14,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
@@ -33,7 +37,8 @@ import java.util.*;
 public class AiKuaishouAdvertiserStrategyController {
 public class AiKuaishouAdvertiserStrategyController {
     @Autowired
     @Autowired
     private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
     private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
-
+    @Autowired
+    private ISysRoleService sysRoleService;
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *
@@ -51,6 +56,11 @@ public class AiKuaishouAdvertiserStrategyController {
                                                                      HttpServletRequest req) {
                                                                      HttpServletRequest req) {
         Result<IPage<AiKuaishouAdvertiserStrategy>> result = new Result<>();
         Result<IPage<AiKuaishouAdvertiserStrategy>> result = new Result<>();
         QueryWrapper<AiKuaishouAdvertiserStrategy> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAdvertiserStrategy, req.getParameterMap());
         QueryWrapper<AiKuaishouAdvertiserStrategy> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAdvertiserStrategy, req.getParameterMap());
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
+        if(!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)){
+            queryWrapper.eq("user_id", user.getId());
+        }
         Page<AiKuaishouAdvertiserStrategy> page = new Page<>(pageNo, pageSize);
         Page<AiKuaishouAdvertiserStrategy> page = new Page<>(pageNo, pageSize);
         queryWrapper.orderByDesc("id");
         queryWrapper.orderByDesc("id");
         IPage<AiKuaishouAdvertiserStrategy> pageList = aiKuaishouAdvertiserStrategyService.page(page, queryWrapper);
         IPage<AiKuaishouAdvertiserStrategy> pageList = aiKuaishouAdvertiserStrategyService.page(page, queryWrapper);

+ 8 - 8
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -95,16 +95,16 @@ spring:
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
       datasource:
-#        master:
-#          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
-#          username: hcst
-#          password: hcst@2020
-#          driver-class-name: com.mysql.jdbc.Driver
         master:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: data
-          password: hcst@2021
+          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+          username: hcst
+          password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
           driver-class-name: com.mysql.jdbc.Driver
+#        master:
+#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          username: data
+#          password: hcst@2021
+#          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   #redis 配置
   redis:
   redis:
     database: 0
     database: 0

+ 2 - 1
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -387,7 +387,8 @@ public class SampleTest {
     private IByteDanceVideoReportDailyService videoReportDailyService;
     private IByteDanceVideoReportDailyService videoReportDailyService;
 
 
     @Test
     @Test
-    public void formatVideoReportData() {
+    synchronized public void formatVideoReportData() {
+
         for (int i = 1; i < 45; i++) {
         for (int i = 1; i < 45; i++) {
             Date getDate = DateUtils.addDay(new Date(), -i);
             Date getDate = DateUtils.addDay(new Date(), -i);
             String date = DateUtils.formatDate(getDate);
             String date = DateUtils.formatDate(getDate);

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
 
-import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -26,6 +25,7 @@ public class AiKuaishouAdvertiserStrategy {
 	private Long id;
 	private Long id;
 	/**账户ID*/
 	/**账户ID*/
 	private Long accountId;
 	private Long accountId;
+	private String userId;
 	/**策略状态 1-使用 0-停用*/
 	/**策略状态 1-使用 0-停用*/
 	private Integer status;
 	private Integer status;
 	/**客户要求的计划名称规范*/
 	/**客户要求的计划名称规范*/

+ 4 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -688,9 +688,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
             //设定网址
             //设定网址
             webDriver.get(KUAISHOU_BE_DOMAIN_HTTPS);
             webDriver.get(KUAISHOU_BE_DOMAIN_HTTPS);
             //显示等待控制对象
             //显示等待控制对象
+            webDriver.findElement(By.className("login-now-btn")).click();
             WebDriverWait webDriverWait = new WebDriverWait(webDriver, 10);
             WebDriverWait webDriverWait = new WebDriverWait(webDriver, 10);
-            webDriverWait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".phone input"))).sendKeys(login.getAccountName());
-            webDriverWait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".password input"))).sendKeys(login.getPassword());
+            webDriverWait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[contains(@type,'text')]"))).sendKeys(login.getAccountName());
+            webDriverWait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[contains(@type,'password')]"))).sendKeys(login.getPassword());
             //点击登录
             //点击登录
             webDriver.findElement(By.className("foot")).click();
             webDriver.findElement(By.className("foot")).click();
             //等待2秒用于页面加载,保证Cookie响应全部获取。
             //等待2秒用于页面加载,保证Cookie响应全部获取。
@@ -711,7 +712,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     }
                     }
                 }
                 }
                 webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
                 webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
-                webDriver.findElement(By.xpath("//div[@class='opArea']/span[@id='submit']")).click();
+                webDriver.findElement(By.xpath("//div[@class='ad-login-comp-btn']")).click();
             }
             }
             Thread.sleep(3000L);
             Thread.sleep(3000L);