فهرست منبع

Merge remote-tracking branch 'origin/test' into test

syh 4 سال پیش
والد
کامیت
7dfa8ad1d2
29فایلهای تغییر یافته به همراه1166 افزوده شده و 83 حذف شده
  1. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java
  2. 56 58
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 34 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  4. 1 1
      jeecg-boot-module-system/src/main/resources/quartz.properties
  5. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/enums/MaterialEnum.java
  6. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialCutFrameService.java
  7. 5 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java
  8. 7 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/CloudVideoProcessUtil.java
  9. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  10. 72 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportJob.java
  11. 81 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java
  12. 250 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouTitleCollectionController.java
  13. 266 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouTrackUrlCollectionController.java
  14. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java
  15. 71 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouTitleCollection.java
  16. 77 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouTrackUrlCollection.java
  17. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouTitleCollectionMapper.java
  18. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouTrackUrlCollectionMapper.java
  19. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  20. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouTitleCollectionMapper.xml
  21. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouTrackUrlCollectionMapper.xml
  22. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouTitleCollectionService.java
  23. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouTrackUrlCollectionService.java
  24. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  25. 26 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  26. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  27. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouTitleCollectionServiceImpl.java
  28. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouTrackUrlCollectionServiceImpl.java
  29. 88 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java

