diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java index d2240cb..185fef7 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java @@ -2,6 +2,7 @@ package com.hnac.hzims.ticket.processflow.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -22,13 +23,14 @@ import java.util.Date; @Data @ApiModel(value = "ProcessDict",description = "票据字典表") @Accessors(chain = true) +@TableName("process_dict") public class ProcessDict { /** * 票据编码 */ - @TableId(value = "dictCode",type = IdType.AUTO) + @TableId(type = IdType.AUTO) @ApiModelProperty("票据编码") private Long dictCode; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java index 145b692..b785073 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java @@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.time.LocalDateTime; @@ -124,6 +126,8 @@ public class WorkTicketFinish implements Serializable { /** * 结束时间 */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime workEndTime; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 2c8d482..15ce51e 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -5,9 +5,11 @@ import cn.afterturn.easypoi.word.WordExportUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; @@ -250,16 +252,21 @@ public class TicketProcessServiceImpl implements TicketProcessService { e.printStackTrace(); } //更新安全措施 - List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); - if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { - log.info("获取安全措施的数据:{}", safetyMeasuresList); - safetyMeasuresList.forEach(item -> { - if (ObjectUtils.isNotEmpty(item.getTicketId())) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId, item.getTicketId()); - workTicketSafetyMeasureService.update(item, queryWrapper); + try { + List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); + if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { + log.info("获取安全措施的数据:{}", safetyMeasuresList); + for (WorkTicketSafetyMeasureEntity item : safetyMeasuresList) { + if (ObjectUtils.isNotEmpty(item.getId())) { + workTicketSafetyMeasureService.updateById(item); + }else { + item.setTicketId(workTicketInfo.getId()); + workTicketSafetyMeasureService.save(item); + } } - }); + } + } catch (Exception e) { + e.printStackTrace(); } //工作票工作任务组 // List workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); @@ -299,7 +306,9 @@ public class TicketProcessServiceImpl implements TicketProcessService { //工作结束 WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); try { - if (ObjectUtils.isNotEmpty(workTicketFinish) && 99 == workTicket.getFlowStatus().intValue()) { + + log.info("工作结束==============>"+ (workTicket.getFlowStatus().intValue())); + if (ObjectUtils.isNotEmpty(workTicketFinish)) { WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId()); log.info("获取工作结束:{}", workTicketFinish); if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) { @@ -427,6 +436,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { workTicket.setFlowTaskName("结束"); workTicket.setNextStepOperator(" "); workTicket.setStepOperator(" "); + workTicket.setFlowStatus(999); } else { workTicket.setFlowTaskId(taskId); workTicket.setFlowTaskName(response.getTaskName()); @@ -856,7 +866,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); log.info("工作票延期: {}", workTicketDelay); if (ObjectUtils.isNotEmpty(workTicketDelay)) { - result.putAll(PdfUtils.objectToMapResult(workTicket, result)); + result.putAll(PdfUtils.objectToMapResult(workTicketDelay, result)); } else { result.putAll(PdfUtils.objectToMapResult(new WorkTicketDelayEntity(), result)); } @@ -973,12 +983,11 @@ public class TicketProcessServiceImpl implements TicketProcessService { //负责人 String licensorName = WordHelper.toMapAsString(result, "principalName", 10); result.put("principalName2", licensorName); - }else { + } else { WordHelper.putMap(result, "principalName2", 10); } //许可人确认工作票终结 - if (WordHelper.isNoneBlank(result, "workEndTime")) { log.info("许可人确认工作票终结"); //负责人 @@ -987,7 +996,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { //许可人 String licensorName = WordHelper.toMapAsString(result, "licensorName", 10); result.put("licensorName2", licensorName); - }else { + } else { WordHelper.putMap(result, "principalName3", 10); WordHelper.putMap(result, "licensorName2", 10); } @@ -1065,12 +1074,32 @@ public class TicketProcessServiceImpl implements TicketProcessService { * @param maps 新的Map * @param i 索引 */ - private static void listWichMap(List> matterLibraryListFive, List> matterLibraryListFlow, List> maps, int i) { - Map stringObjectMap = matterLibraryListFive.get(i); - Map stringObjectMap1 = matterLibraryListFlow.get(i); + private static void listWichMap(List> matterLibraryListFive, + List> matterLibraryListFlow, List> maps, int i) { HashMap objectObjectHashMap = new HashMap<>(); - objectObjectHashMap.put("safetyMeasure", stringObjectMap.get("safetyMeasure")); - objectObjectHashMap.put("safetyMeasure1", stringObjectMap1.get("safetyMeasure")); + if (matterLibraryListFive.size() > 0) { + if (matterLibraryListFive.size() <= i) { + objectObjectHashMap.put("safetyMeasure", ""); + } else { + Map stringObjectMap = matterLibraryListFive.get(i); + objectObjectHashMap.put("safetyMeasure", stringObjectMap.get("safetyMeasure")); + } + } else { + objectObjectHashMap.put("safetyMeasure", ""); + } + + + if (matterLibraryListFlow.size() > 0) { + if (matterLibraryListFlow.size() <= i) { + objectObjectHashMap.put("safetyMeasure1", ""); + } else { + Map stringObjectMap = matterLibraryListFive.get(i); + objectObjectHashMap.put("safetyMeasure1", stringObjectMap.get("safetyMeasure")); + } + }else { + objectObjectHashMap.put("safetyMeasure1", ""); + } + maps.add(objectObjectHashMap); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java index f6e0b8e..83519ba 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java @@ -2,6 +2,7 @@ package com.hnac.hzims.ticket.twoTicket.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.mapper.WorkTicketFinishMapper; @@ -34,8 +35,8 @@ public class WorkTicketFinishServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(WorkTicketFinish::getTicketId, ticketId); queryWrapper.orderByDesc(WorkTicketFinish::getCreateTime); - queryWrapper.last("limit 1"); - return this.getOne(queryWrapper); + List list = this.list(queryWrapper); + return CollectionUtils.isNotEmpty(list) ? list.get(0) : null; } /** diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java index 8147ea9..e8505ad 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java @@ -71,8 +71,7 @@ public class WordHelper extends StringUtils { * 判断map不为为空 */ public static boolean isNoneBlank(Map result, String key) { - String value = WordHelper.toString(result.get(key)).trim(); - System.out.println(value.length()); + String value = WordHelper.toString(result.get(key)); if (StringUtils.isNoneBlank(value)) { return true; } @@ -116,6 +115,7 @@ public class WordHelper extends StringUtils { */ private static void isContainsKey(Map params, Map result) { + if (params.containsKey("principalName1")) { result.put("principalName1", params.get("principalName1")); params.remove("principalName1"); @@ -219,7 +219,7 @@ public class WordHelper extends StringUtils { Object newValue = StringUtils.isNoneBlank(toString(value).trim()) ? value : "\u00A0" + printSpace(count); result.put(key, newValue); } else { - Object newValue = StringUtils.isNoneBlank(toString(value).trim()) ? value : "\u00A0"; + Object newValue = StringUtils.isNoneBlank(toString(value).trim()) ? value : "\u00A0" + printSpace(4); result.put(key, newValue); } } diff --git a/hzims-service/ticket/src/main/resources/template/secondary/工作票危险点分析及控制措施票.docx b/hzims-service/ticket/src/main/resources/template/secondary/工作票危险点分析及控制措施票.docx index 591306f..5e86dca 100644 Binary files a/hzims-service/ticket/src/main/resources/template/secondary/工作票危险点分析及控制措施票.docx and b/hzims-service/ticket/src/main/resources/template/secondary/工作票危险点分析及控制措施票.docx differ diff --git a/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx b/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx index f2760d0..4684a35 100644 Binary files a/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx and b/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx differ