Преглед изворни кода

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

syh пре 4 година
родитељ
комит
d357d642a2

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialCutFrameMapper.java

@@ -1,6 +1,8 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,4 +19,6 @@ import java.util.List;
 public interface MaterialCutFrameMapper extends BaseMapper<MaterialCutFrame> {
 
     List<MaterialCutFrame> getListByVideoSignature(@Param(value = "videoSignature") String signature);
+
+    List<JSONObject> getProgramCreativeCover(@Param("signature") String signature);
 }

+ 12 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialCutFrameMapper.xml

@@ -19,8 +19,19 @@
         where frame.signature = a.signature
         order by id desc
         limit 1) as 'id'
-from (select distinct signature
+       from (select distinct signature
       from ctop_material_cut_frame
       where video_signature = #{videoSignature}) a;
     </select>
+
+
+    <select id="getProgramCreativeCover" resultType="com.alibaba.fastjson.JSONObject">
+      SELECT
+      signature as 'signature',
+      url as 'url'
+      FROM ctop_material_cut_frame
+      WHERE video_signature = #{signature}
+      ORDER BY RAND() LIMIT 5;
+    </select>
+
 </mapper>

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

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.service;
 
 
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.io.IOException;
@@ -25,10 +26,11 @@ public interface IMaterialCutFrameService extends IService<MaterialCutFrame> {
 
     void loadCosCutFrame(String jobId, String videoSignature);  //腾讯云抽帧任务状态查询以及数据入库
 
-    void getTencentCutFrame(String videoUrl,String materialId,String coveUrl);
+    void getTencentCutFrame(String videoUrl, String materialId, String coveUrl);
 
     boolean updateTencentCutFrame(String videoMD5);
 
     MaterialCutFrame getCutFrameByCode(String code);
 
+    List<JSONObject> getProgramCreativeCover(String signature);
 }

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

@@ -423,5 +423,10 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
         return this.getOne(queryWrapper);
     }
 
+    @Override
+    public  List<JSONObject>  getProgramCreativeCover(String signature) {
+        return materialCutFrameMapper.getProgramCreativeCover(signature);
+    }
+
 
 }

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

@@ -2388,4 +2388,5 @@ public class BatchController {
 
 
 
+
 }

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

@@ -95,7 +95,7 @@ public class CollectionSlogansController {
     public Result<JSONObject> add(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
         try {
-            if(Check.isNull(requestJson.getJSONArray("coverSlogansList"))&&Check.isNull(requestJson.getJSONArray("captionsList"))){
+            if(Check.isNull(requestJson.getJSONArray("coverSlogansList"))&&Check.isNull(requestJson.getJSONArray("captionsList"))&&Check.isNull(requestJson.getJSONArray("creativeTag"))){
                 result.setMessage("请输入广告语");
                 result.setSuccess(false);
                 return result;

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

@@ -7,6 +7,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProgramCreative;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouProgramCreativeService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -136,6 +137,37 @@ public class KuaishouProgramCreativeController {
 
 
     /**
+     * 创意分类
+     *
+     * @param
+     * @return
+     */
+    @PostMapping(value = "/getProgramCreativeCover")
+    public Result<JSONArray> getCreativeCategory(@RequestBody JSONObject jsonObject) {
+        Result<JSONArray> result = new Result<>();
+        try {
+
+             JSONArray md5Arr = jsonObject.getJSONArray("md5Arr");
+
+            if (Check.isNull(md5Arr)) {
+                throw new Exception("请选择视频");
+            }
+
+            JSONArray data = kuaishouProgramCreativeService.getProgramCreativeCover(md5Arr);
+            result.setSuccess(true);
+            result.setResult(data);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setResult(null);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+
+    /**
      * 添加
      *
      * @param kuaishouProgramCreative

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

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProgramCreative;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -15,4 +16,6 @@ public interface IKuaishouProgramCreativeService extends IService<KuaishouProgra
     void getProgramCreative(Long accountId, Long unitId, String accessToken, String startDate, String endDate, Integer page);
 
     JSONObject createProgramCreative(CtopOauthToken oauthToken, JSONObject requestJson);
+
+    JSONArray getProgramCreativeCover(JSONArray md5Arr);
 }

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

@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
 public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansMapper, CollectionSlogans> implements ICollectionSlogansService {
 
     @Autowired
-    CollectionSlogansMapper collectionSlogansMapper;
+    private CollectionSlogansMapper collectionSlogansMapper;
 
     @Override
     public void saveCollectionSlogans(JSONObject requestJson) {
@@ -32,6 +32,7 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
         Long accountId = requestJson.getLong("accountId");
         JSONArray coverSlogansList = requestJson.getJSONArray("coverSlogansList");
         JSONArray captionsList = requestJson.getJSONArray("captionsList");
+        JSONArray tagList = requestJson.getJSONArray("creativeTag");
         if (!Check.isNull(coverSlogansList)) {
             //封面广告语
             co.setType(NoEn.NO1.valueStr());
@@ -41,6 +42,11 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
             co.setType(NoEn.NO2.valueStr());
             co.setValue(captionsList.toString());
         }
+        //创意标题
+        if (!Check.isNull(tagList)) {
+            co.setType(NoEn.NO3.valueStr());
+            co.setValue(tagList.toString());
+        }
         co.setAccountId(accountId);
         co.setUserId(userId);
         JSONObject slogansJson = getByUserId(userId, accountId.toString(), co.getType());
@@ -57,13 +63,20 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
                         }
                     }
                     co.setValue(value.toString());
-                } else {
+                } else if (NoEn.NO2.valueStr().equals(co.getType())) {
                     for (int i = 0; i < captionsList.size(); i++) {
                         if (!value.contains(captionsList.get(i))) {
                             value.add(captionsList.get(i));
                         }
                     }
                     co.setValue(value.toString());
+                } else {
+                    for (int i = 0; i < tagList.size(); i++) {
+                        if (!value.contains(tagList.get(i))) {
+                            value.add(tagList.get(i));
+                        }
+                    }
+                    co.setValue(value.toString());
                 }
             }
             collectionSlogansMapper.update(co, queryWrapper);

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -41,6 +42,9 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
     @Autowired
     private IKuaiShouMaterialUploadService uploadService;
 
+    @Autowired
+    private IMaterialCutFrameService materialCutFrameService;
+
 
     @Override
     public void getProgramCreative(Long accountId, Long unitId, String accessToken, String startDate, String endDate, Integer page) {
@@ -220,4 +224,30 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
 
         return returnJson;
     }
+
+    @Override
+    public JSONArray getProgramCreativeCover(JSONArray md5Arr) {
+
+        JSONArray returnArr = new JSONArray();
+        for (int i = 0; i < md5Arr.size(); i++) {
+            String signature = md5Arr.getString(i);
+            if (Check.isNull(signature)) {
+                continue;
+            }
+            List<JSONObject> coverArr = materialCutFrameService.getProgramCreativeCover(signature);
+            if (!Check.isNull(coverArr)) {
+                for (int j = 0; j < coverArr.size(); j++) {
+                    JSONObject jsonObject = JSONObject.parseObject(coverArr.get(j).toJSONString());
+                    if (!Check.isNull(jsonObject)) {
+                        returnArr.add(jsonObject);
+                    }
+                }
+
+            }
+
+        }
+        return returnArr;
+    }
+
+
 }