Browse Source

在线收集

“zhifk” 2 years ago
parent
commit
fae161e8d6

+ 11 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -1,5 +1,6 @@
 package org.springblade.business.feign;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.business.vo.ArchiveFileVO;
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -34,8 +36,14 @@ public interface ArchiveFileClient {
     void updateArchiveFileSort(@RequestBody ArchiveFileVO vo);
 
     @PostMapping(API_PREFIX + "/updateArchiveFileByBoxName")
-    boolean updateArchiveFileByBoxName(@RequestParam List<Long> toLongList,@RequestParam String boxName,@RequestParam Integer boxNumber);
+    boolean updateArchiveFileByBoxName(@RequestBody Map<String,Object> jsons);
 
-    @PostMapping(API_PREFIX + "/IsBoxName")
-    boolean IsBoxName(@RequestParam String boxName);
+    @PostMapping(API_PREFIX + "/isBoxName")
+    String isBoxName(@RequestParam String boxName);
+
+    @PostMapping(API_PREFIX + "/selectBoxNameAndBoxNumber")
+    JSONArray selectBoxNameAndBoxNumber(@RequestParam String nodeId);
+
+    @PostMapping(API_PREFIX + "/updateArchiveFileByNodeId")
+    boolean updateArchiveFileByNodeId(@RequestParam String ids,@RequestParam String nodeId);
 }

+ 33 - 6
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java

@@ -22,7 +22,9 @@ import org.springblade.resource.feign.IOSSClient;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 
@@ -92,7 +94,7 @@ public class ArchiveFileController extends BladeController {
     @PostMapping("/page")
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
-    public R<Object> page(ArchiveFileVO queryVo){
+    public R<Object> page( ArchiveFileVO queryVo){
         if(queryVo.getNodeIds().isEmpty() || queryVo.getNodeIds().equals("")){
             return  R.data(null);
         }
@@ -127,9 +129,12 @@ public class ArchiveFileController extends BladeController {
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "未分盒的显示")
     public R<Object> pageByBoxName(ArchiveFileVO queryVo){
-        if(queryVo.getNodeIds().isEmpty() || queryVo.getNodeIds().equals("")){
+        if(queryVo == null || queryVo.getNodeIds() == null || queryVo.getNodeIds().equals("")){
             return  R.data(null);
         }
+        List<String> ids = new ArrayList<>();
+        ids.add(queryVo.getNodeIds());
+        queryVo.setNodeIdArray(ids);
         return R.data(this.archiveFileClient.selectArchiveFilePageByBoxName(queryVo));
     }
     /**
@@ -138,8 +143,8 @@ public class ArchiveFileController extends BladeController {
     @PostMapping("/getIsBoxName")
     @ApiOperationSupport(order = 6)
     @ApiOperation(value = "分盒盒号验证", notes = "传入boxName")
-    public R getIsBoxName(@RequestParam String boxName) {
-        return R.status(this.archiveFileClient.IsBoxName(boxName));
+    public R<String> getIsBoxName(@RequestParam String boxName) {
+        return R.data(this.archiveFileClient.isBoxName(boxName));
     }
     /**
      * 设置分盒
@@ -147,7 +152,29 @@ public class ArchiveFileController extends BladeController {
     @PostMapping("/allocation")
     @ApiOperationSupport(order = 7)
     @ApiOperation(value = "设置分盒", notes = "传入ids")
-    public R allocation(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam String boxName,@RequestParam Integer boxNumber) {
-        return R.status(this.archiveFileClient.updateArchiveFileByBoxName(Func.toLongList(ids),boxName,boxNumber));
+    public R allocation(@RequestBody Map<String,Object> jsons) {
+        return R.status(this.archiveFileClient.updateArchiveFileByBoxName(jsons));
+    }
+
+    /**
+     * 已有盒号和案卷名称
+     */
+    @PostMapping("/getBoxNameAndBoxNumber")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "未分盒的显示")
+    public R<Object> getBoxNameAndBoxNumber(@ApiParam(value = "树节点", required = true) @RequestParam String nodeId){
+        if(nodeId.isEmpty() || nodeId.equals("")){
+            return  R.data(null);
+        }
+        return R.data(this.archiveFileClient.selectBoxNameAndBoxNumber(nodeId));
+    }
+    /**
+     * 迁移文件
+     */
+    @PostMapping("/migrateFile")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "迁移文件", notes = "传入ids")
+    public R migrateFile(@RequestParam String ids,@RequestParam String nodeId) {
+        return R.status(this.archiveFileClient.updateArchiveFileByNodeId(ids,nodeId));
     }
 }

+ 18 - 4
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.business.feignClient;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import lombok.AllArgsConstructor;
@@ -9,6 +10,7 @@ import org.springblade.business.vo.ArchiveFileVO;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
 
 
 @RestController
@@ -39,12 +41,24 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
     }
 
     @Override
