工作流完善

This commit is contained in:
wangwei
2017-09-06 17:59:23 +08:00
parent 1732bfaa8a
commit 240d894060
2 changed files with 22 additions and 6 deletions

View File

@@ -105,13 +105,21 @@ public interface BpmTaskService{
void reject(String taskId);
/**
* 设置办
* 设置办人
*
* @param taskId 当前环节ID
* @param actId 当前环节图元ID
* @param userId 用户ID
*/
void setAssignee(String taskId, String actId, String userId);
void addCandidateUser(String taskId, String actId, String userId);
/**
* 设置办理人
*
* @param taskId 当前环节ID
* @param userId 用户ID
*/
void setAssignee(String taskId, String userId);
/**
* 结束流程

View File

@@ -17,6 +17,7 @@ import org.hswebframework.utils.StringUtils;
import org.hswebframework.web.NotFoundException;
import org.hswebframework.web.entity.organizational.RelationDefineEntity;
import org.hswebframework.web.entity.workflow.ActDefEntity;
import org.hswebframework.web.organizational.authorization.relation.Relation;
import org.hswebframework.web.organizational.authorization.relation.Relations;
import org.hswebframework.web.service.organizational.RelationDefineService;
import org.hswebframework.web.service.organizational.RelationInfoService;
@@ -259,21 +260,28 @@ public class BpmTaskServiceImp extends FlowableAbstract implements BpmTaskServic
}
@Override
public void setAssignee(String taskId, String actId, String userId) {
public void addCandidateUser(String taskId, String actId, String userId) {
if(!StringUtils.isNullOrEmpty(actId)){
// 获取节点配置信息
ActDefEntity actDefEntity = actDefService.selectSingle(single(ActDefEntity.actId,actId));
// 获取矩阵信息
RelationDefineEntity relationDefineEntity = relationDefineService.selectByPk(actDefEntity.getDefId());
// 获取人员信息
Relations relations = relationInfoService.getRelations(relationDefineEntity.getName(),userId);
List<Relation> relations = relationInfoService.getRelations("person",userId).findRev(relationDefineEntity.getName());
// 设置待办人
taskService.setAssignee(taskId, userId);
for(Relation relation : relations){
taskService.addCandidateUser(taskId,relation.getTarget() );
}
}else {
taskService.setAssignee(taskId, userId);
taskService.addCandidateUser(taskId, userId);
}
}
@Override
public void setAssignee(String taskId, String userId) {
taskService.setAssignee(taskId, userId);
}
@Override
public void endProcess(String procInstId) {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();