Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
4079fb09c6
  1. 54
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
  2. 1
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java
  3. 33
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java
  4. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  5. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  6. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  7. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java
  8. 16
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java
  9. 35
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java
  10. 1
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java
  11. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
  12. 54
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OperatorProcessServiceImpl.java
  13. 53
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/SignatureProcessServiceImpl.java
  14. 32
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/propperties/ThreadPoolConfigProperties.java
  15. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java
  16. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/constant/TicketProcessConstant.java
  17. 31
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/service/TicketProcessService.java
  18. 154
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneMakeProcessServiceImpl.java
  19. 126
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OnePrincipalProcessServiceImpl.java
  20. 124
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneReceptionProcessServiceImpl.java
  21. 127
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSafetyProcessServiceImpl.java
  22. 125
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSignProcessServiceImpl.java
  23. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IWorkTicketFinishService.java
  24. 596
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  25. 21
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java
  26. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketDelayService.java
  27. 7
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketPrincipalChangeService.java
  28. 245
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketDelayServiceImpl.java
  29. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketPrincipalChangeServiceImpl.java
  30. BIN
      hzims-service/ticket/src/main/resources/template/新电气第一种工作票模板.xlsx

54
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java

@ -20,34 +20,38 @@ import javax.annotation.Resource;
* @author hx * @author hx
*/ */
@FeignClient( @FeignClient(
value = MessageConstants.APP_NAME value = MessageConstants.APP_NAME,
fallback = MessageClientFallback.class
) )
public interface IMessageClient { public interface IMessageClient {
String API_PREFIX = "/feign/message"; String API_PREFIX = "/feign/message";
String SEND_SMS_MESSAGE = API_PREFIX + "/send-sms-message"; String SEND_SMS_MESSAGE = API_PREFIX + "/send-sms-message";
String SEND_MESSAGE = API_PREFIX + "/sendMessage"; String SEND_MESSAGE = API_PREFIX + "/sendMessage";
String GET_TEMPLATE_BY_ID = API_PREFIX + "/getMsgTemplateById"; String GET_TEMPLATE_BY_ID = API_PREFIX + "/getMsgTemplateById";
String PLAN_SEND_MESSAGE = API_PREFIX + "/planSendMessage"; String PLAN_SEND_MESSAGE = API_PREFIX + "/planSendMessage";
/**
* 推送消息短信
* @param pushDto
* @return
*/
@PostMapping(SEND_SMS_MESSAGE)
R sendSmsMessage(SmsPushDto pushDto);
@PostMapping(SEND_MESSAGE) /**
R<Boolean> sendMessage(@RequestBody MessagePushRecordDto request); * 推送消息短信
*
* @param pushDto
* @return
*/
@PostMapping(SEND_SMS_MESSAGE)
R sendSmsMessage(SmsPushDto pushDto);
@GetMapping(GET_TEMPLATE_BY_ID) @PostMapping(SEND_MESSAGE)
R<MessageTemplateEntity> getMsgTemplateById(@RequestParam Long id); R<Boolean> sendMessage(@RequestBody MessagePushRecordDto request);
/** @Author hx @GetMapping(GET_TEMPLATE_BY_ID)
* @Description 计划推送类型消息推送 R<MessageTemplateEntity> getMsgTemplateById(@RequestParam Long id);
* @Date 2023/4/14 15:04
* @Param /**
* @return * @return
**/ * @Author hx
@PostMapping(PLAN_SEND_MESSAGE) * @Description 计划推送类型消息推送
R<PlanMsgRecordDto> planSendMessage(@RequestBody PlanMsgRecordDto request); * @Date 2023/4/14 15:04
* @Param
**/
@PostMapping(PLAN_SEND_MESSAGE)
R<PlanMsgRecordDto> planSendMessage(@RequestBody PlanMsgRecordDto request);
} }

1
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java

@ -101,6 +101,7 @@ public interface TicketConstants {
SECOND_WORK("7","大隆水电站电气第二种工作票模板"), SECOND_WORK("7","大隆水电站电气第二种工作票模板"),
MECHANICAL_WORK("8","大隆水电站水力机械工作票模板"), MECHANICAL_WORK("8","大隆水电站水力机械工作票模板"),
EMERGENCY_REPAIR("9","大隆水电站事故应急抢修单模板"), EMERGENCY_REPAIR("9","大隆水电站事故应急抢修单模板"),
NEW_FIRST_WORK("10","新电气第一种工作票模板"),
; ;
@Getter @Getter
private String type; private String type;

33
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java

@ -412,14 +412,41 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
/** /**
* 工作确认是否通过 delay 工作票延期 transfe 工作票转移 true 通过 * 工作确认是否通过 input= 延期 input=转移 input 通过
*/ */
@ApiModelProperty("工作确认是否通过 (delay 工作票延期 transfe 工作票转移 true 通过 )") @ApiModelProperty("input= 延期 input=转移 input 通过")
private String flag; private String input;
/**
* 下一个审批人
*/
@ApiModelProperty("下一个审批人")
private Long nextStepOperator;
/**
* 当前审批人
*/
@ApiModelProperty("当前审批人")
private Long stepOperator;
/**
* 当前任务名
*/
@ApiModelProperty("当前任务名")
private String flowTaskName;
/**
* 当前任务名
*/
@ApiModelProperty("当前任务名")
private String flowTaskId;
} }

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java

@ -1,6 +1,6 @@
package com.hnac.hzims.spare.service.impl; package com.hnac.hzims.spare.service.impl;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;

10
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -203,8 +203,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
// FIXME 下载至 response // FIXME 下载至 response
this.downloadZip(response,zipFile); this.downloadZip(response,zipFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -598,7 +596,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
// 查询巡检任务项目 // 查询巡检任务项目
List<TaskObjectProjectOfflineVO> taskObjectProjects = taskObjectProjectService.getObjectProjectData(taskIds); List<TaskObjectProjectOfflineVO> taskObjectProjects = taskObjectProjectService.getObjectProjectData(taskIds);
// 返回数据 // 返回数据
return taskObjectProjects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return taskObjectProjects.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -616,7 +614,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
in(TaskObjectProjectContentEntity::getTaskId, taskIds); in(TaskObjectProjectContentEntity::getTaskId, taskIds);
}}); }});
// 返回数据 // 返回数据
return contents.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -631,7 +629,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
// 查询巡检对象 // 查询巡检对象
List<ObjectOfflineVO> objects = objectService.getReDbjectData(tenantId); List<ObjectOfflineVO> objects = objectService.getReDbjectData(tenantId);
// 返回数据 // 返回数据
return objects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return objects.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -646,7 +644,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
// 查询巡检项目 // 查询巡检项目
List<ProjectOfflineVO> projects = projectService.getProjectData(tenantId); List<ProjectOfflineVO> projects = projectService.getProjectData(tenantId);
// 返回数据 // 返回数据
return projects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return projects.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -251,7 +251,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
} }
// 查询当天类型处理告警 // 查询当天类型处理告警
List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.INTELLIGENCE_ALARM); List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM);
// 返回数据 // 返回数据
AlarmReustVo response = new AlarmReustVo(); AlarmReustVo response = new AlarmReustVo();

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java

@ -44,8 +44,9 @@ public abstract class TemplateAbstractService implements TemplateService {
private void saveData(PlanMsgRecordDto list) { private void saveData(PlanMsgRecordDto list) {
log.info("正在保存推送的数据"); log.info("正在保存推送的数据");
R<PlanMsgRecordDto> planMsgRecordDtoR = messageClient.planSendMessage(list); R<PlanMsgRecordDto> planMsgRecordDtoR = messageClient.planSendMessage(list);
if (planMsgRecordDtoR.isSuccess()) { if (!planMsgRecordDtoR.isSuccess()) {
throw new ServiceException(planMsgRecordDtoR.getMsg()); log.error("业务出错呢:{}", planMsgRecordDtoR.getMsg());
throw new ServiceException("推送的数据,远程调用失败");
} }
} }
@ -57,3 +58,4 @@ public abstract class TemplateAbstractService implements TemplateService {
*/ */
public abstract PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord); public abstract PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord);
} }

16
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java

