Commit 63b45660 by wuwenlong

获取角色公司bugfix;

parent a6af315d
...@@ -153,16 +153,19 @@ public class UserSessionUtils extends UserSession { ...@@ -153,16 +153,19 @@ 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); // 查询组织信息
Optional.ofNullable(companyCodes).orElse(new ArrayList<>()).stream().forEach( code -> { List<Org> orgs = HGXSTools.XsOrg.list(companyCodes);
orgs.addAll(HGXSTools.XsOrg.queryByParent(code,OrgTypeEnum.COMPANY.getCode())); Optional.ofNullable(companyCodes).orElse(new ArrayList<>()).stream().forEach(code -> {
}); 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( });
Collectors.toMap(Company::getCompanyCode, Function.identity(), (oldValue, newValue) -> oldValue), return orgs.stream().filter(o -> StringUtils.equals(o.getOrgType(), OrgTypeEnum.COMPANY.getCode())).map(item -> new Company(item.getOrgId(), item.getOrgCname())).collect(Collectors.collectingAndThen(
// 将Map转回List Collectors.toMap(Company::getCompanyCode, Function.identity(), (oldValue, newValue) -> oldValue),
m -> new ArrayList<>(m.values()) // 将Map转回List
)); 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