liuyc преди 1 година
родител
ревизия
043ec185da

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ImageClassificationFile.java

@@ -127,4 +127,7 @@ public class ImageClassificationFile extends BaseEntity {
     @ApiModelProperty("合并后的PDF")
     private String margePdfUrl;
 
+    @ApiModelProperty("视频封面图Url地址")
+    private String videoCoverUrl;
+
 }

+ 1 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ImageClassificationFileVO.java

@@ -85,4 +85,5 @@ public class ImageClassificationFileVO extends ImageClassificationFile {
     @ApiModelProperty("是否是App")
     private Integer isApp;
 
+
 }

+ 26 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -20,6 +20,7 @@ import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.RecycleBinClient;
 import org.springblade.business.service.ImageClassificationShowService;
 import org.springblade.business.utils.FileUtils;
+import org.springblade.business.utils.VideoFrameExtractor;
 import org.springblade.business.vo.ImageClassificationShowVO;
 import org.springblade.business.vo.TreeVo;
 import org.springblade.common.utils.CommonUtil;
@@ -484,7 +485,11 @@ public class ImageClassificationFileController extends BladeController {
             }
 
             //获取当前节点下的文件
-            Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId());
+            String type = "1";
+            if (vo.getId().toString().equals("1526085356632051714") || vo.getId().toString().equals("1526085256795033601")) {
+                type = "2";
+            }
+            Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId(), type);
             vo.setCount(count);
 
         });
@@ -530,7 +535,7 @@ public class ImageClassificationFileController extends BladeController {
             @ApiImplicitParam(name = "staDate", value = "开始时间"),
             @ApiImplicitParam(name = "endDate", value = "结束时间")
     })
-    public R<Object> page(ImageClassificationFileVO fileVO, Query query) {
+    public R<Object> page(ImageClassificationFileVO fileVO, Query query) throws Exception {
         IPage<ImageClassificationFileVO> page = this.imageClassificationFileService.selectImageClassificationFilePage(Condition.getPage(query), fileVO);
         List<ImageClassificationFileVO> sortedRecords = page.getRecords().stream()
                 .filter(vos -> vos.getCreateTime() != null)//过滤掉创建时间为null的记录
@@ -553,6 +558,14 @@ public class ImageClassificationFileController extends BladeController {
                 List<ImageClassificationFileVO> value = stringObjectEntry.getValue();
                 Map<String, Object> stringObjectMap = new HashMap<>();
                 stringObjectMap.put("name", date);
+
+                for (ImageClassificationFileVO vo : value) {
+                    if (StringUtils.isNotEmpty(vo.getImageUrl()) && isVideoUrl(vo.getImageUrl()) && StringUtils.isEmpty(vo.getVideoCoverUrl())) {
+                        //设置默认视频封面logo
+                        vo.setVideoCoverUrl("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230904/b86888a3fcd280d56053639dbfddb35d.jpg");
+                    }
+                }
+
                 stringObjectMap.put("child", value);
                 list.add(stringObjectMap);
             }
@@ -560,7 +573,18 @@ public class ImageClassificationFileController extends BladeController {
         }
         page.setRecords(sortedRecords);
         return R.data(page);
+    }
 
+    /**
+     * 根据Url地址后缀判断是否为视频地址
+     */
+    public static boolean isVideoUrl(String url) {
+        String lowercaseUrl = url.toLowerCase(); //将URL转换为小写,以便不区分大小写
+        return lowercaseUrl.endsWith(".mp4") || lowercaseUrl.endsWith(".avi") || lowercaseUrl.endsWith(".mov")
+                || lowercaseUrl.endsWith(".wmv") || lowercaseUrl.endsWith(".mkv") || lowercaseUrl.endsWith(".flv")
+                || lowercaseUrl.endsWith(".3gp")
+                || lowercaseUrl.endsWith(".m4v")
+                || lowercaseUrl.endsWith(".webm");
     }
 
     /**

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.java

@@ -44,7 +44,7 @@ public interface ImageClassificationFileMapper extends BaseMapper<ImageClassific
      * @param classifyId 分类ID
      * @return 结果
      */
-    Integer queryCurrentClassifyAllFileCount(@Param("projectId") String projectId, @Param("contractId") String contractId, @Param("classifyId") Long classifyId);
+    Integer queryCurrentClassifyAllFileCount(@Param("projectId") String projectId, @Param("contractId") String contractId, @Param("classifyId") Long classifyId, @Param("type") String type);
 
     /**
      * 获取当前分类下当前项目的拍摄时间

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.xml

@@ -52,7 +52,11 @@
         <if test="projectId != null and projectId != ''">
             and project_id = #{projectId}
         </if>
-            and a.wbs_id in (select p_key_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and contract_id = #{contractId})
+        <choose>
+            <when test="type == 1">
+                and a.wbs_id in (select p_key_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and contract_id = #{contractId})
+            </when>
+        </choose>
     </select>
 
     <select id="selectShootingTimeByClassifyAndProjectId" resultType="java.util.Date">

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/IImageClassificationFileService.java

@@ -27,7 +27,7 @@ public interface IImageClassificationFileService extends BaseService<ImageClassi
      * @param classifyId 分类ID
      * @return 结果
      */
-    Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId);
+    Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId,String type);
 
     /**
      * 获取当前分类下当前项目的拍摄时间

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ImageClassificationFileServiceImpl.java

@@ -63,8 +63,8 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
     }
 
     @Override
-    public Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId) {
-        return this.baseMapper.queryCurrentClassifyAllFileCount(projectId, contractId, classifyId);
+    public Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId, String type) {
+        return this.baseMapper.queryCurrentClassifyAllFileCount(projectId, contractId, classifyId, type);
     }
 
     @Override