Commit 850bab91 by 宋祥

1.返回空对象

parent c0fe2b26
...@@ -65,7 +65,7 @@ public class UserSessionUtils extends UserSession { ...@@ -65,7 +65,7 @@ public class UserSessionUtils extends UserSession {
public static String getAccountCode() { public static String getAccountCode() {
String loginName = getLoginName(); String loginName = getLoginName();
if (loginName == null) { if (loginName == null) {
return null; return "";
} }
String accountCode = MapUtils.getString(ACCOUNT_MAP, loginName); String accountCode = MapUtils.getString(ACCOUNT_MAP, loginName);
if (accountCode == null) { if (accountCode == null) {
...@@ -84,7 +84,7 @@ public class UserSessionUtils extends UserSession { ...@@ -84,7 +84,7 @@ public class UserSessionUtils extends UserSession {
public static List<String> getOrgId() { public static List<String> getOrgId() {
List<Org> orgs = HGXSTools.XsOrg.queryByUser(); List<Org> orgs = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isEmpty(orgs)) { if (CollectionUtils.isEmpty(orgs)) {
return null; return new ArrayList<>();
} }
return orgs.stream().map(item -> item.getOrgId()).collect(Collectors.toList()); return orgs.stream().map(item -> item.getOrgId()).collect(Collectors.toList());
} }
...@@ -97,7 +97,7 @@ public class UserSessionUtils extends UserSession { ...@@ -97,7 +97,7 @@ public class UserSessionUtils extends UserSession {
public static List<String> getFactoryCode() { public static List<String> getFactoryCode() {
List<Org> orgs = HGXSTools.XsOrg.queryByUser(); List<Org> orgs = HGXSTools.XsOrg.queryByUser();
if (CollectionUtils.isEmpty(orgs)) { if (CollectionUtils.isEmpty(orgs)) {
return null; return new ArrayList<>();
} }
List<String> factoryCodes = new ArrayList<>(); List<String> factoryCodes = new ArrayList<>();
for (Org org : orgs) { for (Org org : orgs) {
...@@ -125,7 +125,7 @@ public class UserSessionUtils extends UserSession { ...@@ -125,7 +125,7 @@ public class UserSessionUtils extends UserSession {
public static List<Company> getRoleCompany() { public static List<Company> getRoleCompany() {
List<UserGroup> userGroups = HGXSTools.XsUserGroup.queryByUser(); List<UserGroup> userGroups = HGXSTools.XsUserGroup.queryByUser();
if (CollectionUtils.isEmpty(userGroups)) { if (CollectionUtils.isEmpty(userGroups)) {
return null; return new ArrayList<>();
} }
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());
...@@ -142,7 +142,7 @@ public class UserSessionUtils extends UserSession { ...@@ -142,7 +142,7 @@ public class UserSessionUtils extends UserSession {
public static List<Dept> getDepByCompany(String companyCode) { public static List<Dept> getDepByCompany(String companyCode) {
List<Org> orgs = HGXSTools.XsOrg.queryByParent(companyCode, OrgTypeEnum.DEPT.getCode()); List<Org> orgs = HGXSTools.XsOrg.queryByParent(companyCode, OrgTypeEnum.DEPT.getCode());
if (CollectionUtils.isEmpty(orgs)) { if (CollectionUtils.isEmpty(orgs)) {
return null; return new ArrayList<>();
} }
return orgs.stream().map(item -> new Dept(item.getOrgId(), item.getOrgCname())).collect(Collectors.toList()); return orgs.stream().map(item -> new Dept(item.getOrgId(), item.getOrgCname())).collect(Collectors.toList());
} }
...@@ -156,7 +156,7 @@ public class UserSessionUtils extends UserSession { ...@@ -156,7 +156,7 @@ public class UserSessionUtils extends UserSession {
// 查询该公司下的所有组织机构 // 查询该公司下的所有组织机构
List<String> orgIds = HGXSTools.XsOrg.queryChildren(companyCode); List<String> orgIds = HGXSTools.XsOrg.queryChildren(companyCode);
if (CollectionUtils.isEmpty(orgIds)) { if (CollectionUtils.isEmpty(orgIds)) {
return null; return new ArrayList<>();
} }
return HGXSTools.XsUser.queryByOrg(orgIds); return HGXSTools.XsUser.queryByOrg(orgIds);
} }
......
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