Browse Source

#检修流程

zhongwei
yang_shj 1 year ago
parent
commit
1052a8afde
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessTaskEntity.java
  2. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessTaskV4Controller.java
  4. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDetailDTO.java
  5. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  6. 35
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  7. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DangerSourceController.java
  8. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IDangerSourceService.java
  9. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessTaskEntity.java

@ -160,4 +160,10 @@ public class OperAccessTaskEntity extends TenantEntity {
private YearMonth yearMonth;
@ApiModelProperty("当前步骤任务名称")
private String taskName;
@ApiModelProperty("当前环节处理人")
private String nextStepOperator;
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java

@ -5,14 +5,12 @@ import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.operational.access.feign.IAccessPlanV4Client;
import com.hnac.hzims.operational.defect.feign.IOperDefectClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.DEFECT_KEY;
import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OVERHAUL_PLAN;
/**

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessV4Controller.java → hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessTaskV4Controller.java

@ -14,6 +14,6 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor
@RequestMapping("/overhaul_task")
@Api(tags = "v4检修计划流程")
public class AccessV4Controller extends BladeController {
public class AccessTaskV4Controller extends BladeController {
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDetailDTO.java

@ -1,9 +1,8 @@
package com.hnac.hzims.operational.access.dto;
import io.swagger.annotations.ApiModelProperty;
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity;
/**
* 模型DTO

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.access.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -179,12 +178,12 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
entity.setTaskName("流程结束");
entity.setNextStepOperator("流程结束,无需人员处理");
entity.setActEndTime(new Date());
// 开启检修任务
this.startTaskProcess(entity);
}
this.planService.updateById(entity);
this.saveAccessMaterial(entity);
this.saveAccessContent(entity);
// 开启检修任务
this.startTaskProcess(entity);
return true;
}
@ -196,6 +195,7 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
for(OperAccessContentDTO item : entity.getAccessContents()){
//任务参数
AccessTaskV4DTO task = BeanUtil.copy(item, AccessTaskV4DTO.class);
task.setId(null);
task.setCreateTime(new Date());
task.setCreateUser(entity.getCreateUser());
task.setProcDefId(entity.getProcDefId());

35
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.access.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO;
@ -29,10 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -78,8 +76,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
* @param entity
*/
private void startProcess(AccessTaskV4DTO entity) {
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONString(entity), Map.class);
variables.put("handler",TaskUtil.getTaskUser(entity.getHandler().toString()));
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class);
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);
// 更新任务流程Id
if (result.isSuccess()) {
@ -110,8 +108,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
return;
}
materialService.saveOrUpdateBatch(entity.getAccessMaterials().stream().peek(material -> {
material.setPlanId(null);
material.setId(null);
material.setPlanId(entity.getPlanId());
material.setTaskId(entity.getId());
}).collect(Collectors.toList()));
}
@ -154,7 +152,26 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
*/
@Override
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;
}
}

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DangerSourceController.java

@ -21,6 +21,8 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @author xiashandong
@ -89,6 +91,16 @@ public class DangerSourceController extends BladeController {
}
/**
* 根据ID查询危险源
*/
@GetMapping("/safes")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "查询危险源", notes = "传入safeInfos")
public R<List<DangerSourceEntity>> safes(@RequestParam String safeInfos) {
return R.data(dangerSourceService.safes(safeInfos));
}
/**
* 导入数据
*/
@ApiOperation(value = "导入Excel")

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IDangerSourceService.java

@ -39,4 +39,6 @@ public interface IDangerSourceService extends BaseService<DangerSourceEntity> {
List<SourceVO> listByTenantId(String tenantId);
List<CreateTableVO> getSafeCreateTable(List<String> tableNames);
List<DangerSourceEntity> safes(String safeInfos);
}

22
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java

@ -31,6 +31,7 @@ import com.hnac.hzims.safeproduct.wrapper.DangerSourceWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang.ArrayUtils;
import org.springblade.core.excel.support.ExcelException;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -46,17 +47,16 @@ import org.springblade.system.vo.CreateTableVO;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* @author xiashandong
@ -308,6 +308,20 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper,
}
@Override
public List<DangerSourceEntity> safes(String safeInfos) {
if(StringUtil.isEmpty(safeInfos)){
return new ArrayList<>();
}
List<DangerSourceEntity> sources = this.listByIds(Arrays.asList(safeInfos.split(",")));
//未查到数据返回空集合
if (CollectionUtils.isEmpty(sources)) {
return new ArrayList<>();
}
//查到数据则将数据排序后再返回
return sources.stream().sorted(Comparator.comparing(DangerSourceEntity::getId)).collect(Collectors.toList());
}
@Override
public List<SourceVO> listByTenantId(String tenantId) {
return this.baseMapper.listByTenantId(tenantId);
}

Loading…
Cancel
Save