|
|
@@ -850,7 +850,32 @@ public class CommonScript extends BaseScript {
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+ public List<String> findPositionId(String roleName) {
|
|
|
+ if(StringUtil.isNotBlank(roleName)) {
|
|
|
+ List<String> roles = Arrays.asList(roleName.toLowerCase().split(","));
|
|
|
+ for (DefaultPartyRolePo partyRolePo : PartyUtil.findRoleByUserId(currentContext.getCurrentUserId())) {
|
|
|
+ if (roles.contains(partyRolePo.getAlias().toLowerCase())) {
|
|
|
+ List<String> result = new ArrayList<String>();
|
|
|
+ //find all position nodes
|
|
|
+ APIResult<List<PartyEntityTreePo>> tree = PartyUtil.findAllPositions();
|
|
|
+ if (!tree.isSuccess()) {
|
|
|
+ result.add("0");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ List<PartyEntityTreePo> treeData = tree.getData();
|
|
|
+ //remove root node
|
|
|
+ treeData = treeData.stream().filter(x -> !x.getId().equals(StringPool.ZERO)).collect(Collectors.toList());
|
|
|
+ //get all position
|
|
|
+ List<String> posWithChild = treeData.stream()
|
|
|
+ .map(PartyEntityTreePo::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return posWithChild;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return findPositionId();
|
|
|
|
|
|
+ }
|
|
|
/**
|
|
|
* 脚本获取用户的岗位ID 只能用于in 或者 not in 在。。之内和 不在。。之内
|
|
|
* cscript.findPositionId()
|