浏览代码

影像资料bug

Signed-off-by: liuyc <56808083@qq.com>
liuyc 1 年之前
父节点
当前提交
26491ed875

+ 52 - 47
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.xml

@@ -73,60 +73,65 @@
 
     <select id="selectImageClassificationFilePage" resultMap="imageClassificationFileResultMap">
         select
-        files.id,
-        files.title,
-        files.text_content,
-        files.shooting_user,
-        files.shooting_time,
-        files.file_size,
-        files.image_url,
-        files.pdf_url,
-        files.type,
-        files.marge_pdf_url,
-        files.create_time
+            files.id,
+            files.title,
+            files.text_content,
+            files.shooting_user,
+            files.shooting_time,
+            files.file_size,
+            files.image_url,
+            files.pdf_url,
+            files.type,
+            files.marge_pdf_url,
+            files.create_time,
+            files.wbs_id
         from
         (
-        select
-        create_time,
-        id,
-        title,
-        text_content,
-        shooting_user,
-        shooting_time,
-        file_size,
-        image_url,
-        pdf_url,
-        marge_pdf_url,
-        type,
-        date_format(shooting_time,'%Y-%m-%d') as shootingTimeStr
-        from u_image_classification_file where is_deleted = 0
-        and project_id = #{param.projectId} and classify_id = #{param.classifyId}
-        <if test="param.contractId != null and param.contractId != ''">
-            and contract_id = #{param.contractId}
-        </if>
-        <if test="param.queryStr != null and param.queryStr != ''">
-            and (title like concat('%',#{param.queryStr},'%') OR shooting_user like concat('%',#{param.queryStr},'%'))
-        </if>
-        <if test="param.wbsIds != null and param.wbsIds.size != 0">
-            and wbs_id in
-            <foreach collection="param.wbsIds" item="webId" open="(" separator="," close=")">#{webId}</foreach>
-        </if>
-
-        <if test="param.staDate != null and param.staDate != ''">
-            <![CDATA[ and  shooting_time >= DATE_FORMAT(#{param.staDate}, '%Y-%m-%d %H:%i:%S') ]]>
-        </if>
-        <if test="param.endDate != null and param.endDate != ''">
-            <![CDATA[ and  shooting_time <= DATE_FORMAT(#{param.endDate}, '%Y-%m-%d %H:%i:%S') ]]>
-        </if>
-
-        order by shooting_time desc
-        ) as files
+            select
+                wbs_id,
+                create_time,
+                id,
+                title,
+                text_content,
+                shooting_user,
+                shooting_time,
+                file_size,
+                image_url,
+                pdf_url,
+                marge_pdf_url,
+                type,
+                date_format(shooting_time,'%Y-%m-%d') as shootingTimeStr
+            from u_image_classification_file
+            where is_deleted = 0 and status = 1
+                and project_id = #{param.projectId}
+                and classify_id = #{param.classifyId}
+            <if test="param.contractId != null and param.contractId != ''">
+                and contract_id = #{param.contractId}
+            </if>
+            <if test="param.queryStr != null and param.queryStr != ''">
+                and (title like concat('%',#{param.queryStr},'%') OR shooting_user like concat('%',#{param.queryStr},'%'))
+            </if>
+            <if test="param.wbsIds != null and param.wbsIds.size != 0">
+                and wbs_id in
+                <foreach collection="param.wbsIds" item="wbsId" open="(" separator="," close=")">
+                    #{wbsId}
+                </foreach>
+            </if>
+            <if test="param.staDate != null and param.staDate != ''">
+                <![CDATA[ and  shooting_time >= DATE_FORMAT(#{param.staDate}, '%Y-%m-%d %H:%i:%S') ]]>
+            </if>
+            <if test="param.endDate != null and param.endDate != ''">
+                <![CDATA[ and  shooting_time <= DATE_FORMAT(#{param.endDate}, '%Y-%m-%d %H:%i:%S') ]]>
+            </if>
+                order by shooting_time desc
+            ) as files
         where
-        1 = 1
+            1 = 1
         <if test="param.queryDate != null and param.queryDate != ''">
             and files.shootingTimeStr like concat('%',#{param.queryDate},'%')
         </if>
     </select>
+
     <select id="getDeleteDataByIds" resultType="org.springblade.business.entity.ImageClassificationFile">
         select * from u_image_classification_file where id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">

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

@@ -31,10 +31,8 @@ import org.springblade.business.vo.TreeVo;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.manager.entity.WbsParam;
-import org.springblade.manager.entity.WbsTree;
-import org.springblade.manager.entity.WbsTreeContract;
-import org.springblade.manager.entity.WbsTreePrivate;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.feign.ImageClassificationConfigClient;
 import org.springblade.manager.feign.WbsTreeContractClient;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -55,6 +53,7 @@ import java.util.stream.Collectors;
 public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageClassificationFileMapper, ImageClassificationFile> implements IImageClassificationFileService {
 
     private final WbsTreeContractClient wbsTreeContractClient;
+    private final ImageClassificationConfigClient classificationConfigClient;
     private final JdbcTemplate jdbcTemplate;
 
     @Override
@@ -83,9 +82,8 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
         long current = (page.getCurrent() - 1L) * page.getSize();
         if (StringUtils.isNotEmpty(imageClassificationFile.getWbsIdsStr())) {
             //查询下级节点信息
-            //imageClassificationFile.setWbsIds(JSONArray.parseArray(JSONObject.toJSONString(imageClassificationFile.getWbsIdsStr().split(",")), String.class));
             WbsTreeContract node = wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.valueOf(imageClassificationFile.getWbsIdsStr()));
-            List<WbsTreeContract> wbsTreeContracts = new ArrayList<>();
+            List<WbsTreeContract> wbsTreeContracts;
             if (node.getParentId() == 0) {
                 wbsTreeContracts = wbsTreeContractClient.queryAllChild(imageClassificationFile.getContractId());
             } else {
@@ -97,6 +95,19 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
 
         //获取数据
         List<ImageClassificationFile> fileVOS = this.baseMapper.selectImageClassificationFilePage(current, page.getSize(), imageClassificationFile);
+
+        if (ObjectUtil.isNotEmpty(imageClassificationFile.getClassifyId())) {
+            List<ImageClassificationConfig> imageClassificationConfigs = classificationConfigClient.queryClassificationConfigListByIds(Collections.singletonList(imageClassificationFile.getClassifyId()));
+            if (imageClassificationConfigs.size() > 0) {
+                ImageClassificationConfig imageClassificationConfig = imageClassificationConfigs.get(0);
+                if (imageClassificationConfig.getStorageDirectoryFormat().equals(1)) {
+                    fileVOS.removeIf(f -> ObjectUtil.isEmpty(f.getWbsId()));
+                } else if (imageClassificationConfig.getStorageDirectoryFormat().equals(2)){
+                    fileVOS.removeIf(f -> ObjectUtil.isNotEmpty(f.getWbsId()));
+                }
+            }
+        }
+
         //获取总数据条数和总页数
         int totalRecords = fileVOS.size();
         int totalPages = (int) Math.ceil((double) totalRecords / page.getSize());