v3.14.0 更新;【新增】EasyExcel重磅升级为FastExcel;【新增】使用最强Argon2算法作为密码存储;【新增】大家吐槽的数据字典改为可重复;【新增】前端布局再增加多种样式;【优化】升级SaToken到最新版本;【优化】token使用Sa-Token的Bearer类型;【优化】优化其他

This commit is contained in:
zhuoda
2025-03-12 20:17:39 +08:00
parent 5553aac514
commit eeb9c569de
147 changed files with 7035 additions and 1565 deletions

View File

@@ -34,10 +34,11 @@
<commons-io.version>2.15.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-collections4.version>4.4</commons-collections4.version>
<commons-compress.version>1.26.0</commons-compress.version>
<commons-codec.version>1.13</commons-codec.version>
<commons-text.version>1.9</commons-text.version>
<xerces.version>2.12.0</xerces.version>
<easy-excel.version>3.3.2</easy-excel.version>
<fast-excel.version>1.0.0</fast-excel.version>
<poi.version>5.2.4</poi.version>
<ooxml-schemas.version>1.4</ooxml-schemas.version>
<aws-java-sdk.version>1.11.842</aws-java-sdk.version>
@@ -164,6 +165,12 @@
<version>${commons-collections4.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>${commons-compress.version}</version>
</dependency>
<dependency>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
@@ -248,13 +255,13 @@
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easy-excel.version}</version>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>${fast-excel.version}</version>
<exclusions>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
</exclusions>
</dependency>

View File

