From f90726cacf9234e8898b3b8b3f936322040edec3 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 13 Apr 2021 16:08:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=89=AB=E7=A0=81=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=B9=9F=E6=A0=B9=E6=8D=AE=E7=99=BB=E5=BD=95=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=BB=84=E7=BB=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile-test | 2 +- .../rtss/services/ISysUserService.java | 11 ++ .../joylink/rtss/services/SysUserService.java | 87 ++++++---- .../services/auth/AuthenticateService.java | 41 ++--- .../rtss/services/org/OrgUserService.java | 2 +- .../cbtc/build/InterlockBuilder2.java | 148 ------------------ .../java/club/joylink/rtss/vo/UserVO.java | 9 ++ 7 files changed, 102 insertions(+), 198 deletions(-) diff --git a/Dockerfile-test b/Dockerfile-test index 46ac1b8b5..58813577a 100644 --- a/Dockerfile-test +++ b/Dockerfile-test @@ -13,4 +13,4 @@ EXPOSE 9000 19000/tcp ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -CMD java -jar -Dfile.encoding=UTF-8 -Dspring.profiles.active=test /app.jar +CMD java -jar -Dfile.encoding=UTF-8 -Dspring.profiles.active=test -Dhttps.protocols=TLSv1.2 /app.jar 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(); + } + } } From 4220a2881dba1f89785ccb6cbddb05cc0e73a4c6 Mon Sep 17 00:00:00 2001 From: DU Date: Tue, 13 Apr 2021 16:59:46 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AF=AD=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile-test | 2 +- sql/20210413-dukang.sql | 11 +++++++++++ .../voice/huawei/HuaweiVoiceServiceImpl.java | 13 +++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 sql/20210413-dukang.sql diff --git a/Dockerfile-test b/Dockerfile-test index 46ac1b8b5..58813577a 100644 --- a/Dockerfile-test +++ b/Dockerfile-test @@ -13,4 +13,4 @@ EXPOSE 9000 19000/tcp ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -CMD java -jar -Dfile.encoding=UTF-8 -Dspring.profiles.active=test /app.jar +CMD java -jar -Dfile.encoding=UTF-8 -Dspring.profiles.active=test -Dhttps.protocols=TLSv1.2 /app.jar diff --git a/sql/20210413-dukang.sql b/sql/20210413-dukang.sql new file mode 100644 index 000000000..cbfc8a387 --- /dev/null +++ b/sql/20210413-dukang.sql @@ -0,0 +1,11 @@ +CREATE TABLE `map_group` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `group_name` VARCHAR(64) NOT NULL, + `group_type` VARCHAR(32) NOT NULL, + `map_ids` VARCHAR(6400) NOT NULL DEFAULT '[]', + PRIMARY KEY (`id`) +) +COMMENT='地图分组' +ENGINE=InnoDB +AUTO_INCREMENT=3 +; diff --git a/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java b/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java index 377bb1283..bc0b8a3e0 100644 --- a/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java @@ -20,6 +20,12 @@ import java.util.Base64; @Service("HuaWeiVoiceService") public class HuaweiVoiceServiceImpl implements IVoiceService { + + @Override + public String synthesis(String message, String per) { + throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现"); + } + /** * 华为语音识别配置 */ @@ -28,12 +34,6 @@ public class HuaweiVoiceServiceImpl implements IVoiceService { private final String region = "cn-north-4"; private final String projectId = "0aada8176180f28c2f34c0196f5394e8"; - - @Override - public String synthesis(String message, String per) { - throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现"); - } - @Override public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) { String filePath; @@ -42,6 +42,7 @@ public class HuaweiVoiceServiceImpl implements IVoiceService { } catch (IOException e) { throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e); } + System.setProperty("https.protocols", "TLSv1.2,TLSv1.1,SSLv3"); AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId); SisConfig sisConfig = new SisConfig(); AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig); From c540da932a6c9e76af7cdde654096b23347d1c1c Mon Sep 17 00:00:00 2001 From: DU Date: Tue, 13 Apr 2021 17:06:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java b/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java index bc0b8a3e0..492d9c404 100644 --- a/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/voice/huawei/HuaweiVoiceServiceImpl.java @@ -42,7 +42,6 @@ public class HuaweiVoiceServiceImpl implements IVoiceService { } catch (IOException e) { throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e); } - System.setProperty("https.protocols", "TLSv1.2,TLSv1.1,SSLv3"); AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId); SisConfig sisConfig = new SisConfig(); AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig); From a0d99564e4fb29ad4bfdb35f6591a15730c672d7 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 13 Apr 2021 18:30:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=A1=E5=8F=B7=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/map/newmap/MapGraphDataNewVO.java | 2 + .../client/map/newmap/MapSignalButtonVO.java | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalButtonVO.java diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapGraphDataNewVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapGraphDataNewVO.java index 4e0063658..424160aa4 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapGraphDataNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapGraphDataNewVO.java @@ -157,6 +157,8 @@ public class MapGraphDataNewVO { @ApiModelProperty(value = "应答器") private List responderList; + private List signalButtonList; + public MapGraphDataNewVO() { this.bigScreenConfig = new BigScreenConfig(); this.generateConfig = new MapCiGenerateConfig(); diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalButtonVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalButtonVO.java new file mode 100644 index 000000000..723ae0c95 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalButtonVO.java @@ -0,0 +1,42 @@ +package club.joylink.rtss.vo.client.map.newmap; + +import club.joylink.rtss.vo.client.Point; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * 信号按钮 + */ +@Getter +@Setter +@NoArgsConstructor +public class MapSignalButtonVO { + private String code; + + private String name; + + private Type type; + + private String signalCode; + + private String sectionCode; + + private String switchCode; + + private String showConditions; + + private Point position; + + private String stationCode; + + public enum Type { + PICK, + PASS, + GUIDE, + FLEXIBLE, + RAMP_TERMINAL, + TRAIN_TERMINAL, + SHUNT_TERMINAL + } +}