Bladeren bron

feat:与账号服务数据同步接口

liusw 6 jaren geleden
bovenliggende
commit
d59e3b6afe

+ 1 - 0
sso-server/build.gradle

@@ -51,6 +51,7 @@ dependencies {
     compile("com.github.sgroschupf:zkclient:0.1")
 
     compile("com.belerweb:pinyin4j:2.5.1")
+    compile("com.usoft.framework:usoft-security-utils:dev-1.0-SNAPSHOT")
 
     compile("commons-fileupload:commons-fileupload:1.3.2")
     compile("org.apache.httpcomponents:httpmime:4.4")

+ 1 - 0
sso-server/src/main/java/com/uas/sso/sync/README.md

@@ -0,0 +1 @@
+与新版的账号服务进行数据

+ 15 - 0
sso-server/src/main/java/com/uas/sso/sync/config/OpenApiSignConfig.java

@@ -0,0 +1,15 @@
+package com.uas.sso.sync.config;
+
+/**
+ * OpenApi
+ *
+ * @author liusw
+ * @date 2019-01-15 21:03
+ */
+public class OpenApiSignConfig {
+
+    /**
+     * 与账号服务对接 秘钥
+     */
+    public static String SECRET_KEY = "uu7gz6baXzcVYnIdz6gQLQEZ61GQncghrdtYgiMd";
+}

+ 57 - 0
sso-server/src/main/java/com/uas/sso/sync/controller/SyncUserController.java

@@ -0,0 +1,57 @@
+package com.uas.sso.sync.controller;
+
+import com.uas.sso.controller.BaseController;
+import com.uas.sso.sync.config.OpenApiSignConfig;
+import com.uas.sso.sync.service.SyncUserService;
+import com.usoft.security.utils.OpenApiSignUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 用户控制层
+ *
+ * @author liusw
+ * @date 2019-01-15 20:36
+ */
+@RestController
+public class SyncUserController extends BaseController {
+
+    @Autowired
+    private SyncUserService syncUserService;
+
+    /**
+     * 分页获取用户信息
+     * @param pageSize
+     * @param pageNumber
+     * @param timestamp
+     * @param signature
+     * @return
+     */
+    @GetMapping("/sync/user/page/info/get")
+    public ModelMap getSyncUserSpacePageInfo(int pageSize, int pageNumber, Long timestamp, String signature) throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+        if (!OpenApiSignUtil.verifySignForHttpGet(request, OpenApiSignConfig.SECRET_KEY)) {
+            throw new RuntimeException("签名错误");
+        }
+        return success(syncUserService.getSyncUserPageInfo(pageSize, pageNumber, timestamp));
+    }
+
+    /**
+     * 根据uu号获取用户信息
+     * @param userUU
+     * @param signature
+     * @return
+     */
+    @GetMapping("/sync/user/info/get")
+    public ModelMap getSyncUserByUserUU(Long userUU, String signature) throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+        if (!OpenApiSignUtil.verifySignForHttpGet(request, OpenApiSignConfig.SECRET_KEY)) {
+            throw new RuntimeException("签名错误");
+        }
+        return success(syncUserService.getSyncUserByUserUU(userUU));
+    }
+}

+ 56 - 0
sso-server/src/main/java/com/uas/sso/sync/controller/SyncUserspaceController.java

@@ -0,0 +1,56 @@
+package com.uas.sso.sync.controller;
+
+import com.uas.sso.controller.BaseController;
+import com.uas.sso.sync.config.OpenApiSignConfig;
+import com.uas.sso.sync.service.SyncUserspaceService;
+import com.usoft.security.utils.OpenApiSignUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 企业控制层
+ *
+ * @author liusw
+ * @date 2019-01-15 20:36
+ */
+@RestController
+public class SyncUserspaceController extends BaseController {
+    @Autowired
+    private SyncUserspaceService syncUserspaceService;
+
+    /**
+     * 分页获取企业信息
+     * @param pageSize
+     * @param pageNumber
+     * @param timestamp
+     * @param signature
+     * @return
+     */
+    @GetMapping("/sync/userspace/page/info/get")
+    public ModelMap getSyncUserSpacePageInfo(int pageSize, int pageNumber, Long timestamp, String signature) throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+        if (!OpenApiSignUtil.verifySignForHttpGet(request, OpenApiSignConfig.SECRET_KEY)) {
+            throw new RuntimeException("签名错误");
+        }
+        return success(syncUserspaceService.getSyncUserSpacePageInfo(pageSize, pageNumber, timestamp));
+    }
+
+    /**
+     * 根据企业UU号获取企业信息
+     * @param spaceUU
+     * @param signature
+     * @return
+     */
+    @GetMapping("/sync/userspace/info/get")
+    public ModelMap getSyncUserspaceBySpaceUU(Long spaceUU, String signature) throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+        if (!OpenApiSignUtil.verifySignForHttpGet(request, OpenApiSignConfig.SECRET_KEY)) {
+            throw new RuntimeException("签名错误");
+        }
+        return success(syncUserspaceService.getSyncUserspaceBySpaceUU(spaceUU));
+    }
+}

+ 13 - 0
sso-server/src/main/java/com/uas/sso/sync/dao/SyncUserDao.java

@@ -0,0 +1,13 @@
+package com.uas.sso.sync.dao;
+
+import com.uas.sso.sync.entity.SyncUser;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+ * @author liusw
+ * @date 2019-01-15 11:40
+ */
+public interface SyncUserDao extends JpaRepository<SyncUser, Long>, JpaSpecificationExecutor<SyncUser> {
+
+}

+ 14 - 0
sso-server/src/main/java/com/uas/sso/sync/dao/SyncUserspaceDao.java

@@ -0,0 +1,14 @@
+package com.uas.sso.sync.dao;
+
+import com.uas.sso.sync.entity.SyncUser;
+import com.uas.sso.sync.entity.SyncUserspace;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+ * @author liusw
+ * @date 2019-01-15 11:40
+ */
+public interface SyncUserspaceDao extends JpaRepository<SyncUserspace, Long>, JpaSpecificationExecutor<SyncUserspace> {
+
+}

+ 493 - 0
sso-server/src/main/java/com/uas/sso/sync/entity/SyncUser.java

