From 88939b70816b8e2c9b99e86e273e0ed9c29a49c7 Mon Sep 17 00:00:00 2001 From: "H.X" <7458466+huangxing1023@user.noreply.gitee.com> Date: Tue, 14 Mar 2023 19:33:32 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E4=B8=A4=E7=A5=A8=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=88=E4=B8=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/ticket/constants/TicketConstants.java | 42 +++++ .../service/impl/ModelInstanceServiceImpl.java | 6 +- .../ticket/redisConsume/WorkTicketMsgConsume.java | 22 ++- .../ticket/response/WorkTicketMessageResponse.java | 36 ++++ .../src/main/resources/file/工作票.bpmn20.xml | 194 +++++++++++++++++++++ 5 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/WorkTicketMessageResponse.java create mode 100644 hzims-service/ticket/src/main/resources/file/工作票.bpmn20.xml diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java index 9876ba9..acd4218 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java @@ -49,6 +49,48 @@ public interface TicketConstants { } } + /** + * 工作票流程环节 + */ + enum WorkTicketFlowEnum { + /**开票**/ + START("1","startEvent1","开票"), + /**签发人签发**/ + SIGN("1","sid-5E7013A9-385A-4EE4-91B6-FD5328D05E2A","签发人签发"), + /**运行人员接收**/ + RECEIVE("2","sid-355DB6EC-7D54-4537-B80F-C26CD716ADA1","运行人员接收"), + /**运行人员布置安全措施**/ + FIX_UP("3","sid-F35C4A79-53AF-40B8-AFBD-AF7283CC5708","运行人员布置安全措施"), + /**工作负责人确认安全措施**/ + PRINCIPAL_CONFIRM_MEASURE("4","sid-5476EB52-438F-4C74-94FB-88A6EA6625EA","工作负责人确认安全措施"), + /**许可人许可**/ + LICENCE("5","sid-0CB1456A-D85C-4473-A032-FAEF62EFBF22","许可人许可"), + /**工作负责人确认工作内容执行**/ + PRINCIPAL_CONFIRM_CONTENT("6","sid-5476EB52-438F-4C74-94FB-88A6EA6625EA","工作负责人确认工作内容执行"), + /**工作负责人确认工作票结束**/ + PRINCIPAL_CONFIRM_END("7","sid-5476EB52-438F-4C74-94FB-88A6EA6625EA","工作负责人确认工作票结束、终结"), + /**工作负责人确认工作票结束**/ + LICENSE_CONFIRM_END("8","sid-5476EB52-438F-4C74-94FB-88A6EA6625EA","工作负责人确认工作票结束、终结"), + /**签发人审核**/ + SIGN_CONFIRM_DELAY("9","sid-5476EB52-438F-4C74-94FB-88A6EA6625EA","签发人审核"), + ; + @Getter + private String status; + @Getter + private String flowId; + @Getter + private String segment; + + WorkTicketFlowEnum(String status, String flowId, String segment) { + this.status = status; + this.flowId = flowId; + this.segment = segment; + } + public static WorkTicketFlowEnum getEnumByFlowId(String flowId) { + Optional workTicketFlowEnum = Arrays.stream(WorkTicketFlowEnum.class.getEnumConstants()).filter(flowEnum -> flowId.equals(flowEnum.flowId)).findFirst(); + return workTicketFlowEnum.orElse(null); + } + } enum WordFileNameEnum { OPERATE("1","操作票"), WORK("2","工作票"), diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java index f07554b..bec8367 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java @@ -3,6 +3,8 @@ package com.hnac.hzims.monitor.service.impl; import com.hnac.hzims.monitor.service.IModelInstanceService; import com.hnac.hzinfo.sdk.analyse.AnalyseDataHandlerClient; import com.hnac.hzinfo.sdk.analyse.dto.AnalyseDataHandlerDTO; +import com.hnac.hzinfo.sdk.core.response.Result; +import com.hnac.hzinfo.sdk.core.response.ResultCode; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -20,7 +22,7 @@ public class ModelInstanceServiceImpl implements IModelInstanceService { @Override public boolean save(AnalyseDataHandlerDTO analyseDataHandlerDTO) { - //analyseDataHandlerClient.save(analyseDataHandlerDTO); - return true; + Result saveResult = analyseDataHandlerClient.save(analyseDataHandlerDTO); + return saveResult.getCode() == ResultCode.SUCCESS.getCode() && saveResult.isSuccess(); } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java index 036bbd4..7af631a 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java @@ -1,10 +1,17 @@ package com.hnac.hzims.ticket.redisConsume; +import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.common.config.RedisMessageListener; +import com.hnac.hzims.ticket.constants.TicketConstants; +import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.log.logger.BladeLogger; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Component; +import org.springframework.util.Assert; /** * @author hx @@ -17,10 +24,23 @@ import org.springframework.stereotype.Component; public class WorkTicketMsgConsume { private final IFirstWorkTicketService firstWorkTicketService; + private final BladeLogger logger; @RedisMessageListener(topic = RedisMessageTopic.WORK_TICKET_MESSAGE_KEY) public void dealWorkTicketFlow(String message){ - + Assert.isTrue(StringUtil.isNotBlank(message),() -> { + throw new ServiceException("两票接收流程消息为空!"); + }); + WorkTicketMessageResponse response = JSONObject.parseObject(message, WorkTicketMessageResponse.class); + TicketConstants.WorkTicketFlowEnum workTicketFlowEnum = TicketConstants.WorkTicketFlowEnum.getEnumByFlowId(response.getTaskDefinitionKey()); + switch(workTicketFlowEnum) { + case START: + //FIXME 开票暂用此接口 + firstWorkTicketService.billing(null); + break; + default: + break; + } log.info("接收工作票流程,接收消息为:{}",message); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/WorkTicketMessageResponse.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/WorkTicketMessageResponse.java new file mode 100644 index 0000000..bda5a2e --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/WorkTicketMessageResponse.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.ticket.response; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/14 19:13 + */ +@Data +@EqualsAndHashCode +public class WorkTicketMessageResponse implements Serializable { + + /**当前任务ID**/ + @NotNull + private String taskId; + + /**当前任务名称**/ + private String taskName; + + /**当前环节流程ID**/ + @NotNull + private String taskDefinitionKey; + + /**下一环节处理人**/ + @NotNull + private String nextStepOperator; + + /**票据表单**/ + private Object formData; + +} diff --git a/hzims-service/ticket/src/main/resources/file/工作票.bpmn20.xml b/hzims-service/ticket/src/main/resources/file/工作票.bpmn20.xml new file mode 100644 index 0000000..823e09f --- /dev/null +++ b/hzims-service/ticket/src/main/resources/file/工作票.bpmn20.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file