Procházet zdrojové kódy

禅道接入门户 修改接口传参

zhangcl před 1 týdnem
rodič
revize
236cd74c48

+ 1 - 1
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java

@@ -208,7 +208,7 @@ public class AuthController {
     @PostMapping("/zentaoSsoToken")
     @PermitAll
     @Operation(summary = "根据当前登录人工号 获取随机验证码", description = "快捷登录 禅道")
-    public CommonResult<AuthZentaoLoginRespVO> zentaoSsoToken(@RequestBody @Valid AuthSocialLoginReqVO reqVO) {
+    public CommonResult<AuthZentaoLoginRespVO> zentaoSsoToken(@RequestBody @Valid AuthOaLoginReqVO reqVO) {
         return success(authService.zentaoSsoToken(reqVO));
     }
 

+ 1 - 1
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java

@@ -119,5 +119,5 @@ public interface AdminAuthService {
      *
      * @param reqVO 验证码信息
      */
-    AuthZentaoLoginRespVO zentaoSsoToken(AuthSocialLoginReqVO reqVO);
+    AuthZentaoLoginRespVO zentaoSsoToken(AuthOaLoginReqVO reqVO);
 }

+ 35 - 29
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java

@@ -454,44 +454,50 @@ public class AdminAuthServiceImpl implements AdminAuthService {
     }
 
     @Override
-    public AuthZentaoLoginRespVO zentaoSsoToken(AuthSocialLoginReqVO reqVO) {
+    public AuthZentaoLoginRespVO zentaoSsoToken(AuthOaLoginReqVO reqVO) {
         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 {
-            // 钉钉用户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);
             }
+            respVO.setJobNumber(user.getUsername());
+            // 钉钉用户id
+            // String userId = DingtalkUtil.getUserIdByAuthCode(validCode);
+            // if (StrUtil.isBlank(userId)) {
+                // 查询不到用户详情 返回 登录失败
+                // throw exception(USER_NOT_EXISTS);
+            // }
             // 根据钉钉用户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;
         } catch (Exception e) {
             // 调用钉钉接口报错 提示 登录失败