Ver Fonte

Merge remote-tracking branch 'origin/master'

yumeng há 4 anos atrás
pai
commit
b62d3d5f96
47 ficheiros alterados com 980 adições e 455 exclusões
  1. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java
  2. 13 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  3. 66 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  4. 31 326
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  5. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  6. 28 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  7. 2 20
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  8. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  9. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java
  10. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java
  11. 15 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  12. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml
  13. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java
  14. 10 3
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  15. 24 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java
  16. 28 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  17. 10 6
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCheckAccountReportJob.java
  18. 11 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java
  19. 4 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouLandpagePackageServiceImpl.java
  20. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java
  21. 87 50
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  22. 1 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  23. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  24. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  25. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProjectVideoGetServiceImpl.java
  26. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java
  27. 18 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml
  28. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java
  29. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java
  30. 69 10
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceVideoSlogenInfoController.java
  31. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceCreativeWordPackageMapper.java
  32. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceVideoSlogenInfoMapper.java
  33. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceCreativeWordPackageMapper.xml
  34. 8 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceVideoSlogenInfoMapper.xml
  35. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceCreativeWordPackageService.java
  36. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceVideoSlogenInfoService.java
  37. 4 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeWordPackageServiceImpl.java
  38. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceImageInfoServiceImpl.java
  39. 10 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java
  40. 236 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/controller/BytedanceOperationLogController.java
  41. 61 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/entity/BytedanceOperationLog.java
  42. 17 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/mapper/BytedanceOperationLogMapper.java
  43. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/mapper/xml/BytedanceOperationLogMapper.xml
  44. 14 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/service/IBytedanceOperationLogService.java
  45. 19 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/service/impl/BytedanceOperationLogServiceImpl.java
  46. 108 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/util/GetChangeDateUtil.java
  47. 4 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

+ 0 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/config/WebMvcConfiguration.java

@@ -1,8 +1,6 @@
 package org.jeecg.config;
 
