From 1cc419302feee61996ef6312c64ad999becfcc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 5 Jun 2023 10:35:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C=E7=A5=A8pr?= =?UTF-8?q?ocess=5Fdict=E5=AD=97=E5=85=B8=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/TicketProcessConstant.java | 5 +- .../controller/ProcessDictController.java | 44 ++++++++ .../ticket/processflow/entity/ProcessDict.java | 113 +++++++++++++++++++++ .../processflow/mapper/ProcessDictMapper.java | 14 +++ .../processflow/mapper/xml/ProcessTypeMapper.xml | 5 - .../processflow/service/ProcessDictService.java | 22 ++++ .../service/impl/ProcessDictServiceImpl.java | 33 ++++++ .../serviceimpl/OneTicketProcessServiceImpl.java | 15 ++- .../service/impl/TicketProcessServiceImpl.java | 16 ++- .../service/impl/WorkTicketInfoServiceImpl.java | 2 +- .../ticket/src/main/resources/application.yml | 1 + .../mapper/processflow/ProcessDictMapper.xml | 5 + .../mapper/processflow/ProcessTypeMapper.xml | 5 + 13 files changed, 267 insertions(+), 13 deletions(-) create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessDictController.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/ProcessDictMapper.java delete mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/xml/ProcessTypeMapper.xml create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/ProcessDictService.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/impl/ProcessDictServiceImpl.java create mode 100644 hzims-service/ticket/src/main/resources/mapper/processflow/ProcessDictMapper.xml create mode 100644 hzims-service/ticket/src/main/resources/mapper/processflow/ProcessTypeMapper.xml diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java index 46a48bc..7bef5ea 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java @@ -10,5 +10,8 @@ package com.hnac.hzims.ticket.processflow.constant; */ public class TicketProcessConstant { - public final static String STARTEVENT = "workTicketFlow"; + /** + * 第一种工作票的key + */ + public static final String FIRST_TICKET_KEY = "networking"; } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessDictController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessDictController.java new file mode 100644 index 0000000..f6b6fdf --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessDictController.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.ticket.processflow.controller; + +import com.hnac.hzims.ticket.processflow.entity.ProcessDict; +import com.hnac.hzims.ticket.processflow.service.ProcessDictService; +import groovy.util.logging.Slf4j; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/5 9:35 + */ + +@Slf4j +@RequestMapping("/process-dict") +@RestController +@RequiredArgsConstructor +public class ProcessDictController { + + + private final ProcessDictService processDictService; + + + + + @GetMapping("/test") + public void test(){ + ProcessDict processDict = new ProcessDict(); + processDict.setDictKey("networking"); + processDict.setDictSort(0); + processDict.setDictValue("workTicketFlow"); + processDict.setDictLabel("第一种工作票"); + processDict.setIsDefault("Y"); + processDict.setRemark("第一种工作票"); + processDict.setDictType("工作票"); + processDictService.save(processDict); + } + + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java new file mode 100644 index 0000000..d2240cb --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/ProcessDict.java @@ -0,0 +1,113 @@ +package com.hnac.hzims.ticket.processflow.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 票据字典表 + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/5 8:33 + */ +@Data +@ApiModel(value = "ProcessDict",description = "票据字典表") +@Accessors(chain = true) +public class ProcessDict { + + + /** + * 票据编码 + */ + @TableId(value = "dictCode",type = IdType.AUTO) + @ApiModelProperty("票据编码") + private Long dictCode; + + + /** + *票据排序 + */ + @ApiModelProperty("票据排序") + private Integer dictSort; + + + /** + *票据字典码 + */ + @ApiModelProperty("票据字典码") + private String dictKey; + + + /** + *票据流程标识 + */ + @ApiModelProperty("票据流程标识") + private String dictValue; + + + + /** + *票据标签 + */ + @ApiModelProperty("票据标签") + private String dictLabel; + + /** + *票据类型 + */ + @ApiModelProperty("票据类型") + private String dictType; + + /** + *是否默认(Y是 N否) + */ + @ApiModelProperty("是否默认(Y是 N否)") + private String isDefault; + + + /** + *状态(0正常 1停用) + */ + @ApiModelProperty("状态(0正常 1停用)") + private Integer status; + + + + /** + * 所属机构 + */ + @ApiModelProperty("所属机构") + private Long createDept; + + + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + + /** + * 更新时间 + */ + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + + + /** + * 票据备注 + */ + @ApiModelProperty("票据备注") + private String remark; +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/ProcessDictMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/ProcessDictMapper.java new file mode 100644 index 0000000..2bb86f5 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/ProcessDictMapper.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.ticket.processflow.mapper; + +import com.hnac.hzims.ticket.processflow.entity.ProcessDict; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/5 8:49 + */ +public interface ProcessDictMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/xml/ProcessTypeMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/xml/ProcessTypeMapper.xml deleted file mode 100644 index 39ffa8c..0000000 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/mapper/xml/ProcessTypeMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/ProcessDictService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/ProcessDictService.java new file mode 100644 index 0000000..7113a06 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/ProcessDictService.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.ticket.processflow.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.ticket.processflow.entity.ProcessDict; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/5 8:52 + */ +public interface ProcessDictService extends IService { + + + /** + * 根据字典key查询字典value + */ + String selectDictValueByKey(String dictKey); + + + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/impl/ProcessDictServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/impl/ProcessDictServiceImpl.java new file mode 100644 index 0000000..84fbfd9 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/service/impl/ProcessDictServiceImpl.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.ticket.processflow.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.ticket.processflow.entity.ProcessDict; +import com.hnac.hzims.ticket.processflow.mapper.ProcessDictMapper; +import com.hnac.hzims.ticket.processflow.service.ProcessDictService; +import groovy.util.logging.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/5 8:59 + */ +@Slf4j +@Service +public class ProcessDictServiceImpl extends ServiceImpl implements ProcessDictService { + /** + * 根据字典key查询字典value + * + * @param dictKey + */ + @Override + public String selectDictValueByKey(String dictKey) { + LambdaQueryChainWrapper processDictLambdaQueryChainWrapper = new LambdaQueryChainWrapper<>(baseMapper); + processDictLambdaQueryChainWrapper.eq(ProcessDict::getDictKey,dictKey); + return processDictLambdaQueryChainWrapper.one().getDictValue(); + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java index 82f64ce..1255079 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java @@ -1,6 +1,7 @@ package com.hnac.hzims.ticket.processflow.strategy.serviceimpl; import com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant; +import com.hnac.hzims.ticket.processflow.service.ProcessDictService; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse; import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; @@ -9,6 +10,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import static com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant.FIRST_TICKET_KEY; + /** * 开工作票流程实现类 * @@ -27,6 +30,15 @@ public class OneTicketProcessServiceImpl extends ProcessAbstractService { private final TicketProcessService ticketProcessService; + + private final ProcessDictService processDictService; + + + + + + + /** * 设置执行那种实现类 * @@ -36,7 +48,8 @@ public class OneTicketProcessServiceImpl extends ProcessAbstractService { @Override public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { log.info("是否执行开第一种工作票流程环节操作~~~~,流程ticket: {}", flowQueue); - if (TicketProcessConstant.STARTEVENT.equals(flowQueue.getProcessDefinitionKey())) { + String dictValue = processDictService.selectDictValueByKey(FIRST_TICKET_KEY); + if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { log.info("已执行第一种开工作票流程环节操作~~~~"); return true; } 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 73bd986..2c8d482 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 @@ -18,6 +18,7 @@ import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.WorkTicketConstants; +import com.hnac.hzims.ticket.processflow.service.ProcessDictService; import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse; import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant; @@ -68,6 +69,8 @@ import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; +import static com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant.FIRST_TICKET_KEY; + /** * 开票处理流程实现类 @@ -112,8 +115,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { private final IAccessTaskClient accessTaskClient; - private String newFirstWorkTicketFlowKey = "workTicketFlow"; - private final IStationClient stationClient; @@ -141,6 +142,9 @@ public class TicketProcessServiceImpl implements TicketProcessService { private final TicketInfoDangerService ticketInfoDangerService; + private final ProcessDictService processDictService; + + /** * 启动开票流程 * @@ -188,9 +192,11 @@ public class TicketProcessServiceImpl implements TicketProcessService { this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); //5. 保存工作任务 this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); - //6. 开启动作流 - this.dealProcess(newFirstWorkTicketFlowKey, workTicketVo); - //7. 处理任务 + //6. 查询第一种工作票值 + String dictValue = processDictService.selectDictValueByKey(FIRST_TICKET_KEY); + //7. 开启动作流 + this.dealProcess(dictValue, workTicketVo); + //8. 处理任务 this.returnTicket(workTicketVo); } 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 1da1885..0105a3d 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 @@ -256,7 +256,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl { User user = UserCache.getUser(item.getCreateUser()); if (user != null) { - item.setCreateUserName(UserCache.getUser(item.getCreateUser()).getName()); + item.setCreateUserName(user.getName()); } }); diff --git a/hzims-service/ticket/src/main/resources/application.yml b/hzims-service/ticket/src/main/resources/application.yml index 9341ce3..1de0a34 100644 --- a/hzims-service/ticket/src/main/resources/application.yml +++ b/hzims-service/ticket/src/main/resources/application.yml @@ -16,6 +16,7 @@ swagger: + #ticket: # workTickets: # - status: 1 diff --git a/hzims-service/ticket/src/main/resources/mapper/processflow/ProcessDictMapper.xml b/hzims-service/ticket/src/main/resources/mapper/processflow/ProcessDictMapper.xml new file mode 100644 index 0000000..1882427 --- /dev/null +++ b/hzims-service/ticket/src/main/resources/mapper/processflow/ProcessDictMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/ticket/src/main/resources/mapper/processflow/ProcessTypeMapper.xml b/hzims-service/ticket/src/main/resources/mapper/processflow/ProcessTypeMapper.xml new file mode 100644 index 0000000..39ffa8c --- /dev/null +++ b/hzims-service/ticket/src/main/resources/mapper/processflow/ProcessTypeMapper.xml @@ -0,0 +1,5 @@ + + + + +