This commit is contained in:
qimingjin 2020-12-20 19:46:06 +08:00
parent 3c965f5078
commit 6d2390e368
5 changed files with 43 additions and 10 deletions

View File

@ -115,7 +115,7 @@ public class SysUserController extends BaseController
String jobNumber = sysSequenceService.getNewSequenceNo("SNOW");
mmap.put("jobNumber",jobNumber);
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()&&r.getRoleType()==UserConstants.SYSTEM_ROLE_TYPE).collect(Collectors.toList()));
mmap.put("posts", postService.selectPostAll());
return prefix + "/add";
}

View File

@ -49,5 +49,5 @@ public interface FlowableUserService {
* @param userId
* @return
*/
List<SysRole> getFlowGroupByUserId(String userId);
List<SysRole> getFlowGroupByUserId(Long userId);
}

View File

@ -18,6 +18,7 @@ import com.snow.flowable.config.ICustomProcessDiagramGenerator;
import com.snow.flowable.domain.*;
import com.snow.flowable.enums.FlowFinishedStatusEnum;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.FlowableUserService;
import com.snow.system.domain.ActDeModel;
import com.snow.system.domain.SysRole;
import com.snow.system.domain.SysUser;
@ -117,6 +118,9 @@ public class FlowableServiceImpl implements FlowableService {
@Autowired
private ObjectMapper objectMapper;
@Resource
private FlowableUserService flowableUserService;
@Override
public void saveModel(ActDeModel actDeModel) {
// 构建ModelEditorSource
@ -387,7 +391,7 @@ public class FlowableServiceImpl implements FlowableService {
)
.forEach(identityLink -> {
String groupId = identityLink.getGroupId();
List<SysUser> sysUsers = sysUserMapper.selectUserListByRoleId(groupId);
List<SysUser> sysUsers=flowableUserService.getUserByFlowGroupId(Long.parseLong(groupId));
userList.addAll(sysUsers);
});
identityLinksForTask.stream().filter(identityLink ->
@ -419,7 +423,7 @@ public class FlowableServiceImpl implements FlowableService {
&&identityLink.getType().equals("candidate"))
.forEach(identityLink -> {
String groupId = identityLink.getGroupId();
List<SysUser> sysUsers = sysUserMapper.selectUserListByRoleId(groupId);
List<SysUser> sysUsers=flowableUserService.getUserByFlowGroupId(Long.parseLong(groupId));
userList.addAll(sysUsers);
});
historicIdentityLinksForTask.stream().filter(identityLink -> !StringUtils.isEmpty(identityLink.getUserId())
@ -922,7 +926,7 @@ public class FlowableServiceImpl implements FlowableService {
}else {
for (String candidateGroup:candidateGroups){
if(com.snow.common.utils.StringUtils.isNumeric(candidateGroup)){
List<SysUser> sysUsers = sysUserMapper.selectUserListByRoleId(candidateGroup);
List<SysUser> sysUsers=flowableUserService.getUserByFlowGroupId(Long.parseLong(candidateGroup));
if(!CollectionUtils.isEmpty(sysUsers)){
List<String> collect = sysUsers.stream().map(SysUser::getUserName).collect(Collectors.toList());
handleNameList.addAll(collect);
@ -1061,6 +1065,13 @@ public class FlowableServiceImpl implements FlowableService {
}
}
/**
* 获取高亮的线
* @param bpmnModel
* @param processDefinitionEntity
* @param historicActivityInstances
* @return
*/
private List<String> getHighLightedFlows(BpmnModel bpmnModel,ProcessDefinitionEntity processDefinitionEntity,List<HistoricActivityInstance> historicActivityInstances) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //24小时制
List<String> highFlows = new ArrayList<String>();// 用以保存高亮的线flowId

View File

@ -32,7 +32,8 @@ public class FlowableUserServiceImpl implements FlowableUserService {
//存放所有子几点
private static Set<Long> childFlowGroup= new HashSet<>();
//存放所有的父节点
private static Set<Long> parentFlowGroup= new HashSet<>();
@Autowired
private ISysUserService iSysUserService;
@Autowired
@ -127,8 +128,9 @@ public class FlowableUserServiceImpl implements FlowableUserService {
}
@Override
public List<SysRole> getFlowGroupByUserId(String userId) {
return null;
public List<SysRole> getFlowGroupByUserId(Long userId) {
List<SysRole> sysRoles = sysRoleService.selectRolesByUserId(userId);
return sysRoles;
}
@ -149,11 +151,31 @@ public class FlowableUserServiceImpl implements FlowableUserService {
for(FlowGroupDO flowGroupDO: sysRoleList){
// 不为空则递归
getAllSonSysRoleList(flowGroupDO.getRoleId());
}
}
return childFlowGroup;
}
/**
* 获取某个子节点下面的所有父节点
* @param roleId
* @return
*/
public Set<Long> getAllParentSysRoleList(Long roleId){
SysRole sysRole = sysRoleService.selectRoleById(roleId);
if(StringUtils.isNotNull(sysRole)){
FlowGroupDO flowGroupDO=new FlowGroupDO();
flowGroupDO.setRoleId(sysRole.getParentId());
flowGroupDO.setRoleType(UserConstants.FLOW_ROLE_TYPE);
List<FlowGroupDO> sysRoleList = flowGroupDOService.selectFlowGroupDOList(flowGroupDO);
Set<Long> collect = sysRoleList.stream().map(FlowGroupDO::getRoleId).collect(Collectors.toSet());
parentFlowGroup.addAll(collect);
for(Long id: collect){
// 不为空则递归
getAllParentSysRoleList(id);
}
}
return parentFlowGroup;
}
}

View File

@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roleType != null and roleType != ''"> and role_type = #{roleType}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
</where>
order by parent_id
order by role_sort
</select>
<select id="selectFlowGroupDOById" parameterType="Long" resultMap="FlowGroupDOResult">