Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-zhouyin
This commit is contained in:
commit
db0222843f
18
src/main/java/club/joylink/rtss/entity/org/OrgProject.java
Normal file
18
src/main/java/club/joylink/rtss/entity/org/OrgProject.java
Normal file
@ -0,0 +1,18 @@
|
||||
package club.joylink.rtss.entity.org;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class OrgProject {
|
||||
private Long id;
|
||||
|
||||
private Long orgId;
|
||||
|
||||
private String projectCode;
|
||||
|
||||
private Long creatorId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
}
|
@ -55,13 +55,13 @@ public class AccountVO implements Serializable {
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@NotBlank(message="姓名不能为空")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@NotBlank(message="昵称不能为空")
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ public class AccountVO implements Serializable {
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotBlank(message="手机号码不能为空")
|
||||
@NotBlank(message = "手机号码不能为空")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
@ -85,7 +85,7 @@ public class AccountVO implements Serializable {
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
@NotBlank(message="微信OPENID不能为空")
|
||||
@NotBlank(message = "微信OPENID不能为空")
|
||||
private String wxId;
|
||||
|
||||
/**
|
||||
@ -140,7 +140,8 @@ public class AccountVO implements Serializable {
|
||||
private List<String> projectCodes;
|
||||
|
||||
|
||||
public AccountVO() {}
|
||||
public AccountVO() {
|
||||
}
|
||||
|
||||
public AccountVO(SysAccount account) {
|
||||
this.id = account.getId();
|
||||
@ -194,14 +195,14 @@ public class AccountVO implements Serializable {
|
||||
|
||||
@JsonIgnore
|
||||
public String getRolesStr() {
|
||||
if(!CollectionUtils.isEmpty(this.roles)) {
|
||||
return String.join(",", this.roles.toArray(new String[] {}));
|
||||
if (!CollectionUtils.isEmpty(this.roles)) {
|
||||
return String.join(",", this.roles.toArray(new String[]{}));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setRolesByString(String roles) {
|
||||
if(StringUtils.hasText(roles)) {
|
||||
if (StringUtils.hasText(roles)) {
|
||||
String[] splits = roles.split(",");
|
||||
this.roles = new ArrayList<>();
|
||||
Collections.addAll(this.roles, splits);
|
||||
@ -209,7 +210,7 @@ public class AccountVO implements Serializable {
|
||||
}
|
||||
|
||||
public void setRolesByString() {
|
||||
if(StringUtils.hasText(dbRoles)) {
|
||||
if (StringUtils.hasText(dbRoles)) {
|
||||
String[] splits = dbRoles.split(",");
|
||||
this.roles = new ArrayList<>();
|
||||
Collections.addAll(this.roles, splits);
|
||||
@ -218,13 +219,13 @@ public class AccountVO implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode="
|
||||
return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email + ", nationcode="
|
||||
+ nationcode + ", wxId=" + wxId + "]";
|
||||
}
|
||||
|
||||
public static List<AccountVO> convertFromDB(List<SysAccount> list) {
|
||||
List<AccountVO> voList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(list)) {
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(account -> voList.add(new AccountVO(account)));
|
||||
}
|
||||
return voList;
|
||||
@ -232,7 +233,7 @@ public class AccountVO implements Serializable {
|
||||
|
||||
public static List<AccountVO> convert2BaseInfoVO(List<SysAccount> list) {
|
||||
List<AccountVO> voList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(list)) {
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(account -> {
|
||||
AccountVO accountVO = new AccountVO();
|
||||
accountVO.setId(account.getId());
|
||||
@ -247,9 +248,9 @@ public class AccountVO implements Serializable {
|
||||
|
||||
public static List<SysAccount> convert2UnionIdInfoVOs(List<AccountVO> voList) {
|
||||
List<SysAccount> list = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(voList)) {
|
||||
if (!CollectionUtils.isEmpty(voList)) {
|
||||
voList.forEach(userVO -> {
|
||||
if(StringUtils.hasText(userVO.getWxUnionId())) {
|
||||
if (StringUtils.hasText(userVO.getWxUnionId())) {
|
||||
SysAccount account = new SysAccount();
|
||||
account.setId(userVO.getId());
|
||||
account.setWxUnionId(userVO.getWxUnionId());
|
||||
@ -262,6 +263,7 @@ public class AccountVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 是否管理员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@ -272,6 +274,7 @@ public class AccountVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 是否超级管理员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.constants.Client;
|
||||
import club.joylink.rtss.entity.SysAccountLogin;
|
||||
import club.joylink.rtss.entity.project.Project;
|
||||
import club.joylink.rtss.util.EncryptUtil;
|
||||
import club.joylink.rtss.vo.client.org.OrgProjectVO;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.project.ProjectVO;
|
||||
import lombok.Getter;
|
||||
@ -49,6 +50,9 @@ public class LoginUserInfoVO {
|
||||
private LocalDateTime preLogoutTime;
|
||||
private LocalDateTime lastQueryTime; // 最后使用时间
|
||||
|
||||
// 20220929 增加
|
||||
private OrgProjectVO orgProjectVO;
|
||||
|
||||
public LoginUserInfoVO(AccountVO accountVO, Client client, String project, ProjectDeviceVO deviceVO) {
|
||||
this.accountVO = accountVO;
|
||||
this.client = client;
|
||||
@ -139,4 +143,14 @@ public class LoginUserInfoVO {
|
||||
public boolean isWechatLogin() {
|
||||
return Client.Assistant.equals(this.getClient());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取顶级组织Id
|
||||
*/
|
||||
public Long getTopOrgId() {
|
||||
if (orgProjectVO == null) {
|
||||
return null;
|
||||
}
|
||||
return orgProjectVO.getTopOrgId();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package club.joylink.rtss.vo.client.org;
|
||||
|
||||
import club.joylink.rtss.entity.org.OrgProject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrgProjectVO {
|
||||
private Long topOrgId;
|
||||
|
||||
private Long orgId;
|
||||
|
||||
|
||||
private String projectCode;
|
||||
|
||||
public OrgProjectVO(OrgProject orgProject) {
|
||||
this.orgId = orgProject.getOrgId();
|
||||
this.projectCode = orgProject.getProjectCode();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user