-import org.jeecg.config.interceptors.BrowseLogHandelInterceptor;
 import org.jeecg.modules.shiro.authc.interceptor.OnlineInterceptor;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -22,10 +20,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  */
 @Configuration
 public class WebMvcConfiguration implements WebMvcConfigurer {
-
-	@Autowired
-	BrowseLogHandelInterceptor browseLogHandelInterceptor;
-
 	@Value("${jeecg.path.upload}")
 	private String upLoadPath;
 	@Value("${jeecg.path.webapp}")

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

@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -50,7 +51,7 @@ public class CallbackController {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-    @Autowired
+    @Resource
     private UserAllocationMapper allocationMapper;
     @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
@@ -147,6 +148,7 @@ public class CallbackController {
                     //创建人
                     String userId = json.getString("userId");
                     Long projectId = json.getLong("projectId");
+                    String authBeginTime = json.getString("authBeginTime");
                     BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
                     BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
@@ -185,6 +187,9 @@ public class CallbackController {
                     userAllocation.setSystemType(systemType);
                     // 获取快手昵称
                     userAllocation.setAuthName((String) advertiseBaseInfoMap.get("userName"));
+                    if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                        userAllocation.setAuthBeginTime(authBeginTime);
+                    }
                     userAllocation.setMediaId(mediaId);
                     userAllocation.setAccountId(accountId);
                     userAllocation.setProjectId(projectId);
@@ -274,6 +279,7 @@ public class CallbackController {
             String userId = json.getString("userId");
             //创建人
             String userName = json.getString("userName");
+            String authBeginTime = json.getString("authBeginTime");
             Long projectId = json.getLong("projectId");
             BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
             BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
@@ -339,6 +345,9 @@ public class CallbackController {
                             userAllocation.setProjectId(projectId);
                             userAllocation.setSystemType(systemType);
                             userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                            if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                                userAllocation.setAuthBeginTime(authBeginTime);
+                            }
                             userAllocation.setAdvertiserId(advertiserId);
                             userAllocation.setWarningProportion(warningProportion);
                             userAllocation.setWarningAmount(warningAmount);
@@ -391,6 +400,9 @@ public class CallbackController {
                     userAllocation.setProjectId(projectId);
                     userAllocation.setSystemType(systemType);
                     userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                    if(null!=authBeginTime&&!authBeginTime.trim().equals("")){
+                        userAllocation.setAuthBeginTime(authBeginTime);
+                    }
                     userAllocation.setAdvertiserId(advertiserId);
                     userAllocation.setWarningProportion(warningProportion);
                     userAllocation.setWarningAmount(warningAmount);

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

@@ -6,7 +6,9 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -31,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
 import java.net.URLDecoder;
 import java.text.ParseException;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 素材信息
@@ -74,7 +78,8 @@ public class MaterialInfoController {
     private IProductService productService;
     @Autowired
     private IProjectService projectService;
-
+    @Autowired
+    private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 
     @GetMapping("/supplierWatermark")
     public Result<String> supplierWatermark(String id) {
@@ -513,8 +518,60 @@ public class MaterialInfoController {
         if (!Check.isNull(materialInfo.getSlogans())) {
             JSONArray slogans = materialInfo.getSlogans();
             if (null != slogans && !slogans.isEmpty()) {
+
+
+                for (int i = 0;i<slogans.size();i++) {
+                    JSONObject slogenInfo = slogans.getJSONObject(i);
+                    String title = slogenInfo.getString("title");
+                    title = title.trim().replaceAll("[\\{]{2,}","{");
+                    title = title.trim().replaceAll("[\\}]{2,}","}");
+                    slogenInfo.put("title",title);
+                    String reg = "\\{[\\u4e00-\\u9fa5\\-]{2,6}\\}";
+                    Pattern pattern = Pattern.compile(reg);
+                    Matcher matcher = pattern.matcher(title);
+                    JSONArray creativeWordIdsArray = new JSONArray();
+
+                    int len = StringUtils.lengthAsSlogan(title);
+                    int left = title.indexOf("{");
+                    int right = title.indexOf("}");
+                    if(left >= 0 || right >= 0){
+                        int times = 0;
+                        while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
+                            times++;
+                            if(times>=3){
+                                result.setCode(500);
+                                result.setMessage("动态词包不合法,词包数量超过2个");
+                                return  result;
+                            }
+                            String matchStr = matcher.group();//获取当前匹配的值
+                            title = title.replace(matchStr,"");
+                            ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1,matchStr.length()-1));
+                            if(Check.isNull(creativeWordPackage)){
+                                result.setCode(500);
+                                result.setMessage("动态词包不合法,词包不存在或者含有单独的非词包大括号");
+                                return  result;
+                            }
+                            creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
+                            len = len - (right - left) + creativeWordPackage.getMaxWordLen();
+                            left = title.indexOf("{");
+                            right = title.indexOf("}");
+                        }
+                        if(title.contains("{") || title.contains("}")){
+                            return result.error500("大括号单独出现或大括号中内容不合法");
+                        }
+                        slogenInfo.put("creative_word_ids",creativeWordIdsArray.toJSONString());
+                    }
+                    //校验标题长度,长度小于5和大于30的全部过滤
+                    if(len<5 || len>30){
+                        result.setCode(500);
+                        result.setMessage("文案长度不合法,小于5或大于30");
+                        return  result;
+                    }
+                }
+
                 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                slogenInfoService.insertSlogans(materialInfo.getProjectId(), materialInfoEntity.getCode(), slogans, user.getId());
+                slogenInfoService.deleteAllSlogens(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(),materialInfoEntity.getCode(),user.getId());
+                slogenInfoService.insertSlogans(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId() , materialInfoEntity.getCode(), slogans, user.getId());
             }
         }
         boolean ok = materialInfoService.updateById(materialInfo);
@@ -545,6 +602,7 @@ public class MaterialInfoController {
                 sendMessageService.sendMessage(userId, text);
             }
         }
+        result.setCode(0);
         return result;
 
     }
@@ -563,11 +621,14 @@ public class MaterialInfoController {
         for (String id : ids) {
             materialInfo.setId(id);
             Result<MaterialInfo> materialInfoResult = bytedanceEdit(materialInfo);
-            if (materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)) {
-                successNum++;
+            if (!materialInfoResult.getCode().equals(0)) {
+                return materialInfoResult;
             }
+            successNum++;
         }
-        return result.success("批量修改成功" + successNum + "个");
+        result.setCode(0);
+        result.setMessage("批量通过" + successNum + "个视频");
+        return result;
 
     }
 

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

@@ -35,6 +35,7 @@ import cn.com.ctop.toutiao.modules.report.service.*;
 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 lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -120,12 +121,9 @@ public class TestController {
     private IUserAllocationService allocationService;
     @Autowired
     private ICtopOauthTokenService tokenService;
-
     @Autowired
     private IKuaiShouProjectDataService kuaiShouProjectDataService;
     @Autowired
-    private IKuaishouReportHourlyGroupService hourlyGroupService;
-    @Autowired
     private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
 
     @Autowired
@@ -177,207 +175,6 @@ public class TestController {
         return "success";
     }
 
-
-    @GetMapping(value = "/getProgramCreative")
-    public void getProgramCreative() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            creativeService.getProgramCreative(oauthToken, 1);
-        }
-
-
-    }
-
-
-    @GetMapping(value = "/campaignList")
-    public void campaignList() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            // kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
-            videoService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
-                        //   kuaishouInterfaceService.getGroupList(oauthToken, null, null);
-                        //     kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
-                        Thread.sleep(1500);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            });
-
-        }
-
-    }
-
-
-    @GetMapping(value = "/creativeList")
-    public void creativeList() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
-            campaignQueryWrapper.eq("account_id", accountId);
-
-            List<KuaiShouCampaign> list1 = campaignService.list(campaignQueryWrapper);
-            for (KuaiShouCampaign campaign : list1) {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
-                    }
-                });
-                try {
-                    Thread.sleep(400L);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-
-
-        }
-
-    }
-
-
-    @GetMapping(value = "/updateUnit")
-    public void updateUnit() throws Exception {
-        List<Long> list = new ArrayList();
-        list.add(9556344L);
-        list.add(9743738L);
-        list.add(9743727L);
-        list.add(9812671L);
-        list.add(9838554L);
-        list.add(9743746L);
-        list.add(9767055L);
-        list.add(9556274L);
-        list.add(9767096L);
-        list.add(9792538L);
-        list.add(9766952L);
-        list.add(9677440L);
-        list.add(9677334L);
-        list.add(9556465L);
-        list.add(9677236L);
-        list.add(9556227L);
-        list.add(9556188L);
-        list.add(9556431L);
-        list.add(9677408L);
-        list.add(9677284L);
-
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
-            groupQueryWrapper.eq("account_id", accountId);
-            //      groupQueryWrapper.ne("schedule_time","000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111");
-            //     groupQueryWrapper.eq("use_app_market", 1);
-            //    groupQueryWrapper.gt("cpa_bid", 19000);
-
-
-            List<KuaiShouGroup> list1 = groupService.list(groupQueryWrapper);
-          /*  for (KuaiShouGroup group : list1) {
-
-                JSONObject json = new JSONObject();
-                json.put("unitId", group.getUnitId());
-                json.put("useAppMarket", 0);
-                json.put("appStore", new JSONArray());
-                batchService.updateUnit(json, oauthToken);
-            }*/
-
-            for (KuaiShouGroup group : list1) {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        try {
-                            JSONObject json = new JSONObject();
-                            json.put("unitId", group.getUnitId());
-                            json.put("cpaBid", 18 * 1000);
-                            //     json.put("gender", "2");
-                            batchService.updateUnit(json, oauthToken);
-                            Thread.sleep(1500);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
-                });
-
-
-            }
-
-
-        }
-
-
-    }
-
-
-    @GetMapping(value = "/updateCreative")
-    public void updateCreative() {
-        List<Long> list = new ArrayList();
-        list.add(10045052L);
-        list.add(10045823L);
-        list.add(10045830L);
-        list.add(10045831L);
-
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-
-
-            QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
-            creativeQueryWrapper.eq("account_id", accountId);
-
-
-            List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
-            for (KuaiShouCreative creative : creativeList) {
-                executorService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        try {
-                            JSONObject json = new JSONObject();
-                            json.put("creativeId", creative.getCreativeId());
-                            String url = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
-
-                            if (creative.getCreativeMaterialType() == 1) {
-                                json.put("clickTrackUrl", url);
-                            } else if (creative.getCreativeMaterialType() == 4) {
-                                json.put("impressionUrl", url);
-                                json.put("clickTrackUrl", url);
-
-                            }
-                            JSONObject jsonObject = batchService.updateCreative(json, oauthToken);
-                            log.info("修改创意返回信息:creative:{},结果:{}", creative.getCreativeId(), jsonObject);
-                            Thread.sleep(1000L);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
-                });
-            }
-        }
-    }
-
-
     @GetMapping("/cleanNewlyData")
     public void cleanNewlyData(String startDate, String endDate) throws ParseException {
 
@@ -423,19 +220,6 @@ public class TestController {
 
     }
 
-    @GetMapping("/getVideoByProjectId")
-    public String getVideoByProjectId(Long projectId) {
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", projectId);
-        List<UserAllocation> list = allocationService.list(queryWrapper);
-        for (UserAllocation allocation : list) {
-            CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
-            kuaishouInterfaceService.getVideoList(token, null, null);
-        }
-        return "success";
-    }
-
-
     @GetMapping("/testKuaishou")
     public String kuaishouCallback(@RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
         try {
@@ -545,115 +329,6 @@ public class TestController {
         return "授权绑定失败!";
     }
 
-
-    @GetMapping("/getBytedanceMatReport")
-    public Map<String, Object> getData() {
-        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
-        executorService = Executors.newFixedThreadPool(10);
-        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
-        tokens.forEach(record -> executorService.submit(() -> {
-            try {
-                reportService.getAdvertiserReport(record, DateUtils.parseDate("2021-01-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                log.info("账户数据获取完成:account:{},时间:{}-{}", record.getAccountId(), "2021-01-01", "2020-01-31");
-            } catch (Exception e) {
-
-            } finally {
-                countDownLatch.countDown();
-            }
-        }));
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        Map<String, Object> result = new HashMap<>();
-        ResultMapUtils.setResultMap(new HashMap<>(), StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
-
-    @GetMapping(value = "/updateTemplate")
-    public void updateTemplate(Long projectId, String startDate, String endDate) {
-
-        List<Long> list = new ArrayList();
-        list.add(7022550L);
-        list.add(7409586L);
-        list.add(5473041L);
-        list.add(5852766L);
-        list.add(6962896L);
-        list.add(7409919L);
-        for (int i = 0; i < list.size(); i++) {
-            Long accountId = list.get(i);
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-            templateService.getTemplateByAccountId(oauthToken.getAccountId(), oauthToken.getAccessToken(), 1);
-
-            QueryWrapper<KuaishouTemplate> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("account_id", accountId);
-            List<KuaishouTemplate> list1 = templateService.list(queryWrapper);
-            if (!Check.isNull(list1)) {
-                for (KuaishouTemplate template : list1) {
-                    JSONObject param = new JSONObject();
-                    param.put("templateId", template.getTemplateId());
-                    param.put("accountId", template.getAccountId());
-                    param.put("templateName", template.getTemplateName());
-                    param.put("filterConvertedLevel", 5);
-                    templateService.updateTemplate(oauthToken.getAccountId(), oauthToken.getAccessToken(), param);
-
-                }
-
-            }
-
-
-        }
-
-
-    }
-
-
-    @GetMapping(value = "/getCreativeByProjectId")
-    public void gerCreative(Long projectId, String startDate, String endDate) {
-
-        Result<String> result = new Result<>();
-        try {
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            Date start = simpleDateFormat.parse(startDate);
-            Date end = simpleDateFormat.parse(endDate);
-            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-            userAllocationQueryWrapper.eq("project_id", projectId);
-            List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
-            if (!Check.isNull(list)) {
-                for (UserAllocation allocation : list) {
-                    Long accountId = allocation.getAccountId();
-                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-                    tokenQueryWrapper.eq("media_id", 2);
-                    tokenQueryWrapper.eq("account_id", accountId);
-                    CtopOauthToken token = tokenMapper.selectOne(tokenQueryWrapper);
-                    if (!Check.isNull(token)) {
-                        suzhaoService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                JSONArray arr = new JSONArray();
-                                kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, start, end, arr, arr);
-
-                            }
-                        });
-
-
-                    }
-                }
-
-            }
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-
-
-    }
-
-
     @GetMapping(value = "/agentReport")
     public void agentReport(String startDate, String endDate) {
         dailyAgentService.getAgentReportByPage(startDate, endDate);
@@ -1585,4 +1260,34 @@ public class TestController {
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+    @GetMapping("checkCostData")
+    public void checkCostData(String date){
+            //1:初始化
+            checkReportTaskInfoService.initTask(date);
+            //2: checkCost
+            List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,date,0);
+            if(null!=taskInfos&&!taskInfos.isEmpty()){
+                for (BytedanceCheckReportTaskInfo task:taskInfos) {
+                    checkReportTaskInfoService.checkCost(task);
+                }
+                log.info("{}:数据获取完成",date);
+            }
+    }
+
+    @GetMapping("refreshReportData")
+    public void refreshReportData()throws Exception{
+        //1:查询异常任务数据
+        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,null,50001);
+        if(null!=taskInfos&&!taskInfos.isEmpty()){
+            taskInfos.forEach(taskInfo -> {
+                try {
+                    checkReportTaskInfoService.reloadData(taskInfo);
+                    checkReportTaskInfoService.checkCost(taskInfo);
+                }catch (Exception e) {
+                }
+            });
+            log.info("数据更新完成");
+        }
+    }
 }

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -498,10 +498,10 @@ public class UserAllocationController {
             ProjectMember member = memberMapper.selectOne(memberQueryWrapper);
             if (Check.isNull(member)) {
                 ProjectMember addMember = new ProjectMember();
-                addMember.setProjectId(userAllocation.getProjectId());
-                addMember.setUserId(userAllocation.getUserId());
-                addMember.setUserName(userAllocation.getUserName());
-                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocation.getUserId());
+                addMember.setProjectId(userAllocationEntity.getProjectId());
+                addMember.setUserId(userAllocationEntity.getUserId());
+                addMember.setUserName(userAllocationEntity.getUserName());
+                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocationEntity.getUserId());
                 if (!Check.isNull(roleCode)) {
                     addMember.setRoleCode(roleCode);
                 }

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

@@ -15,6 +15,9 @@ import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.common.module.vo.SysDepartUsersVO;
 import cn.com.ctop.common.module.vo.SysUserRoleVO;
 import cn.com.ctop.common.module.vo.SysUserVo;
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import cn.com.ctop.toutiao.modules.operation.service.IBytedanceOperationLogService;
+import cn.com.ctop.toutiao.modules.operation.util.GetChangeDateUtil;
 import cn.hutool.core.util.RandomUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -102,10 +105,12 @@ public class SysUserController {
     private IUserCompanyService userCompanyService;
     @Autowired
     private ISysRoleService roleService;
-
     @Resource
     private UserCompanyMapper userCompanyMapper;
     @Autowired
+    IBytedanceOperationLogService bytedanceOperationLogService;
+
+    @Autowired
     private RedisUtil redisUtil;
     @Value("${jeecg.path.upload}")
     private String upLoadPath;
@@ -143,7 +148,7 @@ public class SysUserController {
      * @param user
      * @param pageNo
      * @param pageSize
-     * @param req
+     * @param
      * @return
      */
     @PermissionData(pageComponent = "system/UserList")
@@ -329,9 +334,16 @@ public class SysUserController {
                     user.setOrgCode(depart.getOrgCode());
                 }
             }
+
+            if (Check.isNull(selectedRoles)){
+
+            }
+
             sysUserService.addUserWithRole(user, selectedRoles);
             sysUserService.addUserWithDepart(user, selectedDeparts);
             userCompanyService.addOrUpdateUserWithCompany(user);
+            //用户 分配角色 为 设计组长  用户设计组长姓名 为自己真实姓名
+            sysUserService.updUserDesignLeaderById(user.getId(),user.getRealname(),selectedRoles);
             result.success("添加成功!");
             sysBaseAPI.addLog("添加用户,id: " + user.getId(), CommonConstant.LOG_TYPE_2, 1);
         } catch (Exception e) {
@@ -358,7 +370,18 @@ public class SysUserController {
             if (sysUser == null) {
                 result.error500("未找到对应实体");
             } else {
+                sysUser = sysUserService.queryPageList(sysUser).get(0);
                 SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
+                BytedanceOperationLog bytedanceOperationLog = new BytedanceOperationLog();
+                bytedanceOperationLog.setOldData(sysUser.toString());
+                bytedanceOperationLog.setNewData(user.toString());
+                String operationContent = user.getRealname() + ":" +GetChangeDateUtil.makeOperationContent(sysUser,user,new String[]{"leaderName", "departName","roleName"});
+                bytedanceOperationLog.setOperationContent(operationContent);
+                bytedanceOperationLog.setOperationType("用户管理-修改");
+                LoginUser createBy = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+                bytedanceOperationLog.setCreateById(createBy.getId());
+                bytedanceOperationLogService.save(bytedanceOperationLog);
+
                 user.setLeaderName(user.getLeaderName().trim());
                 user.setUpdateTime(new Date());
                 user.setLeaderName(user.getLeaderName().trim());
@@ -388,12 +411,14 @@ public class SysUserController {
                                 ProjectMember updateMember = new ProjectMember();
                                 updateMember.setRoleCode(sysRole.getRoleCode());
                                 memberService.update(updateMember, memberQueryWrapper);//更新项目人员角色信息
+
                             }
                         }
                     };
                     thread.start();
                 }
-
+                //用户 分配角色 为 设计组长  用户设计组长姓名 为自己真实姓名
+                sysUserService.updUserDesignLeaderById(user.getId(),user.getRealname(),roles);
                 result.success("修改成功!");
             }
         } catch (Exception e) {

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

@@ -193,8 +193,8 @@ public class SampleTest {
 
     @Test
     public void checkCostData(){
-        String date = "2021-06-01";
-        for (int i=0;i<14;i++){
+        String date = "2021-06-11";
+        for (int i=0;i<7;i++){
             String getDate = DateUtils.addDay(date,i);
             //1:初始化
             checkReportTaskInfoService.initTask(getDate);
@@ -210,24 +210,6 @@ public class SampleTest {
     }
 
     @Test
-    public void reloadKuaishouData(){
-        String formatDate = "2021-06-01";
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> {
-            try {
-                List<EtlKuaishouAccountMaterialReportDaily> getList = etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyList(formatDate,token.getAccountId());
-                if(null!=getList&&!getList.isEmpty()){
-                    getList.forEach(report->etlKuaishouAccountMaterialReportDailyMapper.replace(report));
-                }
-            }catch (Exception e){
-                e.printStackTrace();
-            }
-        });
-
-        log.info("{}数据获取完成",formatDate);
-    }
-
-    @Test
     public void refreshReportData()throws Exception{
         //1:查询异常任务数据
         List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,null,50001);

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -192,4 +192,9 @@ public class MaterialInfo implements Serializable {
     //视频关联广告语信息--头条
     @TableField(exist = false)
     private JSONArray slogans;
+
+    @TableField(exist = false)
+    private Integer slogansCount;
+
+    private Integer offlineFlag;
 }

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

@@ -104,6 +104,13 @@ public class UserAllocation implements Serializable {
     @ApiModelProperty(value = "授权名称")
     private String authName;
 
+    /**
+     * 授权开始时间
+     */
+    @Excel(name = "授权开始时间", width = 15)
+    @ApiModelProperty(value = "授权开始时间")
+    private String authBeginTime;
+
 
     /**
      * 0 启动

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java

@@ -152,6 +152,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      */
     int updateNullByEmptyString(@Param("fieldName") String fieldName);
 
+
     /**
      * 根据部门Ids,查询部门下用户信息
      *
@@ -177,4 +178,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     List<SysUser> queryPageList(SysUser user);
 
     List<JSONObject> getUserMapByMap(@Param("ids") Map<String, String> userIdMap);
+
+    /**
+     *
+     * @param userId 用户id
+     * @param designTeamLeaderName 设计组长姓名
+     * @return
+     */
+    Integer updUserDesignLeaderById(@Param("userId") String userId,@Param("designTeamLeaderName") String designTeamLeaderName);
 }

+ 15 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -90,8 +90,22 @@
         select
         distinct matInfo.code,
         matInfo.project_id,
-        matInfo.id
+        matInfo.id,
+        t.slogansCount,
+        matInfo.offline_flag
         from ctop_material_info matInfo
+        left JOIN (
+            SELECT
+                video_code,
+                count(*) AS slogansCount
+            FROM
+                ctop_bytedance_video_slogen_info
+            WHERE
+                status = 1
+            GROUP BY
+                video_code
+        ) t ON matInfo.code = t.video_code
+
         <if test="tagCode!=null">
             left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
         </if>

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -313,6 +313,9 @@ SELECT
         <if test="sex != null and sex != ''">
             AND t1.sex =#{sex}
         </if>
+        <if test="id != null and id != ''">
+            AND t1.id =#{id}
+        </if>
 
         ) t4
         GROUP BY t4.id
@@ -325,4 +328,12 @@ SELECT
         </foreach>
     </select>
 
+
+
+
+    <!-- 修改用户 设计组长姓名 -->
+    <update id="updUserDesignLeaderById">
+        UPDATE sys_user SET design_team_leader_name = #{designTeamLeaderName} WHERE id = #{userId}
+    </update>
+
 </mapper>

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

@@ -272,4 +272,6 @@ public interface ISysUserService extends IService<SysUser> {
     Map<String, String> getUserMapByMap(Map<String, String> userIdMap);
 
     String getRoleCodeByUserId(String userId);
+
+    Integer updUserDesignLeaderById(String userId,String userName,String roleId);
 }

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

@@ -38,7 +38,6 @@ import java.util.concurrent.Executors;
 
 import static cn.com.ctop.common.module.utils.CloudVideoProcessUtil.getTaskDetailResponse;
 import static cn.com.ctop.common.module.utils.CloudVideoProcessUtil.videoWatermarkHandle;
-
 /**
  * 素材信息
  *
@@ -70,7 +69,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private ISupplierWatermarkService supplierWatermarkService;
     @Resource
     private IProductService productService;
-
     @Value("${oss.replace.download}")
     private String downloadUrl;
 
@@ -797,6 +795,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         if (null != dailyList && !dailyList.isEmpty()) {
             for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
+                materialInfo.setSlogansCount(info.getSlogansCount());
+                materialInfo.setOfflineFlag(info.getOfflineFlag());
                 //素材名称为空 则使用素材id 同步失败
                 materialInfo.setMaterialName(Check.isNull(materialInfo.getMaterialName()) ? materialInfo.getId() : materialInfo.getMaterialName());
                 //判断是否已经同步到快手平台
@@ -841,7 +841,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setWhetherUnaudited(true);
                 }
-
+                //统计广告语数量
+//                List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(), 1);
+//                JSONArray slogenArray = new JSONArray();
+//                if (null != slogenInfos && !slogenInfos.isEmpty()) {
+//                    slogenArray.addAll(slogenInfos);
+//                }
+//                materialInfo.setSlogans(slogenArray);
                 setList.add(materialInfo);
             }
         }
@@ -851,6 +857,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return result;
     }
 
+
     @Override
     public JSONArray getIdListByProject(Long projectId) {
         return materialInfoMapper.getIdListByProject(projectId);

+ 24 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java

@@ -521,4 +521,28 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return userMapper.queryByDepIds(departIds, username);
     }
 
+
+    /**
+     *
+     * @description: 修改用户 设计组长姓名
+     *用户 分配角色 为 设计组长  用户设计组长姓名 为自己真实姓名
+     * @param userId 用户id
+     * @param userName 设计组长姓名
+     * @param roleId 角色id
+     * @return: java.lang.Integer
+     * @author: zianY
+     */
+    @Override
+    public Integer updUserDesignLeaderById(String userId,String userName,String roleId) {
+        String designTeamLeaderName = "";
+        if (!Check.isNull(roleId)){
+            SysRole sysRole = sysRoleMapper.selectById(roleId);
+            if ("designTeamLeader".equals(sysRole.getRoleCode())){
+                designTeamLeaderName = userName;
+            }
+        }
+       return userMapper.updUserDesignLeaderById(userId,designTeamLeaderName);
+    }
+
+
 }

+ 28 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.utils;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -118,4 +119,31 @@ public class StringUtils {
         }
         return dest;
     }
+
+    public static int lengthAsSlogan(String a)  {
+        char[] c = a.toCharArray();
+        int count=0;
+        for (char d : c) {
+            Character.UnicodeBlock ub = Character.UnicodeBlock.of(d);
+            if (ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
+                    || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
+                    || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
+                    || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS
+                    || ub == Character.UnicodeBlock.VERTICAL_FORMS
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C
+                    || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D
+                    || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
+                    || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT) {
+                count++;
+            }
+
+        }
+        BigDecimal strNum = new BigDecimal(count);
+        BigDecimal strlen = new BigDecimal(a.length());
+        BigDecimal res = strlen.subtract(strNum).divide(new BigDecimal(2),0, BigDecimal.ROUND_UP).add(strNum);
+        return res.intValue();
+    }
 }

+ 10 - 6
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCheckAccountReportJob.java

@@ -23,22 +23,26 @@ public class BytedanceCheckAccountReportJob {
     private IBytedanceCheckReportTaskInfoService checkReportTaskInfoService;
     @XxlJob("initCheckReportJob")
     public void initCheckReportJob() throws Exception {
-        String params = DateUtils.addDay(DateUtils.formatDate(),-1);
-        checkReportTaskInfoService.initTask(params);
+        String date = DateUtils.addDay(DateUtils.formatDate(),-1);
+        String param = XxlJobHelper.getJobParam();
+        if (param==null || param.trim().length()==0) {
+            param = date;
+        }
+        checkReportTaskInfoService.initTask(date);
         //查询初始化的任务
-        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,params,0);
+        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,date,0);
         if(null!=taskInfos&&!taskInfos.isEmpty()){
             countDownLatch = new CountDownLatch(taskInfos.size());
-            taskInfos.forEach(taskInfo -> {
+            taskInfos.forEach(taskInfo ->executorService.submit(()->{
                 try {
                     checkReportTaskInfoService.checkCost(taskInfo);
                 }catch (Exception e){
                 }finally {
                     countDownLatch.countDown();
                 }
-            });
+            }));
             countDownLatch.await();
-            XxlJobHelper.log("{}数据初始化完成",params);
+            XxlJobHelper.log("{}数据初始化完成",date);
         }
     }
 

