ソースを参照

Merge remote-tracking branch 'origin/master'

syh 4 年 前
コミット
faca38d856
18 ファイル変更375 行追加122 行削除
  1. 47 18
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  2. 1 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  3. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouCampaignController.java
  4. 5 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  5. 93 43
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/MaterialRefuseController.java
  6. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouCreative.java
  7. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  8. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
  9. 22 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  10. 110 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  11. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  12. 5 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  13. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  14. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java
  15. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml
  16. 50 17
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  17. 5 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java
  18. 19 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAccountServiceImpl.java

+ 47 - 18
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -10,6 +10,7 @@ import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
@@ -33,6 +34,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -48,16 +50,39 @@ public class SampleTest {
     @Autowired
     private IByteDanceCreativeService creativeService;
 
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+
     @Test
     public void loadBytedanceCreativeData() {
         /**
          *
          */
-        CtopOauthToken token = oauthTokenService.getTokenByAccountId(1649600126891015L);
-        creativeService.getAdvertiserCreative(token,null,null);
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(23212L);
+        iKuaishouInterfaceService.getCampaignList(token, null, null);
+//        advertiserDataService.getMaterialList(token);
+    }
+
+
+    @Test
+    public void test() {
+        /**
+         *
+         */
+        // CtopOauthToken token = oauthTokenService.getTokenByAccountId(23212L);
+        //  iKuaishouInterfaceService.getCampaignList(token,null,null);
 //        advertiserDataService.getMaterialList(token);
+
+
+        // HttpUtils.httpPostRequest()
+        Map<String, Object> paramsMap = new HashMap<>();
+        paramsMap.put("campaignType",2);
+        String url = "https://ad.e.kuaishou.com/rest/dsp/control-panel/cover/list/actionBarText";
+        String s = HttpUtils.httpGet(url, paramsMap, null);
+        System.err.println(s);
     }
 
+
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
@@ -78,7 +103,8 @@ public class SampleTest {
         log.info("总用时:{}毫秒", end - start);
     }
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(10);;
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    ;
     static CountDownLatch countDownLatch = null;
 
     @Test
@@ -153,21 +179,24 @@ public class SampleTest {
             }
         }
     }
+
     @Autowired
     private IByteDanceCampaignService campaignService;
+
     @Test
