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. 55
      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.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;

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.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;

55
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();
}
//更新安全措施
try {
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) {
log.info("获取安全措施的数据:{}", safetyMeasuresList);
safetyMeasuresList.forEach(item -> {
if (ObjectUtils.isNotEmpty(item.getTicketId())) {
LambdaQueryWrapper<WorkTicketSafetyMeasureEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId, item.getTicketId());
workTicketSafetyMeasureService.update(item, queryWrapper);
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<WorkTicketContentEntity> 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));
}
@ -978,7 +988,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
}
//许可人确认工作票终结
if (WordHelper.isNoneBlank(result, "workEndTime")) {
log.info("许可人确认工作票终结");
//负责人
@ -1065,12 +1074,32 @@ public class TicketProcessServiceImpl implements TicketProcessService {
* @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);
private static void listWichMap(List<Map<String, Object>> matterLibraryListFive,
List<Map<String, Object>> matterLibraryListFlow, List<Map<String, Object>> maps, int i) {
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
if (matterLibraryListFive.size() > 0) {
if (matterLibraryListFive.size() <= i) {
objectObjectHashMap.put("safetyMeasure", "");
} else {
Map<String, Object> stringObjectMap = matterLibraryListFive.get(i);
objectObjectHashMap.put("safetyMeasure", stringObjectMap.get("safetyMeasure"));
objectObjectHashMap.put("safetyMeasure1", stringObjectMap1.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);
}

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.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<WorkTicketFinishMap
LambdaQueryWrapper<WorkTicketFinish> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketFinish::getTicketId, ticketId);
queryWrapper.orderByDesc(WorkTicketFinish::getCreateTime);
queryWrapper.last("limit 1");
return this.getOne(queryWrapper);
List<WorkTicketFinish> list = this.list(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不为为空
*/
public static boolean isNoneBlank(Map<String, Object> 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<String, Object> params, Map<String, Object> 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);
}
}

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