+ 11 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java

@@ -60,4 +60,15 @@ public class KuaishouEtlVideoJob {
             materialReportDailyService.etlKuaishouAccountMaterialReportInfo(DateUtils.formatDate(DateUtils.addDay(new Date(),-i)));
         }
     }
+
+    @XxlJob("etlKuaishouReportCompanyInfo")
+    public void etlKuaishouReportCompanyInfo(){
+        Date date = DateUtils.addDay(new Date(),-1);
+        materialReportDailyService.etlKuaishouReportCompanyInfo(DateUtils.formatDate(date));
+    }
+
+    @XxlJob("etlKuaishouVideoReportStateDate")
+    public void etlKuaishouVideoReportStateDate(){
+        materialReportDailyService.etlKuaishouVideoReportStateDate();
+    }
 }

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

@@ -26,6 +26,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -41,14 +42,14 @@ import java.util.Map;
 @Service
 public class KuaishouLandpagePackageServiceImpl extends ServiceImpl<KuaishouLandpagePackageMapper, KuaishouLandpagePackage> implements IKuaishouLandpagePackageService {
 
-    @Autowired
+    @Resource
     private KuaishouLandpagePackageMapper landpagePackageMapper;
-    @Autowired
+    @Resource
     private KuaishouLandpagePackageRelMapper landpagePackageRelMapper;
     @Autowired
     private KuaishouLandpagePackageRelServiceImpl landpagePackageRelService;
 
-    @Autowired
+    @Resource
     private UserAllocationMapper userAllocationMapper;
     @Autowired
     private ICtopOauthTokenService oauthTokenService;

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java

@@ -16,7 +16,7 @@ import java.util.List;
  */
 public interface KuaiShouGroupTemplateMapper extends BaseMapper<KuaiShouGroupTemplate> {
 
-    JSONObject getMd5ByPhotoId(@Param("photoId") Long photoId);
+    JSONObject getMd5ByPhotoId(@Param("photoId") String photoId);
 
     List<JSONObject> getImageListByMd5(@Param("md5") String md5);
 

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

@@ -443,7 +443,13 @@
         t1.user_id
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.code
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -457,8 +463,6 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
-        AND t4.stat_date &gt;= #{startTime}
-        AND t4.stat_date &lt;= concat(#{endTime},' 23:59:59')
         GROUP BY t1.user_id
         ) t
     </select>
@@ -481,7 +485,13 @@
         t3.role_name
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.code
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -495,8 +505,6 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
         GROUP BY t1.user_id
         ) k
         LEFT JOIN
@@ -505,7 +513,13 @@
         t1.user_id, SUM(t5.charge) 'zhenren_charge'
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -519,10 +533,7 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60155
+        WHERE t2.parent_id = 60155
         GROUP BY t1.user_id
         ) k1 ON k1.user_id =k.user_id
         LEFT JOIN
