Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
#	pom.xml
yumeng 4 лет назад
Родитель
Сommit
320e9d4d6b
34 измененных файлов с 290 добавлено и 174 удалено
  1. 5 0
      jeecg-boot-module-system/pom.xml
  2. 37 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  3. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  4. 1 1
      jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml
  5. 1 1
      jeecg-boot-module-system/src/main/resources/application-preprod.yml
  6. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  7. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  8. 1 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  9. 0 1
      jeecg-boot-module-system/src/main/resources/application.yml
  10. BIN
      jeecg-boot-module-system/src/main/resources/lib/opencv-4.2.0.jar
  11. 0 1
      jeecg-boot-module-system/src/main/resources/static/demo1.html
  12. 24 22
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  13. 2 13
      module-common/pom.xml
  14. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java
  15. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  16. 4 4
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  17. BIN
      module-common/src/main/resources/lib/jave-1.0.jar
  18. 1 1
      module-job-bytedance/src/main/resources/application-dev.yml
  19. 1 1
      module-job-bytedance/src/main/resources/application-jiaoyang.yml
  20. 1 1
      module-job-bytedance/src/main/resources/application-prod.yml
  21. 51 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAutoSynchronousProjectMaterialJob.java
  22. 16 6
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java
  23. 9 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java
  24. 4 3
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java
  25. 0 46
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java
  26. 1 1
      module-job-kuaishou/src/main/resources/application-jiaoyang.yml
  27. 1 1
      module-job-kuaishou/src/main/resources/application-preprod.yml
  28. 1 1
      module-job-kuaishou/src/main/resources/application-prod.yml
  29. 33 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  30. 29 28
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java
  31. 2 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouYiCheReportController.java
  32. 49 19
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml
  33. 1 1
      module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json
  34. 2 2
      pom.xml

+ 5 - 0
jeecg-boot-module-system/pom.xml

@@ -161,6 +161,8 @@
             <groupId>cn.com.ctop</groupId>
             <artifactId>opencv</artifactId>
             <version>4.2.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/opencv-4.2.0.jar</systemPath>
         </dependency>
         <dependency>
             <groupId>com.github.pagehelper</groupId>
@@ -208,6 +210,9 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
             </plugin>
         </plugins>
         <resources>

+ 37 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -9,7 +9,12 @@ import cn.com.ctop.common.module.service.IBindAccountAuthService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.ISysDepartService;
 import cn.com.ctop.common.module.service.ISysUserService;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
@@ -36,7 +41,10 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Slf4j
 @RestController