@ -11,13 +11,15 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
/** /**
* 日常维护计划 * 安全维护计划
* *
* @Author WL * @Author WL
* @Version v1.0 * @Version v1.0
@ -36,12 +38,16 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService {
@Override @Override
public PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord) { public PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("one", Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse("")); String name = Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse("");
map.put("two", planMsgRecord.getPlanTime()); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String planTime = dateTimeFormatter.format(planMsgRecord.getPlanTime());
map.put("one", name);
map.put("two", planTime);
// planMsgRecord.setContent(JSON.toJSONString(map)); // planMsgRecord.setContent(JSON.toJSONString(map));
planMsgRecord.setSmsParam(JSON.toJSONString(map)); planMsgRecord.setSmsParam(JSON.toJSONString(map));
planMsgRecord.setResourceCode("aliyun-safeTool-push"); planMsgRecord.setResourceCode("aliyun-safeTool-push");
planMsgRecord.setContent(JSON.toJSONString(map)); planMsgRecord.setContent("【华自科技】工器具检查提醒:工器具(+" +
name + ")将于" + planTime + "到检查时间,请安排时间复核!");
return planMsgRecord; return planMsgRecord;
} }
@ -56,4 +62,6 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService {
} }
} }

35
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java

@ -0,0 +1,35 @@
package com.hnac.hzims.ticket.config;
import com.hnac.hzims.ticket.propperties.ThreadPoolConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/10 12:49
*/
@Configuration
public class ThreadConfig {
@Autowired
private ThreadPoolConfigProperties threadPoolConfigProperties;
// @Bean
public ThreadPoolExecutor threadPoolExecutor() {
return new ThreadPoolExecutor(threadPoolConfigProperties.getCorePoolSize(),
threadPoolConfigProperties.getMaxSize(),
threadPoolConfigProperties.getKeepAliveTime(),
TimeUnit.SECONDS,
new LinkedBlockingDeque<>(threadPoolConfigProperties.getCapacity()),
Executors.defaultThreadFactory(),
new ThreadPoolExecutor.AbortPolicy());
}
}

1
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java

@ -50,6 +50,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
try { try {
ticketService.calculate(response); ticketService.calculate(response);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
//todo 业务出错误 做补偿 //todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage()); log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.error("业务出错,StandardWorkTicketConsumer: {} ", response); log.error("业务出错,StandardWorkTicketConsumer: {} ", response);

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeProcessServiceImpl.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java

@ -1,18 +1,14 @@
package com.hnac.hzims.ticket.processflow.strategy.serviceimpl; package com.hnac.hzims.ticket.processflow.strategy.serviceimpl;
import com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant; import com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant;
import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService; import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 开工作票流程实现类 * 开工作票流程实现类
* *
@ -24,7 +20,7 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class MakeProcessServiceImpl extends ProcessAbstractService { public class OneTicketProcessServiceImpl extends ProcessAbstractService {
@ -39,12 +35,12 @@ public class MakeProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行开工作票流程环节操作~~~~,流程ticket: {}", flowQueue); log.info("是否执行开第一种工作票流程环节操作~~~~,流程ticket: {}", flowQueue);
if (TicketProcessConstant.STARTEVENT.equals(flowQueue.getProcessDefinitionKey())) { if (TicketProcessConstant.STARTEVENT.equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行开工作票流程环节操作~~~~"); log.info("已执行第一种开工作票流程环节操作~~~~");
return true; return true;
} }
log.error("未是否执行开工作票流程环节操作,请联系管理员~~~~"); log.error("未是否执行第一种开工作票流程环节操作,请联系管理员~~~~");
return false; return false;
} }

54
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OperatorProcessServiceImpl.java

@ -1,54 +0,0 @@
package com.hnac.hzims.ticket.processflow.strategy.serviceimpl;
import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 运行人实例类 运行人接收
*
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/28 8:47
*/
@Slf4j
@Service
public class OperatorProcessServiceImpl extends ProcessAbstractService {
/**
* 设置执行那种实现类
*
* @param flowQueue
* @return
*/
@Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue);
List<ProcessType> ticketList = this.getProcessList();
ProcessType properties = ticketList.get(2);
if (properties.getDeploymentId().equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行运行人接收操作~~~~");
return true;
}
log.info("未执行运行人接收操作,请联系管理员~~~~");
return false;
}
/**
* 两票管理业务方法
*
* @param response
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
System.out.println("OperatorTicketServiceImpl");
}
}

53
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/SignatureProcessServiceImpl.java

@ -1,53 +0,0 @@
package com.hnac.hzims.ticket.processflow.strategy.serviceimpl;
import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 签发人实现类签发人签发
*
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/27 16:40
*/
@Slf4j
@Service
public class SignatureProcessServiceImpl extends ProcessAbstractService {
/**
* 设置执行那种实现类
*
* @param flowQueue
* @return
*/
@Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue);
List<ProcessType> ticketList = this.getProcessList();
ProcessType properties = ticketList.get(1);
if (properties.getDeploymentId().equals(flowQueue.getProcessDefinitionKey())){
log.info("已执行运行人接收操作~~~~");
return true;
}
log.info("未执行运行人接收操作,请联系管理员~~~~");
return false;
}
/**
* 两票管理业务方法
*
* @param response
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
System.out.println("SignatureTicketServiceImpl");
}
}

32
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/propperties/ThreadPoolConfigProperties.java

@ -0,0 +1,32 @@
package com.hnac.hzims.ticket.propperties;
import lombok.Data;
import org.springframework.context.annotation.Configuration;
/**
*
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/10 12:51
*/
@Configuration
@Data
public class ThreadPoolConfigProperties {
/**
* 核心数
*/
private Integer corePoolSize = 20;
/**
* 最大数
*/
private Integer maxSize = 200;
/**
* 存活时间
*/
private Integer keepAliveTime = 20;
/**
* 容量
*/
private Integer capacity = 10000;
}

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java

@ -38,9 +38,6 @@ public class TicketProcessController {
private final TicketProcessService ticketProcessService; private final TicketProcessService ticketProcessService;
/** /**
* 启动流程 * 启动流程
* @return * @return

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/constant/TicketProcessConstant.java

@ -1,14 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.constant;
/**
* 开票常量类
*
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 10:53
*/
public class TicketProcessConstant {
public final static String WORKTICKET = "workTicket";
}

31
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/service/TicketProcessService.java

@ -1,31 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.service;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/5 8:21
*/
public interface TicketProcessService {
/**
* 判断状态
* @param processDefinitionKey
* @param enumByStatus
* @return
*/
Boolean isStatus(String processDefinitionKey, FlowWorkTicketConstants enumByStatus);
/**
* 执行业务
* @param response
* @param workTicketVo
*/
void execute(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo);
}

154
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneMakeProcessServiceImpl.java

@ -1,154 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.serviceimpl.oneserviceImpl;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.flowprocess.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketSafetyMeasureService;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.Func;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.START;
import static com.hnac.hzims.ticket.twoTicket.flowprocess.constant.TicketProcessConstant.WORKTICKET;
/**
* 开票
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/5 8:36
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class OneMakeProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final IWorkTicketInfoService workTicketInfoService;
private final ProcessIdWorker processIdWorker;
private final IFirstWorkTicketService firstWorkTicketService;
private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService;
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IOperAccessTaskClient operAccessTaskClient;
private final ITaskClient taskClient;
private final IAccessTaskClient accessTaskClient;
private String newFirstWorkTicketFlowKey = "workTicket";
private final IStationClient stationClient;
private final WorkTicketOperateTimeServiceImpl workTicketOperateTimeServiceImpl;
private final IWorkTicketFinishService workTicketFinishService;
private final WorkTicketDelayServiceImpl workTicketDelayService;
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService;
/**
* 判断状态
* @param processDefinitionKey
* @param enumByStatus
* @return
*/
@Override
public Boolean isStatus(String processDefinitionKey, FlowWorkTicketConstants enumByStatus) {
if (WORKTICKET.equals(processDefinitionKey) && START.equals(enumByStatus)){
log.info("执行开票业务成功,正准备处理开票业务逻辑~~~~");
return true;
}
log.error("执行开票业务出错~~~");
return false;
}
/**
* 执行业务
* @param response
* @param workTicketVo
*/
@Override
public void execute(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setProcessInstanceId(response.getProcessInstanceId());
workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN.getDescription());
//保存工作流实例ID
workTicketInfoService.updateById(workTicket);
//处理来源任务
this.returnTicket(workTicketVo);
}
/**
* 处理来源任务
*
* @param workTicketVo
*/
private void returnTicket(WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(workTicket.getTaskType())) {
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity();
taskEntity.setId(workTicket.getTaskId());
taskEntity.setTicketId(workTicket.getId());
operAccessTaskClient.updateById(taskEntity);
}
if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(workTicket.getTaskType())) {
OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO();
dto.setId(workTicket.getTaskId());
dto.setTicketId(workTicket.getId());
taskClient.doUpdateTaskById(dto);
}
//消缺流程进行
if ((TicketConstants.TaskTypeEnum.JXRW.getType().equals(workTicket.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(workTicket.getTaskType())) && Func.isNotEmpty(workTicket.getTaskId())) {
accessTaskClient.billing(workTicket.getTaskId());
}
}
}