@@ -116,13 +116,13 @@ public class MaterialImageInfoController {
     @AutoLog(value = "素材-分页列表查询")
     @ApiOperation(value = "素材-分页列表查询", notes = "素材-分页列表查询")
     @GetMapping(value = "/list")
-    public Result<List<MaterialImageInfo>> queryPageList(String videoId) {
+    public Result<List<MaterialImageInfo>> queryPageList(String videoId,Integer status) {
         Result<List<MaterialImageInfo>> result = new Result<>();
-
         List<MaterialImageInfo> list = new ArrayList<>();
         if (!Check.isNull(videoId)) {
             QueryWrapper<MaterialImageInfo> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("video_id", videoId);
+            queryWrapper.eq("status", status);
             list = MaterialImageInfoService.list(queryWrapper);
         }
 

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

@@ -355,74 +355,72 @@ public class MaterialInfoController {
         Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
         if (materialInfoEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            String url = materialInfo.getUrl();
-            if (!Check.isNull(url)) {
-                if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
-                }
-                materialInfo.setUrl(url);
+            return result.error500("未找到对应实体");
+        }
+        String url = materialInfo.getUrl();
+        if (!Check.isNull(url)) {
+            if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
             }
+            materialInfo.setUrl(url);
+        }
 
-            //  修改素材库 相关联code
-            if (!Check.isNull(materialInfo.getCode())) {
-                String code = materialInfoEntity.getCode();
-                if (!Check.isNull(code)) {
-                    MaterialTag updateMaterialTag = new MaterialTag();
-                    updateMaterialTag.setMaterialId(materialInfo.getCode());
-                    QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
-                    tagQueryWrapper.eq("material_id", code);
-                    materialTagService.update(updateMaterialTag, tagQueryWrapper);
-                    MaterialParameter updateParameter = new MaterialParameter();
-                    updateParameter.setMaterialId(materialInfo.getCode());
-                    QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                    parameterQueryWrapper.eq("material_id", code);
-                    materialParameterService.update(updateParameter, parameterQueryWrapper);
-                    MaterialAscription updateMaterialAscription = new MaterialAscription();
-                    updateMaterialAscription.setMaterialId(materialInfo.getCode());
-                    QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
-                    ascriptionQueryWrapper.eq("material_id", code);
-                    materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
-                }
+        //  修改素材库 相关联code
+        if (!Check.isNull(materialInfo.getCode())) {
+            String code = materialInfoEntity.getCode();
+            if (!Check.isNull(code)) {
+                MaterialTag updateMaterialTag = new MaterialTag();
+                updateMaterialTag.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
+                tagQueryWrapper.eq("material_id", code);
+                materialTagService.update(updateMaterialTag, tagQueryWrapper);
+                MaterialParameter updateParameter = new MaterialParameter();
+                updateParameter.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", code);
+                materialParameterService.update(updateParameter, parameterQueryWrapper);
+                MaterialAscription updateMaterialAscription = new MaterialAscription();
+                updateMaterialAscription.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
+                ascriptionQueryWrapper.eq("material_id", code);
+                materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
             }
+        }
 
-            //  审核通过自动同步到到媒体后台
-           /* Long projectId = materialInfoEntity.getProjectId();
-            Project project = projectService.getById(projectId);
-            if (!Check.isNull(projectId)) {
-                if ("2".equals(project.getMediaId())) {
-                    if (!Check.isNull(materialInfo.getStatus())) {
-                        Integer status = materialInfo.getStatus();
-                        if (status == 1) {
-                            Thread thread = new Thread() {
-                                @Override
-                                public void run() {
-                                    log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
-                                    uploadService.upload(materialInfoEntity);
-                                }
-                            };
-                            thread.start();
-                        }
+        //  审核通过自动同步到到媒体后台
+       /* Long projectId = materialInfoEntity.getProjectId();
+        Project project = projectService.getById(projectId);
+        if (!Check.isNull(projectId)) {
+            if ("2".equals(project.getMediaId())) {
+                if (!Check.isNull(materialInfo.getStatus())) {
+                    Integer status = materialInfo.getStatus();
+                    if (status == 1) {
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
+                                uploadService.upload(materialInfoEntity);
+                            }
+                        };
+                        thread.start();
                     }
                 }
-
-            }*/
-
-            boolean ok = materialInfoService.updateById(materialInfo);
-            if (ok) {
-                result.success("修改成功!");
             }
 
-            Integer status = materialInfo.getStatus();
-            // 如果状态为2 审核拒绝 给上传人发送消息
-            if (status == 2) {
-                Project project = projectService.getById(materialInfoEntity.getProjectId());
-                String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-                sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
-            }
+        }*/
+
+        boolean ok = materialInfoService.updateById(materialInfo);
+        if (ok) {
+            result.success("修改成功!");
         }
 
+        Integer status = materialInfo.getStatus();
+        // 如果状态为2 审核拒绝 给上传人发送消息
+        if (status == 2) {
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+        }
         return result;
 
     }

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

@@ -774,4 +774,38 @@ public class TestController {
         ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+
+
+    @GetMapping(value = "/getAppList")
+    public void getAppList() throws JobExecutionException {
+        try {
+            //1:查询当日数据
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("media_id", 2);
+            queryWrapper.orderByDesc("create_time");
+            List<CtopOauthToken> tokens = tokenService.list(queryWrapper);
+            if (null == tokens || tokens.size() <= 0) {
+                log.info("定时获取快手数据异常:未获取到可用的token");
+                return;
+            }
+
+            tokens.forEach(token -> {
+
+                kuaishouInterfaceService.getAppList2(token.getAccountId(),token.getAccessToken());
+                //suzhaoService.submit(new Runnable() {
+                //    @Override
+                //    public void run() {
+                //        //1: 获取广告主信息数据
+                //        log.info("获取素造素材:accountId:{}", token.getAccountId());
+                //        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
+                //    }
+                //});
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
 }

+ 1 - 1
jeecg-boot-module-system/src/main/resources/quartz.properties

@@ -4,7 +4,7 @@ org.quartz.scheduler.batchTriggerAcquisitionMaxCount=50
 org.quartz.threadPool.threadPriority=5
 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
 org.quartz.jobStore.misfireThreshold=600000
-org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
+# org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
 
 ##打开集群模式
 #org.quartz.jobStore.isClustered = true

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/enums/MaterialEnum.java

@@ -34,7 +34,7 @@ public enum MaterialEnum {
             }
         }
 
-        return 0;
+        return 1;
     }
 
 

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

@@ -27,7 +27,8 @@ public interface IMaterialCutFrameService extends IService<MaterialCutFrame> {
 
     void getTencentCutFrame(String videoUrl,String materialId,String coveUrl);
 
+    boolean updateTencentCutFrame(String videoMD5);
+
     MaterialCutFrame getCutFrameByCode(String code);
 
-    boolean updateTencentCutFrame(String videoMD5);
 }

+ 5 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java

@@ -356,8 +356,10 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
     private void getCut(String materialId, String videoUrl, String loadImage, Integer count) {
         try {
             Map<String, Object> coverMap = CloudVideoProcessUtil.videoCutFrameHandle(videoUrl, loadImage);
-            if (Check.isNullMap(coverMap) && count < 4) {
+            if (count < 4) {
                 getCut(materialId, videoUrl, loadImage, count + 1);
+            } else {
+                return;
             }
 
             if (Check.isNullMap(coverMap)) {
@@ -376,11 +378,12 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
                     this.save(cutFrame);
                     LoadFileUtil.delFile(cutFramePath);
                 }
-
             }
 
         } catch (Exception e) {
+            log.info("抽帧异常,code:{}", materialId);
             e.printStackTrace();
+            getCut(materialId, videoUrl, loadImage, count + 1);
 
         }
 

+ 7 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/CloudVideoProcessUtil.java

@@ -141,6 +141,12 @@ public class CloudVideoProcessUtil {
         }
     }
 
+    public static void main(String[] args) {
+        String loadImage = "cutFrame/" + 12345 + "/${Number}.jpg";
+        Map<String, Object> stringObjectMap = videoCutFrameHandle("/video/2020-07-22/1595381635927-JX.美白丸混剪.mp4", loadImage);
+        System.err.println(stringObjectMap);
+    }
+
     /**
      * 数据万象发起视频抽帧处理请求
      */
@@ -181,7 +187,7 @@ public class CloudVideoProcessUtil {
         Map JobsDetail = (Map) ((Map) mapResp.get("Response")).get("JobsDetail");
         if (JobsDetail.get("Code").equals("Success")) {
             Map jobStatusMap = null;
-            for (int i = 0; i < 10; i++) {
+            for (int i = 0; i < 30; i++) {
                 try {
                     Thread.sleep(1000);
                 } catch (InterruptedException e) {

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -83,12 +83,17 @@ public class KuaishouInterfaceConstant {
      * 创建广告获取应用列表
      */
     public static final String APP_LIST = "/rest/openapi/v1/file/ad/app/list";
+    /**
+     * 创建广告获取应用列表(新版本)
+     */
+    public static final String APP_LIST_v2 = "/rest/openapi/v2/file/ad/app/list";
 
     /**
      * 账户日预算查询
      */
     public static final String ACCOUNT_BUDGET = "/rest/openapi/v1/advertiser/budget/get";
 
+
     /**
      * 获取账户余额
      */

+ 72 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportJob.java

@@ -0,0 +1,72 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class BytedanceDailyMaterialReportJob {
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
+    @XxlJob("bytedanceDailyMaterialReportJob")
+    public ReturnT<String> execute(String param) throws Exception {
+        Date getDate2 = DateUtils.addDay(new Date(), -2);
+        String date2 = DateUtils.formatDate(getDate2);
+
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        String date = DateUtils.formatDate(getDate);
+        XxlJobLogger.log("头条获取素材报表数据任务开始,任务时间:" + date2 + "~" + date);
+
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        if (null == tokens || tokens.size() <= 0) {
+            XxlJobLogger.log("头条获取素材报表数据任务执行失败:未获取到可用的token");
+            return ReturnT.FAIL;
+        }
+
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        //获取头条素材报表两天前的数据
+                        XxlJobLogger.log("账户"+token.getAccountId() + "素材报表数据任务开始,任务时间:" + date2 + "~" + date2);
+                        bytedanceReportService.bytedanceMaterialReport(token, date2, date2);
+                        XxlJobLogger.log("账户"+token.getAccountId() + "素材报表数据任务完成,任务时间:" + date2 + "~" + date2);
+
+                        //获取头条素材报表数据
+                        XxlJobLogger.log("账户"+token.getAccountId() + "素材报表数据任务开始,任务时间:" + date + "~" + date);
+                        bytedanceReportService.bytedanceMaterialReport(token, date, date);
+                        XxlJobLogger.log("账户"+token.getAccountId() + "素材报表数据任务完成,任务时间:" + date + "~" + date);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+                }
+            });
+        });
+        return ReturnT.SUCCESS;
+    }
+
+
+
+}

+ 81 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java

@@ -0,0 +1,81 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class BytedanceDailyMaterialReportRetryJob {
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+
+    @XxlJob("bytedanceDailyMaterialReportRetryJob")
+    public ReturnT<String> execute(String param) throws Exception {
+        XxlJobLogger.log("头条素材报表重试定时任务开始");
+
+        List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
+        retryList.forEach(retry -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        String startDate = retry.getStartDate();
+                        String endDate = retry.getEndDate();
+                        Long accountId = retry.getAccountId();
+                        Integer type = retry.getType();
+                        CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+                        XxlJobLogger.log("头条素材报表重试定时任务开始,当前accountId为:" + token.getAccountId());
+                        Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+                        String start = null;
+                        String end = null;
+                        for (int i = 0; i <= days; i++) {
+                            start = DateUtils.addDay(startDate, i);
+                            end = start;
+                            //获取头条素材报表数据
+                            int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
+                            XxlJobLogger.log("头条素材报表重试定时任务完成,当前accountId为:" + token.getAccountId() + "code:" + code);
+                            if (code == 200 || code == 1) {
+                                if (type == 1) {
+                                    XxlJobLogger.log("头条素材报表重试定时任务清洗数据开始,当前accountId为:" + token.getAccountId());
+                                    //重试成功清洗数据
+                                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start, end, accountId);
+                                    XxlJobLogger.log("头条素材报表重试定时任务清洗数据完成,当前accountId为:" + token.getAccountId());
+                                }
+                            }
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                    }
+                }
+            });
+        });
+
+        return ReturnT.SUCCESS;
+    }
+
+
+
+}

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

