|
|
|
@ -74,6 +74,7 @@ import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant.FIRST_TICKET_KEY; |
|
|
|
|
import static com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant.MACHINERY_TICKET_KEY; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -191,7 +192,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
} |
|
|
|
|
signage = signage.length() == 2 ? station.getSignage() : station.getSignage().substring(0, 2); |
|
|
|
|
|
|
|
|
|
workTicketVo.getWorkTicket().setSignage(signage); |
|
|
|
|
workTicketVo.getWorkTicket().setSignage(station.getSignage()); |
|
|
|
|
workTicketVo.getWorkTicket().setSignageCode(station.getCode()); |
|
|
|
|
//2. 获取编码
|
|
|
|
|
String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), this.getTicketWichCode(workTicketVo.getWorkTicket().getType()), |
|
|
|
@ -204,7 +205,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
//5. 保存工作任务
|
|
|
|
|
this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); |
|
|
|
|
//6. 查询第一种工作票值
|
|
|
|
|
String dictValue = processDictService.selectDictValueByKey(FIRST_TICKET_KEY); |
|
|
|
|
String dictValue = getDictValue(workTicketVo); |
|
|
|
|
//7. 开启动作流
|
|
|
|
|
this.dealProcess(dictValue, workTicketVo); |
|
|
|
|
//8. 处理任务
|
|
|
|
@ -213,6 +214,23 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 验证是走那种工作票流程,默认走第一种工作票 |
|
|
|
|
* |
|
|
|
|
* @param workTicketVo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private String getDictValue(WorkTicketVo workTicketVo) { |
|
|
|
|
String key = FIRST_TICKET_KEY; |
|
|
|
|
if ("6".equals(workTicketVo.getWorkTicket().getType()) || "7".equals(workTicketVo.getWorkTicket().getType())) { |
|
|
|
|
key = FIRST_TICKET_KEY; |
|
|
|
|
} else if ("8".equals(workTicketVo.getWorkTicket().getType())) { |
|
|
|
|
key = MACHINERY_TICKET_KEY; |
|
|
|
|
} |
|
|
|
|
String dictValue = processDictService.selectDictValueByKey(key); |
|
|
|
|
return dictValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 待处理 |
|
|
|
|
* |
|
|
|
|
* @param response |
|
|
|
@ -339,7 +357,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//工作开始时间和结束时间
|
|
|
|
|
// 工作开始时间和结束时间
|
|
|
|
|
// List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) {
|
|
|
|
|
// log.info("工作开始时间和结束时间:{}", workTicketFinish);
|
|
|
|
@ -438,7 +456,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
message.setPusherName(user.getName()); |
|
|
|
|
} |
|
|
|
|
message.setAccount(userId); |
|
|
|
|
|
|
|
|
|
message.setCreateUser(NumberUtils.toLong(userId)); |
|
|
|
|
messageClient.sendMessage(message); |
|
|
|
|
log.info("推送消息成功,用户名称{},消息{}", user.getName(), message); |
|
|
|
@ -476,18 +493,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
} |
|
|
|
|
//如果response.getHandleType() 是1使角色
|
|
|
|
|
if ("1".equals(response.getHandleType())) { |
|
|
|
|
//根据角色别名获取用户信息
|
|
|
|
|
// try {
|
|
|
|
|
// R<List<User>> roleAlias = userClient.relationUserListByRoleAlias(workTicket.getTenantId(), workTicket.getCreateDept(), response.getNextStepOperator());
|
|
|
|
|
// String collect = roleAlias.getData().stream().map(item -> item.getName()).collect(Collectors.joining(","));
|
|
|
|
|
// flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(collect).concat("审批");
|
|
|
|
|
// workTicket.setNextStepOperator(collect);
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// log.error("R<List<User>> roleAlias = userClient.userListByRoleAlias(workTicket.getTenantId(), response.getNextStepOperator())");
|
|
|
|
|
// log.error("获取用户信息失败");
|
|
|
|
|
// workTicket.setNextStepOperator(null);
|
|
|
|
|
// }
|
|
|
|
|
workTicket.setFlowUserId(response.getUserId()); |
|
|
|
|
workTicket.setNextStepOperator(response.getNextStepOperator()); |
|
|
|
|
flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(response.getNextStepOperator()).concat("审批"); |
|
|
|
@ -497,7 +502,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
String taskId = response.getTaskId(); |
|
|
|
|
if (StringUtils.isEmpty(taskId)) { |
|
|
|
|
workTicket.setFlowDescription("结束"); |
|
|
|
|
// workTicket.setFlowTaskId(" ");
|
|
|
|
|
workTicket.setFlowTaskName("结束"); |
|
|
|
|
workTicket.setNextStepOperator(" "); |
|
|
|
|
workTicket.setStepOperator(" "); |
|
|
|
@ -507,6 +511,27 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
workTicket.setFlowTaskName(response.getTaskName()); |
|
|
|
|
workTicket.setFlowDescription(flowDescription); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//如果签发人为false
|
|
|
|
|
if (workTicket.getSignFlag() != null) { |
|
|
|
|
if (!workTicket.getSignFlag()) { |
|
|
|
|
workTicket.setFlowDescription("作废"); |
|
|
|
|
workTicket.setFlowTaskName("作废"); |
|
|
|
|
workTicket.setNextStepOperator(" "); |
|
|
|
|
workTicket.setStepOperator(" "); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//运行人员false
|
|
|
|
|
if (workTicket.getRecieveFlag() != null) { |
|
|
|
|
if (!workTicket.getRecieveFlag()) { |
|
|
|
|
workTicket.setFlowDescription("作废"); |
|
|
|
|
workTicket.setFlowTaskName("作废"); |
|
|
|
|
workTicket.setNextStepOperator(" "); |
|
|
|
|
workTicket.setStepOperator(" "); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -606,6 +631,9 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
// }
|
|
|
|
|
Map<String, Object> params = new HashMap<>(4); |
|
|
|
|
params.put("workTicketVo", workTicketVo); |
|
|
|
|
if ("8".equals(workTicketVo.getWorkTicket().getType())) { |
|
|
|
|
params.put("principal", "taskUser_" + workTicketVo.getWorkTicket().getPrincipal()); |
|
|
|
|
} |
|
|
|
|
//已开启流程
|
|
|
|
|
R<BladeFlow> processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(newFirstWorkTicketFlowKey, String.valueOf(workTicketVo.getWorkTicket().getId()), workTicketVo.getWorkTicket().getWorkContent(), params); |
|
|
|
|
log.info("processInstanceContainNameByKey.isSuccess() : {}", processInstanceContainNameByKey.isSuccess()); |
|
|
|
@ -771,14 +799,14 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
} |
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
|
|
if ((workTicket.getIsSafety() == null && workTicket.getIsHazard() == null && workTicket.getIsLimited() == null && workTicket.getIsRailway() == null) |
|
|
|
|
|| (workTicket.getIsSafety() == null || workTicket.getIsHazard() == null || workTicket.getIsLimited() == null || workTicket.getIsRailway() == null)) { |
|
|
|
|
if (workTicket.getIsSafety() == null && workTicket.getIsHazard() == null && workTicket.getIsLimited() == null && workTicket.getIsRailway() == null |
|
|
|
|
&& workTicket.getIsStart() == null) { |
|
|
|
|
extractedWithWord(response, resultMap, status); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//如果4个多为false 或为空 附件不展示附件
|
|
|
|
|
if (!workTicket.getIsSafety() && !workTicket.getIsHazard() && !workTicket.getIsLimited() && !workTicket.getIsRailway()) { |
|
|
|
|
if (!workTicket.getIsSafety() && !workTicket.getIsHazard() && !workTicket.getIsLimited() && !workTicket.getIsRailway() && !workTicket.getIsStart()) { |
|
|
|
|
extractedWithWord(response, resultMap, status); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -801,22 +829,22 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
//安全隔离措施附页 (true,展示附件,false,不展示附件)
|
|
|
|
|
if (workTicket.getIsSafety()) { |
|
|
|
|
addFile(prefix, TicketConstant.SECURE_PAGE, docFileList); |
|
|
|
|
// setWorkTicketPrincipalChange(docFileList);
|
|
|
|
|
} |
|
|
|
|
//危险点分析与预控措施票 (true,展示附件,false,不展示附件)
|
|
|
|
|
if (workTicket.getIsSafety()) { |
|
|
|
|
addFile(prefix, TicketConstant.SAFETY_PAGE, docFileList); |
|
|
|
|
// setWorkTicketHazardPointChange(docFileList);
|
|
|
|
|
} |
|
|
|
|
//动火工作票 (true,展示附件,false,不展示附件)
|
|
|
|
|
if (workTicket.getIsRailway()) { |
|
|
|
|
addFile(prefix, TicketConstant.FLIGHT_PAGE, docFileList); |
|
|
|
|
// setWorkTicketRailwayChange(docFileList);
|
|
|
|
|
} |
|
|
|
|
//有限空间监测记录单(true,展示附件,false,不展示附件)
|
|
|
|
|
if (workTicket.getIsLimited()) { |
|
|
|
|
addFile(prefix, TicketConstant.SPACE_PAGE, docFileList); |
|
|
|
|
// setWorkTicketLimitedChange(docFileList);
|
|
|
|
|
} |
|
|
|
|
//每日开工和收工时间附页
|
|
|
|
|
if (workTicket.getIsStart()) { |
|
|
|
|
addFile(prefix, TicketConstant.START_PAGE, docFileList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String name = LocalDate.now() + "-" + UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
|
@ -832,11 +860,11 @@ public class TicketProcessServiceImpl implements TicketProcessService {
|
|
|
|
|
log.info("输出word路径:{}", docPath); |
|
|
|
|
|
|
|
|
|
//第一种工作票
|
|
|
|
|
resultMap.put("one", status == 1 ? "☑":"□"); |
|
|
|
|
resultMap.put("one", status == 1 ? "☑" : "□"); |
|
|
|
|
//第二种工作票
|
|
|
|
|
resultMap.put("two", status == 2 ? "☑":"□"); |
|
|
|
|
resultMap.put("two", status == 2 ? "☑" : "□"); |
|
|
|
|
//水力机器工作票
|
|
|
|
|
resultMap.put("three", status == 3 ? "☑":"□"); |
|
|
|
|
resultMap.put("three", status == 3 ? "☑" : "□"); |
|
|
|
|
//导入文档
|
|
|
|
|
File file = new File(docPath); |
|
|
|
|
MergeDocUtils.mergeDoc(docFileList, file); |
|
|
|
|