126
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OnePrincipalProcessServiceImpl.java

@ -1,126 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.serviceimpl.oneserviceImpl;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.flowprocess.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketSafetyMeasureService;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.*;
import static com.hnac.hzims.ticket.twoTicket.flowprocess.constant.TicketProcessConstant.WORKTICKET;
/**
* 工作负责人确认安全措施
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/5 8:36
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class OnePrincipalProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final IWorkTicketInfoService workTicketInfoService;
private final ProcessIdWorker processIdWorker;
private final IFirstWorkTicketService firstWorkTicketService;
private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService;
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IOperAccessTaskClient operAccessTaskClient;
private final ITaskClient taskClient;
private final IAccessTaskClient accessTaskClient;
private String newFirstWorkTicketFlowKey = "workTicket";
private final IStationClient stationClient;
private final WorkTicketOperateTimeServiceImpl workTicketOperateTimeServiceImpl;
private final IWorkTicketFinishService workTicketFinishService;
private final WorkTicketDelayServiceImpl workTicketDelayService;
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService;
/**
* 判断状态
* @param processDefinitionKey
* @param enumByStatus
* @return
*/
@Override
public Boolean isStatus(String processDefinitionKey, FlowWorkTicketConstants enumByStatus) {
if (WORKTICKET.equals(processDefinitionKey) && PRINCIPAL_CONFIRM_MEASURE.equals(enumByStatus)){
log.info("执行运行人员布置安全措施业务成功,正准备处理签发人签发业务逻辑~~~~");
return true;
}
log.error("执行运行人员布置安全措施业务出错~~~");
return false;
}
/**
* 执行业务
* @param response
* @param workTicketVo
*/
@Override
public void execute(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
//负责人确认时间
//workTicket.setConfirmDateTime(workTicketVo.getWorkTicket().getConfirmDateTime());
workTicket.setFlowStatus(PRINCIPAL_CONFIRM_MEASURE.getStatus());
workTicket.setFlowDescription(PRINCIPAL_CONFIRM_MEASURE.getDescription());
//更新状态值
workTicketInfoService.updateById(workTicket);
}
}

124
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneReceptionProcessServiceImpl.java

@ -1,124 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.serviceimpl.oneserviceImpl;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.flowprocess.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketSafetyMeasureService;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.RECEIVE;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.START;
import static com.hnac.hzims.ticket.twoTicket.flowprocess.constant.TicketProcessConstant.WORKTICKET;
/**
* 运功人接收
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/5 8:36
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class OneReceptionProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final IWorkTicketInfoService workTicketInfoService;
private final ProcessIdWorker processIdWorker;
private final IFirstWorkTicketService firstWorkTicketService;
private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService;
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IOperAccessTaskClient operAccessTaskClient;
private final ITaskClient taskClient;
private final IAccessTaskClient accessTaskClient;
private String newFirstWorkTicketFlowKey = "workTicket";
private final IStationClient stationClient;
private final WorkTicketOperateTimeServiceImpl workTicketOperateTimeServiceImpl;
private final IWorkTicketFinishService workTicketFinishService;
private final WorkTicketDelayServiceImpl workTicketDelayService;
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService;
/**
* 判断状态
* @param processDefinitionKey
* @param enumByStatus
* @return
*/
@Override
public Boolean isStatus(String processDefinitionKey, FlowWorkTicketConstants enumByStatus) {
if (WORKTICKET.equals(processDefinitionKey) && RECEIVE.equals(enumByStatus)){
log.info("执行签发人签发业务成功,正准备处理签发人签发业务逻辑~~~~");
return true;
}
log.error("执行签发人签发业务出错~~~");
return false;
}
/**
* 执行业务
* @param response
* @param workTicketVo
*/
@Override
public void execute(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.FIX_UP.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.FIX_UP.getDescription());
//更新状态值
workTicketInfoService.updateById(workTicket);
}
}

127
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSafetyProcessServiceImpl.java

@ -1,127 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.serviceimpl.oneserviceImpl;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.flowprocess.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketSafetyMeasureService;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.FIX_UP;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.START;
import static com.hnac.hzims.ticket.twoTicket.flowprocess.constant.TicketProcessConstant.WORKTICKET;
/**
* 运行人员布置安全措施
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/5 8:36
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class OneSafetyProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final IWorkTicketInfoService workTicketInfoService;
private final ProcessIdWorker processIdWorker;
private final IFirstWorkTicketService firstWorkTicketService;
private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService;
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IOperAccessTaskClient operAccessTaskClient;
private final ITaskClient taskClient;
private final IAccessTaskClient accessTaskClient;
private String newFirstWorkTicketFlowKey = "workTicket";
private final IStationClient stationClient;
private final WorkTicketOperateTimeServiceImpl workTicketOperateTimeServiceImpl;
private final IWorkTicketFinishService workTicketFinishService;
private final WorkTicketDelayServiceImpl workTicketDelayService;
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService;
/**
* 判断状态
* @param processDefinitionKey
* @param enumByStatus
* @return
*/
@Override
public Boolean isStatus(String processDefinitionKey, FlowWorkTicketConstants enumByStatus) {
if (WORKTICKET.equals(processDefinitionKey) && FIX_UP.equals(enumByStatus)){
log.info("执行运行人员布置安全措施业务成功,正准备处理签发人签发业务逻辑~~~~");
return true;
}
log.error("执行运行人员布置安全措施业务出错~~~");
return false;
}
/**
* 执行业务
* @param response
* @param workTicketVo
*/
@Override
public void execute(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
//值班负责人
workTicket.setWatchPrincipal(workTicketVo.getWorkTicket().getPrincipal());
workTicket.setWatchPrincipalEndTime(workTicketVo.getWorkTicket().getWatchPrincipalEndTime());
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getDescription());
//更新状态值
workTicketInfoService.updateById(workTicket);
}
}

125
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSignProcessServiceImpl.java

@ -1,125 +0,0 @@
package com.hnac.hzims.ticket.twoTicket.flowprocess.serviceimpl.oneserviceImpl;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.flowprocess.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketSafetyMeasureService;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.SIGN;
import static com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants.START;
import static com.hnac.hzims.ticket.twoTicket.flowprocess.constant.TicketProcessConstant.WORKTICKET;
/**
* 签发人签发
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/5 8:36
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class OneSignProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final IWorkTicketInfoService workTicketInfoService;
private final ProcessIdWorker processIdWorker;
private final IFirstWorkTicketService firstWorkTicketService;
private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService;
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IOperAccessTaskClient operAccessTaskClient;
private final ITaskClient taskClient;
private final IAccessTaskClient accessTaskClient;
private String newFirstWorkTicketFlowKey = "workTicket";
private final IStationClient stationClient;
private final WorkTicketOperateTimeServiceImpl workTicketOperateTimeServiceImpl;
private final IWorkTicketFinishService workTicketFinishService;
private final WorkTicketDelayServiceImpl workTicketDelayService;
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService;
/**
* 判断状态
* @param processDefinitionKey
* @param enumByStatus
* @return
*/
@Override
public Boolean isStatus(String processDefinitionKey, FlowWorkTicketConstants enumByStatus) {
if (WORKTICKET.equals(processDefinitionKey) && SIGN.equals(enumByStatus)){
log.info("执行签发人签发业务成功,正准备处理签发人签发业务逻辑~~~~");
return true;
}
log.error("执行签发人签发业务出错~~~");
return false;
}
/**
* 执行业务
* @param response
* @param workTicketVo
*/
@Override
public void execute(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicketInfoEntity = workTicketVo.getWorkTicket();
//更新状态值
workTicketInfoEntity.setFlowStatus(FlowWorkTicketConstants.RECEIVE.getStatus());
workTicketInfoEntity.setFlowDescription(FlowWorkTicketConstants.RECEIVE.getDescription());
workTicketInfoEntity.setSignerDateTime(workTicketVo.getWorkTicket().getSignerDateTime());
workTicketInfoService.updateById(workTicketInfoEntity);
}
}

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

@ -19,4 +19,10 @@ public interface IWorkTicketFinishService extends IService<WorkTicketFinish> {
* @return * @return
*/ */
WorkTicketFinish selectByTicketId(Long ticketId); WorkTicketFinish selectByTicketId(Long ticketId);
/**
* 更新
* @param workTicketFinish
*/
void updateByTicketId(WorkTicketFinish workTicketFinish);
} }

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

