| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587 |
- package com.uas.sso.entity;
- import com.alibaba.fastjson.annotation.JSONField;
- import java.io.Serializable;
- import java.sql.Timestamp;
- import java.util.List;
- import javax.persistence.*;
- import com.uas.sso.core.Const;
- import org.codehaus.jackson.annotate.JsonIgnore;
- /**
- * 企业实体
- *
- * @author wangmh
- * @date 2018/1/4
- */
- @Entity
- @Table(name = "sso$userspace")
- public class Userspace implements Serializable {
- /**
- *
- */
- 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;
- /**
- * 管理员uu号
- */
- @Column(name = "adminuu")
- private Long adminUU;
- /**
- * 管理员
- */
- @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH})
- @JoinColumn(name = "adminuu", insertable=false, updatable=false)
- private User admin;
- /**
- * 营业执照号
- */
- @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 = "access_secret")
- private String accessSecret;
- /**
- * 企业对应erp的地址
- */
- @Column(name = "website")
- private String website;
- /**
- * 企业下的用户
- */
- @com.fasterxml.jackson.annotation.JsonIgnore
- @ManyToMany
- @JoinTable(name = "sso$user_userspace",
- joinColumns = {@JoinColumn(name="space_uu", referencedColumnName="spaceuu")},
- inverseJoinColumns = {@JoinColumn(name="user_uu", referencedColumnName="useruu")})
- private List<User> users;
- /**
- * 企业开通的应用
- */
- @ManyToMany(fetch = FetchType.LAZY)
- @JoinTable(name = "sso$app_userspace",
- joinColumns = {@JoinColumn(name="space_uu", referencedColumnName="spaceuu")},
- inverseJoinColumns = {@JoinColumn(name="app_uid", referencedColumnName="uid_")})
- private List<App> apps;
- public Userspace() {
- }
- public Userspace(Long spaceUU) {
- this.spaceUU = spaceUU;
- }
- public Userspace(String spaceName) {
- this.spaceName = spaceName;
- }
- public Long getSpaceUU() {
- return spaceUU;
- }
- public void setSpaceUU(Long spaceUU) {
- this.spaceUU = spaceUU;
- }
- public String getSpaceName() {
- if (spaceName.contains(Const.REPEAT_SEPARATOR)) {
- return spaceName.substring(0, spaceName.indexOf(Const.REPEAT_SEPARATOR));
- }
- 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 Long getAdminUU() {
- return adminUU;
- }
- public void setAdminUU(Long adminUU) {
- this.adminUU = adminUU;
- }
- public User getAdmin() {
- return admin;
- }
- public void setAdmin(User admin) {
- this.admin = admin;
- }
- public String getBusinessCode() {
- if (businessCode.contains(Const.REPEAT_SEPARATOR)) {
- return businessCode.substring(0, businessCode.indexOf(Const.REPEAT_SEPARATOR));
- }
- 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;
- }
- @JsonIgnore
- @JSONField(serialize = false)
- public List<User> getUsers() {
- return users;
- }
- public void setUsers(List<User> users) {
- this.users = users;
- }
- @JsonIgnore
- @JSONField(serialize = false)
- public List<App> getApps() {
- return apps;
- }
- public void setApps(List<App> apps) {
- this.apps = apps;
- }
- 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;
- }
- @JsonIgnore
- @JSONField(serialize = false)
- 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;
- }
- /**
- * 将企业信息变成视图
- * @return
- */
- public UserSpaceView toView() {
- UserSpaceView userSpaceView = new UserSpaceView();
- userSpaceView.setSpaceUU(this.getSpaceUU());
- userSpaceView.setSpaceName(this.getSpaceName());
- userSpaceView.setCorporation(this.getCorporation());
- userSpaceView.setRegisterDate(this.getRegisterDate());
- userSpaceView.setAdmin(this.getAdmin().toView());
- userSpaceView.setBusinessCode(this.getBusinessCode());
- userSpaceView.setBusinessCodeImage(this.getBusinessCodeImage());
- userSpaceView.setRegAddress(this.getRegAddress());
- userSpaceView.setValidCode(this.getValidCode());
- userSpaceView.setLogoImage(this.getLogoImage());
- userSpaceView.setTelephone(this.getTelephone());
- userSpaceView.setProfession(this.getProfession());
- userSpaceView.setTags(this.getTags());
- userSpaceView.setArea(this.getArea());
- return userSpaceView;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Userspace userspace = (Userspace) o;
- return spaceUU.equals(userspace.spaceUU);
- }
- @Override
- public int hashCode() {
- return spaceUU.hashCode();
- }
- }
|