Browse Source

操作票浏览

zhongwei
段飞宇 1 year ago
parent
commit
7f4fcf7fb1
  1. 310
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketInfoEntity.java
  2. 67
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketMeasureEntity.java
  3. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java
  4. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
  5. 7
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketMeasureService.java
  6. 11
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java
  7. 92
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
  8. 61
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  9. 13
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketMeasureServiceImpl.java
  10. 121
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/utils/OperationWordHelper.java
  11. 1
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  12. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordHelper.java
  13. 36
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketInfoVo.java
  14. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketMeasureVo.java

310
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketInfoEntity.java

@ -20,167 +20,161 @@ import java.time.LocalDateTime;
@EqualsAndHashCode
@Data
@TableName("hzims_standard_ticket_info")
@ApiModel(value = "标准票对象",description = "标准票对象")
@ApiModel(value = "标准票对象", description = "标准票对象")
public class StandardTicketInfoEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 8278603728783507684L;
@ApiModelProperty("票据类型")
@QueryField(condition = SqlCondition.EQUAL)
private String ticketType;
@ApiModelProperty("单位")
@QueryField(condition = SqlCondition.EQUAL)
private String company;
@ApiModelProperty("工作流ID")
@QueryField(condition = SqlCondition.EQUAL)
private String processInstanceId;
@ApiModelProperty("编号")
@QueryField(condition = SqlCondition.EQUAL)
private String code;
@ApiModelProperty("发令人")
@QueryField(condition = SqlCondition.EQUAL)
private Long issueOrderPerson;
@ApiModelProperty("受令人")
@QueryField(condition = SqlCondition.EQUAL)
private Long accessOrderPerson;
@ApiModelProperty("发令时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime issueOrderTime;
@ApiModelProperty("操作开始时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime startTime;
@ApiModelProperty("操作结束时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime endTime;
@ApiModelProperty("操作任务")
@QueryField(condition = SqlCondition.EQUAL)
private String title;
@ApiModelProperty("任务类型")
@QueryField(condition = SqlCondition.EQUAL)
private String taskType;
@ApiModelProperty("关联业务任务ID")
private Long taskId;
@ApiModelProperty("关联业务名称")
@QueryField(condition = SqlCondition.LIKE)
private String taskName;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("监护人")
private Long guardian;
@ApiModelProperty("操作人")
private Long operator;
@ApiModelProperty("操作时间")
private LocalDateTime operateTime;
@ApiModelProperty("负责人确认时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime guardianshipTime;
@ApiModelProperty("值班负责人")
private Long principal;
@ApiModelProperty("值班负责人确认时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private LocalDateTime principalTime;
@ApiModelProperty("是否评价")
private Integer isEvaluate;
/**
* AA/AAA/AAAA由建站时建站人填写必须系统验证唯一性
* 站点标识-两票编码
*/
@ApiModelProperty("站点标识-两票编码")
private String signage;
/**
* 编号原站点ID
*/
@ApiModelProperty("编号(原站点ID)")
private String signageCode;
/**
* 流程状态'
*/
@ApiModelProperty("流程状态")
private Integer flowStatus;
/**
* 流程描述
*/
@ApiModelProperty("流程描述")
private String flowDescription;
/**
* 下一个审批人
*/
@ApiModelProperty("下一个审批人")
private String nextStepOperator;
/**
* 用户Id
*/
@ApiModelProperty("用户Id")
private String flowUserId;
/**
* 当前任务名
*/
@ApiModelProperty("当前任务名")
private String flowTaskName;
private static final long serialVersionUID = 8278603728783507684L;
@ApiModelProperty("票据类型")
@QueryField(condition = SqlCondition.EQUAL)
private String ticketType;
/**
* 当前任务名
*/
@ApiModelProperty("当前任务名")
private String flowTaskId;
@ApiModelProperty("单位")
@QueryField(condition = SqlCondition.EQUAL)
private String company;
@ApiModelProperty("工作流ID")
@QueryField(condition = SqlCondition.EQUAL)
private String processInstanceId;
@ApiModelProperty("编号")
@QueryField(condition = SqlCondition.EQUAL)
private String code;
@ApiModelProperty("发令人")
@QueryField(condition = SqlCondition.EQUAL)
private Long issueOrderPerson;
@ApiModelProperty("受令人")
@QueryField(condition = SqlCondition.EQUAL)
private Long accessOrderPerson;
@ApiModelProperty("发令时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime issueOrderTime;
@ApiModelProperty("操作开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startTime;
@ApiModelProperty("操作结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
@ApiModelProperty("操作任务")
@QueryField(condition = SqlCondition.EQUAL)
private String title;
@ApiModelProperty("任务类型")
@QueryField(condition = SqlCondition.EQUAL)
private String taskType;
@ApiModelProperty("关联业务任务ID")
private Long taskId;
@ApiModelProperty("关联业务名称")
@QueryField(condition = SqlCondition.LIKE)
private String taskName;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("监护人")
private Long guardian;
@ApiModelProperty("操作人")
private Long operator;
@ApiModelProperty("操作时间")
private LocalDateTime operateTime;
@ApiModelProperty("负责人确认时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime guardianshipTime;
@ApiModelProperty("值班负责人")
private Long principal;
@ApiModelProperty("值班负责人确认时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime principalTime;
@ApiModelProperty("是否评价")
private Integer isEvaluate;
/**
* AA/AAA/AAAA由建站时建站人填写必须系统验证唯一性
* 站点标识-两票编码
*/
@ApiModelProperty("站点标识-两票编码")
private String signage;
/**
* 编号原站点ID
*/
@ApiModelProperty("编号(原站点ID)")
private String signageCode;
/**
* 流程状态'
*/
@ApiModelProperty("流程状态")
private Integer flowStatus;
/**
* 流程描述
*/
@ApiModelProperty("流程描述")
private String flowDescription;
/**
* 下一个审批人
*/
@ApiModelProperty("下一个审批人")
private String nextStepOperator;
/**
* 用户Id
*/
@ApiModelProperty("用户Id")
private String flowUserId;
/**
* 当前任务名
*/
@ApiModelProperty("当前任务名")
private String flowTaskName;
/**
* 当前任务名
*/
@ApiModelProperty("当前任务名")
private String flowTaskId;
/**
* 项目
*/
@ApiModelProperty("项目")
private String projectName;
/**
*
*/
@ApiModelProperty("分组")
private String classGroupName;
}

67
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/entity/StandardTicketMeasureEntity.java

@ -22,49 +22,50 @@ import java.time.LocalDateTime;
* @author hx
*/
@Data
@ApiModel(value = "标准票安全措施明细",description = "标准票安全措施明细")
@ApiModel(value = "标准票安全措施明细", description = "标准票安全措施明细")
@EqualsAndHashCode
@TableName("hzims_standard_ticket_measure")
public class StandardTicketMeasureEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 8503146008417850183L;
private static final long serialVersionUID = 8503146008417850183L;
@ApiModelProperty("标准票ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long ticketId;
@ApiModelProperty("标准票ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long ticketId;
@ApiModelProperty("分组")
private Long matterGroup;
@ApiModelProperty("分组")
private Long matterGroup;
@ApiModelProperty("安全措施ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long measureId;
@ApiModelProperty("安全措施ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long measureId;
@ApiModelProperty("安全措施")
@QueryField(condition = SqlCondition.LIKE)
private String measure;
@ApiModelProperty("安全措施")
@QueryField(condition = SqlCondition.LIKE)
private String measure;
@ApiModelProperty("执行人")
@TableField(updateStrategy = FieldStrategy.IGNORED)
@QueryField(condition = SqlCondition.EQUAL)
private Long executor;
@ApiModelProperty("执行人")
@TableField(updateStrategy = FieldStrategy.IGNORED)
@QueryField(condition = SqlCondition.EQUAL)
private Long executor;
@ApiModelProperty("执行时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDateTime executeTime;
@ApiModelProperty("执行时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDateTime executeTime;
@ApiModelProperty("执行图片")
private String executeImgUrl;
@ApiModelProperty("执行图片")
private String executeImgUrl;
@ApiModelProperty("执行备注")
private String remark;
@ApiModelProperty("执行备注")
private String remark;
@ApiModelProperty("操作事项排序")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer sort;
@ApiModelProperty("操作事项排序")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer sort;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime operationTime;
}

22
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java

@ -1,16 +1,15 @@
package com.hnac.hzims.ticket.standardTicket.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.ticket.standardTicket.service.OperationTicketService;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
* 操作票
@ -44,4 +43,17 @@ public class OperationTicketController {
/**
* 新预览
*/
@GetMapping("/newPreview")
@ApiOperation(value = "新预览")
@ApiOperationSupport(order = 11)
public void preview(@RequestParam(value = "ticketId", required = true) Long ticketId,
@RequestParam(value = "status", required = true) Integer status,
HttpServletResponse response) {
operationTicketService.newPreview(ticketId, status, response);
}
}

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java

@ -10,6 +10,7 @@ import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
@ -109,4 +110,11 @@ public interface IStandardTicketInfoService extends BaseService<StandardTicketIn
*/
BladePage<StandardTicketVo> areaMonthlyWithOperation(StandardTicketWithAreaVo areaMonthly, Page<StandardTicketInfoEntity> searchPage);
/**
* 根据Id获取操作票详细信息
* @param ticketId
* @return
*/
StandardTicketInfoVo selectDetailsById(Long ticketId);
}

7
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketMeasureService.java

@ -61,4 +61,11 @@ public interface IStandardTicketMeasureService extends BaseService<StandardTicke
* @return
*/
boolean update(StandardTicketMeasureDto dto);
/**
* 根据ticketId获取安全措施信息
* @param ticketId
* @return
*/
List<StandardTicketMeasureEntity> listStandardByTicketId(Long ticketId);
}

11
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java

@ -4,6 +4,8 @@ import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import javax.servlet.http.HttpServletResponse;
/**
* @Author WL
* @Version v1.0
@ -25,4 +27,13 @@ public interface OperationTicketService {
* @param response
*/
void findPending(ProcessWorkFlowResponse response);
/**
* 新预览
* @param ticketId 操作票id
* @param status 状态
* @param response 扩展 ServletResponse 接口以在发送响应时提供特定于 HTTP 的功能例如它具有访问HTTP标头和cookie的方法
*/
void newPreview(Long ticketId, Integer status, HttpServletResponse response);
}

92
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java

@ -1,7 +1,9 @@
package com.hnac.hzims.ticket.standardTicket.service.impl;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants;
@ -9,6 +11,7 @@ import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.processflow.service.ProcessDictService;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
@ -17,15 +20,24 @@ import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketMeasureEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketMeasureService;
import com.hnac.hzims.ticket.standardTicket.service.OperationTicketService;
import com.hnac.hzims.ticket.standardTicket.utils.OperationWordHelper;
import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant;
import com.hnac.hzims.ticket.twoTicket.utils.WordHelper;
import com.hnac.hzims.ticket.twoTicket.utils.WordMapUtils;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketMeasureVo;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.utils.PdfUtils;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.feign.ISysClient;
@ -34,10 +46,13 @@ import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant.OPERATION_TICKET_KEY;
@ -221,6 +236,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
}
}
/**
* 填充数据
*
@ -357,4 +373,80 @@ public class OperationTicketServiceImpl implements OperationTicketService {
}
return result;
}
/**
* 新预览
*
* @param ticketId 操作票id
* @param status 状态
* @param response 扩展 ServletResponse 接口以在发送响应时提供特定于 HTTP 的功能例如它具有访问HTTP标头和cookie的方法
*/
@SneakyThrows
@Override
public void newPreview(Long ticketId, Integer status, HttpServletResponse response) {
String fileName = IdWorker.get32UUID() + ".docx";
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
StandardTicketInfoVo standardTicketInfoVo = standardTicketInfoService.selectDetailsById(ticketId);
//将查询的数据转换为map
Map<String, Object> workTicketInfoMap = this.convertMap(standardTicketInfoVo);
//导入下在word
Map<String, Object> resultMap = OperationWordHelper.resultMap(workTicketInfoMap);
String workTicketStatus = OperationWordHelper.getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME;
//Windows操作系统
if (os != null && os.toLowerCase().startsWith("windows")) {
String url = "template/" + workTicketStatus;
XWPFDocument doc = WordExportUtil.exportWord07(url, resultMap);
log.info("当前系统版本是:{}", os);
doc.write(response.getOutputStream());
} else {
String url = TicketConstant.TICKET_LIUNX_PATH + "/" + workTicketStatus;
XWPFDocument doc = WordExportUtil.exportWord07(url, resultMap);
//其它操作系统
log.info("当前系统版本是:{}", os);
ServletOutputStream outputStream = response.getOutputStream();
doc.write(outputStream);
}
}
/**
* 将查询的数据转换为map
* @param standardTicketInfoVo
* @return
*/
private Map<String, Object> convertMap(StandardTicketInfoVo standardTicketInfoVo) {
//1. 操作票装换map
Map<String, Object> result = new HashMap<>();
Map<String, Object> stringObjectMap = PdfUtils.objectToMapResult(standardTicketInfoVo, result);
result.putAll(stringObjectMap);
//2. 安全措施转换map
List<StandardTicketMeasureVo> standardTicketMeasureVos = standardTicketInfoVo.getStandardTicketMeasureVos();
AtomicInteger index = new AtomicInteger(1);
if (CollectionUtil.isNotEmpty(standardTicketMeasureVos)) {
List<Map<String, Object>> measureMapLists = new ArrayList<>();
for (StandardTicketMeasureVo measure : standardTicketMeasureVos) {
Map<String, Object> map = PdfUtils.objectToMap(measure);
map.put("index", index.get());
map.put("status", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : "");
map.put("operationTime", measure.getOperationTime());
map.put("hello","");
map.put("hello1","");
index.getAndIncrement();
measureMapLists.add(map);
}
result.put("measureMapList", measureMapLists);
}else {
result.put("measureMapList", new ArrayList<>());
}
WordMapUtils.newMapWithList("measureMapList",result,false,17,null);
return result;
}
}

61
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -21,6 +22,7 @@ import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketMeasureDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketMeasureEntity;
import com.hnac.hzims.ticket.standardTicket.mapper.StandardTicketInfoMapper;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketMeasureService;
@ -28,6 +30,8 @@ import com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketMeasureVO;
import com.hnac.hzims.ticket.standardTicket.wrapper.StandardTicketInfoWrapper;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketMeasureVo;
import com.hnac.hzims.ticket.utils.ExcelUtil;
import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
@ -109,7 +113,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
@Override
public R<IPage<StandardTicketInfoVO>> queryList(StandardTicketInfoDto req, Query query) {
LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = this.getQueryWrapper(req);
queryWrapper.eq(Func.isNotEmpty(req.getCreateDept()),StandardTicketInfoEntity::getCreateDept,req.getCreateDept());
queryWrapper.eq(Func.isNotEmpty(req.getCreateDept()), StandardTicketInfoEntity::getCreateDept, req.getCreateDept());
queryWrapper.orderByDesc(StandardTicketInfoEntity::getCreateTime);
IPage pages = super.page(Condition.getPage(query), queryWrapper);
return R.data(pages.setRecords(StandardTicketInfoWrapper.build().listVO(pages.getRecords())));
@ -337,7 +341,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type",
areaVo.getTaskType());
//编号
queryWrapper.like(Func.isNotEmpty(areaVo.getCode()),"sti.code" , areaVo.getCode());
queryWrapper.like(Func.isNotEmpty(areaVo.getCode()), "sti.code", areaVo.getCode());
//状态
queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status",
areaVo.getStatus());
@ -386,9 +390,62 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
return bladePage;
}
/**
* 根据Id获取操作票详细信息
*
* @param ticketId
* @return
*/
@Override
public StandardTicketInfoVo selectDetailsById(Long ticketId) {
StandardTicketInfoVo standardTicketInfoVo = new StandardTicketInfoVo();
//1. 根据工作票Id查询操作票信息
StandardTicketInfoEntity standardTicketInfoEntity = baseMapper.selectById(ticketId);
BeanUtils.copyProperties(standardTicketInfoEntity,standardTicketInfoVo);
//2. 封装vo
transFrom(standardTicketInfoVo, standardTicketInfoEntity);
//2. 根据ticketId获取安全措施信息
List<StandardTicketMeasureEntity> standardTicketMeasure = measureService.listStandardByTicketId(ticketId);
if (CollectionUtils.isNotEmpty(standardTicketMeasure)){
List<StandardTicketMeasureVo> collect = standardTicketMeasure.stream().map(standardTicketMeasureEntity -> {
StandardTicketMeasureVo standardTicketMeasureVO = new StandardTicketMeasureVo();
BeanUtils.copyProperties(standardTicketMeasureEntity, standardTicketMeasureVO);
return standardTicketMeasureVO;
}).collect(Collectors.toList());
standardTicketInfoVo.setStandardTicketMeasureVos(collect);
}
return standardTicketInfoVo;
}
/**
* 封装Vo
* @param standardTicketInfoVo
* @param standardTicketInfoEntity
*/
private static void transFrom(StandardTicketInfoVo standardTicketInfoVo, StandardTicketInfoEntity standardTicketInfoEntity) {
User creator = UserCache.getUser(standardTicketInfoEntity.getCreateUser());
User updater = UserCache.getUser(standardTicketInfoEntity.getUpdateUser());
/*发令人、受令人、负责人、监护人*/
User issueOrderPerson = UserCache.getUser(standardTicketInfoEntity.getIssueOrderPerson());
User accessOrderPerson = UserCache.getUser(standardTicketInfoEntity.getAccessOrderPerson());
User principal = UserCache.getUser(standardTicketInfoEntity.getPrincipal());
User guardian = UserCache.getUser(standardTicketInfoEntity.getGuardian());
standardTicketInfoVo.setCreateUserName(Optional.ofNullable(creator).map(User::getName).orElse(null));
standardTicketInfoVo.setUpdateUserName(Optional.ofNullable(updater).map(User::getName).orElse(null));
standardTicketInfoVo.setIssueOrderPersonName(Optional.ofNullable(issueOrderPerson).map(User::getName).orElse(null));
standardTicketInfoVo.setAccessOrderPersonName(Optional.ofNullable(accessOrderPerson).map(User::getName).orElse(null));
standardTicketInfoVo.setPrincipalName(Optional.ofNullable(principal).map(User::getName).orElse(null));
standardTicketInfoVo.setGuardianName(Optional.ofNullable(guardian).map(User::getName).orElse(null));
}
/**
* 判断是否存在合格率 如果存在返回true 否则为false
*
* @param item
* @return
*/

13
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketMeasureServiceImpl.java

@ -3,6 +3,7 @@ package com.hnac.hzims.ticket.standardTicket.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.constants.TicketConstants;
@ -125,6 +126,18 @@ public class StandardTicketMeasureServiceImpl extends BaseServiceImpl<StandardTi
}
/**
* 根据ticketId获取安全措施信息
*
* @param ticketId
* @return
*/
@Override
public List<StandardTicketMeasureEntity> listStandardByTicketId(Long ticketId) {
return new LambdaQueryChainWrapper<StandardTicketMeasureEntity>(baseMapper)
.eq(StandardTicketMeasureEntity::getTicketId,ticketId).list();
}
/**
* 获取StandardTicketMeasureEntity - LambdaQueryWrapper
* @param req
* @return

121
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/utils/OperationWordHelper.java

@ -0,0 +1,121 @@
package com.hnac.hzims.ticket.standardTicket.utils;
import com.hnac.hzims.ticket.twoTicket.utils.WordHelper;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/6/7 17:00
*/
public class OperationWordHelper {
/**
* map验证是value否为null
*
* @param workTicketInfoMap
* @return
*/
public static Map<String, Object> resultMap(Map<String, Object> workTicketInfoMap) {
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<String, Object> entry : workTicketInfoMap.entrySet()) {
listEntryMap(resultMap, entry.getKey(), entry.getValue());
}
return resultMap;
}
/**
* 根据状态获取模板
* @param status
* @return
*/
public static String getWorkTicketStatus(Integer status) {
String result = null;
switch (status) {
case 0:
result = "电气操作票.docx";
default:
result = "电气操作票.docx";
}
return result;
}
@Data
@AllArgsConstructor
static class Entry {
/**
* key值
*/
private String fileName;
/**
* count
*/
private Integer count;
}
/**
* 判断是否存在如果不存在空格代替
* @param resultMap
* @param key
* @param value
*/
private static void listEntryMap(Map<String, Object> resultMap, String key, Object value) {
List<Entry> params = new ArrayList<>();
paramsList(params);
for (Entry entry : params) {
isEntryMap(resultMap, entry.getFileName(), key, value, entry.getCount());
}
}
/**
* 验证空格多少
* @param resultMap
* @param fileName
* @param key
* @param value
* @param count
*/
private static void isEntryMap(Map<String, Object> resultMap, String fileName, String key, Object value, Integer count) {
if (fileName.equals(key)) {
Object newValue = StringUtils.isNoneBlank(WordHelper.toString(value).trim()) ? value :
"\u00A0" + WordHelper.printSpace(count);
resultMap.put(key, newValue);
} else {
Object newValue = StringUtils.isNoneBlank(WordHelper.toString(value).trim()) ? value :
"\u00A0" + WordHelper.printSpace(5);
resultMap.put(key, newValue);
}
}
/**
* 存储数据要加载多少空格
* @param params
*/
private static void paramsList(List<Entry> params) {
params.add(new Entry("projectName", 10));
params.add(new Entry("classGroupName", 10));
params.add(new Entry("code", 10));
params.add(new Entry("accessOrderPersonName", 10));
params.add(new Entry("guardianName", 10));
params.add(new Entry("startTime", 10));
params.add(new Entry("endTime", 10));
params.add(new Entry("principalName", 10));
params.add(new Entry("principalTime", 10));
}
}

1
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -440,6 +440,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
message.setCreateUser(NumberUtils.toLong(userId));
messageClient.sendMessage(message);
log.info("推送消息成功,用户名称{},消息{}", user.getName(), message);
}
} catch (Exception e) {
e.printStackTrace();

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

@ -152,7 +152,7 @@ public class WordHelper extends StringUtils {
}
/**
*
*判断是否存在如果不存在空格代替
*/
public static void listEntryMap(Map<String, Object> result, String key, Object value) {
List<Entry> params = new ArrayList<>();

36
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketInfoVo.java

@ -107,12 +107,48 @@ public class StandardTicketInfoVo extends TenantEntity {
/**
* 项目
*/
@ApiModelProperty("项目")
private String projectName;
/**
*
*/
@ApiModelProperty("分组")
private String classGroupName;
/**
* 编号原站点ID
*/
@ApiModelProperty("编号(原站点ID)")
private String signageCode;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("更新人名称")
private String updateUserName;
@ApiModelProperty("来源类型名称")
private String taskTypeName;
@ApiModelProperty("发令人名称")
private String issueOrderPersonName;
@ApiModelProperty("受令人名称")
private String accessOrderPersonName;
@ApiModelProperty("负责人名称")
private String principalName;
@ApiModelProperty("许可人名称")
private String guardianName;
/**
* 安全措施
*/

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/operation/StandardTicketMeasureVo.java

@ -54,4 +54,9 @@ public class StandardTicketMeasureVo extends TenantEntity {
@ApiModelProperty("操作事项排序")
private Integer sort;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime operationTime;
}

Loading…
Cancel
Save