Explorar el Código

Merge remote-tracking branch 'origin/master'

liuyc hace 1 año
padre
commit
259b59413b

+ 4 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/InspectionRectify.java

@@ -19,9 +19,12 @@ import java.time.LocalDate;
 @EqualsAndHashCode(callSuper = true)
 public class InspectionRectify extends BaseEntity {
 
-    @ApiModelProperty(value = "项目名称")
+    @ApiModelProperty(value = "项目id")
     private Long projectId;
 
+    @ApiModelProperty(value = "合同id")
+    private Long contractId;
+
     @ApiModelProperty(value = "巡检id")
     private Long inspectId;
 

+ 5 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/RoutingInspection.java

@@ -20,16 +20,19 @@ import java.time.LocalDateTime;
 @EqualsAndHashCode(callSuper = true)
 public class RoutingInspection extends BaseEntity {
 
-    @ApiModelProperty(value = "项目名称")
+    @ApiModelProperty(value = "项目id")
     private Long projectId;
 
+    @ApiModelProperty(value = "合同id")
+    private Long contractId;
+
     @ApiModelProperty(value = "检查名称")
     private String inspectName;
 
     @ApiModelProperty(value = "巡检类别 1安全巡检2质量巡检")
     private Integer inspectType;
 
-    @ApiModelProperty(value = "是否需要整改 1需要2不需要")
+    @ApiModelProperty(value = "是否需要整改 1需要2不需要3已整改")
     private Integer isRectify;
 
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/RoutingInspectionVO.java

@@ -25,4 +25,7 @@ public class RoutingInspectionVO extends RoutingInspection {
 
     @ApiModelProperty(value = "是否需要整改名称")
     private String isRectifyName;
+
+    @ApiModelProperty(value = "整改人是否当前用户,0否1是")
+    private Integer isRectifyUser;
 }

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

@@ -523,10 +523,43 @@ public class ArchivesAutoController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "刷新项目档案", notes = "传入projectId,contractId")
 	public R<String> refreshProjectArchive(@RequestParam Long projectId, @RequestParam Long contractId,@RequestParam Long nodeId) {
+		try{
+
+			ContractInfo contract = contractClient.getContractById(contractId);
+
+			Integer isArchivesAuto = contract.getIsArchivesAuto();
+			if(isArchivesAuto!=-1 && isArchivesAuto!=null && isArchivesAuto!=0){
+				return R.fail("当前合同段已经在自动组卷中,请耐心等待");
+			}
+			log.info("开始刷新档号....");
+			//设置自动组卷中
+			contractClient.updateIsArchivesAutoById(contractId,1);
+
+			archivesAutoService.refreshFileNumberThread(projectId,contractId,nodeId);
+			return R.success("开始刷新档号中,请耐心等待");
+		}catch (Exception e){
+			e.printStackTrace();
+			log.error("刷新档。"+e.getMessage()+"--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
+			//设置自动组卷结束
+			contractClient.updateIsArchivesAutoById(contractId,0);
+			return R.fail(e.getMessage());
+		}
+	}
+
+	/**
+	 * 刷新指定项目的档案
+	 * @param projectId 项目id
+	 * @return R
+	 */
+	@PostMapping("/refreshFileNumber1")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "刷新项目档案", notes = "传入projectId,contractId")
+	public R<String> refreshProjectArchive1(@RequestParam Long projectId, @RequestParam Long contractId,@RequestParam Long nodeId) {
 		archivesAutoService.refreshFileNumberNoSlipt(projectId,contractId,null,false);
 		return R.data("刷新成功");
 	}
 
+
 	/**
 	 * 批量编辑
 	 */

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

@@ -88,6 +88,8 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
 
 	void archiveAutoMethodThread(Long projectId, Long contractId, Long nodeId);
 
+	void refreshFileNumberThread(Long projectId, Long contractId, Long nodeId);
+
 	List<User> getArchiveDestroyUser(Long projectId);
 
 	List<Map<String, List<Map<String, String>>>> getArchivesCabinet(ArchivesAutoVO archivesAuto);

+ 26 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -2145,6 +2145,32 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		});
 	}
 