@@ -0,0 +1,250 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTitleCollection;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouTitleCollectionService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 标题收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+@Slf4j
+@Api(tags = "标题收藏")
+@RestController
+@RequestMapping("/kuaishou/kuaiShouTitleCollection")
+public class KuaiShouTitleCollectionController {
+    @Autowired
+    private IKuaiShouTitleCollectionService kuaiShouTitleCollectionService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouTitleCollection
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "标题收藏-分页列表查询")
+    @ApiOperation(value = "标题收藏-分页列表查询", notes = "标题收藏-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouTitleCollection>> queryPageList(KuaiShouTitleCollection kuaiShouTitleCollection,
+                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                HttpServletRequest req) {
+        Result<IPage<KuaiShouTitleCollection>> result = new Result<>();
+        QueryWrapper<KuaiShouTitleCollection> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouTitleCollection, req.getParameterMap());
+        queryWrapper.orderByDesc("create_time");
+        Page<KuaiShouTitleCollection> page = new Page<KuaiShouTitleCollection>(pageNo, pageSize);
+        IPage<KuaiShouTitleCollection> pageList = kuaiShouTitleCollectionService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+        
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouTitleCollection
+     * @return
+     */
+    @AutoLog(value = "标题收藏-添加")
+    @ApiOperation(value = "标题收藏-添加", notes = "标题收藏-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouTitleCollection> add(@RequestBody KuaiShouTitleCollection kuaiShouTitleCollection) {
+        Result<KuaiShouTitleCollection> result = new Result<>();
+        try {
+            kuaiShouTitleCollectionService.save(kuaiShouTitleCollection);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouTitleCollection
+     * @return
+     */
+    @AutoLog(value = "标题收藏-编辑")
+    @ApiOperation(value = "标题收藏-编辑", notes = "标题收藏-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouTitleCollection> edit(@RequestBody KuaiShouTitleCollection kuaiShouTitleCollection) {
+        Result<KuaiShouTitleCollection> result = new Result<KuaiShouTitleCollection>();
+        KuaiShouTitleCollection kuaiShouTitleCollectionEntity = kuaiShouTitleCollectionService.getById(kuaiShouTitleCollection.getId());
+        if (kuaiShouTitleCollectionEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouTitleCollectionService.updateById(kuaiShouTitleCollection);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "标题收藏-通过id删除")
+    @ApiOperation(value = "标题收藏-通过id删除", notes = "标题收藏-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaiShouTitleCollectionService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "标题收藏-批量删除")
+    @ApiOperation(value = "标题收藏-批量删除", notes = "标题收藏-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouTitleCollection> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouTitleCollection> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouTitleCollectionService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "标题收藏-通过id查询")
+    @ApiOperation(value = "标题收藏-通过id查询", notes = "标题收藏-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouTitleCollection> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouTitleCollection> result = new Result<>();
+        KuaiShouTitleCollection kuaiShouTitleCollection = kuaiShouTitleCollectionService.getById(id);
+        if (kuaiShouTitleCollection == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouTitleCollection);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouTitleCollection> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouTitleCollection kuaiShouTitleCollection = JSON.parseObject(deString, KuaiShouTitleCollection.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouTitleCollection, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouTitleCollection> pageList = kuaiShouTitleCollectionService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "标题收藏列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouTitleCollection.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<KuaiShouTitleCollection> listKuaiShouTitleCollections = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouTitleCollection.class, params);
+                kuaiShouTitleCollectionService.saveBatch(listKuaiShouTitleCollections);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouTitleCollections.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,266 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTrackUrlCollection;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouTrackUrlCollectionService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 监测链接收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+@Slf4j
+@Api(tags = "监测链接收藏")
+@RestController
+@RequestMapping("/kuaishou/kuaiShouTrackUrlCollection")
+public class KuaiShouTrackUrlCollectionController {
+    @Autowired
+    private IKuaiShouTrackUrlCollectionService kuaiShouTrackUrlCollectionService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouTrackUrlCollection
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "监测链接收藏-分页列表查询")
+    @ApiOperation(value = "监测链接收藏-分页列表查询", notes = "监测链接收藏-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouTrackUrlCollection>> queryPageList(KuaiShouTrackUrlCollection kuaiShouTrackUrlCollection,
+                                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                   HttpServletRequest req) {
+        Result<IPage<KuaiShouTrackUrlCollection>> result = new Result<>();
+        QueryWrapper<KuaiShouTrackUrlCollection> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouTrackUrlCollection, req.getParameterMap());
+        Page<KuaiShouTrackUrlCollection> page = new Page<KuaiShouTrackUrlCollection>(pageNo, pageSize);
+        IPage<KuaiShouTrackUrlCollection> pageList = kuaiShouTrackUrlCollectionService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+    @GetMapping(value = "/checkTrackName")
+    public Result<Boolean> checkTrackName(Long accountId, String trackName) {
+        Result<Boolean> result = new Result<>();
+        QueryWrapper<KuaiShouTrackUrlCollection> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("track_name", trackName);
+        List<KuaiShouTrackUrlCollection> list = kuaiShouTrackUrlCollectionService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            result.setResult(true);
+        } else {
+            result.setResult(false);
+        }
+
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouTrackUrlCollection
+     * @return
+     */
+    @AutoLog(value = "监测链接收藏-添加")
+    @ApiOperation(value = "监测链接收藏-添加", notes = "监测链接收藏-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouTrackUrlCollection> add(@RequestBody KuaiShouTrackUrlCollection kuaiShouTrackUrlCollection) {
+        Result<KuaiShouTrackUrlCollection> result = new Result<>();
+        try {
+            kuaiShouTrackUrlCollectionService.save(kuaiShouTrackUrlCollection);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouTrackUrlCollection
+     * @return
+     */
+    @AutoLog(value = "监测链接收藏-编辑")
+    @ApiOperation(value = "监测链接收藏-编辑", notes = "监测链接收藏-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouTrackUrlCollection> edit(@RequestBody KuaiShouTrackUrlCollection kuaiShouTrackUrlCollection) {
+        Result<KuaiShouTrackUrlCollection> result = new Result<KuaiShouTrackUrlCollection>();
+        KuaiShouTrackUrlCollection kuaiShouTrackUrlCollectionEntity = kuaiShouTrackUrlCollectionService.getById(kuaiShouTrackUrlCollection.getId());
+        if (kuaiShouTrackUrlCollectionEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouTrackUrlCollectionService.updateById(kuaiShouTrackUrlCollection);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "监测链接收藏-通过id删除")
+    @ApiOperation(value = "监测链接收藏-通过id删除", notes = "监测链接收藏-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaiShouTrackUrlCollectionService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "监测链接收藏-批量删除")
+    @ApiOperation(value = "监测链接收藏-批量删除", notes = "监测链接收藏-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaiShouTrackUrlCollection> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouTrackUrlCollection> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouTrackUrlCollectionService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "监测链接收藏-通过id查询")
+    @ApiOperation(value = "监测链接收藏-通过id查询", notes = "监测链接收藏-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouTrackUrlCollection> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouTrackUrlCollection> result = new Result<>();
+        KuaiShouTrackUrlCollection kuaiShouTrackUrlCollection = kuaiShouTrackUrlCollectionService.getById(id);
+        if (kuaiShouTrackUrlCollection == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouTrackUrlCollection);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouTrackUrlCollection> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouTrackUrlCollection kuaiShouTrackUrlCollection = JSON.parseObject(deString, KuaiShouTrackUrlCollection.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouTrackUrlCollection, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouTrackUrlCollection> pageList = kuaiShouTrackUrlCollectionService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "监测链接收藏列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouTrackUrlCollection.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<KuaiShouTrackUrlCollection> listKuaiShouTrackUrlCollections = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouTrackUrlCollection.class, params);
+                kuaiShouTrackUrlCollectionService.saveBatch(listKuaiShouTrackUrlCollections);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouTrackUrlCollections.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("文件导入失败!");
+    }
+
+}

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java

@@ -163,6 +163,9 @@ public class KuaiShouGroup {
     private String groupCreateTime;
     private String groupUpdateTime;
 
+    // 应用商店列表
+    private String appStore;
+
 
     /**
      * 创建时间

+ 71 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouTitleCollection.java

@@ -0,0 +1,71 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 标题收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+@Data
+@TableName("ctop_kuaishou_title_collection")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_title_collection对象", description = "标题收藏")
+public class KuaiShouTitleCollection {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户
+     */
+    @Excel(name = "账户", width = 15)
+    @ApiModelProperty(value = "账户")
+    private Long accountId;
+    /**
+     * 用户id
+     */
+    @Excel(name = "用户id", width = 15)
+    @ApiModelProperty(value = "用户id")
+    private String userId;
+    /**
+     * 标题
+     */
+    @Excel(name = "标题", width = 15)
+    @ApiModelProperty(value = "标题")
+    private String title;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * 修改时间
+     */
+    @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 updateTime;
+}

+ 77 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouTrackUrlCollection.java

@@ -0,0 +1,77 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 监测链接收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+@Data
+@TableName("ctop_kuaishou_track_url_collection")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_track_url_collection对象", description = "监测链接收藏")
+public class KuaiShouTrackUrlCollection {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户
+     */
+    @Excel(name = "账户", width = 15)
+    @ApiModelProperty(value = "账户")
+    private Long accountId;
+    /**
+     * 用户id
+     */
+    @Excel(name = "用户id", width = 15)
+    @ApiModelProperty(value = "用户id")
+    private String userId;
+    /**
+     * 监测链接名称
+     */
+    @Excel(name = "监测链接名称", width = 15)
+    @ApiModelProperty(value = "监测链接名称")
+    private String trackName;
+    /**
+     * url
+     */
+    @Excel(name = "url", width = 15)
+    @ApiModelProperty(value = "url")
+    private String trackUrl;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * 修改时间
+     */
+    @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 updateTime;
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouTitleCollectionMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTitleCollection;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 标题收藏
+ *
+ * @author: jeecg-boot
+ * @date: 2020-07-22
+ * @cersion: V1.0
+ */
+public interface KuaiShouTitleCollectionMapper extends BaseMapper<KuaiShouTitleCollection> {
+
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouTrackUrlCollectionMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTrackUrlCollection;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 监测链接收藏
+ *
+ * @author: jeecg-boot
+ * @date: 2020-07-22
+ * @cersion: V1.0
+ */
+public interface KuaiShouTrackUrlCollectionMapper extends BaseMapper<KuaiShouTrackUrlCollection> {
+
+}

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

@@ -32,6 +32,7 @@
         app_icon_url,
         convert_id,
         use_app_market,
+        app_store,
         group_create_time,
         group_update_time,
         create_time,
@@ -68,6 +69,7 @@
             #{getGroup.appIconUrl},
             #{getGroup.convertId},
             #{getGroup.useAppMarket},
+            #{getGroup.appStore,},
             #{getGroup.groupCreateTime},
             #{getGroup.groupUpdateTime},
             #{getGroup.createTime},

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouTitleCollectionMapper.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.kuaishou.modules.batch.mapper.KuaiShouTitleCollectionMapper">
+
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouTrackUrlCollectionMapper.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.kuaishou.modules.batch.entity.KuaiShouTrackUrlCollection">
+
+</mapper>

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTitleCollection;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 标题收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+public interface IKuaiShouTitleCollectionService extends IService<KuaiShouTitleCollection> {
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTrackUrlCollection;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 监测链接收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+public interface IKuaiShouTrackUrlCollectionService extends IService<KuaiShouTrackUrlCollection> {
+
+}

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

@@ -266,6 +266,14 @@ public interface IKuaishouInterfaceService {
     void getAppList(Long advertiserId, String accessToken);
 
     /**
+     * 获取应用列表
+     *
+     * @param advertiserId
+     * @param accessToken
+     */
+    void getAppList2(Long advertiserId, String accessToken);
+
+    /**
      * 文件上传 发送请求
      *
      * @param url

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

@@ -5,8 +5,6 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.LoadFileUtil;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
@@ -27,7 +25,6 @@ import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
-import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
@@ -201,6 +198,11 @@ public class BatchServiceImpl implements IBatchService {
             unitJson.put("use_app_market", requestJson.getInteger("useAppMarket"));
         }
 
+        // 应用商店列表
+        if (!Check.isNull(requestJson.getJSONArray("appStore"))) {
+            unitJson.put("app_store", requestJson.getJSONArray("appStore"));
+        }
+
         //投放开始时间
         if (!Check.isNull(requestJson.getString("beginTime"))) {
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
@@ -494,6 +496,11 @@ public class BatchServiceImpl implements IBatchService {
                 unitJson.put("use_app_market", requestJson.getInteger("useAppMarket"));
             }
 
+            // 应用商店列表
+            if (!Check.isNull(requestJson.getJSONArray("appStore"))) {
+                unitJson.put("app_store", requestJson.getJSONArray("appStore"));
+            }
+
             //投放开始时间
             if (!Check.isNull(requestJson.getString("beginTime"))) {
                 String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
@@ -771,6 +778,12 @@ public class BatchServiceImpl implements IBatchService {
                 if (!Check.isNull(group.getUseAppMarket())) {
                     unitJson.put("use_app_market", group.getUseAppMarket());
                 }
+
+                // 应用商店列表
+                if (!Check.isNull(group.getAppStore())) {
+                    unitJson.put("app_store", JSONArray.parseArray(group.getAppStore()));
+                }
+
                 // 转化目标id
                 if (!Check.isNull(group.getConvertId())) {
                     unitJson.put("convert_id", group.getConvertId());
@@ -891,7 +904,7 @@ public class BatchServiceImpl implements IBatchService {
                     }
                     // APP行为-按APP名称
                     if (!Check.isNull(groupTarget.getAppIds())) {
-                        targetJson.put("app_ids", groupTarget.getAppIds());
+                        targetJson.put("app_ids", JSONArray.parseArray(groupTarget.getAppIds()));
                     }
                     // 人群包定向
                     if (!Check.isNull(groupTarget.getPopulation())) {
@@ -1042,7 +1055,7 @@ public class BatchServiceImpl implements IBatchService {
                 String image = creative.getImageToken();
                 String name = creative.getCreativeName();
                 creativeJson.put("action_bar_text", action_bar_text);
-                creativeJson.put("description", description);
+                creativeJson.put("description", description.trim());
                 creativeJson.put("image_token", image);
                 creativeJson.put("creative_name", name);
                 creativeJson.put("photo_id", photo_id);
@@ -1177,7 +1190,7 @@ public class BatchServiceImpl implements IBatchService {
                                 content += 1;
                                 String name = imageJson.getString("name") + content;
                                 creativeJson.put("action_bar_text", action_bar_text);
-                                creativeJson.put("description", description);
+                                creativeJson.put("description", description.trim());
                                 creativeJson.put("creative_name", name);
                                 creativeJson.put("photo_id", photo_id);
                                 creativeJson.put("click_track_url", click_track_url);
@@ -1379,6 +1392,12 @@ public class BatchServiceImpl implements IBatchService {
             if (!Check.isNull(requestJson.getInteger("useAppMarket"))) {
                 unitJson.put("use_app_market", requestJson.getInteger("useAppMarket"));
             }
+
+            // 应用商店列表
+            if (!Check.isNull(requestJson.getJSONArray("appStore"))) {
+                unitJson.put("app_store", requestJson.getJSONArray("appStore"));
+            }
+
             // 转化目标
             if (!Check.isNull(requestJson.getInteger("convertId"))) {
                 unitJson.put("convert_id", requestJson.getInteger("convertId"));
@@ -1545,7 +1564,7 @@ public class BatchServiceImpl implements IBatchService {
 
         // 广告语
         if (!Check.isNull(requestJson.get("description"))) {
-            creativeJson.put("description", requestJson.get("description"));
+            creativeJson.put("description", requestJson.getString("description").trim());
         }
         // 封面标题
         if (!Check.isNull(requestJson.get("stickerTitle"))) {
@@ -1598,14 +1617,6 @@ public class BatchServiceImpl implements IBatchService {
         }
         return null;
     }
-
-
-    public static void main(String[] args) throws IOException {
-        String localUrl = LoadFileUtil.downLoadFromUrl("https://ctop-media.oss-cn-beijing.aliyuncs.com/image/2020-04-29/uuuuu-1588129352054.jpg", PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-        String signature = LoadFileUtil.getMD5(localUrl);
-        System.err.println(signature);
-    }
-
 }
 
 

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

@@ -297,6 +297,7 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                     group.setGroupUpdateTime(detail.getString("update_time"));
                     group.setConvertId(detail.getLong("convert_id"));
                     group.setUseAppMarket(detail.getInteger("use_app_market"));
+                    group.setAppStore(detail.getJSONArray("app_store") + "");
                     group.setCreateTime(new Date());
                     group.setUpdateTime(new Date());
                     groups.add(group);

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTitleCollection;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTitleCollectionMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouTitleCollectionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 标题收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+@Service
+public class KuaiShouTitleCollectionServiceImpl extends ServiceImpl<KuaiShouTitleCollectionMapper, KuaiShouTitleCollection> implements IKuaiShouTitleCollectionService {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTrackUrlCollection;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTrackUrlCollectionMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouTrackUrlCollectionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 监测链接收藏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-07-22
+ */
+@Service
+public class KuaiShouTrackUrlCollectionServiceImpl extends ServiceImpl<KuaiShouTrackUrlCollectionMapper, KuaiShouTrackUrlCollection> implements IKuaiShouTrackUrlCollectionService {
+
+}

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

@@ -189,8 +189,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-
-
     private void getVideoListByPage(CtopOauthToken token, String startDate, String endDate, int page) {
         try {
             log.info("获取视频数据,accountId:{}", token.getAccountId());
@@ -1255,6 +1253,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setGroupUpdateTime(detail.getString("update_time"));
                     group.setConvertId(detail.getLong("convert_id"));
                     group.setUseAppMarket(detail.getInteger("use_app_market"));
+                    group.setAppStore(detail.getJSONArray("app_store") + "");
                     group.setCreateTime(new Date());
                     group.setUpdateTime(new Date());
                     groups.add(group);
@@ -3233,4 +3232,91 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return returnArr;
     }
 
+    /**
+     * 获取应用列表(新)
+     *
+     * @param advertiserId
+     * @param accessToken
+     */
+    @Override
+    public void getAppList2(Long advertiserId, String accessToken) {
+        Integer pageSize = 20;
+        Integer page = 1;
+        getAppList2ByPage(advertiserId, accessToken, page, pageSize);
+    }
+
+    private void getAppList2ByPage(Long advertiserId, String accessToken, Integer page, Integer pageSize) {
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_LIST_v2;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", " application/json");
+            JSONObject json = new JSONObject();
+            json.put("advertiser_id", advertiserId);
+            json.put("page", page);
+            json.put("page_size", pageSize);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, json.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    if(page == 1){ //分页保存数据,如果页数为1,删除之前的数据重新入库
+                        Map<String, Object> deleteMap = new HashMap<>();
+                        deleteMap.put("account_id", advertiserId);
+                        appListMapper.deleteByMap(deleteMap);
+                    }
+                    JSONObject data = resultJson.getJSONObject("data");
+                    if (!Check.isNull(data)) {
+                        Integer totalCount = data.getInteger("total_count");
+                        JSONArray dataArr = data.getJSONArray("details");
+                        for (int i = 0; i < dataArr.size(); i++) {
+                            JSONObject dataJson = JSONObject.parseObject(dataArr.get(i).toString());
+                            if (!Check.isNull(dataJson)) {
+                                KuaiShouAppList appList = new KuaiShouAppList();
+                                appList.setAccountId(advertiserId);
+                                appList.setPlatform(dataJson.getInteger("platform"));
+                                appList.setUrl(dataJson.getString("url"));
+                                appList.setAppId(dataJson.getLong("app_id"));
+                                appList.setAppVersion(dataJson.getString("app_version"));
+                                appList.setAppName(dataJson.getString("app_name"));
+                                appList.setAppIconUrl(dataJson.getString("app_icon_url"));
+                                appList.setImageToken(dataJson.getString("image_token"));
+                                appList.setPackageName(dataJson.getString("package_name"));
+                                appList.setReturnTime(DateUtils.timeStamp2Date(dataJson.getTimestamp("update_time")));
+                                appListMapper.insert(appList);
+                            }
+                        }
+                        Integer totalPage = (totalCount-1)/pageSize + 1;
+                        if(page < totalPage ){
+                            getAppList2ByPage(advertiserId,accessToken,page+1,pageSize);
+                        }
+                    }
+                } else {
+                    log.error("获取应用列表失败,返回信息:{}", resultJson);
+                }
+            } else {
+                log.error("获取地域列表返回结果为空");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 }