-    public boolean updateArchiveFileByBoxName(List<Long> toLongList, String boxName,Integer boxNumber) {
-        return  this.iArchiveFileService.updateArchiveFileByBoxName(toLongList,boxName,boxNumber);
+    public boolean updateArchiveFileByBoxName(Map<String,Object> jsons) {
+        return  this.iArchiveFileService.updateArchiveFileByBoxName(jsons);
     }
 
     @Override
-    public boolean IsBoxName(String boxName) {
-        return this.iArchiveFileService.IsBoxName(boxName);
+    public String isBoxName(String boxName) {
+        return this.iArchiveFileService.isBoxName(boxName);
+    }
+
+    @Override
+    public JSONArray selectBoxNameAndBoxNumber(String nodeId) {
+        List<Object> mapList = this.iArchiveFileService.selectBoxNameAndBoxNumber(nodeId);
+
+        return JSONArray.parseArray(JSONArray.toJSONString(mapList));
+    }
+
+    @Override
+    public boolean updateArchiveFileByNodeId(String ids, String nodeId) {
+        return this.iArchiveFileService.updateArchiveFileByNodeId(ids,nodeId);
     }
 }

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

@@ -22,6 +22,7 @@ import org.springblade.business.vo.ArchiveFileVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import java.util.List;
+import java.util.Map;
 
 /**
  *  Mapper 接口
@@ -33,6 +34,7 @@ public interface ArchiveFileMapper extends BaseMapper<ArchiveFile> {
 
 	Integer selectArchiveFileCount(@Param("vo") ArchiveFileVO vo);
 
+	Integer selectArchiveFilePageByBoxNameCount(@Param("vo") ArchiveFileVO vo);
 	/**
 	 * 自定义分页
 	 */
@@ -49,12 +51,15 @@ public interface ArchiveFileMapper extends BaseMapper<ArchiveFile> {
 	List<ArchiveFile> getDeleteDataByIds(@Param("ids")List<String> ids);
 
 	Boolean updateArchiveFileByBoxName(@Param("ids") List<Long> ids,@Param("boxName") String boxName,@Param("boxNumber") Integer boxNumber);
-
-	Integer IsBoxName(@Param("boxName") String boxName);
+	Boolean updateArchiveFileByBoxNameOne(@Param("boxName") String boxName,@Param("boxNumber") Integer boxNumber);
+	Integer isBoxName(@Param("boxName") String boxName);
 
 	/**
 	 * 自定义分页
 	 */
 	List<ArchiveFile> selectArchiveFilePageByBoxName(@Param("current") Integer current, @Param("size") Integer size, @Param("vo") ArchiveFileVO vo);
 
+	List<Object> selectBoxNameAndBoxNumber(String nodeId);
+
+	Integer updateArchiveFileByNodeId(List<Long> ids, String nodeId);
 }

+ 62 - 3
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -123,6 +123,48 @@
         order by sort,create_time DESC
     </select>
 
+    <select id="selectArchiveFilePageByBoxNameCount" resultType="java.lang.Integer">
+        select count(id) from u_archive_file where is_deleted = 0
+        <if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
+            and status = #{vo.isApprovalValue}
+        </if>
+        <if test="vo.isCertificationValue != null and vo.isCertificationValue != ''">
+            and is_certification = #{vo.isCertificationValue}
+        </if>
+        <if test="vo.projectId != null and vo.projectId != ''">
+            and project_id = #{vo.projectId}
+        </if>
+        <if test="vo.contractId != null and vo.contractId != ''">
+            and contract_id = #{vo.contractId}
+        </if>
+        <if test="vo.nodeIds != null and vo.nodeIds != ''">
+            and node_id in
+            <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
+                #{nodeId}
+            </foreach>
+        </if>
+
+        <choose>
+            <when test="vo.boxName != null and vo.boxName != ''">
+                and  (box_name = #{vo.boxName} or box_name is null or box_name = '')
+            </when>
+            <otherwise>
+                and (box_name is null or box_name = '')
+            </otherwise>
+        </choose>
+
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+            and (
+            file_name like concat('%',#{vo.queryValue},'%') or
+            file_number like concat('%',#{vo.queryValue},'%') or
+            duty_user like concat('%',#{vo.queryValue},'%') or
+            sheet_source like concat('%',#{vo.queryValue},'%') or
+            drawing_no like concat('%',#{vo.queryValue},'%') or
+            cite_change_number like concat('%',#{vo.queryValue},'%')
+            )
+        </if>
+        order by box_number,sort,create_time DESC
+    </select>
     <select id="selectArchiveFilePageByBoxName" resultMap="archiveFileResultMap">
         select * from u_archive_file where is_deleted = 0
         <if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
@@ -146,7 +188,7 @@
 
         <choose>
             <when test="vo.boxName != null and vo.boxName != ''">
-                and box_name = #{vo.boxName}
+                and (box_name = #{vo.boxName} or box_name is null or box_name = '')
             </when>
             <otherwise>
                 and (box_name is null or box_name = '')
@@ -165,7 +207,6 @@
         </if>
         order by box_number,sort,create_time DESC
     </select>
-
     <select id="getDeleteDataByIds" resultType="org.springblade.business.entity.ArchiveFile">
         select * from u_archive_file where id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -173,7 +214,7 @@
         </foreach>
     </select>
 
-    <select id="IsBoxName" resultType="java.lang.Integer">
+    <select id="isBoxName" resultType="java.lang.Integer">
         select count(id) from u_archive_file where is_deleted = 0 and box_name =  #{boxName}
     </select>
 
@@ -184,4 +225,22 @@
             #{id}
         </foreach>
     </update>
+    <update id="updateArchiveFileByBoxNameOne" >
+        update u_archive_file set box_name = null,box_number = null where
+        box_name =  #{boxName} and box_number = #{boxNumber}
+    </update>
+
+    <select id="selectBoxNameAndBoxNumber" resultType="java.util.Map">
+        select box_name as boxName,box_number as boxNumber,group_concat(DISTINCT id ORDER BY id ASC SEPARATOR ',') as ids
+         from u_archive_file where node_id = #{nodeId} and box_number is not null
+         group by box_name order by box_number asc
+    </select>
+
+    <update id="updateArchiveFileByNodeId" >
+        update u_archive_file set node_id = #{nodeId} where
+        id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
 </mapper>

+ 9 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/IArchiveFileService.java

@@ -16,12 +16,15 @@
  */
 package org.springblade.business.service;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  *  服务类
@@ -55,7 +58,11 @@ public interface IArchiveFileService extends BaseService<ArchiveFile> {
 
 	void updateArchiveFileSort(List<ArchiveFileVO> list);
 
-	boolean updateArchiveFileByBoxName(List<Long> toLongList, String boxName,Integer boxNumber);
+	boolean updateArchiveFileByBoxName(Map<String,Object> jsons);
 
-	boolean IsBoxName(String boxName);
+	String isBoxName(String boxName);
+
+	List<Object> selectBoxNameAndBoxNumber(String nodeId);
+
+	boolean updateArchiveFileByNodeId(String ids, String nodeId);
 }

+ 36 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java

@@ -11,6 +11,7 @@ import org.springblade.business.service.IArchiveFileService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springframework.stereotype.Service;
@@ -18,6 +19,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  *  服务实现类
@@ -100,14 +102,43 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
 	}
 
 	@Override
-	public boolean updateArchiveFileByBoxName(List<Long> ids, String boxName,Integer boxNumber) {
-		return baseMapper.updateArchiveFileByBoxName(ids,boxName,boxNumber);
+	public boolean updateArchiveFileByBoxName(Map<String,Object> jsons) {
+		List<Object> list = (List< Object>) jsons.get("list");
+		for(int i = 0 ;i<list.size();i++){
+			Map<String,Object> map = (Map<String, Object>) list.get(i);
+			String ids = (String) map.get("ids");
+			String boxName = (String) map.get("boxName");
+			Integer boxNumber = (Integer) map.get("boxNumber");
+			if(ids == null || boxName == null || boxNumber == null){
+				continue;
+			}
+			baseMapper.updateArchiveFileByBoxNameOne(boxName,boxNumber);
+			baseMapper.updateArchiveFileByBoxName(Func.toLongList(ids),boxName,boxNumber);
+		}
+		return true;
 	}
 
 	@Override
-	public boolean IsBoxName(String boxName) {
-		Integer integer = this.baseMapper.IsBoxName(boxName);
+	public String isBoxName(String boxName) {
+		Integer integer = this.baseMapper.isBoxName(boxName);
 		if(integer > 0){
+			return boxName;
+		}
+		return "";
+	}
+
+	@Override
+	public List<Object> selectBoxNameAndBoxNumber(String nodeId) {
+		return this.baseMapper.selectBoxNameAndBoxNumber(nodeId);
+	}
+
+	@Override
+	public boolean updateArchiveFileByNodeId(String ids, String nodeId) {
+		try {
+			baseMapper.updateArchiveFileByNodeId(Func.toLongList(ids),nodeId);
+
+		} catch (Exception e) {
+			e.printStackTrace();
 			return false;
 		}
 		return true;
@@ -122,7 +153,7 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
 		IPage<ArchiveFileVO> iPage = Condition.getPage(query);
 
 		//汇总
-		Integer total = this.baseMapper.selectArchiveFileCount(vo);
+		Integer total = this.baseMapper.selectArchiveFilePageByBoxNameCount(vo);
 		if(total == null){
 			total = 0;
 		}