Forráskód Böngészése

1、已发起列表接口返回增加状态描述信息

dongpo 3 hete
szülő
commit
36728a119f

+ 3 - 0
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java

@@ -26,6 +26,9 @@ public class BpmProcessInstanceRespVO {
     @Schema(description = "流程实例的状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
     private Integer status; // 参见 BpmProcessInstanceStatusEnum 枚举
 
+    @Schema(description = "状态描述")
+    private String statusDesc; // 参见 OaAuditStatusEnum.java 枚举
+
     @Schema(description = "发起时间", requiredMode = Schema.RequiredMode.REQUIRED)
     private LocalDateTime startTime;
 

+ 7 - 0
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java

@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessI
 import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
 import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO;
 import cn.iocoder.yudao.module.bpm.enums.DictDataConstants;
+import cn.iocoder.yudao.module.bpm.enums.OaAuditStatusEnum;
 import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
@@ -28,8 +29,10 @@ import org.mapstruct.Mapping;
 import org.mapstruct.MappingTarget;
 import org.mapstruct.factory.Mappers;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 流程实例 Convert
@@ -49,6 +52,9 @@ public interface BpmProcessInstanceConvert {
                                                                           Map<Long, DeptRespDTO> deptMap,
                                                                           Map<String, BpmProcessDefinitionExtDO> bpmProcessDefinitionExtDOMap) {
         PageResult<BpmProcessInstanceRespVO> vpPageResult = BeanUtils.toBean(pageResult, BpmProcessInstanceRespVO.class);
+        // 状态
+        Map<String, String> statusMap = Arrays.stream(OaAuditStatusEnum.values())
+                .collect(Collectors.toMap(OaAuditStatusEnum::getStatus, OaAuditStatusEnum::getStatusDesc));
         for (int i = 0; i < pageResult.getList().size(); i++) {
             BpmProcessInstanceRespVO respVO = vpPageResult.getList().get(i);
             HistoricProcessInstance historicProcessInstance = pageResult.getList().get(i);
@@ -58,6 +64,7 @@ public interface BpmProcessInstanceConvert {
                 processInstanceStatus = Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_AUDITED);
             }
             respVO.setStatus(processInstanceStatus);
+            respVO.setStatusDesc(statusMap.get(String.valueOf(respVO.getStatus())));
 
             MapUtils.findAndThen(processDefinitionMap, respVO.getProcessDefinitionId(),
                     processDefinition -> respVO.setCategory(processDefinition.getCategory()));