From 708e1e7e351c15e2c9c01505ff4cc14b7771aadd Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 26 Jun 2023 08:11:21 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8A=BD?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../access/entity/OperAccessPlanEntity.java | 11 +++++ .../access/feign/AccessPlanV4ClientFallback.java | 2 +- .../access/feign/AccessTaskV4ClientFallback.java | 2 +- .../access/feign/IAccessPlanV4Client.java | 4 +- .../access/feign/IAccessTaskV4Client.java | 4 +- .../ecology/entity/EcologyFlowStationEntity.java | 2 - .../process/constant/TicketProcessConstant.java | 10 ++++ .../fallback/ProcessDictFeignServiceFallback.java | 3 +- .../process/feign/ProcessDictFeignService.java | 2 - .../serviceimpl/OverhaulPlanServiceImpl.java | 56 ++++++++++++++++++++++ .../serviceimpl/OverhaulTaskServiceImpl.java | 56 ++++++++++++++++++++++ .../access/controller/AccessPlanV4Controller.java | 3 +- .../access/feign/AccessPlanV4Client.java | 2 +- .../access/feign/AccessTaskV4Client.java | 3 +- .../access/service/AccessPlanV4Service.java | 2 +- .../access/service/AccessTaskV4Service.java | 2 +- .../service/impl/AccessPlanV4ServiceImpl.java | 18 +++++-- .../service/impl/AccessTaskV4ServiceImpl.java | 2 +- 18 files changed, 161 insertions(+), 23 deletions(-) create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessPlanEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessPlanEntity.java index 4a148ea..b58b9d9 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessPlanEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessPlanEntity.java @@ -1,6 +1,7 @@ package com.hnac.hzims.operational.access.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; import io.swagger.annotations.ApiModel; @@ -8,6 +9,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.util.Date; @@ -62,24 +65,32 @@ public class OperAccessPlanEntity extends TenantEntity { * 计划开始时间 */ @ApiModelProperty(value = "计划开始时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private Date planStartTime; /** * 计划结束时间 */ @ApiModelProperty(value = "计划结束时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private Date planEndTime; /** * 实际开始时间 */ @ApiModelProperty(value = "实际开始时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private Date actStartTime; /** * 实际结束时间 */ @ApiModelProperty(value = "实际结束时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private Date actEndTime; /** diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4ClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4ClientFallback.java index be198df..c98940f 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4ClientFallback.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4ClientFallback.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.feign; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Component; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4ClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4ClientFallback.java index 1229028..c85381e 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4ClientFallback.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4ClientFallback.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.feign; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Component; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessPlanV4Client.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessPlanV4Client.java index 8b6a736..18eba65 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessPlanV4Client.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessPlanV4Client.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.feign; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.OperationalConstants; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; @@ -18,7 +18,7 @@ public interface IAccessPlanV4Client { String API_PREFIX = "/feign/accessPlanV4"; - String PLAN_PROCESS_LISTENER = API_PREFIX + "listener"; + String PLAN_PROCESS_LISTENER = API_PREFIX + "/listener"; @PostMapping(PLAN_PROCESS_LISTENER) R listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse); diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessTaskV4Client.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessTaskV4Client.java index 63fdfe0..433216a 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessTaskV4Client.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessTaskV4Client.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.feign; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.OperationalConstants; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; @@ -18,7 +18,7 @@ public interface IAccessTaskV4Client { String API_PREFIX = "/feign/accessTaskV4"; - String PLAN_PROCESS_LISTENER = API_PREFIX + "listener"; + String PLAN_PROCESS_LISTENER = API_PREFIX + "/listener"; @PostMapping(PLAN_PROCESS_LISTENER) R listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse); diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java index 068222a..48ee5b1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java @@ -28,6 +28,4 @@ public class EcologyFlowStationEntity extends TenantEntity { private Long isTimely; private Long isComplete; - - private String city; } diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index 7770383..b88f81f 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -35,4 +35,14 @@ public class TicketProcessConstant { * 消缺流程 */ public static final String DEFECT_KEY = "defectDealty"; + + /** + * 检修计划 + */ + public static final String OVERHAUL_PLAN = "overhaul_plan"; + + /** + * 检修任务 + */ + public static final String OVERHAUL_TASK = "overhaul_task"; } diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java index d29fdfd..afe824b 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java @@ -2,6 +2,7 @@ package com.hnac.hzims.middle.process.fallback; import com.hnac.hzims.middle.process.feign.ProcessDictFeignService; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @@ -13,7 +14,7 @@ import java.time.LocalDateTime; * @Date 2023/6/15 15:17 */ @Slf4j -@Service +@Component public class ProcessDictFeignServiceFallback implements ProcessDictFeignService { /** * 获取工作票工作票唯一ID diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java index 4e213e4..27bc415 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java @@ -2,7 +2,6 @@ package com.hnac.hzims.middle.process.feign; import com.hnac.hzims.middle.process.fallback.ProcessDictFeignServiceFallback; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.stereotype.Repository; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -14,7 +13,6 @@ import java.time.LocalDateTime; * @Serial 1.0 * @Date 2023/6/15 15:16 */ -@Repository @FeignClient(value = "hzims-middle", fallback = ProcessDictFeignServiceFallback.class) public interface ProcessDictFeignService { diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java new file mode 100644 index 0000000..8d52efb --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java @@ -0,0 +1,56 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import com.hnac.hzims.operational.access.feign.IAccessPlanV4Client; +import com.hnac.hzims.operational.defect.feign.IOperDefectClient; +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.stereotype.Service; + +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.DEFECT_KEY; +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OVERHAUL_PLAN; + +/** + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class OverhaulPlanServiceImpl extends ProcessAbstractService { + + + private final IAccessPlanV4Client accessPlanV4Client; + + + private final ProcessDictService processDictService; + + + /** + * 消息确认 + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + String dictValue = processDictService.selectDictValueByKey(OVERHAUL_PLAN); + return dictValue.equals(flowQueue.getProcessDefinitionKey()); + } + + /** + * 两票管理业务方法 + * + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + R defect = accessPlanV4Client.listener(response); + if (!defect.isSuccess()) { + throw new ServiceException("检修计划业务执行异常!"); + } + } +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java new file mode 100644 index 0000000..3283052 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java @@ -0,0 +1,56 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import com.hnac.hzims.operational.access.feign.IAccessPlanV4Client; +import com.hnac.hzims.operational.access.feign.IAccessTaskV4Client; +import com.hnac.hzims.operational.defect.feign.IOperDefectClient; +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.stereotype.Service; + +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.*; + +/** + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class OverhaulTaskServiceImpl extends ProcessAbstractService { + + + private final IAccessTaskV4Client accessTaskV4Client; + + + private final ProcessDictService processDictService; + + + /** + * 消息确认 + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + String dictValue = processDictService.selectDictValueByKey(OVERHAUL_TASK); + return dictValue.equals(flowQueue.getProcessDefinitionKey()); + } + + /** + * 调用检修业务处理 + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + R defect = accessTaskV4Client.listener(response); + if (!defect.isSuccess()) { + throw new ServiceException("检修任务业务执行异常!"); + + } + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessPlanV4Controller.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessPlanV4Controller.java index aa0b2af..f52d218 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessPlanV4Controller.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessPlanV4Controller.java @@ -9,6 +9,7 @@ import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -32,7 +33,7 @@ public class AccessPlanV4Controller extends BladeController { @PostMapping("/overhaul_start_v4") @ApiOperationSupport(order = 1) @ApiOperation(value = "v4检修计划流程开启") - public R startV4(AccessPlanV4DTO entity) { + public R startV4(@RequestBody AccessPlanV4DTO entity) { return R.status(service.startProcessV4(entity)); } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4Client.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4Client.java index f5d4a88..73ed760 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4Client.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessPlanV4Client.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.feign; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.service.AccessPlanV4Service; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4Client.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4Client.java index 1063a61..a4684f3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4Client.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskV4Client.java @@ -1,7 +1,6 @@ package com.hnac.hzims.operational.access.feign; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; -import com.hnac.hzims.operational.access.service.AccessPlanV4Service; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.service.AccessTaskV4Service; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessPlanV4Service.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessPlanV4Service.java index 9ec840d..f95e019 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessPlanV4Service.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessPlanV4Service.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.service; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.dto.AccessPlanV4DTO; /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessTaskV4Service.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessTaskV4Service.java index edffde2..409624b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessTaskV4Service.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessTaskV4Service.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.access.service; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java index fa8d63c..a5abe1f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java @@ -1,8 +1,9 @@ package com.hnac.hzims.operational.access.service.impl; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.dto.*; import com.hnac.hzims.operational.access.entity.OperAccessContentEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; @@ -11,6 +12,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomUtils; 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; @@ -19,6 +21,7 @@ import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; +import org.springblade.flow.core.utils.TaskUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -74,6 +77,7 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ private void saveAccess(AccessPlanV4DTO entity) { // 检修计划保存 entity.setCode("PLAN_" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999))); + entity.setProcDefId("overhaul_plan"); planService.save(entity); } @@ -143,7 +147,9 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ */ private void startProcess(AccessPlanV4DTO entity) { Map variables = JSONObject.parseObject(JSONObject.toJSONString(entity), Map.class); + variables.put("creator", TaskUtil.getTaskUser(String.valueOf(AuthUtil.getUserId()))); R result = flowClient.startProcessInstanceContainNameByKey("overhaul_plan", FlowUtil.getBusinessKey("access_plan_v4",String.valueOf(entity.getId())), entity.getName(), variables); + log.error("start_process_planV4 :{}",result); // 更新任务流程Id if (result.isSuccess()) { BladeFlow flow = result.getData(); @@ -162,16 +168,18 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ @Override public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { Map variables = (Map) processWorkFlowResponse.getVariables(); - AccessPlanV4DTO entity = JSONObject.parseObject(variables.toString(), AccessPlanV4DTO.class); + AccessPlanV4DTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference(){}); + // 当前流程名称 entity.setTaskName(processWorkFlowResponse.getTaskName()); + // 流程阶段执行人员名称 entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator()); - if((Boolean) variables.get("pass")){ + if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){ entity.setTaskName("流程结束"); - entity.setNextStepOperator("流程结束,不需要人员处理"); + entity.setNextStepOperator("流程结束,无需人员处理"); // 开启检修任务 this.startTaskProcess(entity); } - this.saveAccess(entity); + this.planService.updateById(entity); this.saveAccessMaterial(entity); this.saveAccessContent(entity); return true; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java index 6eed515..111f711 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java @@ -3,7 +3,7 @@ package com.hnac.hzims.operational.access.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; import com.hnac.hzims.operational.access.dto.OperAccessTaskDetailDTO; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;