@ -1,10 +1,12 @@
package com.hnac.hzims.ticket.twoTicket.service.impl; package com.hnac.hzims.ticket.twoTicket.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
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.toolkit.CollectionUtils; 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.core.toolkit.ObjectUtils;
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;
@ -19,7 +21,6 @@ import com.hnac.hzims.ticket.constants.WorkTicketConstants;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker; import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish;
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
@ -31,14 +32,14 @@ import com.hnac.hzims.ticket.workTicket.entity.*;
import com.hnac.hzims.ticket.workTicket.service.*; import com.hnac.hzims.ticket.workTicket.service.*;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl; import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl; import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketSafetyMeasureVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -54,9 +55,10 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.Instant; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -69,9 +71,9 @@ import java.util.stream.Collectors;
* @Serial 1.0 * @Serial 1.0
* @Date 2023/4/8 11:11 * @Date 2023/4/8 11:11
*/ */
@Service
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
@Service
public class TicketProcessServiceImpl implements TicketProcessService { public class TicketProcessServiceImpl implements TicketProcessService {
@ -120,10 +122,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService;
private final List<TicketProcessService> processService;
private final IWorkTicketOperateTimeService workTicketOperateTimeService; private final IWorkTicketOperateTimeService workTicketOperateTimeService;
@ -141,13 +139,14 @@ public class TicketProcessServiceImpl implements TicketProcessService {
* *
* @param workTicketVo * @param workTicketVo
*/ */
@SneakyThrows
@Override @Override
@Transactional @Transactional
public void startUp(WorkTicketVo workTicketVo) { public void startUp(WorkTicketVo workTicketVo) {
log.info("执行 com.hnac.hzims.ticket.twoTicket.service.impl【startUp】 。。。方法");
if (workTicketVo.getWorkTicket().getSignage() == null) { if (workTicketVo.getWorkTicket().getSignage() == null) {
throw new ServiceException("站点标识-两票编码不能为空"); throw new ServiceException("站点标识-两票编码不能为空");
} }
//1. 获取站点站点标识-两票编码
StationEntity stationEntity = new StationEntity(); StationEntity stationEntity = new StationEntity();
stationEntity.setCode(workTicketVo.getWorkTicket().getSignageCode()); stationEntity.setCode(workTicketVo.getWorkTicket().getSignageCode());
R<StationEntity> stationClientOne = stationClient.getOne(stationEntity); R<StationEntity> stationClientOne = stationClient.getOne(stationEntity);
@ -158,7 +157,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
if (station == null) { if (station == null) {
throw new ServiceException("根据条件获取唯一站点暂无数据"); throw new ServiceException("根据条件获取唯一站点暂无数据");
} }
log.info("前端查的站点编号 :{}", workTicketVo.getWorkTicket().getSignage()); log.info("前端查的站点编号 :{}", workTicketVo.getWorkTicket().getSignage());
log.info("后端查寻的站点编码 :{}", station.getSignage()); log.info("后端查寻的站点编码 :{}", station.getSignage());
if (!workTicketVo.getWorkTicket().getSignage().equals(station.getSignage())) { if (!workTicketVo.getWorkTicket().getSignage().equals(station.getSignage())) {
@ -170,24 +168,24 @@ public class TicketProcessServiceImpl implements TicketProcessService {
if (StringUtils.isBlank(signage) || signage.length() < 2) { if (StringUtils.isBlank(signage) || signage.length() < 2) {
throw new ServiceException("站点标识-两票编码不能为空"); throw new ServiceException("站点标识-两票编码不能为空");
} }
signage = signage.length() == 2 ? station.getSignage() : station.getSignage().substring(0, 2); signage = signage.length() == 2 ? station.getSignage() : station.getSignage().substring(0, 2);
workTicketVo.getWorkTicket().setSignage(signage); workTicketVo.getWorkTicket().setSignage(signage);
workTicketVo.getWorkTicket().setSignageCode(station.getCode()); workTicketVo.getWorkTicket().setSignageCode(station.getCode());
//2. 获取编码 //2. 获取编码
String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), workTicketVo.getWorkTicket().getType(), LocalDateTime.now());
workTicketVo.getWorkTicket().getType(), LocalDateTime.now());
workTicketVo.getWorkTicket().setCode(code); workTicketVo.getWorkTicket().setCode(code);
//2 .保存工作对象 //3 .保存工作对象
this.saveWorkTicketInfo(workTicketVo.getWorkTicket()); this.saveWorkTicketInfo(workTicketVo.getWorkTicket());
//3. 保存安全措施 //4. 保存安全措施
log.info("获取报存安全措施:{}", workTicketVo.getSafetyMeasuresList());
this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket());
//4. 保存工作任务 //5. 保存工作任务
this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket());
//5. 开启动作流 //6. 开启动作流
this.dealProcess(newFirstWorkTicketFlowKey, workTicketVo); this.dealProcess(newFirstWorkTicketFlowKey, workTicketVo);
//7. 处理任务
this.returnTicket(workTicketVo);
} }
/** /**
@ -196,15 +194,13 @@ public class TicketProcessServiceImpl implements TicketProcessService {
* @param response * @param response
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void findPending(ProcessWorkFlowResponse response) { public void findPending(ProcessWorkFlowResponse response) {
log.info("获取待处理的数据 {}", response); log.info("获取待处理的数据 {}", response);
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());
if (StringUtils.isNull(response.getTaskId())) { log.info("获取当前任务名称是: {}", response.getTaskName());
log.info("工作流结束~~~");
return;
}
//json转换表单 //json转换表单
String formData = JSON.toJSONString(response.getVariables()); String formData = JSON.toJSONString(response.getVariables());
log.info("获取表单的数据:{}", formData); log.info("获取表单的数据:{}", formData);
@ -212,12 +208,8 @@ public class TicketProcessServiceImpl implements TicketProcessService {
try { try {
fristWorkFlowResponse = JSONObject.parseObject(formData, FristWorkTicketVo.class); fristWorkFlowResponse = JSONObject.parseObject(formData, FristWorkTicketVo.class);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取表单出现异常了~~~~");
} throw new IllegalArgumentException(e.getMessage());
if (ObjectUtils.isEmpty(fristWorkFlowResponse)) {
log.error("获取表单的数据解析的数据为null");
return;
} }
//获取表单数据 //获取表单数据
WorkTicketVo workTicketVo = fristWorkFlowResponse.getWorkTicketVo(); WorkTicketVo workTicketVo = fristWorkFlowResponse.getWorkTicketVo();
@ -225,20 +217,16 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//2.流程处理 //2.流程处理
String businessKey = response.getBusinessKey(); String businessKey = response.getBusinessKey();
WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(businessKey); WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(businessKey);
if (ObjectUtils.isEmpty(workTicketInfo) || ObjectUtils.isEmpty(workTicket.getId())) { if (ObjectUtils.isEmpty(workTicketInfo)) {
log.error("获取工作票的数据为不存在"); log.error("获取工作票的数据为不存在");
return; return;
} }
//更新工作票 //更新工作票
if (workTicket.getId() == null) { workTicket.setId(workTicketInfo.getId());
workTicket.setId(workTicketInfo.getId()); //保存流程描述
} saveWorkTicket(workTicket, response);
//工作流ID //工作流ID
if (StringUtils.isEmpty(workTicketInfo.getProcessInstanceId())) { workTicket.setProcessInstanceId(response.getProcessInstanceId());
workTicket.setProcessInstanceId(response.getProcessInstanceId());
}
workTicketInfoService.updateById(workTicket); workTicketInfoService.updateById(workTicket);
//更新安全措施 //更新安全措施
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
@ -255,367 +243,194 @@ public class TicketProcessServiceImpl implements TicketProcessService {
}); });
} }
//工作票工作任务组 //工作票工作任务组
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); // List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList();
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { // if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) {
log.info("获取工作票工作任务组:{}", workTicketContentDtoList); // log.info("获取工作票工作任务组:{}", workTicketContentDtoList);
workTicketContentDtoList.forEach(item -> { // workTicketContentDtoList.forEach(item -> {
if (ObjectUtils.isEmpty(item.getId())) { // if (ObjectUtils.isEmpty(item.getId())) {
LambdaQueryWrapper<WorkTicketContentEntity> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<WorkTicketContentEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketContentEntity::getTicketId, workTicketInfo.getId()); // queryWrapper.eq(WorkTicketContentEntity::getTicketId, workTicketInfo.getId());
contentService.update(item, queryWrapper); // contentService.update(item, queryWrapper);
} else { // } else {
contentService.updateById(item); // contentService.updateById(item);
} // }
}); // });
} // }
// 工作票延期 // 工作票延期
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay();
if (ObjectUtils.isNotEmpty(workTicketDelay) && ObjectUtils.isNotEmpty(workTicketDelay.getCreateUser())) { try {
log.info("获取工作票延期:{}", workTicketDelay); if (ObjectUtils.isNotEmpty(workTicketDelay) && "延期".equals(workTicket.getInput())) {
try {
workTicketDelay.setCreateDept(workTicket.getCreateDept()); WorkTicketDelayEntity workTicketDelayEntity = workTicketDelayService.selectByTicketId(workTicketInfo.getId());
log.info("获取工作票延期:{}", workTicketDelay);
workTicketDelay.setCreateDept(workTicketInfo.getCreateDept());
workTicketDelay.setTicketId(workTicketInfo.getId()); workTicketDelay.setTicketId(workTicketInfo.getId());
workTicketDelay.setTenantId(workTicketInfo.getTenantId()); workTicketDelay.setTenantId(workTicketInfo.getTenantId());
if (ObjectUtils.isEmpty(workTicketDelay.getId())) { if (ObjectUtils.isEmpty(workTicketDelay.getId()) || ObjectUtils.isEmpty(workTicketDelayEntity)) {
workTicketDelayService.save(workTicketDelay); workTicketDelayService.save(workTicketDelay);
} else { } else {
workTicketDelayService.updateById(workTicketDelay); workTicketDelayService.updateByTicketId(workTicketDelay);
} }
} catch (Exception e) {
e.printStackTrace();
} }
} catch (Exception e) {
e.printStackTrace();
} }
//工作结束 //工作结束
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish();
if (ObjectUtils.isNotEmpty(workTicketFinish) && ObjectUtils.isNotEmpty(workTicketFinish.getPrincipal())) { try {
log.info("获取工作结束:{}", workTicketFinish); if (ObjectUtils.isNotEmpty(workTicketFinish) && 99 == workTicket.getFlowStatus().intValue()) {
if (ObjectUtils.isEmpty(workTicketFinish.getId())) { WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId());
workTicketDelay.setTicketId(workTicketInfo.getId()); log.info("获取工作结束:{}", workTicketFinish);
//workTicketDelay.setInitialTime(LocalDateTime.now()); if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) {
workTicketFinishService.save(workTicketFinish); workTicketFinish.setTicketId(workTicketInfo.getId());
} else { workTicketFinishService.save(workTicketFinish);
workTicketDelay.setInitialTime(LocalDateTime.now()); } else {
workTicketFinishService.updateById(workTicketFinish); workTicketDelay.setInitialTime(LocalDateTime.now());
workTicketFinishService.updateByTicketId(workTicketFinish);
}
} }
} catch (Exception e) {
e.printStackTrace();
} }
//工作开始时间和结束时间 //工作开始时间和结束时间
List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities(); // List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) { // if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) {
log.info("工作开始时间和结束时间:{}", workTicketFinish); // log.info("工作开始时间和结束时间:{}", workTicketFinish);
workTicketOperateTimeService.saveBatch(workTicketOperateTimeEntities); // workTicketOperateTimeService.saveBatch(workTicketOperateTimeEntities);
}
//工作票负责人变更
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange();
if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && workTicketPrincipalChange.getInitialPrincipal() != null) {
log.info("工作票负责人变更: {}", workTicketPrincipalChange);
//原来的负责人
User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal());
//新的负责人
User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal());
workTicketPrincipalChange.setCreateDept(workTicket.getCreateDept());
workTicketPrincipalChange.setTicketId(workTicketInfo.getId());
workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId());
if (workTicketPrincipalChange.getId() == null) {
workTicketPrincipalChangeService.save(workTicketPrincipalChange);
} else {
workTicketPrincipalChangeService.updateById(workTicketPrincipalChange);
}
log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName());
workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal());
workTicket.setPrincipalName(newUser.getName());
//更新工作票
workTicketInfoService.updateById(workTicket);
}
// WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(workTicket.getId());
// Integer flowStatus = workTicketInfo.getFlowStatus();
// FlowWorkTicketConstants enumByStatus = FlowWorkTicketConstants.getEnumByStatus(flowStatus);
// ProcessService dbProcessService = processService.stream().filter(item -> item.isStatus(response.getProcessDefinitionKey(),
// enumByStatus)).findFirst().orElse(null);
// dbProcessService.execute(response,workTicketVo);
//
// switch (enumByStatus) {
// case START:
// //开票
// make(response, workTicketVo);
// break;
// case SIGN:
// //签发人签发
// //工作票签发人默认执行
// sign(response, workTicketVo);
// break;
// case RECEIVE:
// //运功人接收
// reception(response, workTicketVo);
// break;
// case FIX_UP:
// // 运行人员布置安全措施
// safety(response, workTicketVo);
// break;
// case PRINCIPAL_CONFIRM_MEASURE:
// //工作负责人确认安全措施
// principal(response, workTicketVo);
// break;
// case LICENCE:
// //许可人许可
// license(response, workTicketVo);
// break;
// case PRINCIPAL_CONFIRM_CONTENT:
// //工作负责人确认工作内容执行
// principalConfirmContent(response, workTicketVo);
// break;
// case PRINCIPAL_CONFIRM_END:
// //工作负责人确认工作票结束
// principalConfirmEnd(response, workTicketVo);
// break;
// case LICENSE_CONFIRM_END:
// //许可人确认工作票结束
// licenseConfirmEnd(response, workTicketVo);
// break;
// case PROCESS_POSTPONE:
// //工作票延期
// processPostpone(response, workTicketVo);
// break;
// case PROCESS_COURSE:
// //工作票转移
// processCourse(response, workTicketVo);
// break;
// case SIGN_CONFIRM_DELAY:
// //签发人审核
// signConfirmDelay(response, workTicketVo);
// break;
// } // }
}
/**
* 签发人审核
*
* @param response
* @param workTicketVo
*/
private void signConfirmDelay(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription());
workTicketInfoService.updateById(workTicket);
}
/**
* 工作票转移
*
* @param response
* @param workTicketVo
*/
private void processCourse(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
//工作票负责人变更 //工作票负责人变更
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange();
workTicketPrincipalChangeService.save(workTicketPrincipalChange); try {
//更新工作票信息 if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && "转移".equals(workTicket.getInput())) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); log.info("工作票负责人变更: {}", workTicketPrincipalChange);
workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN_CONFIRM_DELAY.getStatus()); //原来的负责人
workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN_CONFIRM_DELAY.getDescription()); User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal());
workTicketInfoService.updateById(workTicket); //新的负责人
User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal());
workTicketPrincipalChange.setCreateDept(workTicketInfo.getCreateDept());
} workTicketPrincipalChange.setTicketId(workTicketInfo.getId());
workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId());
if (workTicketPrincipalChange.getFlowCode() == null) {
/** workTicketPrincipalChange.setFlowCode(IdWorker.getIdStr());
* 工作票延期 }
*
* @param response
* @param workTicketVo
*/
private void processPostpone(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
//保存工作票延期
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay();
workTicketDelayService.save(workTicketDelay);
//更新工作票信息
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription());
workTicketInfoService.updateById(workTicket);
}
/**
* 许可人确认工作票结束
*
* @param response
* @param workTicketVo
*/
private void licenseConfirmEnd(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
//工作结束
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish();
workTicketFinishService.updateById(workTicketFinish);
//更新工作票信息
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.END.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.END.getDescription());
workTicketInfoService.updateById(workTicket);
}
/**
* 工作负责人确认工作票结束
*
* @param response
* @param workTicketVo
*/
private void principalConfirmEnd(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
//工作结束
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish();
workTicketFinishService.save(workTicketFinish);
//更新工作票信息
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENSE_CONFIRM_END.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENSE_CONFIRM_END.getDescription());
workTicketInfoService.updateById(workTicket);
}
/**
* 工作负责人确认工作内容执行
*
* @param response
* @param workTicketVo
*/
private void principalConfirmContent(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
if (CollectionUtils.isEmpty(workTicketOperateTimeEntities)) {
log.info("暂时没有每日开工每日收的数据");
return;
}
workTicketOperateTimeServiceImpl.saveBatch(workTicketOperateTimeEntities);
//更新工作票信息
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_END.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_END.getDescription());
workTicketInfoService.updateById(workTicket);
}
/** WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = workTicketPrincipalChangeService.selectByTicketId(workTicket.getId());
* 许可人许可
*
* @param response
* @param workTicketVo
*/
private void license(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
if (CollectionUtils.isEmpty(safetyMeasuresList)) {
log.error("没有安全措施数据");
return;
}
//更新安全措施的状态 if (workTicketPrincipalChange.getId() == null || ObjectUtils.isEmpty(workTicketPrincipalChangeEntity)) {
List<WorkTicketSafetyMeasureEntity> workTicketSafetyMeasureEntities = new ArrayList<>(); workTicketPrincipalChangeService.save(workTicketPrincipalChange);
for (WorkTicketSafetyMeasureEntity workTicketSafetyMeasureDto : safetyMeasuresList) { } else {
WorkTicketSafetyMeasureEntity workTicketSafetyMeasureEntity = BeanUtil.copyProperties(workTicketSafetyMeasureDto, WorkTicketSafetyMeasureEntity.class); workTicketPrincipalChangeService.updateByTicketId(workTicketPrincipalChange);
workTicketSafetyMeasureEntities.add(workTicketSafetyMeasureEntity); }
log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName());
workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal());
workTicket.setPrincipalName(newUser.getName());
//更新工作票
workTicketInfoService.updateById(workTicket);
}
} catch (Exception e) {
e.printStackTrace();
} }
workTicketSafetyMeasureService.saveBatch(workTicketSafetyMeasureEntities);
//更新工作票
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_CONTENT.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_CONTENT.getDescription());
workTicketInfoService.updateById(workTicket);
}
/**
* 工作负责人确认安全措施
*
* @param response
* @param workTicketVo
*/
private void principal(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
//负责人确认时间
//workTicket.setConfirmDateTime(workTicketVo.getWorkTicket().getConfirmDateTime());
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription());
//更新状态值
workTicketInfoService.updateById(workTicket);
} }
/** /**
* 运行人员布置安全措施 * 保存流程描述
* *
* @param workTicket
* @param response * @param response
* @param workTicketVo
*/ */
private void safety(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { private void saveWorkTicket(WorkTicketInfoEntity workTicket, ProcessWorkFlowResponse response) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); String taskId = response.getTaskId();
//值班负责人 String nextStepOperator = response.getNextStepOperator();
workTicket.setWatchPrincipal(workTicketVo.getWorkTicket().getPrincipal()); //1.获取状态
workTicket.setWatchPrincipalEndTime(workTicketVo.getWorkTicket().getWatchPrincipalEndTime()); Integer flowStatus = workTicket.getFlowStatus();
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getStatus()); //2.根据流程获取描述信息
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getDescription()); String description = getWorkTicketDescription(flowStatus);
//更新状态值 String flowDescription = "";
workTicketInfoService.updateById(workTicket); //当前审批人
User user = UserCache.getUser(workTicket.getStepOperator());
if (StringUtils.isNotEmpty(nextStepOperator)) {
Long taskUser = NumberUtils.createLong(nextStepOperator.startsWith("taskUser_") ?
nextStepOperator.substring(9) : null);
//下一个审批人
User stepUser = UserCache.getUser(taskUser);
flowDescription = "审批中,当前环节是".concat(description)
.concat(",当前审批人是").concat(user.getName())
.concat(",下一个审批人是").concat(stepUser.getName()).concat("待审批");
workTicket.setNextStepOperator(taskUser);
} else {
flowDescription = "审批中,当前环节是".concat(description)
.concat(",审批人是").concat(user.getName());
}
//如果taskId为空 或 flowStatus = 99
if (StringUtils.isEmpty(taskId) || 99 == flowStatus) {
flowDescription = "结束";
workTicket.setFlowDescription(flowDescription);
workTicket.setFlowTaskId("");
workTicket.setFlowTaskName("结束");
workTicket.setNextStepOperator(-1L);
workTicket.setStepOperator(-1L);
} else {
workTicket.setFlowDescription(flowDescription);
workTicket.setFlowTaskId(taskId);
workTicket.setFlowTaskName(response.getTaskName());
}
//如果下一个审批人【nextStepOperator】是null设为-1
if (StringUtils.isEmpty(nextStepOperator)) {
workTicket.setNextStepOperator(-1L);
}
} }
/** /**
* 运功人接收 * 获取描述信息
* *
* @param response * @param flowStatus 状态
* @param workTicketVo * @return
*/
private void reception(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setFlowStatus(FlowWorkTicketConstants.FIX_UP.getStatus());
workTicket.setFlowDescription(FlowWorkTicketConstants.FIX_UP.getDescription());
//更新状态值
workTicketInfoService.updateById(workTicket);
}
/**
* 第一种工作票签发
*/
//@Transactional(rollbackFor = Exception.class)
public void sign(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) {
WorkTicketInfoEntity workTicketInfoEntity = workTicketVo.getWorkTicket();
//更新状态值
workTicketInfoEntity.setStatus(FlowWorkTicketConstants.RECEIVE.getStatus());
workTicketInfoEntity.setFlowStatus(FlowWorkTicketConstants.RECEIVE.getStatus());
workTicketInfoEntity.setFlowDescription(FlowWorkTicketConstants.RECEIVE.getDescription());
workTicketInfoEntity.setSignerDateTime(workTicketVo.getWorkTicket().getSignerDateTime());
workTicketInfoService.updateById(workTicketInfoEntity);
}
/**
* 开票
*/ */
private void make(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { private String getWorkTicketDescription(Integer flowStatus) {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); String value = null;
workTicket.setProcessInstanceId(response.getProcessInstanceId()); switch (flowStatus) {
workTicket.setStatus(FlowWorkTicketConstants.SIGN.getStatus()); case 1:
workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN.getStatus()); value = "签发人签发";
workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN.getDescription()); break;
//保存工作流实例ID case 2:
workTicketInfoService.updateById(workTicket); value = "运行人接收";
//处理来源任务 break;
this.returnTicket(workTicketVo); case 3:
value = "布置安全措施";
break;
case 4:
value = "确认安全措施";
break;
case 5:
value = "许可人许可";
break;
case 6:
value = "确认工作内容执行";
break;
case 7:
value = "工作负责人确认结束";
break;
case 8:
value = "许可人确认结束";
break;
case 9:
value = "签发人审核";
break;
case 99:
value = "结束";
break;
default:
log.error("getWorkTicketDescription【flowStatus】 输入的有误,请重洗输入。。。。");
break;
}
return value;
} }
/** /**
* 处理来源任务 * 处理来源任务
* *
@ -738,8 +553,8 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//班组负责人 //班组负责人
String principalName = getByPrincipal(workTicket); String principalName = getByPrincipal(workTicket);
workTicket.setPrincipalName(principalName); workTicket.setPrincipalName(principalName);
workTicket.setFlowStatus(FlowWorkTicketConstants.START.getStatus()); workTicket.setFlowStatus(1);
workTicket.setFlowDescription(FlowWorkTicketConstants.START.getDescription()); workTicket.setStepOperator(AuthUtil.getUserId());
//唯一 //唯一
workTicket.setCreateUser(AuthUtil.getUserId()); workTicket.setCreateUser(AuthUtil.getUserId());
boolean isSave = firstWorkTicketService.save(workTicket); boolean isSave = firstWorkTicketService.save(workTicket);
@ -805,10 +620,12 @@ public class TicketProcessServiceImpl implements TicketProcessService {
String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(ticketType) + PdfUtils.XLSX_SUFFIX; String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(ticketType) + PdfUtils.XLSX_SUFFIX;
log.info("工作票模板为:{}", fileName); log.info("工作票模板为:{}", fileName);
TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); TemplateExportParams templateExportParams = new TemplateExportParams("template/新电气第一种工作票模板.xlsx", true);
Workbook workbook = null; Workbook workbook = null;
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "你好");
try { try {
workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap); workbook = ExcelExportUtil.exportExcel(templateExportParams, map);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -836,12 +653,11 @@ public class TicketProcessServiceImpl implements TicketProcessService {
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
//1. 工作对象 //1. 工作对象
Map<String, Object> workTicketInfoMap = PdfUtils.objectToMap(workTicket); Map<String, Object> workTicketInfoMap = PdfUtils.objectToMap(workTicket);
result.putAll(workTicketInfoMap);
//2. 安全措施 //2. 安全措施
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { if (CollectionUtils.isNotEmpty(safetyMeasuresList)) {
Map<String, List<WorkTicketSafetyMeasureEntity>> measureMap = safetyMeasuresList.stream() Map<String, List<WorkTicketSafetyMeasureEntity>> measureMap = safetyMeasuresList.stream().collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType));
.collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType));
Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()).forEach(measureEnum -> { 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 = measureMap.get(measureEnum.getType()).stream().map(measureVO -> { List<Map<String, Object>> mapList = measureMap.get(measureEnum.getType()).stream().map(measureVO -> {
@ -857,6 +673,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
} }
}); });
} }
result.putAll(workTicketInfoMap);
//3. 工作票工作任务组 //3. 工作票工作任务组
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList();
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) {
@ -891,8 +708,47 @@ public class TicketProcessServiceImpl implements TicketProcessService {
private static <T> Map<String, Object> parseObjectMap(T target, Class clas) { private static <T> Map<String, Object> parseObjectMap(T target, Class clas) {
return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class); return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class);
} }
public static void main(String[] args) throws IOException {
//System.out.println(DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss").format(LocalDateTime.now()));
TemplateExportParams params = new TemplateExportParams(
"template/新电气第一种工作票模板.xlsx");
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "你好");
// map.put("money", 2000000.00);
// map.put("upperMoney", "贰佰万");
// map.put("company", "执笔潜行科技有限公司");
// map.put("bureau", "财政局");
// map.put("person", "JueYue");
// map.put("phone", "1879740****");
// List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
// for (int i = 0; i < 4; i++) {
// Map<String, String> lm = new HashMap<String, String>();
// lm.put("id", i + 1 + "");
// lm.put("zijin", i * 10000 + "");
// lm.put("bianma", "A001");
// lm.put("mingcheng", "设计");
// lm.put("xiangmumingcheng", "EasyPoi " + i + "期");
// lm.put("quancheng", "开源项目");
// lm.put("sqje", i * 10000 + "");
// lm.put("hdje", i * 10000 + "");
//
// listMap.add(lm);
// }
// map.put("maplist", listMap);
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
FileOutputStream fos = new FileOutputStream("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\新电气第一种工作票模板2" +
".xlsx");
workbook.write(fos);
fos.close();
}
} }

21
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzims.ticket.twoTicket.service.impl; 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.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;
@ -31,7 +32,25 @@ public class WorkTicketFinishServiceImpl extends ServiceImpl<WorkTicketFinishMap
@Override @Override
public WorkTicketFinish selectByTicketId(Long ticketId) { public WorkTicketFinish selectByTicketId(Long ticketId) {
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.last("limit 1");
return this.getOne(queryWrapper); return this.getOne(queryWrapper);
} }
/**
* 更新
*
* @param workTicketFinish
*/
@Override
public void updateByTicketId(WorkTicketFinish workTicketFinish) {
if (workTicketFinish.getId() == null) {
UpdateWrapper<WorkTicketFinish> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda().eq(WorkTicketFinish::getTicketId, workTicketFinish.getTicketId());
this.update(workTicketFinish, updateWrapper);
return;
}
this.updateById(workTicketFinish);
}
} }

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketDelayService.java

