正在显示
5 个修改的文件
包含
47 行增加
和
3 行删除
| @@ -86,6 +86,9 @@ public class RouteController { | @@ -86,6 +86,9 @@ public class RouteController { | ||
| 86 | String[] serverInfo = server.split(":"); | 86 | String[] serverInfo = server.split(":"); |
| 87 | CIMServerResVO vo = new CIMServerResVO(serverInfo[0],Integer.parseInt(serverInfo[1])) ; | 87 | CIMServerResVO vo = new CIMServerResVO(serverInfo[0],Integer.parseInt(serverInfo[1])) ; |
| 88 | 88 | ||
| 89 | + //保存路由信息 | ||
| 90 | + accountService.saveRouteInfo(vo) ; | ||
| 91 | + | ||
| 89 | res.setDataBody(vo); | 92 | res.setDataBody(vo); |
| 90 | res.setCode(StatusEnum.SUCCESS.getCode()) ; | 93 | res.setCode(StatusEnum.SUCCESS.getCode()) ; |
| 91 | res.setMessage(StatusEnum.SUCCESS.getMessage()) ; | 94 | res.setMessage(StatusEnum.SUCCESS.getMessage()) ; |
| @@ -109,7 +112,7 @@ public class RouteController { | @@ -109,7 +112,7 @@ public class RouteController { | ||
| 109 | 112 | ||
| 110 | long userId = System.currentTimeMillis(); | 113 | long userId = System.currentTimeMillis(); |
| 111 | RegisterInfoResVO info = new RegisterInfoResVO(userId,registerInfoReqVO.getUserName()) ; | 114 | RegisterInfoResVO info = new RegisterInfoResVO(userId,registerInfoReqVO.getUserName()) ; |
| 112 | - info = accountService.registerAccount(info); | 115 | + info = accountService.register(info); |
| 113 | 116 | ||
| 114 | res.setDataBody(info); | 117 | res.setDataBody(info); |
| 115 | res.setCode(StatusEnum.SUCCESS.getCode()) ; | 118 | res.setCode(StatusEnum.SUCCESS.getCode()) ; |
| 1 | package com.crossoverjie.cim.route.service; | 1 | package com.crossoverjie.cim.route.service; |
| 2 | 2 | ||
| 3 | import com.crossoverjie.cim.route.vo.req.LoginReqVO; | 3 | import com.crossoverjie.cim.route.vo.req.LoginReqVO; |
| 4 | +import com.crossoverjie.cim.route.vo.res.CIMServerResVO; | ||
| 4 | import com.crossoverjie.cim.route.vo.res.RegisterInfoResVO; | 5 | import com.crossoverjie.cim.route.vo.res.RegisterInfoResVO; |
| 5 | 6 | ||
| 6 | /** | 7 | /** |
| @@ -18,7 +19,7 @@ public interface AccountService { | @@ -18,7 +19,7 @@ public interface AccountService { | ||
| 18 | * @return | 19 | * @return |
| 19 | * @throws Exception | 20 | * @throws Exception |
| 20 | */ | 21 | */ |
| 21 | - RegisterInfoResVO registerAccount(RegisterInfoResVO info) throws Exception; | 22 | + RegisterInfoResVO register(RegisterInfoResVO info) throws Exception; |
| 22 | 23 | ||
| 23 | /** | 24 | /** |
| 24 | * 登录服务 | 25 | * 登录服务 |
| @@ -27,4 +28,11 @@ public interface AccountService { | @@ -27,4 +28,11 @@ public interface AccountService { | ||
| 27 | * @throws Exception | 28 | * @throws Exception |
| 28 | */ | 29 | */ |
| 29 | boolean login(LoginReqVO loginReqVO) throws Exception ; | 30 | boolean login(LoginReqVO loginReqVO) throws Exception ; |
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 保存路由信息 | ||
| 34 | + * @param vo | ||
| 35 | + * @throws Exception | ||
| 36 | + */ | ||
| 37 | + void saveRouteInfo(CIMServerResVO vo) throws Exception ; | ||
| 30 | } | 38 | } |
cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/AccountServiceRedisImpl.java
| @@ -2,6 +2,7 @@ package com.crossoverjie.cim.route.service.impl; | @@ -2,6 +2,7 @@ package com.crossoverjie.cim.route.service.impl; | ||
| 2 | 2 | ||
| 3 | import com.crossoverjie.cim.route.service.AccountService; | 3 | import com.crossoverjie.cim.route.service.AccountService; |
| 4 | import com.crossoverjie.cim.route.vo.req.LoginReqVO; | 4 | import com.crossoverjie.cim.route.vo.req.LoginReqVO; |
| 5 | +import com.crossoverjie.cim.route.vo.res.CIMServerResVO; | ||
| 5 | import com.crossoverjie.cim.route.vo.res.RegisterInfoResVO; | 6 | import com.crossoverjie.cim.route.vo.res.RegisterInfoResVO; |
| 6 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| @@ -26,7 +27,7 @@ public class AccountServiceRedisImpl implements AccountService { | @@ -26,7 +27,7 @@ public class AccountServiceRedisImpl implements AccountService { | ||
| 26 | private RedisTemplate<String, String> redisTemplate; | 27 | private RedisTemplate<String, String> redisTemplate; |
| 27 | 28 | ||
| 28 | @Override | 29 | @Override |
| 29 | - public RegisterInfoResVO registerAccount(RegisterInfoResVO info) { | 30 | + public RegisterInfoResVO register(RegisterInfoResVO info) { |
| 30 | String key = ACCOUNT_PREFIX + info.getUserId(); | 31 | String key = ACCOUNT_PREFIX + info.getUserId(); |
| 31 | 32 | ||
| 32 | String name = redisTemplate.opsForValue().get(info.getUserName()) ; | 33 | String name = redisTemplate.opsForValue().get(info.getUserName()) ; |
| @@ -56,4 +57,9 @@ public class AccountServiceRedisImpl implements AccountService { | @@ -56,4 +57,9 @@ public class AccountServiceRedisImpl implements AccountService { | ||
| 56 | } | 57 | } |
| 57 | return true ; | 58 | return true ; |
| 58 | } | 59 | } |
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public void saveRouteInfo(CIMServerResVO vo) throws Exception { | ||
| 63 | + | ||
| 64 | + } | ||
| 59 | } | 65 | } |
protocol/BaseRequestProto.proto
0 → 100644
| 1 | +syntax = "proto2"; | ||
| 2 | + | ||
| 3 | +package protocol; | ||
| 4 | + | ||
| 5 | +option java_package = "com.crossoverjie.cim.common.protocol"; | ||
| 6 | +option java_outer_classname = "CIMRequestProto"; | ||
| 7 | + | ||
| 8 | +message CIMReqProtocol { | ||
| 9 | + required int64 requestId = 2; | ||
| 10 | + required string reqMsg = 1; | ||
| 11 | + required int32 type = 3; | ||
| 12 | + | ||
| 13 | +} | ||
| 14 | + |
protocol/BaseResponseProto.proto
0 → 100644
-
请 注册 或 登录 后发表评论