初始代码
This commit is contained in:
21
yunzhupaas-workflow/yunzhupaas-workflow-engine/pom.xml
Normal file
21
yunzhupaas-workflow/yunzhupaas-workflow-engine/pom.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yunzhupaas-workflow</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-workflow-engine</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>yunzhupaas-workflow-engine-entity</module>
|
||||
<module>yunzhupaas-workflow-engine-biz</module>
|
||||
<module>yunzhupaas-workflow-engine-controller</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yunzhupaas-workflow-engine</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-workflow-engine-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-workflow-engine-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-provider</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-system-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-permission-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowAuthorizeEntity;
|
||||
|
||||
/**
|
||||
* 流程权限表
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowAuthorizeMapper extends SuperMapper<FlowAuthorizeEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowCandidatesEntity;
|
||||
|
||||
/**
|
||||
* 流程候选人
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowCandidatesMapper extends SuperMapper<FlowCandidatesEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowCommentEntity;
|
||||
|
||||
/**
|
||||
* 流程评论
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowCommentMapper extends SuperMapper<FlowCommentEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowDelegateEntity;
|
||||
|
||||
/**
|
||||
* 流程委托
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowDelegateMapper extends SuperMapper<FlowDelegateEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowEngineVisibleEntity;
|
||||
|
||||
/**
|
||||
* 流程可见
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowEngineVisibleMapper extends SuperMapper<FlowEngineVisibleEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowEventLogEntity;
|
||||
|
||||
/**
|
||||
* 流程事件日志
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowEventLogMapper extends SuperMapper<FlowEventLogEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowOperatorUserEntity;
|
||||
|
||||
/**
|
||||
* 流程依次审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowOperatorUserMapper extends SuperMapper<FlowOperatorUserEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowRejectDataEntity;
|
||||
|
||||
/**
|
||||
* 冻结审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowRejectDataMapper extends SuperMapper<FlowRejectDataEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskCirculateEntity;
|
||||
|
||||
/**
|
||||
* 流程传阅
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskCirculateMapper extends SuperMapper<FlowTaskCirculateEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowTaskListModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程任务
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskMapper extends SuperMapper<FlowTaskEntity> {
|
||||
/**
|
||||
* 已办事宜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskListModel> getTrialList(@Param("map") Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 抄送事宜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskListModel> getCirculateList(@Param("map") Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 待办事宜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskListModel> getWaitList(@Param("map") Map<String, Object> map);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskNodeEntity;
|
||||
|
||||
/**
|
||||
* 流程节点
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskNodeMapper extends SuperMapper<FlowTaskNodeEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
|
||||
/**
|
||||
* 流程经办
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskOperatorMapper extends SuperMapper<FlowTaskOperatorEntity> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorRecordEntity;
|
||||
|
||||
/**
|
||||
* 流程经办记录
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskOperatorRecordMapper extends SuperMapper<FlowTaskOperatorRecordEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
public interface FlowTemplateJsonMapper extends SuperMapper<FlowTemplateJsonEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
public interface FlowTemplateMapper extends SuperMapper<FlowTemplateEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.engine.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.engine.entity.FlowUserEntity;
|
||||
|
||||
/**
|
||||
* 流程发起用户信息
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowUserMapper extends SuperMapper<FlowUserEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowAuthorizeEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 流程权限表
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowAuthorizeService extends SuperService<FlowAuthorizeEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowAuthorizeEntity> getList(String taskId, String nodeCode, SFunction<FlowAuthorizeEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param list 实体对象
|
||||
*/
|
||||
void create(List<FlowAuthorizeEntity> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowCandidatesEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程候选人
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowCandidatesService extends SuperService<FlowCandidatesEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param taskNodeId 节点主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowCandidatesEntity> getList(String taskNodeId);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param taskNodeId 节点主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowCandidatesEntity> getList(String taskId, String taskNodeId);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowCandidatesEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowCandidatesEntity entity);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param list 实体对象
|
||||
*/
|
||||
void create(List<FlowCandidatesEntity> list);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void update(String id, FlowCandidatesEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void delete(FlowCandidatesEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
void deleteByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 拒绝删除候选人节点
|
||||
*/
|
||||
void deleteTaskNodeId(List<String> taskNodeId);
|
||||
|
||||
/**
|
||||
* 撤回删除候选人
|
||||
*
|
||||
* @param taskOperatorId 经办主键
|
||||
*/
|
||||
void delete(List<String> taskOperatorId);
|
||||
|
||||
/**
|
||||
* 撤回删除候选人节点
|
||||
*/
|
||||
void deleteTaskNodeId(List<String> taskNodeId, Integer type);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowCommentEntity;
|
||||
import com.yunzhupaas.engine.model.flowcomment.FlowCommentPagination;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程评论
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowCommentService extends SuperService<FlowCommentEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param pagination 请求参数
|
||||
* @return
|
||||
*/
|
||||
List<FlowCommentEntity> getlist(FlowCommentPagination pagination);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowCommentEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowCommentEntity entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void update(String id, FlowCommentEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void delete(FlowCommentEntity entity);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.engine.entity.FlowDelegateEntity;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateUserModel;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.FlowDelegateCrForm;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.FlowDelegatePagination;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowPageListVO;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程委托
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowDelegateService extends SuperService<FlowDelegateEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param pagination 请求参数
|
||||
* @return
|
||||
*/
|
||||
List<FlowDelegateEntity> getList(FlowDelegatePagination pagination);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowDelegateEntity> getList();
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowDelegateEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void delete(FlowDelegateEntity entity);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowDelegateEntity entity);
|
||||
|
||||
/**
|
||||
* 获取被委托人的表单
|
||||
*
|
||||
* @param touserId 被委托人
|
||||
* @return
|
||||
*/
|
||||
List<FlowDelegateEntity> getUser(String touserId);
|
||||
|
||||
/**
|
||||
* 获取委托的表单
|
||||
*
|
||||
* @param userId 委托人
|
||||
* @param flowId 流程引擎
|
||||
* @param touserId 被委托人
|
||||
* @return
|
||||
*/
|
||||
List<FlowDelegateEntity> getUser(String userId, String flowId, String touserId);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
boolean update(String id, FlowDelegateEntity entity);
|
||||
|
||||
/**
|
||||
* 委托结束
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
boolean updateStop(String id, FlowDelegateEntity entity);
|
||||
|
||||
/**
|
||||
* 获取我的委托发起
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowPageListVO> getflow(FlowPagination pagination);
|
||||
|
||||
/**
|
||||
* 根据流程获取委托人列表。
|
||||
*
|
||||
* @param flowId 流程版本id
|
||||
* @return
|
||||
*/
|
||||
ListVO<FlowCandidateUserModel> getUserListByFlowId(String flowId) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 根据条件查询相关委托信息
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/10/28
|
||||
*/
|
||||
List<FlowDelegateEntity> selectSameParamAboutDelaget(FlowDelegateCrForm model);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.engine.enums.FlowStatusEnum;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.ChildNode;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
|
||||
/**
|
||||
* 在线开发工作流
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/3/15 9:19
|
||||
*/
|
||||
public interface FlowDynamicService {
|
||||
|
||||
/**
|
||||
* 流程数据
|
||||
*
|
||||
* @param flowModel
|
||||
*/
|
||||
void flowTask(FlowModel flowModel, FlowStatusEnum flowStatus, ChildNode childNode) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 保存流程
|
||||
*
|
||||
* @param flowModel
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void createOrUpdate(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 批量保存流程
|
||||
*
|
||||
* @param flowModel
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void batchCreateOrUpdate(FlowModel flowModel) throws WorkFlowException;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowEngineVisibleEntity;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowAssistModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程可见
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowEngineVisibleService extends SuperService<FlowEngineVisibleEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param flowIdList 流程主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowEngineVisibleEntity> getList(List<String> flowIdList);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowEngineVisibleEntity> getList();
|
||||
|
||||
/**
|
||||
* 可见流程列表
|
||||
*
|
||||
* @param userId 用户主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowEngineVisibleEntity> getVisibleFlowList(String userId);
|
||||
|
||||
/**
|
||||
* 可见流程列表
|
||||
*
|
||||
* @param userId 用户主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowEngineVisibleEntity> getVisibleFlowList(String userId, Integer type);
|
||||
|
||||
/**
|
||||
* 删除流程可见
|
||||
*/
|
||||
void deleteVisible(String flowId);
|
||||
|
||||
/**
|
||||
* 保存协管数据
|
||||
*/
|
||||
void assistList(FlowAssistModel assistModel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowEventLogEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程事件日志
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowEventLogService extends SuperService<FlowEventLogEntity> {
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowEventLogEntity entity);
|
||||
|
||||
/**
|
||||
* 获取日志列表
|
||||
*
|
||||
* @param taskNodeId
|
||||
* @return
|
||||
*/
|
||||
List<FlowEventLogEntity> getList(List<String> taskNodeId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowOperatorUserEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 流程依次审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowOperatorUserService extends SuperService<FlowOperatorUserEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param taskId 流程实例Id
|
||||
* @return
|
||||
*/
|
||||
List<FlowOperatorUserEntity> getList(String taskId);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowOperatorUserEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 获取
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowOperatorUserEntity> getTaskList(String taskId, String taskNodeId);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param list 实体对象
|
||||
*/
|
||||
void create(List<FlowOperatorUserEntity> list);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void update(String id, FlowOperatorUserEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void delete(FlowOperatorUserEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
void deleteByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 驳回的节点之后审批人删除
|
||||
*
|
||||
* @param taskId
|
||||
* @param taskNodeId
|
||||
*/
|
||||
void updateReject(String taskId, Set<String> taskNodeId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowRejectDataEntity;
|
||||
|
||||
/**
|
||||
* 冻结审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-29 上午9:18
|
||||
*/
|
||||
public interface FlowRejectDataService extends SuperService<FlowRejectDataEntity> {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param rejectEntity
|
||||
*/
|
||||
void createOrUpdate(FlowRejectDataEntity rejectEntity);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param rejectEntity
|
||||
*/
|
||||
void create(FlowRejectDataEntity rejectEntity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param rejectEntity
|
||||
*/
|
||||
void update(String id, FlowRejectDataEntity rejectEntity);
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
FlowRejectDataEntity getInfo(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskCirculateEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程传阅
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskCirculateService extends SuperService<FlowTaskCirculateEntity> {
|
||||
|
||||
/**
|
||||
* 删除(根据实例Id)
|
||||
*
|
||||
* @param taskId 任务主键
|
||||
* @return
|
||||
*/
|
||||
void deleteByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entitys 实体对象
|
||||
* @return
|
||||
*/
|
||||
void create(List<FlowTaskCirculateEntity> entitys);
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskCirculateEntity> getList(String taskId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorRecordEntity;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowBeforeInfoVO;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowSummary;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateUserModel;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateVO;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowRejectVO;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年4月27日 上午9:18
|
||||
*/
|
||||
public interface FlowTaskNewService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param flowModel 保存数据
|
||||
* @return
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
FlowTaskEntity saveIsAdmin(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param flowModel 保存数据
|
||||
* @return
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
FlowTaskEntity save(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
void submit(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 提交包含事件和数据
|
||||
*
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void submitAll(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 审批
|
||||
*
|
||||
* @param flowTask 流程实例
|
||||
* @param operator 流程经办
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void audit(FlowTaskEntity flowTask, FlowTaskOperatorEntity operator, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 审批包含事件和数据
|
||||
*
|
||||
* @param flowTask 流程实例
|
||||
* @param operator 流程经办
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void auditAll(FlowTaskEntity flowTask, FlowTaskOperatorEntity operator, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 验证流程审批
|
||||
*
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void audit(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 驳回
|
||||
*
|
||||
* @param flowTask 流程实例
|
||||
* @param operator 流程经办
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void reject(FlowTaskEntity flowTask, FlowTaskOperatorEntity operator, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 驳回包含事件和数据
|
||||
*
|
||||
* @param flowTask 流程实例
|
||||
* @param operator 流程经办
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void rejectAll(FlowTaskEntity flowTask, FlowTaskOperatorEntity operator, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 验证流程审批
|
||||
*
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void reject(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 已办撤回
|
||||
*
|
||||
* @param id 已办id
|
||||
* @param operatorRecord 经办记录
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
void recall(String id, FlowTaskOperatorRecordEntity operatorRecord, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 发起撤回
|
||||
*
|
||||
* @param flowTask 流程实例
|
||||
* @param flowModel 提交数据
|
||||
*/
|
||||
void revoke(FlowTaskEntity flowTask, FlowModel flowModel, boolean isParentId) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 发起撤回
|
||||
*
|
||||
* @param id 流程主键
|
||||
* @param flowModel 提交数据
|
||||
*/
|
||||
void revoke(List<String> id, FlowModel flowModel, boolean isParentId) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 终止
|
||||
*
|
||||
* @param flowTask 流程实例
|
||||
* @param flowModel 提交数据
|
||||
*/
|
||||
void cancel(FlowTaskEntity flowTask, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 终止
|
||||
*
|
||||
* @param flowModel 提交数据
|
||||
*/
|
||||
void cancel(List<String> id, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 指派
|
||||
*
|
||||
* @param id
|
||||
* @param flowModel 提交数据
|
||||
* @return
|
||||
*/
|
||||
void assign(String id, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 转办
|
||||
*
|
||||
* @param taskOperator 经办数据
|
||||
*/
|
||||
void transfer(FlowTaskOperatorEntity taskOperator, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 验证流程审批
|
||||
*
|
||||
* @param flowModel 提交数据
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void transfer(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 获取任务详情
|
||||
*
|
||||
* @return
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
FlowBeforeInfoVO getBeforeInfo(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 查询审批汇总
|
||||
*
|
||||
* @param id 主键
|
||||
* @param category 类型(1.部门 2.角色 3.岗位)
|
||||
* @param type 0.查询全部 1.查询通过和拒绝
|
||||
* @return
|
||||
*/
|
||||
List<FlowSummary> recordList(String id, String category, String type);
|
||||
|
||||
/**
|
||||
* 催办
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
boolean press(String id, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 获取候选人节点
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
FlowCandidateVO candidates(String id, FlowModel flowModel, boolean batch) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 获取候选人list
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
List<FlowCandidateUserModel> candidateUser(String id, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 批量审批
|
||||
*
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void batch(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 批量获取候选人节点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
FlowCandidateVO batchCandidates(String flowId, String taskOperatorId, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 判断操作权限
|
||||
*
|
||||
* @param userId
|
||||
* @param flowTask
|
||||
* @param operator
|
||||
* @param msg
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void permissions(String userId, FlowTaskEntity flowTask, FlowTaskOperatorEntity operator, String msg, FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 变更、复活节点
|
||||
*
|
||||
* @param flowModel
|
||||
*/
|
||||
void change(FlowModel flowModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 拒绝下拉框
|
||||
*
|
||||
* @param id
|
||||
* @param batch
|
||||
* @return
|
||||
*/
|
||||
FlowRejectVO rejectList(String id, boolean batch) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 流程挂起和恢复
|
||||
*
|
||||
* @param id
|
||||
* @param flowModel
|
||||
* @param isSuspend true 挂起 false 恢复
|
||||
*/
|
||||
void suspend(String id, FlowModel flowModel, boolean isSuspend);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskNodeEntity;
|
||||
import com.yunzhupaas.engine.model.flowtasknode.TaskNodeListModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程节点
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskNodeService extends SuperService<FlowTaskNodeEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param taskId 任务主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskNodeEntity> getList(String taskId, SFunction<FlowTaskNodeEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param id 节点主键
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskNodeEntity> getList(List<String> id, SFunction<FlowTaskNodeEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param nodeListModel
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskNodeEntity> getList(TaskNodeListModel nodeListModel, SFunction<FlowTaskNodeEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowTaskNodeEntity getInfo(String id, SFunction<FlowTaskNodeEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 删除(根据实例Id)
|
||||
*
|
||||
* @param taskId 任务主键
|
||||
*/
|
||||
void deleteByTaskId(String taskId);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowTaskNodeEntity entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void update(FlowTaskNodeEntity entity);
|
||||
|
||||
/**
|
||||
* 更新驳回开始流程节点
|
||||
*
|
||||
* @param taskId 流程id
|
||||
*/
|
||||
void update(String taskId);
|
||||
|
||||
/**
|
||||
* 修改节点的审批状态
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param start 状态
|
||||
*/
|
||||
void updateCompletion(List<String> id, int start);
|
||||
|
||||
/**
|
||||
* 修改节点数据
|
||||
*
|
||||
* @param taskNodeLis
|
||||
*/
|
||||
void updateTaskNode(List<FlowTaskNodeEntity> taskNodeLis);
|
||||
|
||||
/**
|
||||
* 修改节点的选择分支数据
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void updateTaskNodeCandidates(List<String> id, String candidates);
|
||||
|
||||
/**
|
||||
* 保存子流程任务id
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
void updateTaskIdList(FlowTaskNodeEntity entity);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorRecordEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 流程经办记录
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskOperatorRecordService extends SuperService<FlowTaskOperatorRecordEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param taskId 流程实例Id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskOperatorRecordEntity> getList(String taskId);
|
||||
|
||||
/**
|
||||
* 消息汇总列表
|
||||
*
|
||||
* @param taskId 流程实例Id
|
||||
* @param handleStatus 状态
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskOperatorRecordEntity> getRecordList(String taskId, List<Integer> handleStatus);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowTaskOperatorRecordEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void delete(FlowTaskOperatorRecordEntity entity);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void create(FlowTaskOperatorRecordEntity entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void update(String id, FlowTaskOperatorRecordEntity entity);
|
||||
|
||||
/**
|
||||
* 驳回流转记录状态
|
||||
*
|
||||
* @param taskNodeId 流程id
|
||||
* @param taskId 流程实例Id
|
||||
*/
|
||||
void updateStatus(Set<String> taskNodeId, String taskId);
|
||||
|
||||
/**
|
||||
* 通过3个id查询记录
|
||||
*
|
||||
* @param taskId
|
||||
* @param taskNodeId
|
||||
* @param taskOperatorId
|
||||
* @return
|
||||
*/
|
||||
FlowTaskOperatorRecordEntity getInfo(String taskId, String taskNodeId, String taskOperatorId);
|
||||
|
||||
/**
|
||||
* 更新撤回经办记录
|
||||
*
|
||||
* @param idAll 经办id
|
||||
*/
|
||||
void updateStatus(List<String> idAll);
|
||||
|
||||
/**
|
||||
* 更新驳回流程节点
|
||||
*
|
||||
* @param taskId 流程id
|
||||
*/
|
||||
void update(String taskId);
|
||||
|
||||
FlowTaskOperatorRecordEntity getIsCheck(String taskOperatorId, Integer status);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 流程经办
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskOperatorService extends SuperService<FlowTaskOperatorEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param taskId 流程实例Id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskOperatorEntity> getList(String taskId);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowTaskOperatorEntity getInfo(String id) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowTaskOperatorEntity getOperatorInfo(String id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entitys 实体对象
|
||||
*/
|
||||
void create(List<FlowTaskOperatorEntity> entitys);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void update(FlowTaskOperatorEntity entity);
|
||||
|
||||
/**
|
||||
* 更新会签委托人的审核状态
|
||||
*
|
||||
* @param taskNodeId 流程节点id
|
||||
* @param userId 委托人id
|
||||
* @param completion 审批状态
|
||||
*/
|
||||
void update(String taskNodeId, List<String> userId, String completion);
|
||||
|
||||
/**
|
||||
* 更新流程经办审核状态
|
||||
*
|
||||
* @param taskNodeId 流程节点id
|
||||
* @param type 流程类型
|
||||
*/
|
||||
void update(String taskNodeId, Integer type);
|
||||
|
||||
/**
|
||||
* 更新驳回流程节点
|
||||
*
|
||||
* @param taskId 流程id
|
||||
*/
|
||||
void update(String taskId);
|
||||
|
||||
/**
|
||||
* 经办未审核人员
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskOperatorEntity> press(String taskId);
|
||||
|
||||
/**
|
||||
* 驳回的节点之后的节点作废
|
||||
*
|
||||
* @param taskId
|
||||
* @param taskNodeId
|
||||
*/
|
||||
void updateReject(String taskId, Set<String> taskNodeId);
|
||||
|
||||
/**
|
||||
* 删除经办id
|
||||
*
|
||||
* @param idAll 经办id
|
||||
*/
|
||||
void deleteList(List<String> idAll);
|
||||
|
||||
/**
|
||||
* 查询加签人信息
|
||||
*
|
||||
* @param parentId 父节点Id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskOperatorEntity> getParentId(String parentId);
|
||||
|
||||
/**
|
||||
* 更新经办记录作废
|
||||
*
|
||||
* @param idAll
|
||||
*/
|
||||
void updateTaskOperatorState(List<String> idAll);
|
||||
|
||||
/**
|
||||
* 获取自己代办的流程任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskOperatorEntity> getBatchList();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowBatchModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowTaskListModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.PaginationFlowTask;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.FlowWorkListVO;
|
||||
import com.yunzhupaas.permission.model.user.WorkHandoverModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程任务
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public interface FlowTaskService extends SuperService<FlowTaskEntity> {
|
||||
|
||||
/**
|
||||
* 列表(流程监控)
|
||||
*
|
||||
* @param paginationFlowTask
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getMonitorList(PaginationFlowTask paginationFlowTask);
|
||||
|
||||
/**
|
||||
* 列表(我发起的)
|
||||
*
|
||||
* @param paginationFlowTask
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getLaunchList(PaginationFlowTask paginationFlowTask);
|
||||
|
||||
|
||||
/**
|
||||
* 列表(待我审批)
|
||||
* @param pagination
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskListModel> getWaitList(PaginationFlowTask pagination);
|
||||
|
||||
/**
|
||||
* 列表(抄送我的)
|
||||
*
|
||||
* @param pagination
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskListModel> getCirculateList(PaginationFlowTask pagination);
|
||||
|
||||
/**
|
||||
* 列表(我已审批)
|
||||
*
|
||||
* @param pagination
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskListModel> getTrialList(PaginationFlowTask pagination);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
FlowTaskEntity getInfo(String id, SFunction<FlowTaskEntity, ?>... columns) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param entity 主键值
|
||||
* @return
|
||||
*/
|
||||
void update(FlowTaskEntity entity);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 主键值
|
||||
* @return
|
||||
*/
|
||||
void create(FlowTaskEntity entity);
|
||||
|
||||
/**
|
||||
* 创建或者修改
|
||||
*
|
||||
* @param entity 主键值
|
||||
* @return
|
||||
*/
|
||||
void createOrUpdate(FlowTaskEntity entity);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param columns 指定获取的列数据 , 任务中存了三个JSON数据 , 排除后可以提高查询速度
|
||||
* @return
|
||||
*/
|
||||
FlowTaskEntity getInfoSubmit(String id, SFunction<FlowTaskEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param ids 主键值
|
||||
* @param columns 指定获取的列数据 , 任务中存了三个JSON数据 , 排除后可以提高查询速度
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getInfosSubmit(String[] ids, SFunction<FlowTaskEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
void delete(FlowTaskEntity entity) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 递归删除所有字节点
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteChildAll(List<String> id);
|
||||
|
||||
/**
|
||||
* 批量删除流程
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void delete(String[] ids) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getOrderStaList(List<String> id, SFunction<FlowTaskEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 查询子流程
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getChildList(String id, SFunction<FlowTaskEntity, ?>... columns);
|
||||
|
||||
|
||||
/**
|
||||
* 查询子流程
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getChildList(List<String> id, SFunction<FlowTaskEntity, ?>... columns);
|
||||
|
||||
/**
|
||||
* 查询流程列表
|
||||
*
|
||||
* @param tempId
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getTemplateIdList(String tempId);
|
||||
|
||||
/**
|
||||
* 查询流程列表
|
||||
*
|
||||
* @param flowId
|
||||
* @return
|
||||
*/
|
||||
List<FlowTaskEntity> getFlowList(String flowId);
|
||||
|
||||
/**
|
||||
* 批量审批引擎
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowBatchModel> batchFlowSelector();
|
||||
|
||||
/**
|
||||
* 获取子节点下所有数据
|
||||
*
|
||||
* @param idList
|
||||
* @param idAll
|
||||
*/
|
||||
void deleTaskAll(List<String> idList, List<String> idAll);
|
||||
|
||||
/**
|
||||
* 获取所有子流程
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<String> getChildAllList(String id);
|
||||
|
||||
/**
|
||||
* 获取子流程
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void getChildList(String id, boolean suspend, List<String> list);
|
||||
|
||||
/**
|
||||
* 流程交接
|
||||
* @return
|
||||
*/
|
||||
FlowWorkListVO flowWork(String fromId);
|
||||
|
||||
/**
|
||||
* 流程交接
|
||||
* @return
|
||||
*/
|
||||
boolean flowWork(WorkHandoverModel workHandoverModel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowSelectVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowTemplateJsonPage;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
public interface FlowTemplateJsonService extends SuperService<FlowTemplateJsonEntity> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateJsonEntity> getTemplateList(List<String> id);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateJsonEntity> getTemplateJsonList(List<String> id);
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateJsonEntity> getListPage(FlowTemplateJsonPage page, boolean isPage);
|
||||
|
||||
/**
|
||||
* 查询子流程
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowSelectVO> getChildListPage(FlowPagination page);
|
||||
|
||||
/**
|
||||
* 获取主版本
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateJsonEntity> getMainList(List<String> id);
|
||||
|
||||
/**
|
||||
* 获取主版本
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
FlowTemplateJsonEntity getInfo(String id) throws WorkFlowException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取主版本
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
FlowTemplateJsonEntity getJsonInfo(String id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowTemplateJsonEntity entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void update(String id, FlowTemplateJsonEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
void delete(FlowTemplateJsonEntity entity);
|
||||
|
||||
/**
|
||||
* 查询主版本流程
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateJsonEntity> getListAll(List<String> id);
|
||||
|
||||
/**
|
||||
* 设置主版本
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void templateJsonMajor(String ids) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 获取消息发送配置id
|
||||
*
|
||||
* @param engine
|
||||
* @return
|
||||
*/
|
||||
List<String> sendMsgConfigList(FlowTemplateJsonEntity engine);
|
||||
|
||||
/**
|
||||
* 修改流程引擎名称
|
||||
*
|
||||
* @param groupId
|
||||
* @param fullName
|
||||
*/
|
||||
void updateFullName(String groupId, String fullName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowExportModel;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowTemplateInfoVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowTemplateListVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowTemplateVO;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
public interface FlowTemplateService extends SuperService<FlowTemplateEntity> {
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*
|
||||
* @param pagination 分页
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateEntity> getPageList(FlowPagination pagination);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
FlowTemplateEntity getInfo(String id) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 验证名称
|
||||
*
|
||||
* @param fullName 名称
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
boolean isExistByFullName(String fullName, String id);
|
||||
|
||||
/**
|
||||
* 验证编码
|
||||
*
|
||||
* @param enCode 编码
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
boolean isExistByEnCode(String enCode, String id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowTemplateEntity entity, List<FlowTemplateJsonEntity> templateJsonList) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowTemplateEntity entity);
|
||||
|
||||
/**
|
||||
* 获取流程信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowTemplateInfoVO info(String id) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
FlowTemplateVO updateVisible(String id, FlowTemplateEntity entity, List<FlowTemplateJsonEntity> templateJsonList) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
boolean update(String id, FlowTemplateEntity entity) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 复制
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void copy(FlowTemplateEntity entity, List<FlowTemplateJsonEntity> templateJsonEntity) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delete(FlowTemplateEntity entity) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 导入创建
|
||||
*
|
||||
* @param id 导出主键
|
||||
*/
|
||||
FlowExportModel exportData(String id) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 工作流导入
|
||||
*
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
void ImportData(FlowExportModel flowExportModel, String type) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 流程设计列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateListVO> getSelectList();
|
||||
|
||||
/**
|
||||
* 所属流程树形
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateListVO> getTreeList();
|
||||
|
||||
/**
|
||||
* 查询引擎
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateEntity> getTemplateList(List<String> id);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param code 主键值
|
||||
* @return
|
||||
* @throws WorkFlowException 异常
|
||||
*/
|
||||
FlowTemplateEntity getFlowIdByCode(String code) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param pagination 分页对象
|
||||
* @param isPage 是否分页
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateEntity> getListAll(FlowPagination pagination, boolean isPage);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* 当isAll为true时,可查询全部。为false不可查询全部。
|
||||
*
|
||||
* @param pagination 分页对象
|
||||
* @param listAll 是否查询列表
|
||||
* @return
|
||||
*/
|
||||
List<FlowTemplateEntity> getListByFlowIds(FlowPagination pagination, List<String> listAll, Boolean isAll, Boolean isPage, String userId);
|
||||
|
||||
void saveLogicFlowAndForm(String id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.yunzhupaas.engine.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.engine.entity.FlowUserEntity;
|
||||
|
||||
/**
|
||||
* 流程发起用户信息
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public interface FlowUserService extends SuperService<FlowUserEntity> {
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowUserEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
FlowUserEntity getTaskInfo(String id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(FlowUserEntity entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void update(String id, FlowUserEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
* @return
|
||||
*/
|
||||
void delete(FlowUserEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
void deleteByTaskId(String taskId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowAuthorizeEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowAuthorizeMapper;
|
||||
import com.yunzhupaas.engine.service.FlowAuthorizeService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程权限表
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Service
|
||||
public class FlowAuthorizeServiceImpl extends SuperServiceImpl<FlowAuthorizeMapper, FlowAuthorizeEntity> implements FlowAuthorizeService {
|
||||
|
||||
@Override
|
||||
public List<FlowAuthorizeEntity> getList(String taskId, String nodeCode, SFunction<FlowAuthorizeEntity, ?>... columns) {
|
||||
QueryWrapper<FlowAuthorizeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowAuthorizeEntity::getTaskId, taskId);
|
||||
if (StringUtil.isNotEmpty(nodeCode)) {
|
||||
queryWrapper.lambda().eq(FlowAuthorizeEntity::getNodeCode, nodeCode);
|
||||
}
|
||||
queryWrapper.lambda().select(columns);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(List<FlowAuthorizeEntity> list) {
|
||||
for (FlowAuthorizeEntity entity : list) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowCandidatesEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowCandidatesMapper;
|
||||
import com.yunzhupaas.engine.service.FlowCandidatesService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程候选人
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Service
|
||||
public class FlowCandidatesServiceImpl extends SuperServiceImpl<FlowCandidatesMapper, FlowCandidatesEntity> implements FlowCandidatesService {
|
||||
|
||||
@Override
|
||||
public List<FlowCandidatesEntity> getList(String taskNodeId) {
|
||||
return getList(null, taskNodeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowCandidatesEntity> getList(String taskId, String taskNodeId) {
|
||||
QueryWrapper<FlowCandidatesEntity> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(taskId)) {
|
||||
queryWrapper.lambda().eq(FlowCandidatesEntity::getTaskId, taskId);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskNodeId)) {
|
||||
queryWrapper.lambda().eq(FlowCandidatesEntity::getTaskNodeId, taskNodeId);
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowCandidatesEntity getInfo(String id) {
|
||||
QueryWrapper<FlowCandidatesEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowCandidatesEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowCandidatesEntity entity) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(List<FlowCandidatesEntity> list) {
|
||||
for (FlowCandidatesEntity entity : list) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowCandidatesEntity entity) {
|
||||
entity.setId(id);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowCandidatesEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByTaskId(String taskId) {
|
||||
QueryWrapper<FlowCandidatesEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowCandidatesEntity::getTaskId, taskId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTaskNodeId(List<String> taskNodeId) {
|
||||
if (taskNodeId.size() > 0) {
|
||||
QueryWrapper<FlowCandidatesEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowCandidatesEntity::getTaskNodeId, taskNodeId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<String> taskOperatorId) {
|
||||
if (taskOperatorId.size() > 0) {
|
||||
QueryWrapper<FlowCandidatesEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowCandidatesEntity::getOperatorId, taskOperatorId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTaskNodeId(List<String> taskNodeId, Integer type) {
|
||||
if (taskNodeId.size() > 0) {
|
||||
QueryWrapper<FlowCandidatesEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowCandidatesEntity::getTaskNodeId, taskNodeId);
|
||||
queryWrapper.lambda().eq(FlowCandidatesEntity::getType, type);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowCommentEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowCommentMapper;
|
||||
import com.yunzhupaas.engine.model.flowcomment.FlowCommentPagination;
|
||||
import com.yunzhupaas.engine.service.FlowCommentService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程评论
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Service
|
||||
public class FlowCommentServiceImpl extends SuperServiceImpl<FlowCommentMapper, FlowCommentEntity> implements FlowCommentService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<FlowCommentEntity> getlist(FlowCommentPagination pagination) {
|
||||
QueryWrapper<FlowCommentEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowCommentEntity::getTaskId, pagination.getTaskId());
|
||||
queryWrapper.lambda().isNull(FlowCommentEntity::getDeleteMark);
|
||||
queryWrapper.lambda().orderByDesc(FlowCommentEntity::getCreatorTime);
|
||||
Page<FlowCommentEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowCommentEntity> userIPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(userIPage.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowCommentEntity getInfo(String id) {
|
||||
QueryWrapper<FlowCommentEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowCommentEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowCommentEntity entity) {
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setCreatorUserId(UserProvider.getUser().getUserId());
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowCommentEntity entity) {
|
||||
entity.setId(id);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowCommentEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.constant.PermissionConst;
|
||||
import com.yunzhupaas.engine.entity.FlowDelegateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowEngineVisibleEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowDelegateMapper;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateUserModel;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.FlowDelegateCrForm;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.FlowDelegateModel;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.FlowDelegatePagination;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowPageListVO;
|
||||
import com.yunzhupaas.engine.service.FlowDelegateService;
|
||||
import com.yunzhupaas.engine.service.FlowEngineVisibleService;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateJsonService;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateService;
|
||||
import com.yunzhupaas.engine.util.FlowMsgUtil;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.OrganizeEntity;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.entity.UserRelationEntity;
|
||||
import com.yunzhupaas.util.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程委托
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Service
|
||||
public class FlowDelegateServiceImpl extends SuperServiceImpl<FlowDelegateMapper, FlowDelegateEntity> implements FlowDelegateService {
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowMsgUtil flowMsgUtil;
|
||||
|
||||
@Autowired
|
||||
private FlowTemplateService flowTemplateService;
|
||||
@Autowired
|
||||
private FlowTemplateJsonService flowTemplateJsonService;
|
||||
@Autowired
|
||||
private FlowEngineVisibleService flowEngineVisibleService;
|
||||
|
||||
@Override
|
||||
public List<FlowDelegateEntity> getList(FlowDelegatePagination pagination) {
|
||||
// 定义变量判断是否需要使用修改时间倒序
|
||||
boolean flag = false;
|
||||
String userId = UserProvider.getUser().getUserId();
|
||||
QueryWrapper<FlowDelegateEntity> queryWrapper = new QueryWrapper<>();
|
||||
if ("2".equals(pagination.getMyOrDelagateToMe())) {//MyOrDelagateToMe=2查询委托给我的列表
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getToUserId, userId);
|
||||
} else {
|
||||
// if (!UserProvider.getUser().getIsAdministrator()) {//非超管
|
||||
// List<UserByRoleVO> list = serviceUtil.getListByAuthorize("0");
|
||||
// if (CollectionUtils.isNotEmpty(list)) {//是分管
|
||||
// List<String> userIds = new ArrayList<>();
|
||||
// for (UserByRoleVO item : list) {
|
||||
// List<UserByRoleVO> listByAuthorize = serviceUtil.getListByAuthorize(item.getId());
|
||||
// userIds.addAll(listByAuthorize.stream().map(UserByRoleVO::getId).collect(Collectors.toList()));
|
||||
// }
|
||||
// queryWrapper.lambda().and(
|
||||
// t -> t.eq(FlowDelegateEntity::getUserId, userId))
|
||||
// .or().in(FlowDelegateEntity::getUserId, userIds);
|
||||
// } else {
|
||||
// queryWrapper.lambda().eq(FlowDelegateEntity::getUserId, userId);
|
||||
// }
|
||||
// }
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getUserId, userId);
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(pagination.getKeyword())) {
|
||||
flag = true;
|
||||
if ("1".equals(pagination.getMyOrDelagateToMe())) {
|
||||
queryWrapper.lambda().and(
|
||||
t -> t.like(FlowDelegateEntity::getFlowName, pagination.getKeyword())
|
||||
.or().like(FlowDelegateEntity::getToUserName, pagination.getKeyword())
|
||||
);
|
||||
} else {
|
||||
queryWrapper.lambda().and(
|
||||
t -> t.like(FlowDelegateEntity::getFlowName, pagination.getKeyword())
|
||||
.or().like(FlowDelegateEntity::getUserName, pagination.getKeyword())
|
||||
);
|
||||
}
|
||||
}
|
||||
//排序
|
||||
queryWrapper.lambda().orderByAsc(FlowDelegateEntity::getSortCode).orderByDesc(FlowDelegateEntity::getCreatorTime);
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(FlowDelegateEntity::getLastModifyTime);
|
||||
}
|
||||
Page page = new Page(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowDelegateEntity> flowDelegateEntityPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(flowDelegateEntityPage.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowDelegateEntity> getList() {
|
||||
String userId = UserProvider.getUser().getUserId();
|
||||
QueryWrapper<FlowDelegateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().and(
|
||||
t -> t.eq(FlowDelegateEntity::getCreatorUserId, userId)
|
||||
.or().eq(FlowDelegateEntity::getUserId, userId));
|
||||
return this.baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowDelegateEntity getInfo(String id) {
|
||||
QueryWrapper<FlowDelegateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowDelegateEntity entity) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowDelegateEntity entity) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setId(RandomUtil.uuId());
|
||||
entity.setSortCode(RandomUtil.parses());
|
||||
entity.setCreatorUserId(userInfo.getUserId());
|
||||
FlowDelegateModel delegate = new FlowDelegateModel();
|
||||
delegate.setToUserIds(ImmutableList.of(entity.getToUserId()));
|
||||
delegate.setType(entity.getType());
|
||||
delegate.setUserInfo(userInfo);
|
||||
flowMsgUtil.delegateMsg(delegate);
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowDelegateEntity> getUser(String touserId) {
|
||||
return getUser(null, null, touserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowDelegateEntity> getUser(String userId, String flowId, String touserId) {
|
||||
Date thisTime = DateUtil.getNowDate();
|
||||
QueryWrapper<FlowDelegateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getType, 1);
|
||||
queryWrapper.lambda().le(FlowDelegateEntity::getStartTime, thisTime).ge(FlowDelegateEntity::getEndTime, thisTime);
|
||||
if (StringUtil.isNotEmpty(userId)) {
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getUserId, userId);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(touserId)) {
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getToUserId, touserId);
|
||||
}
|
||||
List<FlowDelegateEntity> list = this.list(queryWrapper);
|
||||
List<FlowDelegateEntity> listRes = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(flowId)) {
|
||||
for (FlowDelegateEntity item : list) {
|
||||
if (StringUtil.isNotEmpty(item.getFlowId())) {
|
||||
String[] split = item.getFlowId().split(",");
|
||||
if (Arrays.asList(split).contains(flowId)) {
|
||||
listRes.add(item);
|
||||
}
|
||||
} else {//为空是全部流程
|
||||
listRes.add(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
listRes = list;
|
||||
}
|
||||
return listRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(String id, FlowDelegateEntity entity) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setId(id);
|
||||
entity.setLastModifyTime(new Date());
|
||||
entity.setLastModifyUserId(userInfo.getUserId());
|
||||
FlowDelegateModel delegate = new FlowDelegateModel();
|
||||
delegate.setToUserIds(ImmutableList.of(entity.getToUserId()));
|
||||
delegate.setType(entity.getType());
|
||||
delegate.setUserInfo(userInfo);
|
||||
flowMsgUtil.delegateMsg(delegate);
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateStop(String id, FlowDelegateEntity entity) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setId(id);
|
||||
entity.setLastModifyTime(new Date());
|
||||
entity.setLastModifyUserId(userInfo.getUserId());
|
||||
FlowDelegateModel delegate = new FlowDelegateModel();
|
||||
delegate.setToUserIds(ImmutableList.of(entity.getToUserId()));
|
||||
delegate.setType(FlowNature.EndMsg);
|
||||
delegate.setUserInfo(userInfo);
|
||||
flowMsgUtil.delegateMsg(delegate);
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowPageListVO> getflow(FlowPagination pagination) {
|
||||
List<FlowDelegateEntity> list = getLaunchDelagateList();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// List<String> listFlow = new ArrayList<>();
|
||||
// for (FlowDelegateEntity item : list) {
|
||||
// if (StringUtil.isNotEmpty(item.getFlowId())) {
|
||||
// listFlow.addAll(
|
||||
// flowTemplateService.getListByFlowIds(pagination, Arrays.asList(item.getFlowId().split(",")), false, false, item.getUserId())
|
||||
// .stream().map(FlowTemplateEntity::getId).collect(Collectors.toList()));
|
||||
// } else {
|
||||
// listFlow.addAll(flowTemplateService.getListByFlowIds(pagination, null, true, false, item.getUserId())
|
||||
// .stream().map(FlowTemplateEntity::getId).collect(Collectors.toList()));
|
||||
// }
|
||||
// }
|
||||
// List<FlowTemplateEntity> listReslut = flowTemplateService.getListByFlowIds(pagination, listFlow, false, false, null);
|
||||
List<String> templateIdList = new ArrayList<>();
|
||||
int num = 0;
|
||||
for (FlowDelegateEntity item : list) {
|
||||
if (StringUtil.isNotEmpty(item.getFlowId())) {
|
||||
templateIdList.addAll(Arrays.asList(item.getFlowId().split(",")));
|
||||
}
|
||||
num += StringUtil.isEmpty(item.getFlowId()) ? 1 : 0;
|
||||
}
|
||||
if (num == 0) {
|
||||
pagination.setTemplateIdList(templateIdList);
|
||||
}
|
||||
List<FlowTemplateEntity> dataList = flowTemplateService.getListAll(pagination, true);
|
||||
List<FlowPageListVO> listVO = JsonUtil.getJsonToList(dataList, FlowPageListVO.class);
|
||||
return listVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListVO<FlowCandidateUserModel> getUserListByFlowId(String flowId) throws WorkFlowException {
|
||||
FlowTemplateJsonEntity info = flowTemplateJsonService.getInfo(flowId);
|
||||
String templateId = info.getTemplateId();
|
||||
List<FlowDelegateEntity> list = getLaunchDelagateList();
|
||||
Set<UserEntity> userName = new HashSet<>();
|
||||
for (FlowDelegateEntity item : list) {
|
||||
//用户可见列表
|
||||
UserEntity userInfo = serviceUtil.getUserInfo(item.getUserId());
|
||||
boolean visibleType = "1".equals(userInfo.getIsAdministrator());
|
||||
List<String> listVisible = null;
|
||||
if (!visibleType) {
|
||||
List<String> id = flowEngineVisibleService.getVisibleFlowList(userInfo.getId()).stream().map(FlowEngineVisibleEntity::getFlowId).collect(Collectors.toList());
|
||||
//可见列表
|
||||
listVisible = flowTemplateJsonService.getListAll(id).stream().map(FlowTemplateJsonEntity::getTemplateId).collect(Collectors.toList());
|
||||
}
|
||||
//判断委托人是否有发起权限
|
||||
if (StringUtil.isNotEmpty(item.getFlowId())) {
|
||||
List<String> strings = Arrays.asList(item.getFlowId().split(","));
|
||||
if (strings.contains(templateId) && listVisible.contains(templateId)) {
|
||||
userName.add(userInfo);
|
||||
}
|
||||
} else {
|
||||
if (listVisible.contains(templateId)) {
|
||||
userName.add(userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> userIdAll = userName.stream().map(UserEntity::getId).collect(Collectors.toList());
|
||||
Map<String, List<UserRelationEntity>> userMap = serviceUtil.getListByUserIdAll(userIdAll).stream().filter(t -> PermissionConst.ORGANIZE.equals(t.getObjectType())).collect(Collectors.groupingBy(UserRelationEntity::getUserId));
|
||||
List<FlowCandidateUserModel> jsonToList = new ArrayList<>();
|
||||
for (UserEntity entity : userName) {
|
||||
List<UserRelationEntity> listByUserId = userMap.get(entity.getId()) != null ? userMap.get(entity.getId()) : new ArrayList<>();
|
||||
StringJoiner joiner = new StringJoiner(",");
|
||||
for (UserRelationEntity relation : listByUserId) {
|
||||
List<OrganizeEntity> organizeId = serviceUtil.getOrganizeId(relation.getObjectId());
|
||||
if (organizeId.size() > 0) {
|
||||
String organizeName = organizeId.stream().map(OrganizeEntity::getFullName).collect(Collectors.joining("/"));
|
||||
joiner.add(organizeName);
|
||||
}
|
||||
}
|
||||
FlowCandidateUserModel vo = JsonUtil.getJsonToBean(entity, FlowCandidateUserModel.class);
|
||||
vo.setFullName(entity.getRealName() + "/" + entity.getAccount());
|
||||
vo.setHeadIcon(UploaderUtil.uploaderImg(entity.getHeadIcon()));
|
||||
vo.setOrganize(joiner.toString());
|
||||
jsonToList.add(vo);
|
||||
}
|
||||
if (jsonToList.size() == 0) {
|
||||
throw new WorkFlowException(MsgCode.WF029.get());
|
||||
}
|
||||
ListVO<FlowCandidateUserModel> vo = new ListVO<>();
|
||||
vo.setList(jsonToList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户所有发起委托列表
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/10/17
|
||||
*/
|
||||
private List<FlowDelegateEntity> getLaunchDelagateList() {
|
||||
String userId = UserProvider.getUser().getUserId();
|
||||
Date thisTime = DateUtil.getNowDate();
|
||||
QueryWrapper<FlowDelegateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getToUserId, userId);
|
||||
queryWrapper.lambda().le(FlowDelegateEntity::getStartTime, thisTime).ge(FlowDelegateEntity::getEndTime, thisTime);
|
||||
queryWrapper.lambda().like(FlowDelegateEntity::getType, 0);
|
||||
List<FlowDelegateEntity> list = this.baseMapper.selectList(queryWrapper);//全部发起委托
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowDelegateEntity> selectSameParamAboutDelaget(FlowDelegateCrForm model) {
|
||||
QueryWrapper<FlowDelegateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getUserId, model.getUserId());
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getToUserId, model.getToUserId());
|
||||
queryWrapper.lambda().eq(FlowDelegateEntity::getType, model.getType());
|
||||
queryWrapper.lambda().gt(FlowDelegateEntity::getEndTime, new Date());
|
||||
List<FlowDelegateEntity> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.enums.FlowStatusEnum;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowTemplateAllModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.ChildNode;
|
||||
import com.yunzhupaas.engine.service.FlowDynamicService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNewService;
|
||||
import com.yunzhupaas.engine.util.FlowContextHolder;
|
||||
import com.yunzhupaas.engine.util.FlowTaskUtil;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.base.model.flow.FlowFormDataModel;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 在线开发工作流
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/3/15 9:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FlowDynamicServiceImpl implements FlowDynamicService {
|
||||
|
||||
|
||||
@Autowired
|
||||
public ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowTaskUtil flowTaskUtil;
|
||||
@Autowired
|
||||
private FlowTaskNewService flowTaskNewService;
|
||||
|
||||
@Override
|
||||
public void flowTask(FlowModel flowModel, FlowStatusEnum flowStatus, ChildNode childNode) throws WorkFlowException {
|
||||
Map<String, Object> formData = flowModel.getFormData();
|
||||
String id = flowModel.getProcessId();
|
||||
Map<String, Object> map = flowModel.getFormData();
|
||||
formData.put(FlowFormConstant.FLOWID, flowModel.getFlowId());
|
||||
String formId = childNode.getProperties().getFormId();
|
||||
List<Map<String, Object>> formOperates = childNode.getProperties().getFormOperates();
|
||||
FlowFormDataModel formDataModel = FlowFormDataModel.builder().
|
||||
formId(formId).id(id).delegateUser(serviceUtil.getUserInfo(flowModel.getUserId())).
|
||||
map(map).formOperates(formOperates).build();
|
||||
switch (flowStatus) {
|
||||
case save:
|
||||
flowTaskNewService.save(flowModel);
|
||||
serviceUtil.createOrUpdate(formDataModel);
|
||||
break;
|
||||
case submit:
|
||||
FlowContextHolder.addData(formId, formData);
|
||||
FlowContextHolder.addChildData(id, formId, formData);
|
||||
FlowContextHolder.addFormOperates(id, formId, formOperates);
|
||||
flowTaskNewService.submitAll(flowModel);
|
||||
break;
|
||||
case none:
|
||||
serviceUtil.createOrUpdate(formDataModel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createOrUpdate(FlowModel flowModel) throws WorkFlowException {
|
||||
FlowTemplateAllModel model = flowTaskUtil.templateJson(flowModel.getFlowId());
|
||||
FlowTemplateJsonEntity templateJson = model.getTemplateJson();
|
||||
FlowTemplateEntity template = model.getTemplate();
|
||||
ChildNode childNode = JsonUtil.getJsonToBean(templateJson.getFlowTemplateJson(), ChildNode.class);
|
||||
FlowStatusEnum statusEnum = FlowStatusEnum.submit.getMessage().equals(flowModel.getStatus()) ? FlowStatusEnum.submit :
|
||||
template.getType() == 0 ? FlowStatusEnum.save : FlowStatusEnum.none;
|
||||
flowTask(flowModel, statusEnum, childNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void batchCreateOrUpdate(FlowModel flowModel) throws WorkFlowException {
|
||||
UserInfo userInfo = flowModel.getUserInfo();
|
||||
List<String> batchUserId = flowModel.getDelegateUserList();
|
||||
boolean isBatchUser = batchUserId.size() == 0;
|
||||
if (isBatchUser) {
|
||||
batchUserId.add(userInfo.getUserId());
|
||||
}
|
||||
for (String id : batchUserId) {
|
||||
FlowModel model = JsonUtil.getJsonToBean(flowModel, FlowModel.class);
|
||||
model.setDelegateUser(isBatchUser ? model.getDelegateUser() : userInfo.getUserId());
|
||||
model.setProcessId(StringUtil.isNotEmpty(model.getId()) ? model.getId() : RandomUtil.uuId());
|
||||
if (!isBatchUser) {
|
||||
UserEntity userEntity = serviceUtil.getUserInfo(id);
|
||||
if (userEntity != null) {
|
||||
UserInfo info = new UserInfo();
|
||||
info.setUserName(userEntity.getRealName());
|
||||
info.setUserId(userEntity.getId());
|
||||
model.setUserInfo(info);
|
||||
}
|
||||
}
|
||||
model.setUserId(id);
|
||||
createOrUpdate(model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowEngineVisibleEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowEngineVisibleMapper;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowAssistModel;
|
||||
import com.yunzhupaas.engine.service.FlowEngineVisibleService;
|
||||
import com.yunzhupaas.permission.entity.UserRelationEntity;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import com.yunzhupaas.util.ServiceAllUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程可见
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Service
|
||||
public class FlowEngineVisibleServiceImpl extends SuperServiceImpl<FlowEngineVisibleMapper, FlowEngineVisibleEntity> implements FlowEngineVisibleService {
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
|
||||
@Override
|
||||
public List<FlowEngineVisibleEntity> getList(List<String> flowIdList) {
|
||||
List<FlowEngineVisibleEntity> list = new ArrayList<>();
|
||||
if (flowIdList.size() > 0) {
|
||||
QueryWrapper<FlowEngineVisibleEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowEngineVisibleEntity::getFlowId, flowIdList);
|
||||
queryWrapper.lambda().orderByAsc(FlowEngineVisibleEntity::getSortCode).orderByDesc(FlowEngineVisibleEntity::getCreatorTime);
|
||||
list.addAll(this.list(queryWrapper));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowEngineVisibleEntity> getList() {
|
||||
QueryWrapper<FlowEngineVisibleEntity> queryWrapper = new QueryWrapper<>();
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowEngineVisibleEntity> getVisibleFlowList(String userId) {
|
||||
return getVisibleFlowList(userId, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowEngineVisibleEntity> getVisibleFlowList(String userId, Integer type) {
|
||||
List<String> userRelationList = serviceUtil.getListByUserIdAll(ImmutableList.of(userId)).stream().map(UserRelationEntity::getObjectId).collect(Collectors.toList());
|
||||
userRelationList.add(userId);
|
||||
QueryWrapper<FlowEngineVisibleEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda().in(FlowEngineVisibleEntity::getOperatorId, userRelationList);
|
||||
wrapper.lambda().eq(FlowEngineVisibleEntity::getType, type);
|
||||
List<FlowEngineVisibleEntity> flowList = this.list(wrapper);
|
||||
return flowList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVisible(String flowId) {
|
||||
QueryWrapper<FlowEngineVisibleEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowEngineVisibleEntity::getFlowId, flowId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assistList(FlowAssistModel assistModel) {
|
||||
List<FlowEngineVisibleEntity> assistListAll = this.getList(ImmutableList.of(assistModel.getTemplateId()));
|
||||
for (FlowEngineVisibleEntity entity : assistListAll) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
List<String> list = assistModel.getList();
|
||||
List<FlowEngineVisibleEntity> visibleList = new ArrayList<>();
|
||||
for (String idAll : list) {
|
||||
String[] id = idAll.split("--");
|
||||
String operatorId = id[0];
|
||||
String type = id.length > 1 ? id[1] : "user";
|
||||
FlowEngineVisibleEntity visible = new FlowEngineVisibleEntity();
|
||||
visible.setOperatorId(operatorId);
|
||||
visible.setOperatorType(type);
|
||||
visible.setType(2);
|
||||
visibleList.add(visible);
|
||||
}
|
||||
for (int i = 0; i < visibleList.size(); i++) {
|
||||
FlowEngineVisibleEntity visibleEntity = visibleList.get(i);
|
||||
visibleEntity.setId(RandomUtil.uuId());
|
||||
visibleEntity.setFlowId(assistModel.getTemplateId());
|
||||
visibleEntity.setSortCode(Long.parseLong(i + ""));
|
||||
this.save(visibleEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowEventLogEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowEventLogMapper;
|
||||
import com.yunzhupaas.engine.service.FlowEventLogService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程事件日志
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Service
|
||||
public class FlowEventLogServiceImpl extends SuperServiceImpl<FlowEventLogMapper, FlowEventLogEntity> implements FlowEventLogService {
|
||||
|
||||
|
||||
@Override
|
||||
public void create(FlowEventLogEntity entity) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowEventLogEntity> getList(List<String> nodeIdList) {
|
||||
QueryWrapper<FlowEventLogEntity> queryWrapper = new QueryWrapper<>();
|
||||
if (nodeIdList.size() > 0) {
|
||||
queryWrapper.lambda().in(FlowEventLogEntity::getTaskNodeId, nodeIdList);
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowOperatorUserEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowOperatorUserMapper;
|
||||
import com.yunzhupaas.engine.service.FlowOperatorUserService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 流程依次审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Service
|
||||
public class FlowOperatorUserServiceImpl extends SuperServiceImpl<FlowOperatorUserMapper, FlowOperatorUserEntity> implements FlowOperatorUserService {
|
||||
|
||||
@Override
|
||||
public List<FlowOperatorUserEntity> getList(String taskId) {
|
||||
return getTaskList(taskId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowOperatorUserEntity getInfo(String id) {
|
||||
QueryWrapper<FlowOperatorUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowOperatorUserEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowOperatorUserEntity> getTaskList(String taskId, String taskNodeId) {
|
||||
QueryWrapper<FlowOperatorUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
if (StringUtil.isNotEmpty(taskId)) {
|
||||
queryWrapper.lambda().eq(FlowOperatorUserEntity::getTaskId, taskId);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(taskNodeId)) {
|
||||
queryWrapper.lambda().eq(FlowOperatorUserEntity::getTaskNodeId, taskNodeId);
|
||||
}
|
||||
queryWrapper.lambda().orderByAsc(FlowOperatorUserEntity::getSortCode);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(List<FlowOperatorUserEntity> list) {
|
||||
for (FlowOperatorUserEntity entity : list) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowOperatorUserEntity entity) {
|
||||
entity.setId(id);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowOperatorUserEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByTaskId(String taskId) {
|
||||
QueryWrapper<FlowOperatorUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowOperatorUserEntity::getTaskId, taskId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReject(String taskId, Set<String> taskNodeId) {
|
||||
if (taskNodeId.size() > 0) {
|
||||
QueryWrapper<FlowOperatorUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowOperatorUserEntity::getTaskId, taskId);
|
||||
queryWrapper.lambda().in(FlowOperatorUserEntity::getTaskNodeId, taskNodeId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowRejectDataEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowRejectDataMapper;
|
||||
import com.yunzhupaas.engine.service.FlowRejectDataService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 冻结审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-29 上午9:18
|
||||
*/
|
||||
@Service
|
||||
public class FlowRejectDataDataServiceImpl extends SuperServiceImpl<FlowRejectDataMapper, FlowRejectDataEntity> implements FlowRejectDataService {
|
||||
|
||||
@Override
|
||||
public void createOrUpdate(FlowRejectDataEntity rejectEntity) {
|
||||
this.saveOrUpdate(rejectEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowRejectDataEntity rejectEntity) {
|
||||
if (rejectEntity.getId() == null) {
|
||||
rejectEntity.setId(RandomUtil.uuId());
|
||||
}
|
||||
this.save(rejectEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowRejectDataEntity rejectEntity) {
|
||||
rejectEntity.setId(id);
|
||||
this.updateById(rejectEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowRejectDataEntity getInfo(String id) {
|
||||
QueryWrapper<FlowRejectDataEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowRejectDataEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskCirculateEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowTaskCirculateMapper;
|
||||
import com.yunzhupaas.engine.service.FlowTaskCirculateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程传阅
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Service
|
||||
public class FlowTaskCirculateServiceImpl extends SuperServiceImpl<FlowTaskCirculateMapper, FlowTaskCirculateEntity> implements FlowTaskCirculateService {
|
||||
|
||||
@Override
|
||||
public void deleteByTaskId(String taskId) {
|
||||
QueryWrapper<FlowTaskCirculateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskCirculateEntity::getTaskId, taskId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(List<FlowTaskCirculateEntity> entitys) {
|
||||
for (FlowTaskCirculateEntity entity : entitys) {
|
||||
this.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskCirculateEntity> getList(String taskId) {
|
||||
QueryWrapper<FlowTaskCirculateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskCirculateEntity::getTaskId, taskId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,149 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskNodeEntity;
|
||||
import com.yunzhupaas.engine.enums.FlowNodeEnum;
|
||||
import com.yunzhupaas.engine.mapper.FlowTaskNodeMapper;
|
||||
import com.yunzhupaas.engine.model.flowtasknode.TaskNodeListModel;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNodeService;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程节点
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Service
|
||||
public class FlowTaskNodeServiceImpl extends SuperServiceImpl<FlowTaskNodeMapper, FlowTaskNodeEntity> implements FlowTaskNodeService {
|
||||
|
||||
@Override
|
||||
public List<FlowTaskNodeEntity> getList(String taskId, SFunction<FlowTaskNodeEntity, ?>... columns) {
|
||||
TaskNodeListModel nodeListModel = new TaskNodeListModel();
|
||||
nodeListModel.setId(taskId);
|
||||
return getList(nodeListModel, columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskNodeEntity> getList(List<String> id, SFunction<FlowTaskNodeEntity, ?>... columns) {
|
||||
List<FlowTaskNodeEntity> list = new ArrayList<>();
|
||||
if (id.size() > 0) {
|
||||
QueryWrapper<FlowTaskNodeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskNodeEntity::getId, id);
|
||||
queryWrapper.lambda().select(columns);
|
||||
list.addAll(this.list(queryWrapper));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskNodeEntity> getList(TaskNodeListModel nodeListModel, SFunction<FlowTaskNodeEntity, ?>... columns) {
|
||||
QueryWrapper<FlowTaskNodeEntity> queryWrapper = new QueryWrapper<>();
|
||||
String taskId = nodeListModel.getId();
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getTaskId, taskId);
|
||||
Integer state = nodeListModel.getState();
|
||||
if (ObjectUtil.isNotEmpty(state)) {
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getState, state);
|
||||
}
|
||||
Integer completion = nodeListModel.getCompletion();
|
||||
if (ObjectUtil.isNotEmpty(completion)) {
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getCompletion, completion);
|
||||
}
|
||||
String nodeCode = nodeListModel.getNotNodeCode();
|
||||
if (ObjectUtil.isNotEmpty(nodeCode)) {
|
||||
queryWrapper.lambda().ne(FlowTaskNodeEntity::getNodeCode, nodeCode);
|
||||
}
|
||||
queryWrapper.lambda().select(columns);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskNodeEntity getInfo(String id, SFunction<FlowTaskNodeEntity, ?>... columns) {
|
||||
QueryWrapper<FlowTaskNodeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getId, id);
|
||||
queryWrapper.lambda().select(columns);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByTaskId(String taskId) {
|
||||
QueryWrapper<FlowTaskNodeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getTaskId, taskId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowTaskNodeEntity entity) {
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(FlowTaskNodeEntity entity) {
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String taskId) {
|
||||
UpdateWrapper<FlowTaskNodeEntity> wrapper = new UpdateWrapper<>();
|
||||
wrapper.lambda().eq(FlowTaskNodeEntity::getTaskId, taskId);
|
||||
wrapper.lambda().set(FlowTaskNodeEntity::getCompletion, FlowNodeEnum.Futility.getCode());
|
||||
wrapper.lambda().set(FlowTaskNodeEntity::getState, FlowNodeEnum.Futility.getCode());
|
||||
this.update(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCompletion(List<String> id, int start) {
|
||||
if (id.size() > 0) {
|
||||
UpdateWrapper<FlowTaskNodeEntity> wrapper = new UpdateWrapper<>();
|
||||
wrapper.lambda().in(FlowTaskNodeEntity::getId, id);
|
||||
wrapper.lambda().set(FlowTaskNodeEntity::getCompletion, start);
|
||||
this.update(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskNode(List<FlowTaskNodeEntity> taskNodeLis) {
|
||||
for (FlowTaskNodeEntity taskNodeLi : taskNodeLis) {
|
||||
String nodeNext = StringUtil.isNotEmpty(taskNodeLi.getNodeNext()) ? taskNodeLi.getNodeNext() : FlowNature.NodeEnd;
|
||||
UpdateWrapper<FlowTaskNodeEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(FlowTaskNodeEntity::getId, taskNodeLi.getId());
|
||||
updateWrapper.lambda().set(FlowTaskNodeEntity::getNodeNext, nodeNext);
|
||||
updateWrapper.lambda().set(FlowTaskNodeEntity::getSortCode, taskNodeLi.getSortCode());
|
||||
updateWrapper.lambda().set(FlowTaskNodeEntity::getState, taskNodeLi.getState());
|
||||
updateWrapper.lambda().set(FlowTaskNodeEntity::getCompletion, taskNodeLi.getCompletion());
|
||||
updateWrapper.lambda().set(FlowTaskNodeEntity::getNodePropertyJson, taskNodeLi.getNodePropertyJson());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskNodeCandidates(List<String> id, String candidates) {
|
||||
if (id.size() > 0) {
|
||||
UpdateWrapper<FlowTaskNodeEntity> wrapper = new UpdateWrapper<>();
|
||||
wrapper.lambda().in(FlowTaskNodeEntity::getId, id);
|
||||
wrapper.lambda().set(FlowTaskNodeEntity::getCandidates, candidates);
|
||||
this.update(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskIdList(FlowTaskNodeEntity entity) {
|
||||
UpdateWrapper<FlowTaskNodeEntity> wrapper = new UpdateWrapper<>();
|
||||
wrapper.lambda().eq(FlowTaskNodeEntity::getId, entity.getId());
|
||||
wrapper.lambda().set(FlowTaskNodeEntity::getNodePropertyJson, entity.getNodePropertyJson());
|
||||
this.update(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorRecordEntity;
|
||||
import com.yunzhupaas.engine.enums.FlowNodeEnum;
|
||||
import com.yunzhupaas.engine.enums.FlowRecordEnum;
|
||||
import com.yunzhupaas.engine.mapper.FlowTaskOperatorRecordMapper;
|
||||
import com.yunzhupaas.engine.service.FlowTaskOperatorRecordService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 流程经办
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Service
|
||||
public class FlowTaskOperatorRecordServiceImpl extends SuperServiceImpl<FlowTaskOperatorRecordMapper, FlowTaskOperatorRecordEntity> implements FlowTaskOperatorRecordService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<FlowTaskOperatorRecordEntity> getList(String taskId) {
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskId, taskId).orderByAsc(FlowTaskOperatorRecordEntity::getHandleTime);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskOperatorRecordEntity> getRecordList(String taskId, List<Integer> handleStatus) {
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskId, taskId);
|
||||
if (handleStatus.size() > 0) {
|
||||
queryWrapper.lambda().in(FlowTaskOperatorRecordEntity::getHandleStatus, handleStatus);
|
||||
}
|
||||
queryWrapper.lambda().orderByDesc(FlowTaskOperatorRecordEntity::getHandleTime);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskOperatorRecordEntity getInfo(String id) {
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowTaskOperatorRecordEntity entity) {
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getId, entity.getId());
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowTaskOperatorRecordEntity entity) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowTaskOperatorRecordEntity entity) {
|
||||
entity.setId(id);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Set<String> taskNodeId, String taskId) {
|
||||
if (taskNodeId.size() > 0) {
|
||||
UpdateWrapper<FlowTaskOperatorRecordEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().in(FlowTaskOperatorRecordEntity::getTaskNodeId, taskNodeId);
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskId, taskId);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorRecordEntity::getStatus, FlowRecordEnum.revoke.getCode());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskOperatorRecordEntity getInfo(String taskId, String taskNodeId, String taskOperatorId) {
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskId, taskId);
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskNodeId, taskNodeId);
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskOperatorId, taskOperatorId);
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getStatus, FlowNodeEnum.FreeApprover.getCode());
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getHandleStatus, FlowRecordEnum.audit.getCode());
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(List<String> idAll) {
|
||||
if (idAll.size() > 0) {
|
||||
UpdateWrapper<FlowTaskOperatorRecordEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().in(FlowTaskOperatorRecordEntity::getId, idAll);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorRecordEntity::getStatus, FlowRecordEnum.revoke.getCode());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String taskId) {
|
||||
UpdateWrapper<FlowTaskOperatorRecordEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskId, taskId);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorRecordEntity::getStatus, FlowRecordEnum.revoke.getCode());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskOperatorRecordEntity getIsCheck(String taskOperatorId, Integer status) {
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getTaskOperatorId, taskOperatorId);
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorRecordEntity::getStatus, status);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.FlowDelegateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.engine.enums.FlowNodeEnum;
|
||||
import com.yunzhupaas.engine.mapper.FlowTaskOperatorMapper;
|
||||
import com.yunzhupaas.engine.service.FlowDelegateService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskOperatorService;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程经办记录
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Service
|
||||
public class FlowTaskOperatorServiceImpl extends SuperServiceImpl<FlowTaskOperatorMapper, FlowTaskOperatorEntity> implements FlowTaskOperatorService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FlowDelegateService flowDelegateService;
|
||||
|
||||
@Override
|
||||
public List<FlowTaskOperatorEntity> getList(String taskId) {
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getTaskId, taskId).orderByDesc(FlowTaskOperatorEntity::getCreatorTime);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskOperatorEntity getInfo(String id) throws WorkFlowException {
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getId, id);
|
||||
FlowTaskOperatorEntity entity = this.getOne(queryWrapper);
|
||||
if (entity == null) {
|
||||
throw new WorkFlowException(MsgCode.FA001.get());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskOperatorEntity getOperatorInfo(String id) {
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getId, id);
|
||||
FlowTaskOperatorEntity entity = this.getOne(queryWrapper);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void create(List<FlowTaskOperatorEntity> entitys) {
|
||||
for (FlowTaskOperatorEntity entity : entitys) {
|
||||
this.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(FlowTaskOperatorEntity entity) {
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String taskNodeId, List<String> userId, String completion) {
|
||||
if (userId.size() > 0) {
|
||||
UpdateWrapper<FlowTaskOperatorEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorEntity::getTaskNodeId, taskNodeId);
|
||||
updateWrapper.lambda().in(FlowTaskOperatorEntity::getHandleId, userId);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorEntity::getCompletion, FlowNature.AuditCompletion);
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String taskNodeId, Integer type) {
|
||||
UpdateWrapper<FlowTaskOperatorEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorEntity::getTaskNodeId, taskNodeId);
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorEntity::getType, type);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorEntity::getCompletion, FlowNature.AuditCompletion);
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String taskId) {
|
||||
UpdateWrapper<FlowTaskOperatorEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorEntity::getTaskId, taskId);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorEntity::getState, FlowNodeEnum.Futility.getCode());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskOperatorEntity> press(String taskId) {
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getCompletion, FlowNature.ProcessCompletion)
|
||||
.eq(FlowTaskOperatorEntity::getTaskId, taskId)
|
||||
.eq(FlowTaskOperatorEntity::getState, FlowNodeEnum.Process.getCode() + "");
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReject(String taskId, Set<String> taskNodeId) {
|
||||
if (taskNodeId.size() > 0) {
|
||||
UpdateWrapper<FlowTaskOperatorEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(FlowTaskOperatorEntity::getTaskId, taskId);
|
||||
updateWrapper.lambda().in(FlowTaskOperatorEntity::getTaskNodeId, taskNodeId);
|
||||
updateWrapper.lambda().set(FlowTaskOperatorEntity::getState, FlowNodeEnum.Futility.getCode());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteList(List<String> idAll) {
|
||||
if (idAll.size() > 0) {
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskOperatorEntity::getId, idAll);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskOperatorEntity> getParentId(String parentId) {
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getAppendHandleId, parentId);
|
||||
queryWrapper.lambda().orderByDesc(FlowTaskOperatorEntity::getCreatorTime);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskOperatorState(List<String> idAll) {
|
||||
if (idAll.size() > 0) {
|
||||
UpdateWrapper<FlowTaskOperatorEntity> queryWrapper = new UpdateWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskOperatorEntity::getId, idAll);
|
||||
queryWrapper.lambda().set(FlowTaskOperatorEntity::getState, FlowNodeEnum.Futility.getCode());
|
||||
queryWrapper.lambda().set(FlowTaskOperatorEntity::getCompletion, FlowNature.RejectCompletion);
|
||||
this.update(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskOperatorEntity> getBatchList() {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
List<String> userList = flowDelegateService.getUser(userInfo.getUserId()).stream().map(FlowDelegateEntity::getCreatorUserId).collect(Collectors.toList());
|
||||
userList.add(userInfo.getUserId());
|
||||
QueryWrapper<FlowTaskOperatorEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskOperatorEntity::getHandleId, userList);
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getCompletion, FlowNature.ProcessCompletion);
|
||||
queryWrapper.lambda().eq(FlowTaskOperatorEntity::getState, FlowNature.ProcessCompletion);
|
||||
queryWrapper.lambda().select(FlowTaskOperatorEntity::getTaskId);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,911 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.*;
|
||||
import com.yunzhupaas.engine.enums.FlowNodeEnum;
|
||||
import com.yunzhupaas.engine.enums.FlowTaskStatusEnum;
|
||||
import com.yunzhupaas.engine.mapper.FlowTaskMapper;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowBatchModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowTaskListModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.PaginationFlowTask;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowTemplateJsonPage;
|
||||
import com.yunzhupaas.engine.service.*;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.FlowWorkListVO;
|
||||
import com.yunzhupaas.model.FlowWorkModel;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.model.user.WorkHandoverModel;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.ServiceAllUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程任务
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FlowTaskServiceImpl extends SuperServiceImpl<FlowTaskMapper, FlowTaskEntity> implements FlowTaskService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowTemplateService flowTemplateService;
|
||||
@Autowired
|
||||
private FlowTemplateJsonService flowTemplateJsonService;
|
||||
@Autowired
|
||||
private FlowDelegateService flowDelegateService;
|
||||
@Autowired
|
||||
private FlowTaskNodeService flowTaskNodeService;
|
||||
@Autowired
|
||||
private FlowTaskOperatorService flowTaskOperatorService;
|
||||
@Autowired
|
||||
private FlowOperatorUserService flowOperatorUserService;
|
||||
@Autowired
|
||||
private FlowRejectDataService flowRejectDataService;
|
||||
@Autowired
|
||||
private FlowTaskOperatorRecordService flowTaskOperatorRecordService;
|
||||
@Autowired
|
||||
private FlowTaskCirculateService flowTaskCirculateService;
|
||||
@Autowired
|
||||
private FlowCandidatesService flowCandidatesService;
|
||||
@Autowired
|
||||
private FlowCommentService flowCommentService;
|
||||
@Autowired
|
||||
private FlowAuthorizeService flowAuthorizeService;
|
||||
@Autowired
|
||||
private FlowUserService flowUserService;
|
||||
@Autowired
|
||||
private FlowEngineVisibleService flowEngineVisibleService;
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getMonitorList(PaginationFlowTask pagination) {
|
||||
// 定义变量判断是否需要使用修改时间倒序
|
||||
boolean flag = false;
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().select(FlowTaskEntity::getId);
|
||||
queryWrapper.lambda().gt(FlowTaskEntity::getStatus, FlowTaskStatusEnum.Draft.getCode());
|
||||
queryWrapper.lambda().and(t -> t.isNull(FlowTaskEntity::getSuspend).or().ne(FlowTaskEntity::getSuspend, FlowTaskStatusEnum.Draft.getCode()));
|
||||
if (!userInfo.getIsAdministrator()) {
|
||||
List<String> userList = serviceUtil.getOrganizeUserList("select");
|
||||
if (userList.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getCreatorUserId, userList);
|
||||
}
|
||||
//关键字(流程名称、流程编码)
|
||||
String keyWord = pagination.getKeyword();
|
||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().and(t -> t.like(FlowTaskEntity::getEnCode, keyWord).or().like(FlowTaskEntity::getFullName, keyWord));
|
||||
}
|
||||
//日期范围(近7天、近1月、近3月、自定义)
|
||||
if (ObjectUtil.isNotEmpty(pagination.getStartTime()) && ObjectUtil.isNotEmpty(pagination.getEndTime())) {
|
||||
queryWrapper.lambda().between(FlowTaskEntity::getStartTime, new Date(pagination.getStartTime()), new Date(pagination.getEndTime()));
|
||||
}
|
||||
//流程状态
|
||||
Integer status = pagination.getStatus();
|
||||
if (ObjectUtil.isNotEmpty(status)) {
|
||||
flag = true;
|
||||
List<Integer> statusList = new ArrayList() {{
|
||||
add(status);
|
||||
}};
|
||||
if (Objects.equals(status, FlowTaskStatusEnum.Revoke.getCode())) {
|
||||
statusList.add(FlowTaskStatusEnum.Resubmit.getCode());
|
||||
}
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getStatus, statusList);
|
||||
}
|
||||
//所属流程
|
||||
String templateId = pagination.getTemplateId();
|
||||
if (ObjectUtil.isNotEmpty(templateId)) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getTemplateId, templateId);
|
||||
}
|
||||
//所属名称
|
||||
String flowId = pagination.getFlowId();
|
||||
if (ObjectUtil.isNotEmpty(flowId)) {
|
||||
flag = true;
|
||||
FlowTemplateJsonPage page = new FlowTemplateJsonPage();
|
||||
page.setTemplateId(templateId);
|
||||
page.setFlowId(flowId);
|
||||
List<String> flowList = flowTemplateJsonService.getListPage(page, false).stream().map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
if (flowList.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getFlowId, flowList);
|
||||
}
|
||||
//所属分类
|
||||
String flowCategory = pagination.getFlowCategory();
|
||||
if (ObjectUtil.isNotEmpty(flowCategory)) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getFlowCategory, flowCategory);
|
||||
}
|
||||
//发起人员
|
||||
String creatorUserId = pagination.getCreatorUserId();
|
||||
if (ObjectUtil.isNotEmpty(creatorUserId)) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getCreatorUserId, creatorUserId);
|
||||
}
|
||||
//紧急程度
|
||||
Integer flowUrgent = pagination.getFlowUrgent();
|
||||
if (ObjectUtil.isNotEmpty(flowUrgent)) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getFlowUrgent, flowUrgent);
|
||||
}
|
||||
//排序
|
||||
// if ("desc".equals(pagination.getSort().toLowerCase())) {
|
||||
// queryWrapper.lambda().orderByDesc(FlowTaskEntity::getCreatorTime);
|
||||
// } else {
|
||||
queryWrapper.lambda().orderByAsc(FlowTaskEntity::getSortCode).orderByDesc(FlowTaskEntity::getCreatorTime);
|
||||
// }
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(FlowTaskEntity::getLastModifyTime);
|
||||
}
|
||||
Page<FlowTaskEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowTaskEntity> flowTaskEntityPage = this.page(page, queryWrapper);
|
||||
if (!flowTaskEntityPage.getRecords().isEmpty()) {
|
||||
List<String> ids = flowTaskEntityPage.getRecords().stream().map(FlowTaskEntity::getId).collect(Collectors.toList());
|
||||
queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getId, ids);
|
||||
//排序
|
||||
queryWrapper.lambda().orderByAsc(FlowTaskEntity::getSortCode).orderByDesc(FlowTaskEntity::getCreatorTime);
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(FlowTaskEntity::getLastModifyTime);
|
||||
}
|
||||
flowTaskEntityPage.setRecords(this.list(queryWrapper));
|
||||
}
|
||||
return pagination.setData(flowTaskEntityPage.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getLaunchList(PaginationFlowTask pagination) {
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
String userId = UserProvider.getUser().getUserId();
|
||||
if (pagination.getDelegateType()) {
|
||||
queryWrapper.lambda().select(FlowTaskEntity::getId).eq(FlowTaskEntity::getDelegateUser, userId);
|
||||
} else {
|
||||
queryWrapper.lambda().select(FlowTaskEntity::getId).eq(FlowTaskEntity::getCreatorUserId, userId);
|
||||
}
|
||||
//关键字(流程名称、流程编码)
|
||||
String keyWord = pagination.getKeyword();
|
||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||
queryWrapper.lambda().and(t -> t.like(FlowTaskEntity::getEnCode, keyWord).or().like(FlowTaskEntity::getFullName, keyWord));
|
||||
}
|
||||
//日期范围(近7天、近1月、近3月、自定义)
|
||||
if (ObjectUtil.isNotEmpty(pagination.getStartTime()) && ObjectUtil.isNotEmpty(pagination.getEndTime())) {
|
||||
queryWrapper.lambda().between(FlowTaskEntity::getStartTime, new Date(pagination.getStartTime()), new Date(pagination.getEndTime()));
|
||||
}
|
||||
//所属流程
|
||||
String templateId = pagination.getTemplateId();
|
||||
if (ObjectUtil.isNotEmpty(templateId)) {
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getTemplateId, templateId);
|
||||
}
|
||||
//所属名称
|
||||
String flowId = pagination.getFlowId();
|
||||
if (ObjectUtil.isNotEmpty(flowId)) {
|
||||
FlowTemplateJsonPage page = new FlowTemplateJsonPage();
|
||||
page.setTemplateId(templateId);
|
||||
page.setFlowId(flowId);
|
||||
List<String> flowList = flowTemplateJsonService.getListPage(page, false).stream().map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
if (flowList.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getFlowId, flowList);
|
||||
}
|
||||
//流程状态
|
||||
Integer status = pagination.getStatus();
|
||||
if (ObjectUtil.isNotEmpty(status)) {
|
||||
List<Integer> statusList = new ArrayList() {{
|
||||
add(status);
|
||||
}};
|
||||
if (Objects.equals(status, FlowTaskStatusEnum.Revoke.getCode())) {
|
||||
statusList.add(FlowTaskStatusEnum.Resubmit.getCode());
|
||||
}
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getStatus, statusList);
|
||||
}
|
||||
//紧急程度
|
||||
Integer flowUrgent = pagination.getFlowUrgent();
|
||||
if (ObjectUtil.isNotEmpty(flowUrgent)) {
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getFlowUrgent, flowUrgent);
|
||||
}
|
||||
//所属分类
|
||||
String flowCategory = pagination.getFlowCategory();
|
||||
if (ObjectUtil.isNotEmpty(flowCategory)) {
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getFlowCategory, flowCategory);
|
||||
}
|
||||
//排序
|
||||
queryWrapper.lambda().orderByAsc(FlowTaskEntity::getStatus).orderByDesc(FlowTaskEntity::getStartTime);
|
||||
Page<FlowTaskEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowTaskEntity> flowTaskEntityPage = this.page(page, queryWrapper);
|
||||
if (!flowTaskEntityPage.getRecords().isEmpty()) {
|
||||
List<String> ids = flowTaskEntityPage.getRecords().stream().map(FlowTaskEntity::getId).collect(Collectors.toList());
|
||||
queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getId, ids);
|
||||
//排序
|
||||
queryWrapper.lambda().orderByAsc(FlowTaskEntity::getStatus).orderByDesc(FlowTaskEntity::getStartTime);
|
||||
flowTaskEntityPage.setRecords(this.list(queryWrapper));
|
||||
}
|
||||
return pagination.setData(flowTaskEntityPage.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskListModel> getWaitList(PaginationFlowTask pagination) {
|
||||
String userId = StringUtil.isNotEmpty(pagination.getUserId()) ? pagination.getUserId() : UserProvider.getUser().getUserId();
|
||||
MPJLambdaWrapper<FlowTaskEntity> wrapper = JoinWrappers.lambda(FlowTaskEntity.class)
|
||||
.selectAll(FlowTaskEntity.class)
|
||||
.leftJoin(FlowTaskOperatorEntity.class, FlowTaskOperatorEntity::getTaskId, FlowTaskEntity::getId)
|
||||
.selectAs(FlowTaskOperatorEntity::getId, FlowTaskListModel::getId)
|
||||
.selectAs(FlowTaskOperatorEntity::getNodeName, FlowTaskListModel::getThisStep)
|
||||
.selectAs(FlowTaskOperatorEntity::getNodeName, FlowTaskListModel::getNodeName)
|
||||
.selectAs(FlowTaskOperatorEntity::getTaskNodeId, FlowTaskListModel::getThisStepId)
|
||||
.selectAs(FlowTaskOperatorEntity::getHandleId, FlowTaskListModel::getHandleId)
|
||||
.selectAs(FlowTaskOperatorEntity::getCreatorTime, FlowTaskListModel::getCreatorTime)
|
||||
.eq(FlowTaskOperatorEntity::getCompletion, FlowNature.ProcessCompletion)
|
||||
.le(FlowTaskOperatorEntity::getCreatorTime, new Date())
|
||||
.eq(FlowTaskOperatorEntity::getState, FlowNodeEnum.Process.getCode())
|
||||
.eq(FlowTaskEntity::getStatus, FlowTaskStatusEnum.Handle.getCode());
|
||||
boolean isDelegateType = pagination.getDelegateType();
|
||||
List<String> handleId = new ArrayList<>();
|
||||
handleId.add(userId);
|
||||
Map<String, String[]> delegateListAll = new HashMap<>();
|
||||
//是否委托
|
||||
if (isDelegateType) {
|
||||
List<FlowDelegateEntity> delegateList = flowDelegateService.getUser(userId);
|
||||
for (FlowDelegateEntity entity : delegateList) {
|
||||
if (StringUtil.isNotEmpty(entity.getFlowId())) {
|
||||
String[] flowIdAll = entity.getFlowId().split(",");
|
||||
delegateListAll.put(entity.getUserId(), flowIdAll);
|
||||
} else {
|
||||
handleId.add(entity.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//代办人
|
||||
wrapper.and(t -> {
|
||||
t.in(FlowTaskOperatorEntity::getHandleId, handleId);
|
||||
if (isDelegateType) {
|
||||
for (String key : delegateListAll.keySet()) {
|
||||
t.or(tw -> tw.in(FlowTaskEntity::getTemplateId, delegateListAll.get(key)).eq(FlowTaskOperatorEntity::getHandleId, key));
|
||||
}
|
||||
}
|
||||
});
|
||||
//关键字(流程名称、流程编码)
|
||||
String keyWord = pagination.getKeyword();
|
||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||
wrapper.and(t -> t.like(FlowTaskEntity::getEnCode, keyWord).or().like(FlowTaskEntity::getFullName, keyWord));
|
||||
}
|
||||
//日期范围(近7天、近1月、近3月、自定义)
|
||||
if (ObjectUtil.isNotEmpty(pagination.getStartTime()) && ObjectUtil.isNotEmpty(pagination.getEndTime())) {
|
||||
wrapper.between(FlowTaskEntity::getStartTime, new Date(pagination.getStartTime()), new Date(pagination.getEndTime()));
|
||||
}
|
||||
//所属流程
|
||||
String templateId = pagination.getTemplateId();
|
||||
if (ObjectUtil.isNotEmpty(templateId)) {
|
||||
wrapper.eq(FlowTaskEntity::getTemplateId, templateId);
|
||||
}
|
||||
//是否批量
|
||||
Integer isBatch = pagination.getIsBatch();
|
||||
if (ObjectUtil.isNotEmpty(isBatch)) {
|
||||
wrapper.eq(FlowTaskEntity::getIsBatch, isBatch);
|
||||
}
|
||||
//所属名称
|
||||
String flowId = pagination.getFlowId();
|
||||
if (ObjectUtil.isNotEmpty(flowId)) {
|
||||
List<String> flowList = new ArrayList<>();
|
||||
if (ObjectUtil.isEmpty(isBatch)) {
|
||||
FlowTemplateJsonPage page = new FlowTemplateJsonPage();
|
||||
page.setTemplateId(templateId);
|
||||
page.setFlowId(flowId);
|
||||
flowList.addAll(flowTemplateJsonService.getListPage(page, false).stream().map(FlowTemplateJsonEntity::getId).collect(Collectors.toList()));
|
||||
if (flowList.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
flowList.add(flowId);
|
||||
}
|
||||
wrapper.in(FlowTaskEntity::getFlowId, flowList);
|
||||
}
|
||||
//所属分类
|
||||
String category = pagination.getFlowCategory();
|
||||
if (ObjectUtil.isNotEmpty(category)) {
|
||||
wrapper.in(FlowTaskEntity::getFlowCategory, category.split(","));
|
||||
}
|
||||
//发起人员
|
||||
String creatorUserId = pagination.getCreatorUserId();
|
||||
if (ObjectUtil.isNotEmpty(creatorUserId)) {
|
||||
wrapper.eq(FlowTaskEntity::getCreatorUserId, creatorUserId);
|
||||
}
|
||||
//节点编码
|
||||
String nodeCode = pagination.getNodeCode();
|
||||
if (ObjectUtil.isNotEmpty(nodeCode)) {
|
||||
wrapper.eq(FlowTaskOperatorEntity::getNodeCode, nodeCode);
|
||||
}
|
||||
//紧急程度
|
||||
Integer flowUrgent = pagination.getFlowUrgent();
|
||||
if (ObjectUtil.isNotEmpty(flowUrgent)) {
|
||||
wrapper.eq(FlowTaskEntity::getFlowUrgent, flowUrgent);
|
||||
}
|
||||
wrapper.orderByDesc(FlowTaskOperatorEntity::getCreatorTime);
|
||||
Page<FlowTaskListModel> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
Page<FlowTaskListModel> data = this.selectJoinListPage(page, FlowTaskListModel.class, wrapper);
|
||||
for (FlowTaskListModel entity : data.getRecords()) {
|
||||
boolean isuser = entity.getHandleId().equals(userId);
|
||||
entity.setDelegateUser(!isuser ? entity.getCreatorUserId() : null);
|
||||
}
|
||||
return pagination.setData(data.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskListModel> getCirculateList(PaginationFlowTask pagination) {
|
||||
String userId = StringUtil.isNotEmpty(pagination.getUserId()) ? pagination.getUserId() : UserProvider.getUser().getUserId();
|
||||
MPJLambdaWrapper<FlowTaskEntity> wrapper = JoinWrappers.lambda(FlowTaskEntity.class)
|
||||
.selectAll(FlowTaskEntity.class)
|
||||
.leftJoin(FlowTaskCirculateEntity.class, FlowTaskCirculateEntity::getTaskId, FlowTaskEntity::getId)
|
||||
.selectAs(FlowTaskCirculateEntity::getNodeName, FlowTaskListModel::getThisStep)
|
||||
.selectAs(FlowTaskCirculateEntity::getTaskNodeId, FlowTaskListModel::getThisStepId)
|
||||
.selectAs(FlowTaskCirculateEntity::getId, FlowTaskListModel::getCirculateId)
|
||||
.selectAs(FlowTaskCirculateEntity::getCreatorTime, FlowTaskListModel::getCreatorTime)
|
||||
.eq(FlowTaskCirculateEntity::getObjectId, userId);
|
||||
//关键字(流程名称、流程编码)
|
||||
String keyWord = pagination.getKeyword();
|
||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||
wrapper.and(t -> t.like(FlowTaskEntity::getEnCode, keyWord).or().like(FlowTaskEntity::getFullName, keyWord));
|
||||
}
|
||||
//日期范围(近7天、近1月、近3月、自定义)
|
||||
if (ObjectUtil.isNotEmpty(pagination.getStartTime()) && ObjectUtil.isNotEmpty(pagination.getEndTime())) {
|
||||
wrapper.between(FlowTaskEntity::getStartTime, new Date(pagination.getStartTime()), new Date(pagination.getEndTime()));
|
||||
}
|
||||
//所属流程
|
||||
String templateId = pagination.getTemplateId();
|
||||
if (ObjectUtil.isNotEmpty(templateId)) {
|
||||
wrapper.eq(FlowTaskEntity::getTemplateId, templateId);
|
||||
}
|
||||
//所属名称
|
||||
String flowId = pagination.getFlowId();
|
||||
if (ObjectUtil.isNotEmpty(flowId)) {
|
||||
FlowTemplateJsonPage page = new FlowTemplateJsonPage();
|
||||
page.setTemplateId(templateId);
|
||||
page.setFlowId(flowId);
|
||||
List<String> flowList = flowTemplateJsonService.getListPage(page, false).stream().map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
if (flowList.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
wrapper.in(FlowTaskEntity::getFlowId, flowList);
|
||||
}
|
||||
//所属分类
|
||||
String category = pagination.getFlowCategory();
|
||||
if (ObjectUtil.isNotEmpty(category)) {
|
||||
wrapper.in(FlowTaskEntity::getFlowCategory, category.split(","));
|
||||
}
|
||||
//发起人员
|
||||
String creatorUserId = pagination.getCreatorUserId();
|
||||
if (ObjectUtil.isNotEmpty(creatorUserId)) {
|
||||
wrapper.in(FlowTaskEntity::getCreatorUserId, creatorUserId);
|
||||
}
|
||||
//紧急程度
|
||||
Integer flowUrgent = pagination.getFlowUrgent();
|
||||
if (ObjectUtil.isNotEmpty(flowUrgent)) {
|
||||
wrapper.in(FlowTaskEntity::getFlowUrgent, flowUrgent);
|
||||
}
|
||||
wrapper.orderByDesc(FlowTaskCirculateEntity::getCreatorTime);
|
||||
Page<FlowTaskListModel> page = new Page(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
Page<FlowTaskListModel> data = this.selectJoinListPage(page, FlowTaskListModel.class, wrapper);
|
||||
return pagination.setData(data.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskListModel> getTrialList(PaginationFlowTask pagination) {
|
||||
String userId = StringUtil.isNotEmpty(pagination.getUserId()) ? pagination.getUserId() : UserProvider.getUser().getUserId();
|
||||
Integer handleStatus[] = new Integer[]{0, 1, 10, 13};
|
||||
MPJLambdaWrapper<FlowTaskOperatorRecordEntity> recordWrapper = JoinWrappers.lambda(FlowTaskOperatorRecordEntity.class)
|
||||
.select(FlowTaskOperatorRecordEntity::getHandleId)
|
||||
.select(FlowTaskOperatorRecordEntity::getTaskNodeId)
|
||||
.select(FlowTaskOperatorRecordEntity::getTaskId)
|
||||
.selectMax(FlowTaskOperatorRecordEntity::getHandleTime)
|
||||
.in(FlowTaskOperatorRecordEntity::getHandleStatus, handleStatus)
|
||||
.eq(FlowTaskOperatorRecordEntity::getHandleId, userId)
|
||||
.isNotNull(FlowTaskOperatorRecordEntity::getTaskOperatorId)
|
||||
.groupBy(FlowTaskOperatorRecordEntity::getTaskId, FlowTaskOperatorRecordEntity::getTaskNodeId, FlowTaskOperatorRecordEntity::getHandleId);
|
||||
List<FlowTaskOperatorRecordEntity> recordList = flowTaskOperatorRecordService.selectJoinList(FlowTaskOperatorRecordEntity.class, recordWrapper);
|
||||
if (recordList.size() > 0) {
|
||||
List<String> taskId = recordList.stream().map(FlowTaskOperatorRecordEntity::getTaskId).collect(Collectors.toList());
|
||||
List<String> taskNodeId = recordList.stream().map(FlowTaskOperatorRecordEntity::getTaskNodeId).collect(Collectors.toList());
|
||||
List<Date> handleTime = recordList.stream().map(FlowTaskOperatorRecordEntity::getHandleTime).collect(Collectors.toList());
|
||||
MPJLambdaWrapper<FlowTaskEntity> wrapper = JoinWrappers.lambda(FlowTaskEntity.class)
|
||||
.leftJoin(FlowTaskOperatorRecordEntity.class, FlowTaskOperatorRecordEntity::getTaskId, FlowTaskEntity::getId)
|
||||
.leftJoin(FlowTaskOperatorEntity.class, FlowTaskOperatorEntity::getId, FlowTaskOperatorRecordEntity::getTaskOperatorId)
|
||||
.selectAll(FlowTaskEntity.class)
|
||||
.selectAs(FlowTaskOperatorRecordEntity::getId, FlowTaskListModel::getId)
|
||||
.selectAs(FlowTaskOperatorRecordEntity::getNodeName, FlowTaskListModel::getThisStep)
|
||||
.selectAs(FlowTaskOperatorRecordEntity::getTaskNodeId, FlowTaskListModel::getThisStepId)
|
||||
.selectAs(FlowTaskOperatorRecordEntity::getHandleStatus, FlowTaskListModel::getStatus)
|
||||
.selectAs(FlowTaskOperatorRecordEntity::getHandleId, FlowTaskListModel::getHandleId)
|
||||
.selectAs(FlowTaskOperatorRecordEntity::getHandleTime, FlowTaskListModel::getCreatorTime)
|
||||
.selectAs(FlowTaskOperatorEntity::getHandleId, FlowTaskListModel::getDelegateUser)
|
||||
.in(FlowTaskOperatorRecordEntity::getTaskId, taskId)
|
||||
.in(FlowTaskOperatorRecordEntity::getTaskNodeId, taskNodeId)
|
||||
.in(FlowTaskOperatorRecordEntity::getHandleStatus, handleStatus)
|
||||
.and(t -> {
|
||||
for (Date date : handleTime) {
|
||||
t.or().eq(FlowTaskOperatorRecordEntity::getHandleTime, date);
|
||||
}
|
||||
});
|
||||
//关键字(流程名称、流程编码)
|
||||
String keyWord = pagination.getKeyword();
|
||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||
wrapper.and(t -> t.like(FlowTaskEntity::getEnCode, keyWord).or().like(FlowTaskEntity::getFullName, keyWord));
|
||||
}
|
||||
//日期范围(近7天、近1月、近3月、自定义)
|
||||
if (ObjectUtil.isNotEmpty(pagination.getStartTime()) && ObjectUtil.isNotEmpty(pagination.getEndTime())) {
|
||||
wrapper.between(FlowTaskEntity::getStartTime, new Date(pagination.getStartTime()), new Date(pagination.getEndTime()));
|
||||
}
|
||||
//所属流程
|
||||
String templateId = pagination.getTemplateId();
|
||||
if (ObjectUtil.isNotEmpty(templateId)) {
|
||||
wrapper.eq(FlowTaskEntity::getTemplateId, templateId);
|
||||
}
|
||||
//所属名称
|
||||
String flowId = pagination.getFlowId();
|
||||
if (ObjectUtil.isNotEmpty(flowId)) {
|
||||
FlowTemplateJsonPage page = new FlowTemplateJsonPage();
|
||||
page.setTemplateId(templateId);
|
||||
page.setFlowId(flowId);
|
||||
List<String> flowList = flowTemplateJsonService.getListPage(page, false).stream().map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
if (flowList.size() == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
wrapper.in(FlowTaskEntity::getFlowId, flowList);
|
||||
}
|
||||
//所属分类
|
||||
String category = pagination.getFlowCategory();
|
||||
if (ObjectUtil.isNotEmpty(category)) {
|
||||
wrapper.in(FlowTaskEntity::getFlowCategory, category.split(","));
|
||||
}
|
||||
//发起人员
|
||||
String creatorUserId = pagination.getCreatorUserId();
|
||||
if (ObjectUtil.isNotEmpty(creatorUserId)) {
|
||||
wrapper.in(FlowTaskEntity::getCreatorUserId, creatorUserId);
|
||||
}
|
||||
//紧急程度
|
||||
Integer flowUrgent = pagination.getFlowUrgent();
|
||||
if (ObjectUtil.isNotEmpty(flowUrgent)) {
|
||||
wrapper.in(FlowTaskEntity::getFlowUrgent, flowUrgent);
|
||||
}
|
||||
wrapper.orderByDesc(FlowTaskOperatorRecordEntity::getHandleTime);
|
||||
Page<FlowTaskListModel> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
Page<FlowTaskListModel> data = this.selectJoinListPage(page, FlowTaskListModel.class, wrapper);
|
||||
for (FlowTaskListModel entity : data.getRecords()) {
|
||||
boolean isuser = entity.getHandleId().equals(entity.getDelegateUser());
|
||||
entity.setDelegateUser(!isuser ? entity.getCreatorUserId() : null);
|
||||
}
|
||||
return pagination.setData(data.getRecords(), page.getTotal());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskEntity getInfo(String id, SFunction<FlowTaskEntity, ?>... columns) throws WorkFlowException {
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getId, id);
|
||||
queryWrapper.lambda().select(columns);
|
||||
FlowTaskEntity entity = this.getOne(queryWrapper);
|
||||
if (entity == null) {
|
||||
throw new WorkFlowException(MsgCode.FA001.get());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(FlowTaskEntity entity) {
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowTaskEntity entity) {
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createOrUpdate(FlowTaskEntity entity) {
|
||||
this.saveOrUpdate(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTaskEntity getInfoSubmit(String id, SFunction<FlowTaskEntity, ?>... columns) {
|
||||
List<FlowTaskEntity> list = getInfosSubmit(new String[]{id}, columns);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getInfosSubmit(String[] ids, SFunction<FlowTaskEntity, ?>... columns) {
|
||||
List<FlowTaskEntity> resultList = Collections.emptyList();
|
||||
if (ids == null || ids.length == 0) {
|
||||
return resultList;
|
||||
}
|
||||
LambdaQueryWrapper<FlowTaskEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ids.length == 1) {
|
||||
queryWrapper.select(columns).and(
|
||||
t -> t.eq(FlowTaskEntity::getId, ids[0])
|
||||
);
|
||||
resultList = this.list(queryWrapper);
|
||||
if (resultList.isEmpty()) {
|
||||
queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(columns).and(
|
||||
t -> t.eq(FlowTaskEntity::getProcessId, ids[0])
|
||||
);
|
||||
resultList = this.list(queryWrapper);
|
||||
}
|
||||
} else {
|
||||
queryWrapper.select(FlowTaskEntity::getId).and(t -> {
|
||||
t.in(FlowTaskEntity::getId, ids).or().in(FlowTaskEntity::getProcessId, ids);
|
||||
});
|
||||
List<String> resultIds = this.listObjs(queryWrapper, t -> t.toString());
|
||||
if (!resultIds.isEmpty()) {
|
||||
queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(columns).in(FlowTaskEntity::getId, resultIds);
|
||||
resultList = this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowTaskEntity entity) throws WorkFlowException {
|
||||
if (FlowTaskStatusEnum.Suspend.getCode().equals(entity.getStatus())) {
|
||||
throw new WorkFlowException(MsgCode.WF048.get());
|
||||
}
|
||||
List<Integer> status = ImmutableList.of(FlowTaskStatusEnum.Draft.getCode(),FlowTaskStatusEnum.Revoke.getCode(),
|
||||
FlowTaskStatusEnum.Cancel.getCode(),FlowTaskStatusEnum.Resubmit.getCode());
|
||||
if(!status.contains(entity.getStatus())){
|
||||
throw new WorkFlowException(MsgCode.WF063.get());
|
||||
}
|
||||
if (!FlowNature.ParentId.equals(entity.getParentId()) && StringUtil.isNotEmpty(entity.getParentId())) {
|
||||
throw new WorkFlowException(entity.getFullName() + MsgCode.WF021.get());
|
||||
}
|
||||
if (!checkStatus(entity.getStatus())) {
|
||||
throw new WorkFlowException(MsgCode.WF049.get());
|
||||
} else {
|
||||
List<String> idList = ImmutableList.of(entity.getId());
|
||||
this.deleteAll(idList, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteChildAll(List<String> idAll) {
|
||||
this.deleteAll(idAll, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) throws WorkFlowException {
|
||||
if (ids.length > 0) {
|
||||
List<String> idList = Arrays.asList(ids);
|
||||
List<FlowTaskEntity> flowTaskList = getOrderStaList(idList);
|
||||
List<FlowTaskEntity> del = flowTaskList.stream().filter(t -> t.getFlowType() == 1).collect(Collectors.toList());
|
||||
if (del.size() > 0) {
|
||||
throw new WorkFlowException(del.get(0).getFullName() + MsgCode.WF020.get());
|
||||
}
|
||||
List<FlowTaskEntity> child = flowTaskList.stream().filter(t -> !FlowNature.ParentId.equals(t.getParentId()) && StringUtil.isNotEmpty(t.getParentId())).collect(Collectors.toList());
|
||||
if (child.size() > 0) {
|
||||
throw new WorkFlowException(child.get(0).getFullName() + MsgCode.WF021.get());
|
||||
}
|
||||
List<FlowTaskEntity> taskStatusList = new ArrayList<>();
|
||||
for (String id : ids) {
|
||||
List<String> childAllList = getChildAllList(id);
|
||||
taskStatusList.addAll(getOrderStaList(childAllList));
|
||||
}
|
||||
List<FlowTaskEntity> taskStatus = taskStatusList.stream().filter(t -> FlowTaskStatusEnum.Suspend.getCode().equals(t.getStatus())).collect(Collectors.toList());
|
||||
if (taskStatus.size() > 0) {
|
||||
throw new WorkFlowException(taskStatus.get(0).getFullName() + MsgCode.WF050.get());
|
||||
}
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
if (!userInfo.getIsAdministrator()) {
|
||||
List<String> organizeUserList = serviceUtil.getOrganizeUserList("delete");
|
||||
List<FlowTaskEntity> taskOrganize = taskStatusList.stream().filter(t -> !organizeUserList.contains(t.getCreatorUserId())).collect(Collectors.toList());
|
||||
if (taskOrganize.size() > 0) {
|
||||
throw new WorkFlowException(taskOrganize.get(0).getFullName() + MsgCode.WF051.get());
|
||||
}
|
||||
}
|
||||
this.deleteAll(idList, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getOrderStaList(List<String> id, SFunction<FlowTaskEntity, ?>... columns) {
|
||||
List<FlowTaskEntity> list = new ArrayList<>();
|
||||
if (id.size() > 0) {
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTaskEntity::getId, id);
|
||||
list = this.list(queryWrapper);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getChildList(String id, SFunction<FlowTaskEntity, ?>... columns) {
|
||||
return getChildList(ImmutableList.of(id), columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getChildList(List<String> id, SFunction<FlowTaskEntity, ?>... columns) {
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().select(columns).in(FlowTaskEntity::getParentId, id);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getTemplateIdList(String tempId) {
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getTemplateId, tempId);
|
||||
queryWrapper.lambda().select(FlowTaskEntity::getId, FlowTaskEntity::getFlowId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTaskEntity> getFlowList(String flowId) {
|
||||
QueryWrapper<FlowTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskEntity::getFlowId, flowId);
|
||||
queryWrapper.lambda().select(FlowTaskEntity::getId);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowBatchModel> batchFlowSelector() {
|
||||
List<FlowTaskOperatorEntity> operatorList = flowTaskOperatorService.getBatchList();
|
||||
List<String> taskIdList = operatorList.stream().map(FlowTaskOperatorEntity::getTaskId).collect(Collectors.toList());
|
||||
List<FlowTaskEntity> taskList = getOrderStaList(taskIdList);
|
||||
Map<String, List<FlowTaskEntity>> flowList = taskList.stream().filter(t -> ObjectUtil.isNotEmpty(t.getIsBatch()) && t.getIsBatch() == 1).collect(Collectors.groupingBy(FlowTaskEntity::getTemplateId));
|
||||
List<FlowBatchModel> batchFlowList = new ArrayList<>();
|
||||
for (String key : flowList.keySet()) {
|
||||
List<FlowTaskEntity> flowTaskList = flowList.get(key);
|
||||
List<String> flowTask = flowTaskList.stream().map(FlowTaskEntity::getId).collect(Collectors.toList());
|
||||
List<FlowTemplateJsonEntity> templateJsonList = flowTemplateJsonService.getTemplateJsonList(flowTaskList.stream().map(FlowTaskEntity::getFlowId).collect(Collectors.toList()));
|
||||
if (flowTaskList.size() > 0) {
|
||||
String flowName = flowTaskList.stream().map(FlowTaskEntity::getFlowName).distinct().collect(Collectors.joining(","));
|
||||
String flowId = templateJsonList.stream().map(FlowTemplateJsonEntity::getTemplateId).distinct().collect(Collectors.joining(","));
|
||||
Long count = operatorList.stream().filter(t -> flowTask.contains(t.getTaskId())).count();
|
||||
FlowBatchModel batchModel = new FlowBatchModel();
|
||||
batchModel.setNum(count);
|
||||
batchModel.setId(flowId);
|
||||
batchModel.setFullName(flowName + "(" + count + ")");
|
||||
batchFlowList.add(batchModel);
|
||||
}
|
||||
}
|
||||
batchFlowList = batchFlowList.stream().sorted(Comparator.comparing(FlowBatchModel::getNum).reversed()).collect(Collectors.toList());
|
||||
return batchFlowList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getChildAllList(String id) {
|
||||
List<String> idAll = new ArrayList<>();
|
||||
List<String> idList = ImmutableList.of(id);
|
||||
this.deleTaskAll(idList, idAll);
|
||||
return idAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleTaskAll(List<String> idList, List<String> idAll) {
|
||||
idAll.addAll(idList);
|
||||
for (String id : idList) {
|
||||
List<FlowTaskEntity> taskAll = this.getChildList(id, FlowTaskEntity::getId);
|
||||
List<String> list = taskAll.stream().map(FlowTaskEntity::getId).collect(Collectors.toList());
|
||||
this.deleTaskAll(list, idAll);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getChildList(String id, boolean suspend, List<String> list) {
|
||||
List<FlowTaskEntity> taskAll = this.getChildList(id, FlowTaskEntity::getId, FlowTaskEntity::getIsAsync);
|
||||
if (suspend) {
|
||||
taskAll = taskAll.stream().filter(t -> FlowNature.ChildSync.equals(t.getIsAsync())).collect(Collectors.toList());
|
||||
}
|
||||
for (FlowTaskEntity entity : taskAll) {
|
||||
list.add(entity.getId());
|
||||
this.getChildList(entity.getId(), suspend, list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowWorkListVO flowWork(String fromId) {
|
||||
FlowWorkListVO vo = new FlowWorkListVO();
|
||||
//代办
|
||||
QueryWrapper<FlowTaskOperatorEntity> operatorWrapper = new QueryWrapper<>();
|
||||
operatorWrapper.lambda().eq(FlowTaskOperatorEntity::getHandleId, fromId);
|
||||
List<FlowTaskOperatorEntity> list = flowTaskOperatorService.list(operatorWrapper);
|
||||
List<String> taskIdList = list.stream().map(FlowTaskOperatorEntity::getTaskId).collect(Collectors.toList());
|
||||
List<FlowTaskEntity> taskList = getOrderStaList(taskIdList);
|
||||
List<FlowTemplateEntity> waitTemplateList = flowTemplateService.getTemplateList(taskList.stream().map(FlowTaskEntity::getTemplateId).collect(Collectors.toList()));
|
||||
List<FlowWorkModel> waitList = new ArrayList<>();
|
||||
for (FlowTaskOperatorEntity entity : list) {
|
||||
FlowWorkModel workModel = JsonUtil.getJsonToBean(entity, FlowWorkModel.class);
|
||||
FlowTaskEntity taskEntity = taskList.stream().filter(t -> t.getId().equals(entity.getTaskId())).findFirst().orElse(null);
|
||||
if (taskEntity != null) {
|
||||
workModel.setFullName(taskEntity.getFullName());
|
||||
FlowTemplateEntity templateEntity = waitTemplateList.stream().filter(t -> t.getId().equals(taskEntity.getTemplateId())).findFirst().orElse(null);
|
||||
if (templateEntity != null) {
|
||||
workModel.setIcon(templateEntity.getIcon());
|
||||
}
|
||||
}
|
||||
waitList.add(workModel);
|
||||
}
|
||||
vo.setWait(waitList);
|
||||
|
||||
//流程
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
List<FlowTemplateJsonEntity> templateJsonList = flowTemplateJsonService.list(queryWrapper).stream().filter(t -> t.getFlowTemplateJson().contains(fromId)).collect(Collectors.toList());
|
||||
List<String> templateIdList = templateJsonList.stream().map(FlowTemplateJsonEntity::getTemplateId).collect(Collectors.toList());
|
||||
List<FlowTemplateEntity> templateList = flowTemplateService.getTemplateList(templateIdList);
|
||||
List<FlowWorkModel> flowList = new ArrayList<>();
|
||||
for (FlowTemplateJsonEntity entity : templateJsonList) {
|
||||
FlowWorkModel workModel = JsonUtil.getJsonToBean(entity, FlowWorkModel.class);
|
||||
FlowTemplateEntity templateEntity = templateList.stream().filter(t -> t.getId().equals(entity.getTemplateId())).findFirst().orElse(null);
|
||||
if (templateEntity != null) {
|
||||
workModel.setFullName(templateEntity.getFullName() + "_" + entity.getFullName() + "(V" + entity.getVersion() + ")");
|
||||
workModel.setIcon(templateEntity.getIcon());
|
||||
}
|
||||
flowList.add(workModel);
|
||||
}
|
||||
vo.setFlow(flowList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean flowWork(WorkHandoverModel workHandoverModel) {
|
||||
String fromId = workHandoverModel.getFromId();
|
||||
String toId = workHandoverModel.getToId();
|
||||
List<String> waitList = workHandoverModel.getWaitList();
|
||||
//待办事宜
|
||||
if (waitList.size() > 0) {
|
||||
UpdateWrapper<FlowTaskOperatorEntity> operator = new UpdateWrapper<>();
|
||||
operator.lambda().in(FlowTaskOperatorEntity::getId, waitList);
|
||||
operator.lambda().eq(FlowTaskOperatorEntity::getHandleId, fromId);
|
||||
operator.lambda().set(FlowTaskOperatorEntity::getHandleId, toId);
|
||||
flowTaskOperatorService.update(operator);
|
||||
UpdateWrapper<FlowOperatorUserEntity> userOperator = new UpdateWrapper<>();
|
||||
userOperator.lambda().in(FlowOperatorUserEntity::getId, waitList);
|
||||
userOperator.lambda().eq(FlowOperatorUserEntity::getHandleId, fromId);
|
||||
userOperator.lambda().set(FlowOperatorUserEntity::getHandleId, toId);
|
||||
flowOperatorUserService.update(userOperator);
|
||||
UpdateWrapper<FlowCandidatesEntity> candidates = new UpdateWrapper<>();
|
||||
candidates.lambda().in(FlowCandidatesEntity::getId, waitList);
|
||||
candidates.lambda().eq(FlowCandidatesEntity::getHandleId, fromId);
|
||||
candidates.lambda().set(FlowCandidatesEntity::getHandleId, toId);
|
||||
flowCandidatesService.update(candidates);
|
||||
}
|
||||
//负责流程
|
||||
List<String> flowList = workHandoverModel.getFlowList();
|
||||
if (flowList.size() > 0) {
|
||||
UserEntity toUser = serviceUtil.getUserInfo(toId);
|
||||
String toUserName = toUser != null ? toUser.getRealName() + "/" + toUser.getAccount() : "";
|
||||
UserEntity fromUser = serviceUtil.getUserInfo(fromId);
|
||||
String fromUserName = fromUser != null ? fromUser.getRealName() + "/" + fromUser.getAccount() : "";
|
||||
//json
|
||||
List<FlowTemplateJsonEntity> templateJsonList = flowTemplateJsonService.getTemplateJsonList(flowList);
|
||||
for (FlowTemplateJsonEntity entity : templateJsonList) {
|
||||
String json = entity.getFlowTemplateJson().replaceAll(fromId, toId).replaceAll(fromUserName, toUserName);
|
||||
entity.setFlowTemplateJson(json);
|
||||
flowTemplateJsonService.update(entity.getId(), entity);
|
||||
}
|
||||
//任务
|
||||
QueryWrapper<FlowTaskEntity> taskQueryWrapper = new QueryWrapper<>();
|
||||
taskQueryWrapper.lambda().in(FlowTaskEntity::getFlowId, flowList);
|
||||
List<FlowTaskEntity> list = this.list(taskQueryWrapper);
|
||||
for (FlowTaskEntity entity : list) {
|
||||
update(entity);
|
||||
QueryWrapper<FlowTaskNodeEntity> nodeQueryWrapper = new QueryWrapper<>();
|
||||
nodeQueryWrapper.lambda().eq(FlowTaskNodeEntity::getTaskId, entity.getId());
|
||||
List<FlowTaskNodeEntity> nodeList = flowTaskNodeService.list(nodeQueryWrapper);
|
||||
for (FlowTaskNodeEntity taskNodeEntity : nodeList) {
|
||||
taskNodeEntity.setNodePropertyJson(taskNodeEntity.getNodePropertyJson().replaceAll(fromId, toId).replaceAll(fromUserName, toUserName));
|
||||
flowTaskNodeService.update(taskNodeEntity);
|
||||
}
|
||||
}
|
||||
//流程可见
|
||||
List<String> templateIdList = templateJsonList.stream().map(FlowTemplateJsonEntity::getTemplateId).collect(Collectors.toList());
|
||||
if (templateIdList.size() > 0) {
|
||||
UpdateWrapper<FlowEngineVisibleEntity> visibleWrapper = new UpdateWrapper<>();
|
||||
visibleWrapper.lambda().eq(FlowEngineVisibleEntity::getOperatorId, fromId);
|
||||
visibleWrapper.lambda().in(FlowEngineVisibleEntity::getFlowId, templateIdList);
|
||||
visibleWrapper.lambda().set(FlowEngineVisibleEntity::getOperatorId, toId);
|
||||
flowEngineVisibleService.update(visibleWrapper);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证有效状态
|
||||
*
|
||||
* @param status 状态编码
|
||||
* @return
|
||||
*/
|
||||
private boolean checkStatus(int status) {
|
||||
List<Integer> statusList = ImmutableList.of(FlowTaskStatusEnum.Draft.getCode(), FlowTaskStatusEnum.Reject.getCode(),
|
||||
FlowTaskStatusEnum.Revoke.getCode(), FlowTaskStatusEnum.Resubmit.getCode());
|
||||
if (statusList.contains(status)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归删除所有子节点
|
||||
*
|
||||
* @param idList
|
||||
* @param isRecord
|
||||
* @param isCirculate
|
||||
*/
|
||||
private void deleteAll(List<String> idList, boolean isRecord, boolean isCirculate) {
|
||||
List<String> idAll = new ArrayList<>();
|
||||
this.deleTaskAll(idList, idAll);
|
||||
if (idAll.size() > 0) {
|
||||
QueryWrapper<FlowTaskEntity> task = new QueryWrapper<>();
|
||||
task.lambda().in(FlowTaskEntity::getId, idAll);
|
||||
this.remove(task);
|
||||
QueryWrapper<FlowCandidatesEntity> candidates = new QueryWrapper<>();
|
||||
candidates.lambda().in(FlowCandidatesEntity::getTaskId, idAll);
|
||||
flowCandidatesService.remove(candidates);
|
||||
QueryWrapper<FlowCommentEntity> comment = new QueryWrapper<>();
|
||||
comment.lambda().in(FlowCommentEntity::getTaskId, idAll);
|
||||
flowCommentService.remove(comment);
|
||||
QueryWrapper<FlowAuthorizeEntity> authorize = new QueryWrapper<>();
|
||||
authorize.lambda().in(FlowAuthorizeEntity::getTaskId, idAll);
|
||||
flowAuthorizeService.remove(authorize);
|
||||
QueryWrapper<FlowUserEntity> user = new QueryWrapper<>();
|
||||
user.lambda().in(FlowUserEntity::getTaskId, idAll);
|
||||
flowUserService.remove(user);
|
||||
QueryWrapper<FlowTaskNodeEntity> node = new QueryWrapper<>();
|
||||
node.lambda().in(FlowTaskNodeEntity::getTaskId, idAll);
|
||||
flowTaskNodeService.remove(node);
|
||||
QueryWrapper<FlowTaskOperatorEntity> operator = new QueryWrapper<>();
|
||||
operator.lambda().in(FlowTaskOperatorEntity::getTaskId, idAll);
|
||||
flowTaskOperatorService.remove(operator);
|
||||
QueryWrapper<FlowOperatorUserEntity> operatorUser = new QueryWrapper<>();
|
||||
operatorUser.lambda().in(FlowOperatorUserEntity::getTaskId, idAll);
|
||||
flowOperatorUserService.remove(operatorUser);
|
||||
QueryWrapper<FlowRejectDataEntity> rejectData = new QueryWrapper<>();
|
||||
rejectData.lambda().in(FlowRejectDataEntity::getId, idAll);
|
||||
flowRejectDataService.remove(rejectData);
|
||||
QueryWrapper<FlowTaskOperatorRecordEntity> record = new QueryWrapper<>();
|
||||
record.lambda().in(FlowTaskOperatorRecordEntity::getTaskId, idAll);
|
||||
flowTaskOperatorRecordService.remove(record);
|
||||
QueryWrapper<FlowTaskCirculateEntity> circulate = new QueryWrapper<>();
|
||||
circulate.lambda().in(FlowTaskCirculateEntity::getTaskId, idAll);
|
||||
flowTaskCirculateService.remove(circulate);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowTemplateJsonMapper;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.ChildNode;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.MsgConfig;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.Properties;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ChildNodeList;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ConditionList;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowSelectVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowTemplateJsonPage;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateJsonService;
|
||||
import com.yunzhupaas.engine.util.FlowJsonUtil;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
@Service
|
||||
public class FlowTemplateJsonServiceImpl extends SuperServiceImpl<FlowTemplateJsonMapper, FlowTemplateJsonEntity> implements FlowTemplateJsonService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateJsonEntity> getTemplateList(List<String> id) {
|
||||
List<FlowTemplateJsonEntity> list = new ArrayList<>();
|
||||
if (id.size() > 0) {
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTemplateJsonEntity::getTemplateId, id);
|
||||
queryWrapper.lambda().orderByDesc(FlowTemplateJsonEntity::getDeleteMark);
|
||||
list = this.list(queryWrapper);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateJsonEntity> getTemplateJsonList(List<String> id) {
|
||||
List<FlowTemplateJsonEntity> list = new ArrayList<>();
|
||||
if (id.size() > 0) {
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTemplateJsonEntity::getId, id);
|
||||
queryWrapper.lambda().orderByDesc(FlowTemplateJsonEntity::getDeleteMark);
|
||||
list = this.list(queryWrapper);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateJsonEntity> getListPage(FlowTemplateJsonPage pagination, boolean isPage) {
|
||||
if (StringUtil.isNotEmpty(pagination.getFlowId())) {
|
||||
FlowTemplateJsonEntity info = getJsonInfo(pagination.getFlowId());
|
||||
if (info != null) {
|
||||
pagination.setGroupId(info.getGroupId());
|
||||
}
|
||||
}
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
//关键字(流程名称、流程编码)
|
||||
String keyWord = pagination.getKeyword();
|
||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||
queryWrapper.lambda().like(FlowTemplateJsonEntity::getVersion, keyWord);
|
||||
}
|
||||
//流程id
|
||||
String templateId = pagination.getTemplateId();
|
||||
if (ObjectUtil.isNotEmpty(templateId)) {
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getTemplateId, templateId);
|
||||
}
|
||||
//流程状态
|
||||
Integer enableMark = pagination.getEnabledMark();
|
||||
if (ObjectUtil.isNotEmpty(enableMark)) {
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getEnabledMark, enableMark);
|
||||
}
|
||||
//流程分组
|
||||
String groupId = pagination.getGroupId();
|
||||
if (ObjectUtil.isNotEmpty(groupId)) {
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getGroupId, groupId);
|
||||
}
|
||||
//日期范围(近7天、近1月、近3月、自定义)
|
||||
if (ObjectUtil.isNotEmpty(pagination.getStartTime()) && ObjectUtil.isNotEmpty(pagination.getEndTime())) {
|
||||
queryWrapper.lambda().between(FlowTemplateJsonEntity::getCreatorTime, new Date(pagination.getStartTime()), new Date(pagination.getEndTime()));
|
||||
}
|
||||
queryWrapper.lambda().orderByDesc(FlowTemplateJsonEntity::getEnabledMark).orderByDesc(FlowTemplateJsonEntity::getCreatorTime);
|
||||
if (isPage) {
|
||||
Page<FlowTemplateJsonEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowTemplateJsonEntity> userPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(userPage.getRecords(), page.getTotal());
|
||||
} else {
|
||||
queryWrapper.lambda().select(FlowTemplateJsonEntity::getId, FlowTemplateJsonEntity::getGroupId);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowSelectVO> getChildListPage(FlowPagination pagination) {
|
||||
MPJLambdaWrapper<FlowTemplateJsonEntity> wrapper = JoinWrappers.lambda(FlowTemplateJsonEntity.class)
|
||||
.select(FlowTemplateJsonEntity::getFullName, FlowTemplateJsonEntity::getId)
|
||||
.leftJoin(FlowTemplateEntity.class, FlowTemplateEntity::getId, FlowTemplateJsonEntity::getTemplateId)
|
||||
.selectAs(FlowTemplateEntity::getFullName, FlowSelectVO::getFlowName)
|
||||
.selectAs(FlowTemplateEntity::getType, FlowSelectVO::getFlowType)
|
||||
.eq(FlowTemplateEntity::getEnabledMark, 1)
|
||||
.eq(FlowTemplateJsonEntity::getEnabledMark, 1)
|
||||
.eq(FlowTemplateJsonEntity::getVisibleType, 0);
|
||||
if (ObjectUtil.isNotEmpty(pagination.getKeyword())) {
|
||||
wrapper.like(FlowTemplateJsonEntity::getFullName, pagination.getKeyword());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getFlowType())) {
|
||||
wrapper.eq(FlowTemplateEntity::getType, pagination.getFlowType());
|
||||
}
|
||||
wrapper.orderByAsc(FlowTemplateEntity::getSortCode).orderByDesc(FlowTemplateEntity::getCreatorTime);
|
||||
Page<FlowSelectVO> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
Page<FlowSelectVO> data = this.selectJoinListPage(page, FlowSelectVO.class, wrapper);
|
||||
return pagination.setData(data.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateJsonEntity> getMainList(List<String> templaIdList) {
|
||||
List<FlowTemplateJsonEntity> list = new ArrayList<>();
|
||||
if (templaIdList.size() > 0) {
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTemplateJsonEntity::getTemplateId, templaIdList);
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getEnabledMark, 1);
|
||||
queryWrapper.lambda().orderByAsc(FlowTemplateJsonEntity::getSortCode);
|
||||
list.addAll(this.list(queryWrapper));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTemplateJsonEntity getInfo(String id) throws WorkFlowException {
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getId, id);
|
||||
FlowTemplateJsonEntity templateJsonEntity = this.getOne(queryWrapper);
|
||||
if (templateJsonEntity == null) {
|
||||
throw new WorkFlowException(MsgCode.FA001.get());
|
||||
}
|
||||
return templateJsonEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTemplateJsonEntity getJsonInfo(String id) {
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getId, id);
|
||||
FlowTemplateJsonEntity templateJsonEntity = this.getOne(queryWrapper);
|
||||
return templateJsonEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowTemplateJsonEntity entity) {
|
||||
if (entity.getId() == null) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
}
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setCreatorUserId(UserProvider.getUser().getUserId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowTemplateJsonEntity entity) {
|
||||
entity.setId(id);
|
||||
entity.setLastModifyTime(new Date());
|
||||
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowTemplateJsonEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateJsonEntity> getListAll(List<String> id) {
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getEnabledMark, 1);
|
||||
queryWrapper.lambda().and(w -> w.eq(FlowTemplateJsonEntity::getVisibleType, 0).or(!id.isEmpty()).in(!id.isEmpty(), FlowTemplateJsonEntity::getId, id));
|
||||
queryWrapper.lambda().select(FlowTemplateJsonEntity::getId, FlowTemplateJsonEntity::getTemplateId);
|
||||
List<FlowTemplateJsonEntity> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void templateJsonMajor(String ids) throws WorkFlowException {
|
||||
String[] idAll = ids.split(",");
|
||||
for (String id : idAll) {
|
||||
FlowTemplateJsonEntity templateJson = getInfo(id);
|
||||
if (StringUtil.isEmpty(templateJson.getFlowTemplateJson())) {
|
||||
throw new WorkFlowException(MsgCode.WF052.get());
|
||||
}
|
||||
List<String> idList = ImmutableList.of(templateJson.getTemplateId());
|
||||
List<FlowTemplateJsonEntity> list = getTemplateList(idList).stream().filter(t -> t.getGroupId().equals(templateJson.getGroupId())).collect(Collectors.toList());
|
||||
for (FlowTemplateJsonEntity entity : list) {
|
||||
if (entity.getEnabledMark() == 1 || entity.getId().equals(templateJson.getId())) {
|
||||
entity.setEnabledMark(entity.getId().equals(templateJson.getId()) ? 1 : 0);
|
||||
this.update(entity.getId(), entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> sendMsgConfigList(FlowTemplateJsonEntity engine) {
|
||||
List<String> sendConfigList = new ArrayList<>();
|
||||
ChildNode childNodeAll = JsonUtil.getJsonToBean(engine.getFlowTemplateJson(), ChildNode.class);
|
||||
//获取流程节点
|
||||
List<ChildNodeList> nodeListAll = new ArrayList<>();
|
||||
List<ConditionList> conditionListAll = new ArrayList<>();
|
||||
//递归获取条件数据和节点数据
|
||||
FlowJsonUtil.getTemplateAll(childNodeAll, nodeListAll, conditionListAll);
|
||||
for (ChildNodeList childNode : nodeListAll) {
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig waitMsgConfig = properties.getWaitMsgConfig();
|
||||
MsgConfig endMsgConfig = properties.getEndMsgConfig();
|
||||
MsgConfig approveMsgConfig = properties.getApproveMsgConfig();
|
||||
MsgConfig rejectMsgConfig = properties.getRejectMsgConfig();
|
||||
MsgConfig copyMsgConfig = properties.getCopyMsgConfig();
|
||||
MsgConfig launchMsgConfig = properties.getLaunchMsgConfig();
|
||||
MsgConfig overtimeMsgConfig = properties.getOvertimeMsgConfig();
|
||||
MsgConfig noticeMsgConfig = properties.getNoticeMsgConfig();
|
||||
//流程代办
|
||||
if (1 == waitMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(waitMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(waitMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//流程结束
|
||||
if (1 == endMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(endMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(endMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//节点同意
|
||||
if (1 == approveMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(approveMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(approveMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//节点拒绝
|
||||
if (1 == rejectMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(rejectMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(rejectMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//节点抄送
|
||||
if (1 == copyMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(copyMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(copyMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//子流程
|
||||
if (1 == launchMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(launchMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(launchMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//超时
|
||||
if (1 == overtimeMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(overtimeMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(overtimeMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
//提醒
|
||||
if (1 == noticeMsgConfig.getOn()) {
|
||||
if (StringUtil.isNotBlank(waitMsgConfig.getMsgId())) {
|
||||
sendConfigList.add(noticeMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
}
|
||||
sendConfigList = sendConfigList.stream().distinct().collect(Collectors.toList());
|
||||
return sendConfigList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFullName(String groupId, String fullName) {
|
||||
UpdateWrapper<FlowTemplateJsonEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().set(FlowTemplateJsonEntity::getFullName, fullName);
|
||||
updateWrapper.lambda().eq(FlowTemplateJsonEntity::getGroupId, groupId);
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,738 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.constant.PermissionConst;
|
||||
import com.yunzhupaas.engine.entity.FlowEngineVisibleEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowTemplateMapper;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.ChildNode;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.MsgConfig;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.Properties;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ChildNodeList;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ConditionList;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowExportModel;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowTemplateInfoVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowTemplateListVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowTemplateVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowJsonModel;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowTemplateJsonPage;
|
||||
import com.yunzhupaas.engine.service.FlowEngineVisibleService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateJsonService;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateService;
|
||||
import com.yunzhupaas.engine.util.FlowJsonUtil;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.util.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
@Service
|
||||
public class FlowTemplateServiceImpl extends SuperServiceImpl<FlowTemplateMapper, FlowTemplateEntity> implements FlowTemplateService {
|
||||
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowEngineVisibleService flowEngineVisibleService;
|
||||
@Autowired
|
||||
private FlowTemplateJsonService flowTemplateJsonService;
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateEntity> getPageList(FlowPagination pagination) {
|
||||
// 定义变量判断是否需要使用修改时间倒序
|
||||
boolean flag = false;
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(pagination.getKeyword())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().and(
|
||||
t -> t.like(FlowTemplateEntity::getFullName, pagination.getKeyword())
|
||||
.or().like(FlowTemplateEntity::getEnCode, pagination.getKeyword())
|
||||
);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getCategory())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getCategory, pagination.getCategory());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getType())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getType, pagination.getType());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getEnabledMark())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getEnabledMark, pagination.getEnabledMark());
|
||||
}
|
||||
//排序
|
||||
queryWrapper.lambda().orderByAsc(FlowTemplateEntity::getSortCode).orderByDesc(FlowTemplateEntity::getCreatorTime);
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(FlowTemplateEntity::getLastModifyTime);
|
||||
}
|
||||
Page<FlowTemplateEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowTemplateEntity> userPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(userPage.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTemplateEntity getInfo(String id) throws WorkFlowException {
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getId, id);
|
||||
FlowTemplateEntity FlowTemplateEntity = this.getOne(queryWrapper);
|
||||
if (FlowTemplateEntity == null) {
|
||||
throw new WorkFlowException(MsgCode.FA001.get());
|
||||
}
|
||||
return FlowTemplateEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExistByFullName(String fullName, String id) {
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getFullName, fullName);
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getType, 0);
|
||||
if (!ObjectUtil.isEmpty(id)) {
|
||||
queryWrapper.lambda().ne(FlowTemplateEntity::getId, id);
|
||||
}
|
||||
return this.count(queryWrapper) > 0 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExistByEnCode(String enCode, String id) {
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getEnCode, enCode);
|
||||
if (!ObjectUtil.isEmpty(id)) {
|
||||
queryWrapper.lambda().ne(FlowTemplateEntity::getId, id);
|
||||
}
|
||||
return this.count(queryWrapper) > 0 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void create(FlowTemplateEntity entity, List<FlowTemplateJsonEntity> templateJsonList) throws WorkFlowException {
|
||||
if (isExistByFullName(entity.getFullName(), entity.getId())) {
|
||||
throw new WorkFlowException(MsgCode.EXIST001.get());
|
||||
}
|
||||
if (isExistByEnCode(entity.getEnCode(), entity.getId())) {
|
||||
throw new WorkFlowException(MsgCode.EXIST002.get());
|
||||
}
|
||||
boolean formType = entity.getType() == 1;
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setId(StringUtil.isNotEmpty(entity.getId()) ? entity.getId() : RandomUtil.uuId());
|
||||
entity.setCreatorUserId(userInfo.getUserId());
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setEnabledMark(0);
|
||||
entity.setLastModifyUserId(null);
|
||||
entity.setLastModifyTime(null);
|
||||
this.setIgnoreLogicDelete().removeById(entity.getId());
|
||||
this.setIgnoreLogicDelete().saveOrUpdate(entity);
|
||||
this.clearIgnoreLogicDelete();
|
||||
List<String> tempIdList = ImmutableList.of(entity.getId());
|
||||
List<FlowTemplateJsonEntity> templateList = flowTemplateJsonService.getTemplateList(tempIdList);
|
||||
Set<String> formIdList = new HashSet<>();
|
||||
//保存引擎数据
|
||||
for (int k = 0; k < templateJsonList.size(); k++) {
|
||||
FlowTemplateJsonEntity templateJson = templateJsonList.get(k);
|
||||
templateJson.setId(StringUtil.isNotEmpty(templateJson.getId()) ? templateJson.getId() : RandomUtil.uuId());
|
||||
templateJson.setTemplateId(entity.getId());
|
||||
templateJson.setGroupId(StringUtil.isNotEmpty(templateJson.getGroupId()) ? templateJson.getGroupId() : RandomUtil.uuId());
|
||||
List<FlowEngineVisibleEntity> visibleList = visibleList(templateJson, formType, formIdList);
|
||||
flowEngineVisibleService.deleteVisible(templateJson.getId());
|
||||
int version = templateList.stream().filter(t -> t.getGroupId().equals(templateJson.getGroupId())).map(FlowTemplateJsonEntity::getVersion).mapToInt(Integer::parseInt).max().orElse(0) + 1;
|
||||
templateJson.setVersion(version + "");
|
||||
templateJson.setSortCode(Long.parseLong(k + ""));
|
||||
templateJson.setVisibleType(visibleList.size() == 0 ? 0 : 1);
|
||||
templateJson.setEnabledMark(1);
|
||||
flowTemplateJsonService.setIgnoreLogicDelete().removeById(templateJson.getId());
|
||||
flowTemplateJsonService.setIgnoreLogicDelete().saveOrUpdate(templateJson);
|
||||
flowTemplateJsonService.clearIgnoreLogicDelete();
|
||||
for (int i = 0; i < visibleList.size(); i++) {
|
||||
FlowEngineVisibleEntity visibleEntity = visibleList.get(i);
|
||||
visibleEntity.setId(RandomUtil.uuId());
|
||||
visibleEntity.setFlowId(templateJson.getId());
|
||||
visibleEntity.setSortCode(Long.parseLong(i + ""));
|
||||
flowEngineVisibleService.save(visibleEntity);
|
||||
}
|
||||
}
|
||||
if (formType && formIdList.size() > 1) {
|
||||
throw new WorkFlowException(MsgCode.WF055.get());
|
||||
}
|
||||
serviceUtil.formIdList(new ArrayList<>(formIdList), entity.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowTemplateEntity entity) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setId(StringUtil.isNotEmpty(entity.getId()) ? entity.getId() : RandomUtil.uuId());
|
||||
entity.setCreatorUserId(userInfo.getUserId());
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setEnabledMark(0);
|
||||
this.saveOrUpdate(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTemplateInfoVO info(String id) throws WorkFlowException {
|
||||
FlowTemplateEntity flowEntity = getInfo(id);
|
||||
FlowTemplateInfoVO vo = JsonUtil.getJsonToBean(flowEntity, FlowTemplateInfoVO.class);
|
||||
FlowTemplateJsonPage page = new FlowTemplateJsonPage();
|
||||
page.setTemplateId(id);
|
||||
List<FlowTemplateJsonEntity> listAll = flowTemplateJsonService.getListPage(page, false);
|
||||
List<FlowTemplateJsonEntity> list = flowTemplateJsonService.getMainList(ImmutableList.of(id));
|
||||
List<FlowTaskEntity> flowTaskList = flowTaskService.getTemplateIdList(id);
|
||||
List<FlowJsonModel> templateList = new ArrayList<>();
|
||||
for (FlowTemplateJsonEntity templateJson : list) {
|
||||
FlowJsonModel model = new FlowJsonModel();
|
||||
model.setFlowId(templateJson.getId());
|
||||
model.setId(templateJson.getId());
|
||||
model.setFullName(templateJson.getFullName());
|
||||
model.setFlowTemplateJson(JsonUtil.stringToMap(templateJson.getFlowTemplateJson()));
|
||||
List<String> flowIdList = listAll.stream().filter(t -> templateJson.getGroupId().equals(t.getGroupId())).map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
boolean isDelete = flowTaskList.stream().filter(t -> flowIdList.contains(t.getFlowId())).count() > 0;
|
||||
model.setIsDelete(isDelete);
|
||||
templateList.add(model);
|
||||
}
|
||||
vo.setFlowTemplateJson(JsonUtil.getObjectToString(templateList));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public FlowTemplateVO updateVisible(String id, FlowTemplateEntity entity, List<FlowTemplateJsonEntity> templateJsonList) throws WorkFlowException {
|
||||
if (isExistByFullName(entity.getFullName(), id)) {
|
||||
throw new WorkFlowException(MsgCode.EXIST001.get());
|
||||
}
|
||||
if (isExistByEnCode(entity.getEnCode(), id)) {
|
||||
throw new WorkFlowException(MsgCode.EXIST002.get());
|
||||
}
|
||||
boolean formType = entity.getType() == 1;
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
FlowTemplateVO vo = new FlowTemplateVO();
|
||||
List<String> listVO = new ArrayList<>();
|
||||
entity.setId(id);
|
||||
entity.setLastModifyTime(new Date());
|
||||
entity.setLastModifyUserId(userInfo.getUserId());
|
||||
this.saveOrUpdate(entity);
|
||||
//删除没有用到的流程
|
||||
List<FlowTemplateJsonEntity> templateList = flowTemplateJsonService.getMainList(ImmutableList.of(entity.getId()));
|
||||
for (int i = 0; i < templateList.size(); i++) {
|
||||
FlowTemplateJsonEntity templateJson = templateList.get(i);
|
||||
List<FlowTaskEntity> flowList = flowTaskService.getFlowList(templateJson.getId());
|
||||
if (flowList.size() > 0) {
|
||||
templateList.remove(i);
|
||||
}
|
||||
}
|
||||
List<String> tempJsonIdList = templateList.stream().map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
List<String> templateJsonId = templateJsonList.stream().filter(t -> StringUtil.isNotEmpty(t.getId())).map(FlowTemplateJsonEntity::getId).collect(Collectors.toList());
|
||||
tempJsonIdList.removeAll(templateJsonId);
|
||||
for (String tempJsonId : tempJsonIdList) {
|
||||
FlowTemplateJsonEntity delTemplateJson = flowTemplateJsonService.getInfo(tempJsonId);
|
||||
flowEngineVisibleService.deleteVisible(delTemplateJson.getId());
|
||||
flowTemplateJsonService.delete(delTemplateJson);
|
||||
}
|
||||
Set<String> formIdList = new HashSet<>();
|
||||
//保存引擎数据
|
||||
for (int k = 0; k < templateJsonList.size(); k++) {
|
||||
FlowTemplateJsonEntity templateJson = templateJsonList.get(k);
|
||||
boolean isTempId = StringUtil.isNotEmpty(templateJson.getId());
|
||||
String jsonId = isTempId ? templateJson.getId() : RandomUtil.uuId();
|
||||
//json变化才新增版本,true=变化
|
||||
FlowTemplateJsonEntity info = isTempId ? flowTemplateJsonService.getInfo(jsonId) : null;
|
||||
boolean ischange = info != null && StringUtil.isNotEmpty(info.getFlowTemplateJson()) && !info.getFlowTemplateJson().equals(templateJson.getFlowTemplateJson());
|
||||
//判断流程任务是否被使用
|
||||
List<FlowTaskEntity> flowList = flowTaskService.getFlowList(jsonId);
|
||||
boolean isRand = flowList.size() > 0 && ischange;
|
||||
templateJson.setId(isRand ? RandomUtil.uuId() : jsonId);
|
||||
templateJson.setTemplateId(id);
|
||||
templateJson.setGroupId(isTempId ? info.getGroupId() : RandomUtil.uuId());
|
||||
int version = 1;
|
||||
//判断是否在使用,新增版本
|
||||
if (isRand) {
|
||||
version = flowTemplateJsonService.getTemplateList(ImmutableList.of(id)).stream().filter(t -> t.getGroupId().equals(templateJson.getGroupId())).map(FlowTemplateJsonEntity::getVersion).mapToInt(Integer::parseInt).max().orElse(0) + 1;
|
||||
listVO.add(templateJson.getId());
|
||||
}
|
||||
List<FlowEngineVisibleEntity> visibleList = visibleList(templateJson, formType, formIdList);
|
||||
flowEngineVisibleService.deleteVisible(templateJson.getId());
|
||||
templateJson.setVisibleType(visibleList.size() == 0 ? 0 : 1);
|
||||
templateJson.setSortCode(Long.parseLong(k + ""));
|
||||
templateJson.setEnabledMark(isRand ? 0 : isTempId ? info.getEnabledMark() : 1);
|
||||
templateJson.setVersion(isRand ? version + "" : isTempId ? info.getVersion() : version + "");
|
||||
flowTemplateJsonService.saveOrUpdate(templateJson);
|
||||
for (int i = 0; i < visibleList.size(); i++) {
|
||||
FlowEngineVisibleEntity visibleEntity = visibleList.get(i);
|
||||
visibleEntity.setId(RandomUtil.uuId());
|
||||
visibleEntity.setFlowId(templateJson.getId());
|
||||
visibleEntity.setSortCode(Long.parseLong(i + ""));
|
||||
flowEngineVisibleService.save(visibleEntity);
|
||||
}
|
||||
flowTemplateJsonService.updateFullName(templateJson.getGroupId(), templateJson.getFullName());
|
||||
}
|
||||
vo.setIsMainVersion(listVO.size() > 0);
|
||||
vo.setId(String.join(",", listVO));
|
||||
if (formType && formIdList.size() > 1) {
|
||||
throw new WorkFlowException(MsgCode.WF055.get());
|
||||
}
|
||||
serviceUtil.formIdList(new ArrayList<>(formIdList), entity.getId());
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(String id, FlowTemplateEntity entity) {
|
||||
entity.setId(id);
|
||||
boolean flag = this.updateById(entity);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void copy(FlowTemplateEntity entity, List<FlowTemplateJsonEntity> templateJsonEntity) throws WorkFlowException {
|
||||
try {
|
||||
String copyNum = UUID.randomUUID().toString().substring(0, 5);
|
||||
entity.setFullName(entity.getFullName() + ".副本" + copyNum);
|
||||
entity.setEnCode(entity.getEnCode() + copyNum);
|
||||
entity.setId(null);
|
||||
entity.setLastModifyTime(null);
|
||||
entity.setLastModifyUserId(null);
|
||||
for (FlowTemplateJsonEntity jsonEntity : templateJsonEntity) {
|
||||
jsonEntity.setCreatorUserId(UserProvider.getUser().getUserId());
|
||||
jsonEntity.setCreatorTime(new Date());
|
||||
jsonEntity.setLastModifyUserId(null);
|
||||
jsonEntity.setLastModifyTime(null);
|
||||
jsonEntity.setGroupId(null);
|
||||
jsonEntity.setId(null);
|
||||
}
|
||||
this.create(entity, templateJsonEntity);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new WorkFlowException(MsgCode.PRI006.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void delete(FlowTemplateEntity entity) throws WorkFlowException {
|
||||
List<FlowTaskEntity> flowTaskList = flowTaskService.getTemplateIdList(entity.getId());
|
||||
if (flowTaskList.size() > 0) {
|
||||
throw new WorkFlowException(MsgCode.WF057.get());
|
||||
}
|
||||
List<FlowTemplateJsonEntity> list = flowTemplateJsonService.getTemplateList(ImmutableList.of(entity.getId()));
|
||||
this.removeById(entity.getId());
|
||||
serviceUtil.formIdList(new ArrayList<>(), entity.getId());
|
||||
for (FlowTemplateJsonEntity templateJson : list) {
|
||||
List<String> sendConfigIdList = flowTemplateJsonService.sendMsgConfigList(templateJson);
|
||||
if (sendConfigIdList != null && sendConfigIdList.size() > 0) {
|
||||
serviceUtil.updateSendConfigUsed(entity.getId(), sendConfigIdList);
|
||||
}
|
||||
serviceUtil.deleteFormId(templateJson.getId());
|
||||
flowEngineVisibleService.deleteVisible(templateJson.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowExportModel exportData(String id) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = getInfo(id);
|
||||
List<FlowTemplateJsonEntity> templateJsonList = flowTemplateJsonService.getMainList(ImmutableList.of(id));
|
||||
FlowExportModel model = new FlowExportModel();
|
||||
model.setFlowTemplate(entity);
|
||||
model.setFlowTemplateJson(templateJsonList);
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void ImportData(FlowExportModel flowExportModel, String type) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = flowExportModel.getFlowTemplate();
|
||||
List<FlowTemplateJsonEntity> flowTemplateJson = flowExportModel.getFlowTemplateJson();
|
||||
if (entity != null) {
|
||||
StringJoiner joiner = new StringJoiner(";");
|
||||
entity.setCreatorUserId(UserProvider.getLoginUserId());
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setLastModifyTime(null);
|
||||
entity.setLastModifyUserId(null);
|
||||
entity.setEnabledMark(0);
|
||||
List<String> templateList = new ArrayList<>();
|
||||
FlowTemplateEntity templateEntity = Import(entity, type, templateList);
|
||||
if (templateList.size() > 0) {
|
||||
joiner.add(String.join("、", templateList) + "重复");
|
||||
}
|
||||
List<FlowTemplateJsonEntity> jsonList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(flowTemplateJson)) {
|
||||
List<String> idList = new ArrayList<>();
|
||||
List<String> nameList = new ArrayList<>();
|
||||
StringJoiner childJoiner = new StringJoiner("、");
|
||||
for (FlowTemplateJsonEntity templateJsonEntity : flowTemplateJson) {
|
||||
templateJsonEntity.setCreatorUserId(UserProvider.getLoginUserId());
|
||||
templateJsonEntity.setCreatorTime(new Date());
|
||||
templateJsonEntity.setLastModifyTime(null);
|
||||
templateJsonEntity.setLastModifyUserId(null);
|
||||
templateJsonEntity.setGroupId(null);
|
||||
FlowTemplateJsonEntity jsonEntity = Import(templateJsonEntity, type, idList, nameList);
|
||||
jsonList.add(jsonEntity);
|
||||
}
|
||||
if (idList.size() > 0) {
|
||||
childJoiner.add("ID(" + String.join("、", idList) + ")");
|
||||
}
|
||||
if (nameList.size() > 0) {
|
||||
childJoiner.add("名称(" + String.join("、", nameList) + ")");
|
||||
}
|
||||
if (childJoiner.length() > 0) {
|
||||
joiner.add("flowTemplateJson:" + childJoiner + "重复");
|
||||
}
|
||||
}
|
||||
if (StringUtil.isNotEmpty(joiner.toString())) {
|
||||
throw new WorkFlowException(joiner.toString());
|
||||
}
|
||||
create(templateEntity, jsonList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateListVO> getSelectList() {
|
||||
FlowPagination pagination = new FlowPagination();
|
||||
pagination.setFlowType(0);
|
||||
List<FlowTemplateEntity> data = getListAll(pagination, false);
|
||||
List<DictionaryDataEntity> dictionList = serviceUtil.getDiList();
|
||||
Map<String, List<FlowTemplateEntity>> dataList = data.stream().collect(Collectors.groupingBy(FlowTemplateEntity::getCategory));
|
||||
List<FlowTemplateListVO> listVOS = new LinkedList<>();
|
||||
for (DictionaryDataEntity entity : dictionList) {
|
||||
FlowTemplateListVO model = new FlowTemplateListVO();
|
||||
model.setFullName(entity.getFullName());
|
||||
model.setId(entity.getId());
|
||||
List<FlowTemplateEntity> childList = dataList.get(entity.getId()) != null ? dataList.get(entity.getId()) : new ArrayList<>();
|
||||
model.setNum(childList.size());
|
||||
if (childList.size() > 0) {
|
||||
model.setChildren(JsonUtil.getJsonToList(childList, FlowTemplateListVO.class));
|
||||
}
|
||||
listVOS.add(model);
|
||||
}
|
||||
return listVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateListVO> getTreeList() {
|
||||
FlowPagination pagination = new FlowPagination();
|
||||
List<FlowTemplateEntity> data = getListAll(pagination, false);
|
||||
List<DictionaryDataEntity> dictionList = serviceUtil.getDiList();
|
||||
Map<Integer, List<FlowTemplateEntity>> typeList = data.stream().collect(Collectors.groupingBy(FlowTemplateEntity::getType));
|
||||
List<FlowTemplateListVO> listVOS = new LinkedList<>();
|
||||
for (Integer key : typeList.keySet()) {
|
||||
boolean type = Objects.equals(0, key);
|
||||
//发起类型
|
||||
FlowTemplateListVO model = new FlowTemplateListVO();
|
||||
model.setId(key + "");
|
||||
model.setFullName(type ? "发起流程" : "功能流程");
|
||||
model.setDisabled(true);
|
||||
Map<String, List<FlowTemplateEntity>> dataList = typeList.get(key).stream().collect(Collectors.groupingBy(FlowTemplateEntity::getCategory));
|
||||
List<FlowTemplateListVO> dictionListVOS = new LinkedList<>();
|
||||
for (DictionaryDataEntity entity : dictionList) {
|
||||
FlowTemplateListVO dictionModel = new FlowTemplateListVO();
|
||||
dictionModel.setFullName(entity.getFullName());
|
||||
dictionModel.setId(RandomUtil.uuId());
|
||||
List<FlowTemplateEntity> childList = dataList.get(entity.getId()) != null ? dataList.get(entity.getId()) : new ArrayList<>();
|
||||
dictionModel.setDisabled(true);
|
||||
if (childList.size() > 0) {
|
||||
dictionModel.setChildren(JsonUtil.getJsonToList(childList, FlowTemplateListVO.class));
|
||||
dictionModel.setNum(childList.size());
|
||||
dictionListVOS.add(dictionModel);
|
||||
}
|
||||
}
|
||||
if (dictionListVOS.size() > 0) {
|
||||
model.setChildren(dictionListVOS);
|
||||
listVOS.add(model);
|
||||
}
|
||||
}
|
||||
return listVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateEntity> getTemplateList(List<String> id) {
|
||||
List<FlowTemplateEntity> list = new ArrayList<>();
|
||||
if (id.size() > 0) {
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowTemplateEntity::getId, id);
|
||||
list = this.list(queryWrapper);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowTemplateEntity getFlowIdByCode(String code) throws WorkFlowException {
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getEnCode, code);
|
||||
FlowTemplateEntity FlowTemplateEntity = this.getOne(queryWrapper);
|
||||
if (FlowTemplateEntity == null) {
|
||||
throw new WorkFlowException(MsgCode.FA001.get());
|
||||
}
|
||||
return FlowTemplateEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateEntity> getListAll(FlowPagination pagination, boolean isPage) {
|
||||
// 定义变量判断是否需要使用修改时间倒序
|
||||
boolean flag = false;
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getEnabledMark, 1);
|
||||
if (ObjectUtil.isNotEmpty(pagination.getFlowType())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getType, pagination.getFlowType());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getKeyword())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().like(FlowTemplateEntity::getFullName, pagination.getKeyword());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getCategory())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getCategory, pagination.getCategory());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getTemplateIdList())) {
|
||||
queryWrapper.lambda().in(FlowTemplateEntity::getId, pagination.getTemplateIdList());
|
||||
}
|
||||
queryWrapper.lambda().orderByAsc(FlowTemplateEntity::getSortCode).orderByDesc(FlowTemplateEntity::getCreatorTime);
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(FlowTemplateEntity::getLastModifyTime);
|
||||
}
|
||||
queryWrapper.lambda().select(
|
||||
FlowTemplateEntity::getId, FlowTemplateEntity::getEnCode,
|
||||
FlowTemplateEntity::getFullName,
|
||||
FlowTemplateEntity::getType, FlowTemplateEntity::getIcon,
|
||||
FlowTemplateEntity::getCategory, FlowTemplateEntity::getIconBackground,
|
||||
FlowTemplateEntity::getCreatorUserId, FlowTemplateEntity::getSortCode,
|
||||
FlowTemplateEntity::getEnabledMark, FlowTemplateEntity::getCreatorTime
|
||||
);
|
||||
if (isPage) {
|
||||
Page<FlowTemplateEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowTemplateEntity> userPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(userPage.getRecords(), page.getTotal());
|
||||
} else {
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowTemplateEntity> getListByFlowIds(FlowPagination pagination, List<String> listAll, Boolean isAll, Boolean isPage, String userId) {
|
||||
// 定义变量判断是否需要使用修改时间倒序
|
||||
boolean flag = false;
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getEnabledMark, 1);
|
||||
List<String> listIn = new ArrayList<>();
|
||||
List<String> listVisible = null;
|
||||
if (StringUtil.isNotEmpty(userId)) {//当用户不为空的时候【判断该用户的权限
|
||||
UserEntity userInfo = serviceUtil.getUserInfo(userId);
|
||||
boolean visibleType = "1".equals(userInfo.getIsAdministrator());
|
||||
if (!visibleType) {
|
||||
List<String> id = flowEngineVisibleService.getVisibleFlowList(userInfo.getId()).stream().map(FlowEngineVisibleEntity::getFlowId).collect(Collectors.toList());
|
||||
//可见列表
|
||||
listVisible = flowTemplateJsonService.getListAll(id).stream().map(FlowTemplateJsonEntity::getTemplateId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(listVisible) && CollectionUtil.isNotEmpty(listAll)) {
|
||||
for (String str : listAll) {
|
||||
if (listVisible.contains(str)) {
|
||||
listIn.add(str);
|
||||
}
|
||||
}
|
||||
} else if (isAll) {
|
||||
listIn = listVisible;
|
||||
}
|
||||
} else {//不判断用户权限
|
||||
listIn = listAll;
|
||||
}
|
||||
if (CollectionUtil.isEmpty(listIn) && !isAll) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(listIn)) {
|
||||
queryWrapper.lambda().in(FlowTemplateEntity::getId, listIn);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getKeyword())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().like(FlowTemplateEntity::getFullName, pagination.getKeyword());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getCategory())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getCategory, pagination.getCategory());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pagination.getFlowType())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getType, pagination.getFlowType());
|
||||
}
|
||||
queryWrapper.lambda().orderByAsc(FlowTemplateEntity::getSortCode).orderByDesc(FlowTemplateEntity::getCreatorTime);
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(FlowTemplateEntity::getLastModifyTime);
|
||||
}
|
||||
queryWrapper.lambda().select(
|
||||
FlowTemplateEntity::getId, FlowTemplateEntity::getEnCode,
|
||||
FlowTemplateEntity::getFullName,
|
||||
FlowTemplateEntity::getType, FlowTemplateEntity::getIcon,
|
||||
FlowTemplateEntity::getCategory, FlowTemplateEntity::getIconBackground,
|
||||
FlowTemplateEntity::getCreatorUserId, FlowTemplateEntity::getSortCode,
|
||||
FlowTemplateEntity::getEnabledMark, FlowTemplateEntity::getCreatorTime
|
||||
);
|
||||
if (isPage) {
|
||||
Page<FlowTemplateEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<FlowTemplateEntity> userPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(userPage.getRecords(), page.getTotal());
|
||||
} else {
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveLogicFlowAndForm(String id) {
|
||||
FlowTemplateEntity flowEnt = this.setIgnoreLogicDelete().getById(id);
|
||||
if (flowEnt != null) {
|
||||
flowEnt.setDeleteMark(null);
|
||||
this.setIgnoreLogicDelete().updateById(flowEnt);
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getTemplateId, id);
|
||||
List<FlowTemplateJsonEntity> list = flowTemplateJsonService.setIgnoreLogicDelete().list(queryWrapper);
|
||||
list.forEach(t -> t.setDeleteMark(null));
|
||||
flowTemplateJsonService.setIgnoreLogicDelete().updateBatchById(list);
|
||||
}
|
||||
this.clearIgnoreLogicDelete();
|
||||
}
|
||||
|
||||
private List<FlowEngineVisibleEntity> visibleList(FlowTemplateJsonEntity entity, boolean formType, Set<String> formIdList) throws WorkFlowException {
|
||||
List<FlowEngineVisibleEntity> visibleList = new ArrayList<>();
|
||||
String templeId = entity.getTemplateId();
|
||||
String formData = StringUtil.isNotEmpty(entity.getFlowTemplateJson()) ? entity.getFlowTemplateJson() : "{}";
|
||||
ChildNode childNode = JsonUtil.getJsonToBean(formData, ChildNode.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
if (StringUtil.isNotEmpty(properties.getFormId())) {
|
||||
formIdList.add(properties.getFormId());
|
||||
}
|
||||
//流程可见
|
||||
for (String initiator : properties.getInitiator()) {
|
||||
String type = initiator.split("--").length > 1 ? initiator.split("--")[1] : PermissionConst.USER;
|
||||
String operatorId = initiator.split("--")[0];
|
||||
FlowEngineVisibleEntity visible = new FlowEngineVisibleEntity();
|
||||
visible.setOperatorId(operatorId);
|
||||
visible.setOperatorType(type);
|
||||
visible.setType(1);
|
||||
visibleList.add(visible);
|
||||
}
|
||||
List<ChildNodeList> nodeListAll = new ArrayList<>();
|
||||
List<ConditionList> conditionListAll = new ArrayList<>();
|
||||
FlowJsonUtil.getTemplateAll(childNode, nodeListAll, conditionListAll);
|
||||
List<String> sendIdList = new ArrayList<>();
|
||||
for (ChildNodeList childNodeList : nodeListAll) {
|
||||
Properties childProperties = childNodeList.getProperties();
|
||||
MsgConfig waitMsgConfig = childProperties.getWaitMsgConfig();
|
||||
if (StringUtil.isNotEmpty(waitMsgConfig.getMsgId())) {
|
||||
sendIdList.add(waitMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig endMsgConfig = childProperties.getEndMsgConfig();
|
||||
if (StringUtil.isNotEmpty(endMsgConfig.getMsgId())) {
|
||||
sendIdList.add(endMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig approveMsgConfig = childProperties.getApproveMsgConfig();
|
||||
if (StringUtil.isNotEmpty(approveMsgConfig.getMsgId())) {
|
||||
sendIdList.add(approveMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig rejectMsgConfig = childProperties.getRejectMsgConfig();
|
||||
if (StringUtil.isNotEmpty(rejectMsgConfig.getMsgId())) {
|
||||
sendIdList.add(rejectMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig copyMsgConfig = childProperties.getCopyMsgConfig();
|
||||
if (StringUtil.isNotEmpty(copyMsgConfig.getMsgId())) {
|
||||
sendIdList.add(copyMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig launchMsgConfig = childProperties.getLaunchMsgConfig();
|
||||
if (StringUtil.isNotEmpty(launchMsgConfig.getMsgId())) {
|
||||
sendIdList.add(launchMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig overtimeMsgConfig = childProperties.getOvertimeMsgConfig();
|
||||
if (StringUtil.isNotEmpty(overtimeMsgConfig.getMsgId())) {
|
||||
sendIdList.add(overtimeMsgConfig.getMsgId());
|
||||
}
|
||||
MsgConfig noticeMsgConfig = childProperties.getNoticeMsgConfig();
|
||||
if (StringUtil.isNotEmpty(noticeMsgConfig.getMsgId())) {
|
||||
sendIdList.add(noticeMsgConfig.getMsgId());
|
||||
}
|
||||
}
|
||||
entity.setSendConfigIds(JsonUtil.getObjectToString(sendIdList));
|
||||
return visibleList;
|
||||
}
|
||||
|
||||
private FlowTemplateEntity Import(FlowTemplateEntity templateEntity, String type, List<String> errList) {
|
||||
FlowTemplateEntity entity = JsonUtil.getJsonToBean(templateEntity, FlowTemplateEntity.class);
|
||||
boolean skip = Objects.equals("0", type);
|
||||
int num = 0;
|
||||
QueryWrapper<FlowTemplateEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getId, entity.getId());
|
||||
if (this.count(queryWrapper) > 0) {
|
||||
num++;
|
||||
if (skip) {
|
||||
errList.add("ID");
|
||||
}
|
||||
}
|
||||
queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getEnCode, entity.getEnCode());
|
||||
if (this.count(queryWrapper) > 0) {
|
||||
num++;
|
||||
if (skip) {
|
||||
errList.add("编码");
|
||||
}
|
||||
}
|
||||
queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateEntity::getFullName, entity.getFullName());
|
||||
if (this.count(queryWrapper) > 0) {
|
||||
num++;
|
||||
if (skip) {
|
||||
errList.add("名称");
|
||||
}
|
||||
}
|
||||
if (num > 0 && !skip) {
|
||||
String copyNum = UUID.randomUUID().toString().substring(0, 5);
|
||||
entity.setFullName(entity.getFullName() + ".副本" + copyNum);
|
||||
entity.setEnCode(entity.getEnCode() + copyNum);
|
||||
}
|
||||
entity.setId(RandomUtil.uuId());
|
||||
return entity;
|
||||
}
|
||||
|
||||
private FlowTemplateJsonEntity Import(FlowTemplateJsonEntity templateEntity, String type, List<String> idList, List<String> nameList) {
|
||||
FlowTemplateJsonEntity entity = JsonUtil.getJsonToBean(templateEntity, FlowTemplateJsonEntity.class);
|
||||
boolean skip = Objects.equals("0", type);
|
||||
QueryWrapper<FlowTemplateJsonEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getId, entity.getId());
|
||||
if (flowTemplateJsonService.count(queryWrapper) > 0) {
|
||||
if (skip) {
|
||||
idList.add(entity.getId());
|
||||
}
|
||||
}
|
||||
queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getFullName, entity.getFullName());
|
||||
queryWrapper.lambda().eq(FlowTemplateJsonEntity::getTemplateId, entity.getId());
|
||||
if (flowTemplateJsonService.count(queryWrapper) > 0) {
|
||||
if (skip) {
|
||||
nameList.add(entity.getFullName());
|
||||
}
|
||||
}
|
||||
entity.setId(RandomUtil.uuId());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yunzhupaas.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.engine.entity.FlowUserEntity;
|
||||
import com.yunzhupaas.engine.mapper.FlowUserMapper;
|
||||
import com.yunzhupaas.engine.service.FlowUserService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 流程发起用户信息
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Service
|
||||
public class FlowUserServiceImpl extends SuperServiceImpl<FlowUserMapper, FlowUserEntity> implements FlowUserService {
|
||||
|
||||
@Override
|
||||
public FlowUserEntity getInfo(String id) {
|
||||
QueryWrapper<FlowUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowUserEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowUserEntity getTaskInfo(String id) {
|
||||
QueryWrapper<FlowUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowUserEntity::getTaskId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(FlowUserEntity entity) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String id, FlowUserEntity entity) {
|
||||
entity.setId(id);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(FlowUserEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByTaskId(String taskId) {
|
||||
QueryWrapper<FlowUserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowUserEntity::getTaskId, taskId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,927 @@
|
||||
package com.yunzhupaas.engine.util;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.emnus.TemplateEnum;
|
||||
import com.yunzhupaas.engine.entity.*;
|
||||
import com.yunzhupaas.engine.enums.FlowMessageEnum;
|
||||
import com.yunzhupaas.engine.enums.FlowTaskStatusEnum;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowTemplateAllModel;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.FlowDelegateModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.Properties;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.*;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ChildNodeList;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowEventModel;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowMessageModel;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowMsgModel;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowParameterModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowContModel;
|
||||
import com.yunzhupaas.engine.service.FlowDelegateService;
|
||||
import com.yunzhupaas.engine.service.FlowEventLogService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.message.model.SentMessageForm;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.util.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author :云筑产品开发平台组
|
||||
* @version: V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date :2022/3/30 11:45
|
||||
*/
|
||||
@Component
|
||||
public class FlowMsgUtil {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowTaskUtil flowTaskUtil;
|
||||
@Autowired
|
||||
private FlowDelegateService flowDelegateService;
|
||||
@Autowired
|
||||
private FlowEventLogService flowEventLogService;
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param flowMsgModel
|
||||
*/
|
||||
public void message(FlowMsgModel flowMsgModel) throws WorkFlowException {
|
||||
List<SentMessageForm> messageListAll = new ArrayList<>();
|
||||
FlowTaskEntity taskEntity = flowMsgModel.getTaskEntity();
|
||||
List<String> creatorUserId = new ArrayList<>();
|
||||
UserEntity user = taskEntity != null ? serviceUtil.getUserInfo(taskEntity.getCreatorUserId()) : null;
|
||||
if (taskEntity != null) {
|
||||
creatorUserId.add(taskEntity.getCreatorUserId());
|
||||
}
|
||||
FlowTaskNodeEntity flowTaskNode = flowMsgModel.getTaskNodeEntity();
|
||||
FlowTemplateAllModel flowTemplateAllModel = flowMsgModel.getFlowTemplateAllModel();
|
||||
List<FlowTaskNodeEntity> nodeList = flowMsgModel.getNodeList();
|
||||
List<FlowTaskOperatorEntity> operatorList = flowMsgModel.getOperatorList();
|
||||
List<FlowTaskCirculateEntity> circulateList = flowMsgModel.getCirculateList();
|
||||
FlowTaskNodeEntity startNode = nodeList.stream().filter(t -> FlowNature.NodeStart.equals(t.getNodeType())).findFirst().orElse(null);
|
||||
String nodeJson = startNode != null ? startNode.getNodePropertyJson() : "{}";
|
||||
FlowModel flowModel = flowMsgModel.getFlowModel();
|
||||
UserInfo userInfo = flowModel.getUserInfo();
|
||||
FlowTaskOperatorRecordEntity recordEntity = new FlowTaskOperatorRecordEntity();
|
||||
recordEntity.setTaskId(startNode != null ? startNode.getTaskId() : "");
|
||||
recordEntity.setHandleId(userInfo != null ? userInfo.getUserId() : "");
|
||||
//等待
|
||||
if (flowMsgModel.getWait()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig taskMsgConfig = properties.getWaitMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC001");
|
||||
}
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(recordEntity.getTaskNodeId())).findFirst().orElse(null);
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
// if (StringUtil.isNotEmpty(flowMsgModel.getTitle())) {
|
||||
// messageModel.setFullName(taskEntity.getFullName() + flowMsgModel.getTitle());
|
||||
// }
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
for (FlowTaskOperatorEntity operator : taskOperatorList) {
|
||||
List<SentMessageForm> delegationMsg = delegationMsg(operator, messageModel, flowTemplateAllModel);
|
||||
messageListAll.addAll(delegationMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//结束
|
||||
if (flowMsgModel.getEnd()) {
|
||||
//发起人
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getEndMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC010");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
String formId = properties.getFormId();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(formId, childNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("已【结束】");
|
||||
messageModel.setMsgConfig(msgConfig);
|
||||
messageModel.setType(FlowMessageEnum.me.getCode());
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = new ArrayList() {{
|
||||
FlowTaskOperatorEntity operatorEntity = new FlowTaskOperatorEntity();
|
||||
operatorEntity.setTaskId(childNode.getTaskId());
|
||||
operatorEntity.setTaskNodeId(childNode.getTaskNodeId());
|
||||
operatorEntity.setHandleId(taskEntity.getCreatorUserId());
|
||||
add(operatorEntity);
|
||||
}};
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
//同意
|
||||
if (flowMsgModel.getApprove()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getApproveMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC002");
|
||||
}
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(flowTaskNode.getId());
|
||||
//默认获取当前节点
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(recordEntity.getTaskNodeId())).findFirst().orElse(null);
|
||||
ChildNodeList taskChildNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
Properties taskProperties = taskChildNode.getProperties();
|
||||
MsgConfig taskMsgConfig = taskProperties.getApproveMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 2) {
|
||||
taskMsgConfig = msgConfig;
|
||||
}
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC002");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("已被【同意】");
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
for (FlowTaskOperatorEntity operator : taskOperatorList) {
|
||||
List<SentMessageForm> delegationMsg = delegationMsg(operator, messageModel, flowTemplateAllModel);
|
||||
messageListAll.addAll(delegationMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//拒绝
|
||||
if (flowMsgModel.getReject()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getRejectMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC003");
|
||||
}
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(flowTaskNode.getId());
|
||||
//默认获取当前节点
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(recordEntity.getTaskNodeId())).findFirst().orElse(null);
|
||||
ChildNodeList taskChildNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
Properties taskProperties = taskChildNode.getProperties();
|
||||
MsgConfig taskMsgConfig = taskProperties.getRejectMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 2) {
|
||||
taskMsgConfig = msgConfig;
|
||||
}
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC003");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("已被【退回】");
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setType(FlowMessageEnum.wait.getCode());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
for (FlowTaskOperatorEntity operator : taskOperatorList) {
|
||||
List<SentMessageForm> delegationMsg = delegationMsg(operator, messageModel, flowTemplateAllModel);
|
||||
messageListAll.addAll(delegationMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//抄送
|
||||
if (flowMsgModel.getCopy()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getCopyMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC007");
|
||||
}
|
||||
Map<String, List<FlowTaskCirculateEntity>> circulateMap = circulateList.stream().collect(Collectors.groupingBy(FlowTaskCirculateEntity::getTaskNodeId));
|
||||
for (String key : circulateMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
//默认获取当前节点
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(key)).findFirst().orElse(null);
|
||||
ChildNodeList taskChildNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
Properties taskProperties = taskChildNode.getProperties();
|
||||
MsgConfig taskMsgConfig = taskProperties.getCopyMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 2) {
|
||||
taskMsgConfig = msgConfig;
|
||||
}
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC007");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = new ArrayList<>();
|
||||
for (FlowTaskCirculateEntity circulateEntity : circulateMap.get(key)) {
|
||||
FlowTaskOperatorEntity operatorEntity = JsonUtil.getJsonToBean(circulateEntity, FlowTaskOperatorEntity.class);
|
||||
operatorEntity.setHandleId(circulateEntity.getObjectId());
|
||||
taskOperatorList.add(operatorEntity);
|
||||
}
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("已被【抄送】");
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setType(FlowMessageEnum.circulate.getCode());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
}
|
||||
//子流程
|
||||
if (flowMsgModel.getLaunch()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getLaunchMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC011");
|
||||
}
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
//默认获取当前节点
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(key)).findFirst().orElse(null);
|
||||
ChildNodeList taskChildNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
Properties taskProperties = taskChildNode.getProperties();
|
||||
MsgConfig taskMsgConfig = taskProperties.getLaunchMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 2) {
|
||||
taskMsgConfig = msgConfig;
|
||||
}
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC011");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(properties.getFormId(), childNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("请发起【子流程】");
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setType(FlowMessageEnum.me.getCode());
|
||||
messageModel.setStatus(FlowTaskStatusEnum.Draft.getCode());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
}
|
||||
//发起人
|
||||
if (flowMsgModel.getStart()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getRejectMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC003");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
FlowMessageModel meModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(properties.getFormId(), childNode.getTaskId());
|
||||
meModel.setData(data);
|
||||
meModel.setTitle("已被【退回】");
|
||||
meModel.setRecordEntity(recordEntity);
|
||||
meModel.setStatus(taskEntity.getStatus());
|
||||
meModel.setMsgConfig(msgConfig);
|
||||
meModel.setType(FlowMessageEnum.me.getCode());
|
||||
meModel.setFullName(taskEntity.getFullName());
|
||||
meModel.setUserInfo(userInfo);
|
||||
List<FlowTaskOperatorEntity> meOperatorList = new ArrayList() {{
|
||||
FlowTaskOperatorEntity operatorEntity = new FlowTaskOperatorEntity();
|
||||
operatorEntity.setTaskId(flowTaskNode.getTaskId());
|
||||
operatorEntity.setHandleId(taskEntity.getCreatorUserId());
|
||||
add(operatorEntity);
|
||||
}};
|
||||
messageModel(meOperatorList, flowTemplateAllModel, meModel);
|
||||
setMessageList(messageList, meModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
//超时
|
||||
if (flowMsgModel.getOvertime()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getOvertimeMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC009");
|
||||
}
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(key)).findFirst().orElse(null);
|
||||
ChildNodeList taskChildNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
Properties taskProperties = taskChildNode.getProperties();
|
||||
MsgConfig taskMsgConfig = taskProperties.getOvertimeMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 2) {
|
||||
taskMsgConfig = msgConfig;
|
||||
}
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC009");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("已【超时】");
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
for (FlowTaskOperatorEntity operator : taskOperatorList) {
|
||||
List<SentMessageForm> delegationMsg = delegationMsg(operator, messageModel, flowTemplateAllModel);
|
||||
messageListAll.addAll(delegationMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//提醒
|
||||
if (flowMsgModel.getNotice()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig msgConfig = properties.getNoticeMsgConfig();
|
||||
if (msgConfig.getOn() == 3) {
|
||||
msgConfig.setMsgId("PZXTLC008");
|
||||
}
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(key)).findFirst().orElse(null);
|
||||
ChildNodeList taskChildNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
Properties taskProperties = taskChildNode.getProperties();
|
||||
MsgConfig taskMsgConfig = taskProperties.getNoticeMsgConfig();
|
||||
if (taskMsgConfig.getOn() == 2) {
|
||||
taskMsgConfig = msgConfig;
|
||||
}
|
||||
if (taskMsgConfig.getOn() == 3) {
|
||||
taskMsgConfig.setMsgId("PZXTLC008");
|
||||
}
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("请尽快【审批】");
|
||||
messageModel.setMsgConfig(taskMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(taskEntity.getFullName());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
for (FlowTaskOperatorEntity operator : taskOperatorList) {
|
||||
List<SentMessageForm> delegationMsg = delegationMsg(operator, messageModel, flowTemplateAllModel);
|
||||
messageListAll.addAll(delegationMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//评论提醒
|
||||
if (flowMsgModel.getComment()) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class);
|
||||
Properties properties = childNode.getProperties();
|
||||
MsgConfig commentMsgConfig = properties.getCommentMsgConfig();
|
||||
if (commentMsgConfig.getOn() == 3) {
|
||||
commentMsgConfig.setMsgId("MBXTLC017");
|
||||
}
|
||||
//审批人
|
||||
if (operatorList != null && !operatorList.isEmpty()) {
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = operatorMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(recordEntity.getTaskNodeId())).findFirst().orElse(null);
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("有关于您的评论,请及时查看");
|
||||
|
||||
messageModel.setMsgConfig(commentMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(messageModel.getTitle());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel.setType(3);
|
||||
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
for (FlowTaskOperatorEntity operator : taskOperatorList) {
|
||||
List<SentMessageForm> delegationMsg = delegationMsg(operator, messageModel, flowTemplateAllModel);
|
||||
messageListAll.addAll(delegationMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//抄送人
|
||||
if (circulateList != null && !circulateList.isEmpty()) {
|
||||
Map<String, List<FlowTaskCirculateEntity>> circulateMap = circulateList.stream().collect(Collectors.groupingBy(FlowTaskCirculateEntity::getTaskNodeId));
|
||||
for (String key : circulateMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
//默认获取当前节点
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(key)).findFirst().orElse(null);
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = new ArrayList<>();
|
||||
for (FlowTaskCirculateEntity circulateEntity : circulateMap.get(key)) {
|
||||
FlowTaskOperatorEntity operatorEntity = JsonUtil.getJsonToBean(circulateEntity, FlowTaskOperatorEntity.class);
|
||||
operatorEntity.setHandleId(circulateEntity.getObjectId());
|
||||
taskOperatorList.add(operatorEntity);
|
||||
}
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("有关于您的评论,请及时查看");
|
||||
messageModel.setMsgConfig(commentMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setType(FlowMessageEnum.circulate.getCode());
|
||||
messageModel.setFullName(messageModel.getTitle());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
}
|
||||
//发起人
|
||||
if (StringUtil.isNotEmpty(flowMsgModel.getStartHandId())) {
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
Map<String, Object> data = flowTaskUtil.infoData(properties.getFormId(), childNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("有关于您的评论,请及时查看");
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setMsgConfig(commentMsgConfig);
|
||||
messageModel.setType(FlowMessageEnum.me.getCode());
|
||||
messageModel.setFullName(messageModel.getTitle());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
List<FlowTaskOperatorEntity> meOperatorList = new ArrayList() {{
|
||||
FlowTaskOperatorEntity operatorEntity = new FlowTaskOperatorEntity();
|
||||
operatorEntity.setTaskId(taskEntity.getId());
|
||||
operatorEntity.setHandleId(flowMsgModel.getStartHandId());
|
||||
add(operatorEntity);
|
||||
}};
|
||||
messageModel(meOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
|
||||
//审批已办记录
|
||||
List<FlowTaskOperatorRecordEntity> operatorRecordList = flowMsgModel.getOperatorRecordList();
|
||||
if (operatorRecordList != null && !operatorRecordList.isEmpty()) {
|
||||
Map<String, List<FlowTaskOperatorRecordEntity>> operatorRecordMap = operatorRecordList.stream().collect(Collectors.groupingBy(FlowTaskOperatorRecordEntity::getTaskNodeId));
|
||||
for (String key : operatorRecordMap.keySet()) {
|
||||
recordEntity.setTaskNodeId(key);
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
List<FlowTaskOperatorRecordEntity> taskOperatorList = operatorRecordMap.get(key);
|
||||
FlowMessageModel messageModel = new FlowMessageModel();
|
||||
FlowTaskNodeEntity taskNode = nodeList.stream().filter(t -> t.getId().equals(recordEntity.getTaskNodeId())).findFirst().orElse(null);
|
||||
Map<String, Object> data = flowTaskUtil.infoData(taskNode.getFormId(), taskNode.getTaskId());
|
||||
messageModel.setData(data);
|
||||
messageModel.setTitle("有关于您的评论,请及时查看");
|
||||
|
||||
messageModel.setMsgConfig(commentMsgConfig);
|
||||
messageModel.setRecordEntity(recordEntity);
|
||||
messageModel.setStatus(taskEntity.getStatus());
|
||||
messageModel.setFullName(messageModel.getTitle());
|
||||
messageModel.setUserInfo(userInfo);
|
||||
messageModel.setType(3);
|
||||
|
||||
messageModelRecord(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
messageListAll.addAll(messageList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (SentMessageForm sentMessageForm : messageListAll) {
|
||||
FlowTemplateJsonEntity templateJson = flowTemplateAllModel.getTemplateJson();
|
||||
sentMessageForm.setFlowName(templateJson.getFullName());
|
||||
sentMessageForm.setUserName(user != null ? user.getRealName() : "");
|
||||
}
|
||||
serviceUtil.sendMessage(messageListAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装站内信消息
|
||||
*/
|
||||
private void messageModel(List<FlowTaskOperatorEntity> taskOperatorList, FlowTemplateAllModel flowTemplateAllModel, FlowMessageModel messageModel) {
|
||||
List<String> userList = new ArrayList<>();
|
||||
Map<String, String> contMsg = new HashMap<>();
|
||||
for (FlowTaskOperatorEntity taskOperator : taskOperatorList) {
|
||||
FlowContModel contModel = flowMessage(flowTemplateAllModel, taskOperator, messageModel);
|
||||
contMsg.put(taskOperator.getHandleId(), JsonUtil.getObjectToString(contModel));
|
||||
userList.add(taskOperator.getHandleId());
|
||||
}
|
||||
messageModel.setUserList(userList);
|
||||
messageModel.setContMsg(contMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装站内信消息
|
||||
*/
|
||||
private void messageModelRecord(List<FlowTaskOperatorRecordEntity> taskOperatorRecordList, FlowTemplateAllModel flowTemplateAllModel, FlowMessageModel messageModel) {
|
||||
List<String> userList = new ArrayList<>();
|
||||
Map<String, String> contMsg = new HashMap<>();
|
||||
for (FlowTaskOperatorRecordEntity taskOperator : taskOperatorRecordList) {
|
||||
FlowContModel contModel = flowMessageRecord(flowTemplateAllModel, taskOperator, messageModel);
|
||||
contMsg.put(taskOperator.getHandleId(), JsonUtil.getObjectToString(contModel));
|
||||
userList.add(taskOperator.getHandleId());
|
||||
}
|
||||
messageModel.setUserList(userList);
|
||||
messageModel.setContMsg(contMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装站内信对象
|
||||
*
|
||||
* @param taskOperator
|
||||
* @return
|
||||
*/
|
||||
private FlowContModel flowMessageRecord(FlowTemplateAllModel flowTemplateAllModel, FlowTaskOperatorRecordEntity taskOperator, FlowMessageModel messageModel) {
|
||||
FlowTemplateJsonEntity templateJson = flowTemplateAllModel.getTemplateJson();
|
||||
FlowTemplateEntity template = flowTemplateAllModel.getTemplate();
|
||||
FlowContModel contModel = new FlowContModel();
|
||||
contModel.setEnCode(template.getEnCode());
|
||||
contModel.setFlowId(templateJson.getId());
|
||||
contModel.setTaskNodeId(taskOperator.getTaskNodeId());
|
||||
contModel.setTaskOperatorId(taskOperator.getTaskOperatorId());
|
||||
contModel.setProcessId(taskOperator.getTaskId());
|
||||
contModel.setType(messageModel.getType());
|
||||
contModel.setStatus(messageModel.getStatus());
|
||||
return contModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装站内信对象
|
||||
*
|
||||
* @param taskOperator
|
||||
* @return
|
||||
*/
|
||||
private FlowContModel flowMessage(FlowTemplateAllModel flowTemplateAllModel, FlowTaskOperatorEntity taskOperator, FlowMessageModel messageModel) {
|
||||
FlowTemplateJsonEntity templateJson = flowTemplateAllModel.getTemplateJson();
|
||||
FlowTemplateEntity template = flowTemplateAllModel.getTemplate();
|
||||
FlowContModel contModel = new FlowContModel();
|
||||
contModel.setEnCode(template.getEnCode());
|
||||
contModel.setFlowId(templateJson.getId());
|
||||
contModel.setTaskNodeId(taskOperator.getTaskNodeId());
|
||||
contModel.setTaskOperatorId(taskOperator.getId());
|
||||
contModel.setProcessId(taskOperator.getTaskId());
|
||||
contModel.setType(messageModel.getType());
|
||||
contModel.setStatus(messageModel.getStatus());
|
||||
return contModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 整合发送消息
|
||||
*
|
||||
* @param messageList
|
||||
* @param flowMessageModel
|
||||
*/
|
||||
private void setMessageList(List<SentMessageForm> messageList, FlowMessageModel flowMessageModel) {
|
||||
Map<String, Object> data = new HashMap<>(flowMessageModel.getData());
|
||||
MsgConfig msgConfig = flowMessageModel.getMsgConfig() != null ? flowMessageModel.getMsgConfig() : new MsgConfig();
|
||||
List<String> userList = flowMessageModel.getUserList();
|
||||
FlowTaskOperatorRecordEntity record = flowMessageModel.getRecordEntity();
|
||||
String templateId = msgConfig.getOn() == 0 ? "0" : msgConfig.getMsgId();
|
||||
Boolean sysMessage = msgConfig.getOn() != 0;
|
||||
//解析发送配置json,获取消息模板参数
|
||||
List<TemplateJsonModel> templateJson = new ArrayList<>();
|
||||
for (SendConfigJson sendConfigJson : msgConfig.getTemplateJson()) {
|
||||
List<TemplateJsonModel> templateJson1 = sendConfigJson.getParamJson();
|
||||
templateJson.addAll(templateJson1);
|
||||
List<String> paramJson = ImmutableList.of(FlowConstant.MANDATOR, FlowConstant.MANDATARY, FlowConstant.CREATORUSERNAME, FlowConstant.SENDTIME);
|
||||
for (String field : paramJson) {
|
||||
TemplateJsonModel templateJsonModel = new TemplateJsonModel();
|
||||
templateJsonModel.setMsgTemplateId(sendConfigJson.getId());
|
||||
templateJsonModel.setRelationField(field);
|
||||
templateJsonModel.setField(field);
|
||||
templateJsonModel.setSourceType(TemplateEnum.System.getCode());
|
||||
templateJson.add(templateJsonModel);
|
||||
}
|
||||
}
|
||||
SentMessageForm messageModel = new SentMessageForm();
|
||||
messageModel.setSysMessage(sysMessage);
|
||||
messageModel.setTemplateId(templateId);
|
||||
messageModel.setToUserIds(userList);
|
||||
Map<String, Object> parameterMap = new HashMap<>();
|
||||
for (TemplateJsonModel templateJsonModel : templateJson) {
|
||||
String fieldId = templateJsonModel.getField();
|
||||
String msgTemplateId = templateJsonModel.getMsgTemplateId();
|
||||
String relationField = templateJsonModel.getRelationField();
|
||||
String dataValue = data.get(relationField) != null ? String.valueOf(data.get(relationField)) : "";
|
||||
String dataFieldValue = relationField;
|
||||
String dataJson = Objects.equals(TemplateEnum.Field.getCode(), templateJsonModel.getSourceType()) ? dataValue : dataFieldValue;
|
||||
FlowEventModel eventModel = FlowEventModel.builder().data(data).dataJson(dataJson).record(record).templateJson(templateJsonModel).build();
|
||||
dataJson = data(eventModel);
|
||||
parameterMap.put(msgTemplateId + fieldId, dataJson);
|
||||
}
|
||||
data.putAll(parameterMap);
|
||||
messageModel.setUserInfo(flowMessageModel.getUserInfo());
|
||||
messageModel.setParameterMap(data);
|
||||
messageModel.setContentMsg(flowMessageModel.getContMsg());
|
||||
messageModel.setTitle(flowMessageModel.getFullName());
|
||||
if (userList.size() > 0) {
|
||||
messageList.add(messageModel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装接口数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> parameterMap(Map<String, Object> data, List<TemplateJsonModel> templateJsonModelList, FlowTaskOperatorRecordEntity record) {
|
||||
Map<String, String> parameterMap = new HashMap<>();
|
||||
for (TemplateJsonModel templateJsonModel : templateJsonModelList) {
|
||||
String fieldId = templateJsonModel.getField();
|
||||
String msgTemplateId = templateJsonModel.getMsgTemplateId();
|
||||
String relationField = templateJsonModel.getRelationField();
|
||||
String dataValue = data.get(relationField) != null ? String.valueOf(data.get(relationField)) : null;
|
||||
String dataFieldValue = relationField;
|
||||
String dataJson = Objects.equals(TemplateEnum.Field.getCode(), templateJsonModel.getSourceType()) ? dataValue : dataFieldValue;
|
||||
FlowEventModel eventModel = FlowEventModel.builder().data(data).dataJson(dataJson).record(record).templateJson(templateJsonModel).build();
|
||||
dataJson = data(eventModel);
|
||||
parameterMap.put(StringUtil.isNotEmpty(msgTemplateId) ? msgTemplateId : "" + fieldId, dataJson);
|
||||
}
|
||||
return parameterMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private String data(FlowEventModel eventModel) {
|
||||
FlowTaskOperatorRecordEntity record = eventModel.getRecord();
|
||||
TemplateJsonModel templateJson = eventModel.getTemplateJson();
|
||||
String relationField = StringUtil.isNotEmpty(templateJson.getRelationField()) ? templateJson.getRelationField() : "";
|
||||
List<Integer> typeList = ImmutableList.of(TemplateEnum.Field.getCode(), TemplateEnum.System.getCode());
|
||||
boolean isType = typeList.contains(templateJson.getSourceType());
|
||||
String dataJson = eventModel.getDataJson();
|
||||
Map<String, Object> data = eventModel.getData();
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
String userId = StringUtil.isNotEmpty(userInfo.getUserId()) ? userInfo.getUserId() : StringUtil.isNotEmpty(record.getHandleId()) ? record.getHandleId() : "";
|
||||
UserEntity userEntity = serviceUtil.getUserInfo(userId);
|
||||
String userName = userEntity != null ? userEntity.getRealName() : "";
|
||||
String value = dataJson;
|
||||
FlowTaskEntity taskEntity = flowTaskService.getInfoSubmit(record.getTaskId(), FlowTaskEntity::getFlowId, FlowTaskEntity::getFlowName
|
||||
, FlowTaskEntity::getFullName, FlowTaskEntity::getCreatorUserId, FlowTaskEntity::getDelegateUser);
|
||||
if (isType) {
|
||||
switch (relationField) {
|
||||
case FlowConstant.FLOW_ID:
|
||||
value = taskEntity.getFlowId();
|
||||
break;
|
||||
case FlowConstant.TASK_ID:
|
||||
value = record.getTaskId();
|
||||
break;
|
||||
case FlowConstant.TASK_NODE_ID:
|
||||
value = record.getTaskNodeId();
|
||||
break;
|
||||
case FlowConstant.FLOW_FULL_NAME:
|
||||
value = taskEntity.getFlowName();
|
||||
break;
|
||||
case FlowConstant.TASK_FULL_NAME:
|
||||
value = taskEntity.getFullName();
|
||||
break;
|
||||
case FlowConstant.LAUNCH_USER_ID:
|
||||
value = taskEntity.getCreatorUserId();
|
||||
break;
|
||||
case FlowConstant.LAUNCH_USER_NAME:
|
||||
case FlowConstant.CREATORUSERNAME:
|
||||
case FlowConstant.MANDATOR:
|
||||
UserEntity createUser = taskEntity != null ? serviceUtil.getUserInfo(taskEntity.getCreatorUserId()) : null;
|
||||
value = createUser != null ? createUser.getRealName() : "";
|
||||
break;
|
||||
case FlowConstant.FLOW_OPERATOR_USER_ID:
|
||||
value = userId;
|
||||
break;
|
||||
case FlowConstant.FLOW_OPERATOR_USER_NAME:
|
||||
value = userName;
|
||||
break;
|
||||
case FlowConstant.SENDTIME:
|
||||
value = DateUtil.getNow();
|
||||
break;
|
||||
case FlowConstant.MANDATARY:
|
||||
UserEntity delegate = StringUtil.isNotEmpty(taskEntity.getDelegateUser()) ? serviceUtil.getUserInfo(taskEntity.getDelegateUser()) : null;
|
||||
value = delegate != null ? delegate.getRealName() : "";
|
||||
break;
|
||||
default:
|
||||
String[] model = StringUtil.isNotEmpty(relationField) ? relationField.split("-") : new String[]{};
|
||||
if (model.length > 1) {
|
||||
Object dataList = data.get(model[0]);
|
||||
if (dataList instanceof List) {
|
||||
List<Map<String, Object>> listAll = (List<Map<String, Object>>) dataList;
|
||||
List<Object> list = new ArrayList<>();
|
||||
for (Map<String, Object> objectMap : listAll) {
|
||||
list.add(objectMap.get(model[1]));
|
||||
}
|
||||
value = String.valueOf(list);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------事件处理---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 流程事件
|
||||
*
|
||||
* @param status 事件状态 1.发起 2.结束 3.发起撤回 4同意 5拒绝 6节点撤回 7 超时 8提醒
|
||||
* @param childNode 节点数据
|
||||
* @param record 审批数据
|
||||
*/
|
||||
public void event(Integer status, ChildNodeList childNode, FlowTaskOperatorRecordEntity record, FlowModel flowModel) {
|
||||
if (childNode != null) {
|
||||
boolean on = false;
|
||||
String interId = "";
|
||||
List<TemplateJsonModel> templateJsonModelList = new ArrayList<>();
|
||||
FuncConfig config = null;
|
||||
List<Integer> eventList = ImmutableList.of(2, 7, 8);
|
||||
Map<Integer, String> map = ImmutableMap.of(1, "发起事件", 2, "结束事件",
|
||||
3, "撤回事件", 4, "同意事件", 5, "退回事件", 6, "撤回事件",
|
||||
7, "超时事件", 8, "提醒事件");
|
||||
//属性
|
||||
Properties properties = childNode.getProperties();
|
||||
Integer funcConfigRule = properties.getFuncConfigRule();
|
||||
switch (status) {
|
||||
case 1:
|
||||
config = properties.getInitFuncConfig();
|
||||
break;
|
||||
case 2:
|
||||
config = properties.getEndFuncConfig();
|
||||
break;
|
||||
case 3:
|
||||
config = properties.getFlowRecallFuncConfig();
|
||||
break;
|
||||
case 4:
|
||||
config = properties.getApproveFuncConfig();
|
||||
break;
|
||||
case 5:
|
||||
config = properties.getRejectFuncConfig();
|
||||
break;
|
||||
case 6:
|
||||
config = properties.getRecallFuncConfig();
|
||||
break;
|
||||
case 7:
|
||||
config = properties.getOvertimeFuncConfig();
|
||||
break;
|
||||
case 8:
|
||||
config = properties.getNoticeFuncConfig();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (config != null) {
|
||||
on = config.getOn();
|
||||
interId = config.getInterfaceId();
|
||||
templateJsonModelList = config.getTemplateJson();
|
||||
}
|
||||
if (on && StringUtil.isNotEmpty(interId)) {
|
||||
Map<String, Object> data = flowModel.getFormData();
|
||||
Map<String, String> parameterMap = parameterMap(data, templateJsonModelList, record);
|
||||
List<FlowParameterModel> allEvent = FlowContextHolder.getAllEvent();
|
||||
if (allEvent.size() == 0) {
|
||||
ActionResult result = serviceUtil.infoToId(interId, parameterMap);
|
||||
boolean error = Objects.equals(400, result.getCode());
|
||||
FlowEventLogEntity logEntity = new FlowEventLogEntity();
|
||||
logEntity.setTaskNodeId(childNode.getTaskNodeId());
|
||||
logEntity.setFullName(map.get(status));
|
||||
logEntity.setInterfaceId(interId);
|
||||
logEntity.setResult(error ? result.getMsg() : "");
|
||||
flowEventLogService.create(logEntity);
|
||||
if (error && !eventList.contains(status) && Objects.equals(FlowNature.FuncTerminate, funcConfigRule)) {
|
||||
FlowContextHolder.addEvent(interId, parameterMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装委托消息
|
||||
*
|
||||
* @param operator
|
||||
* @param messageModel
|
||||
* @return
|
||||
*/
|
||||
private List<SentMessageForm> delegationMsg(FlowTaskOperatorEntity operator, FlowMessageModel messageModel, FlowTemplateAllModel flowTemplateAllModel) {
|
||||
List<SentMessageForm> messageList = new ArrayList<>();
|
||||
FlowTaskEntity taskEntity = flowTaskService.getInfoSubmit(operator.getTaskId(), FlowTaskEntity::getFlowId);
|
||||
if (taskEntity != null) {
|
||||
//todo 获取委托人
|
||||
List<String> userList = flowDelegateService.getUser(null, taskEntity.getTemplateId(), operator.getHandleId()).stream().map(FlowDelegateEntity::getToUserId).collect(Collectors.toList());
|
||||
List<FlowTaskOperatorEntity> taskOperatorList = new ArrayList<>();
|
||||
for (String user : userList) {
|
||||
FlowTaskOperatorEntity delegaOperator = JsonUtil.getJsonToBean(operator, FlowTaskOperatorEntity.class);
|
||||
delegaOperator.setHandleId(user);
|
||||
taskOperatorList.add(delegaOperator);
|
||||
}
|
||||
messageModel(taskOperatorList, flowTemplateAllModel, messageModel);
|
||||
setMessageList(messageList, messageModel);
|
||||
}
|
||||
return messageList;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------委托消息------------------------------------------------------
|
||||
public void delegateMsg(FlowDelegateModel flowDelegate) {
|
||||
List<String> toUserIds = flowDelegate.getToUserIds();
|
||||
UserInfo userInfo = flowDelegate.getUserInfo();
|
||||
FlowTaskEntity flowTask = flowDelegate.getFlowTask();
|
||||
FlowTemplateAllModel templateAllModel = flowDelegate.getTemplateAllModel();
|
||||
Map<String, String> contentMsg = new HashMap<>();
|
||||
Boolean delegate = flowDelegate.getDelegate();
|
||||
boolean approve = flowDelegate.getApprove();
|
||||
if (approve) {
|
||||
SentMessageForm flowMsgModel = new SentMessageForm();
|
||||
flowMsgModel.setToUserIds(toUserIds);
|
||||
flowMsgModel.setUserInfo(flowDelegate.getUserInfo());
|
||||
// String flowName = flowTask.getFlowName();
|
||||
String flowName = templateAllModel.getTemplateJson().getFullName();
|
||||
Map<String, Object> parameterMap = new HashMap<>();
|
||||
parameterMap.put(FlowConstant.MANDATOR, userInfo.getUserName());
|
||||
UserEntity mandatary = StringUtil.isNotEmpty(flowTask.getDelegateUser()) ? serviceUtil.getUserInfo(flowTask.getDelegateUser()) : null;
|
||||
parameterMap.put(FlowConstant.MANDATARY, mandatary != null ? mandatary.getRealName() : "");
|
||||
parameterMap.put(FlowConstant.TITLE, flowTask != null ? flowTask.getFullName() : "");
|
||||
flowMsgModel.setParameterMap(parameterMap);
|
||||
//1.委托设置 2.委托给我
|
||||
Integer type = flowDelegate.getType();
|
||||
if (delegate) {
|
||||
String title = FlowNature.StartMsg.equals(type) ? "了发起委托" : FlowNature.ApproveMsg.equals(type) ? "了审批委托" : "的委托已结束";
|
||||
String templateId = FlowNature.StartMsg.equals(type) ? "PZXTLG012" : FlowNature.ApproveMsg.equals(type) ? "PZXTLG013" : "PZXTLG014";
|
||||
String content = userInfo.getUserName() + "向您发起" + title;
|
||||
flowMsgModel.setTitle(content);
|
||||
flowMsgModel.setTemplateId(templateId);
|
||||
} else {
|
||||
String title = FlowNature.StartMsg.equals(type) ? "已发起了您的" : "已审批了您的";
|
||||
String templateId = FlowNature.StartMsg.equals(type) ? "PZXTLG015" : "PZXTLG016";
|
||||
String content = userInfo.getUserName() + title + flowName;
|
||||
flowMsgModel.setTitle(content);
|
||||
flowMsgModel.setTemplateId(templateId);
|
||||
}
|
||||
Integer delegateType = delegate ? FlowNature.EndMsg : FlowNature.ApproveMsg;
|
||||
contentMsg.put("type", delegateType + "");
|
||||
flowMsgModel.setContentMsg(contentMsg);
|
||||
flowMsgModel.setFlowType(2);
|
||||
flowMsgModel.setType(2);
|
||||
List<SentMessageForm> messageListAll = new ArrayList<>();
|
||||
if (toUserIds.size() > 0) {
|
||||
messageListAll.add(flowMsgModel);
|
||||
}
|
||||
serviceUtil.sendDelegateMsg(messageListAll);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,93 @@
|
||||
package com.yunzhupaas.engine.util;
|
||||
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskNodeEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.LimitModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.Properties;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ChildNodeList;
|
||||
import com.yunzhupaas.engine.model.flowtime.FlowTimeModel;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNodeService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskOperatorService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.DateUtil;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author :云筑产品开发平台组
|
||||
* @version: V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date :2022/6/17 17:41
|
||||
*/
|
||||
@Component
|
||||
public class FlowTimerUtil {
|
||||
|
||||
@Autowired
|
||||
private FlowTaskNodeService flowTaskNodeService;
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private FlowTaskOperatorService flowTaskOperatorService;
|
||||
|
||||
|
||||
/**
|
||||
* 限时开始时间
|
||||
*/
|
||||
public FlowTimeModel time(FlowTaskNodeEntity taskNodeEntity, List<FlowTaskNodeEntity> nodeList
|
||||
, FlowTaskEntity flowTaskEntity, FlowTaskOperatorEntity operatorInfo) throws WorkFlowException {
|
||||
FlowTaskNodeEntity startNode = nodeList.stream().filter(t -> FlowNature.NodeStart.equals(t.getNodeType())).findFirst().orElse(null);
|
||||
String nodeJson = startNode != null ? startNode.getNodePropertyJson() : "{}";
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(taskNodeEntity.getNodePropertyJson(), ChildNodeList.class);
|
||||
FlowTimeModel date = new FlowTimeModel();
|
||||
date.setChildNode(JsonUtil.getJsonToBean(nodeJson, ChildNodeList.class));//开始节点
|
||||
date.setChildNodeEvnet(childNode);//当前节点
|
||||
Date(operatorInfo, flowTaskEntity, date);
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
private void Date(FlowTaskOperatorEntity operatorInfo, FlowTaskEntity flowTaskEntity, FlowTimeModel flowTimeModel) throws WorkFlowException {
|
||||
Properties taskProperties = flowTimeModel.getChildNodeEvnet().getProperties();
|
||||
LimitModel limitModel = taskProperties.getTimeLimitConfig();
|
||||
boolean isOn = limitModel.getOn() != 0;
|
||||
if (limitModel.getOn() == 2) {
|
||||
taskProperties = flowTimeModel.getChildNode().getProperties();
|
||||
limitModel = taskProperties.getTimeLimitConfig();
|
||||
}
|
||||
Map<String, Object> data = JsonUtil.stringToMap(flowTaskEntity.getFlowFormContentJson());
|
||||
flowTimeModel.setOn(isOn);
|
||||
if (isOn) {
|
||||
Date date = null;
|
||||
if (limitModel.getNodeLimit() == 0) {
|
||||
date = operatorInfo.getCreatorTime();
|
||||
} else if (limitModel.getNodeLimit() == 1) {
|
||||
date = flowTaskEntity.getCreatorTime();
|
||||
} else {
|
||||
Object formData = data.get(limitModel.getFormField());
|
||||
try {
|
||||
date = new Date((Long) formData);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (date == null) {
|
||||
try {
|
||||
date = DateUtil.stringToDate(String.valueOf(formData));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (date == null) {
|
||||
date = flowTaskEntity.getCreatorTime();
|
||||
}
|
||||
flowTimeModel.setDate(date);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yunzhupaas.job;
|
||||
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
/**
|
||||
* 超时设置定时器
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/15 16:23
|
||||
*/
|
||||
public class AutoApproveJob extends QuartzJobBean {
|
||||
|
||||
public static final String autoApprove = "idgenerator_AutoApprove";
|
||||
|
||||
@Autowired
|
||||
private WorkTimeoutJobUtil workTimeoutJobUtil;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
|
||||
workTimeoutJobUtil.approveModel(redisTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.yunzhupaas.job;
|
||||
|
||||
import org.quartz.*;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 流程设计
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.3.0 flowable
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/1 17:27
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class JobConfig {
|
||||
@Bean
|
||||
public JobDetail testJobDetail() {
|
||||
JobDetail JobDetail = JobBuilder.newJob(WorkJobNew.class)
|
||||
.storeDurably() //必须调用该方法,添加任务
|
||||
.build();
|
||||
|
||||
return JobDetail;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Trigger testTrigger() {
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("0/10 * * * * ?"); //配置任务频率,测试环境10s正式环境修改成30s
|
||||
Trigger trigger = TriggerBuilder.newTrigger()
|
||||
.forJob(testJobDetail())
|
||||
.withSchedule(cronScheduleBuilder) //对触发器配置任务
|
||||
.build();
|
||||
return trigger;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public JobDetail timeoutSettingJobDetail() {
|
||||
JobDetail JobDetail = JobBuilder.newJob(TimeoutSettingJob.class)
|
||||
.storeDurably() //必须调用该方法,添加任务
|
||||
.build();
|
||||
|
||||
return JobDetail;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Trigger timeoutTrigger() {
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("0 0 * * * ?"); //配置任务频率,测试环境每分钟,正式环境修改成每小时0 0 * * * ?
|
||||
Trigger trigger = TriggerBuilder.newTrigger()
|
||||
.forJob(timeoutSettingJobDetail())
|
||||
.withSchedule(cronScheduleBuilder) //对触发器配置任务
|
||||
.build();
|
||||
return trigger;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JobDetail autoApproveDetail() {
|
||||
JobDetail JobDetail = JobBuilder.newJob(AutoApproveJob.class)
|
||||
.storeDurably() //必须调用该方法,添加任务
|
||||
.build();
|
||||
|
||||
return JobDetail;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Trigger autoApproveTrigger() {
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("0/5 * * * * ?"); //配置任务频率,测试环境每分钟,正式环境修改成每小时5 0 * * * ?
|
||||
Trigger trigger = TriggerBuilder.newTrigger()
|
||||
.forJob(autoApproveDetail())
|
||||
.withSchedule(cronScheduleBuilder) //对触发器配置任务
|
||||
.build();
|
||||
return trigger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.yunzhupaas.job;
|
||||
|
||||
import com.yunzhupaas.engine.model.flowtask.WorkTimeoutJobModel;
|
||||
import com.yunzhupaas.util.RedisUtil;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 超时设置定时器
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/15 16:23
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
public class TimeoutSettingJob extends QuartzJobBean {
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private WorkTimeoutJobUtil workTimeoutJobUtil;
|
||||
@Autowired
|
||||
private
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
|
||||
List<WorkTimeoutJobModel> listRedis = workTimeoutJobUtil.getListRedis(redisUtil);
|
||||
for (WorkTimeoutJobModel entity : listRedis) {
|
||||
boolean useSuccess = redisTemplate.opsForValue().setIfAbsent(WorkTimeoutJobUtil.WORKTIMEOUT_REDIS_KEY + "_key:" + entity.getTaskNodeOperatorId(), System.currentTimeMillis(), 300, TimeUnit.SECONDS);
|
||||
if (!useSuccess || entity.isSuspend()) continue;
|
||||
workTimeoutJobUtil.runTimeOutMethod(entity, true);
|
||||
redisUtil.remove(WorkTimeoutJobUtil.WORKTIMEOUT_REDIS_KEY + "_key:" + entity.getTaskNodeOperatorId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.yunzhupaas.job;
|
||||
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.database.util.TenantDataSourceUtil;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowMsgModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.WorkJobModel;
|
||||
import com.yunzhupaas.engine.util.FlowMsgUtil;
|
||||
import com.yunzhupaas.util.RedisUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 流程设计
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.3.0 flowable
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/1 17:32
|
||||
*/
|
||||
@Slf4j
|
||||
@DisallowConcurrentExecution
|
||||
public class WorkJobNew extends QuartzJobBean {
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
@Autowired
|
||||
private FlowMsgUtil flowMsgUtil;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
|
||||
// System.out.println("定时器");
|
||||
// List<WorkJobModel> listRedis = WorkJobUtil.getListRedis(redisUtil);
|
||||
Map<String, Object> listRedisTime = WorkJobUtil.getListRedisTime(redisUtil);
|
||||
if (listRedisTime != null) {
|
||||
try {
|
||||
long time = System.currentTimeMillis();
|
||||
// runCode(listRedis, time);
|
||||
//新逻辑,取key 时间缓存,如有延迟,则取延迟workJobModel对象缓存。
|
||||
for (String key : listRedisTime.keySet()) {
|
||||
boolean useSuccess = redisTemplate.opsForValue().setIfAbsent(WorkJobUtil.REDIS_KEY + "_key:" + key, System.currentTimeMillis(), 300, TimeUnit.SECONDS);
|
||||
if (!useSuccess) continue;
|
||||
try {
|
||||
boolean isNext = Long.valueOf(listRedisTime.get(key).toString()).longValue() < time;
|
||||
if (isNext) {
|
||||
WorkJobModel workJobModel = WorkJobUtil.getListRedisJson(redisUtil, key);
|
||||
UserInfo userInfo = workJobModel.getUserInfo();
|
||||
FlowMsgModel flowMsgModel = workJobModel.getFlowMsgModel();
|
||||
if (configValueUtil.isMultiTenancy()) {
|
||||
TenantDataSourceUtil.switchTenant(userInfo.getTenantId());
|
||||
}
|
||||
flowMsgUtil.message(flowMsgModel);
|
||||
redisUtil.removeHash(WorkJobUtil.REDIS_KEY, key);
|
||||
redisUtil.removeHash(WorkJobUtil.REDIS_KEY + "_json", key);
|
||||
}
|
||||
} finally {
|
||||
redisTemplate.delete(WorkJobUtil.REDIS_KEY + "_key:" + key);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("工作流调度报错:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//旧逻辑
|
||||
private void runCode(List<WorkJobModel> listRedis, long time) {
|
||||
for (WorkJobModel workJobModel : listRedis) {
|
||||
boolean useSuccess = redisTemplate.opsForValue().setIfAbsent(WorkJobUtil.REDIS_KEY + "_key:" + workJobModel.getTaskId(), System.currentTimeMillis(), 300, TimeUnit.SECONDS);
|
||||
if (!useSuccess) continue;
|
||||
List<FlowTaskOperatorEntity> operatorList = workJobModel.getFlowMsgModel().getOperatorList();
|
||||
// System.out.println("每个对象:" + workJobModel);
|
||||
boolean isNext = operatorList.stream().filter(t -> t.getCreatorTime().getTime() > time).count() == 0;
|
||||
UserInfo userInfo = workJobModel.getUserInfo();
|
||||
FlowMsgModel flowMsgModel = workJobModel.getFlowMsgModel();
|
||||
if (configValueUtil.isMultiTenancy()) {
|
||||
TenantDataSourceUtil.switchTenant(userInfo.getTenantId());
|
||||
}
|
||||
if (isNext) {
|
||||
redisUtil.removeHash(WorkJobUtil.REDIS_KEY, workJobModel.getTaskId());
|
||||
redisUtil.remove(WorkJobUtil.REDIS_KEY + "_key:" + workJobModel.getTaskId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yunzhupaas.job;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowMsgModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.WorkJobModel;
|
||||
import com.yunzhupaas.engine.util.FlowMsgUtil;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.RedisUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程定时器工具类
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.3.0 flowable
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2 9:04
|
||||
*/
|
||||
@Component
|
||||
public class WorkJobUtil {
|
||||
/**
|
||||
* 缓存key
|
||||
*/
|
||||
public static final String REDIS_KEY = "idgenerator_WorkJobNew";
|
||||
|
||||
private static FlowMsgUtil flowMsgUtil;
|
||||
|
||||
/**
|
||||
* 将数据放入缓存
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public static void insertRedis(WorkJobModel workJobModel, RedisUtil redisUtil) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("taskId", workJobModel.getTaskId());
|
||||
json.put("flowMsgModel", JsonUtil.getObjectToString(workJobModel.getFlowMsgModel()));
|
||||
json.put("userInfo", JsonUtil.getObjectToString(workJobModel.getUserInfo()));
|
||||
|
||||
List<FlowTaskOperatorEntity> operatorList = workJobModel.getFlowMsgModel().getOperatorList();
|
||||
if (operatorList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
boolean isNext = operatorList.stream().filter(t -> t.getCreatorTime().getTime() > time).count() > 0;
|
||||
if (isNext) {
|
||||
Map<String, List<FlowTaskOperatorEntity>> operatorMap = operatorList.stream().collect(Collectors.groupingBy(FlowTaskOperatorEntity::getTaskNodeId));
|
||||
for (String key : operatorMap.keySet()) {
|
||||
redisUtil.insertHash(REDIS_KEY, workJobModel.getTaskId() + key, String.valueOf(operatorMap.get(key).get(0).getCreatorTime().getTime()));
|
||||
redisUtil.insertHash(REDIS_KEY + "_json", workJobModel.getTaskId() + key, json.toJSONString());
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
flowMsgUtil.message(workJobModel.getFlowMsgModel());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时器取用数据调用创建方法
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public static List<WorkJobModel> getListRedis(RedisUtil redisUtil) {
|
||||
List<WorkJobModel> list = new ArrayList<>();
|
||||
if (redisUtil.exists(REDIS_KEY)) {
|
||||
Map<String, Object> map = redisUtil.getMap(REDIS_KEY);
|
||||
for (Object object : map.keySet()) {
|
||||
if (map.get(object) instanceof String) {
|
||||
Map<String, Object> jsonMap = JsonUtil.stringToMap(String.valueOf(map.get(object)));
|
||||
String taskId = jsonMap.get("taskId").toString();
|
||||
FlowMsgModel flowMsgModel = JsonUtil.getJsonToBean(jsonMap.get("flowMsgModel").toString(), FlowMsgModel.class);
|
||||
UserInfo userInfo = JsonUtil.getJsonToBean(jsonMap.get("userInfo").toString(), UserInfo.class);
|
||||
list.add(new WorkJobModel(taskId, flowMsgModel, userInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时器取用数据调用创建方法
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public static Map<String, Object> getListRedisTime(RedisUtil redisUtil) {
|
||||
Map<String, Object> map = null;
|
||||
if (redisUtil.exists(REDIS_KEY)) {
|
||||
map = redisUtil.getMap(REDIS_KEY);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存信息
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public static WorkJobModel getListRedisJson(RedisUtil redisUtil, String key) {
|
||||
String hashValues = redisUtil.getHashValues(REDIS_KEY + "_json", key);
|
||||
Map<String, Object> jsonMap = JsonUtil.stringToMap(String.valueOf(hashValues));
|
||||
String taskId = jsonMap.get("taskId").toString();
|
||||
FlowMsgModel flowMsgModel = JsonUtil.getJsonToBean(jsonMap.get("flowMsgModel").toString(), FlowMsgModel.class);
|
||||
UserInfo userInfo = JsonUtil.getJsonToBean(jsonMap.get("userInfo").toString(), UserInfo.class);
|
||||
return new WorkJobModel(taskId, flowMsgModel, userInfo);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setFlowMsgUtil(FlowMsgUtil flowMsgUtil) {
|
||||
WorkJobUtil.flowMsgUtil = flowMsgUtil;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,679 @@
|
||||
package com.yunzhupaas.job;
|
||||
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.database.util.TenantDataSourceUtil;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskNodeEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskOperatorRecordEntity;
|
||||
import com.yunzhupaas.engine.enums.FlowNodeEnum;
|
||||
import com.yunzhupaas.engine.enums.FlowTaskStatusEnum;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowTemplateAllModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.LimitModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.Properties;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.TimeModel;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowMsgModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowApproveModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.WorkTimeoutJobModel;
|
||||
import com.yunzhupaas.engine.model.flowtime.FlowTimeModel;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNewService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNodeService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskOperatorService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.engine.util.FlowMsgUtil;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.engine.util.FlowTaskUtil;
|
||||
import com.yunzhupaas.engine.util.FlowTimerUtil;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程设计
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.3.0 flowable
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/15 17:37
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@DependsOn("threadPoolTaskExecutor")
|
||||
public class WorkTimeoutJobUtil {
|
||||
/**
|
||||
* 缓存key
|
||||
*/
|
||||
public static final String WORKTIMEOUT_REDIS_KEY = "idgenerator_WorkTimeout";
|
||||
public static Map<String, List<ScheduledFuture>> futureList = new HashMap<>();
|
||||
|
||||
public static Map<String, FlowApproveModel> userInfoMap = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
public FlowMsgUtil flowMsgUtil;
|
||||
@Autowired
|
||||
public FlowTaskNodeService flowTaskNodeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
public FlowTaskNewService flowTaskNewService;
|
||||
//测试
|
||||
boolean testFlag = false;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private FlowTaskOperatorService flowTaskOperatorService;
|
||||
@Autowired
|
||||
private FlowTimerUtil flowTimerUtil;
|
||||
@Autowired
|
||||
private FlowTaskUtil flowTaskUtil;
|
||||
|
||||
private static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = null;
|
||||
|
||||
WorkTimeoutJobUtil(ThreadPoolTaskExecutor threadPoolTaskExecutor) {
|
||||
if(scheduledThreadPoolExecutor == null) {
|
||||
scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(2, threadPoolTaskExecutor.getThreadPoolExecutor().getThreadFactory());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据放入缓存
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public void insertRedis(WorkTimeoutJobModel workTimeoutJobModel, RedisUtil redisUtil) {
|
||||
insertRedis(workTimeoutJobModel, redisUtil, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据放入缓存
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public void insertRedis(WorkTimeoutJobModel workTimeoutJobModel, RedisUtil redisUtil, boolean isRunTimeOut) {
|
||||
workTimeoutJobModel.setCounter(0);
|
||||
workTimeoutJobModel.setOvertimeNum(0);
|
||||
String objectToString = JsonUtil.getObjectToString(workTimeoutJobModel);
|
||||
redisUtil.insertHash(WORKTIMEOUT_REDIS_KEY, workTimeoutJobModel.getTaskNodeOperatorId(), objectToString);
|
||||
if (isRunTimeOut) {
|
||||
this.runTimeOutMethod(workTimeoutJobModel, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时器取用数据调用创建方法
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/2
|
||||
*/
|
||||
public List<WorkTimeoutJobModel> getListRedis(RedisUtil redisUtil) {
|
||||
List<WorkTimeoutJobModel> list = new ArrayList<>();
|
||||
if (redisUtil.exists(WORKTIMEOUT_REDIS_KEY)) {
|
||||
Map<String, Object> map = redisUtil.getMap(WORKTIMEOUT_REDIS_KEY);
|
||||
for (Object object : map.keySet()) {
|
||||
if (map.get(object) instanceof String) {
|
||||
WorkTimeoutJobModel workTimeoutJobModel = JsonUtil.getJsonToBean(String.valueOf(map.get(object)), WorkTimeoutJobModel.class);
|
||||
list.add(workTimeoutJobModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行限时设置的内容。
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/7/25
|
||||
*/
|
||||
public void runTimeOutMethod(WorkTimeoutJobModel entity, boolean isTimeTask) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH");
|
||||
if (testFlag) {
|
||||
formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
}
|
||||
//切换数据库
|
||||
if (configValueUtil.isMultiTenancy()) {
|
||||
TenantDataSourceUtil.switchTenant(entity.getTenantId());
|
||||
}
|
||||
try {
|
||||
FlowTaskOperatorEntity operatorInfo = flowTaskOperatorService.getOperatorInfo(entity.getTaskNodeOperatorId());
|
||||
if (operatorInfo == null || operatorInfo.getCompletion() != 0 || operatorInfo.getState() != 0) {
|
||||
throw new WorkFlowException(MsgCode.WF064.get());
|
||||
}
|
||||
Date realThisTime = DateUtil.stringToDate(DateUtil.getNow());
|
||||
Date thisTime = formatter.parse(DateUtil.getmmNow());
|
||||
FlowTaskEntity flowTask = flowTaskService.getInfo(entity.getTaskId());
|
||||
FlowTemplateAllModel templateAllModel = flowTaskUtil.templateJson(flowTask.getFlowId());
|
||||
List<FlowTaskNodeEntity> taskNodeList = flowTaskNodeService.getList(flowTask.getId());
|
||||
FlowTaskNodeEntity flowTaskNodeEntity = flowTaskNodeService.getInfo(entity.getTaskNodeId());
|
||||
|
||||
//节点属性
|
||||
FlowTimeModel flowTimeModel = flowTimerUtil.time(flowTaskNodeEntity, taskNodeList, flowTask, operatorInfo);
|
||||
Properties approversThis = flowTimeModel.getChildNodeEvnet().getProperties();
|
||||
Properties approversStart = flowTimeModel.getChildNode().getProperties();
|
||||
LimitModel timeLimitConfig = approversThis.getTimeLimitConfig();
|
||||
if (timeLimitConfig.getOn() == 2) {
|
||||
timeLimitConfig = approversStart.getTimeLimitConfig();
|
||||
}
|
||||
TimeModel overTimeConfig = approversThis.getOverTimeConfig();
|
||||
if (overTimeConfig.getOn() == 2) {
|
||||
overTimeConfig = approversStart.getOverTimeConfig();
|
||||
}
|
||||
TimeModel noticeConfig = approversThis.getNoticeConfig();
|
||||
if (noticeConfig.getOn() == 2) {
|
||||
noticeConfig = approversStart.getNoticeConfig();
|
||||
}
|
||||
FlowModel flowModel = entity.getFlowModel();
|
||||
//限时设置
|
||||
if (timeLimitConfig.getOn() == 1) {
|
||||
Date limitStartTime = formatter.parse(formatter.format(flowTimeModel.getDate()));
|
||||
Date realStartTime = flowTimeModel.getDate();
|
||||
Long timeout = realStartTime.getTime() - limitStartTime.getTime();
|
||||
Integer limitedDuration = timeLimitConfig.getDuringDeal();
|
||||
Date limitEndTime = DateUtil.dateAddHours(limitStartTime, limitedDuration);//加限时时间
|
||||
if (testFlag) {
|
||||
//以1分钟为准
|
||||
limitEndTime = DateUtil.dateAddMinutes(limitStartTime, limitedDuration);//加限时时间
|
||||
}
|
||||
if (isTimeTask) {//砍掉尾数的定时器触发当前时间加上被砍掉的时间尾数,为本应该是触发定时器的时间
|
||||
realThisTime = DateUtil.dateAddSeconds(thisTime, timeout.intValue() / 1000);
|
||||
}
|
||||
//1.提醒设置 在限定时间范围内有效
|
||||
if (noticeConfig.getOn() == 1 && realThisTime.getTime() >= limitStartTime.getTime() + timeout && realThisTime.getTime() <= limitEndTime.getTime() + timeout) {
|
||||
noticeMethod(entity, testFlag, thisTime, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, flowTimeModel, noticeConfig, flowModel, limitStartTime, timeout, limitEndTime, isTimeTask, realThisTime);
|
||||
}
|
||||
//2.超时,在限时时长之后生效
|
||||
if (overTimeConfig.getOn() == 1 && realThisTime.getTime() >= limitEndTime.getTime() + timeout) {
|
||||
timeoutMethod(entity, formatter, testFlag, thisTime, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, operatorInfo, flowTimeModel, overTimeConfig, flowModel, timeout, limitEndTime, isTimeTask, realThisTime);
|
||||
}
|
||||
//判断是提交过来的,是否在1个小时范围内
|
||||
if (!isTimeTask) {
|
||||
if (overTimeConfig.getOn() == 1 && realThisTime.getTime() >= limitStartTime.getTime() + timeout && realThisTime.getTime() <= limitEndTime.getTime() + timeout) {
|
||||
timeout = limitEndTime.getTime() + timeout - System.currentTimeMillis();
|
||||
if (timeout < 3600000) {
|
||||
isTimeTask = true;
|
||||
timeoutMethod(entity, formatter, testFlag, thisTime, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, operatorInfo, flowTimeModel, overTimeConfig, flowModel, timeout, limitEndTime, isTimeTask, realThisTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (WorkFlowException we) {
|
||||
we.printStackTrace();
|
||||
redisUtil.removeHash(this.WORKTIMEOUT_REDIS_KEY, entity.getTaskNodeOperatorId());
|
||||
redisUtil.removeHash(this.WORKTIMEOUT_REDIS_KEY, entity.getTaskNodeId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 超时相关逻辑
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/10
|
||||
*/
|
||||
private void timeoutMethod(WorkTimeoutJobModel entity, SimpleDateFormat formatter, boolean testFlag, Date thisTime, FlowTaskEntity flowTask, FlowTemplateAllModel templateAllModel,
|
||||
List<FlowTaskNodeEntity> taskNodeList, FlowTaskNodeEntity flowTaskNodeEntity, FlowTaskOperatorEntity operatorInfo,
|
||||
FlowTimeModel flowTimeModel, TimeModel overTimeConfig, FlowModel flowModel, long timeout, Date limitEndTime, boolean isTimeTask, Date realThisTime) throws ParseException {
|
||||
Integer firstTimeout = overTimeConfig.getFirstOver();
|
||||
Integer timeoutInterval = overTimeConfig.getOverTimeDuring();
|
||||
Date timeoutStartTime = DateUtil.dateAddHours(limitEndTime, firstTimeout);
|
||||
Long delayTime = 500l;
|
||||
if (isTimeTask) {
|
||||
delayTime = timeout;
|
||||
}
|
||||
if (testFlag) {
|
||||
//以1分钟为单位进行测试超时测试,假设起始时间starTime=xxxx以startTimeTest替换给定
|
||||
timeoutStartTime = DateUtil.dateAddMinutes(limitEndTime, firstTimeout);
|
||||
}
|
||||
//当节点创建时间大于超时开始时间时,以节点创建时间为起始
|
||||
// if (operatorInfo.getCreatorTime().getTime() >= timeoutStartTime.getTime()) {
|
||||
// String format = formatter.format(operatorInfo.getCreatorTime());
|
||||
// timeoutStartTime = formatter.parse(format);
|
||||
// }
|
||||
if (overTimeConfig.getOverTimeDuring() == 0) {//超时间隔=0只提醒一次
|
||||
if (thisTime.compareTo(timeoutStartTime) == 0) {
|
||||
TimeModel finalOverTimeConfig = overTimeConfig;
|
||||
Runnable resetExpire = () -> {
|
||||
FlowTaskOperatorEntity operatorNow = null;
|
||||
if (isTimeTask) {
|
||||
operatorNow = onTimeCheckOperatorHave(entity, 1);
|
||||
} else {
|
||||
operatorNow = entity.getOperatorEntity();
|
||||
}
|
||||
if (operatorNow == null) return;
|
||||
//超时消息
|
||||
if (finalOverTimeConfig.getOverNotice()) {
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList();
|
||||
list.add(operatorNow);
|
||||
sendMessge(false, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, list, flowModel);
|
||||
}
|
||||
//超时事件
|
||||
if (finalOverTimeConfig.getOverEvent() && finalOverTimeConfig.getOverEventTime() >= 1) {
|
||||
sendEvent(entity, 7, flowTimeModel);
|
||||
}
|
||||
//超时自动审批
|
||||
if (finalOverTimeConfig.getOverAutoApprove() && finalOverTimeConfig.getOverAutoApproveTime() >= 1) {
|
||||
// _log("超时任务: {}-自动审批", entity.getTaskNodeOperatorId());
|
||||
//自动审批
|
||||
autoApprove(operatorNow, taskNodeList, flowTask, flowModel);
|
||||
}
|
||||
redisUtil.removeHash(this.WORKTIMEOUT_REDIS_KEY, entity.getTaskNodeOperatorId());//超时提醒只有一次的时候完成就移除
|
||||
};
|
||||
this.runScheduleTask(resetExpire, delayTime, entity.getTaskNodeOperatorId());
|
||||
}
|
||||
} else if (overTimeConfig.getOverTimeDuring() > 0) {//超时间隔>0
|
||||
//创建即触发超时
|
||||
if (!isTimeTask && entity.getOvertimeNum() == 0 && realThisTime.getTime() > timeoutStartTime.getTime() + timeout) {
|
||||
Long bett = realThisTime.getTime() - timeoutStartTime.getTime() - timeout;
|
||||
int finaConut = 0;
|
||||
if (testFlag) {
|
||||
finaConut = bett.intValue() / (60000 * timeoutInterval);
|
||||
} else {
|
||||
finaConut = bett.intValue() / (3600000 * timeoutInterval);
|
||||
}
|
||||
// _log("创建即超时次数:{}", finaConut);
|
||||
if (overTimeConfig.getOverNotice()) {
|
||||
// _log("超时任务: {}-创建即触发超时通知", entity.getTaskNodeOperatorId());
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList<>();
|
||||
list.add(entity.getOperatorEntity());
|
||||
sendMessge(false, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, list, flowModel);
|
||||
}
|
||||
if (overTimeConfig.getOverEvent() && overTimeConfig.getOverEventTime() <= (finaConut + 1) && entity.getOvertimeNum() == 0) {
|
||||
//接收到就已经超时多次,直接触发一次事件
|
||||
// _log("超时任务: {}-创建即触发进入超时事件", entity.getTaskNodeOperatorId());
|
||||
sendEvent(entity, 7, flowTimeModel);
|
||||
}
|
||||
if (overTimeConfig.getOverAutoApprove() && overTimeConfig.getOverAutoApproveTime() <= (finaConut + 1) && entity.getOvertimeNum() == 0) {
|
||||
// _log("超时任务: {}-创建即触发超时自动审批", entity.getTaskNodeOperatorId());
|
||||
//自动审批
|
||||
autoApprove(entity.getOperatorEntity(), taskNodeList, flowTask, flowModel);
|
||||
}
|
||||
addNum(entity.getTaskNodeOperatorId(), 1);//有执行则次数加1
|
||||
}
|
||||
int n = 0;
|
||||
while (isTimeTask) {
|
||||
Date whileTime = DateUtil.dateAddHours(timeoutStartTime, timeoutInterval * n);
|
||||
if (testFlag) {
|
||||
//以1分钟为单位进行测试超时测试,假设起始时间starTime=xxxx以startTimeTest替换给定
|
||||
whileTime = DateUtil.dateAddMinutes(timeoutStartTime, timeoutInterval * n);
|
||||
}
|
||||
// _log("超时任务: {}-第:{}次超时时间循环:{}", entity.getTaskNodeOperatorId(), (n + 1), DateUtil.dateFormat(whileTime));
|
||||
if (thisTime.compareTo(whileTime) == 0) {
|
||||
int finalN = n;
|
||||
TimeModel finalOverTimeConfig1 = overTimeConfig;
|
||||
Runnable resetExpire = () -> {
|
||||
FlowTaskOperatorEntity operatorNow = null;
|
||||
if (isTimeTask) {
|
||||
operatorNow = onTimeCheckOperatorHave(entity, 1);
|
||||
} else {
|
||||
operatorNow = entity.getOperatorEntity();
|
||||
}
|
||||
if (operatorNow == null) return;
|
||||
//todo 超时通知
|
||||
if (finalOverTimeConfig1.getOverNotice()) {
|
||||
// _log("超时任务: {}-第{}次的超时通知", entity.getTaskNodeOperatorId(), (finalN + 1));
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList<>();
|
||||
list.add(operatorNow);
|
||||
sendMessge(false, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, list, flowModel);
|
||||
}
|
||||
//todo 超时事件
|
||||
if (finalOverTimeConfig1.getOverEvent() && finalOverTimeConfig1.getOverEventTime() == (finalN + 1)) {
|
||||
// _log("超时任务: {}-第{}次进入超时事件", entity.getTaskNodeOperatorId(), (finalN + 1));
|
||||
//节点事件
|
||||
sendEvent(entity, 7, flowTimeModel);
|
||||
}
|
||||
//todo 超时自动审批
|
||||
if (finalOverTimeConfig1.getOverAutoApprove() && finalOverTimeConfig1.getOverAutoApproveTime() == (finalN + 1)) {
|
||||
// _log("超时任务: {}-第{}次进入超时自动审批", entity.getTaskNodeOperatorId(), (finalN + 1));
|
||||
//自动审批
|
||||
autoApprove(operatorNow, taskNodeList, flowTask, flowModel);
|
||||
}
|
||||
addNum(entity.getTaskNodeOperatorId(), 1);
|
||||
};
|
||||
this.runScheduleTask(resetExpire, delayTime, entity.getTaskNodeOperatorId());
|
||||
}
|
||||
if (whileTime.after(thisTime)) {
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提醒方法执行内容
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/8
|
||||
*/
|
||||
public void noticeMethod(WorkTimeoutJobModel entity, boolean testFlag, Date thisTime, FlowTaskEntity flowTask, FlowTemplateAllModel templateAllModel,
|
||||
List<FlowTaskNodeEntity> taskNodeList, FlowTaskNodeEntity flowTaskNodeEntity, FlowTimeModel flowTimeModel, TimeModel noticeConfig,
|
||||
FlowModel flowModel, Date limitStartTime, long timeout, Date limitEndTime, boolean isTimeTask, Date realThisTime) {
|
||||
Integer firstWarnTime = noticeConfig.getFirstOver();
|
||||
Integer warnInterval = noticeConfig.getOverTimeDuring();
|
||||
Date warnStartTime = DateUtil.dateAddHours(limitStartTime, firstWarnTime);
|
||||
Long delayTime = 0l;
|
||||
if (isTimeTask) {
|
||||
delayTime = timeout;
|
||||
}
|
||||
if (testFlag) {
|
||||
warnStartTime = DateUtil.dateAddMinutes(limitStartTime, firstWarnTime);
|
||||
}
|
||||
if (noticeConfig.getOverTimeDuring() == 0) {//提醒间隔为0-只提醒一次
|
||||
if (thisTime.compareTo(warnStartTime) == 0) {
|
||||
TimeModel finalNoticeConfig = noticeConfig;
|
||||
Runnable resetExpire = () -> {
|
||||
//待处理任务列表
|
||||
FlowTaskOperatorEntity operatorNow = null;
|
||||
if (isTimeTask) {
|
||||
operatorNow = onTimeCheckOperatorHave(entity, 0);
|
||||
} else {
|
||||
operatorNow = entity.getOperatorEntity();
|
||||
}
|
||||
if (operatorNow == null) return;
|
||||
if (finalNoticeConfig.getOverNotice()) {
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList();
|
||||
list.add(operatorNow);
|
||||
sendMessge(true, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, list, flowModel);
|
||||
}
|
||||
if (finalNoticeConfig.getOverEvent() && finalNoticeConfig.getOverEventTime() >= 1) {
|
||||
sendEvent(entity, 8, flowTimeModel);
|
||||
}
|
||||
addNum(entity.getTaskNodeOperatorId(), 0);
|
||||
};
|
||||
this.runScheduleTask(resetExpire, delayTime, entity.getTaskNodeOperatorId());
|
||||
}
|
||||
} else if (noticeConfig.getOverTimeDuring() > 0) {//提醒间隔大于0
|
||||
long noticeTimes = (limitEndTime.getTime() - warnStartTime.getTime()) / (warnInterval * 60 * 60 * 1000);
|
||||
if (testFlag) {
|
||||
noticeTimes = (limitEndTime.getTime() - warnStartTime.getTime()) / (warnInterval * 60 * 1000);
|
||||
}
|
||||
//限定时间在创建时间之前,有过几次时的提醒的情况(前面不管多少次只提醒一次)
|
||||
if (!isTimeTask && entity.getCounter() == 0 && noticeConfig.getOverEventTime() > 0 && realThisTime.getTime() > warnStartTime.getTime() + timeout) {
|
||||
if (noticeConfig.getOverNotice()) {
|
||||
// _log("创建即出发提醒信息");
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList();
|
||||
list.add(entity.getOperatorEntity());
|
||||
sendMessge(true, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, list, flowModel);
|
||||
}
|
||||
if (noticeConfig.getOverEvent()) {
|
||||
// _log("创建即出发提醒事件");
|
||||
sendEvent(entity, 8, flowTimeModel);
|
||||
}
|
||||
addNum(entity.getTaskNodeOperatorId(), 0);//有执行则次数加1
|
||||
}
|
||||
for (int n = 0; n <= noticeTimes; n++) {
|
||||
Date whileTime = DateUtil.dateAddHours(warnStartTime, warnInterval * n);
|
||||
if (testFlag) {
|
||||
//假设以1分钟代替一个小时,
|
||||
whileTime = DateUtil.dateAddMinutes(warnStartTime, warnInterval * n);
|
||||
}
|
||||
// _log("提醒任务: {}-第{}次提醒时间循环: {}", entity.getTaskNodeOperatorId(), (n + 1), DateUtil.dateFormat(whileTime));
|
||||
if (isTimeTask && thisTime.compareTo(whileTime) == 0) {//定时器提醒时间
|
||||
int finalN = n;
|
||||
TimeModel finalNoticeConfig1 = noticeConfig;
|
||||
Runnable resetExpire = () -> {
|
||||
FlowTaskOperatorEntity operatorNow = null;
|
||||
if (isTimeTask) {
|
||||
operatorNow = onTimeCheckOperatorHave(entity, 0);
|
||||
} else {
|
||||
operatorNow = entity.getOperatorEntity();
|
||||
}
|
||||
if (operatorNow == null) return;
|
||||
//todo 提醒事件
|
||||
if (finalNoticeConfig1.getOverEvent() && finalNoticeConfig1.getOverEventTime() == (finalN + 1)) {
|
||||
// _log("提醒任务: {}-第{}次进入提醒事件", entity.getTaskNodeOperatorId(), (finalN + 1));
|
||||
sendEvent(entity, 8, flowTimeModel);
|
||||
}
|
||||
//todo 提醒通知
|
||||
if (finalNoticeConfig1.getOverNotice()) {
|
||||
// _log("提醒任务: {}-第{}次的提醒通知", entity.getTaskNodeOperatorId(), (finalN + 1));
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList();
|
||||
list.add(operatorNow);
|
||||
sendMessge(true, flowTask, templateAllModel, taskNodeList, flowTaskNodeEntity, list, flowModel);
|
||||
}
|
||||
addNum(entity.getTaskNodeOperatorId(), 0);
|
||||
};
|
||||
this.runScheduleTask(resetExpire, delayTime, entity.getTaskNodeOperatorId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动审批
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/10
|
||||
*/
|
||||
private void autoApprove(FlowTaskOperatorEntity operatorNow, List<FlowTaskNodeEntity> taskNodeList, FlowTaskEntity flowTask, FlowModel flowModel) {
|
||||
operatorNow.setAutomation("1");
|
||||
FlowTaskEntity infoSubmit = flowTaskService.getInfoSubmit(flowTask.getId(), FlowTaskEntity::getStatus);
|
||||
if (infoSubmit != null && !FlowTaskStatusEnum.Suspend.getCode().equals(infoSubmit.getStatus())) {
|
||||
List<FlowTaskOperatorEntity> list = new ArrayList<>();
|
||||
list.add(operatorNow);
|
||||
FlowApproveModel approveModel = FlowApproveModel.builder().operatorList(list).taskNodeList(taskNodeList).flowTask(flowTask).flowModel(flowModel).build();
|
||||
flowTaskOperatorService.update(operatorNow);
|
||||
userInfoMap.put(operatorNow.getTaskId(), approveModel);
|
||||
}
|
||||
}
|
||||
|
||||
private FlowTaskOperatorEntity onTimeCheckOperatorHave(WorkTimeoutJobModel entity, Integer type) {
|
||||
FlowTaskOperatorEntity operatorNow = flowTaskOperatorService.getOperatorInfo(entity.getTaskNodeOperatorId());
|
||||
if (operatorNow == null || operatorNow.getCompletion() != 0 || operatorNow.getState() != 0) {
|
||||
removeTaskOperatorEntities(entity);
|
||||
return null;
|
||||
}
|
||||
String hashValues = redisUtil.getHashValues(this.WORKTIMEOUT_REDIS_KEY, entity.getTaskNodeOperatorId());
|
||||
WorkTimeoutJobModel workTimeoutJobModel = JsonUtil.getJsonToBean(hashValues, WorkTimeoutJobModel.class);
|
||||
if (workTimeoutJobModel == null) {
|
||||
return null;
|
||||
}
|
||||
if (type == 1 && !entity.getOvertimeNum().equals(workTimeoutJobModel.getOvertimeNum())) {//判断redis被取用之后是否被改变,被改变这次不执行
|
||||
return null;
|
||||
}
|
||||
if (type == 0 && !entity.getCounter().equals(workTimeoutJobModel.getCounter())) {//判断redis被取用之后是否被改变,被改变这次不执行
|
||||
return null;
|
||||
}
|
||||
return operatorNow;
|
||||
}
|
||||
|
||||
|
||||
private void removeTaskOperatorEntities(WorkTimeoutJobModel entity) {
|
||||
//已处理任务移除缓存
|
||||
redisUtil.removeHash(this.WORKTIMEOUT_REDIS_KEY, entity.getTaskNodeOperatorId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行缓存次数加一
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/8
|
||||
*/
|
||||
private void addNum(String operatorId, Integer type) {
|
||||
//执行没有问题,缓存替换次数加一 type:0-提醒,1-超时
|
||||
String hashValues = redisUtil.getHashValues(WORKTIMEOUT_REDIS_KEY, operatorId);
|
||||
WorkTimeoutJobModel entity = JsonUtil.getJsonToBean(hashValues, WorkTimeoutJobModel.class);
|
||||
if (type == 0) {
|
||||
Integer counter = entity.getCounter() == null ? 1 : entity.getCounter() + 1;
|
||||
entity.setCounter(counter);
|
||||
} else {
|
||||
Integer overtimenum = entity.getOvertimeNum() == null ? 1 : entity.getOvertimeNum() + 1;
|
||||
entity.setOvertimeNum(overtimenum);
|
||||
}
|
||||
String objectToString = JsonUtil.getObjectToString(entity);
|
||||
redisUtil.insertHash(WORKTIMEOUT_REDIS_KEY, entity.getTaskNodeOperatorId(), objectToString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送事件
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/21
|
||||
*/
|
||||
private void sendEvent(WorkTimeoutJobModel entity, int status, FlowTimeModel flowTimeModel) {
|
||||
// _log("进入事件调用");
|
||||
//节点事件
|
||||
FlowTaskOperatorRecordEntity operatorRecord = new FlowTaskOperatorRecordEntity();
|
||||
operatorRecord.setTaskNodeId(entity.getTaskNodeId());
|
||||
operatorRecord.setTaskId(entity.getTaskId());
|
||||
FlowTaskEntity infoSubmit = flowTaskService.getInfoSubmit(entity.getTaskId(), FlowTaskEntity::getStatus);
|
||||
if (infoSubmit != null && !FlowTaskStatusEnum.Suspend.getCode().equals(infoSubmit.getStatus())) {
|
||||
UserInfo userInfo = entity.getFlowModel().getUserInfo();
|
||||
String token = AuthUtil.loginTempUser(userInfo.getUserId(), userInfo.getTenantId(), true);
|
||||
userInfo = UserProvider.getUser(token);
|
||||
UserProvider.setLocalLoginUser(userInfo);
|
||||
flowMsgUtil.event(status, flowTimeModel.getChildNodeEvnet(), operatorRecord, entity.getFlowModel());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/6/21
|
||||
*/
|
||||
@Async
|
||||
public void sendMessge(boolean isNotice, FlowTaskEntity flowTask, FlowTemplateAllModel templateAllModel, List<FlowTaskNodeEntity> taskNodeList, FlowTaskNodeEntity flowTaskNodeEntity, List<FlowTaskOperatorEntity> list, FlowModel flowModel) {
|
||||
//发送流程消息
|
||||
FlowMsgModel flowMsgModel = new FlowMsgModel();
|
||||
flowMsgModel.setWait(false);
|
||||
if (isNotice) {
|
||||
flowMsgModel.setNotice(true);
|
||||
} else {
|
||||
flowMsgModel.setOvertime(true);
|
||||
}
|
||||
flowMsgModel.setCirculateList(new ArrayList<>());
|
||||
flowMsgModel.setNodeList(taskNodeList);
|
||||
flowMsgModel.setOperatorList(list);
|
||||
flowMsgModel.setTaskEntity(flowTask);
|
||||
flowMsgModel.setTaskNodeEntity(flowTaskNodeEntity);
|
||||
flowMsgModel.setFlowTemplateAllModel(templateAllModel);
|
||||
flowMsgModel.setData(JsonUtil.stringToMap(flowTask.getFlowFormContentJson()));
|
||||
flowMsgModel.setFlowModel(flowModel);
|
||||
FlowTaskEntity infoSubmit = flowTaskService.getInfoSubmit(flowTask.getId(), FlowTaskEntity::getStatus);
|
||||
if (infoSubmit != null && !FlowTaskStatusEnum.Suspend.getCode().equals(infoSubmit.getStatus())) {
|
||||
try {
|
||||
flowMsgUtil.message(flowMsgModel);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void runScheduleTask(Runnable runnable, long delayTime, String operatorId) {
|
||||
ScheduledFuture schedule = scheduledThreadPoolExecutor.schedule(runnable, delayTime / 1000, TimeUnit.SECONDS);
|
||||
addFuture(operatorId, schedule);
|
||||
}
|
||||
|
||||
private void _log(String msg, Object... args) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(msg, args);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFuture(String operatorId, ScheduledFuture future) {
|
||||
List<ScheduledFuture> scheduledFutures = futureList.get(operatorId) != null ? futureList.get(operatorId) : new ArrayList<>();
|
||||
scheduledFutures.add(future);
|
||||
futureList.put(operatorId, scheduledFutures);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operatorList
|
||||
* @param isSuspend true 挂起 false 恢复
|
||||
*/
|
||||
public void suspendFuture(List<FlowTaskOperatorEntity> operatorList, boolean isSuspend) {
|
||||
for (FlowTaskOperatorEntity entity : operatorList) {
|
||||
// List<ScheduledFuture> scheduledFutures = futureList.get(entity.getId()) != null ? futureList.get(entity.getId()) : new ArrayList<>();
|
||||
// for (ScheduledFuture scheduledFuture : scheduledFutures) {
|
||||
// scheduledFuture.cancel(true);
|
||||
// }
|
||||
// futureList.remove(entity.getId());
|
||||
String hashValues = redisUtil.getHashValues(WORKTIMEOUT_REDIS_KEY, entity.getId());
|
||||
if (StringUtil.isNotEmpty(hashValues)) {
|
||||
WorkTimeoutJobModel workTimeoutJobModel = JsonUtil.getJsonToBean(hashValues, WorkTimeoutJobModel.class);
|
||||
workTimeoutJobModel.setSuspend(isSuspend);
|
||||
String objectToString = JsonUtil.getObjectToString(workTimeoutJobModel);
|
||||
redisUtil.insertHash(WORKTIMEOUT_REDIS_KEY, workTimeoutJobModel.getTaskNodeOperatorId(), objectToString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void approveModel(RedisTemplate redisTemplate) {
|
||||
List<String> idList = new ArrayList<>();
|
||||
for (String key : userInfoMap.keySet()) {
|
||||
try {
|
||||
boolean useSuccess = redisTemplate.opsForValue().setIfAbsent(AutoApproveJob.autoApprove + "_key:" + key, System.currentTimeMillis(), 300, TimeUnit.SECONDS);
|
||||
if (!useSuccess) continue;
|
||||
FlowApproveModel approveModel = userInfoMap.get(key);
|
||||
UserInfo userInfo = approveModel.getFlowModel().getUserInfo();
|
||||
//切换数据库
|
||||
if (configValueUtil.isMultiTenancy()) {
|
||||
TenantDataSourceUtil.switchTenant(userInfo.getTenantId());
|
||||
}
|
||||
FlowTaskEntity taskEntity = flowTaskService.getInfo(key);
|
||||
List<FlowTaskOperatorEntity> list = flowTaskOperatorService.getList(key).stream().filter(t -> FlowNature.ProcessCompletion.equals(t.getCompletion()) && FlowNodeEnum.Process.getCode().equals(t.getState()) && "1".equals(t.getAutomation())).collect(Collectors.toList());
|
||||
approveModel.setOperatorList(list);
|
||||
approveModel.setFlowTask(taskEntity);
|
||||
flowTaskUtil.approve(approveModel);
|
||||
FlowTaskEntity info = flowTaskService.getInfoSubmit(key, FlowTaskEntity::getStatus);
|
||||
boolean isAdd = !FlowTaskStatusEnum.Handle.getCode().equals(info.getStatus());
|
||||
if (isAdd) {
|
||||
idList.add(key);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
} finally {
|
||||
idList.add(key);
|
||||
redisTemplate.delete(AutoApproveJob.autoApprove + "_key:" + key);
|
||||
}
|
||||
}
|
||||
for (String key : idList) {
|
||||
userInfoMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
package com.yunzhupaas.util;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.Pagination;
|
||||
import com.yunzhupaas.base.entity.DataInterfaceEntity;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.model.flow.FlowFormDataModel;
|
||||
import com.yunzhupaas.base.service.BillRuleService;
|
||||
import com.yunzhupaas.base.service.DataInterfaceService;
|
||||
import com.yunzhupaas.base.service.DictionaryDataService;
|
||||
import com.yunzhupaas.base.util.SentMessageUtil;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.emnus.ModuleTypeEnum;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowExportModel;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.message.model.SentMessageForm;
|
||||
import com.yunzhupaas.message.service.SendMessageConfigService;
|
||||
import com.yunzhupaas.permission.entity.*;
|
||||
import com.yunzhupaas.permission.model.organizeadministrator.OrganizeAdministratorModel;
|
||||
import com.yunzhupaas.permission.service.*;
|
||||
import com.yunzhupaas.util.enums.DictionaryDataEnum;
|
||||
import com.yunzhupaas.visual.service.VisualdevApi;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.yunzhupaas.util.Constants.ADMIN_KEY;
|
||||
|
||||
/**
|
||||
* @author :云筑产品开发平台组
|
||||
* @version: V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date :2022/4/9 13:28
|
||||
*/
|
||||
@Component
|
||||
@DS("")
|
||||
public class ServiceAllUtil {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DictionaryDataService dictionaryDataService;
|
||||
@Autowired
|
||||
private UserRelationService userRelationService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private OrganizeService organizeService;
|
||||
@Autowired
|
||||
private OrganizeAdministratorService organizeAdministratorService;
|
||||
@Autowired
|
||||
private PositionService positionService;
|
||||
@Autowired
|
||||
private BillRuleService billRuleService;
|
||||
@Autowired
|
||||
private DataInterfaceService dataInterfaceService;
|
||||
@Autowired
|
||||
private SentMessageUtil sentMessageUtil;
|
||||
@Autowired
|
||||
private SendMessageConfigService sendMessageConfigService;
|
||||
@Autowired
|
||||
private DataFileExport fileExport;
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
//--------------------------------数据字典------------------------------
|
||||
public List<DictionaryDataEntity> getDiList() {
|
||||
List<DictionaryDataEntity> dictionList = dictionaryDataService.getListByTypeDataCode(DictionaryDataEnum.FLOWWOEK_ENGINE.getDictionaryTypeId());
|
||||
return dictionList;
|
||||
}
|
||||
|
||||
public List<DictionaryDataEntity> getDictionName(List<String> id) {
|
||||
List<DictionaryDataEntity> dictionList = dictionaryDataService.getDictionName(id);
|
||||
return dictionList;
|
||||
}
|
||||
|
||||
//--------------------------------用户关系表------------------------------
|
||||
public List<UserRelationEntity> getListByUserIdAll(List<String> id) {
|
||||
List<UserRelationEntity> list = userRelationService.getListByUserIdAll(id).stream().filter(t -> StringUtil.isNotEmpty(t.getObjectId())).collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<UserRelationEntity> getListByObjectIdAll(List<String> id) {
|
||||
List<UserRelationEntity> list = userRelationService.getListByObjectIdAll(id);
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getAdmin() {
|
||||
UserEntity admin = userService.getUserByAccount(ADMIN_KEY);
|
||||
return admin.getId();
|
||||
}
|
||||
|
||||
//--------------------------------用户------------------------------
|
||||
public List<UserEntity> getUserName(List<String> id) {
|
||||
List<UserEntity> list = getUserName(id, false);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<UserEntity> getListByManagerId(String managerId) {
|
||||
List<UserEntity> list = StringUtil.isNotEmpty(managerId) ? userService.getListByManagerId(managerId, null) : new ArrayList<>();
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<UserEntity> getUserName(List<String> id, boolean enableMark) {
|
||||
List<UserEntity> list = userService.getUserName(id);
|
||||
if (enableMark) list = list.stream().filter(t -> t.getEnabledMark() != 0).collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<UserEntity> getUserName(List<String> id, Pagination pagination) {
|
||||
List<UserEntity> list = userService.getUserName(id, pagination);
|
||||
return list;
|
||||
}
|
||||
|
||||
public UserEntity getUserInfo(String id) {
|
||||
UserEntity entity = null;
|
||||
if (StringUtil.isNotEmpty(id)) {
|
||||
entity = id.equalsIgnoreCase(ADMIN_KEY) ? userService.getUserByAccount(id) : userService.getInfo(id);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public List<String> getUserListAll(List<String> idList) {
|
||||
List<String> userIdList = userService.getUserIdList(idList, null);
|
||||
return userIdList;
|
||||
}
|
||||
|
||||
public List<String> getOrganizeUserList(String type) {
|
||||
OrganizeAdministratorModel model = organizeAdministratorService.getOrganizeAdministratorList();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
map.put("select", model.getSelectList());
|
||||
map.put("add", model.getAddList());
|
||||
map.put("delete", model.getDeleteList());
|
||||
map.put("edit", model.getEditList());
|
||||
List<String> list = map.get(type) != null ? map.get(type) : new ArrayList<>();
|
||||
List<String> userList = userRelationService.getListByObjectIdAll(list).stream().map(UserRelationEntity::getUserId).collect(Collectors.toList());
|
||||
return userList;
|
||||
}
|
||||
|
||||
//--------------------------------单据规则------------------------------
|
||||
|
||||
public void useBillNumber(String enCode) {
|
||||
billRuleService.useBillNumber(enCode);
|
||||
}
|
||||
|
||||
//--------------------------------角色------------------------------
|
||||
public List<RoleEntity> getListByIds(List<String> id) {
|
||||
List<RoleEntity> list = roleService.getListByIds(id, null, false);
|
||||
return list;
|
||||
}
|
||||
|
||||
//--------------------------------组织------------------------------
|
||||
public List<OrganizeEntity> getOrganizeName(List<String> id) {
|
||||
List<OrganizeEntity> list = organizeService.getOrganizeName(id);
|
||||
return list;
|
||||
}
|
||||
|
||||
public OrganizeEntity getOrganizeInfo(String id) {
|
||||
OrganizeEntity entity = StringUtil.isNotEmpty(id) ? organizeService.getInfo(id) : null;
|
||||
return entity;
|
||||
}
|
||||
|
||||
public List<OrganizeEntity> getOrganizeId(String organizeId) {
|
||||
List<OrganizeEntity> organizeList = new ArrayList<>();
|
||||
organizeService.getOrganizeId(organizeId, organizeList);
|
||||
Collections.reverse(organizeList);
|
||||
return organizeList;
|
||||
}
|
||||
|
||||
public List<OrganizeEntity> getDepartmentAll(String organizeId) {
|
||||
List<OrganizeEntity> departmentAll = organizeService.getDepartmentAll(organizeId);
|
||||
return departmentAll;
|
||||
}
|
||||
|
||||
//--------------------------------岗位------------------------------
|
||||
public List<PositionEntity> getPositionName(List<String> id) {
|
||||
List<PositionEntity> list = positionService.getPositionName(id, false);
|
||||
return list;
|
||||
}
|
||||
|
||||
//--------------------------------远端------------------------------
|
||||
public ActionResult infoToId(String interId, Map<String, String> parameterMap) {
|
||||
return dataInterfaceService.infoToId(interId, null, parameterMap);
|
||||
}
|
||||
|
||||
public List<DataInterfaceEntity> getInterfaceList(List<String> id) {
|
||||
return dataInterfaceService.getList(id);
|
||||
}
|
||||
|
||||
//--------------------------------发送消息------------------------------
|
||||
public void sendMessage(List<SentMessageForm> messageListAll) {
|
||||
for (SentMessageForm messageForm : messageListAll)
|
||||
if (messageForm.isSysMessage()) sentMessageUtil.sendMessage(messageForm);
|
||||
}
|
||||
|
||||
public void updateSendConfigUsed(String id, List<String> idList) {
|
||||
sendMessageConfigService.updateUsed(id, idList);
|
||||
}
|
||||
|
||||
public void sendDelegateMsg(List<SentMessageForm> messageListAll) {
|
||||
for (SentMessageForm messageForm : messageListAll) {
|
||||
sentMessageUtil.sendDelegateMsg(messageForm);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------导出-------------------------------
|
||||
public DownloadVO exportData(FlowExportModel model) {
|
||||
DownloadVO downloadVO = fileExport.exportFile(model, configValueUtil.getTemporaryFilePath(), model.getFlowTemplate().getFullName(), ModuleTypeEnum.FLOW_FLOWENGINE.getTableName());
|
||||
return downloadVO;
|
||||
}
|
||||
|
||||
//------------------------------表单数据-------------------------------
|
||||
public void createOrUpdate(FlowFormDataModel flowFormDataModel) throws WorkFlowException {
|
||||
//todo 流程调用表单接口
|
||||
// formDataService.saveOrUpdate(flowFormDataModel);
|
||||
}
|
||||
|
||||
public Map<String, Object> infoData(String formId, String id) throws WorkFlowException {
|
||||
//todo 流程调用表单接口
|
||||
Map<String, Object> dataAll = new HashMap<>();
|
||||
// if (StringUtil.isNotEmpty(formId) && StringUtil.isNotEmpty(id)) {
|
||||
// Map<String, Object> info = new HashMap<>();
|
||||
// ActionResult result = formDataService.info(formId, id);
|
||||
// if (result.getCode() != 200) {
|
||||
// throw new WorkFlowException(result.getMsg());
|
||||
// }
|
||||
// if (result.getData() instanceof Map) {
|
||||
// info.putAll((Map) result.getData());
|
||||
// }
|
||||
// dataAll.putAll(info);
|
||||
// }
|
||||
return dataAll;
|
||||
}
|
||||
|
||||
//------------------------------表单对象-------------------------------
|
||||
public VisualdevEntity getForm(String id) {
|
||||
//todo 流程调用表单接口
|
||||
// FlowFormEntity form = StringUtil.isNotEmpty(id) ? flowFormService.getById(id) : null;
|
||||
// return form;
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<VisualdevEntity> getFlowIdList(String id) {
|
||||
// List<FlowFormEntity> list = StringUtil.isNotEmpty(id) ? flowFormService.getFlowIdList(id) : new ArrayList<>();
|
||||
// return list;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateForm(VisualdevEntity entity) {
|
||||
// flowFormService.updateForm(entity);
|
||||
}
|
||||
|
||||
public void formIdList(List<String> formId, String tempJsonId) {
|
||||
// flowFormRelationService.saveFlowIdByFormIds(tempJsonId, formId);
|
||||
}
|
||||
|
||||
public void deleteFormId(String tempJsonId) {
|
||||
// flowFormRelationService.saveFlowIdByFormIds(tempJsonId, new ArrayList<>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yunzhupaas-workflow-engine</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-workflow-engine-controller</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-workflow-engine-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,806 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.constant.PermissionConst;
|
||||
import com.yunzhupaas.engine.entity.*;
|
||||
import com.yunzhupaas.engine.enums.FlowNodeEnum;
|
||||
import com.yunzhupaas.engine.enums.FlowRecordEnum;
|
||||
import com.yunzhupaas.engine.enums.FlowTaskStatusEnum;
|
||||
import com.yunzhupaas.engine.model.flowbefore.*;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateUserModel;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateVO;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowRejectVO;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.ChildNode;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ChildNodeList;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ConditionList;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowTaskListModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.PaginationFlowTask;
|
||||
import com.yunzhupaas.engine.model.flowtask.TaskNodeModel;
|
||||
import com.yunzhupaas.engine.model.flowtasknode.TaskNodeListModel;
|
||||
import com.yunzhupaas.engine.service.*;
|
||||
import com.yunzhupaas.engine.util.FlowJsonUtil;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.engine.util.FlowTaskUtil;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.entity.UserRelationEntity;
|
||||
import com.yunzhupaas.permission.model.user.UserIdListVo;
|
||||
import com.yunzhupaas.permission.service.UserService;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.ServiceAllUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 待我审核
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "待我审核", description = "FlowBefore")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/FlowBefore")
|
||||
public class FlowBeforeController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
|
||||
@Autowired
|
||||
private FlowTaskUtil flowTaskUtil;
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private FlowTemplateJsonService flowTemplateJsonService;
|
||||
@Autowired
|
||||
private FlowTaskOperatorService flowTaskOperatorService;
|
||||
@Autowired
|
||||
private FlowTaskOperatorRecordService flowTaskOperatorRecordService;
|
||||
@Autowired
|
||||
private FlowTaskNodeService flowTaskNodeService;
|
||||
@Autowired
|
||||
private FlowTaskNewService flowTaskNewService;
|
||||
@Autowired
|
||||
private FlowOperatorUserService flowOperatorUserService;
|
||||
@Autowired
|
||||
private FlowTaskCirculateService flowTaskCirculateService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 获取待我审核列表
|
||||
*
|
||||
* @param category 分类
|
||||
* @param paginationFlowTask 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取待我审核列表(有带分页),1-待办事宜,2-已办事宜,3-抄送事宜,4-批量审批")
|
||||
@GetMapping("/List/{category}")
|
||||
@Parameters({
|
||||
@Parameter(name = "category", description = "分类", required = true),
|
||||
})
|
||||
public ActionResult<PageListVO<FlowBeforeListVO>> list(@PathVariable("category") String category, PaginationFlowTask paginationFlowTask) {
|
||||
List<FlowTaskListModel> data = new ArrayList<>();
|
||||
paginationFlowTask.setDelegateType(true);
|
||||
if (FlowNature.WAIT.equals(category)) {
|
||||
data.addAll(flowTaskService.getWaitList(paginationFlowTask));
|
||||
} else if (FlowNature.TRIAL.equals(category)) {
|
||||
data.addAll(flowTaskService.getTrialList(paginationFlowTask));
|
||||
} else if (FlowNature.CIRCULATE.equals(category)) {
|
||||
data.addAll(flowTaskService.getCirculateList(paginationFlowTask));
|
||||
} else if (FlowNature.BATCH.equals(category)) {
|
||||
paginationFlowTask.setIsBatch(1);
|
||||
data.addAll(flowTaskService.getWaitList(paginationFlowTask));
|
||||
}
|
||||
List<FlowBeforeListVO> listVO = new LinkedList<>();
|
||||
List<UserEntity> userList = serviceUtil.getUserName(data.stream().map(FlowTaskListModel::getCreatorUserId).collect(Collectors.toList()));
|
||||
boolean isBatch = FlowNature.BATCH.equals(category);
|
||||
List<FlowTaskNodeEntity> taskNodeList = new ArrayList<>();
|
||||
List<String> taskNodeIdList = data.stream().map(FlowTaskListModel::getThisStepId).collect(Collectors.toList());
|
||||
if (isBatch) {
|
||||
taskNodeList.addAll(flowTaskNodeService.getList(taskNodeIdList, FlowTaskNodeEntity::getId, FlowTaskNodeEntity::getNodePropertyJson));
|
||||
}
|
||||
for (FlowTaskListModel task : data) {
|
||||
FlowBeforeListVO vo = JsonUtil.getJsonToBean(task, FlowBeforeListVO.class);
|
||||
//用户名称赋值
|
||||
UserEntity user = userList.stream().filter(t -> t.getId().equals(vo.getCreatorUserId())).findFirst().orElse(null);
|
||||
vo.setUserName(user != null ? user.getRealName() + "/" + user.getAccount() : "");
|
||||
FlowTaskNodeEntity taskNode = taskNodeList.stream().filter(t -> t.getId().equals(task.getThisStepId())).findFirst().orElse(null);
|
||||
if (isBatch && taskNode != null) {
|
||||
ChildNodeList childNode = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
vo.setApproversProperties(JsonUtil.getObjectToString(childNode.getProperties()));
|
||||
}
|
||||
vo.setFlowVersion(StringUtil.isEmpty(vo.getFlowVersion()) ? "" : vo.getFlowVersion());
|
||||
listVO.add(vo);
|
||||
}
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationFlowTask, PaginationVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待我审批信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取待我审批信息")
|
||||
@GetMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<FlowBeforeInfoVO> info(@PathVariable("id") String id, FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setId(id);
|
||||
FlowBeforeInfoVO vo = flowTaskNewService.getBeforeInfo(flowModel);
|
||||
//处理当前默认值
|
||||
if (vo != null && vo.getFlowFormInfo() != null && StringUtil.isNotEmpty(vo.getFlowFormInfo().getPropertyJson()) && vo.getFlowFormInfo().getFormType() == 2) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
Map<String, Integer> havaDefaultCurrentValue = new HashMap<>();
|
||||
vo.getFlowFormInfo().setPropertyJson(setDefaultCurrentValue(vo.getFlowFormInfo().getPropertyJson(), havaDefaultCurrentValue, userInfo));
|
||||
}
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核审核
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "待我审核审核")
|
||||
@PostMapping("/Audit/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult audit(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setId(id);
|
||||
flowTaskNewService.audit(flowModel);
|
||||
return ActionResult.success(MsgCode.WF001.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存草稿
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "保存草稿")
|
||||
@PostMapping("/SaveAudit/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult saveAudit(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
FlowTaskOperatorEntity flowTaskOperatorEntity = flowTaskOperatorService.getInfo(id);
|
||||
if (flowTaskOperatorEntity != null) {
|
||||
Map<String, Object> formDataAll = flowModel.getFormData();
|
||||
flowTaskOperatorEntity.setDraftData(JsonUtil.getObjectToString(formDataAll));
|
||||
flowTaskOperatorService.update(flowTaskOperatorEntity);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批汇总
|
||||
*
|
||||
* @param id 主键
|
||||
* @param category 类型
|
||||
* @param type 类型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "审批汇总")
|
||||
@GetMapping("/RecordList/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<List<FlowSummary>> recordList(@PathVariable("id") String id, String category, String type) {
|
||||
List<FlowSummary> flowSummaries = flowTaskNewService.recordList(id, category, type);
|
||||
return ActionResult.success(flowSummaries);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核驳回
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "待我审核驳回")
|
||||
@PostMapping("/Reject/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult reject(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setId(id);
|
||||
flowTaskNewService.reject(flowModel);
|
||||
return ActionResult.success(MsgCode.WF002.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核转办
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "待我审核转办")
|
||||
@PostMapping("/Transfer/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult transfer(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setId(id);
|
||||
flowTaskNewService.transfer(flowModel);
|
||||
return ActionResult.success(MsgCode.WF003.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核转办
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "待我审核加签")
|
||||
@PostMapping("/freeApprover/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult freeApprover(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setId(id);
|
||||
flowTaskNewService.audit(flowModel);
|
||||
return ActionResult.success(MsgCode.WF004.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核撤回审核
|
||||
* 注意:在撤销流程时要保证你的下一节点没有处理这条记录;如已处理则无法撤销流程。
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "待我审核撤回审核")
|
||||
@PostMapping("/Recall/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult recall(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
FlowTaskOperatorRecordEntity operatorRecord = flowTaskOperatorRecordService.getInfo(id);
|
||||
FlowTaskNodeEntity taskNode = flowTaskNodeService.getInfo(operatorRecord.getTaskNodeId(), FlowTaskNodeEntity::getId);
|
||||
//拒绝不撤回
|
||||
if (FlowNature.ProcessCompletion.equals(operatorRecord.getHandleStatus())) {
|
||||
throw new WorkFlowException(MsgCode.WF005.get());
|
||||
}
|
||||
if (taskNode == null) {
|
||||
return ActionResult.fail(MsgCode.WF006.get());
|
||||
}
|
||||
if (FlowRecordEnum.swerve.getCode().equals(operatorRecord.getHandleStatus())) {
|
||||
return ActionResult.fail(MsgCode.WF007.get());
|
||||
}
|
||||
if (FlowRecordEnum.revoke.getCode().equals(operatorRecord.getStatus())) {
|
||||
return ActionResult.fail(MsgCode.WF006.get());
|
||||
}
|
||||
if (taskNode != null && !FlowRecordEnum.revoke.getCode().equals(operatorRecord.getStatus())) {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowTaskNewService.recall(id, operatorRecord, flowModel);
|
||||
}
|
||||
return ActionResult.success(MsgCode.WF008.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核终止审核
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "待我审核终止审核")
|
||||
@PostMapping("/Cancel/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult cancel(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
FlowTaskEntity entity = flowTaskService.getInfo(id, FlowTaskEntity::getFlowType);
|
||||
if (entity != null) {
|
||||
if (Objects.equals(entity.getFlowType(), 1)) {
|
||||
return ActionResult.fail(MsgCode.WF009.get());
|
||||
}
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
List<String> idList = ImmutableList.of(id);
|
||||
flowTaskNewService.cancel(idList, flowModel);
|
||||
return ActionResult.success(MsgCode.SU005.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA009.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指派人
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "指派人")
|
||||
@PostMapping("/Assign/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult assign(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowTaskNewService.assign(id, flowModel);
|
||||
return ActionResult.success(MsgCode.WF010.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取候选人
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取候选人节点")
|
||||
@PostMapping("/Candidates/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult<FlowCandidateVO> candidates(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
FlowCandidateVO candidate = flowTaskNewService.candidates(id, flowModel, false);
|
||||
return ActionResult.success(candidate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取候选人
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取候选人")
|
||||
@PostMapping("/CandidateUser/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult<PageListVO<FlowCandidateUserModel>> candidateUser(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
List<FlowCandidateUserModel> candidate = flowTaskNewService.candidateUser(id, flowModel);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(flowModel, PaginationVO.class);
|
||||
return ActionResult.page(candidate, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审批引擎
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "批量审批引擎")
|
||||
@GetMapping("/BatchFlowSelector")
|
||||
public ActionResult<List<FlowBatchModel>> batchFlowSelector() {
|
||||
List<FlowBatchModel> batchFlowList = flowTaskService.batchFlowSelector();
|
||||
return ActionResult.success(batchFlowList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝下拉框
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "拒绝下拉框")
|
||||
@GetMapping("/RejectList/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<FlowRejectVO> rejectList(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowRejectVO vo = flowTaskNewService.rejectList(id, false);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 引擎节点
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
@Operation(summary = "引擎节点")
|
||||
@GetMapping("/NodeSelector/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<List<FlowBatchModel>> nodeSelector(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateAllModel template = flowTaskUtil.templateJson(id);
|
||||
String templateJson = template.getTemplateJson().getFlowTemplateJson();
|
||||
List<FlowBatchModel> batchList = new ArrayList<>();
|
||||
ChildNode childNodeAll = JsonUtil.getJsonToBean(templateJson, ChildNode.class);
|
||||
//获取流程节点
|
||||
List<ChildNodeList> nodeListAll = new ArrayList<>();
|
||||
List<ConditionList> conditionListAll = new ArrayList<>();
|
||||
//递归获取条件数据和节点数据
|
||||
FlowJsonUtil.getTemplateAll(childNodeAll, nodeListAll, conditionListAll);
|
||||
List<String> type = ImmutableList.of(FlowNature.NodeSubFlow, FlowNature.NodeStart);
|
||||
for (ChildNodeList childNodeList : nodeListAll) {
|
||||
if (!type.contains(childNodeList.getCustom().getType())) {
|
||||
FlowBatchModel batchModel = new FlowBatchModel();
|
||||
batchModel.setFullName(childNodeList.getProperties().getTitle());
|
||||
batchModel.setId(childNodeList.getCustom().getNodeId());
|
||||
batchList.add(batchModel);
|
||||
}
|
||||
}
|
||||
return ActionResult.success(batchList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程批量类型下拉
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
@Operation(summary = "流程批量类型下拉")
|
||||
@GetMapping("/BatchFlowJsonList/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<List<FlowBatchModel>> batchFlowJsonList(@PathVariable("id") String id) {
|
||||
List<String> taskIdList = flowTaskOperatorService.getBatchList().stream().map(FlowTaskOperatorEntity::getTaskId).collect(Collectors.toList());
|
||||
List<FlowTaskEntity> taskListAll = flowTaskService.getOrderStaList(taskIdList);
|
||||
List<String> flowIdList = taskListAll.stream().filter(t -> t.getTemplateId().equals(id)).map(FlowTaskEntity::getFlowId).collect(Collectors.toList());
|
||||
List<FlowTemplateJsonEntity> templateJsonList = flowTemplateJsonService.getTemplateJsonList(flowIdList);
|
||||
List<FlowBatchModel> listVO = new ArrayList<>();
|
||||
for (FlowTemplateJsonEntity entity : templateJsonList) {
|
||||
FlowBatchModel vo = JsonUtil.getJsonToBean(entity, FlowBatchModel.class);
|
||||
vo.setFullName(vo.getFullName() + "(v" + entity.getVersion() + ")");
|
||||
listVO.add(vo);
|
||||
}
|
||||
return ActionResult.success(listVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审批
|
||||
*
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "批量审批")
|
||||
@PostMapping("/BatchOperation")
|
||||
@Parameters({
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult batchOperation(@RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowTaskNewService.batch(flowModel);
|
||||
return ActionResult.success(MsgCode.WF011.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取候选人
|
||||
*
|
||||
* @param flowId 流程主键
|
||||
* @param taskOperatorId 代办主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
@Operation(summary = "批量获取候选人")
|
||||
@GetMapping("/BatchCandidate")
|
||||
public ActionResult<FlowCandidateVO> batchCandidate(String flowId, String taskOperatorId) throws WorkFlowException {
|
||||
FlowModel flowModel = new FlowModel();
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowModel.setFlowId(flowId);
|
||||
FlowCandidateVO candidate = flowTaskNewService.batchCandidates(flowId, taskOperatorId, flowModel);
|
||||
return ActionResult.success(candidate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息跳转工作流
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "消息跳转工作流")
|
||||
@GetMapping("/{id}/Info")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult taskOperatorId(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTaskOperatorEntity operator = flowTaskOperatorService.getInfo(id);
|
||||
FlowTaskEntity flowTask = flowTaskService.getInfo(operator.getTaskId());
|
||||
FlowModel flowModel = new FlowModel();
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowTaskNewService.permissions(operator.getHandleId(), flowTask, operator, "", flowModel);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (!FlowNature.ProcessCompletion.equals(operator.getCompletion())) {
|
||||
map.put("isCheck", true);
|
||||
} else {
|
||||
map.put("isCheck", false);
|
||||
}
|
||||
return ActionResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 节点下拉框
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "节点下拉框")
|
||||
@GetMapping("/Selector/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<List<TaskNodeModel>> selector(@PathVariable("id") String id) {
|
||||
List<String> nodetype = ImmutableList.of(FlowNature.NodeStart, FlowNature.NodeSubFlow, FlowNature.EndRound);
|
||||
TaskNodeListModel nodeListModel = TaskNodeListModel.builder().id(id).state(FlowNodeEnum.Process.getCode()).build();
|
||||
List<FlowTaskNodeEntity> list = flowTaskNodeService.getList(nodeListModel,
|
||||
FlowTaskNodeEntity::getId, FlowTaskNodeEntity::getCandidates,
|
||||
FlowTaskNodeEntity::getCompletion, FlowTaskNodeEntity::getNodeType,
|
||||
FlowTaskNodeEntity::getNodeNext, FlowTaskNodeEntity::getNodeName,
|
||||
FlowTaskNodeEntity::getNodeCode, FlowTaskNodeEntity::getNodePropertyJson
|
||||
);
|
||||
flowTaskUtil.nodeList(list);
|
||||
list = list.stream().filter(t -> !nodetype.contains(t.getNodeType())).collect(Collectors.toList());
|
||||
List<TaskNodeModel> nodeList = JsonUtil.getJsonToList(list, TaskNodeModel.class);
|
||||
return ActionResult.success(nodeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更或者复活
|
||||
*
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "变更或者复活")
|
||||
@PostMapping("/Change")
|
||||
@Parameters({
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult change(@RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
FlowTaskEntity info = flowTaskService.getInfo(flowModel.getTaskId());
|
||||
if (FlowTaskStatusEnum.Revoke.getCode().equals(info.getStatus()) || FlowTaskStatusEnum.Cancel.getCode().equals(info.getStatus()) || FlowTaskStatusEnum.Draft.getCode().equals(info.getStatus())) {
|
||||
throw new WorkFlowException(MsgCode.WF012.get());
|
||||
}
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowTaskNewService.change(flowModel);
|
||||
String msg = flowModel.getResurgence() ? MsgCode.WF013.get() : MsgCode.WF014.get();
|
||||
return ActionResult.success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 子流程数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "子流程数据")
|
||||
@GetMapping("/SubFlowInfo/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<List<FlowBeforeInfoVO>> subFlowInfo(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTaskNodeEntity taskNode = flowTaskNodeService.getInfo(id, FlowTaskNodeEntity::getNodePropertyJson);
|
||||
List<FlowBeforeInfoVO> listVO = new ArrayList<>();
|
||||
if (taskNode != null) {
|
||||
ChildNodeList childNodeList = JsonUtil.getJsonToBean(taskNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
List<String> flowTaskIdList = new ArrayList<>();
|
||||
flowTaskIdList.addAll(childNodeList.getCustom().getAsyncTaskList());
|
||||
flowTaskIdList.addAll(childNodeList.getCustom().getTaskId());
|
||||
for (String taskId : flowTaskIdList) {
|
||||
FlowModel flowModel = new FlowModel();
|
||||
flowModel.setId(taskId);
|
||||
FlowBeforeInfoVO vo = flowTaskNewService.getBeforeInfo(flowModel);
|
||||
listVO.add(vo);
|
||||
}
|
||||
}
|
||||
return ActionResult.success(listVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程类型下拉
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程类型下拉")
|
||||
@GetMapping("/Suspend/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult suspend(@PathVariable("id") String id) {
|
||||
List<FlowTaskEntity> childList = flowTaskService.getChildList(id, FlowTaskEntity::getId, FlowTaskEntity::getIsAsync);
|
||||
boolean isAsync = childList.stream().filter(t -> FlowNature.ChildAsync.equals(t.getIsAsync())).count() > 0;
|
||||
return ActionResult.success(isAsync);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程挂起
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程挂起")
|
||||
@PostMapping("/Suspend/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult suspend(@PathVariable("id") String id, @RequestBody FlowModel flowModel) {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowTaskNewService.suspend(id, flowModel, true);
|
||||
return ActionResult.success(MsgCode.WF015.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程恢复
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程恢复")
|
||||
@PostMapping("/Restore/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult restore(@PathVariable("id") String id, @RequestBody FlowModel flowModel) {
|
||||
flowModel.setUserInfo(UserProvider.getUser());
|
||||
flowModel.setSuspend(false);
|
||||
flowTaskNewService.suspend(id, flowModel, false);
|
||||
return ActionResult.success(MsgCode.WF016.get());
|
||||
}
|
||||
|
||||
//递归处理默认当前配置
|
||||
private String setDefaultCurrentValue(String configJson, Map<String, Integer> havaDefaultCurrentValue, UserInfo userInfo) {
|
||||
if (StringUtil.isEmpty(configJson)) {
|
||||
return configJson;
|
||||
}
|
||||
Map<String, Object> configJsonMap = JsonUtil.stringToMap(configJson.trim());
|
||||
if (configJsonMap == null && configJsonMap.isEmpty()) {
|
||||
return configJson;
|
||||
}
|
||||
List<UserRelationEntity> userRelationList = serviceUtil.getListByUserIdAll(ImmutableList.of(userInfo.getUserId()));
|
||||
|
||||
int isChange = 0;
|
||||
//处理字段
|
||||
Object fieldsObj = configJsonMap.get("fields");
|
||||
List<Map<String, Object>> fieldsList = null;
|
||||
if (fieldsObj != null) {
|
||||
fieldsList = (List<Map<String, Object>>) fieldsObj;
|
||||
if (fieldsList != null && !fieldsList.isEmpty()) {
|
||||
setDefaultCurrentValue(userRelationList, fieldsList, userInfo, "add");
|
||||
configJsonMap.put("fields", fieldsList);
|
||||
isChange = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (isChange == 1) {
|
||||
return JsonUtil.getObjectToString(configJsonMap);
|
||||
} else {
|
||||
return configJson;
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaultCurrentValue(List<UserRelationEntity> userRelationList, List<Map<String, Object>> itemList, UserInfo userInfo, String parseFlag) {
|
||||
for (int i = 0, len = itemList.size(); i < len; i++) {
|
||||
Map<String, Object> itemMap = itemList.get(i);
|
||||
if (itemMap == null || itemMap.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> configMap = (Map<String, Object>) itemMap.get("__config__");
|
||||
if (configMap == null || configMap.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
List<Map<String, Object>> childrenList = (List<Map<String, Object>>) configMap.get("children");
|
||||
if (childrenList != null && !childrenList.isEmpty()) {
|
||||
setDefaultCurrentValue(userRelationList, childrenList, userInfo, parseFlag);
|
||||
configMap = (Map<String, Object>) itemMap.get("__config__");
|
||||
}
|
||||
String yunzhupaasKey = (String) configMap.get("yunzhupaasKey");
|
||||
String defaultCurrent = String.valueOf(configMap.get("defaultCurrent"));
|
||||
if ("true".equals(defaultCurrent)) {
|
||||
Map<String, List<UserRelationEntity>> relationMap = userRelationList.stream().collect(Collectors.groupingBy(UserRelationEntity::getObjectType));
|
||||
Object data = "";
|
||||
switch (yunzhupaasKey) {
|
||||
case YunzhupaasKeyConsts.COMSELECT:
|
||||
data = new ArrayList() {{
|
||||
add(userInfo.getOrganizeId());
|
||||
}};
|
||||
break;
|
||||
case YunzhupaasKeyConsts.DEPSELECT:
|
||||
data = userInfo.getDepartmentId();
|
||||
break;
|
||||
case YunzhupaasKeyConsts.POSSELECT:
|
||||
data = userInfo.getPositionIds().length > 0 ? userInfo.getPositionIds()[0] : "";
|
||||
break;
|
||||
case YunzhupaasKeyConsts.USERSELECT:
|
||||
case YunzhupaasKeyConsts.CUSTOMUSERSELECT:
|
||||
data = YunzhupaasKeyConsts.CUSTOMUSERSELECT.equals(yunzhupaasKey) ? userInfo.getUserId() + "--" + PermissionConst.USER : userInfo.getUserId();
|
||||
break;
|
||||
case YunzhupaasKeyConsts.ROLESELECT:
|
||||
List<UserRelationEntity> roleList = relationMap.get(PermissionConst.ROLE) != null ? relationMap.get(PermissionConst.ROLE) : new ArrayList<>();
|
||||
data = roleList.size() > 0 ? roleList.get(0).getObjectId() : "";
|
||||
break;
|
||||
case YunzhupaasKeyConsts.GROUPSELECT:
|
||||
List<UserRelationEntity> groupList = relationMap.get(PermissionConst.GROUP) != null ? relationMap.get(PermissionConst.GROUP) : new ArrayList<>();
|
||||
data = groupList.size() > 0 ? groupList.get(0).getObjectId() : "";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(data);
|
||||
if ("search".equals(parseFlag)) {
|
||||
String searchMultiple = String.valueOf(itemMap.get("searchMultiple"));
|
||||
if ("true".equals(searchMultiple)) {
|
||||
configMap.put("defaultValue", list);
|
||||
} else {
|
||||
configMap.put("defaultValue", data);
|
||||
}
|
||||
} else {
|
||||
String multiple = String.valueOf(itemMap.get("multiple"));
|
||||
if ("true".equals(multiple)) {
|
||||
configMap.put("defaultValue", list);
|
||||
} else {
|
||||
configMap.put("defaultValue", data);
|
||||
}
|
||||
}
|
||||
itemMap.put("__config__", configMap);
|
||||
itemList.set(i, itemMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程所关联的用户信息
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param flowTaskUserListModel 查询模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程所关联的用户信息")
|
||||
@Parameters({
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true),
|
||||
@Parameter(name = "flowTaskUserListModel", description = "查询模型", required = true)
|
||||
})
|
||||
@GetMapping("/TaskUserList/{taskId}")
|
||||
public ActionResult getTaskUserList(@PathVariable("taskId") String taskId, FlowTaskUserListModel flowTaskUserListModel) throws WorkFlowException {
|
||||
FlowUserListModel flowUserListModel = flowTaskUtil.getTaskUserList(taskId);
|
||||
List<UserIdListVo> jsonToList = userService.getObjList(flowUserListModel.getAllUserIdList(), flowTaskUserListModel, null);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(flowTaskUserListModel, PaginationVO.class);
|
||||
return ActionResult.page(jsonToList, paginationVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,396 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.controller.SuperController;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.*;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowUserListModel;
|
||||
import com.yunzhupaas.engine.model.flowcomment.FlowCommentForm;
|
||||
import com.yunzhupaas.engine.model.flowcomment.FlowCommentInfoVO;
|
||||
import com.yunzhupaas.engine.model.flowcomment.FlowCommentListVO;
|
||||
import com.yunzhupaas.engine.model.flowcomment.FlowCommentPagination;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.MsgConfig;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.nodejson.ChildNodeList;
|
||||
import com.yunzhupaas.engine.model.flowmessage.FlowMsgModel;
|
||||
import com.yunzhupaas.engine.service.FlowCommentService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNodeService;
|
||||
import com.yunzhupaas.engine.util.FlowMsgUtil;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.engine.util.FlowTaskUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.service.UserService;
|
||||
import com.yunzhupaas.util.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程评论
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Tag(name = "流程评论", description = "Comment")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/FlowComment")
|
||||
public class FlowCommentController extends SuperController<FlowCommentService, FlowCommentEntity> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
|
||||
@Autowired
|
||||
private FlowCommentService flowCommentService;
|
||||
@Autowired
|
||||
private FlowTaskNodeService flowTaskNodeService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private FlowTaskUtil flowTaskUtil;
|
||||
@Autowired
|
||||
private FlowMsgUtil flowMsgUtil;
|
||||
|
||||
/**
|
||||
* 获取流程评论列表
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程评论列表")
|
||||
@GetMapping
|
||||
public ActionResult<PageListVO<FlowCommentListVO>> list(FlowCommentPagination pagination) {
|
||||
List<FlowCommentEntity> list = flowCommentService.getlist(pagination);
|
||||
List<FlowCommentListVO> listVO = new ArrayList<>();
|
||||
List<String> userId = list.stream().map(t -> t.getCreatorUserId()).collect(Collectors.toList());
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
List<UserEntity> userName = serviceUtil.getUserName(userId);
|
||||
for (FlowCommentEntity flowCommentEntity : list) {
|
||||
FlowCommentListVO vo = JsonUtil.getJsonToBean(flowCommentEntity, FlowCommentListVO.class);
|
||||
UserEntity userEntity = userName.stream().filter(t -> t.getId().equals(flowCommentEntity.getCreatorUserId())).findFirst().orElse(null);
|
||||
if(flowCommentEntity.getCreatorUserId().equals(userInfo.getUserId()) && !"1".equals(String.valueOf(flowCommentEntity.getDeleteShow()))) {
|
||||
vo.setIsDel(1); //1-删除按钮显示
|
||||
}else if("1".equals(String.valueOf(flowCommentEntity.getDeleteShow()))) {
|
||||
vo.setIsDel(2); //1-删除按钮显示
|
||||
vo.setText("该评论已被删除");
|
||||
}else{
|
||||
vo.setIsDel(0);
|
||||
}
|
||||
vo.setCreatorUser(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
|
||||
vo.setCreatorUserHeadIcon(userEntity != null ? UploaderUtil.uploaderImg(userEntity.getHeadIcon()) : vo.getCreatorUserHeadIcon());
|
||||
if(StringUtil.isNotEmpty(flowCommentEntity.getReplyId())) {
|
||||
FlowCommentEntity replyEntity = list.stream().filter(t-> t.getId().equals(flowCommentEntity.getReplyId())).findFirst().orElse(null);
|
||||
if(replyEntity == null) {
|
||||
replyEntity = flowCommentService.getInfo(flowCommentEntity.getReplyId());
|
||||
}
|
||||
if(replyEntity != null) {
|
||||
FlowCommentEntity finalReplyEntity = replyEntity;
|
||||
UserEntity replyUserEntity = userName.stream().filter(t -> t.getId().equals(finalReplyEntity.getCreatorUserId())).findFirst().orElse(null);
|
||||
vo.setReplyUser(userEntity != null ? replyUserEntity.getRealName() + "/" + replyUserEntity.getAccount() : "");
|
||||
vo.setReplyText(("1".equals(String.valueOf(replyEntity.getDeleteShow())) || "1".equals(String.valueOf(replyEntity.getDeleteMark()))) ? "该评论已被删除": replyEntity.getText());
|
||||
}
|
||||
}
|
||||
listVO.add(vo);
|
||||
}
|
||||
PaginationVO vo = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
return ActionResult.page(listVO, vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程评论信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程评论信息")
|
||||
@GetMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<FlowCommentInfoVO> info(@PathVariable("id") String id) {
|
||||
FlowCommentEntity entity = flowCommentService.getInfo(id);
|
||||
FlowCommentInfoVO vo = JsonUtil.getJsonToBean(entity, FlowCommentInfoVO.class);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建流程评论
|
||||
*
|
||||
* @param commentForm 流程评论模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "新建流程评论")
|
||||
@PostMapping
|
||||
@Parameters({
|
||||
@Parameter(name = "commentForm", description = "流程评论模型", required = true),
|
||||
})
|
||||
public ActionResult create(@RequestBody @Valid FlowCommentForm commentForm) throws DataException, WorkFlowException {
|
||||
FlowCommentEntity entity = JsonUtil.getJsonToBean(commentForm, FlowCommentEntity.class);
|
||||
flowCommentService.create(entity);
|
||||
|
||||
//发送提醒消息
|
||||
this.sendCommentMsg(entity);
|
||||
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流程评论
|
||||
*
|
||||
* @param id 主键
|
||||
* @param commentForm 流程评论模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "更新流程评论")
|
||||
@PutMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "commentForm", description = "流程评论模型", required = true),
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid FlowCommentForm commentForm) throws DataException {
|
||||
FlowCommentEntity info = flowCommentService.getInfo(id);
|
||||
if (info != null) {
|
||||
FlowCommentEntity entity = JsonUtil.getJsonToBean(commentForm, FlowCommentEntity.class);
|
||||
entity.setDeleteShow(info.getDeleteShow());
|
||||
flowCommentService.update(id, entity);
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程评论
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除流程评论")
|
||||
@DeleteMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id) {
|
||||
FlowCommentEntity entity = flowCommentService.getInfo(id);
|
||||
if (entity.getCreatorUserId().equals(UserProvider.getUser().getUserId())) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
boolean isDeleteShow = false;
|
||||
ChildNodeList childNodeList = this.getCommentChildNodeList(entity.getTaskId());
|
||||
if(childNodeList != null && childNodeList.getProperties().getIsShowDelComment() != null && childNodeList.getProperties().getIsShowDelComment()) {
|
||||
isDeleteShow = true;
|
||||
}
|
||||
if(isDeleteShow) {
|
||||
entity.setDeleteShow(1);
|
||||
entity.setDeleteTime(new Date());
|
||||
entity.setDeleteUserId(userInfo.getUserId());
|
||||
flowCommentService.updateById(entity);
|
||||
}else{
|
||||
entity.setDeleteMark(1);
|
||||
entity.setDeleteTime(new Date());
|
||||
entity.setDeleteUserId(userInfo.getUserId());
|
||||
flowCommentService.updateById(entity);
|
||||
// List<FlowCommentEntity> deleteList = new ArrayList<>();
|
||||
// deleteList.add(entity);
|
||||
// List<String> deleteIdList = deleteList.stream().map(t-> t.getId()).collect(Collectors.toList());
|
||||
// this.getDeleteList(deleteList, deleteIdList);
|
||||
// for(FlowCommentEntity each : deleteList) {
|
||||
// flowCommentService.delete(each);
|
||||
// }
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.FA003.get());
|
||||
}
|
||||
|
||||
//递归查询下级
|
||||
private void getDeleteList(List<FlowCommentEntity> allDeleteList, List<String> parentIdList) {
|
||||
if(parentIdList == null || parentIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QueryWrapper<FlowCommentEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(FlowCommentEntity::getReplyId, parentIdList);
|
||||
List<FlowCommentEntity> childrenList = flowCommentService.list(queryWrapper);
|
||||
if(childrenList == null || childrenList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
parentIdList = childrenList.stream().map(t-> t.getId()).collect(Collectors.toList());
|
||||
allDeleteList.addAll(childrenList);
|
||||
this.getDeleteList(allDeleteList, parentIdList);
|
||||
}
|
||||
|
||||
|
||||
private ChildNodeList getCommentChildNodeList(String taskId) {
|
||||
if(StringUtil.isEmpty(taskId)) {
|
||||
return null;
|
||||
}
|
||||
QueryWrapper<FlowTaskNodeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getTaskId, taskId);
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getNodeType, FlowNature.NodeStart);
|
||||
queryWrapper.lambda().orderByDesc(FlowTaskNodeEntity::getCreatorTime);
|
||||
queryWrapper.lambda().select(FlowTaskNodeEntity::getNodePropertyJson);
|
||||
List<FlowTaskNodeEntity> startNodeList = flowTaskNodeService.list(queryWrapper);
|
||||
if(startNodeList != null && !startNodeList.isEmpty()) {
|
||||
FlowTaskNodeEntity flowNode = startNodeList.get(0);
|
||||
ChildNodeList childNodeList = JsonUtil.getJsonToBean(flowNode.getNodePropertyJson(), ChildNodeList.class);
|
||||
return childNodeList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//发送提醒消息
|
||||
private void sendCommentMsg(FlowCommentEntity flowCommentEntity) throws WorkFlowException {
|
||||
//发消息
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
//不包含@{ 且 回复ID为空 (不发消息)
|
||||
if((StringUtil.isEmpty(flowCommentEntity.getText()) || !flowCommentEntity.getText().contains("@{")) && StringUtil.isEmpty(flowCommentEntity.getReplyId())) {
|
||||
return;
|
||||
}
|
||||
ChildNodeList startChildNodeList = this.getCommentChildNodeList(flowCommentEntity.getTaskId());
|
||||
if(startChildNodeList == null || startChildNodeList.getProperties() == null || startChildNodeList.getProperties().getCommentMsgConfig() == null || startChildNodeList.getProperties().getCommentMsgConfig().getOn() == null) {
|
||||
return;
|
||||
}
|
||||
MsgConfig commentMsgConfig = startChildNodeList.getProperties().getCommentMsgConfig();
|
||||
if(commentMsgConfig.getOn() != 1 && commentMsgConfig.getOn() != 3) {
|
||||
return;
|
||||
}
|
||||
Set<String> userIdSet = new HashSet<>();
|
||||
//回复
|
||||
if(StringUtil.isNotEmpty(flowCommentEntity.getReplyId())) {
|
||||
FlowCommentEntity replyEntity = flowCommentService.getInfo(flowCommentEntity.getReplyId());
|
||||
if(replyEntity != null && StringUtil.isNotEmpty(replyEntity.getCreatorUserId())) {
|
||||
userIdSet.add(replyEntity.getCreatorUserId());
|
||||
}
|
||||
}
|
||||
//@
|
||||
if(StringUtil.isNotEmpty(flowCommentEntity.getText()) && flowCommentEntity.getText().contains("@{")) {
|
||||
String[] textArray = flowCommentEntity.getText().split("@\\{");
|
||||
List<String> accountList = new ArrayList<>();
|
||||
for(int i = 0; i<textArray.length; i ++) {
|
||||
if(i == 0) {
|
||||
continue;
|
||||
}
|
||||
if(!textArray[i].trim().contains("}")) {
|
||||
continue;
|
||||
}
|
||||
String nameAndAccount = textArray[i].substring(0, textArray[i].indexOf("}"));
|
||||
if(nameAndAccount.contains("/") && !nameAndAccount.trim().startsWith("/") && !nameAndAccount.trim().endsWith("/")) {
|
||||
String[] nameAndAccountArray = nameAndAccount.split("/");
|
||||
if(nameAndAccountArray.length != 2) {
|
||||
continue;
|
||||
}
|
||||
accountList.add(nameAndAccountArray[1].trim());
|
||||
}
|
||||
}
|
||||
if(accountList != null && !accountList.isEmpty()) {
|
||||
QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(UserEntity::getAccount, accountList);
|
||||
queryWrapper.lambda().select(UserEntity::getId);
|
||||
List<UserEntity> list = userService.list(queryWrapper);
|
||||
userIdSet.addAll(list.stream().map(t-> t.getId()).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
//过滤自己
|
||||
Set<String> finalUserIdSet = userIdSet;
|
||||
userIdSet = userIdSet.stream().filter(t-> !finalUserIdSet.contains(userInfo.getUserId())).collect(Collectors.toSet());
|
||||
|
||||
if(userIdSet.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FlowUserListModel flowUserListModel = flowTaskUtil.getTaskUserList(flowCommentEntity.getTaskId());
|
||||
userIdSet.retainAll(flowUserListModel.getAllUserIdList()); //取交集
|
||||
if(userIdSet.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<String> noAddUserIdList = new HashSet<>(userIdSet);
|
||||
//审批人
|
||||
List<FlowTaskOperatorEntity> operatorList = new ArrayList<>(); //审批人
|
||||
// List<FlowOperatorUserEntity> operatorUserList = new ArrayList<>(); //依次审批人
|
||||
List<FlowTaskCirculateEntity> circulateList = new ArrayList<>(); //抄送人
|
||||
List<FlowTaskOperatorRecordEntity> operatorRecordList = new ArrayList<>(); //已办数据
|
||||
String startHandId = null; //发起人
|
||||
|
||||
//审批人
|
||||
if(!noAddUserIdList.isEmpty()) {
|
||||
for(FlowTaskOperatorEntity each : flowUserListModel.getOperatorList()) {
|
||||
if(noAddUserIdList.contains(each.getHandleId())) {
|
||||
operatorList.add(each);
|
||||
noAddUserIdList.remove(each.getHandleId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//依次审批人
|
||||
// if(!noAddUserIdList.isEmpty()) {
|
||||
// for (FlowOperatorUserEntity each : flowUserListModel.getOperatorUserList()) {
|
||||
// if (noAddUserIdList.contains(each.getHandleId())) {
|
||||
// operatorUserList.add(each);
|
||||
// noAddUserIdList.remove(each.getHandleId());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//抄送人
|
||||
if(!noAddUserIdList.isEmpty()) {
|
||||
for (FlowTaskCirculateEntity each : flowUserListModel.getCirculateList()) {
|
||||
if (noAddUserIdList.contains(each.getObjectId())) {
|
||||
circulateList.add(each);
|
||||
noAddUserIdList.remove(each.getObjectId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//发起人
|
||||
if(!noAddUserIdList.isEmpty()) {
|
||||
if(noAddUserIdList.contains(flowUserListModel.getFlowTask().getCreatorUserId())) {
|
||||
startHandId = flowUserListModel.getFlowTask().getCreatorUserId();
|
||||
}
|
||||
}
|
||||
|
||||
//已办记录
|
||||
if(!noAddUserIdList.isEmpty()) {
|
||||
for (FlowTaskOperatorRecordEntity each : flowUserListModel.getOperatorRecordList()) {
|
||||
if(noAddUserIdList.contains(each.getHandleId())) {
|
||||
operatorRecordList.add(each);
|
||||
noAddUserIdList.remove(each.getHandleId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//节点集合
|
||||
QueryWrapper<FlowTaskNodeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getTaskId, flowCommentEntity.getTaskId());
|
||||
queryWrapper.lambda().eq(FlowTaskNodeEntity::getState, 0);
|
||||
queryWrapper.lambda().orderByDesc(FlowTaskNodeEntity::getCreatorTime);
|
||||
List<FlowTaskNodeEntity> nodeList = flowTaskNodeService.list(queryWrapper);
|
||||
//构造消息
|
||||
FlowMsgModel flowMsgModel = new FlowMsgModel();
|
||||
flowMsgModel.setTaskEntity(flowUserListModel.getFlowTask());
|
||||
flowMsgModel.setNodeList(nodeList);
|
||||
flowMsgModel.setOperatorList(operatorList);
|
||||
flowMsgModel.setCirculateList(circulateList);
|
||||
flowMsgModel.setOperatorRecordList(operatorRecordList);
|
||||
flowMsgModel.setStartHandId(startHandId);
|
||||
FlowModel flowModel = new FlowModel();
|
||||
flowModel.setUserInfo(userInfo);
|
||||
flowMsgModel.setFlowModel(flowModel);
|
||||
flowMsgModel.setWait(false);
|
||||
flowMsgModel.setComment(true);
|
||||
//发送消息
|
||||
flowMsgUtil.message(flowMsgModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.controller.SuperController;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.FlowDelegateEntity;
|
||||
import com.yunzhupaas.engine.model.flowcandidate.FlowCandidateUserModel;
|
||||
import com.yunzhupaas.engine.model.flowdelegate.*;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.FlowPageListVO;
|
||||
import com.yunzhupaas.engine.service.FlowDelegateService;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.JsonUtilEx;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程委托
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "流程委托", description = "FlowDelegate")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/FlowDelegate")
|
||||
public class FlowDelegateController extends SuperController<FlowDelegateService, FlowDelegateEntity> {
|
||||
|
||||
@Autowired
|
||||
private FlowDelegateService flowDelegateService;
|
||||
|
||||
/**
|
||||
* 获取流程委托列表
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程委托列表")
|
||||
@GetMapping
|
||||
public ActionResult<PageListVO<FlowDelegatListVO>> list(FlowDelegatePagination pagination) {
|
||||
List<FlowDelegateEntity> list = flowDelegateService.getList(pagination);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
List<FlowDelegatListVO> listVO = JsonUtil.getJsonToList(list, FlowDelegatListVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程委托信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程委托信息")
|
||||
@GetMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<FlowDelegateInfoVO> info(@PathVariable("id") String id) throws DataException {
|
||||
FlowDelegateEntity entity = flowDelegateService.getInfo(id);
|
||||
FlowDelegateInfoVO vo = JsonUtilEx.getJsonToBeanEx(entity, FlowDelegateInfoVO.class);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建流程委托
|
||||
*
|
||||
* @param flowDelegateCrForm 委托模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "新建流程委托")
|
||||
@PostMapping
|
||||
@Parameters({
|
||||
@Parameter(name = "flowDelegateCrForm", description = "委托模型", required = true),
|
||||
})
|
||||
public ActionResult create(@RequestBody @Valid FlowDelegateCrForm flowDelegateCrForm) {
|
||||
FlowDelegateEntity entity = JsonUtil.getJsonToBean(flowDelegateCrForm, FlowDelegateEntity.class);
|
||||
if (entity.getUserId().equals(entity.getToUserId())) {
|
||||
return ActionResult.fail(MsgCode.WF017.get());
|
||||
}
|
||||
if (alreadyDelegate(flowDelegateCrForm, null)) {
|
||||
return ActionResult.fail(MsgCode.WF018.get());
|
||||
}
|
||||
FlowDelegateCrForm flowReverse = new FlowDelegateCrForm();
|
||||
BeanUtils.copyProperties(flowDelegateCrForm, flowReverse);
|
||||
flowReverse.setUserId(flowDelegateCrForm.getToUserId());
|
||||
flowReverse.setToUserId(flowDelegateCrForm.getUserId());
|
||||
if (alreadyDelegate(flowReverse, null)) {
|
||||
return ActionResult.fail(MsgCode.WF019.get());
|
||||
}
|
||||
flowDelegateService.create(entity);
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否已有委托
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/10/28
|
||||
*/
|
||||
private boolean alreadyDelegate(FlowDelegateCrForm flowDelegateCrForm, String id) {
|
||||
List<FlowDelegateEntity> flowDelegateEntities = flowDelegateService.selectSameParamAboutDelaget(flowDelegateCrForm);
|
||||
for (FlowDelegateEntity delegate : flowDelegateEntities) {
|
||||
if (delegate.getId().equals(id)) {
|
||||
continue;
|
||||
}
|
||||
//时间交叉
|
||||
if ((flowDelegateCrForm.getStartTime() <= delegate.getStartTime().getTime() && flowDelegateCrForm.getEndTime() >= delegate.getStartTime().getTime()) ||
|
||||
(flowDelegateCrForm.getStartTime() >= delegate.getStartTime().getTime() && flowDelegateCrForm.getStartTime() <= delegate.getEndTime().getTime())) {
|
||||
if (StringUtil.isEmpty(flowDelegateCrForm.getFlowId())) {
|
||||
return true;
|
||||
} else {
|
||||
if (StringUtil.isEmpty(delegate.getFlowId())) {
|
||||
return true;
|
||||
} else {
|
||||
List<String> split = Arrays.asList(delegate.getFlowId().split(","));
|
||||
List<String> split1 = Arrays.asList(flowDelegateCrForm.getFlowId().split(","));
|
||||
for (String srt : split) {
|
||||
if (split1.contains(srt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流程委托
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param flowDelegateUpForm 委托模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "更新流程委托")
|
||||
@PutMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowDelegateUpForm", description = "委托模型", required = true),
|
||||
})
|
||||
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid FlowDelegateUpForm flowDelegateUpForm) {
|
||||
FlowDelegateEntity entity = JsonUtil.getJsonToBean(flowDelegateUpForm, FlowDelegateEntity.class);
|
||||
if (entity.getUserId().equals(entity.getToUserId())) {
|
||||
return ActionResult.fail(MsgCode.WF017.get());
|
||||
}
|
||||
|
||||
if (alreadyDelegate(flowDelegateUpForm, id)) {
|
||||
return ActionResult.fail(MsgCode.WF018.get());
|
||||
}
|
||||
FlowDelegateCrForm flowReverse = new FlowDelegateCrForm();
|
||||
BeanUtils.copyProperties(flowDelegateUpForm, flowReverse);
|
||||
flowReverse.setUserId(flowDelegateUpForm.getToUserId());
|
||||
flowReverse.setToUserId(flowDelegateUpForm.getUserId());
|
||||
if (alreadyDelegate(flowReverse, id)) {
|
||||
return ActionResult.fail(MsgCode.WF019.get());
|
||||
}
|
||||
boolean flag = flowDelegateService.update(id, entity);
|
||||
if (flag == false) {
|
||||
return ActionResult.success(MsgCode.FA002.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止流程引擎
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "结束委托")
|
||||
@PutMapping("/Stop/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult stop(@PathVariable("id") String id) {
|
||||
FlowDelegateEntity entity = flowDelegateService.getInfo(id);
|
||||
if (entity != null) {
|
||||
Date date = new Date();
|
||||
entity.setStartTime(date);
|
||||
entity.setEndTime(date);
|
||||
flowDelegateService.updateStop(id, entity);
|
||||
return ActionResult.success(MsgCode.SU008.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程委托
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除流程委托")
|
||||
@DeleteMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult delete(@PathVariable("id") String id) {
|
||||
FlowDelegateEntity entity = flowDelegateService.getInfo(id);
|
||||
if (entity != null) {
|
||||
flowDelegateService.delete(entity);
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA003.get());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 被委托审核
|
||||
* 根据流程id和委托人id=查询被委托人
|
||||
*
|
||||
* @param flowId 流程主键
|
||||
* @param userId 用户主键
|
||||
* @param touserId 用户主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "被委托审核")
|
||||
@GetMapping("/getuser")
|
||||
@Parameters({
|
||||
@Parameter(name = "flowId", description = "流程主键", required = true),
|
||||
@Parameter(name = "userId", description = "用户主键"),
|
||||
@Parameter(name = "touserId", description = "用户主键"),
|
||||
})
|
||||
public ActionResult getuser(@RequestParam("flowId") String flowId, @RequestParam("userId") String userId, @RequestParam("touserId") String touserId) {
|
||||
flowDelegateService.getUser(userId, flowId, touserId);
|
||||
return ActionResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 被委托发起
|
||||
* 根据被委托人查询可发起的流程列表
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "被委托发起")
|
||||
@GetMapping("/getflow")
|
||||
public ActionResult<PageListVO<FlowPageListVO>> getflow(FlowPagination pagination) {
|
||||
List<FlowPageListVO> getflow = flowDelegateService.getflow(pagination);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
List<FlowPageListVO> listVO = JsonUtil.getJsonToList(getflow, FlowPageListVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取委托人
|
||||
* 根据被委托人查询可发起的流程列表
|
||||
*
|
||||
* @Param flowId 流程主键
|
||||
*/
|
||||
@Operation(summary = "获取委托人")
|
||||
@GetMapping("/userList")
|
||||
@Parameters({
|
||||
@Parameter(name = "flowId", description = "流程主键", required = true),
|
||||
})
|
||||
public ActionResult<ListVO<FlowCandidateUserModel>> getUserListByFlowId(@RequestParam("flowId") String flowId) throws WorkFlowException {
|
||||
ListVO<FlowCandidateUserModel> userListByFlowId = flowDelegateService.getUserListByFlowId(flowId);
|
||||
return ActionResult.success(userListByFlowId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.model.flowlaunch.FlowLaunchListVO;
|
||||
import com.yunzhupaas.engine.model.flowtask.PaginationFlowTask;
|
||||
import com.yunzhupaas.engine.service.FlowTaskNewService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 流程发起
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "流程发起", description = "FlowLaunch")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/FlowLaunch")
|
||||
public class FlowLaunchController {
|
||||
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private FlowTaskNewService flowTaskNewService;
|
||||
|
||||
/**
|
||||
* 获取流程发起列表
|
||||
*
|
||||
* @param paginationFlowTask 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程发起列表(带分页)")
|
||||
@GetMapping
|
||||
public ActionResult<PageListVO<FlowLaunchListVO>> list(PaginationFlowTask paginationFlowTask) {
|
||||
List<FlowTaskEntity> list = flowTaskService.getLaunchList(paginationFlowTask);
|
||||
List<FlowLaunchListVO> listVO = JsonUtil.getJsonToList(list, FlowLaunchListVO.class);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationFlowTask, PaginationVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程发起
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除流程发起")
|
||||
@DeleteMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult delete(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTaskEntity entity = flowTaskService.getInfo(id, FlowTaskEntity::getId,
|
||||
FlowTaskEntity::getParentId, FlowTaskEntity::getFlowType, FlowTaskEntity::getFullName,
|
||||
FlowTaskEntity::getStatus
|
||||
);
|
||||
if (entity != null) {
|
||||
if (Objects.equals(entity.getFlowType(), 1)) {
|
||||
return ActionResult.fail(MsgCode.WF020.get());
|
||||
}
|
||||
if (!FlowNature.ParentId.equals(entity.getParentId()) && StringUtil.isNotEmpty(entity.getParentId())) {
|
||||
return ActionResult.fail(entity.getFullName() + MsgCode.WF021.get());
|
||||
}
|
||||
if(!Objects.equals(entity.getCreatorUserId(), UserProvider.getLoginUserId())){
|
||||
return ActionResult.fail(MsgCode.FA021.get());
|
||||
}
|
||||
flowTaskService.delete(entity);
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA003.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核催办
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "发起催办")
|
||||
@PostMapping("/Press/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult press(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowModel flowModel = new FlowModel();
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
flowModel.setUserInfo(userInfo);
|
||||
boolean flag = flowTaskNewService.press(id, flowModel);
|
||||
if (flag) {
|
||||
return ActionResult.success(MsgCode.WF022.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.WF023.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回流程发起
|
||||
* 注意:在撤销流程时要保证你的下一节点没有处理这条记录;如已处理则无法撤销流程。
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "撤回流程发起")
|
||||
@PutMapping("/{id}/Actions/Withdraw")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult revoke(@PathVariable("id") String id, @RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
flowModel.setUserInfo(userInfo);
|
||||
flowTaskNewService.revoke(ImmutableList.of(id), flowModel, true);
|
||||
return ActionResult.success(MsgCode.WF008.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.entity.DataInterfaceEntity;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.FlowEventLogEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.model.flowmonitor.FlowEventLogListVO;
|
||||
import com.yunzhupaas.engine.model.flowmonitor.FlowMonitorListVO;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowAssistModel;
|
||||
import com.yunzhupaas.engine.model.flowtask.PaginationFlowTask;
|
||||
import com.yunzhupaas.engine.service.FlowEventLogService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.ServiceAllUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程监控
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "流程监控", description = "FlowMonitor")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/FlowMonitor")
|
||||
public class FlowMonitorController {
|
||||
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowEventLogService flowEventLogService;
|
||||
|
||||
/**
|
||||
* 获取流程监控列表
|
||||
*
|
||||
* @param paginationFlowTask 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程监控列表")
|
||||
@GetMapping
|
||||
public ActionResult<PageListVO<FlowMonitorListVO>> list(PaginationFlowTask paginationFlowTask) {
|
||||
List<FlowTaskEntity> list = flowTaskService.getMonitorList(paginationFlowTask);
|
||||
List<UserEntity> userList = serviceUtil.getUserName(list.stream().map(t -> t.getCreatorUserId()).collect(Collectors.toList()));
|
||||
List<FlowMonitorListVO> listVO = new LinkedList<>();
|
||||
for (FlowTaskEntity taskEntity : list) {
|
||||
//用户名称赋值
|
||||
FlowMonitorListVO vo = JsonUtil.getJsonToBean(taskEntity, FlowMonitorListVO.class);
|
||||
UserEntity user = userList.stream().filter(t -> t.getId().equals(taskEntity.getCreatorUserId())).findFirst().orElse(null);
|
||||
vo.setUserName(user != null ? user.getRealName() + "/" + user.getAccount() : "");
|
||||
listVO.add(vo);
|
||||
}
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationFlowTask, PaginationVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除流程监控
|
||||
*
|
||||
* @param assistModel 流程删除模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "批量删除流程监控")
|
||||
@DeleteMapping
|
||||
@Parameters({
|
||||
@Parameter(name = "assistModel", description = "流程删除模型", required = true),
|
||||
})
|
||||
public ActionResult delete(@RequestBody FlowAssistModel assistModel) throws WorkFlowException {
|
||||
String[] taskId = assistModel.getIds().split(",");
|
||||
flowTaskService.delete(taskId);
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取事件日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取事件日志列表")
|
||||
@GetMapping("/{id}/EventLog")
|
||||
public ActionResult getEventLog(@PathVariable("id") String id) {
|
||||
List<FlowEventLogEntity> logList = flowEventLogService.getList(ImmutableList.of(id));
|
||||
List<String> interfaceIdList = logList.stream().map(FlowEventLogEntity::getInterfaceId).collect(Collectors.toList());
|
||||
List<DataInterfaceEntity> interfaceList = serviceUtil.getInterfaceList(interfaceIdList);
|
||||
List<FlowEventLogListVO> list = new ArrayList<>();
|
||||
for (FlowEventLogEntity logEntity : logList) {
|
||||
FlowEventLogListVO listVO = JsonUtil.getJsonToBean(logEntity, FlowEventLogListVO.class);
|
||||
DataInterfaceEntity dataInterface = interfaceList.stream().filter(t -> t.getId().equals(listVO.getInterfaceId())).findFirst().orElse(null);
|
||||
if (dataInterface != null) {
|
||||
listVO.setInterfaceCode(dataInterface.getEnCode());
|
||||
listVO.setInterfaceName(dataInterface.getFullName());
|
||||
}
|
||||
list.add(listVO);
|
||||
}
|
||||
ListVO vo = new ListVO();
|
||||
vo.setList(list);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.controller.SuperController;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.enums.FlowStatusEnum;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowModel;
|
||||
import com.yunzhupaas.engine.service.FlowDynamicService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import com.yunzhupaas.util.context.RequestContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "流程引擎", description = "FlowTask")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/FlowTask")
|
||||
public class FlowTaskController extends SuperController<FlowTaskService, FlowTaskEntity> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
@Autowired
|
||||
private FlowDynamicService flowDynamicService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "保存")
|
||||
@PostMapping
|
||||
@Parameters({
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult save(@RequestBody FlowModel flowModel) throws WorkFlowException {
|
||||
boolean isApp = !RequestContext.isOrignPc();
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
flowModel.setUserInfo(userInfo);
|
||||
flowModel.setSystemId(isApp ? userInfo.getSystemId() : userInfo.getAppSystemId());
|
||||
flowDynamicService.batchCreateOrUpdate(flowModel);
|
||||
String msg = FlowStatusEnum.save.getMessage().equals(flowModel.getStatus()) ? MsgCode.SU002.get() : MsgCode.SU006.get();
|
||||
return ActionResult.success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*
|
||||
* @param id 主键
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "提交")
|
||||
@PutMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "flowModel", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult submit(@RequestBody FlowModel flowModel, @PathVariable("id") String id) throws WorkFlowException {
|
||||
boolean isApp = !RequestContext.isOrignPc();
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
flowModel.setId(id);
|
||||
flowModel.setUserInfo(userInfo);
|
||||
flowModel.setSystemId(isApp ? userInfo.getSystemId() : userInfo.getAppSystemId());
|
||||
FlowTaskEntity infoSubmit = flowTaskService.getInfoSubmit(id,FlowTaskEntity::getCreatorUserId);
|
||||
if (infoSubmit != null && !Objects.equals(infoSubmit.getCreatorUserId(), userInfo.getUserId())) {
|
||||
return ActionResult.fail(MsgCode.FA021.get());
|
||||
}
|
||||
flowDynamicService.batchCreateOrUpdate(flowModel);
|
||||
String msg = FlowStatusEnum.save.getMessage().equals(flowModel.getStatus()) ? MsgCode.SU002.get() : MsgCode.SU006.get();
|
||||
return ActionResult.success(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,583 @@
|
||||
package com.yunzhupaas.engine.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.controller.SuperController;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.emnus.ModuleTypeEnum;
|
||||
import com.yunzhupaas.engine.entity.FlowEngineVisibleEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTaskEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateEntity;
|
||||
import com.yunzhupaas.engine.entity.FlowTemplateJsonEntity;
|
||||
import com.yunzhupaas.engine.model.flowbefore.FlowFormVo;
|
||||
import com.yunzhupaas.engine.model.flowengine.FlowPagination;
|
||||
import com.yunzhupaas.engine.model.flowengine.shuntjson.childnode.ChildNode;
|
||||
import com.yunzhupaas.engine.model.flowtask.FlowAssistModel;
|
||||
import com.yunzhupaas.engine.model.flowtemplate.*;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowTemplateJsonListVO;
|
||||
import com.yunzhupaas.engine.model.flowtemplatejson.FlowTemplateJsonPage;
|
||||
import com.yunzhupaas.engine.service.FlowEngineVisibleService;
|
||||
import com.yunzhupaas.engine.service.FlowTaskService;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateJsonService;
|
||||
import com.yunzhupaas.engine.service.FlowTemplateService;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.visual.service.VisualdevApi;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程设计
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "流程模板", description = "template")
|
||||
@RestController
|
||||
@RequestMapping("/api/workflow1/Engine/flowTemplate")
|
||||
public class FlowTemplateController extends SuperController<FlowTemplateService, FlowTemplateEntity> {
|
||||
|
||||
@Autowired
|
||||
private FlowTemplateService flowTemplateService;
|
||||
@Autowired
|
||||
private FlowTemplateJsonService flowTemplateJsonService;
|
||||
@Autowired
|
||||
private FlowEngineVisibleService flowEngineVisibleService;
|
||||
@Autowired
|
||||
private ServiceAllUtil serviceUtil;
|
||||
@Autowired
|
||||
private FlowTaskService flowTaskService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取流程引擎列表
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程引擎列表")
|
||||
@GetMapping
|
||||
public ActionResult<PageListVO<FlowPageListVO>> list(FlowPagination pagination) {
|
||||
List<FlowTemplateEntity> list = flowTemplateService.getPageList(pagination);
|
||||
List<DictionaryDataEntity> dictionList = serviceUtil.getDictionName(list.stream().map(FlowTemplateEntity::getCategory).collect(Collectors.toList()));
|
||||
List<UserEntity> userList = serviceUtil.getUserName(list.stream().map(FlowTemplateEntity::getCreatorUserId).collect(Collectors.toList()));
|
||||
List<FlowPageListVO> listVO = new ArrayList<>();
|
||||
for (FlowTemplateEntity entity : list) {
|
||||
FlowPageListVO vo = JsonUtil.getJsonToBean(entity, FlowPageListVO.class);
|
||||
DictionaryDataEntity dataEntity = dictionList.stream().filter(t -> t.getId().equals(entity.getCategory())).findFirst().orElse(null);
|
||||
vo.setCategory(dataEntity != null ? dataEntity.getFullName() : "");
|
||||
UserEntity userEntity = userList.stream().filter(t -> t.getId().equals(entity.getCreatorUserId())).findFirst().orElse(null);
|
||||
vo.setCreatorUser(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
|
||||
listVO.add(vo);
|
||||
}
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程设计列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程引擎下拉框")
|
||||
@GetMapping("/Selector")
|
||||
public ActionResult<ListVO<FlowTemplateListVO>> listSelect() {
|
||||
List<FlowTemplateListVO> treeList = flowTemplateService.getSelectList();
|
||||
ListVO vo = new ListVO();
|
||||
vo.setList(treeList);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可见引擎下拉框
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "可见引擎下拉框")
|
||||
@GetMapping("/ListAll")
|
||||
public ActionResult<ListVO<FlowTemplateListVO>> listAll() {
|
||||
List<FlowTemplateListVO> treeList = flowTemplateService.getSelectList();
|
||||
ListVO vo = new ListVO();
|
||||
vo.setList(treeList);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可见的流程引擎列表
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "可见的流程引擎列表")
|
||||
@GetMapping("/PageListAll")
|
||||
public ActionResult<PageListVO<FlowPageListVO>> listAll(FlowPagination pagination) {
|
||||
List<FlowTemplateEntity> list = flowTemplateService.getListAll(pagination, true);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
List<FlowPageListVO> listVO = JsonUtil.getJsonToList(list, FlowPageListVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 所属流程树形接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "所属流程树形接口")
|
||||
@GetMapping("/TreeList")
|
||||
public ActionResult<ListVO<FlowTemplateListVO>> treeList() {
|
||||
List<FlowTemplateListVO> treeList = flowTemplateService.getTreeList();
|
||||
ListVO vo = new ListVO();
|
||||
vo.setList(treeList);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可见的流程引擎列表
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "可见的子流程流程引擎列表")
|
||||
@GetMapping("/PageChildListAll")
|
||||
public ActionResult<PageListVO<FlowSelectVO>> childListAll(FlowPagination pagination) {
|
||||
List<FlowSelectVO> list = flowTemplateJsonService.getChildListPage(pagination);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
return ActionResult.page(list, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程引擎信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取流程引擎信息")
|
||||
@GetMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<FlowTemplateInfoVO> info(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateInfoVO vo = flowTemplateService.info(id);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建流程设计
|
||||
*
|
||||
* @param form 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "新建流程引擎")
|
||||
@PostMapping
|
||||
@Parameters({
|
||||
@Parameter(name = "form", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult create(@RequestBody @Valid FlowTemplateCrForm form) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = JsonUtil.getJsonToBean(form, FlowTemplateEntity.class);
|
||||
String json = StringUtil.isNotEmpty(form.getFlowTemplateJson()) ? form.getFlowTemplateJson() : "[]";
|
||||
List<FlowTemplateJsonEntity> templatejson = JsonUtil.getJsonToList(json, FlowTemplateJsonEntity.class);
|
||||
flowTemplateService.create(entity, templatejson);
|
||||
return ActionResult.success(MsgCode.SU001.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流程设计
|
||||
*
|
||||
* @param id 主键
|
||||
* @param form 流程模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "更新流程引擎")
|
||||
@PutMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
@Parameter(name = "form", description = "流程模型", required = true),
|
||||
})
|
||||
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid FlowTemplatUprForm form) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = JsonUtil.getJsonToBean(form, FlowTemplateEntity.class);
|
||||
String json = StringUtil.isNotEmpty(form.getFlowTemplateJson()) ? form.getFlowTemplateJson() : "[]";
|
||||
List<FlowTemplateJsonEntity> templateJsonList = JsonUtil.getJsonToList(json, FlowTemplateJsonEntity.class);
|
||||
FlowTemplateVO vo = flowTemplateService.updateVisible(id, entity, templateJsonList);
|
||||
return ActionResult.success(MsgCode.SU004.get(), vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程设计
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除流程引擎")
|
||||
@DeleteMapping("/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult delete(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = flowTemplateService.getInfo(id);
|
||||
flowTemplateService.delete(entity);
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制流程表单
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "复制流程表单")
|
||||
@PostMapping("/{id}/Actions/Copy")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult copy(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateEntity flowtemplate = flowTemplateService.getInfo(id);
|
||||
if (flowtemplate != null) {
|
||||
if (flowtemplate.getType() == 1) {
|
||||
throw new WorkFlowException(MsgCode.WF024.get());
|
||||
}
|
||||
List<FlowTemplateJsonEntity> templateJson = flowTemplateJsonService.getMainList(ImmutableList.of(id));
|
||||
flowTemplateService.copy(flowtemplate, templateJson);
|
||||
return ActionResult.success(MsgCode.SU007.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA004.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程表单状态
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "更新流程表单状态")
|
||||
@PutMapping("/{id}/Actions/State")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult state(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = flowTemplateService.getInfo(id);
|
||||
if (entity != null) {
|
||||
entity.setEnabledMark("1".equals(String.valueOf(entity.getEnabledMark())) ? 0 : 1);
|
||||
flowTemplateService.update(id, entity);
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布流程引擎
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "发布流程设计")
|
||||
@PostMapping("/Release/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult release(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = flowTemplateService.getInfo(id);
|
||||
if (entity != null) {
|
||||
entity.setEnabledMark(1);
|
||||
List<FlowTemplateJsonEntity> templateJson = flowTemplateJsonService.getMainList(ImmutableList.of(id));
|
||||
if (templateJson.size() == 0) {
|
||||
return ActionResult.fail(MsgCode.WF025.get());
|
||||
}
|
||||
flowTemplateService.update(id, entity);
|
||||
return ActionResult.success(MsgCode.WF026.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA011.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止流程引擎
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "停止流程设计")
|
||||
@PostMapping("/Stop/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult stop(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = flowTemplateService.getInfo(id);
|
||||
if (entity != null) {
|
||||
entity.setEnabledMark(0);
|
||||
flowTemplateService.update(id, entity);
|
||||
return ActionResult.success(MsgCode.WF027.get());
|
||||
}
|
||||
return ActionResult.fail(MsgCode.FA008.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作流导出
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
@Operation(summary = "工作流导出")
|
||||
@GetMapping("/{id}/Actions/Export")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<DownloadVO> exportData(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowExportModel model = flowTemplateService.exportData(id);
|
||||
DownloadVO downloadVO = serviceUtil.exportData(model);
|
||||
return ActionResult.success(downloadVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作流导入
|
||||
*
|
||||
* @param multipartFile 文件
|
||||
* @return
|
||||
* @throws WorkFlowException
|
||||
*/
|
||||
@Operation(summary = "工作流导入")
|
||||
@PostMapping(value = "/Actions/Import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ActionResult ImportData(@RequestPart("file") MultipartFile multipartFile, @RequestPart("type") String type) throws WorkFlowException {
|
||||
//判断是否为.json结尾
|
||||
if (FileUtil.existsSuffix(multipartFile, ModuleTypeEnum.FLOW_FLOWENGINE.getTableName())) {
|
||||
return ActionResult.fail(MsgCode.IMP002.get());
|
||||
}
|
||||
//获取文件内容
|
||||
String fileContent = FileUtil.getFileContent(multipartFile);
|
||||
FlowExportModel flowExportModel = JsonUtil.getJsonToBean(fileContent, FlowExportModel.class);
|
||||
if (ObjectUtil.isEmpty(flowExportModel.getFlowTemplate())) {
|
||||
return ActionResult.fail(MsgCode.IMP004.get());
|
||||
}
|
||||
flowTemplateService.ImportData(flowExportModel, type);
|
||||
return ActionResult.success(MsgCode.IMP001.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程版本列表
|
||||
*
|
||||
* @param templateId 主键
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程版本列表")
|
||||
@GetMapping("{templateId}/FlowJsonList")
|
||||
@Parameters({
|
||||
@Parameter(name = "templateId", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<PageListVO<FlowTemplateJsonListVO>> list(@PathVariable("templateId") String templateId, FlowTemplateJsonPage pagination) {
|
||||
List<FlowTemplateJsonEntity> list = flowTemplateJsonService.getListPage(pagination, true);
|
||||
List<String> createId = list.stream().map(FlowTemplateJsonEntity::getCreatorUserId).collect(Collectors.toList());
|
||||
List<UserEntity> userName = serviceUtil.getUserName(createId);
|
||||
List<FlowTemplateJsonListVO> listVO = JsonUtil.getJsonToList(list, FlowTemplateJsonListVO.class);
|
||||
for (FlowTemplateJsonListVO templateJson : listVO) {
|
||||
UserEntity entity = userName.stream().filter(t -> t.getId().equals(templateJson.getCreatorUserId())).findFirst().orElse(null);
|
||||
templateJson.setCreatorUser(entity != null ? entity.getRealName() + "/" + entity.getAccount() : "");
|
||||
}
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置主版本
|
||||
*
|
||||
* @param ids 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "设置主版本")
|
||||
@PostMapping("{ids}/MainVersion")
|
||||
@Parameters({
|
||||
@Parameter(name = "ids", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult mainVersion(@PathVariable("ids") String ids) throws WorkFlowException {
|
||||
flowTemplateJsonService.templateJsonMajor(ids);
|
||||
return ActionResult.success(MsgCode.SU005.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除版本
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除版本")
|
||||
@DeleteMapping("{id}/FlowJson")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult flowJson(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateJsonEntity entity = flowTemplateJsonService.getInfo(id);
|
||||
List<FlowTaskEntity> flowTaskList = flowTaskService.getFlowList(entity.getId());
|
||||
if (flowTaskList.size() > 0) {
|
||||
throw new WorkFlowException(MsgCode.WF028.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程类型下拉
|
||||
*
|
||||
* @param id 主键
|
||||
* @param type 类型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程类型下拉")
|
||||
@GetMapping("/FlowJsonList/{id}")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<List<FlowSelectVO>> flowJsonList(@PathVariable("id") String id, String type) throws WorkFlowException {
|
||||
FlowTemplateEntity info = flowTemplateService.getInfo(id);
|
||||
if (!ObjectUtil.equal(info.getEnabledMark(), 1)) {
|
||||
return ActionResult.fail(MsgCode.WF053.get());
|
||||
}
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
List<FlowTemplateJsonEntity> list = flowTemplateJsonService.getMainList(ImmutableList.of(id));
|
||||
List<FlowSelectVO> listVO = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(type) && !userInfo.getIsAdministrator()) {
|
||||
List<FlowEngineVisibleEntity> visibleFlowList = flowEngineVisibleService.getVisibleFlowList(userInfo.getUserId());
|
||||
for (FlowTemplateJsonEntity entity : list) {
|
||||
boolean count = visibleFlowList.stream().filter(t -> t.getFlowId().equals(entity.getId())).count() > 0;
|
||||
if ((entity.getVisibleType() == 1 && count) || entity.getVisibleType() == 0) {
|
||||
FlowSelectVO vo = JsonUtil.getJsonToBean(entity, FlowSelectVO.class);
|
||||
listVO.add(vo);
|
||||
}
|
||||
}
|
||||
if (listVO.size() == 0) {
|
||||
return ActionResult.fail(MsgCode.WF029.get());
|
||||
}
|
||||
} else {
|
||||
listVO.addAll(JsonUtil.getJsonToList(list, FlowSelectVO.class));
|
||||
}
|
||||
return ActionResult.success(listVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 子流程表单信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "子流程表单信息")
|
||||
@GetMapping("/{id}/FormInfo")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<FlowFormVo> formInfo(@PathVariable("id") String id) throws WorkFlowException {
|
||||
FlowTemplateJsonEntity info = flowTemplateJsonService.getInfo(id);
|
||||
ChildNode childNode = JsonUtil.getJsonToBean(info.getFlowTemplateJson(), ChildNode.class);
|
||||
String formId = childNode.getProperties().getFormId();
|
||||
//todo 添加表单配置
|
||||
FlowFormVo vo = JsonUtil.getJsonToBean("", FlowFormVo.class);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程协管
|
||||
*
|
||||
* @param assistModel 协管模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "流程协管")
|
||||
@PostMapping("/assist")
|
||||
@Parameters({
|
||||
@Parameter(name = "assistModel", description = "协管模型", required = true),
|
||||
})
|
||||
public ActionResult assist(@RequestBody FlowAssistModel assistModel) {
|
||||
flowEngineVisibleService.assistList(assistModel);
|
||||
return ActionResult.success(MsgCode.SU002.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 委托可选全部流程
|
||||
*
|
||||
* @param pagination 分页模型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "委托可选全部流程")
|
||||
@GetMapping("/getflowAll")
|
||||
public ActionResult<PageListVO<FlowPageListVO>> getflowAll(FlowPagination pagination) {
|
||||
List<FlowTemplateEntity> listByFlowIds = flowTemplateService.getListAll(pagination, true);
|
||||
List<FlowPageListVO> listVO = JsonUtil.getJsonToList(listByFlowIds, FlowPageListVO.class);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||
return ActionResult.page(listVO, paginationVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 委托流程选择展示
|
||||
*
|
||||
* @param templateIds 委托流程
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "委托流程选择展示")
|
||||
@PostMapping("/getflowList")
|
||||
@Parameters({
|
||||
@Parameter(name = "templateIds", description = "委托流程", required = true),
|
||||
})
|
||||
public ActionResult<List<FlowPageListVO>> getflowList(@RequestBody List<String> templateIds) {
|
||||
FlowPagination pagination = new FlowPagination();
|
||||
pagination.setTemplateIdList(templateIds);
|
||||
List<FlowTemplateEntity> listByFlowIds = flowTemplateService.getListAll(pagination, false);
|
||||
List<FlowPageListVO> listVO = JsonUtil.getJsonToList(listByFlowIds, FlowPageListVO.class);
|
||||
return ActionResult.success(MsgCode.SU002.get(), listVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 委托流程选择展示
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取协管")
|
||||
@GetMapping("/{id}/assistList")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true),
|
||||
})
|
||||
public ActionResult<ListVO<String>> getAssistList(@PathVariable("id") String id) {
|
||||
List<FlowEngineVisibleEntity> assistListAll = flowEngineVisibleService.getList(ImmutableList.of(id));
|
||||
List<String> assistList = new ArrayList<>();
|
||||
for (FlowEngineVisibleEntity entity : assistListAll) {
|
||||
assistList.add(entity.getOperatorId() + "--" + entity.getOperatorType());
|
||||
}
|
||||
ListVO vo = new ListVO();
|
||||
vo.setList(assistList);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取引擎id
|
||||
*
|
||||
* @param code 编码
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取引擎id")
|
||||
@GetMapping("/getFlowIdByCode/{code}")
|
||||
@Parameters({
|
||||
@Parameter(name = "code", description = "编码", required = true),
|
||||
})
|
||||
public ActionResult getFlowIdByCode(@PathVariable("code") String code) throws WorkFlowException {
|
||||
FlowTemplateEntity entity = flowTemplateService.getFlowIdByCode(code);
|
||||
return ActionResult.success(MsgCode.SU002.get(), entity.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yunzhupaas-workflow-engine</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-workflow-engine-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-common-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-permission-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程权限表
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_form_authorize")
|
||||
public class FlowAuthorizeEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("f_task_id")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("f_node_code")
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 字段权限
|
||||
*/
|
||||
@TableField("f_form_operate")
|
||||
private String formOperate;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程候选人
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_candidates")
|
||||
public class FlowCandidatesEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField("F_TASK_NODE_ID")
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 代办主键
|
||||
*/
|
||||
@TableField("F_TASK_OPERATOR_ID")
|
||||
private String operatorId;
|
||||
|
||||
/**
|
||||
* 审批人主键
|
||||
*/
|
||||
@TableField("F_HANDLE_ID")
|
||||
private String handleId;
|
||||
|
||||
/**
|
||||
* 审批人账号
|
||||
*/
|
||||
@TableField("F_ACCOUNT")
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 候选人
|
||||
*/
|
||||
@TableField("F_CANDIDATES")
|
||||
private String candidates;
|
||||
|
||||
/**
|
||||
* 类型 1.候选人 2.异常人
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程评论
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_comment")
|
||||
public class FlowCommentEntity extends SuperExtendEntity.SuperExtendEnabledEntity<String> {
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 文本
|
||||
*/
|
||||
@TableField("F_TEXT")
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@TableField("F_IMAGE")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
@TableField("F_FILE")
|
||||
@JSONField(name = "file")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 回复评论id
|
||||
*/
|
||||
@TableField("F_REPLY_ID")
|
||||
private String replyId;
|
||||
|
||||
/**
|
||||
* 评论删除显示
|
||||
*/
|
||||
@TableField("F_DELETE_SHOW")
|
||||
private Integer deleteShow;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 流程委托
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_delegate")
|
||||
public class FlowDelegateEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 委托人
|
||||
*/
|
||||
@TableField("F_USER_ID")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 委托人
|
||||
*/
|
||||
@TableField("F_USER_NAME")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 被委托人
|
||||
*/
|
||||
@TableField("F_TO_USER_ID")
|
||||
private String toUserId;
|
||||
|
||||
/**
|
||||
* 被委托人
|
||||
*/
|
||||
@TableField("F_TO_USER_NAME")
|
||||
private String toUserName;
|
||||
|
||||
/**
|
||||
* 委托类型(0-发起委托,1-审批委托)
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 委托流程
|
||||
*/
|
||||
@TableField("F_FLOW_ID")
|
||||
private String flowId;
|
||||
|
||||
/**
|
||||
* 委托流程
|
||||
*/
|
||||
@TableField("F_FLOW_NAME")
|
||||
private String flowName;
|
||||
|
||||
/**
|
||||
* 流程分类
|
||||
*/
|
||||
@TableField("F_FLOW_CATEGORY")
|
||||
private String flowCategory;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@TableField("F_START_TIME")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@TableField("F_END_TIME")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程可见
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_visible")
|
||||
public class FlowEngineVisibleEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 流程主键
|
||||
*/
|
||||
@TableField("F_FLOW_ID")
|
||||
private String flowId;
|
||||
|
||||
/**
|
||||
* 经办类型
|
||||
*/
|
||||
@TableField("F_OPERATOR_TYPE")
|
||||
private String operatorType;
|
||||
|
||||
/**
|
||||
* 经办主键
|
||||
*/
|
||||
@TableField("F_OPERATOR_ID")
|
||||
private String operatorId;
|
||||
|
||||
/**
|
||||
* 排序码
|
||||
*/
|
||||
@TableField("F_SORT_CODE")
|
||||
private Long sortCode;
|
||||
|
||||
/**
|
||||
* 可见类型 1.发起 2.协管
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperBaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程事件日志
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_event_log")
|
||||
public class FlowEventLogEntity extends SuperBaseEntity.SuperCBaseEntity<String> {
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField("F_TASK_NODE_ID")
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 接口主键
|
||||
*/
|
||||
@TableField("F_INTERFACE_ID")
|
||||
private String interfaceId;
|
||||
|
||||
/**
|
||||
* 事件名称
|
||||
*/
|
||||
@TableField("F_FULL_NAME")
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
* 执行结果
|
||||
*/
|
||||
@TableField("F_RESULT")
|
||||
private String result;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程依次审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_task_operator_user")
|
||||
public class FlowOperatorUserEntity extends SuperExtendEntity.SuperExtendDescriptionEntity<String> {
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField("F_TASK_NODE_ID")
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField("F_STATE")
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 经办主键
|
||||
*/
|
||||
@TableField("F_HANDLE_ID")
|
||||
private String handleId;
|
||||
|
||||
/**
|
||||
* 节点类型
|
||||
*/
|
||||
@TableField("F_Type")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("F_NODE_CODE")
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField("F_NODE_NAME")
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@TableField("F_COMPLETION")
|
||||
private Integer completion;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
@TableField("F_PARENT_ID")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 自动审批
|
||||
*/
|
||||
@TableField("F_AUTOMATION")
|
||||
private String automation;
|
||||
|
||||
/**
|
||||
* 冻结
|
||||
*/
|
||||
@TableField("F_REJECT")
|
||||
private String reject;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 冻结审批
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_reject_data")
|
||||
public class FlowRejectDataEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 经办数据
|
||||
*/
|
||||
@TableField("F_TASK_OPERATOR_JSON")
|
||||
public String taskOperatorJson;
|
||||
/**
|
||||
* 节点数据
|
||||
*/
|
||||
@TableField("F_TASK_NODE_JSON")
|
||||
private String taskNodeJson;
|
||||
/**
|
||||
* 流程任务
|
||||
*/
|
||||
@TableField("F_TASK_JSON")
|
||||
private String taskJson;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程传阅
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_task_circulate")
|
||||
public class FlowTaskCirculateEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 对象类型
|
||||
*/
|
||||
@TableField("F_OBJECT_TYPE")
|
||||
private String objectType;
|
||||
|
||||
/**
|
||||
* 对象主键
|
||||
*/
|
||||
@TableField("F_OBJECT_ID")
|
||||
private String objectId;
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("F_NODE_CODE")
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField("F_NODE_NAME")
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField("F_TASK_NODE_ID")
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 流程任务
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_task")
|
||||
public class FlowTaskEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
|
||||
|
||||
/**
|
||||
* 实例进程
|
||||
*/
|
||||
@TableField("F_PROCESS_ID")
|
||||
private String processId;
|
||||
|
||||
/**
|
||||
* 任务编码
|
||||
*/
|
||||
@TableField("F_EN_CODE")
|
||||
private String enCode;
|
||||
|
||||
/**
|
||||
* 任务标题
|
||||
*/
|
||||
@TableField("F_FULL_NAME")
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
* 紧急程度
|
||||
*/
|
||||
@TableField("F_FLOW_URGENT")
|
||||
private Integer flowUrgent;
|
||||
|
||||
/**
|
||||
* 流程主键
|
||||
*/
|
||||
@TableField("F_FLOW_ID")
|
||||
private String flowId;
|
||||
|
||||
/**
|
||||
* 流程模板id
|
||||
*/
|
||||
@TableField("F_TEMPLATE_ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 流程编码
|
||||
*/
|
||||
@TableField("F_FLOW_CODE")
|
||||
private String flowCode;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
*/
|
||||
@TableField("F_FLOW_NAME")
|
||||
private String flowName;
|
||||
|
||||
/**
|
||||
* 流程类型
|
||||
*/
|
||||
@TableField("F_FLOW_TYPE")
|
||||
private Integer flowType;
|
||||
|
||||
/**
|
||||
* 流程分类
|
||||
*/
|
||||
@TableField("F_FLOW_CATEGORY")
|
||||
private String flowCategory;
|
||||
|
||||
/**
|
||||
* 表单内容
|
||||
*/
|
||||
@TableField("F_FLOW_FORM_DATA_JSON")
|
||||
private String flowFormContentJson;
|
||||
|
||||
/**
|
||||
* 流程版本
|
||||
*/
|
||||
@TableField("F_FLOW_VERSION")
|
||||
private String flowVersion;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@TableField("F_START_TIME")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@TableField("F_END_TIME")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 当前步骤
|
||||
*/
|
||||
@TableField("F_CURRENT_NODE_NAME")
|
||||
private String thisStep;
|
||||
|
||||
/**
|
||||
* 当前步骤Id
|
||||
*/
|
||||
@TableField("F_CURRENT_NODE_CODE")
|
||||
private String thisStepId;
|
||||
|
||||
/**
|
||||
* 任务状态 0-草稿、1-处理、2-通过、3-驳回、4-撤销、5-终止、6-挂起
|
||||
*/
|
||||
@TableField("F_STATUS")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 挂起之前状态
|
||||
*/
|
||||
@TableField(value = "F_SUSPEND", fill = FieldFill.UPDATE)
|
||||
private Integer suspend;
|
||||
|
||||
/**
|
||||
* 完成情况
|
||||
*/
|
||||
@TableField("F_COMPLETION")
|
||||
private Integer completion;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
@TableField("F_PARENT_ID")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 被委托用户
|
||||
*/
|
||||
@TableField("F_DELEGATE_USER_ID")
|
||||
private String delegateUser;
|
||||
|
||||
/**
|
||||
* 关联系统id
|
||||
*/
|
||||
@TableField("F_SYSTEM_ID")
|
||||
private String systemId;
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField(value = "F_REVIVE_NODE_ID", fill = FieldFill.UPDATE)
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 是否批量(0:否,1:是)
|
||||
*/
|
||||
@TableField("F_IS_BATCH")
|
||||
private Integer isBatch;
|
||||
|
||||
/**
|
||||
* 是否能恢复(0:能,1:不能)
|
||||
*/
|
||||
@TableField("F_RESTORE")
|
||||
private Integer frestore;
|
||||
|
||||
/**
|
||||
* 同步异步(0:同步,1:异步)
|
||||
*/
|
||||
@TableField("F_IS_ASYNC")
|
||||
private Integer isAsync;
|
||||
|
||||
/**
|
||||
* 冻结审批
|
||||
*/
|
||||
@TableField(value = "F_REJECT_DATA_ID", fill = FieldFill.UPDATE)
|
||||
private String rejectId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程节点
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_task_node")
|
||||
public class FlowTaskNodeEntity extends SuperExtendEntity.SuperExtendDescriptionEntity<String> {
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("F_NODE_CODE")
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField("F_NODE_NAME")
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 节点类型
|
||||
*/
|
||||
@TableField("F_NODE_TYPE")
|
||||
private String nodeType;
|
||||
|
||||
/**
|
||||
* 节点属性Json
|
||||
*/
|
||||
@TableField("F_NODE_PROPERTY_JSON")
|
||||
private String nodePropertyJson;
|
||||
|
||||
/**
|
||||
* 上一节点 1.上一步骤 0.返回开始
|
||||
*/
|
||||
@TableField("F_NODE_UP")
|
||||
private String nodeUp;
|
||||
|
||||
/**
|
||||
* 下一节点
|
||||
*/
|
||||
@TableField("F_NODE_NEXT")
|
||||
private String nodeNext;
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@TableField("F_COMPLETION")
|
||||
private Integer completion;
|
||||
|
||||
/**
|
||||
* 排序码
|
||||
*/
|
||||
@TableField("F_SORT_CODE")
|
||||
private Long sortCode;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 状态 0.新流程 -1.无用节点
|
||||
*/
|
||||
@TableField("F_STATE")
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 分支选择
|
||||
*/
|
||||
@TableField("F_CANDIDATES")
|
||||
private String candidates;
|
||||
|
||||
/**
|
||||
* 节点数据
|
||||
*/
|
||||
@TableField("F_DRAFT_DATA")
|
||||
private String draftData;
|
||||
|
||||
/**
|
||||
* 表单id
|
||||
*/
|
||||
@TableField("F_FORM_ID")
|
||||
private String formId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 流程经办
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_task_operator")
|
||||
public class FlowTaskOperatorEntity extends SuperExtendEntity.SuperExtendDescriptionEntity<String> {
|
||||
|
||||
/**
|
||||
* 加签处理人
|
||||
*/
|
||||
@TableField("F_APPEND_HANDLE_ID")
|
||||
private String appendHandleId;
|
||||
|
||||
/**
|
||||
* 节点类型
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 经办主键
|
||||
*/
|
||||
@TableField("F_HANDLE_ID")
|
||||
private String handleId;
|
||||
|
||||
/**
|
||||
* 处理状态 0-拒绝、1-同意
|
||||
*/
|
||||
@TableField(value = "F_HANDLE_STATUS", fill = FieldFill.UPDATE)
|
||||
private Integer handleStatus;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
@TableField(value = "F_HANDLE_TIME", fill = FieldFill.UPDATE)
|
||||
private Date handleTime;
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("F_NODE_CODE")
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField("F_NODE_NAME")
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@TableField("F_COMPLETION")
|
||||
private Integer completion;
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField("F_TASK_NODE_ID")
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 状态 0.新流程 -1.无用数据 1加签人
|
||||
*/
|
||||
@TableField("F_STATE")
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
@TableField("F_PARENT_ID")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 草稿数据
|
||||
*/
|
||||
@TableField("F_DRAFT_DATA")
|
||||
private String draftData;
|
||||
|
||||
/**
|
||||
* 自动审批
|
||||
*/
|
||||
@TableField("F_AUTOMATION")
|
||||
private String automation;
|
||||
|
||||
/**
|
||||
* 排序码
|
||||
*/
|
||||
@TableField("F_SORT_CODE")
|
||||
private Long sortCode;
|
||||
|
||||
/**
|
||||
* 回滚id
|
||||
*/
|
||||
@TableField("F_ROLLBACK_ID")
|
||||
private String rollbackId;
|
||||
|
||||
/**
|
||||
* 冻结
|
||||
*/
|
||||
@TableField("F_REJECT")
|
||||
private String reject;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 流程经办记录
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_task_operator_record")
|
||||
public class FlowTaskOperatorRecordEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("F_NODE_CODE")
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField("F_NODE_NAME")
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 经办状态 0-拒绝、1-同意、2-提交、3-撤回、4-终止、5-指派、6-加签、7-转办
|
||||
*/
|
||||
@TableField("F_HANDLE_STATUS")
|
||||
private Integer handleStatus;
|
||||
|
||||
/**
|
||||
* 经办人员
|
||||
*/
|
||||
@TableField("F_HANDLE_ID")
|
||||
private String handleId;
|
||||
|
||||
/**
|
||||
* 经办时间
|
||||
*/
|
||||
@TableField("F_HANDLE_TIME")
|
||||
private Date handleTime;
|
||||
|
||||
/**
|
||||
* 经办理由
|
||||
*/
|
||||
@TableField("F_HANDLE_OPINION")
|
||||
private String handleOpinion;
|
||||
|
||||
/**
|
||||
* 流转操作人
|
||||
*/
|
||||
@TableField("F_OPERATOR_ID")
|
||||
private String operatorId;
|
||||
|
||||
/**
|
||||
* 经办主键
|
||||
*/
|
||||
@TableField(value = "F_TASK_OPERATOR_ID", fill = FieldFill.UPDATE)
|
||||
private String taskOperatorId;
|
||||
|
||||
/**
|
||||
* 节点主键
|
||||
*/
|
||||
@TableField(value = "F_TASK_NODE_ID", fill = FieldFill.UPDATE)
|
||||
private String taskNodeId;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 签名图片
|
||||
*/
|
||||
@TableField("F_SIGN_IMG")
|
||||
private String signImg;
|
||||
|
||||
/**
|
||||
* 0.进行数据 1.加签数据 3.已办不显示数据
|
||||
*/
|
||||
@TableField("F_STATUS")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 经办文件
|
||||
*/
|
||||
@TableField("F_FILE_LIST")
|
||||
private String fileList;
|
||||
|
||||
/**
|
||||
* 审批数据
|
||||
*/
|
||||
@TableField("F_DRAFT_DATA")
|
||||
private String draftData;
|
||||
|
||||
/**
|
||||
* 加签类型
|
||||
*/
|
||||
@TableField("F_APPROVER_TYPE")
|
||||
private Integer approverType;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_template")
|
||||
public class FlowTemplateEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
|
||||
|
||||
/**
|
||||
* 流程编码
|
||||
*/
|
||||
@TableField("F_EN_CODE")
|
||||
private String enCode;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
*/
|
||||
@TableField("F_FULL_NAME")
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
* 流程类型(0.发起流程 1.功能流程)
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 流程分类
|
||||
*/
|
||||
@TableField("F_CATEGORY")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@TableField("F_ICON")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 图标背景色
|
||||
*/
|
||||
@TableField("F_ICON_BACKGROUND")
|
||||
private String iconBackground;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程引擎
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.2
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024年7月11日 上午9:18
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_template_json")
|
||||
public class FlowTemplateJsonEntity extends SuperExtendEntity.SuperExtendEnabledEntity<String> {
|
||||
|
||||
/**
|
||||
* 流程模板id
|
||||
*/
|
||||
@TableField("F_TEMPLATE_ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
*/
|
||||
@TableField("F_FULL_NAME")
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
* 可见类型 0-全部可见、1-指定经办
|
||||
*/
|
||||
@TableField("F_VISIBLE_TYPE")
|
||||
private Integer visibleType;
|
||||
|
||||
/**
|
||||
* 流程模板
|
||||
*/
|
||||
@TableField("F_FLOW_TEMPLATE_JSON")
|
||||
private String flowTemplateJson;
|
||||
|
||||
/**
|
||||
* 流程版本
|
||||
*/
|
||||
@TableField("F_VERSION")
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
@TableField("F_GROUP_ID")
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* 发送配置
|
||||
*/
|
||||
@TableField("F_SEND_CONFIG_IDS")
|
||||
private String sendConfigIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.yunzhupaas.engine.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程发起用户信息
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_launch_user")
|
||||
public class FlowUserEntity extends SuperExtendEntity<String> {
|
||||
|
||||
/**
|
||||
* 组织主键
|
||||
*/
|
||||
@TableField("F_ORGANIZE_ID")
|
||||
private String organizeId;
|
||||
|
||||
/**
|
||||
* 岗位主键
|
||||
*/
|
||||
@TableField("F_POSITION_ID")
|
||||
private String positionId;
|
||||
|
||||
/**
|
||||
* 主管主键
|
||||
*/
|
||||
@TableField("F_MANAGER_ID")
|
||||
private String managerId;
|
||||
|
||||
/**
|
||||
* 上级用户
|
||||
*/
|
||||
@TableField("F_SUPERIOR")
|
||||
private String superior;
|
||||
|
||||
/**
|
||||
* 下属用户
|
||||
*/
|
||||
@TableField("F_SUBORDINATE")
|
||||
private String subordinate;
|
||||
|
||||
/**
|
||||
* 公司下所有部门
|
||||
*/
|
||||
@TableField("F_DEPARTMENT")
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 任务主键
|
||||
*/
|
||||
@TableField("F_TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 同意规则
|
||||
*
|
||||
* @author :云筑产品开发平台组
|
||||
* @version: V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date :2022/6/16 17:01
|
||||
*/
|
||||
public enum FlowAgreeRuleEnum {
|
||||
/**
|
||||
* 不启用
|
||||
*/
|
||||
notstart(1, "不启用"),
|
||||
/**
|
||||
* 审批人为发起人
|
||||
*/
|
||||
initiator(2, "发起人"),
|
||||
/**
|
||||
* 审批人与上一审批节点处理人相同
|
||||
*/
|
||||
node(4, "上一审批节点处理人相同"),
|
||||
/**
|
||||
* 审批人审批过
|
||||
*/
|
||||
pass(3, "审批人有审批过");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
FlowAgreeRuleEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FlowAgreeRuleEnum getByCode(Integer code) {
|
||||
for (FlowAgreeRuleEnum status : FlowAgreeRuleEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 异常规则
|
||||
*
|
||||
* @author :云筑产品开发平台组
|
||||
* @version: V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date :2022/6/17 10:57
|
||||
*/
|
||||
public enum FlowErrorRuleEnum {
|
||||
/**
|
||||
* 1.超级管理员
|
||||
*/
|
||||
administrator(1, "超级管理员"),
|
||||
/**
|
||||
* 2.指定人员
|
||||
*/
|
||||
initiator(2, "指定人员"),
|
||||
/**
|
||||
* 3.上一节点审批人指定处理人
|
||||
*/
|
||||
node(3, "上一节点审批人指定处理人"),
|
||||
/**
|
||||
* 4.默认审批通过
|
||||
*/
|
||||
pass(4, "默认审批通过"),
|
||||
/**
|
||||
* 5.无法提交
|
||||
*/
|
||||
notSubmit(5, "无法提交"),
|
||||
/**
|
||||
* 6.发起者本人处理
|
||||
*/
|
||||
creatorUserId(6, "发起者本人处理");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
FlowErrorRuleEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FlowErrorRuleEnum getByCode(Integer code) {
|
||||
for (FlowErrorRuleEnum status : FlowErrorRuleEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 附件条件
|
||||
*
|
||||
* @author :云筑产品开发平台组
|
||||
* @version: V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date :2022/6/14 16:50
|
||||
*/
|
||||
public enum FlowExtraRuleEnum {
|
||||
/**
|
||||
* 无条件
|
||||
*/
|
||||
unconditional(1, "无条件"),
|
||||
/**
|
||||
* 同一部门
|
||||
*/
|
||||
organize(2, "同一部门"),
|
||||
/**
|
||||
* 同一岗位
|
||||
*/
|
||||
position(3, "同一岗位"),
|
||||
/**
|
||||
* 发起人上级
|
||||
*/
|
||||
manager(4, "发起人上级"),
|
||||
/**
|
||||
* 发起人下属
|
||||
*/
|
||||
subordinate(5, "发起人下属"),
|
||||
/**
|
||||
* 同一公司
|
||||
*/
|
||||
department(6, "同一公司");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
FlowExtraRuleEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FlowExtraRuleEnum getByCode(Integer code) {
|
||||
for (FlowExtraRuleEnum status : FlowExtraRuleEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-29 上午9:18
|
||||
*/
|
||||
public enum FlowMessageEnum {
|
||||
//发起
|
||||
me(1, "me"),
|
||||
//待办
|
||||
wait(2, "wait"),
|
||||
//抄送
|
||||
circulate(3, "circulate");
|
||||
|
||||
private String message;
|
||||
private int code;
|
||||
|
||||
FlowMessageEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
|
||||
/**
|
||||
* 流程节点状态
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-26 上午9:18
|
||||
*/
|
||||
public enum FlowNodeEnum {
|
||||
//进行节点
|
||||
Process(0, "进行节点"),
|
||||
//加签人
|
||||
FreeApprover(1, "加签节点"),
|
||||
//无用节点
|
||||
Futility(-1, "无用节点");
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
FlowNodeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 工作流开发
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.0.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
public enum FlowRecordEnum {
|
||||
|
||||
//拒绝
|
||||
reject(0, "拒绝"),
|
||||
//同意
|
||||
audit(1, "同意"),
|
||||
//提交
|
||||
submit(2, "提交"),
|
||||
//撤回
|
||||
revoke(3, "撤回"),
|
||||
//终止
|
||||
cancel(4, "终止"),
|
||||
//指派
|
||||
assign(5, "指派"),
|
||||
//加签
|
||||
copyId(6, "加签"),
|
||||
//转办
|
||||
transfer(7, "转办"),
|
||||
//变更
|
||||
change(8, "变更"),
|
||||
//复活
|
||||
resurrection(9, "复活"),
|
||||
//前加签
|
||||
befoCopyId(10, "前加签"),
|
||||
//挂起
|
||||
suspend(11, "挂起"),
|
||||
//恢复
|
||||
restore(12, "恢复"),
|
||||
//转向
|
||||
swerve(13, "转向"),
|
||||
//结束
|
||||
end(100, "结束"),
|
||||
//节点撤回
|
||||
recall(-1, "节点撤回");
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
FlowRecordEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 工作流开发
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.0.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
public enum FlowRecordListEnum {
|
||||
|
||||
//部门
|
||||
department("1", "部门"),
|
||||
// 角色
|
||||
role("2", "角色"),
|
||||
//岗位
|
||||
position("3", "岗位");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
FlowRecordListEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 提交状态
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-26 上午9:18
|
||||
*/
|
||||
public enum FlowStatusEnum {
|
||||
//不操作
|
||||
none("-1"),
|
||||
//保存
|
||||
save("1"),
|
||||
// 提交
|
||||
submit("0");
|
||||
|
||||
private String message;
|
||||
|
||||
FlowStatusEnum(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FlowStatusEnum getByCode(Integer code) {
|
||||
for (FlowStatusEnum status : FlowStatusEnum.values()) {
|
||||
if (status.getMessage().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
/**
|
||||
* 经办对象
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-26 上午9:18
|
||||
*/
|
||||
public enum FlowTaskOperatorEnum {
|
||||
|
||||
/**
|
||||
* 发起者主管
|
||||
*/
|
||||
LaunchCharge(1, "发起者主管"),
|
||||
/**
|
||||
* 部门经理
|
||||
*/
|
||||
DepartmentCharge(2, "部门经理"),
|
||||
/**
|
||||
* 发起者本人
|
||||
*/
|
||||
InitiatorMe(3, "发起者本人"),
|
||||
/**
|
||||
* 变量
|
||||
*/
|
||||
Variate(4, "变量"),
|
||||
/**
|
||||
* 环节
|
||||
*/
|
||||
Tache(5, "环节"),
|
||||
/**
|
||||
* 指定人
|
||||
*/
|
||||
Nominator(6, "指定人"),
|
||||
/**
|
||||
* 候选人
|
||||
*/
|
||||
Candidate(7, "候选人"),
|
||||
/**
|
||||
* 服务
|
||||
*/
|
||||
Serve(9, "服务");
|
||||
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
FlowTaskOperatorEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getMessageByCode(String code) {
|
||||
for (FlowTaskOperatorEnum status : FlowTaskOperatorEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status.message;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FlowTaskOperatorEnum getByCode(String code) {
|
||||
for (FlowTaskOperatorEnum status : FlowTaskOperatorEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.yunzhupaas.engine.enums;
|
||||
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-09-26 上午9:18
|
||||
*/
|
||||
public enum FlowTaskStatusEnum {
|
||||
//等待提交
|
||||
Draft(0, "等待提交"),
|
||||
//等待审核
|
||||
Handle(1, "等待审核"),
|
||||
//审核通过
|
||||
Adopt(2, "审核通过"),
|
||||
//审核驳回
|
||||
Reject(3, "审核驳回"),
|
||||
//撤回终止
|
||||
Revoke(4, "撤回终止"),
|
||||
//审核作废
|
||||
Cancel(5, "审核作废"),
|
||||
//审核挂起
|
||||
Suspend(6, "审核挂起"),
|
||||
//撤回提交
|
||||
Resubmit(7, "撤回提交");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
FlowTaskStatusEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getMessageByCode(Integer code) {
|
||||
for (FlowTaskStatusEnum status : FlowTaskStatusEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status.message;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态code获取枚举值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FlowTaskStatusEnum getByCode(Integer code) {
|
||||
for (FlowTaskStatusEnum status : FlowTaskStatusEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.yunzhupaas.engine.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.base.Pagination;
|
||||
import com.yunzhupaas.engine.util.FlowNature;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/3/15 9:17
|
||||
*/
|
||||
@Data
|
||||
public class FlowHandleModel extends Pagination {
|
||||
/**
|
||||
* 意见
|
||||
**/
|
||||
@Schema(description = "意见")
|
||||
private String handleOpinion;
|
||||
/**
|
||||
* 加签人
|
||||
**/
|
||||
@Schema(description = "加签人")
|
||||
private String freeApproverUserId;
|
||||
/**
|
||||
* 加签类型 1.前 2 后
|
||||
*/
|
||||
@Schema(description = "加签类型")
|
||||
private Integer freeApproverType = FlowNature.Later;
|
||||
/**
|
||||
* 审批数据
|
||||
**/
|
||||
@Schema(description = "审批数据")
|
||||
private Map<String, Object> formData = new HashMap<>();
|
||||
/**
|
||||
* 自定义抄送人
|
||||
**/
|
||||
@Schema(description = "自定义抄送人")
|
||||
private String copyIds;
|
||||
/**
|
||||
* 签名
|
||||
**/
|
||||
@Schema(description = "签名")
|
||||
private String signImg;
|
||||
/**
|
||||
* 指派节点
|
||||
**/
|
||||
@Schema(description = "指派节点")
|
||||
private String nodeCode;
|
||||
/**
|
||||
* 候选人
|
||||
*/
|
||||
@Schema(description = "候选人")
|
||||
private Map<String, List<String>> candidateList = new HashMap<>();
|
||||
/**
|
||||
* 异常处理人
|
||||
*/
|
||||
@Schema(description = "异常处理人")
|
||||
private Map<String, List<String>> errorRuleUserList = new HashMap<>();
|
||||
/**
|
||||
* 选择分支
|
||||
*/
|
||||
@Schema(description = "选择分支")
|
||||
private List<String> branchList = new ArrayList<>();
|
||||
/**
|
||||
* 批量审批id
|
||||
*/
|
||||
@Schema(description = "批量审批主键")
|
||||
private List<String> ids = new ArrayList<>();
|
||||
/**
|
||||
* 经办文件
|
||||
**/
|
||||
@Schema(description = "经办文件")
|
||||
private List<Object> fileList = new ArrayList<>();
|
||||
/**
|
||||
* 批量审批类型 0.通过 1.拒绝 2.转办
|
||||
*/
|
||||
@Schema(description = "批量审批类型")
|
||||
private Integer batchType = 0;
|
||||
/**
|
||||
* 批量发起用户
|
||||
*/
|
||||
@Schema(description = "批量发起用户")
|
||||
private List<String> delegateUserList = new ArrayList<>();
|
||||
/**
|
||||
* 驳回节点
|
||||
*/
|
||||
@Schema(description = "驳回节点")
|
||||
private String rejectStep = FlowNature.START;
|
||||
/**
|
||||
* 驳回类型 1.重新审批 2.从当前节点审批
|
||||
*/
|
||||
@Schema(description = "驳回类型")
|
||||
private Integer rejectType = FlowNature.RestartType;
|
||||
/**
|
||||
* false 变更 true 复活
|
||||
*/
|
||||
@Schema(description = "类型")
|
||||
private Boolean resurgence = false;
|
||||
/**
|
||||
* true 同步子流程 false 全部子流程
|
||||
*/
|
||||
@Schema(description = "冻结类型")
|
||||
private Boolean suspend = false;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user