@ -62,4 +62,10 @@ public interface IWorkTicketDelayService extends BaseService<WorkTicketDelayEnti
* @return * @return
*/ */
WorkTicketDelayEntity selectByTicketId(Long ticketId); WorkTicketDelayEntity selectByTicketId(Long ticketId);
/**
* 工作票延期更新
* @param workTicketDelay
*/
void updateByTicketId(WorkTicketDelayEntity workTicketDelay);
} }

7
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketPrincipalChangeService.java

@ -50,4 +50,11 @@ public interface IWorkTicketPrincipalChangeService extends BaseService<WorkTicke
* @return * @return
*/ */
WorkTicketPrincipalChangeEntity selectByTicketId(Long ticketId); WorkTicketPrincipalChangeEntity selectByTicketId(Long ticketId);
/**
* 更新
* @param workTicketPrincipalChange
*/
void
updateByTicketId(WorkTicketPrincipalChangeEntity workTicketPrincipalChange);
} }

245
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketDelayServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzims.ticket.workTicket.service.impl; package com.hnac.hzims.ticket.workTicket.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.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
@ -21,7 +22,9 @@ import com.hnac.hzims.ticket.workTicket.vo.WorkTicketDelayVO;
import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketDelayWrapper; import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketDelayWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -34,6 +37,7 @@ import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.Null;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Date; import java.util.Date;
@ -51,121 +55,142 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
public class WorkTicketDelayServiceImpl extends BaseServiceImpl<WorkTicketDelayMapper, WorkTicketDelayEntity> implements IWorkTicketDelayService { public class WorkTicketDelayServiceImpl extends BaseServiceImpl<WorkTicketDelayMapper, WorkTicketDelayEntity> implements IWorkTicketDelayService {
private final WorkTicketInfoMapper infoMapper; private final WorkTicketInfoMapper infoMapper;
private final IFlowClient flowClient; private final IFlowClient flowClient;
private final IOperAccessTaskClient taskClient; private final IOperAccessTaskClient taskClient;
private final ITaskClient maintenanceTaskClient; private final ITaskClient maintenanceTaskClient;
@Override @Override
public R<IPage<WorkTicketDelayVO>> queryList(WorkTicketDelayDto req, Query query) { public R<IPage<WorkTicketDelayVO>> queryList(WorkTicketDelayDto req, Query query) {
LambdaQueryWrapper queryWrapper = this.getQueryWrapper(req); LambdaQueryWrapper queryWrapper = this.getQueryWrapper(req);
IPage pages = super.page(Condition.getPage(query),queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
return R.data(pages.setRecords(WorkTicketDelayWrapper.build().listVO(pages.getRecords()))); return R.data(pages.setRecords(WorkTicketDelayWrapper.build().listVO(pages.getRecords())));
} }
@Override @Override
public List<WorkTicketDelayVO> list(WorkTicketDelayDto req) { public List<WorkTicketDelayVO> list(WorkTicketDelayDto req) {
List<WorkTicketDelayEntity> workTicketDelayEntityList = this.list(this.getQueryWrapper(req)); List<WorkTicketDelayEntity> workTicketDelayEntityList = this.list(this.getQueryWrapper(req));
return CollectionUtil.isNotEmpty(workTicketDelayEntityList) ? WorkTicketDelayWrapper.build().listVO(workTicketDelayEntityList) : null; return CollectionUtil.isNotEmpty(workTicketDelayEntityList) ? WorkTicketDelayWrapper.build().listVO(workTicketDelayEntityList) : null;
} }
@Override @Override
@Transactional @Transactional
public R saveAndStartFlow(WorkTicketInfoDto infoDto, WorkTicketDelayDto delayDto, ComleteTask comleteTask) { public R saveAndStartFlow(WorkTicketInfoDto infoDto, WorkTicketDelayDto delayDto, ComleteTask comleteTask) {
/**更新工作票状态**/ /**更新工作票状态**/
infoMapper.updateById(infoDto); infoMapper.updateById(infoDto);
/**新增工作票延期记录**/ /**新增工作票延期记录**/
this.save(delayDto); this.save(delayDto);
/**开启工作流**/ /**开启工作流**/
R completeTaskR = flowClient.completeTask(comleteTask); R completeTaskR = flowClient.completeTask(comleteTask);
if(!completeTaskR.isSuccess()){ if (!completeTaskR.isSuccess()) {
throw new ServiceException(completeTaskR.getMsg()); throw new ServiceException(completeTaskR.getMsg());
} }
return R.success("保存成功!"); return R.success("保存成功!");
} }
@Override @Override
@Transactional @Transactional
public R updateAndConfirmFlow(WorkTicketInfoDto infoDto, WorkTicketDelayDto delayDto, ComleteTask comleteTask) { public R updateAndConfirmFlow(WorkTicketInfoDto infoDto, WorkTicketDelayDto delayDto, ComleteTask comleteTask) {
/**更新工作票状态**/ /**更新工作票状态**/
infoMapper.updateById(infoDto); infoMapper.updateById(infoDto);
/**工作票延期更新许可人以及许可时间**/ /**工作票延期更新许可人以及许可时间**/
if(TicketConstants.DelayStatusEnum.LICENSOR_CONFIRM.getStatus() == delayDto.getStatus()){ if (TicketConstants.DelayStatusEnum.LICENSOR_CONFIRM.getStatus() == delayDto.getStatus()) {
delayDto.setLicensor(AuthUtil.getUserId()); delayDto.setLicensor(AuthUtil.getUserId());
delayDto.setLicenseTime(LocalDateTime.now()); delayDto.setLicenseTime(LocalDateTime.now());
} }
/**负责人确认更新时间**/ /**负责人确认更新时间**/
if(TicketConstants.DelayStatusEnum.PRINCIPAL_CONFIRM.getStatus() == delayDto.getStatus()){ if (TicketConstants.DelayStatusEnum.PRINCIPAL_CONFIRM.getStatus() == delayDto.getStatus()) {
delayDto.setPrincipalTime(LocalDateTime.now()); delayDto.setPrincipalTime(LocalDateTime.now());
} }
this.updateById(delayDto); this.updateById(delayDto);
/**开启工作流**/ /**开启工作流**/
R completeTaskR = flowClient.completeTask(comleteTask); R completeTaskR = flowClient.completeTask(comleteTask);
if(!completeTaskR.isSuccess()){ if (!completeTaskR.isSuccess()) {
throw new ServiceException(completeTaskR.getMsg()); throw new ServiceException(completeTaskR.getMsg());
} }
//更新任务延期状态 //更新任务延期状态
if(TicketConstants.DelayStatusEnum.PRINCIPAL_CONFIRM.getStatus() == delayDto.getStatus()){ if (TicketConstants.DelayStatusEnum.PRINCIPAL_CONFIRM.getStatus() == delayDto.getStatus()) {
updateTaskDelayStatus(infoDto,delayDto); updateTaskDelayStatus(infoDto, delayDto);
} }
return R.success("操作成功!"); return R.success("操作成功!");
} }
/** /**
* 工作票延期 * 工作票延期
* *
* @param ticketId * @param ticketId
* @return * @return
*/ */
@Override @Override
public WorkTicketDelayEntity selectByTicketId(Long ticketId) { public WorkTicketDelayEntity selectByTicketId(Long ticketId) {
LambdaQueryWrapper<WorkTicketDelayEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WorkTicketDelayEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketDelayEntity::getTicketId,ticketId); queryWrapper.eq(WorkTicketDelayEntity::getTicketId, ticketId);
List<WorkTicketDelayEntity> entities = this.list(queryWrapper); queryWrapper.orderByDesc(BaseEntity::getCreateTime);
return entities.get(0); List<WorkTicketDelayEntity> entities = this.list(queryWrapper);
} return CollectionUtils.isNotEmpty(entities) ? entities.get(0) : null;
}
/**
* 工作票延期更新
*
* @param workTicketDelay
*/
@Override
public void updateByTicketId(WorkTicketDelayEntity workTicketDelay) {
if (workTicketDelay.getId() == null) {
UpdateWrapper<WorkTicketDelayEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda().eq(WorkTicketDelayEntity::getTicketId, workTicketDelay.getTicketId());
this.update(workTicketDelay, updateWrapper);
return;
}
this.updateById(workTicketDelay);
}
/**
* 更新任务延期时间状态
*
* @param infoDto
*/
@Transactional(rollbackFor = Exception.class)
public void updateTaskDelayStatus(WorkTicketInfoDto infoDto, WorkTicketDelayDto delayDto) {
//检修
if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(infoDto.getTaskType())) {
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity();
taskEntity.setDelayStatus(AccessConstants.DELAY_STATUS_2);
taskEntity.setDelayDate(LocalDateTime.now());
taskEntity.setId(infoDto.getTaskId());
taskEntity.setPlanEndTime(Date.from(delayDto.getChangeTime().atZone(ZoneId.systemDefault()).toInstant()));
taskClient.updateById(taskEntity);
}
//日常维护
else if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(infoDto.getTaskType())) {
OperMaintenanceTaskDTO taskDTO = new OperMaintenanceTaskDTO();
taskDTO.setDelayStatus(AccessConstants.DELAY_STATUS_2);
taskDTO.setDelayDate(LocalDateTime.now());
taskDTO.setPlanEndTime(delayDto.getChangeTime());
taskDTO.setId(infoDto.getTaskId());
TaskFlowDTO taskFlowDTO = new TaskFlowDTO();
taskFlowDTO.setTaskDTO(taskDTO);
maintenanceTaskClient.updateTaskStatus(taskFlowDTO);
}
}
/**
* 获取queryWrapper
*
* @param req
* @return
*/
private LambdaQueryWrapper<WorkTicketDelayEntity> getQueryWrapper(WorkTicketDelayDto req) {
LambdaQueryWrapper<WorkTicketDelayEntity> queryWrapper = new LambdaQueryWrapper<WorkTicketDelayEntity>();
if (Func.isNotEmpty(req.getFlowId())) {
queryWrapper.eq(WorkTicketDelayEntity::getFlowId, req.getFlowId());
}
if (Func.isNotEmpty(req.getTicketId())) {
queryWrapper.eq(WorkTicketDelayEntity::getTicketId, req.getTicketId());
}
return queryWrapper;
}
/**
* 更新任务延期时间状态
* @param infoDto
*/
@Transactional(rollbackFor = Exception.class)
public void updateTaskDelayStatus(WorkTicketInfoDto infoDto, WorkTicketDelayDto delayDto){
//检修
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(infoDto.getTaskType())){
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity();
taskEntity.setDelayStatus(AccessConstants.DELAY_STATUS_2);
taskEntity.setDelayDate(LocalDateTime.now());
taskEntity.setId(infoDto.getTaskId());
taskEntity.setPlanEndTime(Date.from(delayDto.getChangeTime().atZone( ZoneId.systemDefault()).toInstant()));
taskClient.updateById(taskEntity);
}
//日常维护
else if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(infoDto.getTaskType())){
OperMaintenanceTaskDTO taskDTO = new OperMaintenanceTaskDTO();
taskDTO.setDelayStatus(AccessConstants.DELAY_STATUS_2);
taskDTO.setDelayDate(LocalDateTime.now());
taskDTO.setPlanEndTime(delayDto.getChangeTime());
taskDTO.setId(infoDto.getTaskId());
TaskFlowDTO taskFlowDTO = new TaskFlowDTO();
taskFlowDTO.setTaskDTO(taskDTO);
maintenanceTaskClient.updateTaskStatus(taskFlowDTO);
}
}
/**
* 获取queryWrapper
* @param req
* @return
*/
private LambdaQueryWrapper<WorkTicketDelayEntity> getQueryWrapper(WorkTicketDelayDto req){
LambdaQueryWrapper<WorkTicketDelayEntity> queryWrapper = new LambdaQueryWrapper<WorkTicketDelayEntity>();
if(Func.isNotEmpty(req.getFlowId())){
queryWrapper.eq(WorkTicketDelayEntity::getFlowId,req.getFlowId());
}
if(Func.isNotEmpty(req.getTicketId())){
queryWrapper.eq(WorkTicketDelayEntity::getTicketId,req.getTicketId());
}
return queryWrapper;
}
} }

