Commit 63b45660 by wuwenlong

获取角色公司bugfix;

parent a6af315d
...@@ -153,17 +153,20 @@ public class UserSessionUtils extends UserSession { ...@@ -153,17 +153,20 @@ public class UserSessionUtils extends UserSession {
} }
List<String> companyCodes = userGroups.stream().map(UserGroup::getCompanyCode) List<String> companyCodes = userGroups.stream().map(UserGroup::getCompanyCode)
.filter(StringUtils::isNotBlank).collect(Collectors.toList()); .filter(StringUtils::isNotBlank).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(companyCodes)) {
// 查询组织信息 // 查询组织信息
List<Org> orgs = HGXSTools.XsOrg.list(companyCodes); List<Org> orgs = HGXSTools.XsOrg.list(companyCodes);
Optional.ofNullable(companyCodes).orElse(new ArrayList<>()).stream().forEach( code -> { Optional.ofNullable(companyCodes).orElse(new ArrayList<>()).stream().forEach(code -> {
orgs.addAll(HGXSTools.XsOrg.queryByParent(code,OrgTypeEnum.COMPANY.getCode())); orgs.addAll(HGXSTools.XsOrg.queryByParent(code, OrgTypeEnum.COMPANY.getCode()));
}); });
return orgs.stream().filter(o->StringUtils.equals(o.getOrgType(),OrgTypeEnum.COMPANY.getCode())).map(item -> new Company(item.getOrgId(), item.getOrgCname())).collect(Collectors.collectingAndThen( return orgs.stream().filter(o -> StringUtils.equals(o.getOrgType(), OrgTypeEnum.COMPANY.getCode())).map(item -> new Company(item.getOrgId(), item.getOrgCname())).collect(Collectors.collectingAndThen(
Collectors.toMap(Company::getCompanyCode, Function.identity(), (oldValue, newValue) -> oldValue), Collectors.toMap(Company::getCompanyCode, Function.identity(), (oldValue, newValue) -> oldValue),
// 将Map转回List // 将Map转回List
m -> new ArrayList<>(m.values()) m -> new ArrayList<>(m.values())
)); ));
} }
return new ArrayList<Company>();
}
/** /**
* 获取指定公司的部门列表 * 获取指定公司的部门列表
......
...@@ -2,7 +2,6 @@ package com.baosight.hggp.hg.cb.service; ...@@ -2,7 +2,6 @@ package com.baosight.hggp.hg.cb.service;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cb.domain.HGCB001; import com.baosight.hggp.hg.cb.domain.HGCB001;
import com.baosight.hggp.hg.cb.domain.HGCB002;
import com.baosight.hggp.hg.cb.domain.HGCB005; import com.baosight.hggp.hg.cb.domain.HGCB005;
import com.baosight.hggp.hg.cb.tools.HGCBTools; import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cw.domain.HGCW001; import com.baosight.hggp.hg.cw.domain.HGCW001;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment