Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

liuyc 2 yıl önce
ebeveyn
işleme
5f057920ad

+ 4 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -118,4 +118,8 @@ public interface ArchiveFileClient {
 
     @PostMapping(API_PREFIX + "/updateRectificationById")
     boolean updateRectificationById(@RequestParam Long id,@RequestParam Integer rectification);
+
+    //批量查询案卷下的文件
+    @PostMapping(API_PREFIX + "/batchSearchArchiveFile")
+    List<ArchiveFile> batchSearchArchiveFile(@RequestBody List<Long> ids);
 }

+ 13 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -164,6 +164,19 @@ public class ArchivesAutoController extends BladeController {
 		}
 	}
 
+	/**
+	 * 查询档案里的文件
+	 */
+	@GetMapping("/getArchiveFileList")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "查询档案里的文件", notes = "传入案卷主键")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "案卷id", required = true),
+	})
+	public R<ArchivesAutoVO> getArchiveFileList(Long id) {
+		return R.data(archivesAutoService.getArchiveFileList(id));
+	}
+
 	/**
 	 * 档案统计-档案柜切换档案查看权限
 	 */

+ 12 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.java

@@ -92,11 +92,21 @@ public interface ArchivesAutoMapper extends BaseMapper<ArchivesAuto> {
 	 */
     List<ArchivesAutoVO> pageByArchivesAuto(IPage page, @Param("vo") ArchivesAutoVO vo);
 
+	/**
+	 *  档案利用-档案查询,不带范围,不连接文件表
+	 */
+	List<ArchivesAutoVO> pageByArchivesAuto11(IPage page, @Param("vo") ArchivesAutoVO vo);
+
 	/**
 	 *  档案利用-档案查询,带范围
 	 */
 	List<ArchivesAutoVO> pageByArchivesAuto2(IPage page, @Param("vo") ArchivesAutoVO vo);
 
+	/**
+	 *  档案利用-档案查询,带范围,不连接文件表
+	 */
+	List<ArchivesAutoVO> pageByArchivesAuto22(IPage page, @Param("vo") ArchivesAutoVO vo);
+
 	/**
 	 *  档案鉴定-档案查询
 	 */
@@ -135,4 +145,6 @@ public interface ArchivesAutoMapper extends BaseMapper<ArchivesAuto> {
 	List<ArchivesAutoVO> pageByArchivesAuto4(@Param("vo") ArchivesAutoVO vo);
 
     Long getAllArchiveFileSize(@Param("projectId") Long projectId);
+
+	ArchivesAutoVO getArchiveFileList(@Param("id") Long id);
 }

+ 149 - 7
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -49,10 +49,58 @@
         <result column="filing_unit" property="filingUnit"/>
         <result column="file_size" property="fileSize"/>
         <result column="is_reviewed" property="isReviewed"/>
-        <collection property="approvalFileList" javaType="java.util.List"
-                    select="approvalFile"
-                    column="{archiveId=id}">
-        </collection>
+    </resultMap>
+<!-- 带文件子查询的-->
+    <resultMap id="archivesAutoResultMap2" type="org.springblade.archive.vo.ArchivesAutoVO">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="project_id" property="projectId"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="name" property="name"/>
+        <result column="file_number" property="fileNumber"/>
+        <result column="micron" property="micron"/>
+        <result column="unit" property="unit"/>
+        <result column="quantity" property="quantity"/>
+        <result column="specification" property="specification"/>
+        <result column="start_date" property="startDate"/>
+        <result column="end_date" property="endDate"/>
+        <result column="storage_time" property="storageTime"/>
+        <result column="secret_level" property="secretLevel"/>
+        <result column="carrier_type" property="carrierType"/>
+        <result column="keywords" property="keywords"/>
+        <result column="reviewer" property="reviewer"/>
+        <result column="review_date" property="reviewDate"/>
+        <result column="storage_location" property="storageLocation"/>
+        <result column="is_archive" property="isArchive"/>
+        <result column="remark" property="remark"/>
+        <result column="roll_date" property="rollDate"/>
+        <result column="rollor" property="rollor"/>
+        <result column="node_id" property="nodeId"/>
+        <result column="out_url" property="outUrl"/>
+        <result column="cd_id" property="cdId"/>
+        <result column="file_n" property="fileN"/>
+        <result column="page_n" property="pageN"/>
+        <result column="mileage" property="mileage"/>
+        <result column="file_type" property="fileType"/>
+        <result column="size" property="size"/>
+        <result column="tree_sort" property="treeSort"/>
+        <result column="is_open" property="isOpen"/>
+        <result column="ischeck" property="ischeck"/>
+        <result column="is_auto_file" property="isAutoFile"/>
+        <result column="auto_file_sort" property="autoFileSort"/>
+        <result column="filing_unit" property="filingUnit"/>
+        <result column="file_size" property="fileSize"/>
+        <result column="is_reviewed" property="isReviewed"/>
+                <collection property="approvalFileList" javaType="java.util.List"
+                            select="approvalFile"
+                            column="{archiveId=id}">
+                </collection>
     </resultMap>
 
     <select id="approvalFile" resultType="org.springblade.archive.vo.ArchivesAutoVO$ApprovalFile">
@@ -373,7 +421,7 @@
         where project_id = #{projectId};
     </select>
     <select id="pageByArchivesAuto" resultMap="archivesAutoResultMap">
-        select uaa.*,(select COUNT(1) from u_archive_file af WHERE af.archive_id = uaa.id AND af.is_element = 0 and af.is_deleted = 0) as pageNumber
+        select uaa.*
         from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id left join
         u_archive_file uaf on uaa.id = uaf.archive_id
         where uaa.is_deleted = 0 and uaa.is_archive = 1
@@ -423,8 +471,52 @@
         order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
     </select>
 
+    <select id="pageByArchivesAuto11" resultMap="archivesAutoResultMap">
+        select uaa.*
+        from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id
+        where uaa.is_deleted = 0 and uaa.is_archive = 1 and uaa.name like concat('%',#{vo.queryValue},'%')
+        <if test="vo.projectId != null and vo.projectId != ''">
+            and matc.project_id = #{vo.projectId}
+        </if>
+        <if test="vo.contractId != null and vo.contractId != ''">
+            and uaa.contract_id = #{vo.contractId} and matc.contract_id = #{vo.contractId}
+        </if>
+        <if test="vo.storageTimes != null and vo.storageTimes != ''">
+            and uaa.storage_time in
+            <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
+                #{storageTime}
+            </foreach>
+        </if>
+        <if test="vo.secretLevels != null and vo.secretLevels != ''">
+            and uaa.secret_level in
+            <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
+                #{secretLevel}
+            </foreach>
+        </if>
+        <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
+            and uaa.carrier_type in
+            <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
+                #{carrierType}
+            </foreach>
+        </if>
+        <if test="vo.years != null and vo.years != ''">
+            and
+            <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
+                #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
+            </foreach>
+        </if>
+        <if test="vo.months != null and vo.months != ''">
+            and
+            <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
+                #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
+            </foreach>
+        </if>
+        GROUP BY uaa.id
+        order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
+    </select>
+
     <select id="pageByArchivesAuto2" resultMap="archivesAutoResultMap">
-        select uaa.*,(select COUNT(1) from u_archive_file af WHERE af.archive_id = uaa.id AND af.is_element = 0 and af.is_deleted = 0) as pageNumber from
+        select uaa.* from
         (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
         and 1=2
         <foreach collection="vo.nodeIdArray" item="nodeId">
@@ -476,8 +568,54 @@
         order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
     </select>
 
+    <select id="pageByArchivesAuto22" resultMap="archivesAutoResultMap">
+        select uaa.* from
+        (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
+        and 1=2
+        <foreach collection="vo.nodeIdArray" item="nodeId">
+            or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
+        </foreach>
+        ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
+        where uaa.is_deleted = 0 and uaa.is_archive = 1 and uaa.name like concat('%',#{vo.queryValue},'%')
+        <if test="vo.contractId != null and vo.contractId != ''">
+            and uaa.contract_id = #{vo.contractId}
+        </if>
+        <if test="vo.storageTimes != null and vo.storageTimes != ''">
+            and uaa.storage_time in
+            <foreach collection="vo.storageTimes" item="storageTime" open="(" separator="," close=")">
+                #{storageTime}
+            </foreach>
+        </if>
+        <if test="vo.secretLevels != null and vo.secretLevels != ''">
+            and uaa.secret_level in
+            <foreach collection="vo.secretLevels" item="secretLevel" open="(" separator="," close=")">
+                #{secretLevel}
+            </foreach>
+        </if>
+        <if test="vo.carrierTypes != null and vo.carrierTypes != ''">
+            and uaa.carrier_type in
+            <foreach collection="vo.carrierTypes" item="carrierType" open="(" separator="," close=")">
+                #{carrierType}
+            </foreach>
+        </if>
+        <if test="vo.years != null and vo.years != ''">
+            and
+            <foreach collection="vo.years" item="year" separator=" or" open="(" close=")">
+                #{year} BETWEEN DATE_FORMAT(uaa.start_date,'%Y') and DATE_FORMAT(uaa.end_date ,'%Y')
+            </foreach>
+        </if>
+        <if test="vo.months != null and vo.months != ''">
+            and
+            <foreach collection="vo.months" item="month" separator=" or" open="(" close=")">
+                #{month} BETWEEN DATE_FORMAT(uaa.start_date,'%c') and DATE_FORMAT(uaa.end_date ,'%c')
+            </foreach>
+        </if>
+        GROUP BY uaa.id
+        order by uaa.tree_sort,uaa.auto_file_sort,uaa.file_number asc
+    </select>
+
     <select id="pageByArchivesAuto3" resultMap="archivesAutoResultMap">
-        select uaa.*,(select COUNT(1) from u_archive_file af WHERE af.archive_id = uaa.id AND af.is_element = 0 and af.is_deleted = 0) as pageNumber
+        select uaa.*
         from
         (SELECT id FROM m_archive_tree_contract WHERE project_id =#{vo.projectId}
         and  ancestors like concat('%',#{vo.nodeId},'%')
@@ -704,6 +842,10 @@
     <select id="getAllArchiveFileSize" resultType="java.lang.Long">
         select sum(uaa.file_size)  from u_archives_auto uaa WHERE uaa.project_id = #{projectId} and is_deleted = 0
     </select>
+    <select id="getArchiveFileList"  resultMap="archivesAutoResultMap2">
+        select *
+        from u_archives_auto uaa WHERE uaa.id = #{id} and is_deleted = 0
+    </select>
 
 
     <update id="splitFiles">

+ 3 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java

@@ -18,6 +18,7 @@ package org.springblade.archive.service;
 
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.vo.ArchivesAutoVO;
+import org.springblade.business.entity.ArchiveFile;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.core.tool.api.R;
@@ -92,4 +93,6 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
     void getArchivesAuthByUser(Long projectId,Long contractId,Integer archiveType);
 
     Long allArchiveFileSize(Long projectId);
+
+	ArchivesAutoVO getArchiveFileList(Long id);
 }

+ 31 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -64,6 +64,7 @@ import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.EnableAsync;
@@ -142,11 +143,22 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		}
 		if (StringUtils.isNotBlank(vo.getNodeIds())) {
 			vo.setNodeIdArray(Arrays.asList(vo.getNodeIds().split(",")));
-			archivesAutos = baseMapper.pageByArchivesAuto2(page, vo);
+			//如果搜索类型不为文件,就不连接文件表
+			if (vo.getSearchType() == 2) {
+				archivesAutos = baseMapper.pageByArchivesAuto2(page, vo);
+			}else {
+				archivesAutos = baseMapper.pageByArchivesAuto22(page, vo);
+			}
 		} else {
-			archivesAutos = baseMapper.pageByArchivesAuto(page, vo);
+			//如果搜索类型不为文件,就不连接文件表
+			if (vo.getSearchType() == 2) {
+				archivesAutos = baseMapper.pageByArchivesAuto(page, vo);
+			}else {
+				archivesAutos = baseMapper.pageByArchivesAuto11(page, vo);
+			}
 		}
 		if (archivesAutos != null && archivesAutos.size() >0) {
+			//手动插入档案内文件
 			archivesAutos.stream().forEach(aa -> {
 				if (StringUtils.isNotBlank(aa.getStorageTime())) {
 					aa.setStorageTimeValue("3".equals(aa.getStorageTime()) ? "永久" : ("2".equals(aa.getStorageTime()) ? "30年" : "10年"));
@@ -281,6 +293,23 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		return size * 1024L;
 	}
 
+	@Override
+	public ArchivesAutoVO getArchiveFileList(Long id) {
+		ArchivesAutoVO vo = baseMapper.getArchiveFileList(id);
+		if (StringUtils.isNotBlank(vo.getStorageTime())) {
+			vo.setStorageTimeValue("3".equals(vo.getStorageTime()) ? "永久" : ("2".equals(vo.getStorageTime()) ? "30年" : "10年"));
+		}
+		if (StringUtils.isNotBlank(vo.getSecretLevel())) {
+			vo.setSecretLevelValue("1".equals(vo.getSecretLevel()) ? "机密" : ("2".equals(vo.getSecretLevel()) ? "绝密" : "秘密"));
+		}
+		if (vo.getApprovalFileList() != null && vo.getApprovalFileList().size() > 0) {
+			vo.setPageNumber(vo.getApprovalFileList().size());
+		}else {
+			vo.setPageNumber(0);
+		}
+		return vo;
+	}
+
 	/**
 	 * 根据搜索获取档案柜
 	 * @param archivesAuto

+ 5 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java

@@ -251,5 +251,10 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
         return true;
     }
 
+    @Override
+    public List<ArchiveFile> batchSearchArchiveFile(List<Long> ids) {
+        return fileMapper.batchSearchArchiveFile(ids);
+    }
+
 
 }

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.java

@@ -88,4 +88,6 @@ public interface ArchiveFileMapper extends BaseMapper<ArchiveFile> {
     List<ArchiveFile> getAllPdfFileUrlByProjectIdAndFileType(@Param("projectId") Long projectId);
 
     void updateRectificationById(@Param("id") Long id,@Param("rectification") Integer rectification);
+
+    List<ArchiveFile> batchSearchArchiveFile(@Param("ids") List<Long> ids);
 }

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -382,6 +382,13 @@
         FROM u_archive_file
         WHERE project_id = #{projectId}
     </select>
+    <select id="batchSearchArchiveFile" resultType="org.springblade.business.entity.ArchiveFile">
+        select * FROM u_archive_file
+        WHERE is_element = 0 and archive_id in
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
 
     <update id="updateRectificationById">
         update u_archive_file set rectification = #{rectification} where