mirror of https://gitee.com/stylefeng/roses
【7.1.6】新增运维平台检测用户接口
parent
8463b0ef26
commit
71a920ada8
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||
*/
|
||||
package cn.stylefeng.roses.kernel.system.api.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 运维平台检测状态
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/23 21:30
|
||||
*/
|
||||
@Getter
|
||||
public enum DevopsCheckStatusEnum {
|
||||
|
||||
/**
|
||||
* 用户不存在
|
||||
*/
|
||||
USER_NOT_EXIST(0),
|
||||
|
||||
/**
|
||||
* 账号密码错误
|
||||
*/
|
||||
ACCOUNT_PASSWORD_ERROR(1),
|
||||
|
||||
/**
|
||||
* 请求方未打开开关
|
||||
*/
|
||||
REQUESTER_NOT_OPEN_SWITCH(2),
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESSFUL(999);
|
||||
|
||||
private final Integer code;
|
||||
|
||||
DevopsCheckStatusEnum(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
|
@ -268,6 +268,19 @@ public class SysUserController {
|
|||
return new SuccessResponseData<>(sysUserService.getAllUserIdList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运维平台接口检测
|
||||
*
|
||||
* @return {@link PageResult< Integer>}
|
||||
* @author majianguo
|
||||
* @date 2022/1/27 14:29
|
||||
**/
|
||||
@GetResource(name = "运维平台接口检测", path = "/sysUser/devopsApiCheck")
|
||||
public ResponseData<Integer> devopsApiCheck(SysUserRequest sysUserRequest) {
|
||||
return new SuccessResponseData<>(sysUserService.devopsApiCheck(sysUserRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户主键获取用户对应的token
|
||||
*
|
||||
|
|
|
@ -263,4 +263,13 @@ public interface SysUserService extends IService<SysUser>, UserServiceApi {
|
|||
* @date 2022/1/17 15:05
|
||||
**/
|
||||
String getTokenByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 运维平台接口检测
|
||||
*
|
||||
* @return {@link Integer}
|
||||
* @author majianguo
|
||||
* @date 2022/1/27 14:29
|
||||
**/
|
||||
Integer devopsApiCheck(SysUserRequest sysUserRequest);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ import cn.stylefeng.roses.kernel.system.api.DataScopeApi;
|
|||
import cn.stylefeng.roses.kernel.system.api.OrganizationServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.api.ResourceServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.api.RoleServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.api.enums.DevopsCheckStatusEnum;
|
||||
import cn.stylefeng.roses.kernel.system.api.enums.UserStatusEnum;
|
||||
import cn.stylefeng.roses.kernel.system.api.exception.SystemModularException;
|
||||
import cn.stylefeng.roses.kernel.system.api.exception.enums.user.SysUserExceptionEnum;
|
||||
|
@ -642,6 +643,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
return jwtToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer devopsApiCheck(SysUserRequest sysUserRequest) {
|
||||
String account = sysUserRequest.getAccount();
|
||||
String password = sysUserRequest.getPassword();
|
||||
SysUser sysUser = this.getUserByAccount(account);
|
||||
if (ObjectUtil.isEmpty(sysUser)) {
|
||||
return DevopsCheckStatusEnum.USER_NOT_EXIST.getCode();
|
||||
} else if (!passwordStoredEncryptApi.checkPassword(password, sysUser.getPassword())) {
|
||||
return DevopsCheckStatusEnum.ACCOUNT_PASSWORD_ERROR.getCode();
|
||||
} else if (!SystemConfigExpander.getDevSwitchStatus()) {
|
||||
return DevopsCheckStatusEnum.REQUESTER_NOT_OPEN_SWITCH.getCode();
|
||||
}
|
||||
return DevopsCheckStatusEnum.SUCCESSFUL.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserLoginInfoDTO getUserLoginInfo(String account) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue