|
|
@@ -5,10 +5,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 用户简单信息,前台程序使用
|
|
|
@@ -37,20 +34,34 @@ public class UserInfo {
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(user.getEnterprises())) {
|
|
|
Enterprise current = user.getEnterprise();
|
|
|
- List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
+ List<SimpleEnterpriseInfo> list = new ArrayList<SimpleEnterpriseInfo>();
|
|
|
for (Enterprise enterprise : user.getEnterprises()) {
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- map.put("enName", enterprise.getEnName());
|
|
|
- map.put("uu", enterprise.getUu());
|
|
|
- map.put("isVendor",enterprise.getEnMallVendorStatus());
|
|
|
+ SimpleEnterpriseInfo simpleEnterpriseInfo= new SimpleEnterpriseInfo();
|
|
|
+ simpleEnterpriseInfo.setEnName(enterprise.getEnName());
|
|
|
+ simpleEnterpriseInfo.setUu(enterprise.getUu());
|
|
|
+ simpleEnterpriseInfo.setIsVendor(enterprise.getEnMallVendorStatus());
|
|
|
if(enterprise.getEnSaasStatus() != null && enterprise.getEnSaasStatus() == Status.ENABLED.value()) {
|
|
|
- map.put("enSaasUrl", enterprise.getEnSaasUrl());
|
|
|
+ simpleEnterpriseInfo.setEnSaasUrl(enterprise.getEnSaasUrl());
|
|
|
}
|
|
|
if (enterprise.equals(current)){
|
|
|
- map.put("current", true);
|
|
|
+ simpleEnterpriseInfo.setCurrent(true);
|
|
|
}
|
|
|
- list.add(map);
|
|
|
+ for (UserLoginTime userLoginTime : user.getUserLoginTimeSet()){
|
|
|
+ if (userLoginTime.getEnUU().equals(enterprise.getUu())){
|
|
|
+ simpleEnterpriseInfo.setLastLoginTime(userLoginTime.getLoginTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(simpleEnterpriseInfo);
|
|
|
}
|
|
|
+
|
|
|
+ Collections.sort(list,new Comparator(){
|
|
|
+ @Override
|
|
|
+ public int compare(Object o1, Object o2) {
|
|
|
+ SimpleEnterpriseInfo s1 = (SimpleEnterpriseInfo) o1;
|
|
|
+ SimpleEnterpriseInfo s2 = (SimpleEnterpriseInfo)o2;
|
|
|
+ return s1.getLastLoginTime().compareTo(s2.getLastLoginTime());
|
|
|
+ }
|
|
|
+ });
|
|
|
this.enterprises = list;
|
|
|
}
|
|
|
this.havePayPwd = user.getUserPay()==null || user.getUserPay().equals("") ?false:true;
|
|
|
@@ -111,7 +122,7 @@ public class UserInfo {
|
|
|
|
|
|
private Short idEnable;
|
|
|
|
|
|
- private List<Map<String, Object>> enterprises;
|
|
|
+ private List<SimpleEnterpriseInfo> enterprises;
|
|
|
|
|
|
private boolean havePayPwd;
|
|
|
|
|
|
@@ -121,6 +132,8 @@ public class UserInfo {
|
|
|
|
|
|
private Long lastLoginTime;
|
|
|
|
|
|
+ private Set<UserLoginTime> userLoginTimeSet;
|
|
|
+
|
|
|
public Long getLastLoginTime() {
|
|
|
return lastLoginTime;
|
|
|
}
|
|
|
@@ -217,11 +230,19 @@ public class UserInfo {
|
|
|
this.role = role;
|
|
|
}
|
|
|
|
|
|
- public List<Map<String, Object>> getEnterprises() {
|
|
|
+ public Set<UserLoginTime> getUserLoginTimeSet() {
|
|
|
+ return userLoginTimeSet;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUserLoginTimeSet(Set<UserLoginTime> userLoginTimeSet) {
|
|
|
+ this.userLoginTimeSet = userLoginTimeSet;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<SimpleEnterpriseInfo> getEnterprises() {
|
|
|
return enterprises;
|
|
|
}
|
|
|
|
|
|
- public void setEnterprises(List<Map<String, Object>> enterprises) {
|
|
|
+ public void setEnterprises(List<SimpleEnterpriseInfo> enterprises) {
|
|
|
this.enterprises = enterprises;
|
|
|
}
|
|
|
|
|
|
@@ -234,3 +255,67 @@ public class UserInfo {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 返回给前端的简单企业信息数据
|
|
|
+ */
|
|
|
+class SimpleEnterpriseInfo{
|
|
|
+ String enName;
|
|
|
+ Long uu;
|
|
|
+ Short isVendor;
|
|
|
+ String enSaasUrl;
|
|
|
+ boolean current;
|
|
|
+ Long lastLoginTime;
|
|
|
+
|
|
|
+ public SimpleEnterpriseInfo(){
|
|
|
+ this.setLastLoginTime(0L);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getEnName() {
|
|
|
+ return enName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEnName(String enName) {
|
|
|
+ this.enName = enName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getUu() {
|
|
|
+ return uu;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUu(Long uu) {
|
|
|
+ this.uu = uu;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Short getIsVendor() {
|
|
|
+ return isVendor;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setIsVendor(Short isVendor) {
|
|
|
+ this.isVendor = isVendor;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getEnSaasUrl() {
|
|
|
+ return enSaasUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEnSaasUrl(String enSaasUrl) {
|
|
|
+ this.enSaasUrl = enSaasUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isCurrent() {
|
|
|
+ return current;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setCurrent(boolean current) {
|
|
|
+ this.current = current;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getLastLoginTime() {
|
|
|
+ return lastLoginTime;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setLastLoginTime(Long lastLoginTime) {
|
|
|
+ this.lastLoginTime = lastLoginTime;
|
|
|
+ }
|
|
|
+}
|