@@ -2,8 +2,8 @@ package net.lab1024.sa.admin.interceptor;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.strategy.SaStrategy;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
@@ -14,14 +14,9 @@ import net.lab1024.sa.admin.module.system.login.service.LoginService;
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
import net.lab1024.sa.base.common.code.SystemErrorCode;
import net.lab1024.sa.base.common.code.UserErrorCode;
import net.lab1024.sa.base.common.constant.StringConst;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.SystemEnvironment;
import net.lab1024.sa.base.common.enumeration.SystemEnvironmentEnum;
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
import net.lab1024.sa.base.common.util.SmartRequestUtil;
import net.lab1024.sa.base.common.util.SmartResponseUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@@ -47,9 +42,6 @@ public class AdminInterceptor implements HandlerInterceptor {
@Resource
private LoginService loginService;
@Resource
private SystemEnvironment systemEnvironment;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
@@ -68,17 +60,7 @@ public class AdminInterceptor implements HandlerInterceptor {
// --------------- 第一步: 根据token 获取用户 ---------------
String tokenValue = StpUtil.getTokenValue();
boolean debugNumberTokenFlag = isDevDebugNumberToken(tokenValue);
String loginId = null;
if (debugNumberTokenFlag) {
//开发、测试环境,且为数字的话,则表明为 调试临时用户,即需要调用 sa-token switch
loginId = UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + tokenValue;
StpUtil.switchTo(loginId);
} else {
loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
}
String loginId = (String) StpUtil.getLoginIdByToken(tokenValue);
RequestEmployee requestEmployee = loginService.getLoginEmployee(loginId, request);
// --------------- 第二步: 校验 登录 ---------------
@@ -86,7 +68,7 @@ public class AdminInterceptor implements HandlerInterceptor {
Method method = ((HandlerMethod) handler).getMethod();
NoNeedLogin noNeedLogin = ((HandlerMethod) handler).getMethodAnnotation(NoNeedLogin.class);
if (noNeedLogin != null) {
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
checkActiveTimeout(requestEmployee);
return true;
}
@@ -96,7 +78,7 @@ public class AdminInterceptor implements HandlerInterceptor {
}
// 检测token 活跃频率
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
checkActiveTimeout(requestEmployee);
// --------------- 第三步: 校验 权限 ---------------
@@ -143,12 +125,7 @@ public class AdminInterceptor implements HandlerInterceptor {
/**
* 检测token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结
*/
private void checkActiveTimeout(RequestEmployee requestEmployee, boolean debugNumberTokenFlag) {
// 对于开发环境的 数字 debug token ,不需要检测活跃有效期
if (debugNumberTokenFlag) {
return;
}
private void checkActiveTimeout(RequestEmployee requestEmployee) {
// 用户不在线,也不用检测
if (requestEmployee == null) {
@@ -160,28 +137,11 @@ public class AdminInterceptor implements HandlerInterceptor {
}
/**
* 是否为开发使用的 debug token
*
* @param token
* @return
*/
private boolean isDevDebugNumberToken(String token) {
if (!StrUtil.isNumeric(token)) {
return false;
}
return systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV
|| systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.TEST;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// 清除上下文
SmartRequestUtil.remove();
// 开发环境,关闭 sa token 的临时切换用户
if (systemEnvironment.getCurrentEnvironment() == SystemEnvironmentEnum.DEV) {
StpUtil.endSwitch();
}
}

View File

@@ -1,6 +1,6 @@
package net.lab1024.sa.admin.module.business.goods.domain.form;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;

View File

@@ -1,6 +1,7 @@
package net.lab1024.sa.admin.module.business.goods.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

View File

@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
import net.lab1024.sa.base.common.json.serializer.DictValueVoSerializer;
import net.lab1024.sa.base.common.swagger.SchemaEnum;
import java.math.BigDecimal;
@@ -32,7 +31,6 @@ public class GoodsVO {
private Integer goodsStatus;
@Schema(description = "产地")
@JsonSerialize(using = DictValueVoSerializer.class)
private String place;
@Schema(description = "商品价格")

View File

@@ -1,6 +1,6 @@
package net.lab1024.sa.admin.module.business.goods.service;
import com.alibaba.excel.EasyExcel;
import cn.idev.excel.FastExcel;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
@@ -174,7 +174,7 @@ public class GoodsService {
public ResponseDTO<String> importGoods(MultipartFile file) {
List<GoodsImportForm> dataList;
try {
dataList = EasyExcel.read(file.getInputStream()).head(GoodsImportForm.class)
dataList = FastExcel.read(file.getInputStream()).head(GoodsImportForm.class)
.sheet()
.doReadSync();
} catch (IOException e) {
@@ -194,12 +194,13 @@ public class GoodsService {
*/
public List<GoodsExcelVO> getAllGoods() {
List<GoodsEntity> goodsEntityList = goodsDao.selectList(null);
String keyCode="GODOS_PLACE";
return goodsEntityList.stream()
.map(e ->
GoodsExcelVO.builder()
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(code)).collect(Collectors.joining(",")))
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(keyCode,code)).collect(Collectors.joining(",")))
.price(e.getPrice())
.goodsName(e.getGoodsName())
.remark(e.getRemark())

View File

@@ -1,6 +1,6 @@
package net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelProperty;
import lombok.Data;
/**

View File

@@ -56,7 +56,6 @@ public class DataScopeViewService {
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
return this.getDepartmentAndSubEmployeeIdList(employeeId);
}
// 可以查看所有员工数据
return Lists.newArrayList();
}

View File

@@ -59,8 +59,8 @@ public class LoginController {
@Operation(summary = "退出登陆 @author 卓大")
@GetMapping("/login/logout")
public ResponseDTO<String> logout(@RequestHeader(value = RequestHeaderConst.TOKEN, required = false) String token) {
return loginService.logout(token, SmartRequestUtil.getRequestUser());
public ResponseDTO<String> logout() {
return loginService.logout(SmartRequestUtil.getRequestUser());
}
@Operation(summary = "获取验证码 @author 卓大")

View File

@@ -376,10 +376,10 @@ public class LoginService implements StpInterface {
/**
* 退出登录
*/
public ResponseDTO<String> logout(String token, RequestUser requestUser) {
public ResponseDTO<String> logout(RequestUser requestUser) {
// sa token 登出
StpUtil.logoutByTokenValue(token);
StpUtil.logout();
// 清空登录信息缓存
loginEmployeeCache.remove(requestUser.getUserId());

View File

@@ -19,9 +19,8 @@
<select id="selectMenuListByRoleIdList"
resultType="net.lab1024.sa.admin.module.system.menu.domain.entity.MenuEntity">
SELECT
t_menu.*
distinct t_menu.*
from t_menu
left join t_role_menu on t_role_menu.menu_id = t_menu.menu_id
<where>
@@ -35,8 +34,6 @@
</foreach>
</if>
</where>
group by t_menu.menu_id
ORDER BY t_menu.sort ASC
</select>
</mapper>

View File

@@ -177,6 +177,11 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
@@ -213,8 +218,14 @@
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>

View File

@@ -11,7 +11,7 @@ package net.lab1024.sa.base.common.constant;
*/
public class RequestHeaderConst {
public static final String TOKEN = "x-access-token";
public static final String TOKEN = "Authorization";
public static final String USER_AGENT = "user-agent";

View File

@@ -1,52 +0,0 @@
package net.lab1024.sa.base.common.json.serializer;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.google.common.collect.Lists;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.module.support.dict.domain.vo.DictValueVO;
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* 字典序列化
*
* @Author 1024创新实验室: 罗伊
* @Date 2022-08-12 22:17:53
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public class DictValueVoSerializer extends JsonSerializer<String> {
@Resource
private DictCacheService dictCacheService;
@Override
public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
if (StringUtils.isEmpty(value)) {
jsonGenerator.writeObject(Lists.newArrayList());
return;
}
String[] valueCodeArray = value.split(",");
List<String> valueCodeList = Arrays.asList(valueCodeArray);
List<DictValueVO> dictValueVOList = Lists.newArrayList();
valueCodeList.forEach(e->{
if(StringUtils.isNotBlank(e)){
DictValueVO dictValueVO = dictCacheService.selectValueByValueCode(e);
if(dictValueVO != null){
dictValueVOList.add(dictValueVO);
}
}
});
jsonGenerator.writeObject(dictValueVOList);
}
}

View File

@@ -1,9 +1,9 @@
package net.lab1024.sa.base.common.util;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import cn.idev.excel.FastExcel;
import cn.idev.excel.write.handler.SheetWriteHandler;
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
import cn.idev.excel.write.metadata.holder.WriteWorkbookHolder;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -43,7 +43,7 @@ public final class SmartExcelUtil {
// 设置下载消息头
SmartResponseUtil.setDownloadFileHeader(response, fileName, null);
// 下载
EasyExcel.write(response.getOutputStream(), head)
FastExcel.write(response.getOutputStream(), head)
.autoCloseStream(Boolean.FALSE)
.sheet(sheetName)
.doWrite(data);
@@ -58,7 +58,7 @@ public final class SmartExcelUtil {
// 水印
Watermark watermark = new Watermark(watermarkString);
// 一定要inMemory
EasyExcel.write(response.getOutputStream(), head)
FastExcel.write(response.getOutputStream(), head)
.inMemory(true)
.sheet(sheetName)
.registerWriteHandler(new CustomWaterMarkHandler(watermark))

View File

@@ -77,7 +77,7 @@ public class SwaggerConfig {
private Components components() {
return new Components()
.addSecuritySchemes(RequestHeaderConst.TOKEN, new SecurityScheme().type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER).name(RequestHeaderConst.TOKEN));
.addSecuritySchemes(RequestHeaderConst.TOKEN, new SecurityScheme().scheme("Bearer").description("请输入token,格式为[Bearer xxxxxxxx]").type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER).name(RequestHeaderConst.TOKEN));
}
@Bean

View File

@@ -18,5 +18,5 @@ import java.lang.annotation.Target;
@Target(ElementType.FIELD)
public @interface DataTracerFieldDict {
String keyCode() default "";
}

View File

@@ -303,7 +303,7 @@ public class DataTracerChangeContentService {
fieldContent = SmartEnumUtil.getEnumDescByValue(fieldValue, dataTracerFieldEnum.enumClass());
}
} else if (dataTracerFieldDict != null) {
fieldContent = dictCacheService.selectValueNameByValueCodeSplit(fieldValue.toString());
fieldContent = dictCacheService.selectValueNameByValueCodeSplit(dataTracerFieldDict.keyCode(), fieldValue.toString());
} else if (dataTracerFieldSql != null) {
fieldContent = this.getRelateDisplayValue(fieldValue, dataTracerFieldSql);
} else if (fieldValue instanceof Date) {

View File

@@ -52,5 +52,5 @@ public interface DictValueDao extends BaseMapper<DictValueEntity> {
* 跟进code查询
*
*/
DictValueEntity selectByCode(@Param("valueCode") String valueCode, @Param("deletedFlag") Boolean deletedFlag);
DictValueEntity selectByCode(@Param("dictKeyId") Long dictKeyId,@Param("valueCode") String valueCode, @Param("deletedFlag") Boolean deletedFlag);
}

View File

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@@ -41,8 +42,6 @@ public class DictCacheService {
private ConcurrentHashMap<String, List<DictValueVO>> DICT_CACHE = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, DictValueVO> VALUE_CACHE = new ConcurrentHashMap<>();
@PostConstruct
public void dictCache() {
@@ -63,10 +62,6 @@ public class DictCacheService {
Long dictKeyId = dictKeyEntity.getDictKeyId();
DICT_CACHE.put(keyCode, valueListMap.getOrDefault(dictKeyId, Lists.newArrayList()));
}
//字典值缓存
dictValueVOList.forEach(e -> {
VALUE_CACHE.put(e.getValueCode(), e);
});
log.info("################# 数据字典缓存初始化完毕 ###################");
}
@@ -75,7 +70,6 @@ public class DictCacheService {
*/
public ResponseDTO<String> cacheRefresh() {
DICT_CACHE.clear();
VALUE_CACHE.clear();
this.cacheInit();
return ResponseDTO.ok();
}
@@ -92,37 +86,45 @@ public class DictCacheService {
/**
* 查询值code名称
*
* @param keyCode
* @param valueCode
* @return
*/
public String selectValueNameByValueCode(String valueCode) {
if (StrUtil.isEmpty(valueCode)) {
return null;
}
DictValueVO dictValueVO = VALUE_CACHE.get(valueCode);
if (dictValueVO == null) {
public String selectValueNameByValueCode(String keyCode, String valueCode) {
DictValueVO dictValueVO = this.selectValueByValueCode(keyCode, valueCode);
if (dictValueVO == null){
return "";
}
return dictValueVO.getValueName();
return dictValueVO.getValueName()
;
}
public DictValueVO selectValueByValueCode(String valueCode) {
public DictValueVO selectValueByValueCode(String keyCode, String valueCode) {
if (StrUtil.isEmpty(valueCode)) {
return null;
}
return VALUE_CACHE.get(valueCode);
}
if (StrUtil.isEmpty(keyCode)) {
return null;
}
public String selectValueNameByValueCodeSplit(String valueCodes) {
List<DictValueVO> dictValueVOList = DICT_CACHE.get(valueCode);
if (CollectionUtils.isEmpty(dictValueVOList)) {
return null;
}
Optional<DictValueVO> option = dictValueVOList.stream().filter(e->e.getValueCode().equals(valueCode)).findFirst();
if(option.isPresent()){
return option.get();
}
return null;
}
public String selectValueNameByValueCodeSplit(String keyCode, String valueCodes) {
if (StrUtil.isEmpty(valueCodes)) {
return "";
}
List<String> valueNameList = Lists.newArrayList();
String[] valueCodeArray = valueCodes.split(",");
for (String valueCode : valueCodeArray) {
DictValueVO dictValueVO = VALUE_CACHE.get(valueCode);
DictValueVO dictValueVO = this.selectValueByValueCode(keyCode, valueCode);
if (dictValueVO != null) {
valueNameList.add(dictValueVO.getValueName());
}
@@ -130,4 +132,4 @@ public class DictCacheService {
return StringUtils.join(valueNameList, ",");
}
}
}

View File

@@ -66,7 +66,7 @@ public class DictService {
* @return
*/
public synchronized ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getValueCode(), false);
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getDictKeyId(),valueAddForm.getValueCode(), false);
if (dictValueEntity != null) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
@@ -106,7 +106,7 @@ public class DictService {
if (dictKeyEntity == null || dictKeyEntity.getDeletedFlag()) {
return ResponseDTO.userErrorParam("key不能存在");
}
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getValueCode(), false);
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getDictKeyId(),valueUpdateForm.getValueCode(), false);
if (dictValueEntity != null && !dictValueEntity.getDictValueId().equals(valueUpdateForm.getDictValueId())) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}

View File

@@ -1,5 +1,6 @@
package net.lab1024.sa.base.module.support.securityprotect.service;
import lombok.extern.slf4j.Slf4j;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.apache.tika.config.TikaConfig;
@@ -17,7 +18,7 @@ import java.util.Arrays;
import java.util.List;
/**
* 三级等保 文件上传 相关
* 三级等保 文件 相关
*
* @Author 1024创新实验室-主任:卓大
* @Date 2024/08/22 19:25:59
@@ -27,6 +28,7 @@ import java.util.List;
*/
@Service
@Slf4j
public class SecurityFileService {
@Resource
@@ -96,6 +98,7 @@ public class SecurityFileService {
MediaType mimetype = tika.getDetector().detect(stream, metadata);
return mimetype.toString();
} catch (IOException | TikaException e) {
log.error(e.getMessage(), e);
return MimeTypes.OCTET_STREAM;
}
}

View File

@@ -35,10 +35,8 @@ public class SecurityPasswordService {
public static final String PASSWORD_FORMAT_MSG = "密码必须为长度8-20位且必须包含大小写字母、数字、特殊符号@#$%^&*()_+-=)等三种字符";
private static final int PASSWORD_LENGTH = 8;
private static final String PASSWORD_SALT_FORMAT = "smart_%s_admin_$^&*";
@Resource
@@ -47,7 +45,7 @@ public class SecurityPasswordService {
@Resource
private Level3ProtectConfigService level3ProtectConfigService;
static Argon2PasswordEncoder encoder = Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
static Argon2PasswordEncoder ARGON2_PASSWORD_ENCODER = Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8();
/**
* 校验密码复杂度
@@ -87,7 +85,7 @@ public class SecurityPasswordService {
// 检查最近几次是否有重复密码
List<String> oldPasswords = passwordLogDao.selectOldPassword(requestUser.getUserType().getValue(), requestUser.getUserId(), level3ProtectConfigService.getRegularChangePasswordNotAllowRepeatTimes());
boolean isDuplicate = oldPasswords.stream().anyMatch(oldPassword -> encoder.matches(newPassword, oldPassword));
boolean isDuplicate = oldPasswords.stream().anyMatch(oldPassword -> ARGON2_PASSWORD_ENCODER.matches(newPassword, oldPassword));
if (isDuplicate) {
return ResponseDTO.userErrorParam(String.format("与前%d个历史密码重复请换个密码!", level3ProtectConfigService.getRegularChangePasswordNotAllowRepeatTimes()));
}
@@ -147,14 +145,14 @@ public class SecurityPasswordService {
* 获取 加密后 的密码
*/
public static String getEncryptPwd(String password) {
return encoder.encode(password);
return ARGON2_PASSWORD_ENCODER.encode(password);
}
/**
* 校验密码是否匹配
*/
public static Boolean matchesPwd( String password, String encodedPassword){
return encoder.matches( password, encodedPassword);
return ARGON2_PASSWORD_ENCODER.matches( password, encodedPassword);
}
}

View File

@@ -132,7 +132,9 @@ reload:
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: x-access-token
token-name: Authorization
# token 前缀 例如:Bearer
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结

View File

@@ -29,7 +29,7 @@
<select id="selectByCode"
resultType="net.lab1024.sa.base.module.support.dict.domain.entity.DictValueEntity">
select * from t_dict_value where value_code = #{valueCode} and deleted_flag = #{deletedFlag}
select * from t_dict_value where dict_Key_id = #{dictKeyId} and value_code = #{valueCode} and deleted_flag = #{deletedFlag}
</select>
<select id="selectByDeletedFlag"

View File

@@ -132,7 +132,9 @@ reload:
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: x-access-token
token-name: Authorization
# token 前缀 例如:Bear
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结

View File

@@ -129,7 +129,9 @@ reload:
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: x-access-token
token-name: Authorization
# token 前缀 例如:Bear
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结

View File

@@ -132,7 +132,9 @@ reload:
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: x-access-token
token-name: Authorization
# token 前缀 例如:Bear
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结