|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil;
|
|
|
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.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.module.bpm.controller.admin.base.dept.DeptSimpleBaseVO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelRespVO;
|
|
@@ -13,6 +14,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmPro
|
|
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
|
|
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
|
|
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import org.flowable.common.engine.impl.db.SuspensionState;
|
|
|
import org.flowable.engine.repository.Deployment;
|
|
@@ -43,7 +45,8 @@ public interface BpmModelConvert {
|
|
|
Map<String, BpmCategoryDO> categoryMap,
|
|
|
Map<String, Deployment> deploymentMap,
|
|
|
Map<String, ProcessDefinition> processDefinitionMap,
|
|
|
- Map<Long, AdminUserRespDTO> userMap) {
|
|
|
+ Map<Long, AdminUserRespDTO> userMap,
|
|
|
+ Map<Long, DeptRespDTO> deptMap) {
|
|
|
List<BpmModelRespVO> result = convertList(list, model -> {
|
|
|
BpmModelMetaInfoVO metaInfo = parseMetaInfo(model);
|
|
|
BpmFormDO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null;
|
|
@@ -52,7 +55,8 @@ public interface BpmModelConvert {
|
|
|
ProcessDefinition processDefinition = model.getDeploymentId() != 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);
|
|
|
+ List<DeptRespDTO> startDepts = metaInfo != null ? convertList(metaInfo.getStartDeptIds(), deptMap::get) : null;
|
|
|
+ return buildModel0(model, metaInfo, form, category, deployment, processDefinition, startUsers, startDepts);
|
|
|
});
|
|
|
// 排序
|
|
|
result.sort(Comparator.comparing(BpmModelMetaInfoVO::getSort));
|
|
@@ -61,7 +65,7 @@ public interface BpmModelConvert {
|
|
|
|
|
|
default BpmModelRespVO buildModel(Model model, byte[] bpmnBytes, BpmSimpleModelNodeVO simpleModel) {
|
|
|
BpmModelMetaInfoVO metaInfo = parseMetaInfo(model);
|
|
|
- BpmModelRespVO modelVO = buildModel0(model, metaInfo, null, null, null, null, null);
|
|
|
+ BpmModelRespVO modelVO = buildModel0(model, metaInfo, null, null, null, null, null, null);
|
|
|
if (ArrayUtil.isNotEmpty(bpmnBytes)) {
|
|
|
modelVO.setBpmnXml(BpmnModelUtils.getBpmnXml(bpmnBytes));
|
|
|
}
|
|
@@ -72,7 +76,8 @@ public interface BpmModelConvert {
|
|
|
default BpmModelRespVO buildModel0(Model model,
|
|
|
BpmModelMetaInfoVO metaInfo, BpmFormDO form, BpmCategoryDO category,
|
|
|
Deployment deployment, ProcessDefinition processDefinition,
|
|
|
- List<AdminUserRespDTO> startUsers) {
|
|
|
+ List<AdminUserRespDTO> startUsers,
|
|
|
+ List<DeptRespDTO> startDepts) {
|
|
|
BpmModelRespVO modelRespVO = new BpmModelRespVO().setId(model.getId()).setName(model.getName())
|
|
|
.setKey(model.getKey()).setCategory(model.getCategory())
|
|
|
.setCreateTime(DateUtils.of(model.getCreateTime()));
|
|
@@ -96,6 +101,8 @@ public interface BpmModelConvert {
|
|
|
}
|
|
|
// User
|
|
|
modelRespVO.setStartUsers(BeanUtils.toBean(startUsers, UserSimpleBaseVO.class));
|
|
|
+ // Dept
|
|
|
+ modelRespVO.setStartDepts(BeanUtils.toBean(startDepts, DeptSimpleBaseVO.class));
|
|
|
return modelRespVO;
|
|
|
}
|
|
|
|