-    public void testGetCampaign(){
+    public void testGetCampaign() {
         CtopOauthToken token = oauthTokenService.getOauthTokenByAccountId("1649600126891015");
-        campaignService.getAdvertiserCampaign(token,"1672261893872756",null);
+        campaignService.getAdvertiserCampaign(token, "1672261893872756", null);
     }
 
     @Autowired
     private IKuaishouEffectVideoInfoService effectVideoInfoService;
+
     @Test
-    public void loadKuaishouEffectVideoInfo(){
-        List<KuaishouEffectVideoInfo>videoInfos = effectVideoInfoService.list();
-        for (KuaishouEffectVideoInfo video:videoInfos) {
-            if(null!=video.getSignature()&&!"".equals(video.getSignature())){
+    public void loadKuaishouEffectVideoInfo() {
+        List<KuaishouEffectVideoInfo> videoInfos = effectVideoInfoService.list();
+        for (KuaishouEffectVideoInfo video : videoInfos) {
+            if (null != video.getSignature() && !"".equals(video.getSignature())) {
                 effectVideoInfoService.updateFinalCostDateBySignature(video.getSignature());
                 effectVideoInfoService.updateInitialCostDateBySignature(video.getSignature());
                 effectVideoInfoService.updateTotalCostBySignature(video.getSignature());
@@ -177,7 +206,7 @@ public class SampleTest {
     }
 
     @Test
-    public void getIndustryInfo(){
+    public void getIndustryInfo() {
         String access_token = "cbdf6502c04978ae401cb92a64530fb73a8c7dbe";
         // 请求地址
         String url = "https://ad.oceanengine.com/open_api/2/tools/industry/get/";
@@ -186,10 +215,10 @@ public class SampleTest {
     }
 
     @Test
-    public void loadImageInfo()throws Exception{
-        List<CtopOauthToken>tokens = oauthTokenService.selectToutiaoToken();
-        for (CtopOauthToken token:tokens) {
-            advertiserDataService.getImageByPage(token,null,1);
+    public void loadImageInfo() throws Exception {
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        for (CtopOauthToken token : tokens) {
+            advertiserDataService.getImageByPage(token, null, 1);
             Thread.sleep(1000L);
         }
     }
@@ -197,14 +226,14 @@ public class SampleTest {
     @Resource
     private KieSession kieSession;
     @Autowired
-    private IRuleEngineService ruleEngineService ;
+    private IRuleEngineService ruleEngineService;
 
     @Test
-    public void testEngine(){
-        QueryParam queryParam1 = new QueryParam() ;
+    public void testEngine() {
+        QueryParam queryParam1 = new QueryParam();
         queryParam1.setParamId("1");
         queryParam1.setParamSign("+");
-        QueryParam queryParam2 = new QueryParam() ;
+        QueryParam queryParam2 = new QueryParam();
         queryParam2.setParamId("2");
         queryParam2.setParamSign("-");
         // 入参

+ 1 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -125,14 +125,7 @@ public class BatchController {
             String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, 1);
 
 
-            Thread planThread = new Thread() {
-                @Override
-                public void run() {
-                    iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
-
-                }
-            };
-            planThread.start();
+            iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
 
 
             Thread thread = new Thread() {

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouCampaignController.java

@@ -66,6 +66,7 @@ public class KuaiShouCampaignController {
                                                          HttpServletRequest req) {
         Result<IPage<KuaiShouCampaign>> result = new Result<>();
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());
+        queryWrapper.orderByDesc("put_create_time");
         Page<KuaiShouCampaign> page = new Page<KuaiShouCampaign>(pageNo, pageSize);
         IPage<KuaiShouCampaign> pageList = kuaiShouCampaignService.page(page, queryWrapper);
         result.setSuccess(true);

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -144,7 +144,7 @@ public class KuaiShouController {
         }
 
         try{
-            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(),dto.getProjectList(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
             result.setResult(kuaishouReportDailyAccountDTOList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -173,7 +173,7 @@ public class KuaiShouController {
         }
 
         try{
-            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouSaleAccountInfoByProjectId(dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouSaleAccountInfoByProjectId(dto.getProjectList(), dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
             result.setResult(kuaishouReportDailyAccountDTOList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -202,7 +202,7 @@ public class KuaiShouController {
         }
 
         try{
-            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getAccountId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getProjectList(), dto.getAccountId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
             result.setResult(kuaishouCampaignInfoList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -231,7 +231,7 @@ public class KuaiShouController {
         }
 
         try{
-            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getProjectList(), dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
             result.setResult(kuaishouCampaignInfoList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -259,7 +259,7 @@ public class KuaiShouController {
         }
 
         try{
-            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getUnitId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getProjectList(), dto.getUnitId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
             result.setResult(kuaishouCampaignInfoList);
         }catch(Exception e){
             log.error(e.getMessage());

+ 93 - 43
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/MaterialRefuseController.java

@@ -19,12 +19,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @Slf4j
 @RestController
-@RequestMapping("/MaterialRefuse")
+@RequestMapping("/MaterialRefuse/")
 public class MaterialRefuseController {
     @Autowired
     private IMaterialRefuseService materialRefuseService;
@@ -34,9 +35,10 @@ public class MaterialRefuseController {
     private IKuaiShouUpdateService updateService;
     @Autowired
     private IKuaiShouCreativeService creativeService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(15);
 
 
-    @GetMapping(value = "/getRefuseCreative")
+    @GetMapping(value = "getRefuseCreative")
     public Result<IPage<KuaiShouCreative>> getRefuseCreative(KuaiShouCreative creative,
                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@@ -58,13 +60,36 @@ public class MaterialRefuseController {
         return result;
     }
 
-    @PostMapping(value = "/updateCreative")
-    public Map<String, Object> updateCreative(@RequestBody JSONObject jsonObject) {
-        Map<String, Object> map = new HashMap<>();
+
+    @GetMapping(value = "syncCreative")
+    public Result<Boolean> syncCreative(Long accountId, Long campaignId) {
+        Result<Boolean> result = new Result<>();
+        try {
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("media_id", 2);
+            queryWrapper.orderByDesc("create_time");
+            queryWrapper.last("limit 1");
+            CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(queryWrapper);
+            if (Check.isNull(ctopOauthToken)) {
+                throw new Exception("未获取到授权信息");
+            }
+            creativeService.syncCreative(accountId, ctopOauthToken.getAccessToken(), campaignId);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+    @PostMapping(value = "updateCreative")
+    public Result<Boolean> updateCreative(@RequestBody JSONObject jsonObject) {
+        Result<Boolean> result = new Result<>();
         if (Check.isNull(jsonObject)) {
-            map.put("code", -1);
-            map.put("message", "入参为空");
-            return map;
+            result.setSuccess(false);
+            result.setMessage("入参为空");
+            return result;
         }
 
         Long accountId = jsonObject.getLong("accountId");
@@ -75,34 +100,33 @@ public class MaterialRefuseController {
         queryWrapper.last("limit 1");
         CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(queryWrapper);
         if (Check.isNull(ctopOauthToken)) {
-            map.put("code", -1);
-            map.put("message", "未获取授权信息");
-            return map;
+            result.setSuccess(false);
+            result.setMessage("未获取到授权信息");
+            return result;
         }
 
         Map<String, Object> creativeMap = updateService.updateCreative(ctopOauthToken.getAccessToken(), accountId, jsonObject);
         if (Check.isNullMap(creativeMap)) {
-
-            map.put("code", -1);
-            map.put("message", "修改失败,返回为空");
-            return map;
+            result.setSuccess(false);
+            result.setMessage("修改失败,返回为空");
+            return result;
         }
 
         if ((Integer) creativeMap.get("code") != 0) {
-            map.put("code", -1);
-            map.put("message", creativeMap.get("message"));
-            return map;
+            result.setSuccess(false);
+            result.setMessage((String) creativeMap.get("message"));
+            return result;
         }
+        result.setSuccess(true);
 
-        return null;
+        return result;
     }
 
 
-    @PostMapping(value = "/batchUpdateCreative")
-    public Result<JSONObject> batchUpdateCreative(@RequestBody JSONObject jsonObject) {
+    @PostMapping(value = "batchUpdateCreative")
+    public Result<Boolean> batchUpdateCreative(@RequestBody JSONObject jsonObject) {
 
-        Result<JSONObject> result = new Result<>();
-        JSONObject returnJson = new JSONObject();
+        Result<Boolean> result = new Result<>();
         if (Check.isNull(jsonObject)) {
             result.setSuccess(false);
             result.setMessage("入参为空");
@@ -122,42 +146,68 @@ public class MaterialRefuseController {
             return result;
         }
 
+        Integer type = jsonObject.getInteger("type");
+        if (Check.isNull(type)) {
+            result.setSuccess(false);
+            result.setMessage("请选择修改类型");
+            return result;
+        }
+
+
         JSONArray creativeArr = jsonObject.getJSONArray("creativeArr");
-        Integer successCount = 0;
-        Integer failCount = 0;
-        if (!Check.isNull(creativeArr)) {
-
-            for (int i = 0; i < creativeArr.size(); i++) {
-                JSONObject creativeJson = creativeArr.getJSONObject(i);
-                if (!Check.isNull(creativeJson)) {
-                    Long creativeId = creativeJson.getLong("creativeId");
-                    JSONObject requestJson = new JSONObject();
-                    requestJson.put("creativeId", creativeId);
+        if (Check.isNull(creativeArr)) {
+            result.setSuccess(false);
+            result.setMessage("请选择修改创意");
+            return result;
+        }
+
+
+        for (int i = 0; i < creativeArr.size(); i++) {
+            JSONObject creativeJson = creativeArr.getJSONObject(i);
+            if (!Check.isNull(creativeJson)) {
+                Long creativeId = creativeJson.getLong("creativeId");
+                JSONObject requestJson = new JSONObject();
+                requestJson.put("creativeId", creativeId);
+                if (type == 0) {  // 替换修改广告语
                     String description = creativeJson.getString("description");
-                    if (!Check.isNull(description)) {
-                        requestJson.put("description", convertMoString(description));
+                    requestJson.put("description", convertMoString(description));
+                } else if (type == 1) { // 替换广告语
+                    String updateDescription = jsonObject.getString("updateDescription");
+                    String updateActionBarText = jsonObject.getString("updateActionBarText");
+                    if (Check.isNull(updateDescription) && Check.isNull(updateActionBarText)) {
+                        result.setSuccess(false);
+                        result.setMessage("广告语和行动号召按钮不能同时为空");
+                        return result;
+                    }
+                    if (!Check.isNull(updateDescription)) {
+                        requestJson.put("description", updateDescription);
+                    }
+                    if (!Check.isNull(updateActionBarText)) {
+                        requestJson.put("actionBarText", updateActionBarText);
+                    }
+
+                }
+
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
                         Map<String, Object> creativeMap = updateService.updateCreative(ctopOauthToken.getAccessToken(), accountId, requestJson);
                         Integer code = (Integer) creativeMap.get("code");
                         if (code == 0) {
                             log.info("拒审重提成功,accountId:{},creativeId:{}", accountId, creativeId);
-                            successCount += 1;
-
                         } else {
                             log.info("拒审重提失败,accountId:{},creativeId:{}", accountId, creativeId);
-                            failCount += 1;
                         }
                     }
+                });
 
-                }
 
             }
 
         }
-        returnJson.put("successCount", successCount);
-        returnJson.put("failCount", failCount);
 
         result.setSuccess(true);
-        result.setResult(returnJson);
+        result.setMessage("异步执行中,请稍后查看");
         return result;
     }
 

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouCreative.java

@@ -189,8 +189,9 @@ public class KuaiShouCreative {
      */
     @Excel(name = "第三方有效播放监测链接", width = 15)
     @ApiModelProperty(value = "第三方有效播放监测链接")
-    private String adPhotoPlayedT3sUrl;
+    private String adPhotoPlayedT3sUrl; // 第三方有效播放监测链接
     private String shortSlogan;
+    private String actionbarClickUrl; // 第三方点击按钮监测链接
     /**
      * 创建时间
      */

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

@@ -34,6 +34,7 @@
         programmed_creative_material,
         photo_ids,
         short_slogan,
+        actionbar_click_url,
         creative_create_time,
         creative_update_time,
         create_time,
@@ -72,6 +73,7 @@
             #{creative.programmedCreativeMaterial},
             #{creative.photoIds},
             #{creative.shortSlogan},
+            #{creative.actionbarClickUrl},
             #{creative.creativeCreateTime},
             #{creative.creativeUpdateTime},
             #{creative.createTime},

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

@@ -31,4 +31,6 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
      * @return
      */
     Integer checkCreativeCount(Long accountId, Long unitId);
+
+    void syncCreative(Long accountId, String accessToken, Long campaignId);
 }

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

@@ -1046,20 +1046,31 @@ public class BatchServiceImpl implements IBatchService {
                     continue;
                 }
                 creativeJson.put("creative_material_type", creative.getCreativeMaterialType());
+                String click_track_url = creative.getClickTrackUrl();
                 if (creative.getCreativeMaterialType() == 4) {
                     creativeJson.put("image_tokens", JSONArray.parseArray(creative.getImageTokens()));
                     creativeJson.put("short_slogan", creative.getShortSlogan());
+                    // 第三方开始播放监测链接
+                    if (!Check.isNull(click_track_url)) {
+                        creativeJson.put("impression_url", click_track_url);
+                    }
+
+                    if (!Check.isNull(creative.getImpressionUrl())) {
+                        creativeJson.put("impression_url", creative.getImpressionUrl());
+                    }
 
                 } else {
                     String photo_id = creative.getPhotoId();
                     creativeJson.put("photo_id", photo_id);
                     String image = creative.getImageToken();
                     creativeJson.put("image_token", image);
+                    if (!Check.isNull(click_track_url)) {
+                        creativeJson.put("click_track_url", click_track_url);
+                    }
                 }
 
 
                 String action_bar_text = creative.getActionBarText();
-                String click_track_url = creative.getClickTrackUrl();
                 JSONArray successArr = new JSONArray();
                 JSONArray failArr = new JSONArray();
                 String description = creative.getDescription();
@@ -1067,7 +1078,7 @@ public class BatchServiceImpl implements IBatchService {
                 creativeJson.put("action_bar_text", action_bar_text);
                 creativeJson.put("description", description.trim());
                 creativeJson.put("creative_name", name);
-                creativeJson.put("click_track_url", click_track_url);
+                //  creativeJson.put("click_track_url", click_track_url);
 
                 //封面广告语标题
                 if (!Check.isNull(creative.getStickerTitle())) {
@@ -1078,6 +1089,15 @@ public class BatchServiceImpl implements IBatchService {
                     creativeJson.put("overlay_type", creative.getOverlayType());
                 }
 
+                // 第三方有效播放监测链接
+                if (!Check.isNull(creative.getAdPhotoPlayedT3sUrl())) {
+                    creativeJson.put("ad_photo_played_t3s_url", creative.getAdPhotoPlayedT3sUrl());
+                }
+                // 第三方点击按钮监测链接
+                if (!Check.isNull(creative.getActionbarClickUrl())) {
+                    creativeJson.put("actionbar_click_url", creative.getActionbarClickUrl());
+                }
+
                 // 是否修改应用
                 if (!Check.isNull(appJson)) {
                     Boolean isUpdate = appJson.getBoolean("isUpdate");

+ 110 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java

@@ -1,17 +1,26 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouVideoGetMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 快手-创意信息
@@ -19,6 +28,7 @@ import java.util.List;
  * @Date: 2019-07-23
  * @Version: V1.0
  */
+@Slf4j
 @Service
 public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMapper, KuaiShouCreative> implements IKuaiShouCreativeService {
     @Autowired
@@ -65,4 +75,104 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
     public Integer checkCreativeCount(Long accountId, Long unitId) {
         return kuaiShouCreativeMapper.checkCreativeCount(accountId, unitId);
     }
+
+    @Override
+    public void syncCreative(Long accountId, String accessToken, Long campaignId) {
+
+
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        headers.put("Access-Token", accessToken);
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        param.put("page_size", 200);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, message);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            return;
+        }
+        List<KuaiShouCreative> creatives = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
+            if (!Check.isNull(detailJson)) {
+                KuaiShouCreative creative = new KuaiShouCreative();
+                creative.setId("" + accountId + detailJson.getLong("creative_id"));
+                creative.setAccountId(accountId);
+                creative.setCampaignId(detailJson.getLong("campaign_id"));
+                creative.setUnitId(detailJson.getLong("unit_id"));
+                creative.setCreativeId(detailJson.getLong("creative_id"));
+                creative.setCreativeName(detailJson.getString("creative_name"));
+                creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
+                if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
+                    creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
+                }
+
+                if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
+                    creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
+                }
+                creative.setStatus(detailJson.getInteger("status"));
+                creative.setPutStatus(detailJson.getInteger("put_status"));
+                creative.setCreateChannel(detailJson.getInteger("create_channel"));
+                creative.setReviewDetail(detailJson.getString("review_detail"));
+                creative.setCoverUrl(detailJson.getString("cover_url"));
+                creative.setImageToken(detailJson.getString("image_token"));
+                creative.setCoverWidth(detailJson.getString("cover_width"));
+                creative.setCoverHeight(detailJson.getString("cover_height"));
+                creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
+                creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
+                creative.setStickerTitle(detailJson.getString("sticker_title"));
+                creative.setOverlayType(detailJson.getString("overlay_type"));
+                creative.setClickTrackUrl(detailJson.getString("click_track_url"));
+                creative.setImpressionUrl(detailJson.getString("impression_url"));
+                creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
+                creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
+                creative.setShortSlogan(detailJson.getString("short_slogan"));
+                creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
+                JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
+                if (!Check.isNull(displayInfoJson)) {
+                    creative.setDescription(displayInfoJson.getString("description"));
+                    creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
+                }
+                creative.setCreateTime(new java.util.Date());
+                creative.setUpdateTime(new java.util.Date());
+                creative.setSiteId(detailJson.getLong("site_id"));
+                creative.setPhotoId(detailJson.getString("photo_id"));
+                if (detailJson.getLong("photo_id") == 0) {
+                    JSONArray photoIds = new JSONArray();
+                    JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                    if (!Check.isNull(programmed_creative_material)) {
+                        creative.setProgrammedCreativeMaterial(programmed_creative_material.toJSONString());
+                        JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                        if (!Check.isNull(materials)) {
+                            for (int j = 0; j < materials.size(); j++) {
+                                JSONObject materialJson = materials.getJSONObject(j);
+                                if (!Check.isNull(materialJson)) {
+                                    Long photo_id = materialJson.getLong("photo_id");
+                                    photoIds.add(String.valueOf(photo_id));
+                                }
+                            }
+                            creative.setPhotoIds(photoIds.toJSONString());
+                        }
+                    }
+                }
+                creatives.add(creative);
+            }
+        }
+        this.replaceBatch(creatives);
+    }
 }

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

@@ -59,8 +59,8 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
     public void getGroupList(String accessToken, Long accountId) {
         QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
         campaignQueryWrapper.eq("account_id", accountId);
-        campaignQueryWrapper.eq("status", 4);
-        campaignQueryWrapper.eq("put_status", 1);
+        /*campaignQueryWrapper.eq("status", 4);
+        campaignQueryWrapper.eq("put_status", 1);*/
         campaignQueryWrapper.orderByDesc("put_create_time");
         campaignQueryWrapper.last("limit 15");
         List<KuaiShouCampaign> list = kuaiShouCampaignService.list(campaignQueryWrapper);
@@ -216,6 +216,7 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                     creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
                     creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
                     creative.setShortSlogan(detailJson.getString("short_slogan"));
+                    creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
                     JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
                     if (!Check.isNull(displayInfoJson)) {
                         creative.setDescription(displayInfoJson.getString("description"));

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

@@ -489,6 +489,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             String creativeId = requestJson.getString("creativeId");
             String creativeName = requestJson.getString("creativeName");
             String description = requestJson.getString("description");
+            String action_bar_text = requestJson.getString("actionBarText");
             if (!Check.isNull(creativeId)) {
                 params.put("creative_id", creativeId);
             }
@@ -498,6 +499,9 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             if (!Check.isNull(description)) {
                 params.put("description", description);
             }
+            if (!Check.isNull(action_bar_text)) {
+                params.put("action_bar_text", action_bar_text);
+            }
 
 
             String result = HttpUtils.httpPostRequest(url, params, header);
@@ -508,7 +512,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                     returnMap.put("code", 0);
                     returnMap.put("success", true);
                     returnMap.put("message", "修改成功");
-                    Thread.sleep(100);
+                    Thread.sleep(50);
                     interfaceService.getCreativeByCreativeId(token, advertiserId, Long.valueOf(creativeId));
 
                 } else {

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

@@ -1348,6 +1348,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
                     creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
                     creative.setShortSlogan(detailJson.getString("short_slogan"));
+                    creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
                     JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
                     if (!Check.isNull(displayInfoJson)) {
                         creative.setDescription(displayInfoJson.getString("description"));
@@ -1528,6 +1529,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                     creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
                                     creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
                                     creative.setShortSlogan(detailJson.getString("short_slogan"));
+                                    creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
                                     JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
                                     if (!Check.isNull(displayInfoJson)) {
                                         creative.setDescription(displayInfoJson.getString("description"));
@@ -3049,6 +3051,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                     creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
                                     creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
                                     creative.setShortSlogan(detailJson.getString("short_slogan"));
+                                    creative.setActionbarClickUrl(detailJson.getString("actionbar_click_url"));
                                     JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
                                     if (!Check.isNull(displayInfoJson)) {
                                         creative.setDescription(displayInfoJson.getString("description"));

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

@@ -20,11 +20,11 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     List<ProjectAccountDTO> getKuaishouProjectInfo(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("yn")Integer yn);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(@Param("projectId")Long projectId, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("accountId")Long accountId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(@Param("projectList")List<Long> projectList, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("accountId")Long accountId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("campaignId")Long campaignId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(@Param("projectList")List<Long> projectList, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("campaignId")Long campaignId, @Param("accountIds")List<Long> accountIds, @Param("yn")Integer yn);
 
     List<Long> queryProjectMemberByUserId(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
 
@@ -36,7 +36,7 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     List<Long> queryProjectMemberByAdmins(@Param("mediaIds")List<Long> mediaIds);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("unitId")Long unitId, @Param("accountIds") List<Long> accoundIds, @Param("yn")Integer yn);
+    List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(@Param("projectList")List<Long> projectList, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("unitId")Long unitId, @Param("accountIds") List<Long> accoundIds, @Param("yn")Integer yn);
 
     KuaishouVideoInfoDTO getVideoUrl(@Param("photoId")Long photoId);
 

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

@@ -34,7 +34,7 @@
         case
         when t1.system_type = 'android'
         then 16
-        when t1.system_type = 'IOS'
+        when t1.system_type = 'ios'
         then 23
         else 0
         end

+ 50 - 17
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -566,8 +566,8 @@
         end
         ) as 'photoClickCost', -- 平均封面点击单价
         (CASE
-        WHEN sum(a.photo_click) != 0
-        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        WHEN sum(a.bclick) != 0
+        THEN round(sum(a.charge) / sum(a.bclick),2)
         ELSE 0
         end
         ) as 'actionCost', -- 平均行为单价
@@ -594,10 +594,18 @@
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
+        <if test="projectId !=null ">
+        and
+        b.project_id = #{projectId}
+        </if>
 
-        <if test="projectId!=null and projectId != '' ">
+        <if test="projectList !=null ">
             and
-            b.project_id = #{projectId}
+            b.project_id in
+            <foreach collection="projectList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="accountIds !=null">
             and a.account_id in
@@ -655,8 +663,8 @@
             end
             ) as 'photoClickCost', -- 平均封面点击单价
             (CASE
-            WHEN ( sum(a.photo_click) is not null and sum(a.photo_click) != 0)
-            THEN round(sum(a.charge) / sum(a.photo_click),2)
+            WHEN ( sum(a.bclick) is not null and sum(a.bclick) != 0)
+            THEN round(sum(a.charge) / sum(a.bclick),2)
             ELSE 0
             end
             ) as 'actionCost', -- 平均行为单价
@@ -736,8 +744,8 @@
         end
         ) as 'photoClickCost', -- 平均封面点击单价
         (CASE
-        WHEN sum(a.photo_click) != 0
-        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        WHEN sum(a.bclick) != 0
+        THEN round(sum(a.charge) / sum(a.bclick),2)
         ELSE 0
         end
         ) as 'actionCost', -- 平均行为单价
@@ -775,7 +783,14 @@
                 #{item}
             </foreach>
         </if>
-
+        <if test="projectList!=null">
+        and
+            b.project_id in
+            <foreach collection="projectList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
         group by a.campaign_id
         order by sum(a.charge) desc
 <!--        ) m-->
@@ -826,8 +841,8 @@
         end
         ) as 'photoClickCost', -- 平均封面点击单价
         (CASE
-        WHEN sum(a.photo_click) != 0
-        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        WHEN sum(a.bclick) != 0
+        THEN round(sum(a.charge) / sum(a.bclick),2)
         ELSE 0
         end
         ) as 'actionCost', -- 平均行为单价
@@ -855,7 +870,8 @@
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
-            <if test="campaignId != null and campaignId != ''">and
+            <if test="campaignId != null and campaignId != ''">
+            and
                 a.campaign_id = #{campaignId}
             </if>
             <if test="accountIds !=null">
@@ -865,6 +881,14 @@
                     #{item}
                 </foreach>
             </if>
+        <if test="projectList!=null">
+            and
+            b.project_id in
+            <foreach collection="projectList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
             group by unit_id
             order by sum(a.charge) desc
 <!--            ) m-->
@@ -881,7 +905,7 @@
         ctop_project_member b
         left join ctop_project c on b.project_id = c.id
         where b.user_id = #{userId}
-        and a.media_id in
+        and c.media_id in
         <foreach collection="mediaIds" item="item" separator=","
                  open="(" close=")">
             #{item}
@@ -999,8 +1023,8 @@
             end
             ) as 'photoClickCost', -- 平均封面点击单价
             (CASE
-            WHEN sum(a.photo_click) != 0
-            THEN round(sum(a.charge) / sum(a.photo_click),2)
+            WHEN sum(a.bclick) != 0
+            THEN round(sum(a.charge) / sum(a.bclick),2)
             ELSE 0
             end
             ) as 'actionCost', -- 平均行为单价
@@ -1043,6 +1067,14 @@
                     #{item}
                 </foreach>
             </if>
+        <if test="projectList!=null">
+            and
+            b.project_id in
+            <foreach collection="projectList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
             group by a.creative_id
             order by sum(a.charge) desc
 <!--        )m-->
@@ -1069,8 +1101,9 @@
         (select project_id,account_id,media_id from ctop_user_allocation  group by account_id) a
         left join ctop_project_member b on a.project_id=b.project_id
         where
-        and a.media_id in (2,4)
-        order by a.create_time desc
+        a.media_id in (2,4)
+        and user_id = #{userId}
+        order by create_time desc
         <if test="yn==1">
         limit 50
         </if>

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java

@@ -20,14 +20,14 @@ public interface IKuaishouReportDailyAccountService extends IService<KuaishouRep
 
     PageInfo<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort, Integer yn);
 
-    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouSaleAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouSaleAccountInfoByProjectId(List<Long> projectList, Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
-    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, List<Long> projectList, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
-    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(List<Long> projectList, Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
-    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(List<Long> projectList, Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
-    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(List<Long> projectList, Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
 }

+ 19 - 15
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAccountServiceImpl.java

@@ -83,14 +83,14 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
     }
 
     @Override
-    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouSaleAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouSaleAccountInfoByProjectId(List<Long> projectList, Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         //String userId = "e9ca23d68d884d4ebb19d07889727dae";
         String userId = sysUser.getId();
         String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
         List<Long> accountIds = null;
-        if(projectId == null){
+        if(projectList == null && projectId==null){
             if("admin".equals(roleCode)){
                 accountIds = dailyAccountMapper.getUserProjectAccountIdsByAdmin(0);
             }else {
@@ -99,19 +99,23 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         }
 
         PageHelper.startPage(pageNum,pageSize);
-        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(startDate, endDate, projectId, accountIds, yn));
+        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(projectId, startDate, endDate, projectList, accountIds, yn));
     }
 
 
     @Override
-    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, List<Long> projectList, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         //String userId = "e9ca23d68d884d4ebb19d07889727dae";
         String userId = sysUser.getId();
         String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
+        //List<Long> mediaIds = new ArrayList<>();
+        //mediaIds.add(2L);
+        //mediaIds.add(4L);
+
         List<Long> accountIds = null;
-        if(projectId == null){
+        if(projectId==null && projectList==null){
             if("admin".equals(roleCode)){
                 accountIds = dailyAccountMapper.getUserProjectAccountIdsByAdmin(0);
             }else {
@@ -120,18 +124,18 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         }
 
         PageHelper.startPage(pageNum,pageSize);
-        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(startDate, endDate, projectId, accountIds, yn));
+        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(projectId, startDate, endDate, projectList, accountIds, yn));
     }
 
     @Override
-    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(List<Long> projectList, Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         //String userId = "e9ca23d68d884d4ebb19d07889727dae";
         String userId = sysUser.getId();
         String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
         List<Long> accountIds = null;
-        if(accountId == null){
+        if(accountId == null && projectList==null){
             if("admin".equals(roleCode)){
                 accountIds = dailyAccountMapper.getUserProjectAccountIdsByAdmin(1);
             }else {
@@ -140,11 +144,11 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         }
 
         PageHelper.startPage(pageNum,pageSize);
-        return new PageInfo<>(dailyAccountMapper.getKuaishouCampaignInfoByAccountId(startDate, endDate, accountId,accountIds,yn));
+        return new PageInfo<>(dailyAccountMapper.getKuaishouCampaignInfoByAccountId(projectList, startDate, endDate, accountId,accountIds,yn));
     }
 
     @Override
-    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(List<Long> projectList, Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
 
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         //String userId = "e9ca23d68d884d4ebb19d07889727dae";
@@ -152,7 +156,7 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
         List<Long> accountIds = null;
-        if(campaignId == null){
+        if(campaignId == null && projectList == null){
             if("admin".equals(roleCode)){
                 accountIds = dailyAccountMapper.getUserProjectAccountIdsByAdmin(1);
             }else {
@@ -161,18 +165,18 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         }
 
         PageHelper.startPage(pageNum,pageSize);
-        return new PageInfo<>(dailyAccountMapper.getKuaishouUnitInfoByCampaignId(startDate, endDate, campaignId,accountIds, yn));
+        return new PageInfo<>(dailyAccountMapper.getKuaishouUnitInfoByCampaignId(projectList, startDate, endDate, campaignId,accountIds, yn));
     }
 
     @Override
-    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(List<Long> projectList, Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         //String userId = "e9ca23d68d884d4ebb19d07889727dae";
         String userId = sysUser.getId();
         String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
         List<Long> accountIds = null;
-        if(unitId == null){
+        if(unitId == null && projectList ==null){
             if("admin".equals(roleCode)){
                 accountIds = dailyAccountMapper.getUserProjectAccountIdsByAdmin(1);
             }else {
@@ -181,7 +185,7 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         }
 
         PageHelper.startPage(pageNum,pageSize);
-        List<KuaishouReportDailyAccountDTO> kuaishouCreativeInfoList = dailyAccountMapper.getKuaishouCreativeInfoByUnitId(startDate, endDate, unitId,accountIds, yn);
+        List<KuaishouReportDailyAccountDTO> kuaishouCreativeInfoList = dailyAccountMapper.getKuaishouCreativeInfoByUnitId(projectList, startDate, endDate, unitId,accountIds, yn);
         //for(KuaishouReportDailyAccountDTO creativeInfo:kuaishouCreativeInfoList){
         //    KuaishouVideoInfoDTO videoInfo = dailyAccountMapper.getVideoUrl(creativeInfo.getPhotoId());
         //    creativeInfo.setUrl(videoInfo.getUrl());