feat:1.获取流程模型基本信息列表
This commit is contained in:
parent
d4b4f97f17
commit
bb0b68b44a
16
sql/init.sql
16
sql/init.sql
@ -1,15 +1,13 @@
|
||||
CREATE TABLE IF NOT EXISTS axzo_process_own_business
|
||||
CREATE TABLE IF NOT EXISTS workflow_proc_model_ext
|
||||
(
|
||||
id bigint auto_increment comment '主键',
|
||||
business_id varchar(32) not null comment '流程所属业务ID',
|
||||
business_name varchar(50) not null comment '流程所属业务名称',
|
||||
workbench varchar(20) not null comment '工作台名称',
|
||||
creator varchar(20) not null comment '创建人ID',
|
||||
is_delete tinyint default 0 not null comment '未删除0,删除1',
|
||||
proc_model_id varchar(100) not null comment '流程模型ID',
|
||||
status tinyint(1) not null comment '状态:1、启用、0、停用',
|
||||
is_delete tinyint default 0 not null comment '删除状态:未删除0,删除1',
|
||||
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_at datetime default CURRENT_TIMESTAMP not null comment '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8 comment '流程所属业务表';
|
||||
create index idx_axzo_process_own_business
|
||||
on axzo_process_own_business (business_id);
|
||||
DEFAULT CHARSET = utf8 comment '流程模型信息扩展表';
|
||||
create index idx_proc_model_id
|
||||
on workflow_proc_model_ext (proc_model_id);
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.axzo.workflow.client.feign.manage;
|
||||
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.basic.ProcessBasicInfoQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.basic.ProcessBasicInfoResp;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.config.BpmnButtonResp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* OMS流程业务管理API
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 16:01
|
||||
*/
|
||||
|
||||
@FeignClient(name = "workflow-engine", url = "${axzo.service.workflow-engine:http://workflow-engine:8080}")
|
||||
public interface ProcessManageApi {
|
||||
|
||||
/**
|
||||
* 获取流程基本信息列表
|
||||
*
|
||||
* @param basicInfoQuery 查询流程基本信息条件
|
||||
* @return 流程基本信息列表
|
||||
*/
|
||||
@GetMapping("/api/process/basic/list")
|
||||
ApiPageResult<ProcessBasicInfoResp> getProcessBasicInfos(@Validated @RequestBody ProcessBasicInfoQuery basicInfoQuery);
|
||||
|
||||
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
package cn.axzo.workflow.client.feign.manage;
|
||||
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessRequest;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessResp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
/**
|
||||
* OMS流程业务管理API
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 16:01
|
||||
*/
|
||||
|
||||
@FeignClient(name = "workflow-engine", url = "${axzo.service.workflow-engine:http://workflow-engine:8080}")
|
||||
public interface ProcessOwnBusinessApi {
|
||||
|
||||
/**
|
||||
* 创建流程所属业务
|
||||
*
|
||||
* @param processOwnBusinessRequest 新增流程所属业务信息
|
||||
* @return 流程所属业务成功创建信息
|
||||
*/
|
||||
@PostMapping("/api/process/own/business/create")
|
||||
ApiResult<ProcessOwnBusinessResp> createProcessOwnBusiness(@RequestBody @Validated ProcessOwnBusinessRequest processOwnBusinessRequest);
|
||||
|
||||
/**
|
||||
* 更新流程所属业务
|
||||
*
|
||||
* @param processOwnBusinessRequest 更新流程所属业务信息参数
|
||||
* @return 流程所属业务成功更新信息
|
||||
*/
|
||||
@PostMapping("api/process/own/business/update")
|
||||
ApiResult<ProcessOwnBusinessResp> updateProcessOwnBusiness(@RequestBody @Validated ProcessOwnBusinessRequest processOwnBusinessRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 删除流程所属业务信息
|
||||
* 校验 流程模版是否有关联该业务
|
||||
* 该业务下已绑定流程模版,不可删除!
|
||||
* @param businessId 业务流程Id
|
||||
* @return 流程所属业务信息
|
||||
*/
|
||||
@DeleteMapping("api/process/own/business/{businessId}")
|
||||
ApiResult<String> deleteProcessOwnBusiness(@NotBlank(message = "businessId不能为空") @PathVariable("businessId") String businessId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询流程所属业务信息
|
||||
*
|
||||
* @param businessId 业务流程Id
|
||||
* @return 流程所属业务信息
|
||||
*/
|
||||
@GetMapping("api/process/own/business/{businessId}")
|
||||
ApiResult<ProcessOwnBusinessResp> queryProcessOwnBusiness(@NotBlank(message = "businessId不能为空") @PathVariable("businessId") String businessId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询流程所属业务列表
|
||||
* 支持分页
|
||||
*
|
||||
* @param processOwnBusinessQuery 流程所属业务查询条件
|
||||
* @return 流程所属业务列表信息
|
||||
*/
|
||||
@PostMapping("api/process/own/business/page")
|
||||
ApiPageResult<ProcessOwnBusinessResp> queryProcessOwnBusinessList(@RequestBody ProcessOwnBusinessQuery processOwnBusinessQuery);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.basic;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.BpmPageParam;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* yoke
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/15 17:20
|
||||
*/
|
||||
@Data
|
||||
public class ProcessBasicInfoQuery extends BpmPageParam {
|
||||
/**
|
||||
* 流程名称
|
||||
* 模糊查询
|
||||
*/
|
||||
private String processName;
|
||||
|
||||
|
||||
/**
|
||||
* 流程所属业务ID列表
|
||||
*/
|
||||
private List<String> businessIdList;
|
||||
|
||||
|
||||
/**
|
||||
* 流程状态 1、开启 0、关闭
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* yoke
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/15 17:20
|
||||
*/
|
||||
@Data
|
||||
public class ProcessBasicInfoResp {
|
||||
|
||||
/**
|
||||
* 流程ID
|
||||
* 模糊查询
|
||||
*/
|
||||
private String processModelId;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
* 模糊查询
|
||||
*/
|
||||
private String processName;
|
||||
|
||||
|
||||
/**
|
||||
* 流程所属业务
|
||||
* 模糊查询
|
||||
*/
|
||||
private String ownBusiness;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 流程所属业务ID列表
|
||||
*/
|
||||
private String ownBusinessId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 流程工作台ID
|
||||
*/
|
||||
private String workBenchId;
|
||||
|
||||
|
||||
/**
|
||||
* 流程工作台名称
|
||||
*/
|
||||
private String workBenchName;
|
||||
|
||||
/**
|
||||
* 流程状态 1、开启 0、关闭
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 当前版本号
|
||||
*/
|
||||
private String version;
|
||||
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.business;
|
||||
|
||||
import cn.axzo.framework.domain.page.PageRequest;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 流程所属业务列表查询
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 16:01
|
||||
*/
|
||||
@ApiModel("流程所属业务列表查询")
|
||||
@Data
|
||||
public class ProcessOwnBusinessQuery {
|
||||
|
||||
/**
|
||||
* 流程定义的 id
|
||||
*/
|
||||
@NotEmpty(message = "分页参数Page不能为空")
|
||||
private Integer pageNo = 1;
|
||||
|
||||
/**
|
||||
* 分页参数PageSize
|
||||
*/
|
||||
@NotEmpty(message = "分页参数PageSize不能为空")
|
||||
private Integer pageSize = 10;
|
||||
|
||||
/**
|
||||
* 流程所属业务Id
|
||||
*/
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 流程所属业务名称
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 所属工作台
|
||||
*/
|
||||
private String workbench;
|
||||
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.business;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 流程所属业务请求
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 16:01
|
||||
*/
|
||||
@ApiModel("流程所属业务请求")
|
||||
@Data
|
||||
public class ProcessOwnBusinessRequest {
|
||||
|
||||
/**
|
||||
* 流程所属业务ID
|
||||
*/
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 流程所属业务名称
|
||||
*/
|
||||
@NotEmpty(message = "业务名称不能为空")
|
||||
@Length(max = 20, message = "业务名称最长为20个字符")
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 流程所属业务工作台
|
||||
*/
|
||||
@NotEmpty(message = "所属工作台")
|
||||
private String workbench;
|
||||
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.business;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 流程所属业务响应
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 16:01
|
||||
*/
|
||||
@ApiModel("流程所属业务响应")
|
||||
@Data
|
||||
public class ProcessOwnBusinessResp {
|
||||
|
||||
/**
|
||||
* 流程定义的 id
|
||||
*/
|
||||
private String businessId;
|
||||
/**
|
||||
* 流程定义的标识
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 所属工作台
|
||||
*/
|
||||
private String workbench;
|
||||
|
||||
/**
|
||||
* 最后更新人
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateAt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package cn.axzo.workflow.core.repository;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ProcModelExt;
|
||||
import cn.axzo.workflow.core.repository.mapper.ProcModelExtMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* ProcModelExtDao
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/10/10 10:06
|
||||
*/
|
||||
@Repository("procModelExtDao")
|
||||
public class ProcModelExtDao extends ServiceImpl<ProcModelExtMapper, ProcModelExt> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package cn.axzo.workflow.core.repository.entity;
|
||||
|
||||
import cn.axzo.framework.data.mybatisplus.model.BaseEntity;
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
|
||||
/**
|
||||
* 流程模型扩展表
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/10/9 16:01
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "workflow_proc_model_ext", autoResultMap = true)
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class ProcModelExt extends BaseEntity<ProcModelExt> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 流程模型ID
|
||||
*/
|
||||
@TableField("proc_model_id")
|
||||
private String procModelId;
|
||||
|
||||
/**
|
||||
* 模型状态(0正常 1停用)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
package cn.axzo.workflow.core.repository.entity;
|
||||
|
||||
import cn.axzo.framework.data.mybatisplus.model.BaseEntity;
|
||||
import cn.axzo.framework.data.mybatisplus.model.BaseOwnEntity;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
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.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.apache.ibatis.type.DateTypeHandler;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* ProcessOwnBusiness
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 17:18
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "axzo_process_own_business", autoResultMap = true)
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class ProcessOwnBusiness extends BaseEntity<ProcessOwnBusiness> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 流程所属业务ID
|
||||
*/
|
||||
@TableField("business_id")
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 流程所属业务名称
|
||||
*/
|
||||
@TableField("business_name")
|
||||
private String businessName;
|
||||
|
||||
|
||||
/**
|
||||
* 流程所属业务工作台
|
||||
*/
|
||||
@TableField("workbench")
|
||||
private String workbench;
|
||||
|
||||
|
||||
/**
|
||||
* creator
|
||||
*/
|
||||
@TableField("creator")
|
||||
private String creator;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package cn.axzo.workflow.core.repository.mapper;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ProcModelExt;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
||||
/**
|
||||
* ProcModelExtMapper
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/10/10 10:06
|
||||
*/
|
||||
public interface ProcModelExtMapper extends BaseMapper<ProcModelExt> {
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.axzo.workflow.core.repository.mapper;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ProcessOwnBusiness;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* workflow-engine
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 17:18
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProcessOwnBusinessMapper extends BaseMapper<ProcessOwnBusiness> {
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.framework.domain.page.PageResp;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessRequest;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessResp;
|
||||
|
||||
/**
|
||||
* workflow-engine
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 16:55
|
||||
*/
|
||||
public interface ProcessOwnBusinessService {
|
||||
|
||||
PageResp<ProcessOwnBusinessResp> queryProcessOwnBusinessList(ProcessOwnBusinessQuery processOwnBusinessQuery);
|
||||
|
||||
ProcessOwnBusinessResp queryProcessOwnBusiness(String businessId);
|
||||
|
||||
void deleteProcessOwnBusiness(String businessId);
|
||||
|
||||
ProcessOwnBusinessResp updateProcessOwnBusiness(ProcessOwnBusinessRequest processOwnBusinessRequest);
|
||||
|
||||
ProcessOwnBusinessResp createProcessOwnBusiness(ProcessOwnBusinessRequest processOwnBusinessRequest);
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
package cn.axzo.workflow.core.service.business;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.basic.ProcessBasicInfoQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.basic.ProcessBasicInfoResp;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.core.repository.ProcModelExtDao;
|
||||
import cn.axzo.workflow.core.repository.entity.ProcModelExt;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.flowable.engine.ManagementService;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.history.NativeHistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.impl.persistence.entity.ModelEntity;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.flowable.engine.repository.NativeModelQuery;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnNativeQueryUtil.countSql;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnNativeQueryUtil.sqlConnectors;
|
||||
|
||||
/**
|
||||
* workflow-engine
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/16 10:06
|
||||
*/
|
||||
@Service
|
||||
public class ProcessBasicInfoService {
|
||||
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Resource
|
||||
private ManagementService managementService;
|
||||
|
||||
@Resource
|
||||
private ProcModelExtDao procModelExtDao;
|
||||
|
||||
public BpmPageResult<ProcessBasicInfoResp> getProcessBasicInfos(ProcessBasicInfoQuery basicInfoQuery) {
|
||||
NativeModelQuery query = repositoryService.createNativeModelQuery();
|
||||
//act_re_model ModelEntity.class
|
||||
String tableName = managementService.getTableName(ModelEntity.class);
|
||||
StringBuilder baseHeader = new StringBuilder("SELECT a.* FROM ").append(tableName).append(" a ");
|
||||
StringBuilder countHeader = new StringBuilder("SELECT count(1) FROM ").append(tableName).append(" a ");
|
||||
|
||||
StringBuilder baseQuerySql = new StringBuilder();
|
||||
if (basicInfoQuery.getStatus() != null) {
|
||||
baseQuerySql.append(" LEFT JOIN workflow_proc_model_ext b ON a.ID_ = b.proc_model_id ")
|
||||
.append(sqlConnectors(baseQuerySql))
|
||||
.append(" b.status = #{status}");
|
||||
query.parameter("status", basicInfoQuery.getStatus());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(basicInfoQuery.getBusinessIdList())) {
|
||||
baseQuerySql.append(sqlConnectors(baseQuerySql))
|
||||
.append(" a.CATEGORY_ in (");
|
||||
for (int i = 0; i < basicInfoQuery.getBusinessIdList().size(); i++) {
|
||||
baseQuerySql.append("#{CATEGORY_").append(i).append("}");
|
||||
if (i < basicInfoQuery.getBusinessIdList().size() - 1) {
|
||||
baseQuerySql.append(",");
|
||||
}
|
||||
query.parameter("CATEGORY_" + i, basicInfoQuery.getBusinessIdList().get(i));
|
||||
}
|
||||
baseQuerySql.append(")");
|
||||
}
|
||||
if (StringUtils.hasLength(basicInfoQuery.getProcessName())) {
|
||||
baseQuerySql.append(sqlConnectors(baseQuerySql))
|
||||
.append(" a.NAME_ like #{processName}");
|
||||
query.parameter("processName", "%" + basicInfoQuery.getProcessName() + "%");
|
||||
}
|
||||
baseQuerySql.append(" order by a.LAST_UPDATE_TIME_ desc");
|
||||
|
||||
NativeModelQuery countSqlQuery = query.sql(countHeader.append(baseQuerySql).toString());
|
||||
if (countSqlQuery.count() > 0L) {
|
||||
NativeModelQuery dataSqlQuery = query.sql(baseHeader.append(baseQuerySql).toString());
|
||||
List<Model> instances = dataSqlQuery
|
||||
.listPage((basicInfoQuery.getPageNo() - 1) * basicInfoQuery.getPageSize(), basicInfoQuery.getPageSize());
|
||||
List<ProcessBasicInfoResp> processBasicInfos = Lists.newArrayList();
|
||||
instances.forEach(model -> {
|
||||
ProcessBasicInfoResp basicInfoResp = new ProcessBasicInfoResp();
|
||||
basicInfoResp.setUpdateTime(model.getLastUpdateTime());
|
||||
basicInfoResp.setWorkBenchId(model.getTenantId());
|
||||
basicInfoResp.setProcessModelId(model.getId());
|
||||
basicInfoResp.setProcessName(model.getName());
|
||||
basicInfoResp.setVersion("mock-v1.0.1");
|
||||
if (basicInfoQuery.getStatus() != null) {
|
||||
basicInfoResp.setStatus(basicInfoQuery.getStatus());
|
||||
} else {
|
||||
//通过processModelId查询状态
|
||||
ProcModelExt procModelExt = procModelExtDao.lambdaQuery().eq(ProcModelExt::getProcModelId, model.getId()).one();
|
||||
if (procModelExt != null) {
|
||||
basicInfoResp.setStatus(procModelExt.getStatus());
|
||||
}
|
||||
}
|
||||
basicInfoResp.setOwnBusinessId(model.getCategory());
|
||||
processBasicInfos.add(basicInfoResp);
|
||||
});
|
||||
return new BpmPageResult<>(processBasicInfos, countSqlQuery.count());
|
||||
|
||||
}
|
||||
return BpmPageResult.empty();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,137 +0,0 @@
|
||||
package cn.axzo.workflow.core.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.basics.common.exception.ServiceException;
|
||||
import cn.axzo.framework.domain.page.PageResp;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessRequest;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessResp;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictDO;
|
||||
import cn.axzo.workflow.core.repository.entity.ProcessOwnBusiness;
|
||||
import cn.axzo.workflow.core.repository.mapper.ProcessOwnBusinessMapper;
|
||||
import cn.axzo.workflow.core.service.ProcessOwnBusinessService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* workflow-engine
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/6 17:00
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProcessOwnBusinessImpl extends ServiceImpl<ProcessOwnBusinessMapper, ProcessOwnBusiness>
|
||||
implements ProcessOwnBusinessService {
|
||||
|
||||
@Resource
|
||||
private ProcessOwnBusinessMapper processOwnBusinessMapper;
|
||||
|
||||
@Override
|
||||
public PageResp<ProcessOwnBusinessResp> queryProcessOwnBusinessList(ProcessOwnBusinessQuery processOwnBusinessQuery) {
|
||||
|
||||
LambdaQueryWrapper<ProcessOwnBusiness> queryWrapper = Wrappers.lambdaQuery(ProcessOwnBusiness.class)
|
||||
.eq(ProcessOwnBusiness::getIsDelete, 0)
|
||||
.like(StringUtils.isNotBlank(processOwnBusinessQuery.getBusinessName()),
|
||||
ProcessOwnBusiness::getBusinessName,
|
||||
processOwnBusinessQuery.getBusinessName())
|
||||
.eq(processOwnBusinessQuery.getBusinessId() != null,
|
||||
ProcessOwnBusiness::getBusinessId,
|
||||
processOwnBusinessQuery.getBusinessId())
|
||||
.eq(processOwnBusinessQuery.getWorkbench() != null,
|
||||
ProcessOwnBusiness::getWorkbench,
|
||||
processOwnBusinessQuery.getWorkbench())
|
||||
.orderByDesc(ProcessOwnBusiness::getCreateAt);
|
||||
|
||||
Page<ProcessOwnBusiness> pageOfResult = processOwnBusinessMapper.selectPage(new Page<>(processOwnBusinessQuery.getPageNo(),
|
||||
processOwnBusinessQuery.getPageSize()),
|
||||
queryWrapper);
|
||||
|
||||
List<ProcessOwnBusinessResp> list = BeanMapper.copyList(pageOfResult.getRecords(), ProcessOwnBusinessResp.class);
|
||||
return PageResp.list(pageOfResult.getCurrent(), pageOfResult.getSize(),
|
||||
pageOfResult.getTotal(), list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessOwnBusinessResp queryProcessOwnBusiness(String businessId) {
|
||||
ProcessOwnBusiness processOwnBusiness = this.lambdaQuery().eq(ProcessOwnBusiness::getIsDelete, 0)
|
||||
.eq(ProcessOwnBusiness::getBusinessId, businessId).one();
|
||||
if (processOwnBusiness == null) {
|
||||
throw new ServiceException("流程所属业务ID=[" + businessId + "]没有有效数据!无法进行更新");
|
||||
}
|
||||
return BeanMapper.copyBean(processOwnBusiness, ProcessOwnBusinessResp.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProcessOwnBusiness(String businessId) {
|
||||
ProcessOwnBusiness processOwnBusiness = this.lambdaQuery().eq(ProcessOwnBusiness::getIsDelete, 0)
|
||||
.eq(ProcessOwnBusiness::getBusinessId, businessId).one();
|
||||
if (processOwnBusiness == null) {
|
||||
throw new ServiceException("流程所属业务ID=[" + businessId + "]没有有效数据!无法进行更新");
|
||||
}
|
||||
//校验 模板关联关系
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessOwnBusinessResp updateProcessOwnBusiness(ProcessOwnBusinessRequest processOwnBusinessRequest) {
|
||||
String bizId = processOwnBusinessRequest.getBusinessId();
|
||||
if (StringUtils.isEmpty(bizId)) {
|
||||
throw new ServiceException("流程所属业务ID为空!无法进行更新");
|
||||
}
|
||||
ProcessOwnBusiness processOwnBusiness = this.lambdaQuery().eq(ProcessOwnBusiness::getIsDelete, 0)
|
||||
.eq(ProcessOwnBusiness::getBusinessId, bizId).one();
|
||||
if (processOwnBusiness == null) {
|
||||
throw new ServiceException("流程所属业务ID=[" + bizId + "]没有有效数据!无法进行更新");
|
||||
}
|
||||
verifyProcessOwnBusiness(processOwnBusinessRequest.getBusinessName(), bizId);
|
||||
if (StringUtils.isNotEmpty(processOwnBusinessRequest.getBusinessName())) {
|
||||
processOwnBusiness.setBusinessName(processOwnBusinessRequest.getBusinessName());
|
||||
}
|
||||
processOwnBusiness.setUpdateAt(new Date());
|
||||
if (this.saveOrUpdate(processOwnBusiness)) {
|
||||
ProcessOwnBusinessResp processOwnBusinessResp;
|
||||
processOwnBusinessResp = BeanMapper.copyBean(processOwnBusiness, ProcessOwnBusinessResp.class);
|
||||
return processOwnBusinessResp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void verifyProcessOwnBusiness(String businessName, String bizId) {
|
||||
ProcessOwnBusiness processOwnBusiness = this.lambdaQuery().eq(ProcessOwnBusiness::getIsDelete, 0)
|
||||
.eq(ProcessOwnBusiness::getBusinessName, businessName).one();
|
||||
if (processOwnBusiness != null && !processOwnBusiness.getBusinessId().equals(bizId)) {
|
||||
throw new ServiceException("流程所属业务名称=[" + businessName + "]重复!无法进行保存");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessOwnBusinessResp createProcessOwnBusiness(ProcessOwnBusinessRequest processOwnBusinessRequest) {
|
||||
if (processOwnBusinessRequest == null) {
|
||||
return null;
|
||||
}
|
||||
ProcessOwnBusiness processOwnBusiness = BeanMapper.copyBean(processOwnBusinessRequest, ProcessOwnBusiness.class);
|
||||
String bizId = UUID.randomUUID().toString().replace("-", "");
|
||||
verifyProcessOwnBusiness(processOwnBusinessRequest.getBusinessName(), bizId);
|
||||
processOwnBusiness.setBusinessId(bizId);
|
||||
processOwnBusiness.setCreateAt(new Date());
|
||||
processOwnBusiness.setUpdateAt(new Date());
|
||||
if (!this.saveOrUpdate(processOwnBusiness)) {
|
||||
return null;
|
||||
}
|
||||
return BeanMapper.copyBean(processOwnBusiness, ProcessOwnBusinessResp.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package cn.axzo.workflow.server.controller.web.business;
|
||||
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.workflow.client.feign.manage.ProcessConfigApi;
|
||||
import cn.axzo.workflow.client.feign.manage.ProcessManageApi;
|
||||
import cn.axzo.workflow.common.enums.BpmnButtonEnum;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.basic.ProcessBasicInfoQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.basic.ProcessBasicInfoResp;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.config.BpmnButtonResp;
|
||||
import cn.axzo.workflow.core.service.business.ProcessBasicInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* ProcessConfigController
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/9 14:01
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class ProcessBasicInfoController implements ProcessManageApi {
|
||||
@Resource
|
||||
private ProcessBasicInfoService basicInfoService;
|
||||
|
||||
@Override
|
||||
public ApiPageResult<ProcessBasicInfoResp> getProcessBasicInfos(ProcessBasicInfoQuery basicInfoQuery) {
|
||||
BpmPageResult<ProcessBasicInfoResp> basicInfoList = basicInfoService.getProcessBasicInfos(basicInfoQuery);
|
||||
return ApiPageResult.ok(basicInfoList.getList(), basicInfoList.getTotal(),
|
||||
basicInfoQuery.getPageNo(), basicInfoQuery.getPageSize());
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import cn.axzo.workflow.common.enums.BpmnButtonEnum;
|
||||
import cn.axzo.workflow.common.model.response.config.BpmnButtonResp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -31,14 +32,18 @@ public class ProcessConfigController implements ProcessConfigApi {
|
||||
|
||||
@Override
|
||||
public ApiResult<List<BpmnButtonResp>> getProcessButtonList(String webContextPath) {
|
||||
if(StringUtils.isEmpty(webContextPath)){
|
||||
webContextPath = "/api/process";
|
||||
}
|
||||
List<BpmnButtonEnum> bpmnButtonEnumList = Arrays.asList(BpmnButtonEnum.values());
|
||||
String finalWebContextPath = webContextPath;
|
||||
List<BpmnButtonResp> buttonRespList = bpmnButtonEnumList
|
||||
.stream().map(bpmnButtonEnum -> {
|
||||
BpmnButtonResp bpmnButtonResp = new BpmnButtonResp();
|
||||
bpmnButtonResp.setOrder(bpmnButtonEnum.getOrder());
|
||||
bpmnButtonResp.setBtnKey(bpmnButtonEnum.getBtnKey());
|
||||
bpmnButtonResp.setBtnName(bpmnButtonEnum.getBtnName());
|
||||
bpmnButtonResp.setBtnAction(webContextPath + bpmnButtonEnum.getBtnAction());
|
||||
bpmnButtonResp.setBtnAction(finalWebContextPath + bpmnButtonEnum.getBtnAction());
|
||||
return bpmnButtonResp;
|
||||
}).collect(Collectors.toList());
|
||||
return ApiResult.ok(buttonRespList);
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
package cn.axzo.workflow.server.controller.web.business;
|
||||
|
||||
import cn.axzo.framework.domain.page.PageResp;
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.workflow.client.feign.manage.ProcessOwnBusinessApi;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessQuery;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessRequest;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.business.ProcessOwnBusinessResp;
|
||||
import cn.axzo.workflow.core.service.ProcessOwnBusinessService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import static cn.azxo.framework.common.model.CommonResponse.success;
|
||||
|
||||
/**
|
||||
* ProcessOwnBusinessController
|
||||
*
|
||||
* @author zuoqinbo
|
||||
* @version V1.0
|
||||
* @date 2023/11/9 14:01
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class ProcessOwnBusinessController implements ProcessOwnBusinessApi {
|
||||
|
||||
|
||||
@Resource
|
||||
private ProcessOwnBusinessService processOwnBusiness;
|
||||
|
||||
@Override
|
||||
public ApiResult<ProcessOwnBusinessResp> createProcessOwnBusiness(ProcessOwnBusinessRequest processOwnBusinessRequest) {
|
||||
ProcessOwnBusinessResp processOwnBusinessResp = processOwnBusiness.createProcessOwnBusiness(processOwnBusinessRequest);
|
||||
return ApiResult.ok(processOwnBusinessResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<ProcessOwnBusinessResp> updateProcessOwnBusiness(ProcessOwnBusinessRequest processOwnBusinessRequest) {
|
||||
ProcessOwnBusinessResp processOwnBusinessResp = processOwnBusiness.updateProcessOwnBusiness(processOwnBusinessRequest);
|
||||
return ApiResult.ok(processOwnBusinessResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<String> deleteProcessOwnBusiness(@NotBlank(message = "businessId不能为空") String businessId) {
|
||||
processOwnBusiness.deleteProcessOwnBusiness(businessId);
|
||||
return ApiResult.ok("删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<ProcessOwnBusinessResp> queryProcessOwnBusiness(@NotBlank(message = "businessId不能为空") String businessId) {
|
||||
ProcessOwnBusinessResp processOwnBusinessResp = processOwnBusiness.queryProcessOwnBusiness(businessId);
|
||||
return ApiResult.ok(processOwnBusinessResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiPageResult<ProcessOwnBusinessResp> queryProcessOwnBusinessList(ProcessOwnBusinessQuery processOwnBusinessQuery) {
|
||||
PageResp<ProcessOwnBusinessResp> processOwnBusinessPage = processOwnBusiness.queryProcessOwnBusinessList(processOwnBusinessQuery);
|
||||
return ApiPageResult.ok(processOwnBusinessPage);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user