Commit b880f187 by 袁伟铭

用户模块添加多数据源

parent 670439a5
...@@ -25,6 +25,8 @@ public enum ApiCodeEnum { ...@@ -25,6 +25,8 @@ public enum ApiCodeEnum {
CHECK_SIGN_VALID_ERROR("108", "签名校验失败"), CHECK_SIGN_VALID_ERROR("108", "签名校验失败"),
SERVICE_NOT_AVAILABLE("109", "服务不可用"),
BUSINESS_ERROR("400", "业务处理失败"), BUSINESS_ERROR("400", "业务处理失败"),
SERVER_ERROR("500", "服务器繁忙"), SERVER_ERROR("500", "服务器繁忙"),
......
...@@ -89,6 +89,8 @@ public class ApiController { ...@@ -89,6 +89,8 @@ public class ApiController {
// 判断指定异常是否来自或者包含指定异常 // 判断指定异常是否来自或者包含指定异常
if (ExceptionUtil.isFromOrSuppressedThrowable(e, FeignException.Unauthorized.class)) { if (ExceptionUtil.isFromOrSuppressedThrowable(e, FeignException.Unauthorized.class)) {
resp = ApiUtils.toApiResp(form, ResultVo.fail(401, "Unauthorized")); resp = ApiUtils.toApiResp(form, ResultVo.fail(401, "Unauthorized"));
} else if (stackTrace.contains("Load balancer does not have available server for client")) {
resp = ApiUtils.getServiceNotAvailableError(form);
} else { } else {
resp = ApiUtils.getMethodHandlerError(form); resp = ApiUtils.getMethodHandlerError(form);
} }
......
...@@ -144,6 +144,17 @@ public class ApiUtils { ...@@ -144,6 +144,17 @@ public class ApiUtils {
return new ApiResp(form, ApiCodeEnum.CHECK_SIGN_VALID_ERROR); return new ApiResp(form, ApiCodeEnum.CHECK_SIGN_VALID_ERROR);
} }
/**
* 服务不可用resp
* <p>
* 2016年9月29日 上午11:44:38
*
* @return
*/
public static ApiResp getServiceNotAvailableError(ApiForm form) {
return new ApiResp(form, ApiCodeEnum.SERVICE_NOT_AVAILABLE);
}
public static ApiResp toApiResp(ApiForm form, ResultVo resultVo) { public static ApiResp toApiResp(ApiForm form, ResultVo resultVo) {
ApiResp apiResp = new ApiResp(form); ApiResp apiResp = new ApiResp(form);
if (resultVo.isSuccess()) { if (resultVo.isSuccess()) {
......
...@@ -59,7 +59,7 @@ spring: ...@@ -59,7 +59,7 @@ spring:
username: root username: root
password: rooT123!321 password: rooT123!321
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
shzz: gxshzz:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: root username: root
......
...@@ -33,7 +33,7 @@ spring: ...@@ -33,7 +33,7 @@ spring:
username: ${jdbc.username} username: ${jdbc.username}
password: ${jdbc.password} password: ${jdbc.password}
driver-class-name: ${jdbc.driver-class-name} driver-class-name: ${jdbc.driver-class-name}
shzz: gxshzz:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: root username: root
...@@ -71,5 +71,3 @@ mybatis-plus: ...@@ -71,5 +71,3 @@ mybatis-plus:
db-config: db-config:
select-strategy: not_empty select-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
#logging.level.com.zq.drug.dao: debug
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment