登录
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
package com.cool.store.config;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.mapper.SysRoleMapper;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.context.DataSourceContext;
|
||||
import com.cool.store.service.context.UserContext;
|
||||
import com.cool.store.service.utils.DataSourceHelper;
|
||||
import com.cool.store.context.UserContext;
|
||||
import com.cool.store.utils.DataSourceHelper;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.service.context.CurrentUser;
|
||||
import com.cool.store.context.CurrentUser;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.config.datasource;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.service.context.DataSourceContext;
|
||||
import com.cool.store.context.DataSourceContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.cool.store.config.datasource;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dto.DatasourceInfoDTO;
|
||||
import com.cool.store.entity.EnterpriseConfigDO;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.service.EnterpriseConfigService;
|
||||
import com.cool.store.service.context.DataSourceContext;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.context.DataSourceContext;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
|
||||
@@ -3,10 +3,15 @@ package com.cool.store.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.login.FeiShuLoginDTO;
|
||||
import com.cool.store.enums.AppTypeEnum;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.google.protobuf.ServiceException;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.http.ISVHttpRequest;
|
||||
import com.cool.store.service.LoginService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -21,45 +26,37 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Slf4j
|
||||
public class LoginController {
|
||||
|
||||
/*@PostMapping(value = "/v3/feiShuLogin")
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
@Autowired
|
||||
private ISVHttpRequest isvHttpRequest;
|
||||
|
||||
|
||||
@PostMapping(value = "/v3/feiShuLogin")
|
||||
public Object feiShuLogin(@RequestBody FeiShuLoginDTO param) {
|
||||
log.info("isvLoginV2 data={}", JSONObject.toJSONString(param));
|
||||
log.info("feiShuLogin data={}", JSONObject.toJSONString(param));
|
||||
String code = param.getCode();
|
||||
String appId = param.getAppId();
|
||||
|
||||
String userId = "", corpId = "", appType = AppTypeEnum.FEI_SHU.getValue();
|
||||
try {
|
||||
String value = "code=" + code + "&appType=" + appType + "&appId=" + appId;
|
||||
log.info("url:{}", ding_token_userId + value);
|
||||
JSONObject userInfo = JSON.parseObject(HttpRequest.sendGet(ding_token_userId, value));
|
||||
logger.info("userInfo:{}", JSONObject.toJSONString(userInfo));
|
||||
//todo zcb
|
||||
JSONObject userInfo = isvHttpRequest.getUserIdByCode(value);
|
||||
log.info("userInfo:{}", JSONObject.toJSONString(userInfo));
|
||||
userId = userInfo.getString("openId");
|
||||
corpId = userInfo.getString("corpId");
|
||||
String errorCode = userInfo.getString("error_code");
|
||||
if (StringUtils.isBlank(userId) && StringUtils.isNotBlank(errorCode)) {
|
||||
DingLoginErrorEnum dingLoginErrorEnum = DingLoginErrorEnum.getByCode(Integer.getInteger(errorCode));
|
||||
if (dingLoginErrorEnum != null) {
|
||||
throw new ServiceException(dingLoginErrorEnum.getCode(), dingLoginErrorEnum.getMsg());
|
||||
}
|
||||
throw new ServiceException(ErrorCodeEnum.LOGIN_ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
if (e instanceof ServiceException) {
|
||||
throw e;
|
||||
} else {
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR.getCode(), "用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return loginService.isvLogin(userId, corpId, Boolean.TRUE, appType, StringUtils.EMPTY);
|
||||
return loginService.feiShuLogin(userId, corpId, Boolean.TRUE, appType, StringUtils.EMPTY);
|
||||
} catch (ServiceException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ServiceException(e.getErrorCode(), e.getErrorMessage());
|
||||
throw new ServiceException(ErrorCodeEnum.LOGIN_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR.getCode(), "登陆失败");
|
||||
throw new ServiceException(ErrorCodeEnum.LOGIN_ERROR);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,3 +35,6 @@ mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://tzk.coolcollege.cn:2188
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://tstore-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
|
||||
@@ -38,4 +38,7 @@ mybatis.configuration.call-setters-on-nulls=true
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://dzk.coolcollege.cn:2188
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://dstore-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
@@ -34,4 +34,7 @@ mybatis.configuration.call-setters-on-nulls=true
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://10.7.53.199:2188
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://hdstore-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
@@ -41,4 +41,7 @@ mybatis.configuration.call-setters-on-nulls=true
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://localhost:2181
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://tstore-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
@@ -34,4 +34,7 @@ mybatis.configuration.call-setters-on-nulls=true
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://10.6.49.221:2188,10.6.49.222:2188,10.6.49.223:2188
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://store-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
@@ -34,4 +34,7 @@ mybatis.configuration.call-setters-on-nulls=true
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://10.7.54.149:2188
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://store-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
@@ -34,4 +34,7 @@ mybatis.configuration.call-setters-on-nulls=true
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
com.alipay.sofa.rpc.registry.address=zookeeper://tzk.coolcollege.cn:2188
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
com.alipay.sofa.rpc.bolt.port=31010
|
||||
|
||||
isv.domain = https://tstore-isv.coolcollege.cn
|
||||
get.user.id.by.code = /isv/v2/get_user_id_by_code
|
||||
Reference in New Issue
Block a user