Commit b880f187 by 袁伟铭

用户模块添加多数据源

parent 670439a5
......@@ -25,6 +25,8 @@ public enum ApiCodeEnum {
CHECK_SIGN_VALID_ERROR("108", "签名校验失败"),
SERVICE_NOT_AVAILABLE("109", "服务不可用"),
BUSINESS_ERROR("400", "业务处理失败"),
SERVER_ERROR("500", "服务器繁忙"),
......
......@@ -89,6 +89,8 @@ public class ApiController {
// 判断指定异常是否来自或者包含指定异常
if (ExceptionUtil.isFromOrSuppressedThrowable(e, FeignException.Unauthorized.class)) {
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 {
resp = ApiUtils.getMethodHandlerError(form);
}
......
......@@ -144,6 +144,17 @@ public class ApiUtils {
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) {
ApiResp apiResp = new ApiResp(form);
if (resultVo.isSuccess()) {
......
......@@ -59,7 +59,7 @@ spring:
username: root
password: rooT123!321
driver-class-name: com.mysql.cj.jdbc.Driver
shzz:
gxshzz:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
......
......@@ -33,7 +33,7 @@ spring:
username: ${jdbc.username}
password: ${jdbc.password}
driver-class-name: ${jdbc.driver-class-name}
shzz:
gxshzz:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
......@@ -71,5 +71,3 @@ mybatis-plus:
db-config:
select-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