| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -2,6 +2,7 @@ package com.hnac.hzims.operational.access.service.impl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSONObject; | 
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.JSONObject; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.alibaba.fastjson.TypeReference; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -29,10 +30,7 @@ import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
					 | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.text.DecimalFormat; | 
					 | 
					 | 
					 | 
					import java.text.DecimalFormat; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.List; | 
					 | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.Map; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.Objects; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.Set; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
					 | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -78,8 +76,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param entity | 
					 | 
					 | 
					 | 
					     * @param entity | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void startProcess(AccessTaskV4DTO entity) { | 
					 | 
					 | 
					 | 
					    private void startProcess(AccessTaskV4DTO entity) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONString(entity), Map.class); | 
					 | 
					 | 
					 | 
					        Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        variables.put("handler",TaskUtil.getTaskUser(entity.getHandler().toString())); | 
					 | 
					 | 
					 | 
					        variables.put("solve",TaskUtil.getTaskUser(entity.getHandler().toString())); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey("overhaul_task", FlowUtil.getBusinessKey("access_task_v4", String.valueOf(entity.getId())), entity.getName(),variables); | 
					 | 
					 | 
					 | 
					        R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey("overhaul_task", FlowUtil.getBusinessKey("access_task_v4", String.valueOf(entity.getId())), entity.getName(),variables); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 更新任务流程Id
 | 
					 | 
					 | 
					 | 
					        // 更新任务流程Id
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (result.isSuccess()) { | 
					 | 
					 | 
					 | 
					        if (result.isSuccess()) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -110,8 +108,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					           return; | 
					 | 
					 | 
					 | 
					           return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        materialService.saveOrUpdateBatch(entity.getAccessMaterials().stream().peek(material -> { | 
					 | 
					 | 
					 | 
					        materialService.saveOrUpdateBatch(entity.getAccessMaterials().stream().peek(material -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            material.setPlanId(null); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            material.setId(null); | 
					 | 
					 | 
					 | 
					            material.setId(null); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            material.setPlanId(entity.getPlanId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            material.setTaskId(entity.getId()); | 
					 | 
					 | 
					 | 
					            material.setTaskId(entity.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }).collect(Collectors.toList())); | 
					 | 
					 | 
					 | 
					        }).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -154,7 +152,26 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { | 
					 | 
					 | 
					 | 
					    public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        // 对象转换
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return false; | 
					 | 
					 | 
					 | 
					        Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        AccessTaskV4DTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<AccessTaskV4DTO>(){}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 当前流程名称
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        entity.setTaskName(processWorkFlowResponse.getTaskName()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 流程阶段执行人员名称
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setTaskName("流程结束"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setNextStepOperator("流程结束,无需人员处理"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setActEndTime(new Date()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 更新任务数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            this.taskService.updateById(entity); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }else if(ObjectUtil.isNotEmpty(variables.get("examine")) && !(Boolean) variables.get("examine")){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return this.taskService.updateById(entity); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 保存检修材料
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        this.saveMaterial(entity); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 保存检修详情
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        this.saveDetails(entity); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} |