22
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketPrincipalChangeServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.ticket.workTicket.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.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish;
@ -16,6 +17,7 @@ import com.hnac.hzims.ticket.workTicket.vo.WorkTicketPrincipalChangeVO;
import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketPrincipalChangeWrappper; import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketPrincipalChangeWrappper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -97,7 +99,23 @@ public class WorkTicketPrincipalChangeServiceImpl extends BaseServiceImpl<WorkTi
public WorkTicketPrincipalChangeEntity selectByTicketId(Long ticketId) { public WorkTicketPrincipalChangeEntity selectByTicketId(Long ticketId) {
LambdaQueryWrapper<WorkTicketPrincipalChangeEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WorkTicketPrincipalChangeEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketPrincipalChangeEntity::getTicketId,ticketId); queryWrapper.eq(WorkTicketPrincipalChangeEntity::getTicketId,ticketId);
List<WorkTicketPrincipalChangeEntity> workTicketPrincipalChangeEntities = this.list(queryWrapper); queryWrapper.orderByDesc(BaseEntity::getCreateTime);
return workTicketPrincipalChangeEntities.get(workTicketPrincipalChangeEntities.size() - 1); queryWrapper.last("limit 1");
return this.getOne(queryWrapper);
}
/**
* 更新
* @param workTicketPrincipalChange
*/
@Override
public void updateByTicketId(WorkTicketPrincipalChangeEntity workTicketPrincipalChange) {
if (workTicketPrincipalChange.getId() == null) {
UpdateWrapper<WorkTicketPrincipalChangeEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda().eq(WorkTicketPrincipalChangeEntity::getTicketId, workTicketPrincipalChange.getTicketId());
this.update(workTicketPrincipalChange, updateWrapper);
return;
}
this.updateById(workTicketPrincipalChange);
} }
} }

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

Binary file not shown.
Loading…
Cancel
Save