@@ -531,7 +542,13 @@
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -544,10 +561,7 @@
             AND tt3.role_code = #{roleCode}
         </if>
         ) t3 ON t3.id = t1.user_id
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60155
+        WHERE t2.parent_id = 60155
         GROUP BY t1.user_id,t1.`code`
         ) t
         GROUP BY user_id
@@ -558,7 +572,13 @@
         t1.user_id, SUM(t5.charge) 'zhizuo_charge'
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -572,10 +592,7 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60156
+        WHERE t2.parent_id = 60156
         GROUP BY t1.user_id
         )k3 ON k3.user_id =k.user_id
         LEFT JOIN
@@ -584,7 +601,13 @@
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -597,10 +620,7 @@
             AND tt3.role_code = #{roleCode}
         </if>
         ) t3 ON t3.id = t1.user_id
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60156
+        WHERE  t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`
         ) t
         GROUP BY user_id
@@ -632,7 +652,13 @@
         t3.role_name
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.code
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -646,8 +672,6 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
         GROUP BY t1.user_id
         ) k
         LEFT JOIN
@@ -656,8 +680,15 @@
         t1.user_id, SUM(t5.charge) 'zhenren_charge'
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
-        INNER JOIN(
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
         LEFT JOIN sys_role tt3 ON tt2.role_id = tt3.id
@@ -670,10 +701,7 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60155
+        WHERE t2.parent_id = 60155
         GROUP BY t1.user_id
         )k1 ON k1.user_id =k.user_id
         LEFT JOIN
@@ -682,7 +710,13 @@
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -695,10 +729,7 @@
             AND tt3.role_code = #{roleCode}
         </if>
         ) t3 ON t3.id = t1.user_id
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60155
+        WHERE t2.parent_id = 60155
         GROUP BY t1.user_id,t1.`code`
         ) t
         GROUP BY user_id
@@ -709,7 +740,13 @@
         t1.user_id, SUM(t5.charge) 'zhizuo_charge'
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -723,10 +760,7 @@
         </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60156
+        WHERE t2.parent_id = 60156
         GROUP BY t1.user_id
         )k3 ON k3.user_id =k.user_id
         LEFT JOIN
@@ -735,7 +769,13 @@
         t1.user_id,t4.signature
         FROM ctop_material_tag_info t1
         LEFT JOIN ctop_tag_info  t2 ON t2.id = t1.tag_id
-        LEFT JOIN ctop_kuaishou_video_get t4 ON t4.signature= t1.`code`
+        INNER JOIN
+        (
+        SELECT signature  FROM ctop_kuaishou_video_get
+        WHERE  stat_date &gt;=  #{startTime}
+        AND stat_date &lt;=  concat(#{endTime},' 23:59:59')
+        GROUP BY signature
+        ) t4 ON t4.signature= t1.`code`
         INNER JOIN(
         SELECT tt1.id,tt3.role_name,tt1.realname FROM sys_user tt1
         LEFT JOIN sys_user_role tt2 ON tt1.id = tt2.user_id
@@ -748,10 +788,7 @@
             AND tt3.role_code = #{roleCode}
         </if>
         ) t3 ON t3.id = t1.user_id
-        WHERE 1=1
-        AND t4.stat_date &gt;=  #{startTime}
-        AND t4.stat_date &lt;=  concat(#{endTime},' 23:59:59')
-        AND t2.parent_id = 60156
+        WHERE t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`
         ) t
         GROUP BY user_id

