|
@@ -454,44 +454,50 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public AuthZentaoLoginRespVO zentaoSsoToken(AuthSocialLoginReqVO reqVO) {
|
|
|
|
|
|
|
+ public AuthZentaoLoginRespVO zentaoSsoToken(AuthOaLoginReqVO reqVO) {
|
|
|
AuthZentaoLoginRespVO respVO = new AuthZentaoLoginRespVO();
|
|
AuthZentaoLoginRespVO respVO = new AuthZentaoLoginRespVO();
|
|
|
- respVO.setCode(zentaoCode);
|
|
|
|
|
- LocalDateTime currentDate = LocalDateTime.now();
|
|
|
|
|
- Long currentDateMilli = LocalDateTimeUtil.toEpochMilli(currentDate);
|
|
|
|
|
- respVO.setTimestamp(currentDateMilli);
|
|
|
|
|
- // 跳转链接 http://project.deepoil.cc/zentao/api.php?m=user&f=apilogin&account=0033777&code=Deep0ilPortal&time=1775199774917&token=43f484e18659a1898cded87e6fd8e40c
|
|
|
|
|
- // md5 加密 code+应用密钥+时间戳 得到 token
|
|
|
|
|
- String token = SecureUtil.md5(zentaoCode + zentaoSecret + currentDateMilli);
|
|
|
|
|
- respVO.setToken(token);
|
|
|
|
|
- // h5页面获取免登录授权码code 后台通过code查询用户信息
|
|
|
|
|
- String validCode = StrUtils.xssEncode(reqVO.getCode());
|
|
|
|
|
try {
|
|
try {
|
|
|
- // 钉钉用户id
|
|
|
|
|
- String userId = DingtalkUtil.getUserIdByAuthCode(validCode);
|
|
|
|
|
- if (StrUtil.isBlank(userId)) {
|
|
|
|
|
- // 查询不到用户详情 返回 登录失败
|
|
|
|
|
|
|
+ respVO.setCode(zentaoCode);
|
|
|
|
|
+ LocalDateTime currentDate = LocalDateTime.now();
|
|
|
|
|
+ Long currentDateMilli = LocalDateTimeUtil.toEpochMilli(currentDate);
|
|
|
|
|
+ respVO.setTimestamp(currentDateMilli);
|
|
|
|
|
+ // 跳转链接 http://project.deepoil.cc/zentao/api.php?m=user&f=apilogin&account=0033777&code=Deep0ilPortal&time=1775199774917&token=43f484e18659a1898cded87e6fd8e40c
|
|
|
|
|
+ // md5 加密 code+应用密钥+时间戳 得到 token
|
|
|
|
|
+ String token = SecureUtil.md5(zentaoCode + zentaoSecret + currentDateMilli);
|
|
|
|
|
+ respVO.setToken(token);
|
|
|
|
|
+ // h5页面获取免登录授权码code 后台通过code查询用户信息
|
|
|
|
|
+ // String validCode = StrUtils.xssEncode(reqVO.getCode());
|
|
|
|
|
+ // 根据工号查询用户是否存在
|
|
|
|
|
+ AdminUserDO user = userService.getUserByUsername(reqVO.getUsername());
|
|
|
|
|
+ if (ObjUtil.isEmpty(user)) {
|
|
|
throw exception(USER_NOT_EXISTS);
|
|
throw exception(USER_NOT_EXISTS);
|
|
|
}
|
|
}
|
|
|
|
|
+ respVO.setJobNumber(user.getUsername());
|
|
|
|
|
+ // 钉钉用户id
|
|
|
|
|
+ // String userId = DingtalkUtil.getUserIdByAuthCode(validCode);
|
|
|
|
|
+ // if (StrUtil.isBlank(userId)) {
|
|
|
|
|
+ // 查询不到用户详情 返回 登录失败
|
|
|
|
|
+ // throw exception(USER_NOT_EXISTS);
|
|
|
|
|
+ // }
|
|
|
// 根据钉钉用户id 查询用户详情
|
|
// 根据钉钉用户id 查询用户详情
|
|
|
- OapiV2UserGetResponse.UserGetResponse userDetail = DingtalkUtil.getUserDetail(userId);
|
|
|
|
|
- if (ObjUtil.isEmpty(userDetail)) {
|
|
|
|
|
|
|
+ // OapiV2UserGetResponse.UserGetResponse userDetail = DingtalkUtil.getUserDetail(userId);
|
|
|
|
|
+ // if (ObjUtil.isEmpty(userDetail)) {
|
|
|
// 查询不到用户详情 返回 登录失败
|
|
// 查询不到用户详情 返回 登录失败
|
|
|
- throw exception(USER_NOT_EXISTS);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // throw exception(USER_NOT_EXISTS);
|
|
|
|
|
+ // }
|
|
|
// 工号
|
|
// 工号
|
|
|
- String jobNumber = userDetail.getJobNumber();
|
|
|
|
|
- respVO.setJobNumber(jobNumber);
|
|
|
|
|
|
|
+ // String jobNumber = userDetail.getJobNumber();
|
|
|
|
|
+ // respVO.setJobNumber(jobNumber);
|
|
|
// 手机号
|
|
// 手机号
|
|
|
- String mobile = userDetail.getMobile();
|
|
|
|
|
- if (StrUtil.isBlank(mobile)) {
|
|
|
|
|
- throw exception(USER_NOT_EXISTS);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // String mobile = userDetail.getMobile();
|
|
|
|
|
+ // if (StrUtil.isBlank(mobile)) {
|
|
|
|
|
+ // throw exception(USER_NOT_EXISTS);
|
|
|
|
|
+ // }
|
|
|
// 查询当前用户表中 此手机号 是否存在
|
|
// 查询当前用户表中 此手机号 是否存在
|
|
|
- AdminUserDO user = userService.getUserByMobile(mobile);
|
|
|
|
|
- if (ObjUtil.isEmpty(user)) {
|
|
|
|
|
- throw exception(USER_NOT_EXISTS);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // AdminUserDO user = userService.getUserByMobile(mobile);
|
|
|
|
|
+ // if (ObjUtil.isEmpty(user)) {
|
|
|
|
|
+ // throw exception(USER_NOT_EXISTS);
|
|
|
|
|
+ // }
|
|
|
return respVO;
|
|
return respVO;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
// 调用钉钉接口报错 提示 登录失败
|
|
// 调用钉钉接口报错 提示 登录失败
|