From 0b30fb7114de97519ebba43991764c17324d592b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 4 Jan 2024 09:39:33 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=B7=A5=E4=BD=9C=E4=BB=BB=E5=8A=A1=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/constant/TicketProcessConstant.java | 5 + .../hzims/ticket/repair/entity/WorkTaskEntity.java | 118 +++++++++++++++++++++ .../hzims/ticket/repair/fegin/IWorkTaskClient.java | 26 +++++ .../repair/fegin/WorkTaskClientFallback.java | 17 +++ .../strategy/serviceimpl/WorkTaskServiceImpl.java | 44 ++++++++ .../hzims/ticket/repair/fegin/WorkTaskClient.java | 26 +++++ .../hzims/ticket/repair/mapper/WorkTaskMapper.java | 11 ++ .../ticket/repair/mapper/xml/WorkTaskMapper.xml | 6 ++ .../ticket/repair/service/IWorkTaskService.java | 13 +++ .../repair/service/impl/WorkTaskServiceImpl.java | 27 +++++ 10 files changed, 293 insertions(+) create mode 100644 hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java create mode 100644 hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java create mode 100644 hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index 5a7d5d3..d4098d5 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -45,6 +45,11 @@ public class TicketProcessConstant { * 检修任务 */ public static final String OVERHAUL_TASK = "overhaul_task"; + + /** + * 工作任务 + */ + public static final String WORK_TASK = "work_task"; // public static final String DEFECT_KEY = "defectCheck"; diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java new file mode 100644 index 0000000..3c26a42 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java @@ -0,0 +1,118 @@ +package com.hnac.hzims.ticket.repair.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author ysj + */ +@Data +@TableName("hzims_work_task") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "工作任务表", description = "工作任务表") +public class WorkTaskEntity extends TenantEntity { + + private static final long serialVersionUID = -3122149146340663132L; + + @ApiModelProperty(value = "设备code") + private String emCode; + + @ApiModelProperty(value = "编号") + private String number; + + @ApiModelProperty(value = "单位") + private String company; + + @ApiModelProperty(value = "处理状态") + private Integer handleStatus; + + @ApiModelProperty(value = "应急抢修发起人") + private Long originator; + + @ApiModelProperty(value = "应急抢修负责人") + private Long charge; + + @ApiModelProperty(value = "应急抢修班组") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Long repairTeam; + + @ApiModelProperty(value = "应急抢修人员") + private String repairPersonnel; + + @ApiModelProperty(value = "应急抢修任务描述") + private String repairTask; + + @ApiModelProperty(value = "安全措施") + private String safetyMeasures; + + @ApiModelProperty(value = "注意事项") + private String pointsAttention; + + @ApiModelProperty(value = "现场保留安全措施") + private String reserveMeasures; + + @ApiModelProperty(value = "许可人") + private Long licensor; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "许可时间") + private Date licensorTime; + + @ApiModelProperty(value = "许可人安全措施") + private String licensorMeasures; + + @ApiModelProperty(value = "许可人描述") + private String licensorMemo; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "许可完成确认时间") + private Date licensorCompleteTime; + + @ApiModelProperty(value = "抢修工时") + private String implementHours; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "抢修开始时间") + private Date implementStartTime; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "抢修结束时间") + private Date implementEndTime; + + @ApiModelProperty(value = "抢修描述") + private String implementDesc; + + @ApiModelProperty(value = "流程实例ID") + private String processInstanceId; +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java new file mode 100644 index 0000000..f36fab3 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.ticket.repair.fegin; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.constants.TicketConstants; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author ysj + */ +@FeignClient( + value = TicketConstants.APP_NAME, + fallback = RepairClientFallback.class +) +public interface IWorkTaskClient { + + String API_PREFIX = "/feign/workTask"; + + String WORK_TASK_PROCESS_LISTENER = API_PREFIX + "/listener"; + + @PostMapping(WORK_TASK_PROCESS_LISTENER) + R listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse); +} + diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java new file mode 100644 index 0000000..98bbd47 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.ticket.repair.fegin; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Component; + +/** + * @author ysj + */ +@Component +public class WorkTaskClientFallback implements IWorkTaskClient { + + @Override + public R listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return R.status(false); + } +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java new file mode 100644 index 0000000..e9f5d72 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.WORK_TASK; + +/** + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class WorkTaskServiceImpl extends ProcessAbstractService { + + private final ProcessDictService processDictService; + + /** + * 消息确认-工作任务单 + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + String dictValue = processDictService.selectDictValueByKey(WORK_TASK); + return dictValue.equals(flowQueue.getProcessDefinitionKey()); + } + + /** + * 调用工作任务流程监听 + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + + /*if (!defect.isSuccess()) { + throw new ServiceException("检修任务业务执行异常!"); + }*/ + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java new file mode 100644 index 0000000..0b9f97f --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.ticket.repair.fegin; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.service.IWorkTaskService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ysj + */ +@RestController +@Slf4j +@AllArgsConstructor +public class WorkTaskClient implements IWorkTaskClient { + + private final IWorkTaskService workTaskService; + + @Override + @PostMapping(WORK_TASK_PROCESS_LISTENER) + public R listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return R.status(workTaskService.listener(processWorkFlowResponse)); + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java new file mode 100644 index 0000000..5776107 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.ticket.repair.mapper; + +import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface WorkTaskMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml new file mode 100644 index 0000000..a190f1a --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java new file mode 100644 index 0000000..9d7b25f --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.ticket.repair.service; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface IWorkTaskService extends BaseService { + + boolean listener(ProcessWorkFlowResponse processWorkFlowResponse); +} \ No newline at end of file diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java new file mode 100644 index 0000000..eef3891 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.ticket.repair.service.impl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; +import com.hnac.hzims.ticket.repair.mapper.WorkTaskMapper; +import com.hnac.hzims.ticket.repair.service.IWorkTaskService; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +public class WorkTaskServiceImpl extends BaseServiceImpl implements IWorkTaskService { + + /** + * 工作任务流程监听 :业务处理 + * @param processWorkFlowResponse + * @return + */ + @Override + public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return false; + } +} \ No newline at end of file