|
|
@@ -7,8 +7,10 @@ import java.util.stream.Stream;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
|
+import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
import com.lc.ibps.org.party.persistence.entity.*;
|
|
|
import com.lc.ibps.org.vo.PartyEntityAttrVo;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -855,21 +857,23 @@ public class CommonScript extends BaseScript {
|
|
|
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;
|
|
|
+ //如果匹配角色参数值,则返回用户所属地点的所有部门id
|
|
|
+ String userId = currentContext.getCurrentUserId();
|
|
|
+ List<PartyPositionPo> positionPos = PartyUtil.findPosByUserId(userId);
|
|
|
+ if(CollectionUtils.isNotEmpty(positionPos)){
|
|
|
+ String didian = positionPos.get(0).getPath().split("\\.")[1];
|
|
|
+ ICommonDao<?> commonDao = AppUtil.getBean(ICommonDao.class);
|
|
|
+ String sql ="SELECT id_ FROM IBPS_PARTY_entity WHERE path_ LIKE '%%%s%%';";
|
|
|
+ sql = String.format(sql,didian);
|
|
|
+ List<Map<String, Object>> data = (List<Map<String, Object>>)commonDao.query(sql);
|
|
|
+ if(CollectionUtils.isNotEmpty(data)){
|
|
|
+ List<String> result = new ArrayList<String>();
|
|
|
+ for (Map<String, Object> d : data) {
|
|
|
+ result.add((String)d.get("id_"));
|
|
|
+ }
|
|
|
+ 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;
|
|
|
}
|
|
|
}
|
|
|
}
|