|
|
@ -59,6 +59,7 @@ import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -202,6 +203,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
log.info("获取businessKey: {}", response.getBusinessKey()); |
|
|
|
log.info("获取businessKey: {}", response.getBusinessKey()); |
|
|
|
log.info("获取taskId: {}", response.getTaskId()); |
|
|
|
log.info("获取taskId: {}", response.getTaskId()); |
|
|
|
log.info("获取下一个审批人是: {}", response.getNextStepOperator()); |
|
|
|
log.info("获取下一个审批人是: {}", response.getNextStepOperator()); |
|
|
|
|
|
|
|
log.info("获取下一个用户Id是: {}", response.getUserId()); |
|
|
|
log.info("获取当前任务名称是: {}", response.getTaskName()); |
|
|
|
log.info("获取当前任务名称是: {}", response.getTaskName()); |
|
|
|
log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType()); |
|
|
|
log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType()); |
|
|
|
//json转换表单
|
|
|
|
//json转换表单
|
|
|
@ -222,22 +224,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
WorkTicketInfoEntity workTicketInfo = ticketInfoService.getById(businessKey); |
|
|
|
WorkTicketInfoEntity workTicketInfo = ticketInfoService.getById(businessKey); |
|
|
|
if (ObjectUtils.isEmpty(workTicketInfo)) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketInfo)) { |
|
|
|
log.error("获取工作票的数据为不存在"); |
|
|
|
log.error("获取工作票的数据为不存在"); |
|
|
|
int num = response.getNum(); |
|
|
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
if (num == 0) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
//睡眠2秒防止cpu飚高
|
|
|
|
|
|
|
|
Thread.sleep(2000); |
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("进入重试机制 {}", response); |
|
|
|
|
|
|
|
num--; |
|
|
|
|
|
|
|
response.setNum(num); |
|
|
|
|
|
|
|
findPending(response); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
@ -258,12 +244,10 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
log.info("获取安全措施的数据:{}", safetyMeasuresList); |
|
|
|
log.info("获取安全措施的数据:{}", safetyMeasuresList); |
|
|
|
safetyMeasuresList.forEach(item -> { |
|
|
|
safetyMeasuresList.forEach(item -> { |
|
|
|
if (ObjectUtils.isEmpty(item.getId())) { |
|
|
|
if (ObjectUtils.isNotEmpty(item.getTicketId())) { |
|
|
|
LambdaQueryWrapper<WorkTicketSafetyMeasureEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
LambdaQueryWrapper<WorkTicketSafetyMeasureEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId, workTicketInfo.getId()); |
|
|
|
queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId, item.getTicketId()); |
|
|
|
workTicketSafetyMeasureService.update(item, queryWrapper); |
|
|
|
workTicketSafetyMeasureService.update(item, queryWrapper); |
|
|
|
} else { |
|
|
|
|
|
|
|
workTicketSafetyMeasureService.updateById(item); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -364,10 +348,18 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
|
|
|
|
|
|
|
|
//工作票危险点分析及控制措施票
|
|
|
|
//工作票危险点分析及控制措施票
|
|
|
|
try { |
|
|
|
try { |
|
|
|
if (workTicketInfo.getIsHazard()) { |
|
|
|
if (workTicket.getIsHazard()) { |
|
|
|
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers(); |
|
|
|
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers(); |
|
|
|
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { |
|
|
|
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { |
|
|
|
ticketInfoDangerService.saveBatch(ticketInfoDangers); |
|
|
|
List<TicketInfoDanger> collect = ticketInfoDangers.stream().map(item -> { |
|
|
|
|
|
|
|
item.setTicketId(workTicketInfo.getId()); |
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("工作票危险点分析及控制措施票 : " + collect); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ticketInfoDangerService.saveBatch(collect); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
@ -383,14 +375,10 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
* @param response |
|
|
|
* @param response |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void saveWorkTicket(WorkTicketInfoEntity workTicket, ProcessWorkFlowResponse response) { |
|
|
|
private void saveWorkTicket(WorkTicketInfoEntity workTicket, ProcessWorkFlowResponse response) { |
|
|
|
String taskId = response.getTaskId(); |
|
|
|
|
|
|
|
workTicket.setFlowTaskId(taskId); |
|
|
|
|
|
|
|
workTicket.setFlowTaskName(response.getTaskName()); |
|
|
|
|
|
|
|
String nextStepOperator = response.getNextStepOperator(); |
|
|
|
|
|
|
|
String flowDescription = ""; |
|
|
|
String flowDescription = ""; |
|
|
|
Integer flowStatus = workTicket.getFlowStatus(); |
|
|
|
//如果response.getHandleType() 是0使用户
|
|
|
|
|
|
|
|
|
|
|
|
if ("0".equals(response.getHandleType())) { |
|
|
|
if ("0".equals(response.getHandleType())) { |
|
|
|
|
|
|
|
String nextStepOperator = response.getNextStepOperator(); |
|
|
|
Long taskUser = NumberUtils.createLong(nextStepOperator.startsWith("taskUser_") ? nextStepOperator.substring(9) : null); |
|
|
|
Long taskUser = NumberUtils.createLong(nextStepOperator.startsWith("taskUser_") ? nextStepOperator.substring(9) : null); |
|
|
|
if (taskUser != null) { |
|
|
|
if (taskUser != null) { |
|
|
|
//下一个审批人
|
|
|
|
//下一个审批人
|
|
|
@ -399,47 +387,40 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(stepUser.getName()).concat("审批"); |
|
|
|
flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(stepUser.getName()).concat("审批"); |
|
|
|
workTicket.setNextStepOperator(stepUser.getName()); |
|
|
|
workTicket.setNextStepOperator(stepUser.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
workTicket.setNextStepOperator(null); |
|
|
|
workTicket.setNextStepOperator(null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//如果response.getHandleType() 是1使角色
|
|
|
|
if ("1".equals(response.getHandleType())) { |
|
|
|
if ("1".equals(response.getHandleType())) { |
|
|
|
|
|
|
|
|
|
|
|
log.info("获取角色信息" + response.getNextStepOperator()); |
|
|
|
|
|
|
|
//根据角色别名获取用户信息
|
|
|
|
//根据角色别名获取用户信息
|
|
|
|
try { |
|
|
|
// try {
|
|
|
|
R<List<User>> roleAlias = userClient.relationUserListByRoleAlias(workTicket.getTenantId(), workTicket.getCreateDept(), response.getNextStepOperator()); |
|
|
|
// R<List<User>> roleAlias = userClient.relationUserListByRoleAlias(workTicket.getTenantId(), workTicket.getCreateDept(), response.getNextStepOperator());
|
|
|
|
String collect = roleAlias.getData().stream().map(item -> item.getName()).collect(Collectors.joining(",")); |
|
|
|
// String collect = roleAlias.getData().stream().map(item -> item.getName()).collect(Collectors.joining(","));
|
|
|
|
flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(collect).concat("审批"); |
|
|
|
// flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(collect).concat("审批");
|
|
|
|
workTicket.setNextStepOperator(collect); |
|
|
|
// workTicket.setNextStepOperator(collect);
|
|
|
|
} catch (Exception e) { |
|
|
|
// } catch (Exception e) {
|
|
|
|
e.printStackTrace(); |
|
|
|
// e.printStackTrace();
|
|
|
|
log.error("R<List<User>> roleAlias = userClient.userListByRoleAlias(workTicket.getTenantId(), response.getNextStepOperator())"); |
|
|
|
// log.error("R<List<User>> roleAlias = userClient.userListByRoleAlias(workTicket.getTenantId(), response.getNextStepOperator())");
|
|
|
|
log.error("获取用户信息失败"); |
|
|
|
// log.error("获取用户信息失败");
|
|
|
|
workTicket.setNextStepOperator(null); |
|
|
|
// workTicket.setNextStepOperator(null);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
workTicket.setNextStepOperator(response.getNextStepOperator()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//如果taskId为空 或 flowStatus = 99
|
|
|
|
//如果taskId为空
|
|
|
|
if (StringUtils.isEmpty(taskId) || 99 == flowStatus) { |
|
|
|
String taskId = response.getTaskId(); |
|
|
|
flowDescription = "结束"; |
|
|
|
if (StringUtils.isEmpty(taskId)) { |
|
|
|
workTicket.setFlowDescription(flowDescription); |
|
|
|
workTicket.setFlowDescription("结束"); |
|
|
|
workTicket.setFlowTaskId(""); |
|
|
|
workTicket.setFlowTaskId(" "); |
|
|
|
workTicket.setFlowTaskName("结束"); |
|
|
|
workTicket.setFlowTaskName("结束"); |
|
|
|
workTicket.setNextStepOperator(null); |
|
|
|
workTicket.setNextStepOperator(" "); |
|
|
|
workTicket.setStepOperator(null); |
|
|
|
workTicket.setStepOperator(" "); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
workTicket.setFlowTaskId(taskId); |
|
|
|
|
|
|
|
workTicket.setFlowTaskName(response.getTaskName()); |
|
|
|
workTicket.setFlowDescription(flowDescription); |
|
|
|
workTicket.setFlowDescription(flowDescription); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//如果下一个审批人【nextStepOperator】是null设为-1
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(nextStepOperator)) { |
|
|
|
|
|
|
|
workTicket.setNextStepOperator(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("workTicket = " + workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -700,7 +681,8 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
} |
|
|
|
} |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
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.getIsSafety() == null || workTicket.getIsHazard() == null || workTicket.getIsLimited() == null || workTicket.getIsRailway() == null)) { |
|
|
|
extractedWithWord(response, workTicketInfoMap); |
|
|
|
extractedWithWord(response, workTicketInfoMap); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -711,24 +693,59 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
List<File> docFileList = new ArrayList<>(); |
|
|
|
List<File> docFileList = new ArrayList<>(); |
|
|
|
docFileList.add(new File("template/电气第一种工作票模版.docx")); |
|
|
|
|
|
|
|
|
|
|
|
// /template/secondary/工作票安全措施附页.docx
|
|
|
|
|
|
|
|
String os = System.getProperty("os.name"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String prefix = null; |
|
|
|
|
|
|
|
//Windows操作系统
|
|
|
|
|
|
|
|
if (os != null && os.toLowerCase().startsWith("windows")) { |
|
|
|
|
|
|
|
prefix = "hzims-service/ticket/src/main/resources/template"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
prefix = "/data/hzims/ticket/word/template/ticket"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docFileList.add(new File(prefix + "/电气第一种工作票模版.docx")); |
|
|
|
//安全隔离措施附页 (true,展示附件,false,不展示附件)
|
|
|
|
//安全隔离措施附页 (true,展示附件,false,不展示附件)
|
|
|
|
if (workTicket.getIsSafety()) { |
|
|
|
if (workTicket.getIsSafety()) { |
|
|
|
setWorkTicketPrincipalChange(docFileList); |
|
|
|
addFile(prefix, "/secondary/工作票安全措施附页.docx", docFileList); |
|
|
|
|
|
|
|
// setWorkTicketPrincipalChange(docFileList);
|
|
|
|
} |
|
|
|
} |
|
|
|
//危险点分析与预控措施票 (true,展示附件,false,不展示附件)
|
|
|
|
//危险点分析与预控措施票 (true,展示附件,false,不展示附件)
|
|
|
|
if (workTicket.getIsSafety()) { |
|
|
|
if (workTicket.getIsSafety()) { |
|
|
|
setWorkTicketHazardPointChange(docFileList); |
|
|
|
addFile(prefix, "/secondary/工作票危险点分析及控制措施票.docx", docFileList); |
|
|
|
|
|
|
|
// setWorkTicketHazardPointChange(docFileList);
|
|
|
|
} |
|
|
|
} |
|
|
|
//动火工作票 (true,展示附件,false,不展示附件)
|
|
|
|
//动火工作票 (true,展示附件,false,不展示附件)
|
|
|
|
if (workTicket.getIsRailway()) { |
|
|
|
if (workTicket.getIsRailway()) { |
|
|
|
setWorkTicketRailwayChange(docFileList); |
|
|
|
addFile(prefix, "/secondary/动火工作票.docx", docFileList); |
|
|
|
|
|
|
|
// setWorkTicketRailwayChange(docFileList);
|
|
|
|
} |
|
|
|
} |
|
|
|
//有限空间监测记录单(true,展示附件,false,不展示附件)
|
|
|
|
//有限空间监测记录单(true,展示附件,false,不展示附件)
|
|
|
|
if (workTicket.getIsLimited()) { |
|
|
|
if (workTicket.getIsLimited()) { |
|
|
|
setWorkTicketLimitedChange(docFileList); |
|
|
|
addFile(prefix, "/secondary/有限空间监测记录单.docx", docFileList); |
|
|
|
|
|
|
|
// setWorkTicketLimitedChange(docFileList);
|
|
|
|
} |
|
|
|
} |
|
|
|
MergeDocUtils.mergeDoc(docFileList, response); |
|
|
|
|
|
|
|
|
|
|
|
String name = LocalDate.now() + "-" + UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
|
|
|
|
|
String docPath = null; |
|
|
|
|
|
|
|
if (os != null && os.toLowerCase().startsWith("windows")) { |
|
|
|
|
|
|
|
docPath = "D:\\导出excel\\"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
docPath = "/data/hzims/ticket/word/template/ticket/ouput/"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docPath = docPath + name + ".docx"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("输出word路径:{}", docPath); |
|
|
|
|
|
|
|
//导入文档
|
|
|
|
|
|
|
|
File file = new File(docPath); |
|
|
|
|
|
|
|
MergeDocUtils.mergeDoc(docFileList, file); |
|
|
|
|
|
|
|
XWPFDocument xwpfDocument = WordExportUtil.exportWord07(docPath, workTicketInfoMap); |
|
|
|
|
|
|
|
xwpfDocument.write(response.getOutputStream()); |
|
|
|
|
|
|
|
//删除路径
|
|
|
|
|
|
|
|
file.delete(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -760,7 +777,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
private Map<String, Object> convertMap(WorkTicketVo workTicketVo) { |
|
|
|
private Map<String, Object> convertMap(WorkTicketVo workTicketVo) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
|
|
|
|
//1. 工作对象
|
|
|
|
//1. 工作对象
|
|
|
|
Map<String, Object> workTicketInfoMap = PdfUtils.objectToMapResult(workTicket, result); |
|
|
|
Map<String, Object> workTicketInfoMap = PdfUtils.objectToMapResult(workTicket, result); |
|
|
|
//安全隔离措施附页 (true,展示附件,false,不展示附件
|
|
|
|
//安全隔离措施附页 (true,展示附件,false,不展示附件
|
|
|
@ -777,12 +793,15 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
log.info("安全措施: {}", safetyMeasuresList); |
|
|
|
log.info("安全措施: {}", safetyMeasuresList); |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
Map<String, Object> workTicketInfoMap1 = new HashMap<>(); |
|
|
|
Map<String, Object> workTicketInfoMap1 = new HashMap<>(); |
|
|
|
Map<String, List<WorkTicketSafetyMeasureEntity>> measureMap = safetyMeasuresList.stream().collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType)); |
|
|
|
Map<String, List<WorkTicketSafetyMeasureEntity>> measureMap = safetyMeasuresList.stream(). |
|
|
|
Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()).forEach(measureEnum -> { |
|
|
|
collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType)); |
|
|
|
|
|
|
|
Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()) |
|
|
|
|
|
|
|
.forEach(measureEnum -> { |
|
|
|
if (CollectionUtil.isNotEmpty(measureMap.get(measureEnum.getType()))) { |
|
|
|
if (CollectionUtil.isNotEmpty(measureMap.get(measureEnum.getType()))) { |
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>(); |
|
|
|
int tempIndex = 1, index = 1; |
|
|
|
int tempIndex = 1, index = 1; |
|
|
|
List<WorkTicketSafetyMeasureEntity> workTicketSafetyMeasureEntities = measureMap.get(measureEnum.getType()); |
|
|
|
List<WorkTicketSafetyMeasureEntity> workTicketSafetyMeasureEntities = measureMap |
|
|
|
|
|
|
|
.get(measureEnum.getType()); |
|
|
|
for (WorkTicketSafetyMeasureEntity measureVO : workTicketSafetyMeasureEntities) { |
|
|
|
for (WorkTicketSafetyMeasureEntity measureVO : workTicketSafetyMeasureEntities) { |
|
|
|
String type = measureEnum.getType(); |
|
|
|
String type = measureEnum.getType(); |
|
|
|
if (tempIndex != Integer.valueOf(type)) { |
|
|
|
if (tempIndex != Integer.valueOf(type)) { |
|
|
@ -793,58 +812,21 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
Map<String, Object> map = PdfUtils.objectToMap(measureVO, true); |
|
|
|
Map<String, Object> map = PdfUtils.objectToMap(measureVO, true); |
|
|
|
map.put("index", index); |
|
|
|
map.put("index", index); |
|
|
|
map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measureVO.getStatus()) ? "√" : ""; |
|
|
|
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus() |
|
|
|
|
|
|
|
.equals(measureVO.getStatus()) ? "√" : ""; |
|
|
|
map.put("status", status); |
|
|
|
map.put("status", status); |
|
|
|
mapList.add(map); |
|
|
|
mapList.add(map); |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
workTicketInfoMap1.put(measureEnum.getConvertAttributes(), mapList); |
|
|
|
workTicketInfoMap1.put(measureEnum.getConvertAttributes(), mapList); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
workTicketInfoMap1.put(measureEnum.getConvertAttributes(), new ArrayList<WorkTicketSafetyMeasureEntity>()); |
|
|
|
workTicketInfoMap1.put(measureEnum.getConvertAttributes(), |
|
|
|
|
|
|
|
new ArrayList<WorkTicketSafetyMeasureEntity>()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 工作地点保留带电部位或注意事项
|
|
|
|
// 工作地点保留带电部位或注意事项
|
|
|
|
List<Map<String, Object>> matterLibraryListFive1 = workTicketInfoMap1.get("matterLibraryListFive") == null ? new ArrayList<Map<String, Object>>() : (List<Map<String, Object>>) workTicketInfoMap1.get("matterLibraryListFive"); |
|
|
|
this.matterLibraryListWithMap(workTicketInfoMap1); |
|
|
|
List<Map<String, Object>> matterLibraryListFlow1 = workTicketInfoMap1.get("matterLibraryListFlow") == null ? new ArrayList<Map<String, Object>>() : (List<Map<String, Object>>) workTicketInfoMap1.get("matterLibraryListFlow"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("matterLibraryListFive1 = " + matterLibraryListFive1); |
|
|
|
|
|
|
|
System.out.println("matterLibraryListFlow1 = " + matterLibraryListFlow1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matterLibraryListFive1 != null && matterLibraryListFlow1 != null) { |
|
|
|
|
|
|
|
List<Map<String, Object>> matterLibraryListFive = matterLibraryListFive1; |
|
|
|
|
|
|
|
// (4)补充工作地点保留带电部位和补充安全措施
|
|
|
|
|
|
|
|
List<Map<String, Object>> matterLibraryListFlow = matterLibraryListFlow1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(matterLibraryListFive) && CollectionUtils.isNotEmpty(matterLibraryListFlow)) { |
|
|
|
|
|
|
|
if (matterLibraryListFive.size() < matterLibraryListFlow.size()) { |
|
|
|
|
|
|
|
for (Map<String, Object> stringObjectMap : matterLibraryListFlow) { |
|
|
|
|
|
|
|
matterLibraryListFive.add(new HashMap<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matterLibraryListFive.size() > matterLibraryListFlow.size()) { |
|
|
|
|
|
|
|
for (Map<String, Object> stringObjectMap : matterLibraryListFive) { |
|
|
|
|
|
|
|
matterLibraryListFlow.add(new HashMap<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workTicketInfoMap1.put("matterLibraryListFive", CollectionUtils.isEmpty(matterLibraryListFive) ? new ArrayList<>() : matterLibraryListFive); |
|
|
|
|
|
|
|
workTicketInfoMap1.put("matterLibraryListFlow", CollectionUtils.isEmpty(matterLibraryListFlow) ? new ArrayList<>() : matterLibraryListFlow); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(matterLibraryListFive1)) { |
|
|
|
|
|
|
|
workTicketInfoMap1.put("matterLibraryListFive", new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(matterLibraryListFlow1)) { |
|
|
|
|
|
|
|
workTicketInfoMap1.put("matterLibraryListFlow", new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.putAll(workTicketInfoMap1); |
|
|
|
result.putAll(workTicketInfoMap1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -889,19 +871,105 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
List<Map<String, Object>> collect = ticketInfoDangers.stream().map(item -> { |
|
|
|
List<Map<String, Object>> collect = ticketInfoDangers.stream().map(item -> { |
|
|
|
Map<String, Object> newItem = new HashMap<>(); |
|
|
|
Map<String, Object> newItem = new HashMap<>(); |
|
|
|
newItem.put("index", index); |
|
|
|
newItem.put("index", index); |
|
|
|
newItem.put("maintenance", item.getMaintenance()); |
|
|
|
newItem.put("maintenance", item.getMaintenance() == null ? "\u00A0" : item.getMaintenance()); |
|
|
|
newItem.put("dangerousPoint", item.getDangerousPoint()); |
|
|
|
newItem.put("dangerousPoint", item.getDangerousPoint() == null ? "\u00A0" : item.getDangerousPoint()); |
|
|
|
return newItem; |
|
|
|
return newItem; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
map.put("ticketInfoDangers", collect); |
|
|
|
map.put("ticketInfoDangers", CollectionUtils.isNotEmpty(collect) ? collect |
|
|
|
|
|
|
|
: new ArrayList<Map<String, Object>>()); |
|
|
|
result.putAll(map); |
|
|
|
result.putAll(map); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//7. 是否包含
|
|
|
|
|
|
|
|
isExists(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 工作地点保留带电部位或注意事项 |
|
|
|
|
|
|
|
* 2 个map集合转成一个map集合 |
|
|
|
|
|
|
|
* @param workTicketInfoMap |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static void matterLibraryListWithMap(Map<String, Object> workTicketInfoMap) { |
|
|
|
|
|
|
|
List<Map<String, Object>> matterLibraryListFive1 = |
|
|
|
|
|
|
|
workTicketInfoMap.get("matterLibraryListFive") == null ? new ArrayList<Map<String, Object>>() |
|
|
|
|
|
|
|
: (List<Map<String, Object>>) workTicketInfoMap.get("matterLibraryListFive"); |
|
|
|
|
|
|
|
List<Map<String, Object>> matterLibraryListFlow1 = workTicketInfoMap.get("matterLibraryListFlow") == null |
|
|
|
|
|
|
|
? new ArrayList<Map<String, Object>>() |
|
|
|
|
|
|
|
: (List<Map<String, Object>>) workTicketInfoMap.get("matterLibraryListFlow"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matterLibraryListFive1 != null && matterLibraryListFlow1 != null) { |
|
|
|
|
|
|
|
List<Map<String, Object>> matterLibraryListFive = matterLibraryListFive1; |
|
|
|
|
|
|
|
// (4)补充工作地点保留带电部位和补充安全措施
|
|
|
|
|
|
|
|
List<Map<String, Object>> matterLibraryListFlow = matterLibraryListFlow1; |
|
|
|
|
|
|
|
//合成一个map
|
|
|
|
|
|
|
|
List<Map<String, Object>> maps = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matterLibraryListFive.size() < matterLibraryListFlow.size()) { |
|
|
|
|
|
|
|
for (int i = 0; i < matterLibraryListFlow.size(); i++) { |
|
|
|
|
|
|
|
listWichMap(matterLibraryListFive, matterLibraryListFlow, maps, i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matterLibraryListFive.size() > matterLibraryListFlow.size()) { |
|
|
|
|
|
|
|
for (int i = 0; i < matterLibraryListFive.size(); i++) { |
|
|
|
|
|
|
|
listWichMap(matterLibraryListFive, matterLibraryListFlow, maps, i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matterLibraryListFive.size() == matterLibraryListFlow.size()) { |
|
|
|
|
|
|
|
for (int i = 0; i < matterLibraryListFive.size(); i++) { |
|
|
|
|
|
|
|
listWichMap(matterLibraryListFive, matterLibraryListFlow, maps, i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workTicketInfoMap.put("matterLibraryList", CollectionUtils.isEmpty(maps) ? new ArrayList<>() : maps); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 判断是否包含,是否存在 |
|
|
|
|
|
|
|
* @param result |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static void isExists(Map<String, Object> result) { |
|
|
|
|
|
|
|
if (!result.containsKey("ticketInfoDangers")) { |
|
|
|
|
|
|
|
result.put("ticketInfoDangers",new ArrayList<Map<String, Object>>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//项目名称
|
|
|
|
|
|
|
|
if (!result.containsKey("projectName")) { |
|
|
|
|
|
|
|
result.put("projectName","\u00A0 "); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 两个List转成一个Map |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param matterLibraryListFive 第一个List |
|
|
|
|
|
|
|
* @param matterLibraryListFlow 第二个list |
|
|
|
|
|
|
|
* @param maps 新的Map |
|
|
|
|
|
|
|
* @param i 索引 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static void listWichMap(List<Map<String, Object>> matterLibraryListFive, List<Map<String, Object>> matterLibraryListFlow, List<Map<String, Object>> maps, int i) { |
|
|
|
|
|
|
|
Map<String, Object> stringObjectMap = matterLibraryListFive.get(i); |
|
|
|
|
|
|
|
Map<String, Object> stringObjectMap1 = matterLibraryListFlow.get(i); |
|
|
|
|
|
|
|
HashMap<String, Object> objectObjectHashMap = new HashMap<>(); |
|
|
|
|
|
|
|
objectObjectHashMap.put("safetyMeasure", stringObjectMap.get("safetyMeasure")); |
|
|
|
|
|
|
|
objectObjectHashMap.put("safetyMeasure1", stringObjectMap1.get("safetyMeasure")); |
|
|
|
|
|
|
|
maps.add(objectObjectHashMap); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 对象转map |
|
|
|
* 对象转map |
|
|
|
* |
|
|
|
* |
|
|
|
* @param value |
|
|
|
* @param value |
|
|
@ -913,11 +981,11 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
Map<String, Object> map = JSONObject.parseObject(jsonString, Map.class); |
|
|
|
Map<String, Object> map = JSONObject.parseObject(jsonString, Map.class); |
|
|
|
Map<String, Object> newMap = new HashMap<>(); |
|
|
|
Map<String, Object> newMap = new HashMap<>(); |
|
|
|
for (Map.Entry<String, Object> stringObjectEntry : map.entrySet()) { |
|
|
|
for (Map.Entry<String, Object> stringObjectEntry : map.entrySet()) { |
|
|
|
System.out.println("没转换的数据 " + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue()); |
|
|
|
log.info("没转换的数据 " + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue()); |
|
|
|
|
|
|
|
|
|
|
|
//如果包含直接跳过
|
|
|
|
//如果包含直接跳过
|
|
|
|
if (result.containsKey(stringObjectEntry.getKey())) { |
|
|
|
if (result.containsKey(stringObjectEntry.getKey())) { |
|
|
|
System.out.println("跳过key : " + stringObjectEntry.getKey()); |
|
|
|
log.info("跳过key : " + stringObjectEntry.getKey()); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -929,59 +997,27 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
for (Map.Entry<String, Object> stringObjectEntry : newMap.entrySet()) { |
|
|
|
for (Map.Entry<String, Object> stringObjectEntry : newMap.entrySet()) { |
|
|
|
System.out.println("数据转换的数据 " + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue()); |
|
|
|
log.info("数据转换的数据 " + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return newMap; |
|
|
|
return newMap; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 对象转map |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static <T> Map<String, Object> parseObjectMap(T target, Class clas) { |
|
|
|
|
|
|
|
return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 安全隔离措施附页 |
|
|
|
* 添加文件 |
|
|
|
*/ |
|
|
|
* |
|
|
|
@SneakyThrows |
|
|
|
* @param prefix |
|
|
|
public void setWorkTicketPrincipalChange(List<File> docFileList) { |
|
|
|
* @param pathName |
|
|
|
docFileList.add(new File("template/secondary/工作票安全措施附页.docx")); |
|
|
|
* @param docFileList |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 危险点分析与预控措施票 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@SneakyThrows |
|
|
|
|
|
|
|
public void setWorkTicketHazardPointChange(List<File> docFileList) { |
|
|
|
|
|
|
|
docFileList.add(new File("template/secondary/工作票危险点分析及控制措施票.docx")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 动火工作票 |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SneakyThrows |
|
|
|
private void addFile(String prefix, String pathName, List<File> docFileList) { |
|
|
|
public void setWorkTicketRailwayChange(List<File> docFileList) { |
|
|
|
File file = new File(prefix + pathName); |
|
|
|
File file = new File("template/secondary/动火工作票.docx"); |
|
|
|
|
|
|
|
docFileList.add(file); |
|
|
|
docFileList.add(file); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 有限空间监测记录单(true,展示附件,false,不展示附件) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@SneakyThrows |
|
|
|
|
|
|
|
public void setWorkTicketLimitedChange(List<File> docFileList) { |
|
|
|
|
|
|
|
File file = new File("template/secondary/有限空间监测记录单.docx"); |
|
|
|
|
|
|
|
docFileList.add(file); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* value true转 ☑ 或 false转 □ |
|
|
|
* value true转 ☑ 或 false转 □ |
|
|
@ -997,7 +1033,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|