+ 1 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -304,12 +304,10 @@
         supplier_account_name
         FROM ctop_kuaishou_video_get t1
         INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-        WHERE t1.`status` =0
-        AND t2.project_id=#{projectId}
+        WHERE t2.project_id=#{projectId}
         <if test="updateTime!=null and updateTime!=''">
             AND t1.update_time &gt; #{updateTime}
         </if>
-        group by t1.signature
     </select>
 
     <select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -599,7 +599,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         Integer createType = template.getCreateType();
         if (createType == 0) { // 单品
             Long photoId = template.getPhotoId();
-            JSONObject videoMd5Json = groupTemplateMapper.getMd5ByPhotoId(photoId);
+            JSONObject videoMd5Json = groupTemplateMapper.getMd5ByPhotoId(String.valueOf(photoId));
             if (Check.isNull(videoMd5Json)) {
                 log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
                 updateTemplate.setCreativeStatus(3);
@@ -655,7 +655,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             }
             for (int i = 0; i < array.size(); i++) {
                 Long photoId = array.getLong(i);
-                JSONObject videoJson = groupTemplateMapper.getMd5ByPhotoId(photoId);
+                JSONObject videoJson = groupTemplateMapper.getMd5ByPhotoId(String.valueOf(photoId));
                 if (Check.isNull(videoJson)) {
                     log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
                     updateTemplate.setCreativeStatus(3);

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.OauthConfig;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -127,7 +128,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouPopulationGroupService populationGroupService;
     @Autowired
     private IKuaishouAppPackageService appPackageService;
-
+    @Autowired
+    private UserAllocationMapper allocationMapper;
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         try {
@@ -778,8 +780,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     @Override
     public void loadKuaishouDataSingle(CtopOauthToken token) throws java.text.ParseException {
-
-
         Date endDate = new Date();
         for (int i = 0; i < 7; i++) {
             Date getStartDate = DateUtils.addDay(endDate, -i);

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProjectVideoGetServiceImpl.java

@@ -67,7 +67,7 @@ public class KuaishouProjectVideoGetServiceImpl extends ServiceImpl<KuaishouProj
             if (Check.isNull(updateTime) && pageNo == 1) {
                 updateTime = projectVideoGetMapper.queryLatestUpdateTime(projectId);
             }
-            PageHelper.startPage(pageNo, 1500, false);
+            PageHelper.startPage(pageNo, 1000, false);
             List<KuaishouProjectVideoGet> list = videoGetMapper.selectProjectVideo(projectId, updateTime);
             if (Check.isNull(list)) {
                 return;

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java

@@ -21,4 +21,8 @@ public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<
     void replaceBatch(@Param(value = "records")List<EtlKuaishouAccountMaterialReportDaily> getList);
 
     void replace(@Param(value = "report")EtlKuaishouAccountMaterialReportDaily report);
+
+    void etlKuaishouReportCompanyInfo(@Param(value = "formatDate") String formatDate);
+
+    void etlKuaishouVideoReportStateDate();
 }

+ 18 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml

@@ -208,6 +208,22 @@
             #{report.play3sCount}
         )
     </insert>
+    <update id="etlKuaishouReportCompanyInfo">
+        update ctop_etl_kuaishou_account_material_report_daily a left join ctop_user_allocation cua on a.account_id = cua.account_id
+            left join user_company uc on cua.user_id = uc.user_id
+            set a.company_name = uc.company_name
+        where a.company_name is null
+          and uc.company_name is not null
+          and a.stat_date = #{formatDate}
+    </update>
+    <update id="etlKuaishouVideoReportStateDate">
+        UPDATE ctop_etl_kuaishou_video_info info
+            LEFT JOIN ( SELECT min( stat_date ) AS minDate, signature FROM ctop_kuaishou_report_daily_material GROUP BY signature ) a ON a.signature = info.video_code
+            SET info.state_date = a.minDate
+        WHERE
+            a.minDate IS NOT NULL
+          AND info.state_date IS NULL
+    </update>
     <select id="etlKuaishouAccountMaterialReportDailyList"
             resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily">
     select
@@ -216,7 +232,7 @@
     u.project_id ,
     p.project_name,
     m.account_id,
-    m.signature,
+    video.signature,
     sum(m.charge)as charge ,
     sum(m.photo_show)as photo_show ,
     sum(m.aclick)as aclick ,
@@ -242,6 +258,7 @@
     sum(m.form_count)as form_count,
      round(sum(m.play_3s_ratio*m.photo_show))as play_3s_count
     from ctop_kuaishou_report_daily_material m left join ctop_user_allocation u on u.account_id = m.account_id
+    left  join ctop_kuaishou_video_get video on video.account_id = m.account_id and m.photo_id = video.photo_id
 left join ctop_project p on p.id = u.project_id
 left join user_company c on c.user_id = u.account_id
 where 1=1

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java

@@ -14,4 +14,8 @@ public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<
     void etlKuaishouAccountMaterialReportDailyData(String date);
 
     void etlKuaishouAccountMaterialReportInfo(String formatDate);
+
+    void etlKuaishouReportCompanyInfo(String formatDate);
+
+    void etlKuaishouVideoReportStateDate();
 }

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java

@@ -76,4 +76,14 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
         }
         log.info("{}数据获取完成",formatDate);
     }
+
+    @Override
+    public void etlKuaishouReportCompanyInfo(String formatDate) {
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouReportCompanyInfo(formatDate);
+    }
+
+    @Override
+    public void etlKuaishouVideoReportStateDate() {
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouVideoReportStateDate();
+    }
 }

+ 69 - 10
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceVideoSlogenInfoController.java

@@ -1,8 +1,13 @@
 package cn.com.ctop.toutiao.modules.material.controller;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.common.module.utils.StringUtils;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 头条视频文案信息
@@ -31,7 +38,8 @@ import java.util.Date;
 public class BytedanceVideoSlogenInfoController {
 	@Autowired
 	private IBytedanceVideoSlogenInfoService bytedanceVideoSlogenInfoService;
-
+	@Autowired
+	private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 	/**
 	  * 分页列表查询
 	 * @param slogenInfo
@@ -85,17 +93,68 @@ public class BytedanceVideoSlogenInfoController {
 	@PostMapping(value = "/edit")
 	public Result<BytedanceVideoSlogenInfo> edit(@RequestBody BytedanceVideoSlogenInfo slogenInfo) {
 		Result<BytedanceVideoSlogenInfo> result = new Result<>();
-		BytedanceVideoSlogenInfo bytedanceVideoSlogenInfoEntity = bytedanceVideoSlogenInfoService.getById(slogenInfo.getId());
-		if(bytedanceVideoSlogenInfoEntity==null) {
-			result.error500("未找到对应实体");
+		try{
+			BytedanceVideoSlogenInfo bytedanceVideoSlogenInfoEntity = bytedanceVideoSlogenInfoService.getById(slogenInfo.getId());
+			if(bytedanceVideoSlogenInfoEntity==null) {
+				result.error500("未找到对应实体");
+				return result;
+			}
+			LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			slogenInfo.setUpdateBy(user.getId());
+			slogenInfo.setUpdateTime(new Date());
+
+			String title = slogenInfo.getSlogan();
+			title = title.trim().replaceAll("[\\{]{2,}", "{");
+			title = title.trim().replaceAll("[\\}]{2,}", "}");
+			slogenInfo.setSlogan(title);
+
+
+			String reg = "\\{[\\u4e00-\\u9fa5\\-]{2,6}\\}";
+			Pattern pattern = Pattern.compile(reg);
+			Matcher matcher = pattern.matcher(title);
+			JSONArray creativeWordIdsArray = new JSONArray();
+
+			int len = StringUtils.lengthAsSlogan(title);
+			int left = title.indexOf("{");
+			int right = title.indexOf("}");
+			if (left >= 0 || right >= 0) {
+				int times = 0;
+				while (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配
+					times++;
+					if (times >= 3) {
+						result.error500("动态词包不合法,词包数量超过2个");
+						return result;
+					}
+					String matchStr = matcher.group();//获取当前匹配的值
+					title = title.replace(matchStr,"");
+					ByteDanceCreativeWordPackage creativeWordPackage = byteDanceGeneralCopywriterService.selectCreativeWordPackageByName(matchStr.substring(1, matchStr.length() - 1));
+					if (Check.isNull(creativeWordPackage)) {
+						return result.error500("动态词包不合法,词包不存在或者含有单独的非词包大括号");
+					}
+					creativeWordIdsArray.add(creativeWordPackage.getCreativeWordId());
+					len = len - (right - left) + creativeWordPackage.getMaxWordLen();
+					left = title.indexOf("{");
+					right = title.indexOf("}");
+				}
+				if(title.contains("{") || title.contains("}")){
+					return result.error500("大括号单独出现或大括号中内容不合法");
+				}
+				slogenInfo.setCreativeWordIds(creativeWordIdsArray.toJSONString());
+			}
+			//校验标题长度,长度小于5和大于30的全部过滤
+			if (len < 5 || len > 30) {
+				return result.error500("文案长度不合法,小于5或大于30");
+			}
+
+			bytedanceVideoSlogenInfoService.updateById(slogenInfo);
+			result.setCode(0);
+			result.setMessage("修改成功!");
+			return result;
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
 			return result;
 		}
-		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-		slogenInfo.setUpdateBy(user.getId());
-		slogenInfo.setUpdateTime(new Date());
-		bytedanceVideoSlogenInfoService.updateById(slogenInfo);
-		result.success("修改成功!");
-		return result;
 	}
 
 	/**

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceCreativeWordPackageMapper.java

@@ -15,4 +15,6 @@ import java.util.List;
  */
 public interface ByteDanceCreativeWordPackageMapper extends BaseMapper<ByteDanceCreativeWordPackage> {
     void replaceBatch(@Param(value = "creativeWordPackages") List<ByteDanceCreativeWordPackage> creativeWordPackages);
+
+    ByteDanceCreativeWordPackage selectCreativeWordPackageByName(String name);
 }

+ 2 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceVideoSlogenInfoMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.material.mapper;
 
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 头条视频文案信息
@@ -10,5 +11,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @version V1.0
  */
 public interface BytedanceVideoSlogenInfoMapper extends BaseMapper<BytedanceVideoSlogenInfo> {
-
+    void updateStatusToZero(@Param("projectId") Long projectId,@Param("videoCode") String videoCode,@Param("userId") String userId);
 }

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceCreativeWordPackageMapper.xml

@@ -26,4 +26,9 @@
             )
         </foreach>
     </insert>
+
+    <select id="selectCreativeWordPackageByName" resultType="cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage">
+        select * from ctop_bytedance_creative_word_package where name = #{name}
+    </select>
+
 </mapper>

+ 8 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceVideoSlogenInfoMapper.xml

@@ -1,5 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.toutiao.modules.material.mapper.BytedanceVideoSlogenInfoMapper">
-
+    <update id="updateStatusToZero" >
+        update ctop_bytedance_video_slogen_info a set a.status = 0
+        where 1=1
+        and a.video_code = #{videoCode} and a.create_by = #{userId}
+        <if test="projectId != null">
+            and a.project_id = #{projectId}
+        </if>
+    </update>
 </mapper>

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceCreativeWordPackageService.java

@@ -17,5 +17,5 @@ import java.util.Map;
  */
 public interface IByteDanceCreativeWordPackageService extends IService<ByteDanceCreativeWordPackage> {
     Map<String, Object> getCreativeWordPackage();
-
+    public ByteDanceCreativeWordPackage selectCreativeWordPackageByName(String name);
 }

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceVideoSlogenInfoService.java

@@ -17,4 +17,6 @@ public interface IBytedanceVideoSlogenInfoService extends IService<BytedanceVide
     void insertSlogans(Long projectId, String videoCode, JSONArray slogans, String userId);
 
     List<BytedanceVideoSlogenInfo> listByParams(String code, Integer status);
+
+    void deleteAllSlogens(Long projectId, String videoCode, String userId);
 }