+
+	@Override
+	public void refreshFileNumberThread(Long projectId, Long contractId, Long nodeId) {
+		executorService.execute(()->{
+			try{
+				//将项目未锁定案卷拆卷
+				log.info("[自动组卷]{}","开始对未锁定案卷拆卷。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
+
+				//设置完成度10%
+				contractClient.updateIsArchivesAutoById(contractId,10);
+
+				//项目自动组卷入口
+				this.refreshFileNumberNoSlipt(projectId,contractId,null,false);
+
+				//设置自动组卷结束
+				contractClient.updateIsArchivesAutoById(contractId,0);
+				log.info("[自动组卷]{}","自动组卷完成。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
+			}catch (Exception e){
+				e.printStackTrace();
+				log.error("自动组卷报错。"+e.getMessage()+"--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
+				//设置自动组卷结束
+				contractClient.updateIsArchivesAutoById(contractId, 0);
+			}
+		});
+	}
+
 	@Override
 	public List<User> getArchiveDestroyUser(Long projectId) {
 		return autoMapper.getArchiveDestroyUser(projectId);

+ 5 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/RoutingInspectionMapper.xml

@@ -8,13 +8,15 @@
                (select dict_value from blade_dict where code = 'inspect_type' and dict_key = mri.inspect_type) as inspectTypeName,
                (select dict_value from blade_dict where code = 'review_inspect_status' and dict_key = mri.review_inspect_status) as reviewInspectStatusName,
                case mri.is_rectify
-                   when 1 then '未开始'
-                   when 2 then '进行中'
+                   when 1 then '需要'
+                   when 2 then '不需要'
+                   when 3 then '已整改'
                    end as isRectifyName
         from m_routing_inspection mri
-        where mri.is_deleted = 0 and mri.project_id = #{inspection.projectId}
+        where mri.is_deleted = 0 and mri.project_id = #{inspection.projectId} and contract_id = #{inspection.contractId}
         <if test="inspection.isRectify != null and inspection.isRectify != ''">
             and mri.is_rectify = #{inspection.isRectify}
         </if>
+        order by mri.create_time desc
     </select>
 </mapper>

+ 15 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/RoutingInspectionServiceImpl.java

@@ -54,6 +54,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
         RoutingInspection inspection = new RoutingInspection();
         BeanUtils.copyProperties(dto,inspection);
         inspection.setId(id);
+        inspection.setCreateTime(new Date());
         this.save(inspection);
         //再保存具体的巡检项目
         List<InspectionRectify> list1 = list.stream().map(l -> {
@@ -96,6 +97,19 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
     public IPage<RoutingInspectionVO> page(Query query, RoutingInspection inspection) {
         IPage<RoutingInspectionVO> iPage = new Page<>(query.getCurrent(), query.getSize());
         baseMapper.page(iPage,inspection);
+        //设置权限,只能整改人可以点
+        Long userId = AuthUtil.getUserId();
+        List<RoutingInspectionVO> records = iPage.getRecords();
+        for (RoutingInspectionVO record : records) {
+            String rectifyUser = record.getRectifyUser();
+            String[] split = rectifyUser.split("-");
+            Long user = Long.parseLong(split[split.length-1]);
+            if (userId.equals(user)){
+                record.setIsRectifyUser(1);
+            }else {
+                record.setIsRectifyUser(0);
+            }
+        }
         return iPage;
     }
 
@@ -134,7 +148,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
             //复检通过,修改复检状态为3通过,修改整改状态为2不用整改
             this.update(new LambdaUpdateWrapper<RoutingInspection>()
                     .set(RoutingInspection::getReviewInspectStatus,3)
-                    .set(RoutingInspection::getIsRectify,2)
+                    .set(RoutingInspection::getIsRectify,3)
                     .eq(RoutingInspection::getId,id));
         }else {
             throw new ServiceException("参数错误");