@@ -59,6 +67,8 @@ public class CallbackController {
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
     private IReportService reportService;
+    @Autowired
+    private IKuaishouAppPackageService kuaishouAppPackageService;
 
     @GetMapping("/qywexin")
     public void qywexin(HttpServletRequest request,
@@ -152,6 +162,10 @@ public class CallbackController {
                     BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
                     BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
+                    Integer autoDelivery = json.getInteger("autoDelivery");
+                    String materialTypeStr = json.getString("materialType");
+                    //物料类型,0-不同步,1应用包,(2人群包,3定向包)
+                    JSONArray materialTypeArr = json.getJSONArray("materialType");
 
                     CtopOauthToken topOauthToken = new CtopOauthToken();
                     topOauthToken.setId(String.valueOf(accountId));
@@ -197,15 +211,20 @@ public class CallbackController {
                     userAllocation.setWarningAmount(warningAmount);
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
+                    //自动投放,0关闭,1开启
+                    userAllocation.setAutoDelivery(autoDelivery);
+                    userAllocation.setMaterialType(materialTypeStr);
                     allocationMapper.deleteById(userAllocation.getId());
                     Map<String, Object> deleteUserMap = new HashMap<>();
                     deleteUserMap.put("advertiser_id", advertiserId);
                     deleteUserMap.put("account_id", accountId);
                     allocationMapper.deleteByMap(deleteUserMap);
+                    log.info("待创建账户信息:{}", userAllocation.toString());
                     int i = allocationMapper.insert(userAllocation);
                     if (i > 0) {
                         log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
+                    Integer materialType = materialTypeArr.getInteger(0);
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
                     Thread t = new Thread() {
@@ -213,6 +232,9 @@ public class CallbackController {
                         public void run() {
                             try {
                                 kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
+                                if (!Check.isNull(materialType) && materialType != 0) {
+                                    synchronMaterials(materialType, accountId, projectId);
+                                }
                             } catch (ParseException e) {
                                 e.printStackTrace();
                             }
@@ -228,9 +250,19 @@ public class CallbackController {
         return "授权绑定失败!";
     }
 
-
-    public static void main(String[] args) {
-        System.err.println(UUID.randomUUID().toString().replace("-", ""));
+    private void synchronMaterials(Integer materialType, Long accountId, Long projectId) {
+        if (materialType == 1) {
+            JSONArray accountIds = new JSONArray();
+            accountIds.add(accountId);
+            //1 有效项目模板
+            List<Long> ids = kuaishouAppPackageService.queryByAppVersion(projectId, null, 1);
+            log.info("同步账户应用,应用模板={}", ids);
+            if (!Check.isNull(ids)) {
+                for (Long id : ids) {
+                    kuaishouAppPackageService.pushAppPackage(id, accountIds);
+                }
+            }
+        }
     }
 
     @RequestMapping("/bytedance")

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -238,7 +238,7 @@ public class SysUserController {
             List<SysUserVo> userList;
 
             PageHelper.startPage(pageNo, pageSize);
-            if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
+            if ("1648c7ceb4d449a9a13fbed7a8d9976c".equals(companyId) || "4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
                 userList = sysUserService.getAllUser(userName, null);
             } else {
                 userList = sysUserService.getUserListByCompany(companyId, userName);

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml

@@ -127,7 +127,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-preprod.yml

@@ -127,7 +127,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -127,7 +127,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -119,7 +119,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -118,7 +118,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password:
+    password: hcst@2020
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 0 - 1
jeecg-boot-module-system/src/main/resources/application.yml

@@ -1,6 +1,5 @@
 spring:
   profiles:
-    # active: wps
     active: @activatedProperties@
 swagger:
   production: false

BIN
jeecg-boot-module-system/src/main/resources/lib/opencv-4.2.0.jar


+ 0 - 1
jeecg-boot-module-system/src/main/resources/static/demo1.html

@@ -1 +0,0 @@
-demo1

+ 24 - 22
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -6,8 +6,8 @@ import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
@@ -76,19 +76,23 @@ public class SampleTest {
     private IBytedanceReportService bytedanceReportService;
     @Autowired
     private IETLReportBytedanceVideoService etlReportBytedanceVideoService;
+    @Autowired
+    private IEtlKuaishouAccountMaterialReportDailyService materialReportDailyService;
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1700996735138951L);
-        advertiserDataService.getMaterialList(tokenByAccountId);
 
-        CtopOauthToken tokenByAccountId1 = tokenService.getTokenByAccountId(1700996735589383L);
-        advertiserDataService.getMaterialList(tokenByAccountId1);
+        Date startDate = new Date();
+        for (int i = 1; i <= 2; i++) {
+            if (i == 1) {
+                continue;
+            }
+            System.err.println(DateUtils.addDay(new Date(), -i));
+            materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(), -i)));
+        }
     }
 
 
-
-
     @Test
     public void deleteKuaishouComment() {
         Long start = System.currentTimeMillis();
@@ -123,7 +127,6 @@ public class SampleTest {
     }
 
 
-
     @Test
     public void etlBytedanceVideoInfo() {
         String startDate = "2021-02-01";
@@ -147,7 +150,6 @@ public class SampleTest {
     }
 
 
-
     @Test
     public void formatVideoReportData() {
         for (int i = 1; i < 45; i++) {
@@ -192,35 +194,35 @@ public class SampleTest {
     }
 
     @Test
-    public void checkCostData(){
+    public void checkCostData() {
         String date = "2021-06-11";
-        for (int i=0;i<7;i++){
-            String getDate = DateUtils.addDay(date,i);
+        for (int i = 0; i < 7; i++) {
+            String getDate = DateUtils.addDay(date, i);
             //1:初始化
             checkReportTaskInfoService.initTask(getDate);
             //2: checkCost
-            List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,getDate,0);
-            if(null!=taskInfos&&!taskInfos.isEmpty()){
-                for (BytedanceCheckReportTaskInfo task:taskInfos) {
+            List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, getDate, 0);
+            if (null != taskInfos && !taskInfos.isEmpty()) {
+                for (BytedanceCheckReportTaskInfo task : taskInfos) {
                     checkReportTaskInfoService.checkCost(task);
                 }
-                log.info("{}:数据获取完成",getDate);
+                log.info("{}:数据获取完成", getDate);
             }
         }
     }
 
     @Test
-    public void refreshReportData()throws Exception{
+    public void refreshReportData() throws Exception {
         //1:查询异常任务数据
-        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,null,50001);
-        if(null!=taskInfos&&!taskInfos.isEmpty()){
+        List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, null, 50001);
+        if (null != taskInfos && !taskInfos.isEmpty()) {
             countDownLatch = new CountDownLatch(taskInfos.size());
             taskInfos.forEach(taskInfo -> {
                 try {
                     checkReportTaskInfoService.reloadData(taskInfo);
                     checkReportTaskInfoService.checkCost(taskInfo);
-                }catch (Exception e){
-                }finally {
+                } catch (Exception e) {
+                } finally {
                     countDownLatch.countDown();
                 }
             });
@@ -230,7 +232,7 @@ public class SampleTest {
     }
 
     @Test
-    public void testfreshBytedanceUrl(){
+    public void testfreshBytedanceUrl() {
         etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob();
         etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
         etlReportBytedanceVideoService.etlBytedanceVideoShotInfoJob();

+ 2 - 13
module-common/pom.xml

@@ -29,6 +29,8 @@
             <groupId>thirtpart</groupId>
             <artifactId>jave</artifactId>
             <version>1.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/main/resources/lib/jave-1.0.jar</systemPath>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -106,19 +108,6 @@
 
     <build>
         <resources>
-            <resource>
-                <directory>lib</directory>
-                <targetPath>BOOT-INF/lib/</targetPath>
-                <includes>
-                    <include>**/*.jar</include>
-                </includes>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-                <targetPath>BOOT-INF/classes/</targetPath>
-            </resource>
-
-
             <!-- 解决MyBatis配置文件引入问题 -->
             <resource>
                 <directory>src/main/java</directory>

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -138,6 +138,14 @@ public class UserAllocation implements Serializable {
      * 1 禁用
      */
     private Integer deleteComment;
+    /**
+     * 自动投放,0关闭,1开启
+     */
+    private Integer autoDelivery;
+    /**
+     * 物料类型 0-不同步,1应用包,(2人群包,3定向包)
+     */
+    private String materialType;
 
     /**
      * 修改时间

+ 2 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -31,7 +31,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     MaterialInfo getMaterialInfoByCode(String code);
 
-    Map<String, Object> checkMaterialInfo(String code, Long productId);
+    Map<String, Object> checkMaterialInfo(String code, Long projectId);
 
     Map<String, Object> insert(JSONObject jsonObject);
 
@@ -78,7 +78,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     List<MaterialInfo> getListByDate(String startDate, String endDate);
 
-    Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, String code, String startDate, String endDate, String userId, List<Long> projectId, String clipId, String shotId, String planId,Integer offlineFlag, Integer pageNo, Integer pageSize);
+    Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Long projectId, String clipId, String shotId, String planId, Integer offlineFlag, Integer pageNo, Integer pageSize);
 
     JSONArray getIdListByProject(Long projectId);
 }

+ 4 - 4
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -170,10 +170,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    public MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long productId) {
+    public MaterialInfo getMaterialInfoByCodeAndProductId(String code, Long projectId) {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("code", code);
-        queryWrapper.eq("product_id", productId);
+        queryWrapper.eq("project_id", projectId);
         queryWrapper.orderByDesc("id").last("limit 1");
         return this.getOne(queryWrapper);
     }
@@ -188,9 +188,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String, Object> checkMaterialInfo(String code, Long productId) {
+    public Map<String, Object> checkMaterialInfo(String code, Long projectId) {
         Map<String, Object> result = new HashMap<>();
-        MaterialInfo info = this.getMaterialInfoByCodeAndProductId(code, productId);
+        MaterialInfo info = this.getMaterialInfoByCodeAndProductId(code, projectId);
         if (null != info) {
             //文件已存在
             ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_UPLOAD.getCode());

BIN
module-common/src/main/resources/lib/jave-1.0.jar


+ 1 - 1
module-job-bytedance/src/main/resources/application-dev.yml

@@ -86,7 +86,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password:
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
module-job-bytedance/src/main/resources/application-jiaoyang.yml

@@ -101,7 +101,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
module-job-bytedance/src/main/resources/application-prod.yml

@@ -101,7 +101,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 51 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAutoSynchronousProjectMaterialJob.java

@@ -0,0 +1,51 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
+import com.alibaba.fastjson.JSONArray;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Component
+public class KuaishouAutoSynchronousProjectMaterialJob {
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IKuaishouAppPackageService kuaishouAppPackageService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    @XxlJob("autoSynchronousProjectMaterialJob")
+    public void execute() {
+        List<UserAllocation> userAllocations = userAllocationService.listByMediaId("2", 0);
+        userAllocations.forEach(userAllocation -> executorService.submit(() ->
+                synchronMaterials(userAllocation.getMaterialType(), userAllocation.getAccountId(), userAllocation.getProjectId())
+        ));
+        XxlJobHelper.log("快手物料数据同步完成");
+    }
+
+
+    private void synchronMaterials(String materialType, Long accountId, Long projectId) {
+        if (!Check.isNull(materialType) && materialType.contains("1")) {
+            JSONArray accountIds = new JSONArray();
+            accountIds.add(accountId);
+            //1 有效项目模板
+            List<Long> ids = kuaishouAppPackageService.queryByAppVersion(projectId, null, 1);
+            log.info("同步账户应用,应用模板={}", ids);
+            if (!Check.isNull(ids)) {
+                for (Long id : ids) {
+                    kuaishouAppPackageService.pushAppPackage(id, accountIds);
+                }
+            }
+        }
+    }
+}

+ 16 - 6
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java

@@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @Component
 public class KuaishouCreateCreativeJob {
@@ -20,6 +22,7 @@ public class KuaishouCreateCreativeJob {
     private IKuaiShouGroupTemplateService groupTemplateService;
     @Autowired
     private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaihouCreateCreative")
     public void execute() {
@@ -27,17 +30,24 @@ public class KuaishouCreateCreativeJob {
         templateQueryWrapper.eq("task_status", 2);
         templateQueryWrapper.eq("creative_status", 0);
         templateQueryWrapper.orderByAsc("create_time");
-        templateQueryWrapper.last("limit 20");
+        templateQueryWrapper.last("limit 200");
         List<KuaiShouGroupTemplate> list = groupTemplateService.list(templateQueryWrapper);
         if (Check.isNull(list)) {
             return;
         }
         for (KuaiShouGroupTemplate template : list) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(template.getAccountId());
-            if (Check.isNull(token)) {
-                continue;
-            }
-            groupTemplateService.createCreative(token.getAccessToken(), template.getUnitId(), template);
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    CtopOauthToken token = tokenService.getTokenByAccountId(template.getAccountId());
+                    if (Check.isNull(token)) {
+                        return;
+                    }
+                    groupTemplateService.createCreative(token.getAccessToken(), template.getUnitId(), template);
+                }
+            });
+
+
         }
     }
 }

+ 9 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyCampaignReportLoadJob.java

@@ -29,14 +29,20 @@ public class KuaishouDailyCampaignReportLoadJob {
 
     @XxlJob("kuaishouDailyCampaignReport")
     public void execute() throws Exception {
-        Date getDate = DateUtils.addDay(new Date(), -1);
+        Date getDate = DateUtils.addDay(new Date(), -2);
+        Date endDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
             XxlJobHelper.handleFail();
             return;
         }
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate)));
+
+        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, endDate)));
     }
+
+
+
+
 }

+ 4 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyGroupReportLoadJob.java

@@ -25,11 +25,12 @@ public class KuaishouDailyGroupReportLoadJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouReportDailyGroupService reportDailyGroupService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
 
     @XxlJob("kuaishouDailyGroupReport")
     public void execute() throws Exception {
-        Date getDate = DateUtils.addDay(new Date(), -1);
+        Date startDate = DateUtils.addDay(new Date(), -2);
+        Date endDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.size() <= 0) {
@@ -37,6 +38,6 @@ public class KuaishouDailyGroupReportLoadJob {
             XxlJobHelper.handleFail();
             return;
         }
-        tokens.forEach(token -> executorService.submit(() -> reportDailyGroupService.getAdvertiserGroupReportDaily(token, getDate, getDate)));
+        tokens.forEach(token -> executorService.submit(() -> reportDailyGroupService.getAdvertiserGroupReportDaily(token, startDate, endDate)));
     }
 }

+ 0 - 46
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java

@@ -1,46 +0,0 @@
-package cn.com.ctop.job.kuaishou.handler;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import org.jeecg.common.util.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-@Component
-public class KuaishouGroupDailyReportJob {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IKuaishouReportDailyGroupService reportDailyGroupService;
-
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
-
-    @XxlJob("kuaishouGroupDailyReportJob")
-    public void execute() throws ParseException {
-        String date = DateUtils.getDate("yyyy-MM-dd");
-        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
-        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -2);
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse(startDate);
-        Date parse2 = simpleDateFormat.parse(endDate);
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> executorService.submit(() ->
-                reportDailyGroupService.getAdvertiserGroupReportDaily(token, parse, parse2))
-        );
-        XxlJobHelper.log("快手物料数据同步完成");
-    }
-
-}

+ 1 - 1
module-job-kuaishou/src/main/resources/application-jiaoyang.yml

@@ -102,7 +102,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
module-job-kuaishou/src/main/resources/application-preprod.yml

@@ -102,7 +102,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 1 - 1
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -102,7 +102,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: foobared
+    password: hcst@2021..
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 33 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -461,6 +461,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -503,6 +506,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -531,6 +537,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60155
@@ -560,6 +569,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id = 60155
         GROUP BY t1.user_id,t1.`code`
@@ -590,6 +602,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60156
@@ -619,6 +634,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE  t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`
@@ -670,6 +688,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -699,6 +720,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60155
@@ -728,6 +752,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id = 60155
         GROUP BY t1.user_id,t1.`code`
@@ -758,6 +785,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60156
@@ -787,6 +817,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`

+ 29 - 28
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java

@@ -51,7 +51,7 @@ public class KuaiShouAccountReportCtrl {
         String mediaId = requestBody.getString("mediaId");
         BigDecimal discount = requestBody.getBigDecimal("discount");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
-        if(accounts.isEmpty()){
+        if (accounts.isEmpty()) {
             return resultBody;
         }
         String startDate = requestBody.getString("startDate");
@@ -59,8 +59,8 @@ public class KuaiShouAccountReportCtrl {
         try {
             Map<String, Object> sumData = kuaiShouAccountReportService.getSumDataBy(mediaId, discount, accounts, startDate, endDate);
             List<JSONObject> chartData = kuaiShouAccountReportService.getChartDataBy(mediaId, discount, accounts, startDate, endDate);
-            result.put("sumData",sumData);
-            result.put("chartData",chartData);
+            result.put("sumData", sumData);
+            result.put("chartData", chartData);
             resultBody.setResult(result);
             resultBody.setSuccess(true);
         } catch (Exception e) {
@@ -83,16 +83,16 @@ public class KuaiShouAccountReportCtrl {
         String mediaId = requestBody.getString("mediaId");
         BigDecimal discount = requestBody.getBigDecimal("discount");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
-        if(accounts.isEmpty()){
+        if (accounts.isEmpty()) {
             return result;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        int hour= requestBody.getInteger("hour");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
+        int hour = requestBody.getInteger("hour");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData= kuaiShouAccountReportService.getListDataBy(mediaId,discount,accounts,startDate,endDate,hour,target,order);
+            List<JSONObject> listData = kuaiShouAccountReportService.getListDataBy(mediaId, discount, accounts, startDate, endDate, hour, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {
@@ -103,45 +103,46 @@ public class KuaiShouAccountReportCtrl {
     }
 
     /**
-     *  导出数据
+     * 导出数据
      */
     @PostMapping("/report/excel")
     public void getExcelReport(@RequestBody JSONObject requestBody,
                                HttpServletRequest request,
                                HttpServletResponse response) {
-        JSONArray columns=requestBody.getJSONArray("columns");
-        if(columns.isEmpty()){
+        JSONArray columns = requestBody.getJSONArray("columns");
+        if (columns.isEmpty()) {
             log.error("请选择需要导出的字段");
         }
-        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs,columns);
-        List<String> titles= new ArrayList<>();
+        log.info("需要导出的字段:{}", columns);
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs, columns);
+        List<String> titles = new ArrayList<>();
         titles.add("账户Id");
         titles.add("账户名称");
-        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs,columns));
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs, columns));
         //此处增加两个元素是为了保证数据有序
-        columns.add(0,"accountId");
-        columns.add(1,"authName");
+        columns.add(0, "accountId");
+        columns.add(1, "authName");
         String mediaId = requestBody.getString("mediaId");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
-        if(accounts.isEmpty()){
+        if (accounts.isEmpty()) {
             return;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
-        int hour= requestBody.getInteger("hour");
-        List<JSONObject> excelData= kuaiShouAccountReportService.getExcelDataBy(filed,mediaId,accounts,startDate,endDate,hour,target,order);
-        if(excelData.isEmpty()){
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
+        int hour = requestBody.getInteger("hour");
+        List<JSONObject> excelData = kuaiShouAccountReportService.getExcelDataBy(filed, mediaId, accounts, startDate, endDate, hour, target, order);
+        if (excelData.isEmpty()) {
             return;
         }
-        List<List<Object>> excelList= new ArrayList<>();
-        excelData.forEach(data->{
-            List<Object> temp= new ArrayList<>();
-            columns.forEach(k-> temp.add(data.get(k.toString())));
+        List<List<Object>> excelList = new ArrayList<>();
+        excelData.forEach(data -> {
+            List<Object> temp = new ArrayList<>();
+            columns.forEach(k -> temp.add(data.get(k.toString())));
             excelList.add(temp);
         });
-        try{
+        try {
             String[] headers = titles.toArray(new String[titles.size()]);
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
@@ -151,7 +152,7 @@ public class KuaiShouAccountReportCtrl {
             workbook.write(os);
             os.flush();
             os.close();
-        }catch (IOException e){
+        } catch (IOException e) {
             log.error(e.getMessage());
         }
     }

+ 2 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouYiCheReportController.java

@@ -187,9 +187,7 @@ public class KuaiShouYiCheReportController {
             directApplication.add(directApplicationJson.getString("agent"));
             directApplication.add(directApplicationJson.getString("media"));
             directApplication.add(directApplicationJson.getString("systemType"));
-            if (!Check.isNull(directApplicationJson.getString("statDate"))) {
-                directApplication.add(directApplicationJson.getString("statDate").replace("-", "/"));
-            }
+            directApplication.add(directApplicationJson.getString("statDate"));
             directApplication.add(directApplicationJson.getBigDecimal("charge"));
             directApplication.add(directApplicationJson.getBigDecimal("cashCost"));
             directApplication.add(directApplicationJson.getLong("photoShow"));
@@ -222,9 +220,7 @@ public class KuaiShouYiCheReportController {
                 List<Object> channelSubcontracting = new ArrayList();
                 channelSubcontracting.add(channelSubcontractingJson.getString("agent"));
                 channelSubcontracting.add(channelSubcontractingJson.getString("systemType"));
-                if (!Check.isNull(channelSubcontractingJson.getString("statDate"))) {
-                    channelSubcontracting.add(channelSubcontractingJson.getString("statDate").replace("-", "/"));
-                }
+                channelSubcontracting.add(channelSubcontractingJson.getString("statDate"));
                 channelSubcontracting.add(channelSubcontractingJson.getString("campaignName"));
                 channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("charge"));
                 channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("cashCost"));

+ 49 - 19
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml

@@ -15,7 +15,13 @@
 
     <select id="selectReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.system_type systemType,
+        (case when t1.system_type = 'android'
+         then '安卓'
+         when t1.system_type = 'ios'
+         then 'ios'
+         else '-'
+         end
+        ) as systemType,
         t1.auth_name authName,
         ROUND(sum(t2.charge) / #{disCount},3) charge,
         sum(t2.activation) activation,
@@ -64,7 +70,13 @@
 
     <select id="selectSumReportByMap" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.system_type systemType,
+        (case when t1.system_type = 'android'
+        then '安卓'
+        when t1.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
         #{dateDesc} authName,
         ROUND(sum(t2.charge) / #{disCount},3) charge,
         sum(t2.activation) activation,
@@ -121,19 +133,25 @@
         '未知'
         END
         ) media,
-        t1.system_type systemType,
-        t2.stat_date statDate,
+        (case when t1.system_type = 'android'
+        then '安卓'
+        when t1.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
+        DATE_FORMAT(t2.stat_date,'%Y/%c/%d')  statDate,
         sum(t2.charge) charge,
         ROUND(sum(t2.charge) / #{disCount}, 3) cashCost,
-        sum(t2.photo_show) photoShow,
-        sum(t2.photo_click) photoClick,
+        sum(t2.aclick + t2.photo_show) photoShow,
+        sum(t2.photo_click + t2.bclick) photoClick,
         (
         CASE
         WHEN sum(t2.photo_show) != 0 THEN
         CONCAT(
         CAST(ROUND(
         (
-        sum(t2.photo_click) / sum(t2.photo_show)
+        sum(t2.photo_click + t2.bclick) / sum(t2.photo_show + t2.aclick)
         ) * 100,
         3
         ) AS CHAR)
@@ -281,19 +299,25 @@
         '未知'
         END
         ) media,
-        t2.system_type systemType,
-        t2.stat_date statDate,
+        (case when t2.system_type = 'android'
+        then '安卓'
+        when t2.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
+        DATE_FORMAT(t2.stat_date,'%Y/%c/%d') statDate,
         sum(t2.charge) charge,
         ROUND(sum(t2.charge) / #{disCount}, 3) cashCost,
-        sum(t2.photo_show) photoShow,
-        sum(t2.photo_click) photoClick,
+        sum(t2.aclick + t2.photo_show) photoShow,
+        sum(t2.photo_click + t2.bclick) photoClick,
         (
         CASE
         WHEN sum(t2.photo_show) != 0 THEN
         CONCAT(
         CAST( ROUND(
         (
-        sum(t2.photo_click) / sum(t2.photo_show)
+        sum(t2.photo_click + t2.bclick) / sum(t2.photo_show + t2.aclick)
         ) * 100,
         3
         ) AS CHAR)
@@ -446,7 +470,7 @@
         <if test="projectId != null">
             and t.project_id = #{projectId}
         </if>
-        <if test="systemType != null">
+        <if test="statDate != null">
             and t1.stat_date = #{statDate}
         </if>
         ) t2
@@ -471,20 +495,26 @@
         '未知'
         END
         ) media,
-        t2.system_type systemType,
-        t2.stat_date statDate,
+        (case when t2.system_type = 'android'
+        then '安卓'
+        when t2.system_type = 'ios'
+        then 'ios'
+        else '-'
+        end
+        ) as systemType,
+        DATE_FORMAT(t2.stat_date,'%Y/%c/%d') statDate,
         t2.campaignName campaignName ,
         sum(t2.charge) charge,
         ROUND(sum(t2.charge) / #{disCount}, 3) cashCost,
-        sum(t2.photo_show) photoShow,
-        sum(t2.photo_click) photoClick,
+        sum(t2.aclick + t2.photo_show) photoShow,
+        sum(t2.photo_click + t2.bclick) photoClick,
         (
         CASE
         WHEN sum(t2.photo_show) != 0 THEN
         CONCAT(
         CAST( ROUND(
         (
-        sum(t2.photo_click) / sum(t2.photo_show)
+        sum(t2.photo_click + t2.bclick) / sum(t2.photo_show + t2.aclick)
         ) * 100,
         3
         ) AS CHAR)
@@ -626,7 +656,7 @@
         <if test="projectId != null">
             and t.project_id = #{projectId}
         </if>
-        <if test="systemType != null">
+        <if test="statDate != null">
             and t1.stat_date = #{statDate}
         </if>
         ) t2

+ 1 - 1
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -192,7 +192,7 @@
     "comment": "按钮点击率"
   },
   "play3sRate": {
-    "filed": "CASE WHEN sum(CEIL(t1.play_3s_ratio * t1.aclick)) / sum(t1.aclick) IS NULL THEN 0 ELSE round(sum(CEIL(t1.play_3s_ratio * t1.aclick)) / sum(t1.aclick)*100,2)end as play3sRate ",
+    "filed": "(CASE WHEN  sum(t1.aclick) != 0 THEN round( sum(t1.play_3s_ratio * t1.aclick) / sum(t1.aclick) * 100,2) ELSE 0 END )AS play3sRate ",
     "comment": "3s播放率"
   },
   "activeRate": {

+ 2 - 2
pom.xml

@@ -73,7 +73,7 @@
         <repository>
             <id>ctop</id>
             <name>ctop</name>
-            <url>http://118.24.244.213:8081/repository/3rd_part/</url>
+            <url>http://118.24.244.213:8081/3rd_part/</url>
         </repository>
     </repositories>
 
@@ -83,7 +83,7 @@
                 <enabled>true</enabled>
             </snapshots>
             <id>ctop</id>
-            <url>http://118.24.244.213:8081/repository/3rd_part/</url>
+            <url>http://118.24.244.213:8081/3rd_part/</url>
         </pluginRepository>
     </pluginRepositories>