Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-09-29 17:36:33 +08:00
commit 9b94c39826
7 changed files with 76 additions and 71 deletions

View 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;
}

View File

@ -55,13 +55,13 @@ public class AccountVO implements Serializable {
/** /**
* 真实姓名 * 真实姓名
*/ */
@NotBlank(message="姓名不能为空") @NotBlank(message = "姓名不能为空")
private String name; private String name;
/** /**
* 昵称 * 昵称
*/ */
@NotBlank(message="昵称不能为空") @NotBlank(message = "昵称不能为空")
private String nickname; private String nickname;
/** /**
@ -72,7 +72,7 @@ public class AccountVO implements Serializable {
/** /**
* 手机号 * 手机号
*/ */
@NotBlank(message="手机号码不能为空") @NotBlank(message = "手机号码不能为空")
private String mobile; private String mobile;
/** /**
@ -85,7 +85,7 @@ public class AccountVO implements Serializable {
/** /**
* 微信openId * 微信openId
*/ */
@NotBlank(message="微信OPENID不能为空") @NotBlank(message = "微信OPENID不能为空")
private String wxId; private String wxId;
/** /**
@ -140,7 +140,8 @@ public class AccountVO implements Serializable {
private List<String> projectCodes; private List<String> projectCodes;
public AccountVO() {} public AccountVO() {
}
public AccountVO(SysAccount account) { public AccountVO(SysAccount account) {
this.id = account.getId(); this.id = account.getId();
@ -194,14 +195,14 @@ public class AccountVO implements Serializable {
@JsonIgnore @JsonIgnore
public String getRolesStr() { public String getRolesStr() {
if(!CollectionUtils.isEmpty(this.roles)) { if (!CollectionUtils.isEmpty(this.roles)) {
return String.join(",", this.roles.toArray(new String[] {})); return String.join(",", this.roles.toArray(new String[]{}));
} }
return null; return null;
} }
public void setRolesByString(String roles) { public void setRolesByString(String roles) {
if(StringUtils.hasText(roles)) { if (StringUtils.hasText(roles)) {
String[] splits = roles.split(","); String[] splits = roles.split(",");
this.roles = new ArrayList<>(); this.roles = new ArrayList<>();
Collections.addAll(this.roles, splits); Collections.addAll(this.roles, splits);
@ -209,7 +210,7 @@ public class AccountVO implements Serializable {
} }
public void setRolesByString() { public void setRolesByString() {
if(StringUtils.hasText(dbRoles)) { if (StringUtils.hasText(dbRoles)) {
String[] splits = dbRoles.split(","); String[] splits = dbRoles.split(",");
this.roles = new ArrayList<>(); this.roles = new ArrayList<>();
Collections.addAll(this.roles, splits); Collections.addAll(this.roles, splits);
@ -218,13 +219,13 @@ public class AccountVO implements Serializable {
@Override @Override
public String toString() { 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 + "]"; + nationcode + ", wxId=" + wxId + "]";
} }
public static List<AccountVO> convertFromDB(List<SysAccount> list) { public static List<AccountVO> convertFromDB(List<SysAccount> list) {
List<AccountVO> voList = new ArrayList<>(); List<AccountVO> voList = new ArrayList<>();
if(!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
list.forEach(account -> voList.add(new AccountVO(account))); list.forEach(account -> voList.add(new AccountVO(account)));
} }
return voList; return voList;
@ -232,7 +233,7 @@ public class AccountVO implements Serializable {
public static List<AccountVO> convert2BaseInfoVO(List<SysAccount> list) { public static List<AccountVO> convert2BaseInfoVO(List<SysAccount> list) {
List<AccountVO> voList = new ArrayList<>(); List<AccountVO> voList = new ArrayList<>();
if(!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
list.forEach(account -> { list.forEach(account -> {
AccountVO accountVO = new AccountVO(); AccountVO accountVO = new AccountVO();
accountVO.setId(account.getId()); accountVO.setId(account.getId());
@ -247,9 +248,9 @@ public class AccountVO implements Serializable {
public static List<SysAccount> convert2UnionIdInfoVOs(List<AccountVO> voList) { public static List<SysAccount> convert2UnionIdInfoVOs(List<AccountVO> voList) {
List<SysAccount> list = new ArrayList<>(); List<SysAccount> list = new ArrayList<>();
if(!CollectionUtils.isEmpty(voList)) { if (!CollectionUtils.isEmpty(voList)) {
voList.forEach(userVO -> { voList.forEach(userVO -> {
if(StringUtils.hasText(userVO.getWxUnionId())) { if (StringUtils.hasText(userVO.getWxUnionId())) {
SysAccount account = new SysAccount(); SysAccount account = new SysAccount();
account.setId(userVO.getId()); account.setId(userVO.getId());
account.setWxUnionId(userVO.getWxUnionId()); account.setWxUnionId(userVO.getWxUnionId());
@ -262,6 +263,7 @@ public class AccountVO implements Serializable {
/** /**
* 是否管理员 * 是否管理员
*
* @return * @return
*/ */
@JsonIgnore @JsonIgnore
@ -272,6 +274,7 @@ public class AccountVO implements Serializable {
/** /**
* 是否超级管理员 * 是否超级管理员
*
* @return * @return
*/ */
@JsonIgnore @JsonIgnore

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.constants.Client;
import club.joylink.rtss.entity.SysAccountLogin; import club.joylink.rtss.entity.SysAccountLogin;
import club.joylink.rtss.entity.project.Project; import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.util.EncryptUtil; 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.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.project.ProjectVO; import club.joylink.rtss.vo.project.ProjectVO;
import lombok.Getter; import lombok.Getter;
@ -49,6 +50,9 @@ public class LoginUserInfoVO {
private LocalDateTime preLogoutTime; private LocalDateTime preLogoutTime;
private LocalDateTime lastQueryTime; // 最后使用时间 private LocalDateTime lastQueryTime; // 最后使用时间
// 20220929 增加
private OrgProjectVO orgProjectVO;
public LoginUserInfoVO(AccountVO accountVO, Client client, String project, ProjectDeviceVO deviceVO) { public LoginUserInfoVO(AccountVO accountVO, Client client, String project, ProjectDeviceVO deviceVO) {
this.accountVO = accountVO; this.accountVO = accountVO;
this.client = client; this.client = client;
@ -139,4 +143,14 @@ public class LoginUserInfoVO {
public boolean isWechatLogin() { public boolean isWechatLogin() {
return Client.Assistant.equals(this.getClient()); return Client.Assistant.equals(this.getClient());
} }
/**
* 获取顶级组织Id
*/
public Long getTopOrgId() {
if (orgProjectVO == null) {
return null;
}
return orgProjectVO.getTopOrgId();
}
} }

View File

@ -15,26 +15,6 @@ public enum WebSocketMessageType {
* 订单支付结果 * 订单支付结果
*/ */
Order_Pay_Result, Order_Pay_Result,
/**
* 综合演练室-房间消息
*/
JointTraining_Room,
/**
* 综合演练室-房间邀请消息
*/
JointTraining_Room_Invite,
/**
* 综合演练室-用户消息
*/
JointTraining_User,
/**
* 综合演练-设备消息
*/
JointTraining_Device,
/**
* 综合演练室-群聊消息
*/
JointTraining_Chat,
/** /**
* 被登出消息 * 被登出消息
*/ */
@ -158,26 +138,14 @@ public enum WebSocketMessageType {
* 仿真-控制权转换申请回复 * 仿真-控制权转换申请回复
*/ */
Simulation_ControlTransfer_Reply, Simulation_ControlTransfer_Reply,
/**
* 仿真-回放会话消息
*/
Simulation_PlayBack_Conversation,
/** /**
* 仿真-结束消息 * 仿真-结束消息
*/ */
Simulation_Over, Simulation_Over,
/**
* 仿真-权限用完
*/
Simulation_Permission_Over,
/** /**
* 仿真-任务已加载 * 仿真-任务已加载
*/ */
Simulation_Quest_Loaded, Simulation_Quest_Loaded,
/**
* 仿真-任务完成
*/
Simulation_Quest_Finish,
/** /**
* 仿真-退出任务 * 仿真-退出任务
*/ */
@ -200,10 +168,6 @@ public enum WebSocketMessageType {
* 仿真-退出剧本 * 仿真-退出剧本
*/ */
Simulation_Script_Quit, Simulation_Script_Quit,
/**
* 仿真-剧本完成
*/
Simulation_Script_Finish,
/** /**
* 仿真-竞赛实操完成 * 仿真-竞赛实操完成
*/ */
@ -229,10 +193,6 @@ public enum WebSocketMessageType {
* 仿真-暂停/开始消息 * 仿真-暂停/开始消息
*/ */
Simulation_Control_Pause, Simulation_Control_Pause,
/**
* 仿真回放完成消息
*/
Simulation_PlayBack_Finish,
/** /**
* 仿真驾驶数据路由 * 仿真驾驶数据路由
*/ */

View File

@ -70,23 +70,11 @@ public class SocketMessageFactory {
} }
case BROADCAST: case BROADCAST:
case Order_Pay_Result: case Order_Pay_Result:
case JointTraining_Room_Invite:
case Be_Logged_Out: case Be_Logged_Out:
case Simulation_Invite: { case Simulation_Invite: {
topicList.add(WebSocketSubscribeTopic.Common); topicList.add(WebSocketSubscribeTopic.Common);
break; break;
} }
case JointTraining_Room:
case JointTraining_Device:
case JointTraining_Chat: {
topicList.add(SimulationSubscribeTopic.Room.buildDestination(group));
break;
}
case JointTraining_User: {
topicList.add(SimulationSubscribeTopic.Room.buildDestination(group));
topicList.add(SimulationSubscribeTopic.WeChatMini.buildDestination(group));
break;
}
case Simulation_Time_Sync: case Simulation_Time_Sync:
case Simulation_User: case Simulation_User:
case Simulation_Member: case Simulation_Member:
@ -98,14 +86,10 @@ public class SocketMessageFactory {
case Simulation_RunAsPlan_Start: case Simulation_RunAsPlan_Start:
case Simulation_RunFact: case Simulation_RunFact:
case Simulation_ApplyHandle: case Simulation_ApplyHandle:
case Simulation_PlayBack_Conversation:
case Simulation_Control_Pause: case Simulation_Control_Pause:
case Simulation_Permission_Over:
case Simulation_Run_Plan_Reload: case Simulation_Run_Plan_Reload:
case Simulation_Trip_Plan_Change: case Simulation_Trip_Plan_Change:
case Simulation_Scenes_Reload: case Simulation_Scenes_Reload:
case Simulation_Quest_Finish:
case Simulation_PlayBack_Finish:
case Competition_Practical: case Competition_Practical:
case SIMULATION_RAIL_TICKET: case SIMULATION_RAIL_TICKET:
case Simulation_Alarm: { case Simulation_Alarm: {
@ -139,7 +123,6 @@ public class SocketMessageFactory {
case Simulation_Script_Action_Tip: case Simulation_Script_Action_Tip:
case Simulation_Script_Action_Finish: case Simulation_Script_Action_Finish:
case Simulation_Script_Action_Error: case Simulation_Script_Action_Error:
case Simulation_Script_Finish:
case Simulation_Competition_Practice_Finish: case Simulation_Competition_Practice_Finish:
case Simulation_Script_Action: case Simulation_Script_Action:
case Simulation_Driver_Change: case Simulation_Driver_Change:

View File

@ -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();
}
}

View File

@ -246,4 +246,12 @@
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="countByExample" parameterType="club.joylink.rtss.entity.project.ProjectViewExample"
resultType="java.lang.Long">
select count(*) from project_view
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
</mapper> </mapper>