diff --git a/src/main/java/club/joylink/rtss/services/ISysUserService.java b/src/main/java/club/joylink/rtss/services/ISysUserService.java index b84aeb676..4f7e3dd0f 100644 --- a/src/main/java/club/joylink/rtss/services/ISysUserService.java +++ b/src/main/java/club/joylink/rtss/services/ISysUserService.java @@ -1,6 +1,7 @@ package club.joylink.rtss.services; import club.joylink.rtss.constants.Project; +import club.joylink.rtss.entity.Org; import club.joylink.rtss.entity.SysUser; import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserVO; @@ -31,6 +32,16 @@ public interface ISysUserService { */ UserVO findUserById(Long id); + /** + * 设置用户的(与项目{project}关联的)组织信息 + */ + void setOrgInfoOfOrgRelWithTheProject(Project project, UserVO userVO); + + /** + * 设置用户与该组织的关联信息 + */ + void setOrgInfoOfThisOrg(Org topOrg, UserVO userVO); + SysUser findEntity(@NonNull String account, long orgId); boolean isExist(@NonNull String account, long orgId); diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index 007926682..284ea58ad 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -15,10 +15,7 @@ import club.joylink.rtss.services.org.IOrgService; import club.joylink.rtss.services.org.IOrgUserService; import club.joylink.rtss.util.EncryptUtil; import club.joylink.rtss.util.RandomGenerator; -import club.joylink.rtss.vo.SmsResponse; -import club.joylink.rtss.vo.UserQueryVO; -import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.VdCode; +import club.joylink.rtss.vo.*; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.org.CompanyVO; @@ -114,19 +111,38 @@ public class SysUserService implements ISysUserService { } } /* 如果用户属于该顶级组织,设置相关属性 */ - userVO.setRolesByString(); - if (topOrg != null) { + setOrgInfoOfThisOrg(topOrg, userVO); + return userVO; + } + + @Override + public void setOrgInfoOfOrgRelWithTheProject(Project project, UserVO userVO) { + if (project != null) { + Org topOrg = iOrgService.findEntity(project, BusinessConsts.Org.Status.VALID); + setOrgInfoOfThisOrg(topOrg, userVO); + } + } + + @Override + public void setOrgInfoOfThisOrg(Org topOrg, UserVO userVO) { + if (topOrg != null && userVO != null && topOrg.getId() != null && userVO.getId() != null) { boolean flag = false; if (Objects.equals(topOrg.getId(), userVO.getOrgId())) { flag = true; } else { List orgUsers = iOrgUserService.findEntitiesByUserId(userVO.getId(), null); + if (CollectionUtils.isEmpty(orgUsers)) + return; if (orgUsers.stream().anyMatch(ou -> Objects.equals(ou.getOrgId(), topOrg.getId()))) { flag = true; } else { - Set userRelTopOrgId = iOrgService.findEntities(orgUsers.stream().map(OrgUser::getOrgId) - .collect(Collectors.toList()), BusinessConsts.Org.Status.VALID) - .stream().map(Org::getRootId).collect(Collectors.toSet()); //用户直接或间接关联的所有顶级组织id + List orgIds = orgUsers.stream().map(OrgUser::getOrgId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(orgIds)) + return; + List orgs = iOrgService.findEntities(orgIds, BusinessConsts.Org.Status.VALID); + if (CollectionUtils.isEmpty(orgs)) + return; + Set userRelTopOrgId = orgs.stream().map(Org::getRootId).collect(Collectors.toSet()); //用户直接或间接关联的所有顶级组织id if (userRelTopOrgId.contains(topOrg.getId())) { flag = true; } @@ -136,7 +152,6 @@ public class SysUserService implements ISysUserService { userVO.setOrgInfo(topOrg, iOrgUserService.isTheRoleInThisOrg(userVO.getId(), topOrg.getId(), BusinessConsts.OrgRole.Admin)); } } - return userVO; } @Override @@ -285,8 +300,7 @@ public class SysUserService implements ISysUserService { if (!user.getRoles().equals(userVO.getRolesStr())) { user.setRoles(userVO.getRolesStr()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO newUserVO = queryUserInfoWithOrgInfo(id); - this.loginSessionManager.updateLoginUser(newUserVO); + this.updateLoginUserInfoWithOrgInfo(user); } } @@ -442,9 +456,10 @@ public class SysUserService implements ISysUserService { if (CollectionUtils.isEmpty(list)) { return null; } - UserVO userVO = this.queryUserInfoWithOrgInfo(list.get(0).getId()); - userVO.setRolesByString(); - return userVO; + return new UserVO(list.get(0)); +// UserVO userVO = this.queryUserInfoWithOrgInfo(list.get(0).getId()); +// userVO.setRolesByString(); +// return userVO; } @Override @@ -454,9 +469,10 @@ public class SysUserService implements ISysUserService { example.createCriteria().andWmOpenIdEqualTo(wmOpenId); List userList = this.sysUserDAO.selectByExample(example); if (!CollectionUtils.isEmpty(userList)) { - UserVO userVO = queryUserInfoWithOrgInfo(userList.get(0).getId()); - userVO.setRolesByString(); - return userVO; + return new UserVO(userList.get(0)); +// UserVO userVO = queryUserInfoWithOrgInfo(userList.get(0).getId()); +// userVO.setRolesByString(); +// return userVO; } return null; } @@ -584,8 +600,7 @@ public class SysUserService implements ISysUserService { user.setName(name); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO userVO = this.queryUserInfoWithOrgInfo(id); - this.loginSessionManager.updateLoginUser(userVO); + this.updateLoginUserInfoWithOrgInfo(user); } } @@ -598,8 +613,7 @@ public class SysUserService implements ISysUserService { user.setNickname(nickname); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO userVO = this.queryUserInfoWithOrgInfo(id); - this.loginSessionManager.updateLoginUser(userVO); + this.updateLoginUserInfoWithOrgInfo(user); } } @@ -610,8 +624,7 @@ public class SysUserService implements ISysUserService { user.setAvatarPath(avatarPath); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO userVO = queryUserInfoWithOrgInfo(id); - this.loginSessionManager.updateLoginUser(userVO); + this.updateLoginUserInfoWithOrgInfo(user); } } @@ -628,8 +641,7 @@ public class SysUserService implements ISysUserService { user.setMobile(updateMobileVO.getMobile()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO userVO = this.queryUserInfoWithOrgInfo(id); - this.loginSessionManager.updateLoginUser(userVO); + this.updateLoginUserInfoWithOrgInfo(user); } } @@ -645,8 +657,7 @@ public class SysUserService implements ISysUserService { user.setEmail(updateEmailVO.getEmail()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO userVO = this.queryUserInfoWithOrgInfo(id); - this.loginSessionManager.updateLoginUser(userVO); + this.updateLoginUserInfoWithOrgInfo(user); } } @@ -782,8 +793,8 @@ public class SysUserService implements ISysUserService { user.setRoles(updateUserVO.getRolesStr()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - UserVO newUserVO = this.queryUserInfoWithOrgInfo(userId); - this.loginSessionManager.updateLoginUser(newUserVO); +// UserVO newUserVO = this.queryUserInfoWithOrgInfo(userId); +// this.loginSessionManager.updateLoginUser(newUserVO); } // //更新所属公司 // Integer companyId = updateUserVO.getCompanyId(); @@ -842,4 +853,20 @@ public class SysUserService implements ISysUserService { } return userVO; } + + /** + * 更新登录用户信息(包含组织信息) + * @param user + */ + private void updateLoginUserInfoWithOrgInfo(SysUser user) { + List loginUserInfoVOS = loginSessionManager.queryLoginInfoByUserId(user.getId()); + if (!CollectionUtils.isEmpty(loginUserInfoVOS)) { + for (LoginUserInfoVO loginInfo : loginUserInfoVOS) { + UserVO oldUserVO = loginInfo.getUserVO(); + UserVO newUserVO = new UserVO(user); + newUserVO.copyOrgInfo(oldUserVO); + loginInfo.setUserVO(newUserVO); + } + } + } } diff --git a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java index 6019b784d..58f14ebd7 100644 --- a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java +++ b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java @@ -105,8 +105,9 @@ public class AuthenticateService implements IAuthenticateService { public UserVO scanWmLoginQrCode(String code, String state) { LoginScanParam param = LoginScanParam.parse(state); LoginStatusVO loginStatusVo = getLoginStatus(param.getSessionId()); - BusinessExceptionAssertEnum.LOGIN_EXPIRED.assertTrue(null!=loginStatusVo&&loginStatusVo.isWaiting()); + BusinessExceptionAssertEnum.LOGIN_EXPIRED.assertTrue(null != loginStatusVo && loginStatusVo.isWaiting()); UserVO userVO = getOrCreateUserByWmcode(code); + loginStatusVo.setStatus(LoginStatusVO.ScanLoginStatus.SCAN); return userVO; } @@ -115,17 +116,17 @@ public class AuthenticateService implements IAuthenticateService { public UserVO getOrCreateUserByWmcode(String code) { WmUserSession wmUserSession = this.iWxApiService.getWmUserSession(code); UserVO userVO = null; - if(!StringUtils.isEmpty(wmUserSession.getUnionid())) { + if (!StringUtils.isEmpty(wmUserSession.getUnionid())) { userVO = this.iSysUserService.findUserByUnionId(wmUserSession.getUnionid()); } - if(Objects.isNull(userVO)) { + if (Objects.isNull(userVO)) { userVO = this.iSysUserService.findUserByWmOpenId(wmUserSession.getOpenid()); } else { if (!Objects.equals(wmUserSession.getOpenid(), userVO.getWmOpenId())) { this.iSysUserService.updateUserWmOpenId(userVO.getId(), wmUserSession.getOpenid()); } } - if(Objects.isNull(userVO)) { // 如果用户不存在,新建用户 + if (Objects.isNull(userVO)) { // 如果用户不存在,新建用户 userVO = this.iSysUserService.createUserOfWechatMicro(wmUserSession); } userVO.filter4Client(); @@ -199,15 +200,17 @@ public class AuthenticateService implements IAuthenticateService { // 获取登陆状态对象 LoginStatusVO loginStatusVo = getLoginStatus(sessionId); synchronized (loginStatusVo) { - if(!loginStatusVo.isSuccess()) { + if (!loginStatusVo.isSuccess()) { // 获取用户 WmUserSession wmUserSession = this.iWxApiService.getWmUserSession(code); UserVO user = this.iSysUserService.getUserByWmOpenId(wmUserSession.getOpenid()); - if(StringUtils.isEmpty(loginStatusVo.getToken())){ //正常扫码登陆 + if (StringUtils.isEmpty(loginStatusVo.getToken())) { //正常扫码登陆 // 构造登陆用户信息 LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(user, loginStatusVo.getClient(), loginStatusVo.getProject(), loginStatusVo.getDeviceVO()); + // 设置组织信息 + iSysUserService.setOrgInfoOfOrgRelWithTheProject(loginUserInfo.getProject(), user); // 登陆 login(loginUserInfo, true); // 更新登陆状态 @@ -220,8 +223,9 @@ public class AuthenticateService implements IAuthenticateService { /** * 登录逻辑 + * * @param loginUserInfo - * @param force 是否强制登录,true-登出之前登录的相同系统;false-若存在相同已登录系统,此次登录失败 + * @param force 是否强制登录,true-登出之前登录的相同系统;false-若存在相同已登录系统,此次登录失败 */ public void login(LoginUserInfoVO loginUserInfo, boolean force) { if (force) { @@ -251,7 +255,7 @@ public class AuthenticateService implements IAuthenticateService { ProjectDeviceVO deviceVO = loginUserInfo.getDeviceVO(); Objects.requireNonNull(deviceVO); switch (deviceVO.getType()) { - case IM:{ + case IM: { // 教员机 Simulation simulation = this.projectJointSimulationService.createSimulation(loginUserInfo); loginUserInfo.setGroup(simulation.getGroup()); @@ -260,7 +264,7 @@ public class AuthenticateService implements IAuthenticateService { case LW: case DEPOT: case DRIVE: - case CW:{ + case CW: { // 工作站登录 this.projectJointSimulationService.handleWorkStationLogin(loginUserInfo); break; @@ -283,7 +287,7 @@ public class AuthenticateService implements IAuthenticateService { } } } - BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(login,"已登录"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(login, "已登录"); } private void logoutSameClient(LoginUserInfoVO loginUserInfo) { @@ -310,7 +314,7 @@ public class AuthenticateService implements IAuthenticateService { project = Project.DEFAULT; } UserVO user = this.iSysUserService - .findUserByAccountAndPassword(loginUser.getAccount(), loginUser.getPassword(),project); + .findUserByAccountAndPassword(loginUser.getAccount(), loginUser.getPassword(), project); BusinessExceptionAssertEnum.LOGIN_INFO_ERROR.assertNotNull(user, "账号或密码不正确!"); Client client = Client.getByIdAndSecret(loginUser.getClientId(), loginUser.getSecret()); ProjectDeviceVO deviceVO = null; @@ -326,14 +330,14 @@ public class AuthenticateService implements IAuthenticateService { @Override public void logout(String token) { - if(Objects.nonNull(token)) { + if (Objects.nonNull(token)) { LoginUserInfoVO loginUserInfoVO = this.loginSessionManager.queryLoginInfoByToken(token); this.logout(loginUserInfoVO); } } private void logout(LoginUserInfoVO loginUserInfoVO) { - if(Objects.nonNull(loginUserInfoVO)) { + if (Objects.nonNull(loginUserInfoVO)) { log.debug(String.format("用户[%s(%s)]登出[%s]", loginUserInfoVO.getUserVO().getNickname(), loginUserInfoVO.getUserVO().getId(), loginUserInfoVO.getClientInfoStr())); @@ -346,6 +350,7 @@ public class AuthenticateService implements IAuthenticateService { /** * 处理项目设备登出连带其他设备登出逻辑 + * * @param event */ @EventListener @@ -359,7 +364,7 @@ public class AuthenticateService implements IAuthenticateService { logoutList.addAll(loginUserInfoVOS); break; case CW: - case LW:{ + case LW: { for (LoginUserInfoVO infoVO : loginUserInfoVOS) { ProjectDeviceVO deviceVO = infoVO.getDeviceVO(); RelationLoginConfigVO configVO = deviceVO.buildRelationLoginConfig(); @@ -425,7 +430,7 @@ public class AuthenticateService implements IAuthenticateService { case CCTV: case SANDBOX: case ILW: - case VR_IBP:{ + case VR_IBP: { RelationLoginConfigVO config = deviceVO.buildRelationLoginConfig(); if (Objects.nonNull(config) && Objects.nonNull(config.getDeviceCode())) { loginUserInfoVO = this.loginSessionManager.queryLoginInfoOfDevice(config.getDeviceCode()); @@ -488,10 +493,10 @@ public class AuthenticateService implements IAuthenticateService { } public String toParam() { - if(Objects.isNull(this.envId)) { - return this.sessionId+Splitter+this.clientId; + if (Objects.isNull(this.envId)) { + return this.sessionId + Splitter + this.clientId; } - return this.envId+Splitter+this.sessionId+Splitter+this.clientId; + return this.envId + Splitter + this.sessionId + Splitter + this.clientId; } } } diff --git a/src/main/java/club/joylink/rtss/services/org/OrgUserService.java b/src/main/java/club/joylink/rtss/services/org/OrgUserService.java index 36f85e0fd..251d9e88b 100644 --- a/src/main/java/club/joylink/rtss/services/org/OrgUserService.java +++ b/src/main/java/club/joylink/rtss/services/org/OrgUserService.java @@ -383,7 +383,7 @@ public class OrgUserService implements IOrgUserService { public void userBindCompanyManager(UserVO userVO, Long topOrgId) { Org topOrg = iOrgService.getEntity(topOrgId); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNull(topOrg.getParentId(), "所选组织不是顶级组织"); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isTheRoleInThisOrg(userVO.getId(), topOrgId, BusinessConsts.OrgRole.Admin), + BusinessExceptionAssertEnum.OPERATION_REPEAT.assertNotTrue(isTheRoleInThisOrg(userVO.getId(), topOrgId, BusinessConsts.OrgRole.Admin), "已经是所选组织管理员"); /* 如果是其它组织的管理员,删除关系 */ List orgUsers = findEntitiesByUserId(userVO.getId(), BusinessConsts.OrgRole.Admin); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java index ea43618af..4200e9f6b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java @@ -647,154 +647,6 @@ public class InterlockBuilder2 { right, necessarySections, leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, necessaryRoutes, runPath, routes); destinationMap.put(code, destinationCodeDefinition); } - - -// Set checkCodeDuplicateSet = new HashSet<>(); //用于检查code重复 -// -// for (MapDestinationCodeDefinitionVO vo : destinationCodeDefinitionList) { -// //构建目的地码定义需要的所有参数 -// String code = null; -// DestinationCodeDefinition.Type type = null; -// String description = null; -// Section startSection = null; -// Section section = null; -// Boolean right = vo.getRight(); -// List
necessarySections = new ArrayList<>(); -// Station leftStation = null; -// Station rightStation = null; -// Boolean leftFrontTurnBack = null; -// Boolean rightFrontTurnBack = null; -// List necessaryRoutes = null; -// List
runPath = null; -// List routes = null; -// -// code = vo.getCode(); -// if (!checkCodeDuplicateSet.add(code)) { -// errMsgList.add(String.format("目的地码[%s]重复", code)); -// } -// type = vo.getType(); -// if (type == null) { -// errMsgList.add(String.format("目的地码[%s]没有类型", code)); -// continue; -// } -// if (vo.getStartSectionCode() != null) { -// startSection = (Section) elementMap.get(vo.getStartSectionCode()); -// } -// if (vo.getSectionCode() != null) { -// section = (Section) elementMap.get(vo.getSectionCode()); -// } -// if (!CollectionUtils.isEmpty(vo.getRunPath())) { -// necessarySections = vo.getRunPath().stream().map(pathSectionCode -> (Section) elementMap.get(pathSectionCode)) -// .collect(Collectors.toList()); -// } -// switch (type) { -// case NORMAL_OPERATION: { -// description = vo.getDescription(); -// if (!StringUtils.hasText(description)) { -// errMsgList.add(String.format("目的地码[%s]没有描述", code)); -// } -// if (!StringUtils.hasText(vo.getStationACode())) { -// errMsgList.add(String.format("环路类目的地码[%s]没有车站A", code)); -// continue; -// } -// if (!StringUtils.hasText(vo.getStationBCode())) { -// errMsgList.add(String.format("环路类目的地码[%s]没有车站B", code)); -// continue; -// } -// Station stationA = (Station) elementMap.get(vo.getStationACode()); -// Station stationB = (Station) elementMap.get(vo.getStationBCode()); -// boolean stationAFrontTurnBack = vo.getStationAFrontTurnBack() != null ? vo.getStationAFrontTurnBack() : false; -// boolean stationBFrontTurnBack = vo.getStationBFrontTurnBack() != null ? vo.getStationBFrontTurnBack() : false; -// if (stationA.getSn() > stationB.getSn()) { -// leftStation = stationB; -// leftFrontTurnBack = stationBFrontTurnBack; -// rightStation = stationA; -// rightFrontTurnBack = stationAFrontTurnBack; -// } else { -// leftStation = stationA; -// leftFrontTurnBack = stationAFrontTurnBack; -// rightStation = stationB; -// rightFrontTurnBack = stationBFrontTurnBack; -// } -// //从左边车站右行站台站台轨开始,构建运行路径--- (不标准的目的地码定义数据会导致运行路径构建错误) -// Set
necessarySectionSet = new HashSet<>(necessarySections); //必经区段副本 -// Section startSection4RoutePath = null; //查询路径的起始区段 -// Section endSection4RoutePath = null; //查询路径的终点区段 -// runPath = new ArrayList<>(); -// routes = new ArrayList<>(); -// //从左端车站开始选择路径 -// startSection4RoutePath = selectSection4DestinationCode(leftStation, leftFrontTurnBack, necessarySectionSet, true); -// runPath.add(startSection4RoutePath); -// endSection4RoutePath = selectSection4DestinationCode(rightStation, rightFrontTurnBack, necessarySectionSet, false); -// //查询并添加路径 -// RoutePath optimalPath = CalculateService.queryLeastSwitchRoutePath(startSection4RoutePath, endSection4RoutePath, necessarySectionSet, true); -// BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(optimalPath, -// String.format("从%s到%s的路径未找到", startSection4RoutePath.debugStr(), endSection4RoutePath.debugStr())); -// runPath.addAll(optimalPath.getSectionList()); -// //寻找反向的路径 -// Section t = startSection4RoutePath; -// startSection4RoutePath = endSection4RoutePath; -// endSection4RoutePath = t; -// runPath.add(startSection4RoutePath); -// RoutePath optimalPath2 = CalculateService.queryLeastSwitchRoutePath(startSection4RoutePath, endSection4RoutePath, necessarySectionSet, false); -// BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(optimalPath2, -// String.format("从%s到%s的路径未找到", startSection4RoutePath.debugStr(), endSection4RoutePath.debugStr())); -// runPath.addAll(optimalPath2.getSectionList()); -// //添加进路 -// routes.addAll(CalculateService.selectUniqueRoutes(optimalPath, true)); -// routes.addAll(CalculateService.selectUniqueRoutes(optimalPath2, true)); -// break; -// } -// case LAST_OPERATION: -// case NON_OPERATION: -// case LAST_NON_OPERATION: { -// description = vo.getDescription(); -// if (!StringUtils.hasText(description)) { -// errMsgList.add(String.format("目的地码[%s]没有描述", code)); -// } -// if (section == null) { -// errMsgList.add(String.format("单向目的地码[%s]没有目标区段", code)); -// continue; -// } -// if (startSection != null) { -// List
sectionPath = new ArrayList<>(); -// sectionPath.add(startSection); -// sectionPath.addAll(necessarySections); -// sectionPath.add(section); -// runPath = new ArrayList<>(); -// routes = new ArrayList<>(); -// for (int i = 0; i < sectionPath.size() - 1; i++) { -// Section start = sectionPath.get(i); -// Section end = sectionPath.get(i + 1); -// RoutePath routePath; -// if (right == null) { -// routePath = CalculateService.queryLeastSwitchRoutePath(start, end, null, true); -// if (routePath == null) { -// routePath = CalculateService.queryLeastSwitchRoutePath(start, end, null, false); -// } -// } else { -// routePath = CalculateService.queryLeastSwitchRoutePath(start, end, null, right); -// } -// BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(routePath, -// String.format("从%s到%s的路径未找到", startSection.debugStr(), section.debugStr())); -// runPath.add(start); -// runPath.addAll(routePath.getSectionList()); -// routes.addAll(routePath.getRouteList()); -// } -// runPath.add(section); -// } -// } -// case OTHER: -// if (section == null) { -// errMsgList.add(String.format("单向目的地码[%s]没有目标区段", code)); -// continue; -// } -// break; -// } -// DestinationCodeDefinition destinationCodeDefinition = new DestinationCodeDefinition(code, type, description, startSection, section, -// right, necessarySections, leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, necessaryRoutes, runPath, routes); -// destinationMap.put(code, destinationCodeDefinition); -// } } /** diff --git a/src/main/java/club/joylink/rtss/vo/UserVO.java b/src/main/java/club/joylink/rtss/vo/UserVO.java index 8acd1d21c..66b6917ec 100644 --- a/src/main/java/club/joylink/rtss/vo/UserVO.java +++ b/src/main/java/club/joylink/rtss/vo/UserVO.java @@ -285,4 +285,13 @@ public class UserVO implements Serializable { this.projectCodes = Arrays.asList(org.getProjectCode().split(",")); } } + + public void copyOrgInfo(UserVO userVO) { + if (userVO != null) { + this.companyId = userVO.getCompanyId(); + this.companyName = userVO.getCompanyName(); + this.companyAdmin = userVO.getCompanyAdmin(); + this.projectCodes = userVO.getProjectCodes(); + } + } }