mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-09 17:34:50 +08:00
优化工作流
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package org.hswebframework.web.workflow.service;
|
||||
|
||||
import org.hswebframework.web.workflow.service.dto.ActivityCandidateInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityConfigurationService {
|
||||
|
||||
/**
|
||||
* 获取一个流程环节的办理候选人
|
||||
*
|
||||
* @param doingUserId 当前办理用户ID
|
||||
* @param processDefineId 流程定义ID
|
||||
* @param activityId 环节Id
|
||||
* @return 该环节的候选人, 如果没有候选人则返回空集合.不会返回null
|
||||
*/
|
||||
List<ActivityCandidateInfo> getCandidate(String doingUserId, String processDefineId, String activityId);
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.hswebframework.web.workflow.service;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.runtime.Job;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.hswebframework.web.workflow.service.request.StartProcessRequest;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
@@ -24,18 +25,9 @@ public interface BpmProcessService{
|
||||
/**
|
||||
* 启动一个流程,并初始化自定义主表单数据
|
||||
*
|
||||
* @param creator_id 流程创建人
|
||||
* @param procDefKey 流程定义key
|
||||
* @param activity 下一环节id
|
||||
* @param next_claim 下一步执行人(预留)
|
||||
* @param businessKey 业务数据ID
|
||||
* @param variables 启动参数(流程变量,流程未结束前任意环节都可以使用)
|
||||
* @return 启动后的流程实例
|
||||
* @throws Exception 异常信息
|
||||
*/
|
||||
ProcessInstance startProcessInstance(String creator_id, String procDefKey, String activity, String next_claim,
|
||||
String businessKey,
|
||||
Map<String, Object> variables);
|
||||
ProcessInstance startProcessInstance(StartProcessRequest request);
|
||||
|
||||
/**
|
||||
* 根据流程图key获取所有运行中流程分页
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package org.hswebframework.web.workflow.service;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author wangwei
|
||||
* @Date 2017/9/13.
|
||||
*/
|
||||
public interface BpmUtilsService {
|
||||
|
||||
/**
|
||||
* 根据配置获取用户
|
||||
* @param userId
|
||||
* @param actDefEntity
|
||||
* @return
|
||||
*/
|
||||
// List<String> selectUserIdsBy(String userId, ActDefEntity actDefEntity);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.hswebframework.web.workflow.service.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hswebframework.web.authorization.Authentication;
|
||||
import org.hswebframework.web.organizational.authorization.PersonnelAuthentication;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ActivityCandidateInfo {
|
||||
private Authentication user;
|
||||
|
||||
private PersonnelAuthentication person;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import org.activiti.engine.task.Task;
|
||||
import org.hswebframework.utils.StringUtils;
|
||||
import org.hswebframework.web.workflow.service.BpmProcessService;
|
||||
import org.hswebframework.web.workflow.service.BpmTaskService;
|
||||
import org.hswebframework.web.workflow.service.request.StartProcessRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,6 +36,14 @@ public class BpmProcessServiceImp extends AbstractFlowableService implements Bpm
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessInstance startProcessInstance(StartProcessRequest request) {
|
||||
request.tryValidate();
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ProcessInstance startProcessInstance(String creatorId,
|
||||
String procDefKey,
|
||||
String activity,
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
package org.hswebframework.web.workflow.service.imp;
|
||||
|
||||
import org.hswebframework.web.entity.organizational.PersonEntity;
|
||||
import org.hswebframework.web.organizational.authorization.relation.Relation;
|
||||
import org.hswebframework.web.service.organizational.PersonService;
|
||||
import org.hswebframework.web.service.organizational.RelationInfoService;
|
||||
import org.hswebframework.web.workflow.service.BpmUtilsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author wangwei
|
||||
* @Date 2017/9/13.
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Throwable.class)
|
||||
public class BpmUtilsServiceImp implements BpmUtilsService {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired(required = false)
|
||||
PersonService personService;
|
||||
@Autowired(required = false)
|
||||
RelationInfoService relationInfoService;
|
||||
|
||||
public void assertOrgModuleReady(){
|
||||
Assert.notNull(personService,"未引入组织架构模块依赖");
|
||||
Assert.notNull(relationInfoService,"未引入组织架构模块依赖");
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<String> selectUserIdsBy(String userId, ActDefEntity actDefEntity) {
|
||||
// assertOrgModuleReady();
|
||||
// List<String> list = new ArrayList<>();
|
||||
// // 根据配置类型 获取人员信息 设置待办人
|
||||
// if ("person".equals(actDefEntity.getDimension())) { // 矩阵
|
||||
// List<Relation> relations = relationInfoService.getRelations(actDefEntity.getDimension(), userId).findPos(actDefEntity.getDefId());
|
||||
// for (Relation relation : relations) {
|
||||
// list.add(relation.getTarget());
|
||||
// }
|
||||
// } else if ("position".equals(actDefEntity.getDimension())) { // 岗位
|
||||
// List<PersonEntity> personEntities = personService.selectByPositionId(actDefEntity.getDefId());
|
||||
// for(PersonEntity personEntity:personEntities){
|
||||
// list.add(personEntity.getUserId());
|
||||
// }
|
||||
// } else if ("role".equals(actDefEntity.getDimension())) { // 角色
|
||||
// List<PersonEntity> personEntities = personService.selectByRoleId(actDefEntity.getDefId());
|
||||
// for(PersonEntity personEntity:personEntities){
|
||||
// list.add(personEntity.getUserId());
|
||||
// }
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.hswebframework.web.authorization.Authentication;
|
||||
import org.hswebframework.web.authorization.User;
|
||||
import org.hswebframework.web.commons.bean.ValidateBean;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -19,7 +20,8 @@ import java.util.Map;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StartProcessRequest {
|
||||
@ToString
|
||||
public class StartProcessRequest implements ValidateBean{
|
||||
/**
|
||||
* 流程定义KEY
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user