mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-03 12:14:57 +08:00
【功能实现】工作流:流程模型,增加 sort 字段的返回(不包括修改)
This commit is contained in:
parent
a122253a93
commit
30e4f0c09c
@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelUpdateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelUpdateReqVO;
|
||||||
@ -28,10 +26,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
@ -56,38 +51,38 @@ public class BpmModelController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AdminUserApi adminUserApi;
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获得模型分页")
|
@Operation(summary = "获得模型分页")
|
||||||
public CommonResult<PageResult<BpmModelRespVO>> getModelPage(BpmModelPageReqVO pageVO) {
|
@Parameter(name = "name", description = "模型名称", example = "芋艿")
|
||||||
PageResult<Model> pageResult = modelService.getModelPage(pageVO);
|
public CommonResult<List<BpmModelRespVO>> getModelPage(@RequestParam(value = "name", required = false) String name) {
|
||||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
List<Model> list = modelService.getModelList(name);
|
||||||
return success(PageResult.empty(pageResult.getTotal()));
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return success(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拼接数据
|
|
||||||
// 获得 Form 表单
|
// 获得 Form 表单
|
||||||
Set<Long> formIds = convertSet(pageResult.getList(), model -> {
|
Set<Long> formIds = convertSet(list, model -> {
|
||||||
BpmModelMetaInfoVO metaInfo = BpmModelConvert.INSTANCE.parseMetaInfo(model);
|
BpmModelMetaInfoVO metaInfo = BpmModelConvert.INSTANCE.parseMetaInfo(model);
|
||||||
return metaInfo != null ? metaInfo.getFormId() : null;
|
return metaInfo != null ? metaInfo.getFormId() : null;
|
||||||
});
|
});
|
||||||
Map<Long, BpmFormDO> formMap = formService.getFormMap(formIds);
|
Map<Long, BpmFormDO> formMap = formService.getFormMap(formIds);
|
||||||
// 获得 Category Map
|
// 获得 Category Map
|
||||||
Map<String, BpmCategoryDO> categoryMap = categoryService.getCategoryMap(
|
Map<String, BpmCategoryDO> categoryMap = categoryService.getCategoryMap(
|
||||||
convertSet(pageResult.getList(), Model::getCategory));
|
convertSet(list, Model::getCategory));
|
||||||
// 获得 Deployment Map
|
// 获得 Deployment Map
|
||||||
Set<String> deploymentIds = new HashSet<>();
|
Map<String, Deployment> deploymentMap = processDefinitionService.getDeploymentMap(
|
||||||
pageResult.getList().forEach(model -> CollectionUtils.addIfNotNull(deploymentIds, model.getDeploymentId()));
|
convertSet(list, Model::getDeploymentId));
|
||||||
Map<String, Deployment> deploymentMap = processDefinitionService.getDeploymentMap(deploymentIds);
|
|
||||||
// 获得 ProcessDefinition Map
|
// 获得 ProcessDefinition Map
|
||||||
List<ProcessDefinition> processDefinitions = processDefinitionService.getProcessDefinitionListByDeploymentIds(deploymentIds);
|
List<ProcessDefinition> processDefinitions = processDefinitionService.getProcessDefinitionListByDeploymentIds(
|
||||||
|
deploymentMap.keySet());
|
||||||
Map<String, ProcessDefinition> processDefinitionMap = convertMap(processDefinitions, ProcessDefinition::getDeploymentId);
|
Map<String, ProcessDefinition> processDefinitionMap = convertMap(processDefinitions, ProcessDefinition::getDeploymentId);
|
||||||
// 获得 User Map
|
// 获得 User Map
|
||||||
Set<Long> userIds = convertSetByFlatMap(pageResult.getList(), model -> {
|
Set<Long> userIds = convertSetByFlatMap(list, model -> {
|
||||||
BpmModelMetaInfoVO metaInfo = BpmModelConvert.INSTANCE.parseMetaInfo(model);
|
BpmModelMetaInfoVO metaInfo = BpmModelConvert.INSTANCE.parseMetaInfo(model);
|
||||||
return metaInfo != null ? metaInfo.getStartUserIds().stream() : Stream.empty();
|
return metaInfo != null ? metaInfo.getStartUserIds().stream() : Stream.empty();
|
||||||
});
|
});
|
||||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||||
return success(BpmModelConvert.INSTANCE.buildModelPage(pageResult,
|
return success(BpmModelConvert.INSTANCE.buildModelList(list,
|
||||||
formMap, categoryMap, deploymentMap, processDefinitionMap, userMap));
|
formMap, categoryMap, deploymentMap, processDefinitionMap, userMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@ import java.util.List;
|
|||||||
* BPM 流程 MetaInfo Response DTO
|
* BPM 流程 MetaInfo Response DTO
|
||||||
* 主要用于 { Model#setMetaInfo(String)} 的存储
|
* 主要用于 { Model#setMetaInfo(String)} 的存储
|
||||||
*
|
*
|
||||||
* 最终,它的字段和 {@link cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO} 是一致的
|
* 最终,它的字段和
|
||||||
|
* {@link cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO}
|
||||||
|
* 是一致的
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@ -40,13 +42,11 @@ public class BpmModelMetaInfoVO {
|
|||||||
@NotNull(message = "表单类型不能为空")
|
@NotNull(message = "表单类型不能为空")
|
||||||
private Integer formType;
|
private Integer formType;
|
||||||
@Schema(description = "表单编号", example = "1024")
|
@Schema(description = "表单编号", example = "1024")
|
||||||
private Long formId; // formType 为 NORMAL 使用,必须非空
|
private Long formId; // formType 为 NORMAL 使用,必须非空
|
||||||
@Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址",
|
@Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/create")
|
||||||
example = "/bpm/oa/leave/create")
|
private String formCustomCreatePath; // 表单类型为 CUSTOM 时,必须非空
|
||||||
private String formCustomCreatePath; // 表单类型为 CUSTOM 时,必须非空
|
@Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/view")
|
||||||
@Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址",
|
private String formCustomViewPath; // 表单类型为 CUSTOM 时,必须非空
|
||||||
example = "/bpm/oa/leave/view")
|
|
||||||
private String formCustomViewPath; // 表单类型为 CUSTOM 时,必须非空
|
|
||||||
|
|
||||||
@Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
@Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||||
@NotNull(message = "是否可见不能为空")
|
@NotNull(message = "是否可见不能为空")
|
||||||
@ -59,4 +59,7 @@ public class BpmModelMetaInfoVO {
|
|||||||
@NotEmpty(message = "可管理用户编号数组不能为空")
|
@NotEmpty(message = "可管理用户编号数组不能为空")
|
||||||
private List<Long> managerUserIds;
|
private List<Long> managerUserIds;
|
||||||
|
|
||||||
|
@Schema(description = "排序", example = "1")
|
||||||
|
private Long sort; // 创建时,后端自动生成
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 流程模型分页 Request VO")
|
|
||||||
@Data
|
|
||||||
public class BpmModelPageReqVO extends PageParam {
|
|
||||||
|
|
||||||
@Schema(description = "标识,精准匹配", example = "process1641042089407")
|
|
||||||
private String key;
|
|
||||||
|
|
||||||
@Schema(description = "名字,模糊匹配", example = "芋道")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "流程分类", example = "1")
|
|
||||||
private String category;
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.convert.definition;
|
package cn.iocoder.yudao.module.bpm.convert.definition;
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
@ -22,6 +21,7 @@ import org.mapstruct.Mapper;
|
|||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -37,25 +37,31 @@ public interface BpmModelConvert {
|
|||||||
|
|
||||||
BpmModelConvert INSTANCE = Mappers.getMapper(BpmModelConvert.class);
|
BpmModelConvert INSTANCE = Mappers.getMapper(BpmModelConvert.class);
|
||||||
|
|
||||||
default PageResult<BpmModelRespVO> buildModelPage(PageResult<Model> pageResult,
|
default List<BpmModelRespVO> buildModelList(List<Model> list,
|
||||||
Map<Long, BpmFormDO> formMap,
|
Map<Long, BpmFormDO> formMap,
|
||||||
Map<String, BpmCategoryDO> categoryMap, Map<String, Deployment> deploymentMap,
|
Map<String, BpmCategoryDO> categoryMap,
|
||||||
Map<String, ProcessDefinition> processDefinitionMap,
|
Map<String, Deployment> deploymentMap,
|
||||||
Map<Long, AdminUserRespDTO> userMap) {
|
Map<String, ProcessDefinition> processDefinitionMap,
|
||||||
List<BpmModelRespVO> list = convertList(pageResult.getList(), model -> {
|
Map<Long, AdminUserRespDTO> userMap) {
|
||||||
|
List<BpmModelRespVO> result = convertList(list, model -> {
|
||||||
BpmModelMetaInfoVO metaInfo = parseMetaInfo(model);
|
BpmModelMetaInfoVO metaInfo = parseMetaInfo(model);
|
||||||
BpmFormDO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null;
|
BpmFormDO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null;
|
||||||
BpmCategoryDO category = categoryMap.get(model.getCategory());
|
BpmCategoryDO category = categoryMap.get(model.getCategory());
|
||||||
Deployment deployment = model.getDeploymentId() != null ? deploymentMap.get(model.getDeploymentId()) : null;
|
Deployment deployment = model.getDeploymentId() != null ? deploymentMap.get(model.getDeploymentId()) : null;
|
||||||
ProcessDefinition processDefinition = model.getDeploymentId() != null ? processDefinitionMap.get(model.getDeploymentId()) : null;
|
ProcessDefinition processDefinition = model.getDeploymentId() != null
|
||||||
List<AdminUserRespDTO> startUsers = metaInfo != null ? convertList(metaInfo.getStartUserIds(), userMap::get) : null;
|
? processDefinitionMap.get(model.getDeploymentId())
|
||||||
|
: null;
|
||||||
|
List<AdminUserRespDTO> startUsers = metaInfo != null ? convertList(metaInfo.getStartUserIds(), userMap::get)
|
||||||
|
: null;
|
||||||
return buildModel0(model, metaInfo, form, category, deployment, processDefinition, startUsers);
|
return buildModel0(model, metaInfo, form, category, deployment, processDefinition, startUsers);
|
||||||
});
|
});
|
||||||
return new PageResult<>(list, pageResult.getTotal());
|
// 排序
|
||||||
|
result.sort(Comparator.comparing(BpmModelMetaInfoVO::getSort));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
default BpmModelRespVO buildModel(Model model,
|
default BpmModelRespVO buildModel(Model model,
|
||||||
byte[] bpmnBytes) {
|
byte[] bpmnBytes) {
|
||||||
BpmModelMetaInfoVO metaInfo = parseMetaInfo(model);
|
BpmModelMetaInfoVO metaInfo = parseMetaInfo(model);
|
||||||
BpmModelRespVO modelVO = buildModel0(model, metaInfo, null, null, null, null, null);
|
BpmModelRespVO modelVO = buildModel0(model, metaInfo, null, null, null, null, null);
|
||||||
if (ArrayUtil.isNotEmpty(bpmnBytes)) {
|
if (ArrayUtil.isNotEmpty(bpmnBytes)) {
|
||||||
@ -65,9 +71,9 @@ public interface BpmModelConvert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default BpmModelRespVO buildModel0(Model model,
|
default BpmModelRespVO buildModel0(Model model,
|
||||||
BpmModelMetaInfoVO metaInfo, BpmFormDO form, BpmCategoryDO category,
|
BpmModelMetaInfoVO metaInfo, BpmFormDO form, BpmCategoryDO category,
|
||||||
Deployment deployment, ProcessDefinition processDefinition,
|
Deployment deployment, ProcessDefinition processDefinition,
|
||||||
List<AdminUserRespDTO> startUsers) {
|
List<AdminUserRespDTO> startUsers) {
|
||||||
BpmModelRespVO modelRespVO = new BpmModelRespVO().setId(model.getId()).setName(model.getName())
|
BpmModelRespVO modelRespVO = new BpmModelRespVO().setId(model.getId()).setName(model.getName())
|
||||||
.setKey(model.getKey()).setCategory(model.getCategory())
|
.setKey(model.getKey()).setCategory(model.getCategory())
|
||||||
.setCreateTime(DateUtils.of(model.getCreateTime()));
|
.setCreateTime(DateUtils.of(model.getCreateTime()));
|
||||||
@ -83,8 +89,9 @@ public interface BpmModelConvert {
|
|||||||
// ProcessDefinition
|
// ProcessDefinition
|
||||||
if (processDefinition != null) {
|
if (processDefinition != null) {
|
||||||
modelRespVO.setProcessDefinition(BeanUtils.toBean(processDefinition, BpmProcessDefinitionRespVO.class));
|
modelRespVO.setProcessDefinition(BeanUtils.toBean(processDefinition, BpmProcessDefinitionRespVO.class));
|
||||||
modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ?
|
modelRespVO.getProcessDefinition()
|
||||||
SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode());
|
.setSuspensionState(processDefinition.isSuspended() ? SuspensionState.SUSPENDED.getStateCode()
|
||||||
|
: SuspensionState.ACTIVE.getStateCode());
|
||||||
if (deployment != null) {
|
if (deployment != null) {
|
||||||
modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.of(deployment.getDeploymentTime()));
|
modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.of(deployment.getDeploymentTime()));
|
||||||
}
|
}
|
||||||
@ -112,6 +119,10 @@ public interface BpmModelConvert {
|
|||||||
if (vo.getStartUserIds() == null) {
|
if (vo.getStartUserIds() == null) {
|
||||||
vo.setStartUserIds(Collections.emptyList());
|
vo.setStartUserIds(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
// 如果为空,兜底处理,使用 createTime 创建时间
|
||||||
|
if (vo.getSort() == null) {
|
||||||
|
vo.setSort(model.getCreateTime().getTime());
|
||||||
|
}
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.service.definition;
|
package cn.iocoder.yudao.module.bpm.service.definition;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelSaveReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelUpdateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelUpdateReqVO;
|
||||||
@ -9,20 +7,22 @@ import jakarta.validation.Valid;
|
|||||||
import org.flowable.bpmn.model.BpmnModel;
|
import org.flowable.bpmn.model.BpmnModel;
|
||||||
import org.flowable.engine.repository.Model;
|
import org.flowable.engine.repository.Model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flowable流程模型接口
|
* 流程模型接口
|
||||||
*
|
*
|
||||||
* @author yunlongn
|
* @author yunlongn
|
||||||
*/
|
*/
|
||||||
public interface BpmModelService {
|
public interface BpmModelService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得流程模型分页
|
* 获得流程模型列表
|
||||||
*
|
*
|
||||||
* @param pageVO 分页查询
|
* @param name 模型名称
|
||||||
* @return 流程模型分页
|
* @return 流程模型列表
|
||||||
*/
|
*/
|
||||||
PageResult<Model> getModelPage(BpmModelPageReqVO pageVO);
|
List<Model> getModelList(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建流程模型
|
* 创建流程模型
|
||||||
|
@ -3,12 +3,9 @@ package cn.iocoder.yudao.module.bpm.service.definition;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelSaveReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelUpdateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelUpdateReqVO;
|
||||||
@ -41,8 +38,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
|||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flowable流程模型实现
|
* 流程模型实现:主要进行 Flowable {@link Model} 的维护
|
||||||
* 主要进行 Flowable {@link Model} 的维护
|
|
||||||
*
|
*
|
||||||
* @author yunlongn
|
* @author yunlongn
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
@ -64,27 +60,12 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||||||
private BpmTaskCandidateInvoker taskCandidateInvoker;
|
private BpmTaskCandidateInvoker taskCandidateInvoker;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<Model> getModelPage(BpmModelPageReqVO pageVO) {
|
public List<Model> getModelList(String name) {
|
||||||
ModelQuery modelQuery = repositoryService.createModelQuery();
|
ModelQuery modelQuery = repositoryService.createModelQuery();
|
||||||
modelQuery.modelTenantId(FlowableUtils.getTenantId());
|
if (StrUtil.isNotEmpty(name)) {
|
||||||
if (StrUtil.isNotBlank(pageVO.getKey())) {
|
modelQuery.modelNameLike(name);
|
||||||
modelQuery.modelKey(pageVO.getKey());
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(pageVO.getName())) {
|
return modelQuery.list();
|
||||||
modelQuery.modelNameLike("%" + pageVO.getName() + "%"); // 模糊匹配
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(pageVO.getCategory())) {
|
|
||||||
modelQuery.modelCategory(pageVO.getCategory());
|
|
||||||
}
|
|
||||||
// 执行查询
|
|
||||||
long count = modelQuery.count();
|
|
||||||
if (count == 0) {
|
|
||||||
return PageResult.empty(count);
|
|
||||||
}
|
|
||||||
List<Model> models = modelQuery
|
|
||||||
.orderByCreateTime().desc()
|
|
||||||
.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
|
|
||||||
return new PageResult<>(models, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -100,6 +81,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2.1 创建流程定义
|
// 2.1 创建流程定义
|
||||||
|
createReqVO.setSort(System.currentTimeMillis()); // 使用当前时间,作为排序
|
||||||
Model model = repositoryService.newModel();
|
Model model = repositoryService.newModel();
|
||||||
BpmModelConvert.INSTANCE.copyToModel(model, createReqVO);
|
BpmModelConvert.INSTANCE.copyToModel(model, createReqVO);
|
||||||
model.setTenantId(FlowableUtils.getTenantId());
|
model.setTenantId(FlowableUtils.getTenantId());
|
||||||
|
Loading…
Reference in New Issue
Block a user