update - 更新流程定义的 restful 接口,并通过自测
This commit is contained in:
parent
6aa01a3b7d
commit
b5ba283831
@ -1,98 +1,98 @@
|
||||
package cn.axzo.workflow.core.repository.entity;
|
||||
|
||||
import cn.axzo.framework.data.mybatisplus.model.BaseOwnEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Bpm 流程定义的拓展表
|
||||
* 主要解决 Activiti {@link ProcessDefinition} 不支持拓展字段,所以新建拓展表
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName(value = "bpm_process_definition_ext", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
// TODO 该表是否有用有待确定
|
||||
public class ProcessDefinitionExtDO extends BaseOwnEntity<ProcessDefinitionExtDO> {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 流程定义的编号
|
||||
*
|
||||
* 关联 ProcessDefinition 的 id 属性
|
||||
*/
|
||||
private String processDefinitionId;
|
||||
/**
|
||||
* 流程模型的编号
|
||||
*
|
||||
* 关联 Model 的 id 属性
|
||||
*/
|
||||
private String modelId;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 表单类型
|
||||
*
|
||||
* 关联 {@link BpmModelFormTypeEnum}
|
||||
*/
|
||||
private Integer formType;
|
||||
/**
|
||||
* 动态表单编号
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*
|
||||
* 关联 {@link BpmFormDO#getId()}
|
||||
*/
|
||||
private Long formId;
|
||||
/**
|
||||
* 表单的配置
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*
|
||||
* 冗余 {@link BpmFormDO#getConf()}
|
||||
*/
|
||||
private String formConf;
|
||||
/**
|
||||
* 表单项的数组
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*
|
||||
* 冗余 {@link BpmFormDO#getFields()} ()}
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<String> formFields;
|
||||
/**
|
||||
* 自定义表单的提交路径,使用 Vue 的路由地址
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
*/
|
||||
private String formCustomCreatePath;
|
||||
/**
|
||||
* 自定义表单的查看路径,使用 Vue 的路由地址
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
*/
|
||||
private String formCustomViewPath;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 拓展字段:业务自定义数据
|
||||
* */
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> ext;
|
||||
}
|
||||
//package cn.axzo.workflow.core.repository.entity;
|
||||
//
|
||||
//import cn.axzo.framework.data.mybatisplus.model.BaseOwnEntity;
|
||||
//import com.baomidou.mybatisplus.annotation.TableField;
|
||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
||||
//import com.baomidou.mybatisplus.annotation.TableName;
|
||||
//import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
//import lombok.*;
|
||||
//import org.flowable.engine.repository.ProcessDefinition;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * Bpm 流程定义的拓展表
|
||||
// * 主要解决 Activiti {@link ProcessDefinition} 不支持拓展字段,所以新建拓展表
|
||||
// *
|
||||
// * @author 芋道源码
|
||||
// */
|
||||
//@TableName(value = "bpm_process_definition_ext", autoResultMap = true)
|
||||
//@Data
|
||||
//@EqualsAndHashCode(callSuper = true)
|
||||
//@ToString(callSuper = true)
|
||||
//@Builder
|
||||
//@NoArgsConstructor
|
||||
//@AllArgsConstructor
|
||||
//// TODO 该表是否有用有待确定
|
||||
//public class ProcessDefinitionExtDO extends BaseOwnEntity<ProcessDefinitionExtDO> {
|
||||
//
|
||||
// /**
|
||||
// * 编号
|
||||
// */
|
||||
// @TableId
|
||||
// private Long id;
|
||||
// /**
|
||||
// * 流程定义的编号
|
||||
// *
|
||||
// * 关联 ProcessDefinition 的 id 属性
|
||||
// */
|
||||
// private String processDefinitionId;
|
||||
// /**
|
||||
// * 流程模型的编号
|
||||
// *
|
||||
// * 关联 Model 的 id 属性
|
||||
// */
|
||||
// private String modelId;
|
||||
// /**
|
||||
// * 描述
|
||||
// */
|
||||
// private String description;
|
||||
//
|
||||
// /**
|
||||
// * 表单类型
|
||||
// *
|
||||
// * 关联 {@link BpmModelFormTypeEnum}
|
||||
// */
|
||||
// private Integer formType;
|
||||
// /**
|
||||
// * 动态表单编号
|
||||
// * 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
// *
|
||||
// * 关联 {@link BpmFormDO#getId()}
|
||||
// */
|
||||
// private Long formId;
|
||||
// /**
|
||||
// * 表单的配置
|
||||
// * 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
// *
|
||||
// * 冗余 {@link BpmFormDO#getConf()}
|
||||
// */
|
||||
// private String formConf;
|
||||
// /**
|
||||
// * 表单项的数组
|
||||
// * 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
// *
|
||||
// * 冗余 {@link BpmFormDO#getFields()} ()}
|
||||
// */
|
||||
// @TableField(typeHandler = JacksonTypeHandler.class)
|
||||
// private List<String> formFields;
|
||||
// /**
|
||||
// * 自定义表单的提交路径,使用 Vue 的路由地址
|
||||
// * 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
// */
|
||||
// private String formCustomCreatePath;
|
||||
// /**
|
||||
// * 自定义表单的查看路径,使用 Vue 的路由地址
|
||||
// * 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
// */
|
||||
// private String formCustomViewPath;
|
||||
//
|
||||
// private String tenantId;
|
||||
//
|
||||
// /**
|
||||
// * 拓展字段:业务自定义数据
|
||||
// * */
|
||||
// @TableField(typeHandler = JacksonTypeHandler.class)
|
||||
// private Map<String, Object> ext;
|
||||
//}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
package cn.axzo.workflow.core.repository.mapper;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ProcessDefinitionExtDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BpmProcessDefinitionExtMapper extends BaseMapperX<ProcessDefinitionExtDO> {
|
||||
default List<ProcessDefinitionExtDO> selectListByProcessDefinitionIds(Collection<String> processDefinitionIds) {
|
||||
return selectList("process_definition_id", processDefinitionIds);
|
||||
}
|
||||
|
||||
default ProcessDefinitionExtDO selectByProcessDefinitionId(String processDefinitionId) {
|
||||
return selectOne("process_definition_id", processDefinitionId);
|
||||
}
|
||||
}
|
||||
//package cn.axzo.workflow.core.repository.mapper;
|
||||
//
|
||||
//import cn.axzo.workflow.core.repository.entity.ProcessDefinitionExtDO;
|
||||
//import org.apache.ibatis.annotations.Mapper;
|
||||
//
|
||||
//import java.util.Collection;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@Mapper
|
||||
//public interface BpmProcessDefinitionExtMapper extends BaseMapperX<ProcessDefinitionExtDO> {
|
||||
// default List<ProcessDefinitionExtDO> selectListByProcessDefinitionIds(Collection<String> processDefinitionIds) {
|
||||
// return selectList("process_definition_id", processDefinitionIds);
|
||||
// }
|
||||
//
|
||||
// default ProcessDefinitionExtDO selectByProcessDefinitionId(String processDefinitionId) {
|
||||
// return selectOne("process_definition_id", processDefinitionId);
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -2,7 +2,7 @@ package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.workflow.core.service.dto.request.process.BpmProcessDefinitionPageDTO;
|
||||
import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionPageItemRespVO;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionVO;
|
||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
@ -19,8 +19,8 @@ public interface BpmProcessDefinitionService {
|
||||
|
||||
/**
|
||||
* 获取活跃的流程定义分页
|
||||
* */
|
||||
BpmPageResult<BpmProcessDefinitionPageItemRespVO> getProcessDefinitionPage(BpmProcessDefinitionPageDTO request);
|
||||
*/
|
||||
BpmPageResult<BpmProcessDefinitionVO> getProcessDefinitionPage(BpmProcessDefinitionPageDTO request);
|
||||
|
||||
/**
|
||||
* 获得编号对应的 ProcessDefinition
|
||||
|
||||
@ -1,55 +1,47 @@
|
||||
package cn.axzo.workflow.core.service.converter;
|
||||
|
||||
import cn.axzo.workflow.core.common.utils.BpmCollectionUtils;
|
||||
import cn.axzo.workflow.core.repository.entity.ProcessDefinitionExtDO;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionPageItemRespVO;
|
||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class BpmProcessDefinitionConvert {
|
||||
|
||||
|
||||
public static List<BpmProcessDefinitionPageItemRespVO> convertList(List<ProcessDefinition> list,
|
||||
Map<String, Deployment> deploymentMap,
|
||||
Map<String, ProcessDefinitionExtDO> processDefinitionDOMap,
|
||||
Integer version) {
|
||||
return BpmCollectionUtils.convertList(list, definition -> {
|
||||
Deployment deployment =
|
||||
definition.getDeploymentId() != null ? deploymentMap.get(definition.getDeploymentId())
|
||||
: null;
|
||||
ProcessDefinitionExtDO definitionDO = processDefinitionDOMap.get(definition.getId());
|
||||
return convert(definition, deployment, definitionDO, version);
|
||||
});
|
||||
}
|
||||
// public static List<BpmProcessDefinitionPageItemRespVO> convertList(List<ProcessDefinition> list,
|
||||
// Map<String, Deployment> deploymentMap,
|
||||
// Map<String, Object> processDefinitionDOMap,
|
||||
// Integer version) {
|
||||
// return BpmCollectionUtils.convertList(list, definition -> {
|
||||
// Deployment deployment =
|
||||
// definition.getDeploymentId() != null ? deploymentMap.get(definition.getDeploymentId())
|
||||
// : null;
|
||||
// Object definitionDO = processDefinitionDOMap.get(definition.getId());
|
||||
// return convert(definition, deployment, definitionDO, version);
|
||||
// });
|
||||
// }
|
||||
|
||||
public static BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment,
|
||||
ProcessDefinitionExtDO processDefinitionExtDO, Integer version) {
|
||||
BpmProcessDefinitionPageItemRespVO respVO = convert(bean);
|
||||
respVO.setSyncModelPool(!Objects.nonNull(version) || bean.getVersion() <= version);
|
||||
respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode()
|
||||
: SuspensionState.ACTIVE.getStateCode());
|
||||
if (deployment != null) {
|
||||
respVO.setDeploymentTime(deployment.getDeploymentTime());
|
||||
}
|
||||
BeanUtils.copyProperties(processDefinitionExtDO, respVO);
|
||||
return respVO;
|
||||
}
|
||||
// public static BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment,
|
||||
// Object processDefinitionExtDO, Integer version) {
|
||||
// BpmProcessDefinitionPageItemRespVO respVO = convert(bean);
|
||||
// respVO.setSyncModelPool(!Objects.nonNull(version) || bean.getVersion() <= version);
|
||||
// respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode()
|
||||
// : SuspensionState.ACTIVE.getStateCode());
|
||||
// if (deployment != null) {
|
||||
// respVO.setDeploymentTime(deployment.getDeploymentTime());
|
||||
// }
|
||||
// BeanUtils.copyProperties(processDefinitionExtDO, respVO);
|
||||
// return respVO;
|
||||
// }
|
||||
|
||||
public static BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean) {
|
||||
if ( bean == null ) {
|
||||
if (bean == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BpmProcessDefinitionPageItemRespVO bpmProcessDefinitionPageItemRespVO = new BpmProcessDefinitionPageItemRespVO();
|
||||
BpmProcessDefinitionPageItemRespVO bpmProcessDefinitionPageItemRespVO =
|
||||
new BpmProcessDefinitionPageItemRespVO();
|
||||
|
||||
bpmProcessDefinitionPageItemRespVO.setId( bean.getId() );
|
||||
bpmProcessDefinitionPageItemRespVO.setVersion( bean.getVersion() );
|
||||
bpmProcessDefinitionPageItemRespVO.setId(bean.getId());
|
||||
bpmProcessDefinitionPageItemRespVO.setVersion(bean.getVersion());
|
||||
bpmProcessDefinitionPageItemRespVO.setName( bean.getName() );
|
||||
bpmProcessDefinitionPageItemRespVO.setDescription( bean.getDescription() );
|
||||
bpmProcessDefinitionPageItemRespVO.setCategory( bean.getCategory() );
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package cn.axzo.workflow.core.service.converter;
|
||||
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionVO;
|
||||
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author wangli
|
||||
* @sine 2023/7/25 22:44
|
||||
*/
|
||||
@Mapper(
|
||||
componentModel = "spring",
|
||||
nullValueCheckStrategy = ALWAYS,
|
||||
imports = Arrays.class
|
||||
)
|
||||
public interface BpmProcessDefinitionConverter extends EntityConverter<BpmProcessDefinitionVO, ProcessDefinition> {
|
||||
|
||||
@Override
|
||||
default BpmProcessDefinitionVO toVo(ProcessDefinition entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BpmProcessDefinitionVO bpmProcessDefinitionVO = new BpmProcessDefinitionVO();
|
||||
|
||||
if (entity.getId() != null) {
|
||||
bpmProcessDefinitionVO.setId(entity.getId());
|
||||
}
|
||||
if (entity.getName() != null) {
|
||||
bpmProcessDefinitionVO.setName(entity.getName());
|
||||
}
|
||||
if (entity.getKey() != null) {
|
||||
bpmProcessDefinitionVO.setKey(entity.getKey());
|
||||
}
|
||||
if (entity.getDescription() != null) {
|
||||
bpmProcessDefinitionVO.setDescription(entity.getDescription());
|
||||
}
|
||||
if (entity.getCategory() != null) {
|
||||
bpmProcessDefinitionVO.setCategory(entity.getCategory());
|
||||
}
|
||||
if (entity.getTenantId() != null) {
|
||||
bpmProcessDefinitionVO.setTenantId(entity.getTenantId());
|
||||
}
|
||||
bpmProcessDefinitionVO.setVersion(entity.getVersion());
|
||||
ProcessDefinitionEntity entitySource = (ProcessDefinitionEntity) entity;
|
||||
bpmProcessDefinitionVO.setSuspensionState(entitySource.getSuspensionState());
|
||||
|
||||
return bpmProcessDefinitionVO;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,21 @@
|
||||
package cn.axzo.workflow.core.service.converter;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public interface EntityConverter<V, E>{
|
||||
public interface EntityConverter<V, E> {
|
||||
|
||||
V toVo(E entity);
|
||||
|
||||
List<V> toVos(List<E> entities);
|
||||
default List<V> toVos(List<E> entities) {
|
||||
if (CollectionUtils.isEmpty(entities)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<V> vos = new ArrayList<>();
|
||||
entities.forEach(i -> vos.add(toVo(i)));
|
||||
return vos;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,12 +4,8 @@ import cn.axzo.workflow.core.service.dto.response.form.model.BpmModelBaseVO;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
|
||||
|
||||
@ -36,13 +32,4 @@ public interface FormModelConverter extends EntityConverter<BpmModelBaseVO, Mode
|
||||
@Mapping(target = "updateAt", source = "entity.lastUpdateTime")
|
||||
BpmModelBaseVO toVo(Model entity);
|
||||
|
||||
@Override
|
||||
default List<BpmModelBaseVO> toVos(List<Model> entities) {
|
||||
if (CollectionUtils.isEmpty(entities)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<BpmModelBaseVO> result = new ArrayList<>();
|
||||
entities.forEach(i -> result.add(toVo(i)));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,14 @@ import cn.axzo.workflow.core.service.dto.request.BpmPageParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
@Data
|
||||
public class BpmProcessDefinitionPageDTO extends BpmPageParam {
|
||||
|
||||
@ApiModelProperty(value = "流程标识,传了精准匹配")
|
||||
@NotBlank(message = "流程标识不能为空")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "租户Id", example = "1")
|
||||
|
||||
@ -14,12 +14,11 @@ import java.util.Date;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmProcessDefinitionPageItemRespVO extends BpmProcessDefinitionVO {
|
||||
|
||||
@ApiModelProperty(value = "表单名字", example = "请假表单")
|
||||
private String formName;
|
||||
|
||||
@ApiModelProperty(value = "部署时间", required = true)
|
||||
private Date deploymentTime;
|
||||
|
||||
@ApiModelProperty(value = "是否还同步于公共模板")
|
||||
private Boolean syncModelPool;
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理后台 - 流程定义 Response VO")
|
||||
@Data
|
||||
@ -21,35 +20,19 @@ public class BpmProcessDefinitionVO {
|
||||
@NotEmpty(message = "流程名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "流程标识")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "流程描述", example = "我是描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "流程分类", notes = "参见 bpm_model_category 数据字典", example = "1")
|
||||
@ApiModelProperty(value = "流程分类", example = "1")
|
||||
@NotEmpty(message = "流程分类不能为空")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "表单类型", notes = "参见 bpm_model_form_type 数据字典", example = "1")
|
||||
private Integer formType;
|
||||
|
||||
@ApiModelProperty(value = "表单编号", example = "1024", notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空")
|
||||
private Long formId;
|
||||
|
||||
@ApiModelProperty(value = "表单的配置", required = true,
|
||||
notes = "JSON 字符串。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空")
|
||||
private String formConf;
|
||||
|
||||
@ApiModelProperty(value = "表单项的数组", required = true,
|
||||
notes = "JSON 字符串的数组。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空")
|
||||
private List<String> formFields;
|
||||
|
||||
@ApiModelProperty(value = "自定义表单的提交路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/create",
|
||||
notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空")
|
||||
private String formCustomCreatePath;
|
||||
|
||||
@ApiModelProperty(value = "自定义表单的查看路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/view",
|
||||
notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空")
|
||||
private String formCustomViewPath;
|
||||
|
||||
@ApiModelProperty(value = "中断状态", required = true, example = "1", notes = "参见 SuspensionState 枚举")
|
||||
@ApiModelProperty(value = "中断状态 1:激活 2:挂起", required = true, example = "1", notes = "参见 SuspensionState 枚举")
|
||||
private Integer suspensionState;
|
||||
|
||||
@ApiModelProperty(value = "租户 ID")
|
||||
private String tenantId;
|
||||
}
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package cn.axzo.workflow.core.service.impl;
|
||||
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.common.utils.BpmCollectionUtils;
|
||||
import cn.axzo.workflow.core.repository.entity.ProcessDefinitionExtDO;
|
||||
import cn.axzo.workflow.core.repository.mapper.BpmProcessDefinitionExtMapper;
|
||||
import cn.axzo.workflow.core.service.BpmProcessDefinitionService;
|
||||
import cn.axzo.workflow.core.service.converter.BpmProcessDefinitionConvert;
|
||||
import cn.axzo.workflow.core.service.converter.BpmProcessDefinitionConverter;
|
||||
import cn.axzo.workflow.core.service.dto.request.process.BpmProcessDefinitionPageDTO;
|
||||
import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionPageItemRespVO;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionVO;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -18,7 +15,6 @@ import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@ -26,7 +22,8 @@ import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.axzo.workflow.core.common.enums.BpmErrorCode.*;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmCollectionUtils.*;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmCollectionUtils.addIfNotNull;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmCollectionUtils.convertMap;
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
@Service
|
||||
@ -36,7 +33,9 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
@Resource
|
||||
private BpmProcessDefinitionExtMapper processDefinitionExtMapper;
|
||||
private BpmProcessDefinitionConverter processDefinitionConverter;
|
||||
// @Resource
|
||||
// private BpmProcessDefinitionExtMapper processDefinitionExtMapper;
|
||||
|
||||
@Override
|
||||
public String createProcessDefinition(Model model, byte[] bpmnBytes) {
|
||||
@ -71,13 +70,13 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
}
|
||||
|
||||
// 插入拓展表
|
||||
ProcessDefinitionExtDO definitionDO = new ProcessDefinitionExtDO();
|
||||
definitionDO.setModelId(model.getId());
|
||||
BeanUtils.copyProperties(definition, definitionDO);
|
||||
definitionDO.setProcessDefinitionId(definition.getId());
|
||||
definitionDO.setModelId(model.getId());
|
||||
definitionDO.setTenantId(definition.getTenantId());
|
||||
processDefinitionExtMapper.insert(definitionDO);
|
||||
// ProcessDefinitionExtDO definitionDO = new ProcessDefinitionExtDO();
|
||||
// definitionDO.setModelId(model.getId());
|
||||
// BeanUtils.copyProperties(definition, definitionDO);
|
||||
// definitionDO.setProcessDefinitionId(definition.getId());
|
||||
// definitionDO.setModelId(model.getId());
|
||||
// definitionDO.setTenantId(definition.getTenantId());
|
||||
// processDefinitionExtMapper.insert(definitionDO);
|
||||
return definition.getId();
|
||||
}
|
||||
|
||||
@ -99,45 +98,22 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmPageResult<BpmProcessDefinitionPageItemRespVO> getProcessDefinitionPage(BpmProcessDefinitionPageDTO request) {
|
||||
ProcessDefinitionQuery definitionQuery = repositoryService.createProcessDefinitionQuery();
|
||||
if (StrUtil.isNotBlank(request.getKey())) {
|
||||
definitionQuery.processDefinitionKey(request.getKey());
|
||||
}
|
||||
if (StrUtil.isNotBlank(request.getTenantId())) {
|
||||
definitionQuery.processDefinitionTenantId(request.getTenantId());
|
||||
public BpmPageResult<BpmProcessDefinitionVO> getProcessDefinitionPage(BpmProcessDefinitionPageDTO dto) {
|
||||
ProcessDefinitionQuery definitionQuery = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionKey(dto.getKey());
|
||||
if (StrUtil.isNotBlank(dto.getTenantId())) {
|
||||
definitionQuery.processDefinitionTenantId(dto.getTenantId());
|
||||
}
|
||||
// 执行查询
|
||||
List<ProcessDefinition> processDefinitions = definitionQuery.orderByProcessDefinitionVersion()
|
||||
.desc()
|
||||
.listPage((request.getPageNo() - 1) * request.getPageSize(), request.getPageSize());
|
||||
.listPage((dto.getPageNo() - 1) * dto.getPageSize(), dto.getPageSize());
|
||||
|
||||
if (CollUtil.isEmpty(processDefinitions)) {
|
||||
return new BpmPageResult<>(emptyList(), definitionQuery.count());
|
||||
}
|
||||
// 获得 Deployment Map
|
||||
Set<String> deploymentIds = new HashSet<>();
|
||||
processDefinitions.forEach(
|
||||
definition -> addIfNotNull(deploymentIds, definition.getDeploymentId()));
|
||||
Map<String, Deployment> deploymentMap = getDeploymentMap(deploymentIds);
|
||||
|
||||
// 获得 BpmProcessDefinitionDO Map
|
||||
List<ProcessDefinitionExtDO> processDefinitionDOs = processDefinitionExtMapper.selectListByProcessDefinitionIds(
|
||||
convertList(processDefinitions, ProcessDefinition::getId));
|
||||
Map<String, ProcessDefinitionExtDO> processDefinitionDOMap = convertMap(processDefinitionDOs,
|
||||
ProcessDefinitionExtDO::getProcessDefinitionId);
|
||||
|
||||
|
||||
List<Model> list = repositoryService.createModelQuery().modelKey(request.getKey()).list();
|
||||
Integer version = null;
|
||||
if (!BpmCollectionUtils.isAnyEmpty(list)) {
|
||||
version = list.get(0).getVersion();
|
||||
return new BpmPageResult<>(emptyList(), 0L);
|
||||
}
|
||||
// 拼接结果
|
||||
long definitionCount = definitionQuery.count();
|
||||
return new BpmPageResult<>(
|
||||
BpmProcessDefinitionConvert.convertList(processDefinitions, deploymentMap,
|
||||
processDefinitionDOMap, version), definitionCount);
|
||||
return new BpmPageResult<>(processDefinitionConverter.toVos(processDefinitions), definitionQuery.count());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -3,7 +3,7 @@ package cn.axzo.workflow.server.controller.web;
|
||||
import cn.axzo.workflow.core.service.BpmProcessDefinitionService;
|
||||
import cn.axzo.workflow.core.service.dto.request.process.BpmProcessDefinitionPageDTO;
|
||||
import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionPageItemRespVO;
|
||||
import cn.axzo.workflow.core.service.dto.response.process.BpmProcessDefinitionVO;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -27,11 +27,9 @@ public class BpmProcessDefinitionController {
|
||||
* 获取活跃的流程定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public CommonResponse<BpmPageResult<BpmProcessDefinitionPageItemRespVO>> getProcessDefinitionPage(@Valid @RequestBody BpmProcessDefinitionPageDTO dto) {
|
||||
public CommonResponse<BpmPageResult<BpmProcessDefinitionVO>> getProcessDefinitionPage(@Valid @RequestBody BpmProcessDefinitionPageDTO dto) {
|
||||
log.info("获取活跃的流程定义分页getProcessDefinitionPage===>>>参数:{}", JSON.toJSONString(dto));
|
||||
BpmPageResult<BpmProcessDefinitionPageItemRespVO> result =
|
||||
bpmProcessDefinitionService.getProcessDefinitionPage(dto);
|
||||
return CommonResponse.success(result);
|
||||
return CommonResponse.success(bpmProcessDefinitionService.getProcessDefinitionPage(dto));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user