Browse Source

bug修复

wangmh 7 years ago
parent
commit
21e8cda72b

+ 9 - 16
sso-common/src/main/java/com/uas/sso/entity/UserAccount.java

@@ -1,5 +1,8 @@
 package com.uas.sso.entity;
 
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
 import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Date;
@@ -23,61 +26,51 @@ public class UserAccount implements Serializable {
      * uu号
      */
     @Id
-    @Column(name = "useruu")
     private Long userUU;
 
     /**
      * 会员名
      */
-    @Column(name = "vip_name", nullable = false)
     private String vipName;
 
     /**
      * 手机号
      */
-    @Column(name = "mobile", unique = true, nullable = false)
     private String mobile;
 
     /**
      * 手机号所属区域(continent or Hongkong)
      */
-    @Column(name = "mobile_area")
     private String mobileArea;
 
     /**
      * 手机号认证状态
      */
-    @Column(name = "mobile_valid_code")
     private Short mobileValidCode;
 
     /**
      * 用户密码
      */
-    @Column(name = "_password", nullable = false)
     private String password;
 
     /**
      * 用户erp密码
      */
-    @Column(name = "erp_password")
     private String erpPassword;
 
     /**
      * 盐值
      */
-    @Column(name = "salt")
     private String salt;
 
     /**
      * 用户邮箱
      */
-    @Column(name = "user_email")
     private String email;
 
     /**
      * 用户邮箱认证状态
      */
-    @Column(name = "email_valid_code")
     private Short emailValidCode;
 
     /**
@@ -88,37 +81,31 @@ public class UserAccount implements Serializable {
     /**
      * 账户是否冻结(1、冻结)
      */
-    @Column(name = "_lock")
     private Integer lock;
 
     /**
      * 企业uu号
      */
-    @Column(name = "spaceuu")
     private Long spaceUU;
 
     /**
      * 企业名称
      */
-    @Column(name = "space_name", unique = true)
     private String spaceName;
 
     /**
      * 营业执照号
      */
-    @Column(name = "business_code")
     private String businessCode;
 
     /**
      * 企业域名
      */
-    @Column(name = "domain")
     private String spaceDomain;
 
     /**
      * 应用唯一标志
      */
-    @Column(name = "app_uid")
     private String appId;
 
     /**
@@ -206,6 +193,8 @@ public class UserAccount implements Serializable {
         this.mobileValidCode = mobileValidCode;
     }
 
+    @JsonIgnore
+    @JSONField(serialize = false)
     public String getPassword() {
         return password;
     }
@@ -214,6 +203,8 @@ public class UserAccount implements Serializable {
         this.password = password;
     }
 
+    @JsonIgnore
+    @JSONField(serialize = false)
     public String getErpPassword() {
         return erpPassword;
     }
@@ -222,6 +213,8 @@ public class UserAccount implements Serializable {
         this.erpPassword = erpPassword;
     }
 
+    @JsonIgnore
+    @JSONField(serialize = false)
     public String getSalt() {
         return salt;
     }

+ 1 - 43
sso-common/src/main/java/com/uas/sso/entity/UserView.java

@@ -36,21 +36,6 @@ public class UserView {
      */
     private Short mobileValidCode;
 
-    /**
-     * 用户密码
-     */
-    private String password;
-
-    /**
-     * 盐值
-     */
-    private String salt;
-
-    /**
-     * 用户注册时间
-     */
-    private Date registerDate;
-
     /**
      * 用户邮箱
      */
@@ -84,15 +69,12 @@ public class UserView {
     public UserView() {
     }
 
-    public UserView(Long userUU, String name, String mobile, String mobileArea, Short mobileValidCode, String password, String salt, Date registerDate, String email, Short emailValidCode, String realName, String idCard, Short identityValidCode, Integer lock) {
+    public UserView(Long userUU, String name, String mobile, String mobileArea, Short mobileValidCode, String email, Short emailValidCode, String realName, String idCard, Short identityValidCode, Integer lock) {
         this.userUU = userUU;
         this.name = name;
         this.mobile = mobile;
         this.mobileArea = mobileArea;
         this.mobileValidCode = mobileValidCode;
-        this.password = password;
-        this.salt = salt;
-        this.registerDate = registerDate;
         this.email = email;
         this.emailValidCode = emailValidCode;
         this.realName = realName;
@@ -143,30 +125,6 @@ public class UserView {
         this.mobileValidCode = mobileValidCode;
     }
 
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    public String getSalt() {
-        return salt;
-    }
-
-    public void setSalt(String salt) {
-        this.salt = salt;
-    }
-
-    public Date getRegisterDate() {
-        return registerDate;
-    }
-
-    public void setRegisterDate(Date registerDate) {
-        this.registerDate = registerDate;
-    }
-
     public String getEmail() {
         return email;
     }

+ 0 - 118
sso-common/src/main/java/com/uas/sso/support/Page.java

@@ -1,118 +0,0 @@
-package com.uas.sso.support;
-
-import java.io.Serializable;
-import java.util.List;
-
-public class Page<T> implements Serializable {
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
-
-    /**
-     * 页数
-     */
-	private int number;
-
-    /**
-     * 每页大小
-     */
-    private int size;
-
-    /**
-     * 获取数据数量
-     */
-    private int numberOfElements;
-
-    /**
-     * 数据
-     */
-    private List<T> content;
-
-    /**
-     * 是否为第一页
-     */
-    private boolean first;
-
-    /**
-     * 是否为最后一页
-     */
-    private boolean last;
-
-    /**
-     * 总页数
-     */
-    private long totalElements;
-
-	public Page() {
-
-	}
-
-	public Page(int pageNumber, int pageSize, List<T> content, int totalElements) {
-		this.number = pageNumber;
-		this.size = pageSize;
-		this.content = content;
-		this.numberOfElements = content == null || content.isEmpty() ? 0 : content.size();
-		this.totalElements = totalElements;
-		this.first = pageNumber == 1;
-		this.last = pageNumber >= (int) Math.floor((double) totalElements / pageSize);
-	}
-
-	public int getNumber() {
-		return number;
-	}
-
-	public void setNumber(int number) {
-		this.number = number;
-	}
-
-	public int getSize() {
-		return size;
-	}
-
-	public void setSize(int size) {
-		this.size = size;
-	}
-
-	public int getNumberOfElements() {
-		return numberOfElements;
-	}
-
-	public void setNumberOfElements(int numberOfElements) {
-		this.numberOfElements = numberOfElements;
-	}
-
-	public List<T> getContent() {
-		return content;
-	}
-
-	public void setContent(List<T> content) {
-		this.content = content;
-	}
-
-	public boolean isFirst() {
-		return first;
-	}
-
-	public void setFirst(boolean first) {
-		this.first = first;
-	}
-
-	public boolean isLast() {
-		return last;
-	}
-
-	public void setLast(boolean last) {
-		this.last = last;
-	}
-
-	public long getTotalElements() {
-		return totalElements;
-	}
-
-	public void setTotalElements(long totalElements) {
-		this.totalElements = totalElements;
-	}
-
-}

+ 38 - 0
sso-common/src/main/java/com/uas/sso/support/PageInfo.java

@@ -0,0 +1,38 @@
+package com.uas.sso.support;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+
+import java.util.List;
+
+/**
+ * @author wangmh
+ * @create 2018-02-09 16:51
+ * @desc 分页
+ **/
+public class PageInfo<T> extends PageImpl<T> implements Page<T> {
+
+    public PageInfo(List<T> content, Pageable pageable, long total) {
+        super(content, pageable, total);
+    }
+
+    public PageInfo(List<T> content) {
+        super(content);
+    }
+
+    /**
+     * 获取pageable,将当前页减1
+     * @param pageable
+     * @return
+     */
+    public static Pageable pageRequest(Pageable pageable) {
+        return new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize(), pageable.getSort());
+    }
+
+    @Override
+    public int getNumber() {
+        return super.getNumber() + 1;
+    }
+}

+ 2 - 2
sso-common/src/main/java/com/uas/sso/util/AccountUtils.java

@@ -82,7 +82,7 @@ public class AccountUtils {
      * @param spaceUU 企业uu号
      * @throws Exception
      */
-    public static void unbindUserSpace(Long userUU, Long spaceUU) throws Exception {
+    public static void removeUser(Long userUU, Long spaceUU) throws Exception {
         String saveUrl = AccountConfig.getUserSaveUrl();
         if (!StringUtils.isEmpty(saveUrl)) {
             ModelMap formData = new ModelMap();
@@ -107,7 +107,7 @@ public class AccountUtils {
      * @param spaceUU 企业uu号
      * @throws Exception
      */
-    public static void bindUserSpace(Long userUU, Long spaceUU) throws Exception {
+    public static void addUser(Long userUU, Long spaceUU) throws Exception {
         String saveUrl = AccountConfig.getUserSaveUrl();
         if (!StringUtils.isEmpty(saveUrl)) {
             ModelMap formData = new ModelMap();

+ 1 - 4
sso-server/src/main/java/com/uas/sso/entity/User.java

@@ -462,13 +462,10 @@ public class User implements Serializable {
     public UserView toView() {
         UserView userView = new UserView();
         userView.setUserUU(this.getUserUU());
-        userView.setVipName(this.getVipName());
+        userView.setName(this.getVipName());
         userView.setMobile(this.getMobile());
         userView.setMobileArea(this.getMobileArea());
         userView.setMobileValidCode(this.getMobileValidCode());
-        userView.setPassword(this.getPassword());
-        userView.setSalt(this.getSalt());
-        userView.setRegisterDate(this.getRegisterDate());
         userView.setEmail(this.getEmail());
         userView.setEmailValidCode(this.getEmailValidCode());
         userView.setRealName(this.getRealName());