作者 crossoverJie

:recycle: Refactoring code.联调成功3

... ... @@ -86,6 +86,9 @@ public class RouteController {
String[] serverInfo = server.split(":");
CIMServerResVO vo = new CIMServerResVO(serverInfo[0],Integer.parseInt(serverInfo[1])) ;
//保存路由信息
accountService.saveRouteInfo(vo) ;
res.setDataBody(vo);
res.setCode(StatusEnum.SUCCESS.getCode()) ;
res.setMessage(StatusEnum.SUCCESS.getMessage()) ;
... ... @@ -109,7 +112,7 @@ public class RouteController {
long userId = System.currentTimeMillis();
RegisterInfoResVO info = new RegisterInfoResVO(userId,registerInfoReqVO.getUserName()) ;
info = accountService.registerAccount(info);
info = accountService.register(info);
res.setDataBody(info);
res.setCode(StatusEnum.SUCCESS.getCode()) ;
... ...
package com.crossoverjie.cim.route.service;
import com.crossoverjie.cim.route.vo.req.LoginReqVO;
import com.crossoverjie.cim.route.vo.res.CIMServerResVO;
import com.crossoverjie.cim.route.vo.res.RegisterInfoResVO;
/**
... ... @@ -18,7 +19,7 @@ public interface AccountService {
* @return
* @throws Exception
*/
RegisterInfoResVO registerAccount(RegisterInfoResVO info) throws Exception;
RegisterInfoResVO register(RegisterInfoResVO info) throws Exception;
/**
* 登录服务
... ... @@ -27,4 +28,11 @@ public interface AccountService {
* @throws Exception
*/
boolean login(LoginReqVO loginReqVO) throws Exception ;
/**
* 保存路由信息
* @param vo
* @throws Exception
*/
void saveRouteInfo(CIMServerResVO vo) throws Exception ;
}
... ...
... ... @@ -2,6 +2,7 @@ package com.crossoverjie.cim.route.service.impl;
import com.crossoverjie.cim.route.service.AccountService;
import com.crossoverjie.cim.route.vo.req.LoginReqVO;
import com.crossoverjie.cim.route.vo.res.CIMServerResVO;
import com.crossoverjie.cim.route.vo.res.RegisterInfoResVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -26,7 +27,7 @@ public class AccountServiceRedisImpl implements AccountService {
private RedisTemplate<String, String> redisTemplate;
@Override
public RegisterInfoResVO registerAccount(RegisterInfoResVO info) {
public RegisterInfoResVO register(RegisterInfoResVO info) {
String key = ACCOUNT_PREFIX + info.getUserId();
String name = redisTemplate.opsForValue().get(info.getUserName()) ;
... ... @@ -56,4 +57,9 @@ public class AccountServiceRedisImpl implements AccountService {
}
return true ;
}
@Override
public void saveRouteInfo(CIMServerResVO vo) throws Exception {
}
}
... ...
syntax = "proto2";
package protocol;
option java_package = "com.crossoverjie.cim.common.protocol";
option java_outer_classname = "CIMRequestProto";
message CIMReqProtocol {
required int64 requestId = 2;
required string reqMsg = 1;
required int32 type = 3;
}
... ...
syntax = "proto2";
package protocol;
option java_package = "com.crossoverjie.cim.common.protocol";
option java_outer_classname = "CIMResponseProto";
message CIMResProtocol {
required int64 responseId = 2;
required string resMsg = 1;
}
... ...