mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-22 05:18:59 +08:00
update 优化 使用 record 简化实体类编码
This commit is contained in:
@@ -33,7 +33,6 @@ import org.dromara.system.domain.vo.SysClientVo;
|
||||
import org.dromara.system.service.ISysClientService;
|
||||
import org.dromara.system.service.ISysConfigService;
|
||||
import org.dromara.system.service.ISysSocialService;
|
||||
import org.dromara.web.domain.vo.LoginTenantVo;
|
||||
import org.dromara.web.domain.vo.LoginVo;
|
||||
import org.dromara.web.service.IAuthStrategy;
|
||||
import org.dromara.web.service.SysLoginService;
|
||||
@@ -94,9 +93,10 @@ public class AuthController {
|
||||
|
||||
Long userId = LoginHelper.getUserId();
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
SseMessageDTO dto = new SseMessageDTO();
|
||||
dto.setMessage(DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统");
|
||||
dto.setUserIds(List.of(userId));
|
||||
SseMessageDTO dto = new SseMessageDTO(
|
||||
List.of(userId),
|
||||
DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统"
|
||||
);
|
||||
SseMessageUtils.publishMessage(dto);
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
return R.ok(loginVo);
|
||||
@@ -194,9 +194,14 @@ public class AuthController {
|
||||
@GetMapping("/tenant/list")
|
||||
public R<LoginTenantVo> tenantList(HttpServletRequest request) throws Exception {
|
||||
// 暂时预留给前端使用 后续删除
|
||||
LoginTenantVo result = new LoginTenantVo();
|
||||
result.setTenantEnabled(false);
|
||||
return R.ok(result);
|
||||
return R.ok(new LoginTenantVo(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录租户列表响应对象。
|
||||
*
|
||||
* @param tenantEnabled 是否启用租户
|
||||
*/
|
||||
public record LoginTenantVo(Boolean tenantEnabled) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.dromara.common.web.config.properties.CaptchaProperties;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.web.domain.vo.CaptchaVo;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
@@ -119,9 +118,7 @@ public class CaptchaController {
|
||||
public R<CaptchaVo> getCode() {
|
||||
boolean captchaEnabled = captchaProperties.getEnable();
|
||||
if (!captchaEnabled) {
|
||||
CaptchaVo captchaVo = new CaptchaVo();
|
||||
captchaVo.setCaptchaEnabled(false);
|
||||
return R.ok(captchaVo);
|
||||
return R.ok(new CaptchaVo(false, null, null));
|
||||
}
|
||||
return R.ok(SpringUtils.getAopProxy(this).getCodeImpl());
|
||||
}
|
||||
@@ -157,10 +154,17 @@ public class CaptchaController {
|
||||
code = exp.getValue(String.class);
|
||||
}
|
||||
RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
|
||||
CaptchaVo captchaVo = new CaptchaVo();
|
||||
captchaVo.setUuid(uuid);
|
||||
captchaVo.setImg(captcha.getImageBase64());
|
||||
return captchaVo;
|
||||
return new CaptchaVo(true, uuid, captcha.getImageBase64());
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片验证码响应对象。
|
||||
*
|
||||
* @param captchaEnabled 是否启用验证码
|
||||
* @param uuid 验证码标识
|
||||
* @param img Base64 图片数据
|
||||
*/
|
||||
public record CaptchaVo(Boolean captchaEnabled, String uuid, String img) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package org.dromara.web.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 验证码信息
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Data
|
||||
public class CaptchaVo {
|
||||
|
||||
/**
|
||||
* 是否开启验证码
|
||||
*/
|
||||
private Boolean captchaEnabled = true;
|
||||
|
||||
/**
|
||||
* 验证码唯一标识。
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 验证码图片
|
||||
*/
|
||||
private String img;
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.dromara.web.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 登录页租户信息返回对象。
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Data
|
||||
public class LoginTenantVo {
|
||||
|
||||
/**
|
||||
* 租户开关
|
||||
*/
|
||||
private Boolean tenantEnabled;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user