소스 검색

在线收集

“zhifk” 2 년 전
부모
커밋
2a12c86844

+ 11 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java

@@ -228,4 +228,15 @@ public class ArchiveFile extends BaseEntity {
 	 */
 	@ApiModelProperty("排序")
 	private Integer sort;
+	/**
+	 * 分盒名称
+	 */
+	@ApiModelProperty("分盒名称")
+	private String boxName;
+
+	/**
+	 * 分盒编号
+	 */
+	@ApiModelProperty("分盒编号")
+	private Integer boxNumber;
 }

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

@@ -7,6 +7,9 @@ import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
 
 
 /**
@@ -23,4 +26,16 @@ public interface ArchiveFileClient {
 
     @PostMapping(API_PREFIX + "/selectArchiveFilePage")
     JSONObject selectArchiveFilePage(@RequestBody ArchiveFileVO archiveFile);
+
+    @PostMapping(API_PREFIX + "/selectArchiveFilePageByBoxName")
+    JSONObject selectArchiveFilePageByBoxName(@RequestBody ArchiveFileVO archiveFile);
+
+    @PostMapping(API_PREFIX + "/updateArchiveFileSort")
+    void updateArchiveFileSort(@RequestBody ArchiveFileVO vo);
+
+    @PostMapping(API_PREFIX + "/updateArchiveFileByBoxName")
+    boolean updateArchiveFileByBoxName(@RequestParam List<Long> toLongList,@RequestParam String boxName,@RequestParam Integer boxNumber);
+
+    @PostMapping(API_PREFIX + "/IsBoxName")
+    boolean IsBoxName(@RequestParam String boxName);
 }

+ 54 - 7
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java

@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import org.springblade.business.entity.ArchiveFile;
@@ -17,6 +14,7 @@ import org.springblade.core.boot.ctrl.BladeController;
 
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.entity.ArchiveTree;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springblade.manager.feign.ArchiveTreeContractClient;
@@ -40,7 +38,7 @@ import java.util.stream.Collectors;
 @Api(value = "工程文件接口", tags = "工程文件接口")
 public class ArchiveFileController extends BladeController {
 
-	private final ArchiveFileClient archiveFileClient;
+    private final ArchiveFileClient archiveFileClient;
     private final IOSSClient iossClient;
     private final ArchiveTreeContractClient archiveTreeContractClient;
     /**
@@ -66,15 +64,19 @@ public class ArchiveFileController extends BladeController {
      * 批量新增
      */
     @PostMapping("/batchSave")
-    @ApiOperationSupport(order = 3)
+    @ApiOperationSupport(order = 2)
     @ApiOperation(value = "批量新增")
     public R<Boolean> batchSave(@RequestBody ArchiveFileVO vo){
         try {
+            int l =(int) System.currentTimeMillis();
             List<ArchiveFileVO> saveList = vo.getList();
             if(saveList != null && saveList.size() > 0){
+                int i = 1;
                 for(ArchiveFileVO saveVo : saveList){
+                    saveVo.setSort(l+i);
                     saveVo.setStatus(new Integer("0").equals(saveVo.getIsApproval()) ? 2 : 0);
                     saveVo.setIsCertification(new Integer("0").equals(saveVo.getIsNeedCertification()) ? 1 : 0);
+                    i++;
                 }
             }
             this.archiveFileClient.saveArchiveFile(vo);
@@ -88,7 +90,7 @@ public class ArchiveFileController extends BladeController {
      * 分页
      */
     @PostMapping("/page")
-    @ApiOperationSupport(order = 4)
+    @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<Object> page(ArchiveFileVO queryVo){
         if(queryVo.getNodeIds().isEmpty() || queryVo.getNodeIds().equals("")){
@@ -103,4 +105,49 @@ public class ArchiveFileController extends BladeController {
 
         return R.data(this.archiveFileClient.selectArchiveFilePage(queryVo));
     }
+    /**
+     * 排序
+     */
+    @PostMapping("/batchUpdateSort")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "排序")
+    public R<Boolean> batchUpdateSort(@RequestBody ArchiveFileVO vo){
+        try {
+            this.archiveFileClient.updateArchiveFileSort(vo);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.data(false);
+        }
+        return R.data(true);
+    }
+    /**
+     * 未分盒的显示
+     */
+    @PostMapping("/pageByBoxName")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "未分盒的显示")
+    public R<Object> pageByBoxName(ArchiveFileVO queryVo){
+        if(queryVo.getNodeIds().isEmpty() || queryVo.getNodeIds().equals("")){
+            return  R.data(null);
+        }
+        return R.data(this.archiveFileClient.selectArchiveFilePageByBoxName(queryVo));
+    }
+    /**
+     * 分盒盒号验证
+     */
+    @PostMapping("/getIsBoxName")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "分盒盒号验证", notes = "传入boxName")
+    public R getIsBoxName(@RequestParam String boxName) {
+        return R.status(this.archiveFileClient.IsBoxName(boxName));
+    }
+    /**
+     * 设置分盒
+     */
+    @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));
+    }
 }

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

@@ -8,6 +8,8 @@ import org.springblade.business.service.IArchiveFileService;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 
 @RestController
 @AllArgsConstructor
@@ -26,4 +28,23 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
         IPage<ArchiveFileVO> archiveFileVOIPage = this.iArchiveFileService.selectArchiveFilePage(archiveFile);
         return JSONObject.parseObject(JSONObject.toJSONString(archiveFileVOIPage));
     }
