Pārlūkot izejas kodu

修改开屏视频、开屏图片预览功能

zhaoxian 2 gadi atpakaļ
vecāks
revīzija
bdbf0f760b

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTemplateController.java

@@ -243,6 +243,23 @@ public class KuaiShouGroupTemplateController {
 
     }
 
+    @PostMapping(value = "/getUrlByPhotoIds")
+    public Result<Object> getUrlByPhotoIds(@RequestBody JSONObject requestJson) {
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            JSONArray photoIds = requestJson.getJSONArray("photoIds");
+            if (photoIds.isEmpty()) {
+                throw new Exception("参数不能为空");
+            }
+            List<JSONObject> list = kuaiShouGroupTemplateService.getUrlByPhotoIds(accountId, photoIds);
+            return Result.ok(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+
+    }
+
 
     @PostMapping(value = "/queryUrlByImageTokens")
     public Result<Object> queryUrlByImageTokens(@RequestBody JSONObject requestJson) {

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -34,4 +35,5 @@ public interface KuaiShouGroupTemplateMapper extends BaseMapper<KuaiShouGroupTem
      */
     JSONObject getConfig(@Param("projectId") Long projectId);
 
+    List<JSONObject> getUrlByPhotoIds(@Param("accountId") Long accountId, @Param("photoIds") JSONArray photoIds);
 }

+ 40 - 40
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml

@@ -3,66 +3,66 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper">
 
     <select id="getMd5ByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
-    select
-    signature  as 'md5',
-    material_type as 'materialType'
-    from ctop_kuaishou_video_get
-    where  photo_id = #{photoId}
-    and signature is not null
-    limit 1
+        select signature as 'md5', material_type as 'materialType'
+        from ctop_kuaishou_video_get
+        where photo_id = #{photoId}
+          and signature is not null limit 1
     </select>
 
     <select id="getImageListByMd5" resultType="com.alibaba.fastjson.JSONObject">
-      select
-      signature as 'md5',
-      url as 'url'
-      from ctop_material_cut_frame
-      where video_signature = #{md5}
-      ORDER BY RAND() LIMIT #{imageCount}
+        select signature as 'md5', url as 'url'
+        from ctop_material_cut_frame
+        where video_signature = #{md5}
+        ORDER BY RAND() LIMIT #{imageCount}
     </select>
     <select id="getImageJsonByMd5" resultType="com.alibaba.fastjson.JSONObject">
-      select
-      signature as 'md5',
-      url as 'url'
-      from ctop_material_cut_frame
-      where video_signature = #{md5}
-       ORDER BY RAND() LIMIT 1
+        select signature as 'md5', url as 'url'
+        from ctop_material_cut_frame
+        where video_signature = #{md5}
+        ORDER BY RAND() LIMIT 1
     </select>
 
 
     <select id="getApiCreateCount" resultType="java.lang.Integer">
         select count(1)
-        from
-            ctop_kuaishou_group
-        where  account_id = #{accountId}
+        from ctop_kuaishou_group
+        where account_id = #{accountId}
           and unit_type = #{unitType}
-          and DATE_FORMAT(group_create_time,'%Y-%m-%d') =  #{date}
+          and DATE_FORMAT(group_create_time, '%Y-%m-%d') = #{date}
     </select>
 
     <select id="getUrlByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
-     select
-     cover_url as 'coverUrl',
-     url as 'url'
-     from
-     ctop_kuaishou_video_get
-     where  photo_id = #{photoId}
-     and status = 0
-     limit 1
+        select cover_url as 'coverUrl', url as 'url'
+        from ctop_kuaishou_video_get
+        where photo_id = #{photoId}
+          and status = 0 limit 1
     </select>
 
-    <select id="getIdList" resultType="java.lang.Long">
-    select id  from ctop_kuaishou_group_template
-    where  task_status = 0
-    order by create_time asc
-    limit 70
+    <select id="getUrlByPhotoIds" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        cover_url as 'coverUrl',
+        url as 'url'
+        from
+        ctop_kuaishou_video_get
+        where account_id = #{accountId}
+        and photo_id in
+        <foreach collection="photoIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
     </select>
 
+    <select id="getIdList" resultType="java.lang.Long">
+        select id
+        from ctop_kuaishou_group_template
+        where task_status = 0
+        order by create_time asc limit 70
+    </select>
 
 
     <select id="getConfig" resultType="com.alibaba.fastjson.JSONObject">
-      select
-      library_id as 'libraryId'
-      from ctop_kuaishou_library_config
-      where project_id = #{projectId}
+        select library_id as 'libraryId'
+        from ctop_kuaishou_library_config
+        where project_id = #{projectId}
     </select>
 </mapper>

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTemplateService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
@@ -61,10 +62,13 @@ public interface IKuaiShouGroupTemplateService extends IService<KuaiShouGroupTem
 
     /**
      * 获取商品库配置
+     *
      * @param accountId
      * @return
      */
     JSONObject getLibraryConfig(Long accountId);
 
     void createUnitAgain(KuaiShouGroupTemplate template);
+
+    List<JSONObject> getUrlByPhotoIds(Long accountId, JSONArray photoIds);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -1107,6 +1107,11 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         }
     }
 
+    @Override
+    public List<JSONObject> getUrlByPhotoIds(Long accountId, JSONArray photoIds) {
+        return groupTemplateMapper.getUrlByPhotoIds(accountId, photoIds);
+    }
+
     private void createCreativeAgain(String accessToken, Long unitId, KuaiShouGroupTemplate template) {
         KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
         updateTemplate.setId(template.getId());