syh 4 lat temu
rodzic
commit
108591be52

+ 22 - 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.service.IUserAllocationService;
 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 io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 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.web.bind.annotation.*;
 
@@ -33,7 +37,8 @@ import java.util.*;
 public class AiKuaishouAdvertiserStrategyController {
     @Autowired
     private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
-
+    @Autowired
+    private ISysRoleService sysRoleService;
     /**
      * 分页列表查询
      *
@@ -51,6 +56,11 @@ public class AiKuaishouAdvertiserStrategyController {
                                                                      HttpServletRequest req) {
         Result<IPage<AiKuaishouAdvertiserStrategy>> result = new Result<>();
         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);
         queryWrapper.orderByDesc("id");
         IPage<AiKuaishouAdvertiserStrategy> pageList = aiKuaishouAdvertiserStrategyService.page(page, queryWrapper);
@@ -86,6 +96,16 @@ public class AiKuaishouAdvertiserStrategyController {
     public Result<AiKuaishouAdvertiserStrategy> add(@RequestBody AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy) {
         Result<AiKuaishouAdvertiserStrategy> result = new Result<>();
         try {
+            Long accountId = aiKuaishouAdvertiserStrategy.getAccountId();
+            AiKuaishouAdvertiserStrategy getEntity = aiKuaishouAdvertiserStrategyService.getByAccountId(accountId);
+            if(null!=getEntity){
+                result.error500("该账户配置信息已经被创建");
+                return result;
+            }
+            UserAllocation allocation = allocationService.getByAccountId(accountId);
+            if(null!=allocation){
+                aiKuaishouAdvertiserStrategy.setUserId(allocation.getUserId());
+            }
             Integer singleAppId = aiKuaishouAdvertiserStrategy.getSingleAppid();
             if (null != singleAppId && singleAppId == 1) {
                 Integer appId = Integer.parseInt(JSONArray.parseArray(aiKuaishouAdvertiserStrategy.getAppIdArray()).getString(0));

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

@@ -95,16 +95,16 @@ spring:
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       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:
-          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
+#        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:
     database: 0

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

@@ -387,7 +387,8 @@ public class SampleTest {
     private IByteDanceVideoReportDailyService videoReportDailyService;
 
     @Test
-    public void formatVideoReportData() {
+    synchronized public void formatVideoReportData() {
+
         for (int i = 1; i < 45; i++) {
             Date getDate = DateUtils.addDay(new Date(), -i);
             String date = DateUtils.formatDate(getDate);
@@ -418,11 +419,6 @@ public class SampleTest {
     public void loadBDAccoutData() {
         CtopOauthToken token2 = tokenService.getTokenByAccountId(1674206482908163L);
         bytedanceReportService.bytedanceMaterialReport(token2, "2020-10-14", "2020-10-14");
-        bytedanceReportMaterialDailyMapper.updateImageReportCode();
-        bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
-        bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
-        bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
-        bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
     }
 
     @Resource

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

@@ -1,10 +1,6 @@
 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.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -26,6 +22,8 @@ public class AiKuaishouAdvertiserStrategy {
 	private Long id;
 	/**账户ID*/
 	private Long accountId;
+	private String userId;
+	private Integer channelType;
 	/**策略状态 1-使用 0-停用*/
 	private Integer status;
 	/**客户要求的计划名称规范*/

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAdvertiserStrategyService.java

@@ -11,4 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAiKuaishouAdvertiserStrategyService extends IService<AiKuaishouAdvertiserStrategy> {
 
+    AiKuaishouAdvertiserStrategy getByAccountId(Long accountId);
+
 }

+ 9 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAdvertiserStrategyServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.ai.service.impl;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAdvertiserStrategyMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -15,4 +16,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuaishouAdvertiserStrategyMapper, AiKuaishouAdvertiserStrategy> implements IAiKuaishouAdvertiserStrategyService {
 
+    @Override
+    public AiKuaishouAdvertiserStrategy getByAccountId(Long accountId) {
+        QueryWrapper<AiKuaishouAdvertiserStrategy>queryWrapper =new QueryWrapper<>();
+        queryWrapper.eq("account_id",accountId);
+        queryWrapper.orderByDesc("id");
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

+ 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.findElement(By.className("login-now-btn")).click();
             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();
             //等待2秒用于页面加载,保证Cookie响应全部获取。
@@ -711,7 +712,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     }
                 }
                 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);
 

+ 3 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java

@@ -47,9 +47,9 @@ public interface BytedanceReportMaterialDailyMapper extends BaseMapper<Bytedance
 );
 
     void replaceImageBatch(@Param("infos")List<BytedanceReportMaterialDaily> bytedanceReportImageDailyList);
-    void updateImageReportCode();
-    void updateImageReportProjectId();
-    void updateImageReportProjectName();
+    void updateImageReportCode(@Param("accountId")Long accountId);
+    void updateImageReportProjectId(@Param("accountId")Long accountId);
+    void updateImageReportProjectName(@Param("accountId")Long accountId);
     void updateImageReportPlaneId();
     void updateImageReportPlaneName();
 

+ 3 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -320,17 +320,17 @@
 
     <update id="updateImageReportCode">
         update ctop_bytedance_report_image_daily a inner join ctop_bytedance_image_info image on image.material_id =a.material_id  set a.code = image.signature,a.image_url = image.image_url
-        where a.material_id is not null and a.code is null
+        where a.material_id is not null and a.code is null and a.account_id = #{accountId}
     </update>
 
     <update id="updateImageReportProjectId">
         update ctop_bytedance_report_image_daily a inner join ctop_user_allocation allocation on allocation.account_id =a.account_id  set a.project_id = allocation.project_id
-        where a.account_id is not null and a.project_id is null
+        where a.account_id is not null and a.project_id is null and a.account_id = #{accountId}
     </update>
 
     <update id="updateImageReportProjectName">
         update ctop_bytedance_report_image_daily a inner join ctop_project p on p.id =a.project_id  set a.project_name = p.project_name
-        where a.project_id is not null and a.project_name is null
+        where a.project_id is not null and a.project_name is null and a.account_id = #{accountId}
     </update>
 
     <update id="updateImageReportPlaneId">