@@ -0,0 +1,493 @@
+package com.uas.sso.sync.entity;
+
+import com.uas.sso.entity.UserQuestion;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.List;
+import org.hibernate.annotations.Cache;
+
+/**
+ * 账号服务 用户信息 数据同步
+ *
+ * @author liusw
+ * @date 2019-01-15 11:31
+ */
+@Entity
+@Table(name = "sso$user")
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "UserCache")
+public class SyncUser implements Serializable {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * uu号
+     */
+    @Id
+    @Column(name = "useruu")
+    private Long userUU;
+
+    /**
+     * 会员名
+     */
+    @Column(name = "vip_name", nullable = false, length = 100)
+    private String vipName;
+
+    /**
+     * 手机号
+     */
+    @Column(name = "mobile", unique = true, nullable = false, length = 30)
+    private String mobile;
+
+    /**
+     * 手机号所属区域(continent or Hongkong)
+     */
+    @Column(name = "mobile_area", length = 30)
+    private String mobileArea;
+
+    /**
+     * 手机号认证状态
+     */
+    @Column(name = "mobile_valid_code")
+    private Short mobileValidCode;
+
+    /**
+     * 用户密码
+     */
+    @Column(name = "_password", nullable = false)
+    private String password;
+
+    /**
+     * 用户密码等级
+     */
+    @Column(name = "password_level", nullable = false)
+    private int passwordLevel = 2;
+
+    /**
+     * 盐值
+     */
+    @Column(name = "salt")
+    private String salt;
+
+    /**
+     * 用户注册时间
+     */
+    @Column(name = "user_register_date")
+    private Timestamp registerDate;
+
+    /**
+     * 用户邮箱
+     */
+    @Column(name = "user_email")
+    private String email;
+
+    /**
+     * 用户邮箱认证状态
+     */
+    @Column(name = "email_valid_code")
+    private Short emailValidCode;
+
+    /**
+     * 用户真实姓名
+     */
+    @Column(name = "real_name")
+    private String realName;
+
+    /**
+     * 用户身份证号
+     */
+    @Column(name = "id_card")
+    private String idCard;
+
+    /**
+     * 用户身份认证状态
+     */
+    @Column(name = "identity_valid_code", nullable = false)
+    private Short identityValidCode;
+
+    /**
+     * 用户注册应用
+     */
+    @Column(name = "from_app")
+    private String fromApp;
+
+    /**
+     * 用户注册ip
+     */
+    @Column(name = "from_ip")
+    private String fromIp;
+
+    /**
+     * 用户注册来源url
+     */
+    @Column(name = "from_url")
+    private String fromUrl;
+
+    /**
+     * 姓
+     */
+    @Column(name = "first_name")
+    private String firstName;
+
+    /**
+     * 名
+     */
+    @Column(name = "last_name")
+    private String lastName;
+
+    /**
+     * 性别
+     */
+    @Column(name = "sex")
+    private String sex;
+
+    /**
+     * 出生日期
+     */
+    @Column(name = "birthday")
+    private Timestamp birthday;
+
+    /**
+     * 微信号(微信扫码授权或微信客户端授权,不用出现在注册页面,预留)
+     */
+    @Column(name = "wx_openid")
+    private String wxOpenid;
+
+    /**
+     * 微信号(微信扫码授权或微信客户端授权,不用出现在注册页面,预留)
+     */
+    @Column(name = "wx_unionid", unique = true)
+    private String wxUnionid;
+
+    /**
+     * 碧合唯一id
+     */
+    @Column(name = "bh_openid", unique = true)
+    private String bhOpenId;
+
+    /**
+     * qq号(qq扫码或qq客户端授权,不用出现在注册页面,预留)
+     */
+    @Column(name = "qq_number")
+    private Integer qqNumber;
+
+    /**
+     * 国籍(不用出现在注册页面,预留)
+     */
+    @Column(name = "nationality", length = 50)
+    private String nationality;
+
+    /**
+     * 籍贯(不用出现在注册页面,预留)
+     */
+    @Column(name = "native_place", length = 50)
+    private String nativePlace;
+
+    /**
+     * 现在所在国家(不用出现在注册页面,预留)
+     */
+    @Column(name = "user_country", length = 50)
+    private String country;
+
+    /**
+     * 现在所在省份、州、直辖市、行政区(不用出现在注册页面,预留)
+     */
+    @Column(name = "user_province", length = 50)
+    private String province;
+
+    /**
+     * 现在所在城市(不用出现在注册页面,预留)
+     */
+    @Column(name = "user_city", length = 50)
+    private String city;
+
+    /**
+     * 账户是否冻结(1、冻结)
+     */
+    @Column(name = "_lock")
+    private Short lock;
+
+    /**
+     * imId
+     */
+    @Column(name = "im_id")
+    private String imId;
+
+    /**
+     * 密保问题
+     */
+    @OneToMany
+    @JoinColumn(name = "useruu", nullable = false)
+    private List<SyncUserQuestion> questions;
+
+    public Long getUserUU() {
+        return userUU;
+    }
+
+    public void setUserUU(Long userUU) {
+        this.userUU = userUU;
+    }
+
+    public String getVipName() {
+        return vipName;
+    }
+
+    public void setVipName(String vipName) {
+        this.vipName = vipName;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getMobileArea() {
+        return mobileArea;
+    }
+
+    public void setMobileArea(String mobileArea) {
+        this.mobileArea = mobileArea;
+    }
+
+    public Short getMobileValidCode() {
+        return mobileValidCode;
+    }
+
+    public void setMobileValidCode(Short mobileValidCode) {
+        this.mobileValidCode = mobileValidCode;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public int getPasswordLevel() {
+        return passwordLevel;
+    }
+
+    public void setPasswordLevel(int passwordLevel) {
+        this.passwordLevel = passwordLevel;
+    }
+
+    public String getSalt() {
+        return salt;
+    }
+
+    public void setSalt(String salt) {
+        this.salt = salt;
+    }
+
+    public Timestamp getRegisterDate() {
+        return registerDate;
+    }
+
+    public void setRegisterDate(Timestamp registerDate) {
+        this.registerDate = registerDate;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public Short getEmailValidCode() {
+        return emailValidCode;
+    }
+
+    public void setEmailValidCode(Short emailValidCode) {
+        this.emailValidCode = emailValidCode;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getIdCard() {
+        return idCard;
+    }
+
+    public void setIdCard(String idCard) {
+        this.idCard = idCard;
+    }
+
+    public Short getIdentityValidCode() {
+        return identityValidCode;
+    }
+
+    public void setIdentityValidCode(Short identityValidCode) {
+        this.identityValidCode = identityValidCode;
+    }
+
+    public String getFromApp() {
+        return fromApp;
+    }
+
+    public void setFromApp(String fromApp) {
+        this.fromApp = fromApp;
+    }
+
+    public String getFromIp() {
+        return fromIp;
+    }
+
+    public void setFromIp(String fromIp) {
+        this.fromIp = fromIp;
+    }
+
+    public String getFromUrl() {
+        return fromUrl;
+    }
+
+    public void setFromUrl(String fromUrl) {
+        this.fromUrl = fromUrl;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getSex() {
+        return sex;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex;
+    }
+
+    public Timestamp getBirthday() {
+        return birthday;
+    }
+
+    public void setBirthday(Timestamp birthday) {
+        this.birthday = birthday;
+    }
+
+    public String getWxOpenid() {
+        return wxOpenid;
+    }
+
+    public void setWxOpenid(String wxOpenid) {
+        this.wxOpenid = wxOpenid;
+    }
+
+    public String getWxUnionid() {
+        return wxUnionid;
+    }
+
+    public void setWxUnionid(String wxUnionid) {
+        this.wxUnionid = wxUnionid;
+    }
+
+    public String getBhOpenId() {
+        return bhOpenId;
+    }
+
+    public void setBhOpenId(String bhOpenId) {
+        this.bhOpenId = bhOpenId;
+    }
+
+    public Integer getQqNumber() {
+        return qqNumber;
+    }
+
+    public void setQqNumber(Integer qqNumber) {
+        this.qqNumber = qqNumber;
+    }
+
+    public String getNationality() {
+        return nationality;
+    }
+
+    public void setNationality(String nationality) {
+        this.nationality = nationality;
+    }
+
+    public String getNativePlace() {
+        return nativePlace;
+    }
+
+    public void setNativePlace(String nativePlace) {
+        this.nativePlace = nativePlace;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public Short getLock() {
+        return lock;
+    }
+
+    public void setLock(Short lock) {
+        this.lock = lock;
+    }
+
+    public String getImId() {
+        return imId;
+    }
+
+    public void setImId(String imId) {
+        this.imId = imId;
+    }
+
+    public List<SyncUserQuestion> getQuestions() {
+        return questions;
+    }
+
+    public void setQuestions(List<SyncUserQuestion> questions) {
+        this.questions = questions;
+    }
+}

+ 94 - 0
sso-server/src/main/java/com/uas/sso/sync/entity/SyncUserQuestion.java

@@ -0,0 +1,94 @@
+package com.uas.sso.sync.entity;
+
+import com.uas.sso.entity.User;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * 数据同步 用户密保
+ *
+ * @author liusw
+ * @date 2019-01-15 15:56
+ */
+@Entity
+@Table(name = "sso$user$question")
+public class SyncUserQuestion implements Serializable {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @Id
+    @Column(name = "_id")
+    @SequenceGenerator(name = "sso$user$question_gen", sequenceName = "sso$user$question_seq", allocationSize = 1)
+    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "sso$user$question_gen")
+    private Long id;
+
+    /**
+     * 用户uu号
+     */
+    @Column(name = "useruu", insertable=false, updatable=false)
+    private Long userUU;
+
+    /**
+     * 密保问题
+     */
+    @Column(name = "question")
+    private String question;
+
+    /**
+     * 密保答案
+     */
+    @Column(name = "answer")
+    private String answer;
+
+    /**
+     * 排序
+     */
+    @Column(name = "sort")
+    private String sort;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getUserUU() {
+        return userUU;
+    }
+
+    public void setUserUU(Long userUU) {
+        this.userUU = userUU;
+    }
+
+    public String getQuestion() {
+        return question;
+    }
+
+    public void setQuestion(String question) {
+        this.question = question;
+    }
+
+    public String getAnswer() {
+        return answer;
+    }
+
+    public void setAnswer(String answer) {
+        this.answer = answer;
+    }
+
+    public String getSort() {
+        return sort;
+    }
+
+    public void setSort(String sort) {
+        this.sort = sort;
+    }
+}

+ 522 - 0
sso-server/src/main/java/com/uas/sso/sync/entity/SyncUserspace.java

@@ -0,0 +1,522 @@
+package com.uas.sso.sync.entity;
+
+import com.uas.sso.entity.Relation;
+import com.uas.sso.entity.User;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+import java.util.List;
+
+/**
+ * 企业实体
+ *
+ * @author liusw
+ * @date 2019-01-15 11:41
+ */
+@Entity
+@Table(name = "sso$userspace")
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "UserSpaceCache")
+public class SyncUserspace {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 企业uu号
+     */
+    @Id
+    @Column(name = "spaceuu")
+    private Long spaceUU;
+
+    /**
+     * 企业名称
+     */
+    @Column(name = "space_name", nullable = false, unique = true, length = 99)
+    private String spaceName;
+
+    /**
+     * 法定代表人
+     */
+    @Column(name = "corporation", length = 20)
+    private String corporation;
+
+    /**
+     * 注册日期
+     */
+    @Column(name = "space_register_date")
+    private Timestamp registerDate;
+
+    /**
+     * 注册来源
+     */
+    @Column(name = "from_app")
+    private String fromApp;
+
+    /**
+     * 管理员uu号
+     */
+    @Column(name = "adminuu")
+    private Long adminUU;
+
+    /**
+     * 营业执照号
+     */
+    @Column(name = "business_code", unique = true, length = 100)
+    private String businessCode;
+
+    /**
+     * 营业执照
+     */
+    @Column(name = "business_code_image")
+    private String businessCodeImage;
+
+    /**
+     * 注册地址
+     */
+    @Column(name = "reg_address")
+    private String regAddress;
+
+    /**
+     * 注册地址所在省份、州、直辖市、行政区
+     */
+    @Column(name = "reg_province", length = 50)
+    private String regProvince;
+
+    /**
+     * 注册地址所在城市
+     */
+    @Column(name = "reg_city", length = 50)
+    private String regCity;
+
+    /**
+     * 注册地址所在区域
+     */
+    @Column(name = "reg_district", length = 50)
+    private String regDistrict;
+
+    /**
+     * 注册地址所在街道
+     */
+    @Column(name = "reg_street", length = 200)
+    private String regStreet;
+
+    /**
+     * 公司地址经度
+     */
+    @Column(name = "company_longitude", length = 50)
+    private String companyLongitude;
+
+    /**
+     * 公司地址纬度
+     */
+    @Column(name = "company_latitude", length = 50)
+    private String companyLatitude;
+
+    /**
+     * 公司所在国家
+     */
+    @Column(name = "company_country", length = 50)
+    private String companyCountry;
+
+    /**
+     * 公司所在省份、州、直辖市、行政区
+     */
+    @Column(name = "company_province", length = 50)
+    private String companyProvince;
+
+    /**
+     * 公司所在城市
+     */
+    @Column(name = "company_city")
+    private String companyCity;
+
+    /**
+     * 公司地址
+     */
+    @Column(name = "company_address")
+    private String companyAddress;
+
+    /**
+     * 企业信息认证状态
+     */
+    @Column(name = "valid_code", nullable = false)
+    private Short validCode;
+
+    /**
+     * logo图片
+     */
+    @Column(name = "logo_image")
+    private String logoImage;
+
+    /**
+     * 企业联系电话
+     */
+    @Column(name = "telephone", length = 20)
+    private String telephone;
+
+    /**
+     * 主营业务范围
+     */
+    @Column(name = "main_business")
+    private String mainBusiness;
+
+    /**
+     * 对公银行账户
+     */
+    @Column(name = "bank_account")
+    private String bankAccount;
+
+    /**
+     * 对公银行账户开户行
+     */
+    @Column(name = "bank")
+    private String bank;
+
+    /**
+     * 企业域名
+     */
+    @Column(name = "domain")
+    private String domain;
+
+    /**
+     * 行业
+     */
+    @Column(name = "profession")
+    private String profession;
+
+    /**
+     * 经营范围标签,逗号分隔
+     */
+    @Column(name = "tags")
+    private String tags;
+
+    /**
+     * 企业注册地区
+     */
+    @Column(name = "area")
+    private String area;
+
+    /**
+     * 邀请人企业uu号
+     */
+    @Column(name = "invite_space_uu")
+    private Long inviteSpaceUU;
+
+    /**
+     * 邀请人uu号
+     */
+    @Column(name = "invite_user_uu")
+    private Long inviteUserUU;
+
+    /**
+     * 邀请来源
+     */
+    @Column(name = "source", length = 30)
+    private String source;
+
+    /**
+     * 企业秘钥
+     */
+    @com.fasterxml.jackson.annotation.JsonIgnore
+    @Column(name = "access_secret")
+    private String accessSecret;
+
+    /**
+     * 企业对应erp的地址
+     */
+    @Column(name = "website")
+    private String website;
+
+    /**
+     * 企业下的用户
+     */
+    @ManyToMany
+    @JoinTable(name = "sso$user_userspace",
+            joinColumns = {@JoinColumn(name="space_uu", referencedColumnName="spaceuu")},
+            inverseJoinColumns = {@JoinColumn(name="user_uu", referencedColumnName="useruu")})
+    private List<User> users;
+
+    public Long getSpaceUU() {
+        return spaceUU;
+    }
+
+    public void setSpaceUU(Long spaceUU) {
+        this.spaceUU = spaceUU;
+    }
+
+    public String getSpaceName() {
+        return spaceName;
+    }
+
+    public void setSpaceName(String spaceName) {
+        this.spaceName = spaceName;
+    }
+
+    public String getCorporation() {
+        return corporation;
+    }
+
+    public void setCorporation(String corporation) {
+        this.corporation = corporation;
+    }
+
+    public Timestamp getRegisterDate() {
+        return registerDate;
+    }
+
+    public void setRegisterDate(Timestamp registerDate) {
+        this.registerDate = registerDate;
+    }
+
+    public String getFromApp() {
+        return fromApp;
+    }
+
+    public void setFromApp(String fromApp) {
+        this.fromApp = fromApp;
+    }
+
+    public Long getAdminUU() {
+        return adminUU;
+    }
+
+    public void setAdminUU(Long adminUU) {
+        this.adminUU = adminUU;
+    }
+
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
+    public String getBusinessCodeImage() {
+        return businessCodeImage;
+    }
+
+    public void setBusinessCodeImage(String businessCodeImage) {
+        this.businessCodeImage = businessCodeImage;
+    }
+
+    public String getRegAddress() {
+        return regAddress;
+    }
+
+    public void setRegAddress(String regAddress) {
+        this.regAddress = regAddress;
+    }
+
+    public String getRegProvince() {
+        return regProvince;
+    }
+
+    public void setRegProvince(String regProvince) {
+        this.regProvince = regProvince;
+    }
+
+    public String getRegCity() {
+        return regCity;
+    }
+
+    public void setRegCity(String regCity) {
+        this.regCity = regCity;
+    }
+
+    public String getRegDistrict() {
+        return regDistrict;
+    }
+
+    public void setRegDistrict(String regDistrict) {
+        this.regDistrict = regDistrict;
+    }
+
+    public String getRegStreet() {
+        return regStreet;
+    }
+
+    public void setRegStreet(String regStreet) {
+        this.regStreet = regStreet;
+    }
+
+    public String getCompanyLongitude() {
+        return companyLongitude;
+    }
+
+    public void setCompanyLongitude(String companyLongitude) {
+        this.companyLongitude = companyLongitude;
+    }
+
+    public String getCompanyLatitude() {
+        return companyLatitude;
+    }
+
+    public void setCompanyLatitude(String companyLatitude) {
+        this.companyLatitude = companyLatitude;
+    }
+
+    public String getCompanyCountry() {
+        return companyCountry;
+    }
+
+    public void setCompanyCountry(String companyCountry) {
+        this.companyCountry = companyCountry;
+    }
+
+    public String getCompanyProvince() {
+        return companyProvince;
+    }
+
+    public void setCompanyProvince(String companyProvince) {
+        this.companyProvince = companyProvince;
+    }
+
+    public String getCompanyCity() {
+        return companyCity;
+    }
+
+    public void setCompanyCity(String companyCity) {
+        this.companyCity = companyCity;
+    }
+
+    public String getCompanyAddress() {
+        return companyAddress;
+    }
+
+    public void setCompanyAddress(String companyAddress) {
+        this.companyAddress = companyAddress;
+    }
+
+    public Short getValidCode() {
+        return validCode;
+    }
+
+    public void setValidCode(Short validCode) {
+        this.validCode = validCode;
+    }
+
+    public String getLogoImage() {
+        return logoImage;
+    }
+
+    public void setLogoImage(String logoImage) {
+        this.logoImage = logoImage;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public String getMainBusiness() {
+        return mainBusiness;
+    }
+
+    public void setMainBusiness(String mainBusiness) {
+        this.mainBusiness = mainBusiness;
+    }
+
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount;
+    }
+
+    public String getBank() {
+        return bank;
+    }
+
+    public void setBank(String bank) {
+        this.bank = bank;
+    }
+
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    public String getProfession() {
+        return profession;
+    }
+
+    public void setProfession(String profession) {
+        this.profession = profession;
+    }
+
+    public String getTags() {
+        return tags;
+    }
+
+    public void setTags(String tags) {
+        this.tags = tags;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public Long getInviteSpaceUU() {
+        return inviteSpaceUU;
+    }
+
+    public void setInviteSpaceUU(Long inviteSpaceUU) {
+        this.inviteSpaceUU = inviteSpaceUU;
+    }
+
+    public Long getInviteUserUU() {
+        return inviteUserUU;
+    }
+
+    public void setInviteUserUU(Long inviteUserUU) {
+        this.inviteUserUU = inviteUserUU;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public String getAccessSecret() {
+        return accessSecret;
+    }
+
+    public void setAccessSecret(String accessSecret) {
+        this.accessSecret = accessSecret;
+    }
+
+    public String getWebsite() {
+        return website;
+    }
+
+    public void setWebsite(String website) {
+        this.website = website;
+    }
+
+    public List<User> getUsers() {
+        return users;
+    }
+
+    public void setUsers(List<User> users) {
+        this.users = users;
+    }
+}

+ 29 - 0
sso-server/src/main/java/com/uas/sso/sync/service/SyncUserService.java

@@ -0,0 +1,29 @@
+package com.uas.sso.sync.service;
+
+import com.uas.sso.sync.entity.SyncUser;
+import org.springframework.data.domain.Page;
+
+/**
+ * 数据同步 用户业务
+ *
+ * @author liusw
+ * @date 2019-01-15 17:44
+ */
+public interface SyncUserService {
+
+    /**
+     * 分页获取用户信息
+     * @param pageSize
+     * @param pageNubmer
+     * @param timestamp
+     * @return
+     */
+    Page<SyncUser> getSyncUserPageInfo(int pageSize, int pageNubmer, Long timestamp);
+
+    /**
+     * 根据uu号获取用户信息
+     * @param userUU
+     * @return
+     */
+    SyncUser getSyncUserByUserUU(Long userUU);
+}

+ 30 - 0
sso-server/src/main/java/com/uas/sso/sync/service/SyncUserspaceService.java

@@ -0,0 +1,30 @@
+package com.uas.sso.sync.service;
+
+import com.uas.sso.sync.entity.SyncUser;
+import com.uas.sso.sync.entity.SyncUserspace;
+import org.springframework.data.domain.Page;
+
+/**
+ * 数据同步 企业业务
+ *
+ * @author liusw
+ * @date 2019-01-15 17:44
+ */
+public interface SyncUserspaceService {
+
+    /**
+     * 分页获取企业信息
+     * @param pageSize
+     * @param pageNubmer
+     * @param timestamp
+     * @return
+     */
+    Page<SyncUserspace> getSyncUserSpacePageInfo(int pageSize, int pageNubmer, Long timestamp);
+
+    /**
+     * 根据uu号获取企业信息
+     * @param spaceUU
+     * @return
+     */
+    SyncUserspace getSyncUserspaceBySpaceUU(Long spaceUU);
+}

+ 53 - 0
sso-server/src/main/java/com/uas/sso/sync/service/impl/SyncUserServiceImpl.java

@@ -0,0 +1,53 @@
+package com.uas.sso.sync.service.impl;
+
+import com.uas.sso.entity.ApplyUserSpace;
+import com.uas.sso.entity.PageInfo;
+import com.uas.sso.sync.dao.SyncUserDao;
+import com.uas.sso.sync.entity.SyncUser;
+import com.uas.sso.sync.entity.SyncUserspace;
+import com.uas.sso.sync.service.SyncUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+/**
+ * 用户业务接口实现类
+ *
+ * @author liusw
+ * @date 2019-01-15 18:06
+ */
+@Service
+public class SyncUserServiceImpl implements SyncUserService {
+
+    @Autowired
+    private SyncUserDao syncUserDao;
+
+    @Override
+    public Page<SyncUser> getSyncUserPageInfo(int pageSize, int pageNumber, Long timestamp) {
+        // 设置过滤条件
+        Pageable pageable = PageInfo.pageRequest(new PageRequest(pageNumber, pageSize));
+        Page<SyncUser> pageInfos = syncUserDao.findAll(new Specification<SyncUser>() {
+            @Override
+            public Predicate toPredicate(Root<SyncUser> root,
+                                         CriteriaQuery<?> query, CriteriaBuilder cb) {
+                query.orderBy(cb.asc(root.get("userUU").as(Long.class)));
+                return null;
+            }
+        }, pageable);
+        return new PageInfo<SyncUser>(pageInfos.getContent(), pageable, pageInfos.getTotalElements());
+    }
+
+    @Override
+    public SyncUser getSyncUserByUserUU(Long userUU) {
+        SyncUser syncUser = syncUserDao.findOne(userUU);
+        return syncUser;
+    }
+}

+ 52 - 0
sso-server/src/main/java/com/uas/sso/sync/service/impl/SyncUserspaceServiceImpl.java

@@ -0,0 +1,52 @@
+package com.uas.sso.sync.service.impl;
+
+import com.uas.sso.entity.PageInfo;
+import com.uas.sso.sync.dao.SyncUserspaceDao;
+import com.uas.sso.sync.entity.SyncUserspace;
+import com.uas.sso.sync.service.SyncUserspaceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+/**
+ * 企业业务接口实现类
+ *
+ * @author liusw
+ * @date 2019-01-15 18:08
+ */
+@Service
+public class SyncUserspaceServiceImpl implements SyncUserspaceService {
+
+    @Autowired
+    private SyncUserspaceDao syncUserspaceDao;
+
+    @Override
+    public Page<SyncUserspace> getSyncUserSpacePageInfo(int pageSize, int pageNumber, Long timestamp) {
+        // 设置过滤条件
+        Pageable pageable = PageInfo.pageRequest(new PageRequest(pageNumber, pageSize));
+        Page<SyncUserspace> pageInfos = syncUserspaceDao.findAll(new Specification<SyncUserspace>() {
+            @Override
+            public Predicate toPredicate(Root<SyncUserspace> root,
+                                         CriteriaQuery<?> query, CriteriaBuilder cb) {
+                query.orderBy(cb.asc(root.get("spaceUU").as(Long.class)));
+                return null;
+            }
+        }, pageable);
+
+        return new PageInfo<SyncUserspace>(pageInfos.getContent(), pageable, pageInfos.getTotalElements());
+    }
+
+    @Override
+    public SyncUserspace getSyncUserspaceBySpaceUU(Long spaceUU) {
+        SyncUserspace syncUserspace = syncUserspaceDao.findOne(spaceUU);
+        return syncUserspace;
+    }
+}

+ 1 - 1
sso-server/src/main/resources/config/application-dev.properties

@@ -18,7 +18,7 @@ datasource.maxPoolPreparedStatementPerConnectionSize=20
 datasource.filters=stat,slf4j
 datasource.connectionProperties=druid.stat.mergeSql=false;druid.stat.slowSqlMillis=5000
 
-spring.redis.host=188.131.128.107
+spring.redis.host=127.0.0.1
 spring.redis.port=6379
 
 message.url = http://message.ubtob.com/