mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
+4
-5
@@ -16,7 +16,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "未绑定账号,需要进行绑定");
|
||||
ErrorCode AUTH_TOKEN_EXPIRED = new ErrorCode(1_002_000_006, "Token 已经过期");
|
||||
ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_007, "手机号不存在");
|
||||
ErrorCode AUTH_LOGIN_FIRST_LOGIN = new ErrorCode(1_002_000_008, "请通过验证码登录");
|
||||
|
||||
// ========== 菜单模块 1-002-001-000 ==========
|
||||
ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "已经存在该名字的菜单");
|
||||
@@ -37,7 +36,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ROLE_NOT_SUPERADMIN_NO_ORGAN_ID_OPER_ERROR = new ErrorCode(1_002_002_007, "非超管分配权限");
|
||||
|
||||
// ========== 用户模块 1-002-003-000 ==========
|
||||
ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "用户账号已经存在");
|
||||
ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "手机号已经存在");
|
||||
ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "手机号已经存在");
|
||||
ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "邮箱已经存在");
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "用户不存在");
|
||||
@@ -102,7 +101,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 短信发送 1-002-013-000 ==========
|
||||
ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1_002_013_000, "手机号不存在");
|
||||
ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "模板参数({})缺失");
|
||||
ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "短信模板参数({})缺失");
|
||||
ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "短信模板不存在");
|
||||
|
||||
// ========== 短信验证码 1-002-014-000 ==========
|
||||
@@ -177,7 +176,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MAIL_TEMPLATE_CODE_EXISTS = new ErrorCode(1_002_024_001, "邮件模版 code({}) 已存在");
|
||||
|
||||
// ========== 邮件发送 1-002-025-000 ==========
|
||||
ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_025_000, "模板参数({})缺失");
|
||||
ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_025_000, "邮件模板参数({})缺失");
|
||||
ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1_002_025_001, "邮箱不存在");
|
||||
|
||||
// ========== 站内信模版 1-002-026-000 ==========
|
||||
@@ -187,7 +186,7 @@ public interface ErrorCodeConstants {
|
||||
// ========== 站内信模版 1-002-027-000 ==========
|
||||
|
||||
// ========== 站内信发送 1-002-028-000 ==========
|
||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "站内信模板参数({})缺失");
|
||||
|
||||
|
||||
//=========== 工序信息 1-002-027-000 ============
|
||||
|
||||
+1
-10
@@ -30,6 +30,7 @@ public class AuthLoginReqVO {
|
||||
|
||||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "buzhidao")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "组织名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰科技")
|
||||
@@ -42,10 +43,6 @@ public class AuthLoginReqVO {
|
||||
@NotEmpty(message = "验证码不能为空", groups = CodeEnableGroup.class)
|
||||
private String captchaVerification;
|
||||
|
||||
@Schema(description = "短信验证码", example = "123456")
|
||||
@Length(min = 6, max = 6, message = "短信验证码长度为 6 位")
|
||||
private String smsCaptchaVerification;
|
||||
|
||||
// ========== 绑定社交登录时,需要传递如下参数 ==========
|
||||
|
||||
@Schema(description = "社交平台的类型,参见 SocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@@ -72,10 +69,4 @@ public class AuthLoginReqVO {
|
||||
public boolean isSocialState() {
|
||||
return socialType == null || StringUtils.isNotEmpty(socialState);
|
||||
}
|
||||
|
||||
@AssertTrue(message = "请输入密码后登陆")
|
||||
public boolean isPasswordValid() {
|
||||
// 要么是密码登录、要么是验证码登录
|
||||
return ObjectUtil.isNotNull(password) || ObjectUtil.isNotNull(smsCaptchaVerification);
|
||||
}
|
||||
}
|
||||
|
||||
-11
@@ -94,7 +94,6 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
public AdminUserDO authenticate(AuthLoginReqVO reqVO) {
|
||||
String username = reqVO.getUsername();
|
||||
String password = reqVO.getPassword();
|
||||
String smsCaptchaVerification = reqVO.getSmsCaptchaVerification();
|
||||
final LoginLogTypeEnum logTypeEnum = LoginLogTypeEnum.LOGIN_USERNAME;
|
||||
// 查询账号
|
||||
AdminUserDO user = userService.getUserUniqueByUserName(username);
|
||||
@@ -116,11 +115,6 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.USER_DISABLED);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_USER_DISABLED);
|
||||
}
|
||||
// 校验没有密码并且没有传验证码,告诉前端需要验证码登录
|
||||
if (StringUtils.isEmpty(userPassword) && StringUtils.isEmpty(smsCaptchaVerification)) {
|
||||
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.FIRST_LOGIN);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_FIRST_LOGIN);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -144,11 +138,6 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
if (StringUtils.isBlank(dataSourceCode)) {
|
||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
}
|
||||
// 验证并消耗验证码
|
||||
String smsCaptchaVerification = reqVO.getSmsCaptchaVerification();
|
||||
if (StringUtils.isNotEmpty(smsCaptchaVerification)) {
|
||||
smsCodeService.useSmsCode(SmsCodeUseReqDTO.builder().mobile(user.getUsername()).code(smsCaptchaVerification).scene(SmsSceneEnum.USER_LOGIN_CAPTCHAVERIFICATION.getScene()).build());
|
||||
}
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return createTokenAfterLoginSuccess(user.getId(), reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME,organ.getLarge(), dataSourceCode, user.getOrganId(), user.getNickname());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user