Browse Source

修改工作票预览接口

zhongwei
段飞宇 2 years ago
parent
commit
6368d17363
  1. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java
  2. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java
  3. 67
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  4. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java
  5. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java
  6. BIN
      hzims-service/ticket/src/main/resources/template/secondary/工作票危险点分析及控制措施票.docx
  7. BIN
      hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx

4
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.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -22,13 +23,14 @@ import java.util.Date;
@Data @Data
@ApiModel(value = "ProcessDict",description = "票据字典表") @ApiModel(value = "ProcessDict",description = "票据字典表")
@Accessors(chain = true) @Accessors(chain = true)
@TableName("process_dict")
public class ProcessDict { public class ProcessDict {
/** /**
* 票据编码 * 票据编码
*/ */
@TableId(value = "dictCode",type = IdType.AUTO) @TableId(type = IdType.AUTO)
@ApiModelProperty("票据编码") @ApiModelProperty("票据编码")
private Long dictCode; private Long dictCode;

4
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.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; 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; private LocalDateTime workEndTime;

67
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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; 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.common.logs.utils.StringUtils;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
@ -250,16 +252,21 @@ public class TicketProcessServiceImpl implements TicketProcessService {
e.printStackTrace(); e.printStackTrace();
} }
//更新安全措施 //更新安全措施
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); try {
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
log.info("获取安全措施的数据:{}", safetyMeasuresList); if (CollectionUtils.isNotEmpty(safetyMeasuresList)) {
safetyMeasuresList.forEach(item -> { log.info("获取安全措施的数据:{}", safetyMeasuresList);
if (ObjectUtils.isNotEmpty(item.getTicketId())) { for (WorkTicketSafetyMeasureEntity item : safetyMeasuresList) {
LambdaQueryWrapper<WorkTicketSafetyMeasureEntity> queryWrapper = new LambdaQueryWrapper<>(); if (ObjectUtils.isNotEmpty(item.getId())) {
queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId, item.getTicketId()); workTicketSafetyMeasureService.updateById(item);
workTicketSafetyMeasureService.update(item, queryWrapper); }else {
item.setTicketId(workTicketInfo.getId());
workTicketSafetyMeasureService.save(item);
}
} }
}); }
} catch (Exception e) {
e.printStackTrace();
} }
//工作票工作任务组 //工作票工作任务组
// List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); // List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList();
@ -299,7 +306,9 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//工作结束 //工作结束
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish();
try { try {
if (ObjectUtils.isNotEmpty(workTicketFinish) && 99 == workTicket.getFlowStatus().intValue()) {
log.info("工作结束==============>"+ (workTicket.getFlowStatus().intValue()));
if (ObjectUtils.isNotEmpty(workTicketFinish)) {
WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId()); WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId());
log.info("获取工作结束:{}", workTicketFinish); log.info("获取工作结束:{}", workTicketFinish);
if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) { if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) {
@ -427,6 +436,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
workTicket.setFlowTaskName("结束"); workTicket.setFlowTaskName("结束");
workTicket.setNextStepOperator(" "); workTicket.setNextStepOperator(" ");
workTicket.setStepOperator(" "); workTicket.setStepOperator(" ");
workTicket.setFlowStatus(999);
} else { } else {
workTicket.setFlowTaskId(taskId); workTicket.setFlowTaskId(taskId);
workTicket.setFlowTaskName(response.getTaskName()); workTicket.setFlowTaskName(response.getTaskName());
@ -856,7 +866,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay();
log.info("工作票延期: {}", workTicketDelay); log.info("工作票延期: {}", workTicketDelay);
if (ObjectUtils.isNotEmpty(workTicketDelay)) { if (ObjectUtils.isNotEmpty(workTicketDelay)) {
result.putAll(PdfUtils.objectToMapResult(workTicket, result)); result.putAll(PdfUtils.objectToMapResult(workTicketDelay, result));
} else { } else {
result.putAll(PdfUtils.objectToMapResult(new WorkTicketDelayEntity(), result)); result.putAll(PdfUtils.objectToMapResult(new WorkTicketDelayEntity(), result));
} }
@ -973,12 +983,11 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//负责人 //负责人
String licensorName = WordHelper.toMapAsString(result, "principalName", 10); String licensorName = WordHelper.toMapAsString(result, "principalName", 10);
result.put("principalName2", licensorName); result.put("principalName2", licensorName);
}else { } else {
WordHelper.putMap(result, "principalName2", 10); WordHelper.putMap(result, "principalName2", 10);
} }
//许可人确认工作票终结 //许可人确认工作票终结
if (WordHelper.isNoneBlank(result, "workEndTime")) { if (WordHelper.isNoneBlank(result, "workEndTime")) {
log.info("许可人确认工作票终结"); log.info("许可人确认工作票终结");
//负责人 //负责人
@ -987,7 +996,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//许可人 //许可人
String licensorName = WordHelper.toMapAsString(result, "licensorName", 10); String licensorName = WordHelper.toMapAsString(result, "licensorName", 10);
result.put("licensorName2", licensorName); result.put("licensorName2", licensorName);
}else { } else {
WordHelper.putMap(result, "principalName3", 10); WordHelper.putMap(result, "principalName3", 10);
WordHelper.putMap(result, "licensorName2", 10); WordHelper.putMap(result, "licensorName2", 10);
} }
@ -1065,12 +1074,32 @@ public class TicketProcessServiceImpl implements TicketProcessService {
* @param maps 新的Map * @param maps 新的Map
* @param i 索引 * @param i 索引
*/ */
private static void listWichMap(List<Map<String, Object>> matterLibraryListFive, List<Map<String, Object>> matterLibraryListFlow, List<Map<String, Object>> maps, int i) { private static void listWichMap(List<Map<String, Object>> matterLibraryListFive,
Map<String, Object> stringObjectMap = matterLibraryListFive.get(i); List<Map<String, Object>> matterLibraryListFlow, List<Map<String, Object>> maps, int i) {
Map<String, Object> stringObjectMap1 = matterLibraryListFlow.get(i);
HashMap<String, Object> objectObjectHashMap = new HashMap<>(); HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("safetyMeasure", stringObjectMap.get("safetyMeasure")); if (matterLibraryListFive.size() > 0) {
objectObjectHashMap.put("safetyMeasure1", stringObjectMap1.get("safetyMeasure")); if (matterLibraryListFive.size() <= i) {
objectObjectHashMap.put("safetyMeasure", "");
} else {
Map<String, Object> 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<String, Object> stringObjectMap = matterLibraryListFive.get(i);
objectObjectHashMap.put("safetyMeasure1", stringObjectMap.get("safetyMeasure"));
}
}else {
objectObjectHashMap.put("safetyMeasure1", "");
}
maps.add(objectObjectHashMap); maps.add(objectObjectHashMap);
} }

5
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.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish;
import com.hnac.hzims.ticket.twoTicket.mapper.WorkTicketFinishMapper; import com.hnac.hzims.ticket.twoTicket.mapper.WorkTicketFinishMapper;
@ -34,8 +35,8 @@ public class WorkTicketFinishServiceImpl extends ServiceImpl<WorkTicketFinishMap
LambdaQueryWrapper<WorkTicketFinish> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WorkTicketFinish> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketFinish::getTicketId, ticketId); queryWrapper.eq(WorkTicketFinish::getTicketId, ticketId);
queryWrapper.orderByDesc(WorkTicketFinish::getCreateTime); queryWrapper.orderByDesc(WorkTicketFinish::getCreateTime);
queryWrapper.last("limit 1"); List<WorkTicketFinish> list = this.list(queryWrapper);
return this.getOne(queryWrapper); return CollectionUtils.isNotEmpty(list) ? list.get(0) : null;
} }
/** /**

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java

@ -71,8 +71,7 @@ public class WordHelper extends StringUtils {
* 判断map不为为空 * 判断map不为为空
*/ */
public static boolean isNoneBlank(Map<String, Object> result, String key) { public static boolean isNoneBlank(Map<String, Object> result, String key) {
String value = WordHelper.toString(result.get(key)).trim(); String value = WordHelper.toString(result.get(key));
System.out.println(value.length());
if (StringUtils.isNoneBlank(value)) { if (StringUtils.isNoneBlank(value)) {
return true; return true;
} }
@ -116,6 +115,7 @@ public class WordHelper extends StringUtils {
*/ */
private static void isContainsKey(Map<String, Object> params, Map<String, Object> result) { private static void isContainsKey(Map<String, Object> params, Map<String, Object> result) {
if (params.containsKey("principalName1")) { if (params.containsKey("principalName1")) {
result.put("principalName1", params.get("principalName1")); result.put("principalName1", params.get("principalName1"));
params.remove("principalName1"); params.remove("principalName1");
@ -219,7 +219,7 @@ public class WordHelper extends StringUtils {
Object newValue = StringUtils.isNoneBlank(toString(value).trim()) ? value : "\u00A0" + printSpace(count); Object newValue = StringUtils.isNoneBlank(toString(value).trim()) ? value : "\u00A0" + printSpace(count);
result.put(key, newValue); result.put(key, newValue);
} else { } 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); result.put(key, newValue);
} }
} }

BIN
hzims-service/ticket/src/main/resources/template/secondary/工作票危险点分析及控制措施票.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx

Binary file not shown.
Loading…
Cancel
Save