+ 4 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeWordPackageServiceImpl.java

@@ -62,5 +62,8 @@ public class ByteDanceCreativeWordPackageServiceImpl extends ServiceImpl<ByteDan
             byteDanceCreativeWordPackageMapper.replaceBatch(resultList);
         }
     }
-
+    @Override
+    public ByteDanceCreativeWordPackage selectCreativeWordPackageByName(String name){
+        return byteDanceCreativeWordPackageMapper.selectCreativeWordPackageByName(name);
+    }
 }

+ 2 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceImageInfoServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -17,7 +18,7 @@ import java.util.List;
  */
 @Service
 public class BytedanceImageInfoServiceImpl extends ServiceImpl<BytedanceImageInfoMapper, BytedanceImageInfo> implements IBytedanceImageInfoService {
-    @Autowired
+    @Resource
     private BytedanceImageInfoMapper imageInfoMapper;
     @Override
     public void replaceBatch(List<BytedanceImageInfo> videoInfoList) {

+ 10 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -21,6 +22,9 @@ import java.util.List;
  */
 @Service
 public class BytedanceVideoSlogenInfoServiceImpl extends ServiceImpl<BytedanceVideoSlogenInfoMapper, BytedanceVideoSlogenInfo> implements IBytedanceVideoSlogenInfoService {
+    @Resource
+    BytedanceVideoSlogenInfoMapper bytedanceVideoSlogenInfoMapper;
+
     @Override
     public void insertSlogans(Long projectId, String videoCode, JSONArray slogans,String userId){
         if(null==slogans||slogans.isEmpty()){
@@ -36,6 +40,12 @@ public class BytedanceVideoSlogenInfoServiceImpl extends ServiceImpl<BytedanceVi
             this.save(slogenInfo);
         }
     }
+
+    @Override
+    public void deleteAllSlogens(Long projectId, String videoCode, String userId){
+        bytedanceVideoSlogenInfoMapper.updateStatusToZero(projectId, videoCode, userId);
+    }
+
     @Override
     public List<BytedanceVideoSlogenInfo> listByParams(String code, Integer status) {
         QueryWrapper<BytedanceVideoSlogenInfo>queryWrapper =new QueryWrapper<>();

+ 236 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/controller/BytedanceOperationLogController.java

@@ -0,0 +1,236 @@
+package cn.com.ctop.toutiao.modules.operation.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import cn.com.ctop.toutiao.modules.operation.service.IBytedanceOperationLogService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 操作日志
+ * @author jeecg-boot
+ * @date   2021-06-17
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="操作日志")
+@RestController
+@RequestMapping("/operation/bytedanceOperationLog")
+public class BytedanceOperationLogController {
+	@Autowired
+	private IBytedanceOperationLogService bytedanceOperationLogService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceOperationLog
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="操作日志-分页列表查询", notes="操作日志-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceOperationLog>> queryPageList(BytedanceOperationLog bytedanceOperationLog,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<BytedanceOperationLog>> result = new Result<>();
+		QueryWrapper<BytedanceOperationLog> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceOperationLog, req.getParameterMap());
+		Page<BytedanceOperationLog> page = new Page<BytedanceOperationLog>(pageNo, pageSize);
+		IPage<BytedanceOperationLog> pageList = bytedanceOperationLogService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceOperationLog
+	 * @return
+	 */
+	@ApiOperation(value="操作日志-添加", notes="操作日志-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceOperationLog> add(@RequestBody BytedanceOperationLog bytedanceOperationLog) {
+		Result<BytedanceOperationLog> result = new Result<>();
+		try {
+			bytedanceOperationLogService.save(bytedanceOperationLog);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceOperationLog
+	 * @return
+	 */
+	@ApiOperation(value="操作日志-编辑", notes="操作日志-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceOperationLog> edit(@RequestBody BytedanceOperationLog bytedanceOperationLog) {
+		Result<BytedanceOperationLog> result = new Result<BytedanceOperationLog>();
+		BytedanceOperationLog bytedanceOperationLogEntity = bytedanceOperationLogService.getById(bytedanceOperationLog.getId());
+		if(bytedanceOperationLogEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceOperationLogService.updateById(bytedanceOperationLog);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="操作日志-通过id删除", notes="操作日志-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id") String id) {
+		try {
+			bytedanceOperationLogService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="操作日志-批量删除", notes="操作日志-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<BytedanceOperationLog> deleteBatch(@RequestParam(name="ids") String ids) {
+		Result<BytedanceOperationLog> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceOperationLogService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="操作日志-通过id查询", notes="操作日志-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceOperationLog> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceOperationLog> result = new Result<>();
+		BytedanceOperationLog bytedanceOperationLog = bytedanceOperationLogService.getById(id);
+		if(bytedanceOperationLog==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceOperationLog);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<BytedanceOperationLog> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              BytedanceOperationLog bytedanceOperationLog = JSON.parseObject(deString, BytedanceOperationLog.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(bytedanceOperationLog, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<BytedanceOperationLog> pageList = bytedanceOperationLogService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "操作日志列表");
+      mv.addObject(NormalExcelConstants.CLASS, BytedanceOperationLog.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("操作日志列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<BytedanceOperationLog> listBytedanceOperationLogs = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceOperationLog.class, params);
+              bytedanceOperationLogService.saveBatch(listBytedanceOperationLogs);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceOperationLogs.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 61 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/entity/BytedanceOperationLog.java

@@ -0,0 +1,61 @@
+package cn.com.ctop.toutiao.modules.operation.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 操作日志
+ * @author jeecg-boot
+ * @date   2021-06-17
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_operation_log")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_operation_log对象", description="操作日志")
+public class BytedanceOperationLog {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private String id;
+	/**原始数据*/
+	@Excel(name = "原始数据", width = 15)
+    @ApiModelProperty(value = "原始数据")
+	private Object oldData;
+	/**修改后的数据*/
+	@Excel(name = "修改后的数据", width = 15)
+    @ApiModelProperty(value = "修改后的数据")
+	private Object newData;
+	/**操作类型*/
+	@Excel(name = "操作类型", width = 15)
+    @ApiModelProperty(value = "操作类型")
+	private String operationType;
+	/**操作内容*/
+	@Excel(name = "操作内容", width = 15)
+    @ApiModelProperty(value = "操作内容")
+	private Object operationContent;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createById;
+	/**创建时间*/
+	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+}

+ 17 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/mapper/BytedanceOperationLogMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.toutiao.modules.operation.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 操作日志
+ * @author jeecg-boot
+ * 2021-06-17
+ * @version V1.0
+ */
+public interface BytedanceOperationLogMapper extends BaseMapper<BytedanceOperationLog> {
+
+}

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/mapper/xml/BytedanceOperationLogMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.operation.mapper.BytedanceOperationLogMapper">
+
+</mapper>

+ 14 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/service/IBytedanceOperationLogService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.toutiao.modules.operation.service;
+
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 操作日志
+ * @author jeecg-boot
+ * 2021-06-17
+ * @version V1.0
+ */
+public interface IBytedanceOperationLogService extends IService<BytedanceOperationLog> {
+
+}

+ 19 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/service/impl/BytedanceOperationLogServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.toutiao.modules.operation.service.impl;
+
+import cn.com.ctop.toutiao.modules.operation.mapper.BytedanceOperationLogMapper;
+import cn.com.ctop.toutiao.modules.operation.service.IBytedanceOperationLogService;
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 操作日志
+ * @author jeecg-boot
+ * 2021-06-17
+ * @version V1.0
+ */
+@Service
+public class BytedanceOperationLogServiceImpl extends ServiceImpl<BytedanceOperationLogMapper, BytedanceOperationLog> implements IBytedanceOperationLogService {
+
+}

+ 108 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/operation/util/GetChangeDateUtil.java

@@ -0,0 +1,108 @@
+package cn.com.ctop.toutiao.modules.operation.util;
+
+import cn.com.ctop.common.module.entity.SysUser;
+import cn.com.ctop.toutiao.modules.operation.entity.BytedanceOperationLog;
+import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
+
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.security.Timestamp;
+import java.util.*;
+
+public class GetChangeDateUtil {
+    /**
+     *
+     * <p>Title: compareFields</p>
+     * <p>Description: </p>  比较两个实体属性值
+     * @param obj1
+     * @param obj2
+     * @param ignoreArr 忽略的字段
+     * @return
+     */
+    public static Map<String, List<Object>> compareFields(Object obj1, Object obj2, String[] ignoreArr) {
+        try{
+            Map<String, List<Object>> map = new HashMap<String, List<Object>>();
+            List<String> ignoreList = null;
+            if(ignoreArr != null && ignoreArr.length > 0){
+                // array转化为list
+                ignoreList = Arrays.asList(ignoreArr);
+            }
+            if (obj1.getClass() == obj2.getClass()) {// 只有两个对象都是同一类型的才有可比性
+                Class clazz = obj1.getClass();
+                // 获取object的属性描述
+                PropertyDescriptor[] pds = Introspector.getBeanInfo(clazz,
+                        Object.class).getPropertyDescriptors();
+                for (PropertyDescriptor pd : pds) {// 这里就是所有的属性了
+                    String name = pd.getName();// 属性名
+                    if(ignoreList == null || !ignoreList.contains(name)){// 如果当前属性选择忽略比较,跳到下一次循环
+                        continue;
+                    }
+                    Method readMethod = pd.getReadMethod();// get方法
+                    // 在obj1上调用get方法等同于获得obj1的属性值
+                    Object o1 = readMethod.invoke(obj1);
+                    // 在obj2上调用get方法等同于获得obj2的属性值
+                    Object o2 = readMethod.invoke(obj2);
+                    if(o1 == null && o2 == null){                               //o1 旧     o2新    如果两个都是空就跳过
+                        continue;
+                    }else if(o1 == null && o2 != null){                         //如果O1旧的没有     O2新的有
+                        List<Object> list = new ArrayList<Object>();
+                        list.add("旧(null)");
+                        list.add("新"+"("+String.valueOf(o2)+")");
+                        map.put(name, list);
+                        continue;
+                    }
+                    if (!o1.equals(o2)) {// 比较这两个值是否相等,不等就可以放入map了                             //如果旧的和新的不相等
+                        List<Object> list = new ArrayList<Object>();
+
+                        if(o2==null) {
+                            list.add("旧"+"("+String.valueOf(o1)+")");
+                            list.add("新()");
+                        }else {
+                            list.add("旧"+"("+String.valueOf(o1)+")");
+                            list.add("新"+"("+String.valueOf(o2)+")");
+                        }
+                        map.put(name, list);
+                    }
+                }
+            }
+            return map;
+        }catch(Exception e){
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static String makeOperationContent(Object obj1, Object obj2, String[] ignoreArr){
+
+
+        Map<String, List<Object>> bject = GetChangeDateUtil.compareFields(obj1,obj2,ignoreArr);
+        Set<String> names = bject.keySet();
+        StringBuilder sb = new StringBuilder();
+        for (String name: names
+        ) {
+            sb.append(name + "由【"+bject.get(name).get(0) +"】改为了【"+ bject.get(name).get(1)+"】");
+            sb.append(",");
+//            System.out.println(name + "由【"+bject.get(name).get(0) +"】改为了【"+ bject.get(name).get(1)+"】");
+        }
+        return sb.substring(0,sb.length() - 1 >= 0 ? sb.length() - 1 : 0);
+    }
+
+    public static void main(String[] args) {
+
+        SysUser user1 = new SysUser();
+        user1.setRealname("张三");
+//        user1.setLeaderName("领导1号");
+//        user1.setDepartName("研发部门");
+//        user1.setRoleName("用户");
+        SysUser user2 = new SysUser();
+        user2.setRealname("张三");
+//        user2.setLeaderName("领导2号");
+//        user2.setDepartName("组织架构部门");
+//        user2.setRoleName("管理员");
+        String s = makeOperationContent(user1, user2, new String[]{"leaderName", "departName","roleName"});
+
+        System.out.println(s);
+
+    }
+}

+ 4 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.BytedanceConvertType;
+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.CtopAdConstant;
@@ -73,6 +74,8 @@ public class ReportServiceImpl implements IReportService {
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
     private IBytedanceInterfaceService bytedanceInterfaceService;
+    @Autowired
+    private UserAllocationMapper allocationMapper;
 
     @Override
     public void getAdvertiserReport(CtopOauthToken token, Date startDate, Date endDate, String bytedanceReportTypePl) {
@@ -442,7 +445,7 @@ public class ReportServiceImpl implements IReportService {
     @Override
     public void loadBytedanceHistoryData(CtopOauthToken token) {
         for (int i = 1; i < 180; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
+            Date getDate = DateUtils.addDay(new Date(),-i);
             this.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             this.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);