+    @Override
+    public JSONObject selectArchiveFilePageByBoxName(ArchiveFileVO archiveFile) {
+        IPage<ArchiveFileVO> archiveFileVOIPage = this.iArchiveFileService.selectArchiveFilePageByBoxName(archiveFile);
+        return JSONObject.parseObject(JSONObject.toJSONString(archiveFileVOIPage));
+    }
+    @Override
+    public void updateArchiveFileSort(ArchiveFileVO vo) {
+        this.iArchiveFileService.updateArchiveFileSort(vo.getList());
+    }
+
+    @Override
+    public boolean updateArchiveFileByBoxName(List<Long> toLongList, String boxName,Integer boxNumber) {
+        return  this.iArchiveFileService.updateArchiveFileByBoxName(toLongList,boxName,boxNumber);
+    }
+
+    @Override
+    public boolean IsBoxName(String boxName) {
+        return this.iArchiveFileService.IsBoxName(boxName);
+    }
 }

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

@@ -48,4 +48,13 @@ 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);
+
+	/**
+	 * 自定义分页
+	 */
+	List<ArchiveFile> selectArchiveFilePageByBoxName(@Param("current") Integer current, @Param("size") Integer size, @Param("vo") ArchiveFileVO vo);
+
 }

+ 59 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -46,6 +46,9 @@
         <result column="ftime" property="ftime"/>
         <result column="utime" property="utime"/>
         <result column="del_time" property="delTime"/>
+        <result column="sort" property="sort"/>
+        <result column="box_name" property="boxName"/>
+        <result column="box_number" property="boxNumber"/>
     </resultMap>
     <update id="recoveryByIds">
         update u_archive_file set is_deleted = 0 where
@@ -117,8 +120,52 @@
                 cite_change_number like concat('%',#{vo.queryValue},'%')
             )
         </if>
-        order by create_time DESC
+        order by 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 != ''">
+            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}
+            </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="getDeleteDataByIds" resultType="org.springblade.business.entity.ArchiveFile">
         select * from u_archive_file where id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -126,4 +173,15 @@
         </foreach>
     </select>
 
+    <select id="IsBoxName" resultType="java.lang.Integer">
+        select count(id) from u_archive_file where is_deleted = 0 and box_name =  #{boxName}
+    </select>
+
+    <update id="updateArchiveFileByBoxName" >
+        update u_archive_file set box_name = #{boxName},box_number = #{boxNumber} where
+        id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
 </mapper>

+ 10 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IArchiveFileService.java

@@ -36,6 +36,10 @@ public interface IArchiveFileService extends BaseService<ArchiveFile> {
 	 */
 	IPage<ArchiveFileVO> selectArchiveFilePage(ArchiveFileVO archiveFile);
 
+	/**
+	 * 自定义分页并且分盒
+	 */
+	IPage<ArchiveFileVO> selectArchiveFilePageByBoxName(ArchiveFileVO archiveFile);
 	/**
 	 * 恢复删除
 	 */
@@ -48,4 +52,10 @@ public interface IArchiveFileService extends BaseService<ArchiveFile> {
 
 
 	void saveArchiveFile(List<ArchiveFileVO> list);
+
+	void updateArchiveFileSort(List<ArchiveFileVO> list);
+
+	boolean updateArchiveFileByBoxName(List<Long> toLongList, String boxName,Integer boxNumber);
+
+	boolean IsBoxName(String boxName);
 }

+ 43 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java

@@ -93,4 +93,47 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
 		this.saveBatch(JSONArray.parseArray(JSONObject.toJSONString(list), ArchiveFile.class));
 	}
 
+	@Override
+	public void updateArchiveFileSort(List<ArchiveFileVO> list) {
+
+		this.updateBatchById(JSONArray.parseArray(JSONObject.toJSONString(list), ArchiveFile.class));
+	}
+
+	@Override
+	public boolean updateArchiveFileByBoxName(List<Long> ids, String boxName,Integer boxNumber) {
+		return baseMapper.updateArchiveFileByBoxName(ids,boxName,boxNumber);
+	}
+
+	@Override
+	public boolean IsBoxName(String boxName) {
+		Integer integer = this.baseMapper.IsBoxName(boxName);
+		if(integer > 0){
+			return false;
+		}
+		return true;
+	}
+
+	@Override
+	public IPage<ArchiveFileVO> selectArchiveFilePageByBoxName(ArchiveFileVO vo) {
+		Query query = new Query();
+		query.setCurrent(vo.getCurrent());
+		query.setSize(vo.getSize());
+		//设置分页
+		IPage<ArchiveFileVO> iPage = Condition.getPage(query);
+
+		//汇总
+		Integer total = this.baseMapper.selectArchiveFileCount(vo);
+		if(total == null){
+			total = 0;
+		}
+		//分页
+		int current = (vo.getCurrent() - 1) * vo.getSize();
+
+		List<ArchiveFile> pageList = this.baseMapper.selectArchiveFilePageByBoxName(current, vo.getSize(), vo);
+		//设置分页信息
+		iPage.setTotal(total);
+		List<ArchiveFileVO> pageVoList = JSONArray.parseArray(JSONObject.toJSONString(pageList), ArchiveFileVO.class);
+
+		return iPage.setRecords(pageVoList);
+	}
 }