diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java index 0d5bcb2..40338c2 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java @@ -20,8 +20,7 @@ import javax.annotation.Resource; * @author hx */ @FeignClient( - value = MessageConstants.APP_NAME, - fallback = MessageClientFallback.class + value = MessageConstants.APP_NAME ) public interface IMessageClient { String API_PREFIX = "/feign/message"; diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java index fc2293a..b1ddd70 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java @@ -386,8 +386,40 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable { private LocalDateTime confirmDateTime; + /** + * 签发人审核时间 + */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime issuerReviewDateTime; + + /** + * 签发人签发是否通过 + */ + @ApiModelProperty("签发人签发是否通过") + private Boolean signFlag; + + + + /** + * 运行人员是否通过 + */ + @ApiModelProperty("运行人员是否通过") + private Boolean recieveFlag; + + + + + /** + * 工作确认是否通过 (delay 工作票延期 transfe 工作票转移 true 通过 ) + */ + @ApiModelProperty("工作确认是否通过 (delay 工作票延期 transfe 工作票转移 true 通过 )") + private String flag; + + + + + + } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java index c275b5e..b058eba 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java @@ -5,6 +5,8 @@ import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.safeproduct.template.service.TemplateService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.Resource; @@ -19,7 +21,7 @@ import javax.annotation.Resource; public abstract class TemplateAbstractService implements TemplateService { @Resource - private IMessageClient messageClient; + private IMessageClient messageClient; /** * 具体业务 @@ -27,7 +29,7 @@ public abstract class TemplateAbstractService implements TemplateService { * @param planMsgRecord */ @Override - public void execute(PlanMsgRecordDto planMsgRecord) { + public void execute(PlanMsgRecordDto planMsgRecord) { //1.具体的业务逻辑 PlanMsgRecordDto list = executeTemplateMessage(planMsgRecord); //2.保存数据 @@ -41,7 +43,10 @@ public abstract class TemplateAbstractService implements TemplateService { */ private void saveData(PlanMsgRecordDto list) { log.info("正在保存推送的数据"); - messageClient.planSendMessage(list); + R planMsgRecordDtoR = messageClient.planSendMessage(list); + if (planMsgRecordDtoR.isSuccess()) { + throw new ServiceException(planMsgRecordDtoR.getMsg()); + } } @@ -50,5 +55,5 @@ public abstract class TemplateAbstractService implements TemplateService { * * @return */ - public abstract PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord); + public abstract PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java index ca50462..3f7108a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java @@ -41,6 +41,7 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService { // planMsgRecord.setContent(JSON.toJSONString(map)); planMsgRecord.setSmsParam(JSON.toJSONString(map)); planMsgRecord.setResourceCode("aliyun-safeTool-push"); + planMsgRecord.setContent(JSON.toJSONString(map)); return planMsgRecord; } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java index f32345e..be96d3c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java @@ -48,6 +48,6 @@ public class ProcessWorkFlowResponse implements Serializable { /**票据表单**/ - private String variables; + private Object variables; } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java index 7d0030b..98c62b2 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java @@ -1,18 +1,24 @@ package com.hnac.hzims.ticket.twoTicket.controller; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import io.swagger.annotations.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; +import org.springblade.flow.core.entity.BladeFlow; +import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.flow.core.vo.ComleteTask; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 工作票 @@ -29,8 +35,10 @@ import org.springframework.web.bind.annotation.RestController; public class TicketProcessController { - @Autowired - private TicketProcessService ticketProcessService; + private final TicketProcessService ticketProcessService; + + + /** @@ -45,5 +53,17 @@ public class TicketProcessController { } + /** + * 预览 + * @param ticketType + * @param ticketId + */ + @GetMapping("/preview") + @ApiOperation(value = "预览") + @ApiOperationSupport(order = 11) + public void preview(@RequestParam @ApiParam("票据类型") String ticketType, @RequestParam @ApiParam("票据ID") Long ticketId) { + ticketProcessService.preview(ticketType,ticketId); + } + } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java index e201719..46c86ed 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java @@ -144,3 +144,4 @@ public class WorkTicketFinish implements Serializable { } + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/constant/TicketProcessConstant.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/constant/TicketProcessConstant.java new file mode 100644 index 0000000..a5955e3 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/constant/TicketProcessConstant.java @@ -0,0 +1,14 @@ +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"; +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/service/TicketProcessService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/service/TicketProcessService.java new file mode 100644 index 0000000..bdc7e77 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/service/TicketProcessService.java @@ -0,0 +1,31 @@ +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); +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneMakeProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneMakeProcessServiceImpl.java new file mode 100644 index 0000000..be9d804 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneMakeProcessServiceImpl.java @@ -0,0 +1,154 @@ +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()); + } + } + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OnePrincipalProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OnePrincipalProcessServiceImpl.java new file mode 100644 index 0000000..3e3aa01 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OnePrincipalProcessServiceImpl.java @@ -0,0 +1,126 @@ +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); + } + + + + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneReceptionProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneReceptionProcessServiceImpl.java new file mode 100644 index 0000000..b4d3cbd --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneReceptionProcessServiceImpl.java @@ -0,0 +1,124 @@ +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); + } + + + + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSafetyProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSafetyProcessServiceImpl.java new file mode 100644 index 0000000..e051b33 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSafetyProcessServiceImpl.java @@ -0,0 +1,127 @@ +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); + } + + + + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSignProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSignProcessServiceImpl.java new file mode 100644 index 0000000..33f51f1 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/flowprocess/serviceimpl/oneserviceImpl/OneSignProcessServiceImpl.java @@ -0,0 +1,125 @@ +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); + } + + + + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IWorkTicketFinishService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IWorkTicketFinishService.java index 43bdf90..130ca02 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IWorkTicketFinishService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IWorkTicketFinishService.java @@ -13,4 +13,10 @@ import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; */ public interface IWorkTicketFinishService extends IService { + /** + * 工作结束 + * @param ticketId + * @return + */ + WorkTicketFinish selectByTicketId(Long ticketId); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java index 2d0005e..c7554d3 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java @@ -23,4 +23,12 @@ public interface TicketProcessService { * @param response */ void findPending(ProcessWorkFlowResponse response); + + + /** + * 预览 + * @param ticketType + * @param ticketId + */ + void preview(String ticketType, Long ticketId); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 31608cf..6f7c9dc 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -1,9 +1,11 @@ package com.hnac.hzims.ticket.twoTicket.service.impl; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; @@ -21,34 +23,44 @@ import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; +import com.hnac.hzims.ticket.twoTicket.vo.process.FristWorkTicketVo; import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo; -import com.hnac.hzims.ticket.workTicket.dto.WorkTicketContentDto; -import com.hnac.hzims.ticket.workTicket.dto.WorkTicketSafetyMeasureDto; +import com.hnac.hzims.ticket.utils.ExcelUtil; +import com.hnac.hzims.ticket.utils.PdfUtils; import com.hnac.hzims.ticket.workTicket.entity.*; -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.*; import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl; import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl; +import com.hnac.hzims.ticket.workTicket.vo.WorkTicketSafetyMeasureVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.secure.utils.AuthUtil; 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.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; + /** * 开票处理流程实现类 * @@ -109,6 +121,21 @@ public class TicketProcessServiceImpl implements TicketProcessService { private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; + private final List processService; + + + private final IWorkTicketOperateTimeService workTicketOperateTimeService; + + + private final IWorkTicketInfoService ticketInfoService; + + + @Value("${hzims.ticket.path.pdf.savePath}") + private String pdfSavePath; + + @Value("${hzims.ticket.path.xlsx.savePath}") + private String xlsSavePath; + /** * 启动开票流程 * @@ -132,27 +159,34 @@ public class TicketProcessServiceImpl implements TicketProcessService { throw new ServiceException("根据条件获取唯一站点暂无数据"); } - log.info("前端查的站点编号 :{}",workTicketVo.getWorkTicket().getSignage()); - log.info("后端查寻的站点编码 :{}",station.getSignage()); + log.info("前端查的站点编号 :{}", workTicketVo.getWorkTicket().getSignage()); + log.info("后端查寻的站点编码 :{}", station.getSignage()); if (!workTicketVo.getWorkTicket().getSignage().equals(station.getSignage())) { - throw new ServiceException("获取唯一站点不一致"); + throw new ServiceException("站点标识-两票编码不能为空"); + } + + //获取站点编号 + String signage = station.getSignage(); + if (StringUtils.isBlank(signage) || signage.length() < 2) { + throw new ServiceException("站点标识-两票编码不能为空"); } - String signage = - station.getSignage().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().setSignageCode(station.getCode()); //2. 获取编码 - String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), workTicketVo.getWorkTicket().getType(), workTicketVo.getWorkTicket().getMakeDateTime()); + String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), + workTicketVo.getWorkTicket().getType(), LocalDateTime.now()); workTicketVo.getWorkTicket().setCode(code); - //3 .保存工作对象 + //2 .保存工作对象 this.saveWorkTicketInfo(workTicketVo.getWorkTicket()); - //4. 保存安全措施 + //3. 保存安全措施 + log.info("获取报存安全措施:{}", workTicketVo.getSafetyMeasuresList()); this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); - //5. 保存工作任务 + //4. 保存工作任务 this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); - //6. 开启动作流 + //5. 开启动作流 this.dealProcess(newFirstWorkTicketFlowKey, workTicketVo); } @@ -163,69 +197,207 @@ public class TicketProcessServiceImpl implements TicketProcessService { */ @Override public void findPending(ProcessWorkFlowResponse response) { + log.info("获取待处理的数据 {}", response); + log.info("获取businessKey: {}", response.getBusinessKey()); + log.info("获取taskId: {}", response.getTaskId()); + log.info("获取下一个审批人是: {}", response.getNextStepOperator()); + if (StringUtils.isNull(response.getTaskId())) { + log.info("工作流结束~~~"); + return; + } //json转换表单 - String formData = response.getVariables(); - WorkTicketVo workTicketVo = JSON.parseObject(formData, WorkTicketVo.class); + String formData = JSON.toJSONString(response.getVariables()); + log.info("获取表单的数据:{}", formData); + FristWorkTicketVo fristWorkFlowResponse = null; + try { + fristWorkFlowResponse = JSONObject.parseObject(formData, FristWorkTicketVo.class); + } catch (Exception e) { + e.printStackTrace(); + } + + if (ObjectUtils.isEmpty(fristWorkFlowResponse)) { + log.error("获取表单的数据解析的数据为null"); + return; + } + //获取表单数据 + WorkTicketVo workTicketVo = fristWorkFlowResponse.getWorkTicketVo(); WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); //2.流程处理 - Integer flowStatus = workTicket.getFlowStatus(); - FlowWorkTicketConstants enumByStatus = FlowWorkTicketConstants.getEnumByStatus(flowStatus); - 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; + String businessKey = response.getBusinessKey(); + WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(businessKey); + if (ObjectUtils.isEmpty(workTicketInfo) || ObjectUtils.isEmpty(workTicket.getId())) { + log.error("获取工作票的数据为不存在"); + return; + } + //更新工作票 + if (workTicket.getId() == null) { + workTicket.setId(workTicketInfo.getId()); + } + + //工作流ID + if (StringUtils.isEmpty(workTicketInfo.getProcessInstanceId())) { + workTicket.setProcessInstanceId(response.getProcessInstanceId()); } + + workTicketInfoService.updateById(workTicket); + //更新安全措施 + List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); + if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { + log.info("获取安全措施的数据:{}", safetyMeasuresList); + safetyMeasuresList.forEach(item -> { + if (ObjectUtils.isEmpty(item.getId())) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId, workTicketInfo.getId()); + workTicketSafetyMeasureService.update(item, queryWrapper); + } else { + workTicketSafetyMeasureService.updateById(item); + } + }); + } + //工作票工作任务组 + List workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); + if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { + log.info("获取工作票工作任务组:{}", workTicketContentDtoList); + workTicketContentDtoList.forEach(item -> { + if (ObjectUtils.isEmpty(item.getId())) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketContentEntity::getTicketId, workTicketInfo.getId()); + contentService.update(item, queryWrapper); + } else { + contentService.updateById(item); + } + }); + } + // 工作票延期 + WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); + if (ObjectUtils.isNotEmpty(workTicketDelay) && ObjectUtils.isNotEmpty(workTicketDelay.getCreateUser())) { + log.info("获取工作票延期:{}", workTicketDelay); + try { + workTicketDelay.setCreateDept(workTicket.getCreateDept()); + workTicketDelay.setTicketId(workTicketInfo.getId()); + workTicketDelay.setTenantId(workTicketInfo.getTenantId()); + if (ObjectUtils.isEmpty(workTicketDelay.getId())) { + workTicketDelayService.save(workTicketDelay); + } else { + workTicketDelayService.updateById(workTicketDelay); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + //工作结束 + WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); + if (ObjectUtils.isNotEmpty(workTicketFinish) && ObjectUtils.isNotEmpty(workTicketFinish.getPrincipal())) { + log.info("获取工作结束:{}", workTicketFinish); + if (ObjectUtils.isEmpty(workTicketFinish.getId())) { + workTicketDelay.setTicketId(workTicketInfo.getId()); + //workTicketDelay.setInitialTime(LocalDateTime.now()); + workTicketFinishService.save(workTicketFinish); + } else { + workTicketDelay.setInitialTime(LocalDateTime.now()); + workTicketFinishService.updateById(workTicketFinish); + } + } + + //工作开始时间和结束时间 + List workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities(); + if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) { + log.info("工作开始时间和结束时间:{}", workTicketFinish); + 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 */ @@ -236,12 +408,12 @@ public class TicketProcessServiceImpl implements TicketProcessService { workTicketInfoService.updateById(workTicket); - } /** * 工作票转移 + * * @param response * @param workTicketVo */ @@ -341,7 +513,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { * @param workTicketVo */ private void license(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { - List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); + List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); if (CollectionUtils.isEmpty(safetyMeasuresList)) { log.error("没有安全措施数据"); return; @@ -349,7 +521,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { //更新安全措施的状态 List workTicketSafetyMeasureEntities = new ArrayList<>(); - for (WorkTicketSafetyMeasureDto workTicketSafetyMeasureDto : safetyMeasuresList) { + for (WorkTicketSafetyMeasureEntity workTicketSafetyMeasureDto : safetyMeasuresList) { WorkTicketSafetyMeasureEntity workTicketSafetyMeasureEntity = BeanUtil.copyProperties(workTicketSafetyMeasureDto, WorkTicketSafetyMeasureEntity.class); workTicketSafetyMeasureEntities.add(workTicketSafetyMeasureEntity); } @@ -373,8 +545,8 @@ public class TicketProcessServiceImpl implements TicketProcessService { //负责人确认时间 //workTicket.setConfirmDateTime(workTicketVo.getWorkTicket().getConfirmDateTime()); - workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getStatus()); - workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getDescription()); + workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus()); + workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription()); //更新状态值 workTicketInfoService.updateById(workTicket); } @@ -391,8 +563,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { //值班负责人 workTicket.setWatchPrincipal(workTicketVo.getWorkTicket().getPrincipal()); workTicket.setWatchPrincipalEndTime(workTicketVo.getWorkTicket().getWatchPrincipalEndTime()); - - workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getStatus()); workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getDescription()); //更新状态值 @@ -420,9 +590,9 @@ public class TicketProcessServiceImpl implements TicketProcessService { */ //@Transactional(rollbackFor = Exception.class) public void sign(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { - WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); + WorkTicketInfoEntity workTicketInfoEntity = workTicketVo.getWorkTicket(); //更新状态值 - WorkTicketInfoEntity workTicketInfoEntity = new WorkTicketInfoEntity(); + workTicketInfoEntity.setStatus(FlowWorkTicketConstants.RECEIVE.getStatus()); workTicketInfoEntity.setFlowStatus(FlowWorkTicketConstants.RECEIVE.getStatus()); workTicketInfoEntity.setFlowDescription(FlowWorkTicketConstants.RECEIVE.getDescription()); workTicketInfoEntity.setSignerDateTime(workTicketVo.getWorkTicket().getSignerDateTime()); @@ -436,10 +606,11 @@ public class TicketProcessServiceImpl implements TicketProcessService { private void make(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); workTicket.setProcessInstanceId(response.getProcessInstanceId()); + workTicket.setStatus(FlowWorkTicketConstants.SIGN.getStatus()); + workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN.getStatus()); + workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN.getDescription()); //保存工作流实例ID - workTicketInfoService.update(Wrappers.lambdaUpdate(). - set(WorkTicketInfoEntity::getProcessInstanceId, response.getProcessInstanceId()). - set(WorkTicketInfoEntity::getFlowStatus, FlowWorkTicketConstants.SIGN.getStatus()).set(WorkTicketInfoEntity::getFlowDescription, FlowWorkTicketConstants.SIGN.getDescription()).eq(WorkTicketInfoEntity::getId, workTicket.getId())); + workTicketInfoService.updateById(workTicket); //处理来源任务 this.returnTicket(workTicketVo); } @@ -477,41 +648,31 @@ public class TicketProcessServiceImpl implements TicketProcessService { * @param newFirstWorkTicketFlowKey * @param workTicketVo */ - private void - dealProcess(String newFirstWorkTicketFlowKey, WorkTicketVo workTicketVo) { + private void dealProcess(String newFirstWorkTicketFlowKey, WorkTicketVo workTicketVo) { //若为线下工作票 则无需开启工作流 Integer status = WorkTicketConstants.FirstWorkTicketStatusEnum.SIGN.getStatus(); - if (status.intValue() != workTicketVo.getWorkTicket().getStatus().intValue()) { + if (status.intValue() != workTicketVo.getWorkTicket().getFlowStatus().intValue()) { return; } - log.info("租户Id:{}",AuthUtil.getTenantId()); - log.info("用户部门Id: {}",AuthUtil.getUser().getDeptId()); - log.info("用户Id: {}",AuthUtil.getUserId()); + log.info("租户Id:{}", AuthUtil.getTenantId()); + log.info("用户部门Id: {}", AuthUtil.getUser().getDeptId()); + log.info("用户Id: {}", AuthUtil.getUserId()); //获取签发人角色下的人员 R> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.parseLong(AuthUtil.getUser().getDeptId()), TicketConstants.SIGNER_ROLE); if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { throw new ServiceException("工作票签发人角色下未查询到相关人员"); } - log.info("获取签发人角色下的人员: {}",listR.getData()); + log.info("获取签发人角色下的人员: {}", listR.getData()); Map params = new HashMap<>(4); - params.put("workTicketVo",workTicketVo); + params.put("workTicketVo", workTicketVo); + //已开启流程 + workTicketVo.setIsState(true); + log.info("获取表单的数据: {}", workTicketVo); R processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(newFirstWorkTicketFlowKey, String.valueOf(workTicketVo.getWorkTicket().getId()), workTicketVo.getWorkTicket().getWorkContent(), params); if (!processInstanceContainNameByKey.isSuccess() && processInstanceContainNameByKey.getData() == null) { throw new ServiceException("启动流程失败..."); } - //获取BladeFlow 数据库 - BladeFlow bladeFlow = processInstanceContainNameByKey.getData(); - log.info("获取工作流新的数据: {}",bladeFlow); - WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); - workTicket.setProcessInstanceId(bladeFlow.getProcessInstanceId()); - workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN.getStatus()); - workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN.getDescription()); - //保存工作流实例ID - firstWorkTicketService.updateById(workTicket); - workTicketVo.setWorkTicket(workTicket); - //处理来源任务 - this.returnTicket(workTicketVo); } @@ -521,15 +682,14 @@ public class TicketProcessServiceImpl implements TicketProcessService { * @param workTicketContentDtoList * @param workTicketInfoEntity */ - private void saveWorkTicketContentDto(List workTicketContentDtoList, WorkTicketInfoEntity workTicketInfoEntity) { + private void saveWorkTicketContentDto(List workTicketContentDtoList, WorkTicketInfoEntity workTicketInfoEntity) { if (CollectionUtils.isEmpty(workTicketContentDtoList)) { return; } List contentEntities = workTicketContentDtoList.stream().map(contentDto -> { - WorkTicketContentEntity contentEntity = BeanUtil.copy(contentDto, WorkTicketContentEntity.class); - contentEntity.setTicketId(workTicketInfoEntity.getId()); - contentEntity.setCreateDept(workTicketInfoEntity.getCreateDept()); - return contentEntity; + contentDto.setTicketId(workTicketInfoEntity.getId()); + contentDto.setCreateDept(workTicketInfoEntity.getCreateDept()); + return contentDto; }).collect(Collectors.toList()); boolean savedBatch = contentService.saveBatch(contentEntities); if (!savedBatch) { @@ -545,16 +705,16 @@ public class TicketProcessServiceImpl implements TicketProcessService { * @param safetyMeasuresList * @param workTicketInfoEntity */ - private void saveSafetyMeasures(List safetyMeasuresList, WorkTicketInfoEntity workTicketInfoEntity) { + private void saveSafetyMeasures(List safetyMeasuresList, WorkTicketInfoEntity workTicketInfoEntity) { if (CollectionUtil.isEmpty(safetyMeasuresList)) { return; } + log.info("获取安全措施的数据:{}", safetyMeasuresList); List measureEntityList = safetyMeasuresList.stream().map(measure -> { - WorkTicketSafetyMeasureEntity measureEntity = BeanUtil.copy(measure, WorkTicketSafetyMeasureEntity.class); - measureEntity.setTicketId(workTicketInfoEntity.getId()); - measureEntity.setCreateDept(workTicketInfoEntity.getCreateDept()); - measureEntity.setCreateUser(workTicketInfoEntity.getCreateUser()); - return measureEntity; + measure.setTicketId(workTicketInfoEntity.getId()); + measure.setCreateDept(workTicketInfoEntity.getCreateDept()); + measure.setCreateUser(workTicketInfoEntity.getCreateUser()); + return measure; }).collect(Collectors.toList()); boolean savedBatch = workTicketSafetyMeasureService.saveBatch(measureEntityList); if (!savedBatch) { @@ -630,4 +790,109 @@ public class TicketProcessServiceImpl implements TicketProcessService { return stringJoiner.toString(); } + + /** + * 预览 + * + * @param ticketType + * @param ticketId + */ + @Override + public void preview(String ticketType, Long ticketId) { + WorkTicketVo workTicketVo = ticketInfoService.selectDetailsById(ticketId); + //将查询的数据转换为map + Map workTicketInfoMap = this.convertMap(workTicketVo); + + String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(ticketType) + PdfUtils.XLSX_SUFFIX; + log.info("工作票模板为:{}", fileName); + TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); + Workbook workbook = null; + try { + workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap); + } catch (Exception e) { + e.printStackTrace(); + } + //上传xlsx至服务器 + try { + ExcelUtil.upload(workbook, xlsSavePath, workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.XLSX_SUFFIX); + } catch (Exception e) { + e.printStackTrace(); + } + //将xlsx文件转换为pdf并保存 + String pdfFileName = workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.PDF_SUFFIX; + String xlsFileName = workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.XLSX_SUFFIX; + PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); + String savePath = pdfSavePath + pdfFileName; + // 设置response参数,可以打开下载页面 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletResponse response = servletRequestAttributes.getResponse(); + PdfUtils.readPdf(response, savePath); + } + + + //封装map 转换 excel导出 + private Map convertMap(WorkTicketVo workTicketVo) { + Map result = new HashMap<>(); + WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); + //1. 工作对象 + Map workTicketInfoMap = PdfUtils.objectToMap(workTicket); + result.putAll(workTicketInfoMap); + //2. 安全措施 + List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); + if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { + Map> measureMap = safetyMeasuresList.stream() + .collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType)); + Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()).forEach(measureEnum -> { + if (CollectionUtil.isNotEmpty(measureMap.get(measureEnum.getType()))) { + List> mapList = measureMap.get(measureEnum.getType()).stream().map(measureVO -> { + Map map = PdfUtils.objectToMap(measureVO); + map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); + String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measureVO.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList()); + workTicketInfoMap.put(measureEnum.getConvertAttributes(), mapList); + } else { + workTicketInfoMap.put(measureEnum.getConvertAttributes(), new ArrayList>(1)); + } + }); + } + //3. 工作票工作任务组 + List workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); + if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { + result.put("workTicketContentDtoList", workTicketContentDtoList); + } + + //4. 工作票延期 + WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); + if (ObjectUtils.isNotEmpty(workTicketDelay)) { + result.putAll(PdfUtils.objectToMap(workTicketDelay)); + } + + //5. 工作结束 + WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); + if (ObjectUtils.isNotEmpty(workTicketFinish)) { + result.putAll(PdfUtils.objectToMap(workTicketFinish)); + } + + //5. 工作票负责人变更 + WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); + if (ObjectUtils.isNotEmpty(workTicketPrincipalChange)) { + result.putAll(PdfUtils.objectToMap(workTicketPrincipalChange)); + } + + return result; + } + + + /** + * 对象转map + */ + private static Map parseObjectMap(T target, Class clas) { + return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class); + } } + + + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java index 17c044d..e093a17 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketFinishServiceImpl.java @@ -1,11 +1,15 @@ package com.hnac.hzims.ticket.twoTicket.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.mapper.WorkTicketFinishMapper; import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 工作结束 服务实现类 @@ -17,4 +21,17 @@ import org.springframework.stereotype.Service; @Service public class WorkTicketFinishServiceImpl extends ServiceImpl implements IWorkTicketFinishService { + + /** + * 工作结束 + * + * @param ticketId + * @return + */ + @Override + public WorkTicketFinish selectByTicketId(Long ticketId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketFinish::getTicketId,ticketId); + return this.getOne(queryWrapper); + } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/FristWorkTicketVo.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/FristWorkTicketVo.java new file mode 100644 index 0000000..25a44f3 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/FristWorkTicketVo.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.ticket.twoTicket.vo.process; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/5/4 15:17 + */ +@Data +public class FristWorkTicketVo implements Serializable { + + /** + * 签发人签发是否同意 + */ + private boolean signFlag; + + private String flag; + + private boolean pass; + + + /** + * 工作表单 + */ + private WorkTicketVo workTicketVo; + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java index 904541b..378d8ad 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java @@ -1,13 +1,7 @@ package com.hnac.hzims.ticket.twoTicket.vo.process; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; -import com.hnac.hzims.ticket.workTicket.dto.WorkTicketContentDto; -import com.hnac.hzims.ticket.workTicket.dto.WorkTicketSafetyMeasureDto; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketOperateTimeEntity; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketPrincipalChangeEntity; -import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketPrincipalChangeServiceImpl; +import com.hnac.hzims.ticket.workTicket.entity.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -36,14 +30,15 @@ public class WorkTicketVo { * 安全措施 */ @ApiModelProperty("安全措施数组") - private List safetyMeasuresList; + private List safetyMeasuresList; /** * 工作票工作任务组 + * */ @ApiModelProperty("工作票工作任务组") - private List workTicketContentDtoList; + private List workTicketContentDtoList; /** @@ -73,5 +68,10 @@ public class WorkTicketVo { private WorkTicketPrincipalChangeEntity workTicketPrincipalChange; + /** + * 开启流程 + */ + private Boolean isState = true; + } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketContentService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketContentService.java index 6a75ff3..61f3cb8 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketContentService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketContentService.java @@ -15,4 +15,11 @@ public interface IWorkTicketContentService extends BaseService list(WorkTicketContentEntity req); + + /** + * 获取工作票工作任务组 + * @param ticketId + * @return + */ + List selectByTicketId(Long ticketId); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketDelayService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketDelayService.java index 5d2368d..8f2c35f 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketDelayService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketDelayService.java @@ -1,6 +1,7 @@ package com.hnac.hzims.ticket.workTicket.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketDelayDto; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity; @@ -54,4 +55,11 @@ public interface IWorkTicketDelayService extends BaseService list(WorkTicketOperateTimeDto req); + + /** + * 工作开始时间和结束时间 + * @param ticketId + * @return + */ + List selectByTicketId(Long ticketId); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketPrincipalChangeService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketPrincipalChangeService.java index 1f60935..ca095d3 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketPrincipalChangeService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketPrincipalChangeService.java @@ -42,4 +42,12 @@ public interface IWorkTicketPrincipalChangeService extends BaseService measureList); + + /** + * 根据工作票编号对应安全措施数组 + * @param ticketId + * @return + */ + List selectByTicketId(Long ticketId); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketContentServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketContentServiceImpl.java index c5b26cd..1b9bd2f 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketContentServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketContentServiceImpl.java @@ -1,7 +1,9 @@ package com.hnac.hzims.ticket.workTicket.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketContentEntity; +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketSafetyMeasureEntity; import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketContentMapper; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService; import lombok.extern.slf4j.Slf4j; @@ -21,4 +23,18 @@ public class WorkTicketContentServiceImpl extends BaseServiceImpl list(WorkTicketContentEntity req) { return this.list(Condition.getQueryWrapper(new WorkTicketContentEntity(),req)); } + + /** + * 获取工作票工作任务组 + * + * @param ticketId + * @return + */ + @Override + public List selectByTicketId(Long ticketId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketContentEntity::getTicketId,ticketId); + List entities = this.list(queryWrapper); + return entities; + } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketDelayServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketDelayServiceImpl.java index a8e5d28..bef4832 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketDelayServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketDelayServiceImpl.java @@ -9,8 +9,10 @@ import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.dto.TaskFlowDTO; import com.hnac.hzims.operational.maintenance.feign.ITaskClient; import com.hnac.hzims.ticket.constants.TicketConstants; +import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketDelayDto; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketContentEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity; import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketDelayMapper; import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketInfoMapper; @@ -110,6 +112,20 @@ public class WorkTicketDelayServiceImpl extends BaseServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketDelayEntity::getTicketId,ticketId); + List entities = this.list(queryWrapper); + return entities.get(0); + } + + /** * 更新任务延期时间状态 * @param infoDto */ diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index 7bbe64b..40ace2c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; @@ -22,12 +24,13 @@ import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; import com.hnac.hzims.ticket.aspect.AroundFlow; import com.hnac.hzims.ticket.constants.TicketConstants; +import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants; +import com.hnac.hzims.ticket.twoTicket.service.impl.WorkTicketFinishServiceImpl; +import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo; import com.hnac.hzims.ticket.utils.ExcelUtil; import com.hnac.hzims.ticket.workTicket.dto.*; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketFlowEntity; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; +import com.hnac.hzims.ticket.workTicket.entity.*; import com.hnac.hzims.ticket.workTicket.mapper.WorkDelayNoScopeMapper; import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketInfoMapper; import com.hnac.hzims.ticket.workTicket.service.*; @@ -98,6 +101,8 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpllambdaUpdate() - .set(WorkTicketInfoEntity::getProcessInstanceId, bladeFlow.getProcessInstanceId()) - .eq(WorkTicketInfoEntity::getId, req.getId())); + this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getProcessInstanceId, bladeFlow.getProcessInstanceId()).eq(WorkTicketInfoEntity::getId, req.getId())); //将票据ID会传至计划/任务内 returnTicket(req); return R.success("保存成功"); @@ -158,22 +161,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpllambdaQuery() - .eq(WorkTicketFlowEntity::getTicketId, ticketId) - .eq(WorkTicketFlowEntity::getFlowCode, TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()) - .orderByDesc(WorkTicketFlowEntity::getCreateTime) - .last("limit 1;") - ); - workTicketFlowService.update(Wrappers.lambdaUpdate() - .set(WorkTicketFlowEntity::getExecutor, AuthUtil.getUserId().toString()) - .set(WorkTicketFlowEntity::getExecuteTime, LocalDateTime.now()) - .eq(WorkTicketFlowEntity::getId, workTicketFlowEntity.getId()) - ); + WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.lambdaQuery().eq(WorkTicketFlowEntity::getTicketId, ticketId).eq(WorkTicketFlowEntity::getFlowCode, TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()).orderByDesc(WorkTicketFlowEntity::getCreateTime).last("limit 1;")); + workTicketFlowService.update(Wrappers.lambdaUpdate().set(WorkTicketFlowEntity::getExecutor, AuthUtil.getUserId().toString()).set(WorkTicketFlowEntity::getExecuteTime, LocalDateTime.now()).eq(WorkTicketFlowEntity::getId, workTicketFlowEntity.getId())); //更新工作票状态 - this.update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getStatus, status) - .eq(WorkTicketInfoEntity::getId, ticketId) - ); + this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, status).eq(WorkTicketInfoEntity::getId, ticketId)); //创建延期流程 WorkTicketInfoEntity infoEntity = this.getById(ticketId); WorkTicketFlowEntity currentFlowEntity = new WorkTicketFlowEntity(); @@ -266,9 +257,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpllambdaUpdate() - .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()) - .eq(WorkTicketInfoEntity::getId, id)); + boolean flag = this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()).eq(WorkTicketInfoEntity::getId, id)); /**线下单独删除**/ if (TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())) { @@ -305,8 +294,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream() - .collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); + Map> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream().collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))) { workTicketInfoMap.put("matterLibraryListOne", measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure -> { Map map = PdfUtils.objectToMap(measure); @@ -346,8 +334,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList(); //签发 - List signFlow = workTicketFlowVOList.stream() - .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + List signFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(signFlow)) { workTicketInfoMap.put("signer", signFlow.get(0).getCreateUserName()); workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); @@ -365,8 +352,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl receiveFlow = workTicketFlowVOList.stream() - .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + List receiveFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(receiveFlow)) { workTicketInfoMap.put("receivePrincipal", receiveFlow.get(0).getCreateUserName()); workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); @@ -377,8 +363,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl confirmFlow = workTicketFlowVOList.stream() - .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + List confirmFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(confirmFlow)) { workTicketInfoMap.put("confirmPrincipal", confirmFlow.get(0).getCreateUserName()); workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); @@ -387,8 +372,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl finishFlow = workTicketFlowVOList.stream() - .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + List finishFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(finishFlow)) { workTicketInfoMap.put("finisher", finishFlow.get(0).getCreateUserName()); workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); @@ -399,8 +383,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl endFlow = workTicketFlowVOList.stream() - .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); + List endFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(endFlow)) { workTicketInfoMap.put("endLicensor", endFlow.get(0).getCreateUserName()); workTicketInfoMap.put("endTime", DateUtil.format(endFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); @@ -431,8 +414,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList(); if (CollectionUtil.isNotEmpty(membersChangeList)) { /**工作成员变更详情**/ - String membersChangeSituation = membersChangeList.stream().map(mc -> - DateUtil.format(mc.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); + String membersChangeSituation = membersChangeList.stream().map(mc -> DateUtil.format(mc.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); workTicketInfoMap.put("membersChangeSituation", membersChangeSituation); workTicketInfoMap.put("memberChangePrincipal", membersChangeList.get(0).getCreateUserName()); } else { @@ -539,13 +521,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpllambdaUpdate() - .set(WorkTicketInfoEntity::getStatus, req.getStatus()) - .set(WorkTicketInfoEntity::getPrincipal, req.getPrincipal()) - .set(WorkTicketInfoEntity::getLicensor, req.getLicensor()) - .set(WorkTicketInfoEntity::getLicenseTime, req.getLicenseTime()) - .set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()) - .eq(WorkTicketInfoEntity::getId, req.getId())); + boolean flag = this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, req.getStatus()).set(WorkTicketInfoEntity::getPrincipal, req.getPrincipal()).set(WorkTicketInfoEntity::getLicensor, req.getLicensor()).set(WorkTicketInfoEntity::getLicenseTime, req.getLicenseTime()).set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()).eq(WorkTicketInfoEntity::getId, req.getId())); //新增流程信息 WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity(); @@ -732,13 +708,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpllambdaUpdate() - .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()) - .set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId()) - .set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now()) - .set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()) - .eq(WorkTicketInfoEntity::getId, ticketId) - ); + update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()).set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId()).set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now()).set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()).eq(WorkTicketInfoEntity::getId, ticketId)); return R.success("操作成功"); } @@ -752,10 +722,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpllambdaUpdate() - .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()) - .eq(WorkTicketInfoEntity::getId, infoDto.getId()) - ); + update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()).eq(WorkTicketInfoEntity::getId, infoDto.getId())); //获取工作票实体类 WorkTicketInfoEntity infoEntity = getById(infoDto.getId()); //根据任务类型执行任务 @@ -876,45 +843,38 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl workTicketListByMonthAndArea(Page pageEntity, - StandardTicketWithAreaVo areaVo) { + public BladePage workTicketListByMonthAndArea(Page pageEntity, StandardTicketWithAreaVo areaVo) { //1.查询 QueryWrapper queryWrapper = new QueryWrapper<>(); //开票来源 - queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", - areaVo.getTaskType()); + queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType()); //编号 queryWrapper.like(Func.isNotEmpty(areaVo.getCode()), "sti.code", areaVo.getCode()); //状态 - queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", - areaVo.getStatus()); + queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus()); //开始时间 - queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", - areaVo.getStartTime()); + queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime()); //结束时间 - queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", - areaVo.getEndTime()); + queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime()); queryWrapper.eq("sti.create_dept", areaVo.getAreaId()); - queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(sti.create_time,'%Y-%m')", - areaVo.getYearMonth()); + queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth()); //如果为1为合格 // queryWrapper.eq("tie.status",1); Page workTicketInfoEntityPage = baseMapper.selectPages(pageEntity, queryWrapper); //数据转换 List standardWorkList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(workTicketInfoEntityPage.getRecords())) { - standardWorkList = workTicketInfoEntityPage.getRecords() - .stream().map(workTicketInfoEntity -> { - StandardWorkVo standardWorkVo = new StandardWorkVo(); - BeanUtils.copyProperties(workTicketInfoEntity, standardWorkVo); - return standardWorkVo; - }).collect(Collectors.toList()); + standardWorkList = workTicketInfoEntityPage.getRecords().stream().map(workTicketInfoEntity -> { + StandardWorkVo standardWorkVo = new StandardWorkVo(); + BeanUtils.copyProperties(workTicketInfoEntity, standardWorkVo); + return standardWorkVo; + }).collect(Collectors.toList()); } IPage page = new Page<>(); @@ -936,8 +896,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId()); - ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, - TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode()); // 查询合格评价 int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper); return count > 0; @@ -956,6 +915,67 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl queryWrapper = new LambdaUpdateWrapper<>(); queryWrapper.set(WorkTicketInfoEntity::getFlowStatus, status); queryWrapper.set(WorkTicketInfoEntity::getFlowDescription, description); - queryWrapper.eq(WorkTicketInfoEntity::getId,id); + queryWrapper.eq(WorkTicketInfoEntity::getId, id); + } + + /** + * 获取工作详情 + * + * @param ticketId + * @return + */ + @Override + public WorkTicketVo selectDetailsById(Long ticketId) { + WorkTicketVo workTicketVo = new WorkTicketVo(); + + //1. 获取工作票详情数据 + WorkTicketInfoEntity workTicketInfo = this.getById(ticketId); + if (ObjectUtils.isEmpty(workTicketInfo)) { + throw new ServiceException("未查询到ticketId对应的信息"); + } + workTicketVo.setWorkTicket(workTicketInfo); + + //2. 安全措施数组 + List workTicketSafetyMeasureEntity = workTicketSafetyMeasureService.selectByTicketId(ticketId); + if (CollectionUtils.isNotEmpty(workTicketSafetyMeasureEntity)) { + workTicketVo.setSafetyMeasuresList(workTicketSafetyMeasureEntity); + } + + //3. 工作票工作任务组 + List workTicketContentEntities = workTicketContentService.selectByTicketId(ticketId); + if (CollectionUtils.isNotEmpty(workTicketContentEntities)) { + workTicketVo.setWorkTicketContentDtoList(workTicketContentEntities); + } + + //4. 工作票延期 + WorkTicketDelayEntity workTicketDelayEntity = delayService.selectByTicketId(ticketId); + if (ObjectUtils.isNotEmpty(workTicketDelayEntity)) { + workTicketVo.setWorkTicketDelay(workTicketDelayEntity); + } + + + //5.工作结束 + WorkTicketFinish workTicketFinish = workTicketFinishService.selectByTicketId(ticketId); + if (ObjectUtils.isNotEmpty(workTicketFinish)) { + workTicketVo.setWorkTicketFinish(workTicketFinish); + } + + + //6.工作开始时间和结束时间 + List workTicketOperateTimeEntities = + workTicketOperateTimeService.selectByTicketId(ticketId); + if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) { + workTicketVo.setWorkTicketOperateTimeEntities(workTicketOperateTimeEntities); + } + + + //7. 工作票负责人变更 + WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = + workTicketPrincipalChangeService.selectByTicketId(ticketId); + if (ObjectUtils.isNotEmpty(workTicketPrincipalChangeEntity)) { + workTicketVo.setWorkTicketPrincipalChange(workTicketPrincipalChangeEntity); + } + + return workTicketVo; } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketOperateTimeServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketOperateTimeServiceImpl.java index a8418cc..702ae59 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketOperateTimeServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketOperateTimeServiceImpl.java @@ -3,6 +3,7 @@ package com.hnac.hzims.ticket.workTicket.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketOperateTimeDto; +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketOperateTimeEntity; import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketOperateTimeMapper; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketOperateTimeService; @@ -59,4 +60,19 @@ public class WorkTicketOperateTimeServiceImpl extends BaseServiceImpl selectByTicketId(Long ticketId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketOperateTimeEntity::getTicketId,ticketId); + List entities = this.list(queryWrapper); + return entities; + } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketPrincipalChangeServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketPrincipalChangeServiceImpl.java index 10201ce..d6b3c99 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketPrincipalChangeServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketPrincipalChangeServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.ticket.constants.TicketConstants; +import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketPrincipalChangeDto; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; @@ -84,4 +85,19 @@ public class WorkTicketPrincipalChangeServiceImpl extends BaseServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketPrincipalChangeEntity::getTicketId,ticketId); + List workTicketPrincipalChangeEntities = this.list(queryWrapper); + return workTicketPrincipalChangeEntities.get(workTicketPrincipalChangeEntities.size() - 1); + } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketSafetyMeasureServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketSafetyMeasureServiceImpl.java index dc0fe91..71fb8a7 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketSafetyMeasureServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketSafetyMeasureServiceImpl.java @@ -1,6 +1,7 @@ package com.hnac.hzims.ticket.workTicket.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -207,4 +208,19 @@ public class WorkTicketSafetyMeasureServiceImpl extends BaseServiceImpl selectByTicketId(Long ticketId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(WorkTicketSafetyMeasureEntity::getTicketId,ticketId); + List entities = this.list(queryWrapper); + return entities; + } } diff --git a/hzims-service/ticket/src/main/resources/file/新工作票.bpmn20.xml b/hzims-service/ticket/src/main/resources/file/新工作票.bpmn20.xml index fbd5498..d0fdc4b 100644 --- a/hzims-service/ticket/src/main/resources/file/新工作票.bpmn20.xml +++ b/hzims-service/ticket/src/main/resources/file/新工作票.bpmn20.xml @@ -2,18 +2,16 @@ - + - + - - + - @@ -43,45 +41,48 @@ - + - - + - + - + - + - - - + + + + - - + + - + - + + + + @@ -104,10 +105,10 @@ - + - + @@ -134,9 +135,9 @@ - - - + + + @@ -158,7 +159,7 @@ - + @@ -167,8 +168,10 @@ - - + + + + @@ -191,8 +194,8 @@ - - + + diff --git a/hzims-service/ticket/src/main/resources/template/新电气第一种工作票模板.xlsx b/hzims-service/ticket/src/main/resources/template/新电气第一种工作票模板.xlsx new file mode 100644 index 0000000..d66fefa Binary files /dev/null and b/hzims-service/ticket/src/main/resources/template/新电气第一种工作票模板.xlsx differ