|
@@ -40,7 +40,12 @@ public class EmsAuthServiceImpl extends AbstractAuthServiceImpl {
|
|
// 两者都为空时不做校验
|
|
// 两者都为空时不做校验
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- ResultReturn<Group> queryResult = emsSaasWebClient.queryGroupProjectList(new JSONObject());
|
|
|
|
|
|
+ //
|
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
|
+ if (StrUtil.isNotBlank(AppContext.getContext().getProjectId())){
|
|
|
|
+ param.put(CommonConstant.QUERY_PROJECTIDS,CollUtil.newArrayList(AppContext.getContext().getProjectId()));
|
|
|
|
+ }
|
|
|
|
+ ResultReturn<Group> queryResult = emsSaasWebClient.queryGroupProjectList(param);
|
|
if (!CommonConstant.QUERY_SUCCESS.equals(queryResult.getResult())){
|
|
if (!CommonConstant.QUERY_SUCCESS.equals(queryResult.getResult())){
|
|
throw new BusinessException(queryResult.getResultMsg());
|
|
throw new BusinessException(queryResult.getResultMsg());
|
|
}
|
|
}
|
|
@@ -51,26 +56,20 @@ public class EmsAuthServiceImpl extends AbstractAuthServiceImpl {
|
|
Map<String, List<Project>> groupMap = content.stream()
|
|
Map<String, List<Project>> groupMap = content.stream()
|
|
.collect(Collectors.toMap(Group::getGroupCode, Group::getProjects, (k1, k2) -> k1));
|
|
.collect(Collectors.toMap(Group::getGroupCode, Group::getProjects, (k1, k2) -> k1));
|
|
// 1.没有集团编码时根据项目匹配集团
|
|
// 1.没有集团编码时根据项目匹配集团
|
|
- if (StrUtil.isBlank(AppContext.getContext().getGroupCode())){
|
|
|
|
- // 如果集团编码为空则通过项目id查找
|
|
|
|
- Set<Map.Entry<String, List<Project>>> entries = groupMap.entrySet();
|
|
|
|
- flag:
|
|
|
|
- for (Map.Entry<String, List<Project>> entry : entries) {
|
|
|
|
- if (CollUtil.isEmpty(entry.getValue())){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- for (Project project : entry.getValue()) {
|
|
|
|
- if (AppContext.getContext().getProjectId().equals(project.getProjectId())){
|
|
|
|
- AppContext.getContext().setGroupCode(entry.getKey());
|
|
|
|
- break flag;
|
|
|
|
- }
|
|
|
|
|
|
+ // 如果集团编码为空则通过项目id查找
|
|
|
|
+ Set<Map.Entry<String, List<Project>>> entries = groupMap.entrySet();
|
|
|
|
+ flag:
|
|
|
|
+ for (Map.Entry<String, List<Project>> entry : entries) {
|
|
|
|
+ if (CollUtil.isEmpty(entry.getValue())){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ for (Project project : entry.getValue()) {
|
|
|
|
+ if (AppContext.getContext().getProjectId().equals(project.getProjectId())){
|
|
|
|
+ AppContext.getContext().setGroupCode(entry.getKey());
|
|
|
|
+ break flag;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// if (StrUtil.isBlank(AppContext.getContext().getGroupCode())){
|
|
|
|
-// // 无集团编码时,默认为配置的集团编码
|
|
|
|
-// AppContext.getContext().setGroupCode(SpringHelper.getString(AdmCommonConstant.MIDDLEWARE_GROUP_CODE));
|
|
|
|
-// }
|
|
|
|
// 2.验证集团是否有效
|
|
// 2.验证集团是否有效
|
|
if (StrUtil.isBlank(AppContext.getContext().getGroupCode())
|
|
if (StrUtil.isBlank(AppContext.getContext().getGroupCode())
|
|
|| !groupMap.containsKey(AppContext.getContext().getGroupCode())){
|
|
|| !groupMap.containsKey(AppContext.getContext().getGroupCode())){
|