优化doc

This commit is contained in:
MMS 2025-08-31 00:28:04 +08:00
parent 56fb568eaf
commit ea762f8a64
11 changed files with 27 additions and 21 deletions

View File

@ -21,7 +21,7 @@ public class GeneratePassword {
//加密内容 //加密内容
System.out.println("url: " + CryptoUtils.encrypt(arr[0], "jdbc:mysql://localhost:3306/mms")); System.out.println("url: " + CryptoUtils.encrypt(arr[0], "jdbc:mysql://localhost:3306/mms"));
System.out.println("username: " + CryptoUtils.encrypt(arr[0], "root")); System.out.println("username: " + CryptoUtils.encrypt(arr[0], "root"));
System.out.println("password: " + CryptoUtils.encrypt(arr[0], "123456")); System.out.println("password: " + CryptoUtils.encrypt(arr[0], "ieHsBpEdmKcDfMtm"));
//备注: 生成的密文 要和 publicKey 一起更新到配置文件中否则会造成解密失败 //备注: 生成的密文 要和 publicKey 一起更新到配置文件中否则会造成解密失败
} }

View File

@ -53,7 +53,7 @@ public class SysUserBo extends BaseEntity {
* 用户账号 * 用户账号
*/ */
@NotBlank(message = "账号不能为空", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class}) @NotBlank(message = "账号不能为空", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class})
@Size(min = 4, max = 20, message = "账号长度在5到20之间", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class}) @Size(min = 3, max = 20, message = "账号长度在3到20之间", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class})
private String userName; private String userName;
/** /**

View File

@ -25,7 +25,7 @@ public class SysDictDataVo {
private Integer sort; private Integer sort;
private String status; private Integer status;
private String colorType; private String colorType;

View File

@ -29,9 +29,9 @@ public class SysDictVo {
*/ */
private Integer type; private Integer type;
/** /**
* 状态;0正常 1停用 * 状态;1正常 0停用
*/ */
private String status; private Integer status;
/** /**
* 排序 * 排序
*/ */

View File

@ -63,7 +63,7 @@ public class SysFunctionVo {
*/ */
private String componentName; private String componentName;
/** /**
* 状态;0正常 1停用 * 状态;1正常 0停用
*/ */
private Integer status; private Integer status;
/** /**

View File

@ -179,7 +179,7 @@ public class SysConfigServiceImpl extends BaseServiceImpl<SysConfig, SysConfigVo
if (bo.getConfigKey() == null || bo.getConfigKey().isEmpty()) { if (bo.getConfigKey() == null || bo.getConfigKey().isEmpty()) {
continue; continue;
} }
bo.setStatus(0); bo.setStatus(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue());
bo.setConfigType(1); bo.setConfigType(1);
this.insert(bo); this.insert(bo);
} else { } else {

View File

@ -69,7 +69,7 @@ public class SysDictServiceImpl implements SysDictService {
vos = new ArrayList<>(); vos = new ArrayList<>();
SysDictDataVo sysDictDataVo = new SysDictDataVo(); SysDictDataVo sysDictDataVo = new SysDictDataVo();
sysDictDataVo.setDictType("0"); sysDictDataVo.setDictType("0");
sysDictDataVo.setStatus("0"); sysDictDataVo.setStatus(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue());
vos.add(sysDictDataVo); vos.add(sysDictDataVo);
} }
sysDictVo.setList(vos); sysDictVo.setList(vos);
@ -124,7 +124,7 @@ public class SysDictServiceImpl implements SysDictService {
@Override @Override
public Integer initSysDict(String code) { public Integer initSysDict(String code) {
List<SysDict> dicts = baseMapper.selectList(new LambdaQueryWrapper<SysDict>().eq(SysDict::getStatus, 0).orderByAsc(SysDict::getSort)); List<SysDict> dicts = baseMapper.selectList(new LambdaQueryWrapper<SysDict>().eq(SysDict::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()).orderByAsc(SysDict::getSort));
int i = 0; int i = 0;
for (SysDict d : dicts) { for (SysDict d : dicts) {
List<SysDictData> data = sysDictDataMapper.selectList(new LambdaQueryWrapper<SysDictData>() List<SysDictData> data = sysDictDataMapper.selectList(new LambdaQueryWrapper<SysDictData>()
@ -151,7 +151,9 @@ public class SysDictServiceImpl implements SysDictService {
@Override @Override
public List<Map<String, Object>> selectAll() { public List<Map<String, Object>> selectAll() {
List<SysDictVo> dataVos = baseMapper.selectVoList(new LambdaQueryWrapper<SysDict>().eq(SysDict::getStatus, 0).orderByAsc(SysDict::getSort)); List<SysDictVo> dataVos = baseMapper.selectVoList(new LambdaQueryWrapper<SysDict>()
.eq(SysDict::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())
.orderByAsc(SysDict::getSort));
List<Map<String, Object>> end = new ArrayList<>(); List<Map<String, Object>> end = new ArrayList<>();
for (SysDictVo dict : dataVos) { for (SysDictVo dict : dataVos) {

View File

@ -99,20 +99,20 @@ public class SysLoginServiceImpl implements SysLoginService {
if(sysConfigService.getIsOpenCaptcha()){ if(sysConfigService.getIsOpenCaptcha()){
if(StringUtil.isEmpty(code)){ if(StringUtil.isEmpty(code)){
throw new MmsException("The verification code cannot be empty"); throw new MmsException("验证码不能为空");
} }
Map<String, Object> data = RedisUtil.getCacheObject(uuid); Map<String, Object> data = RedisUtil.getCacheObject(uuid);
if (ObjectUtils.isEmpty(data)) { if (ObjectUtils.isEmpty(data)) {
log.info("登录:验证码失效!"); log.info("登录:验证码失效!");
throw new LoginException("Verification code failure"); throw new LoginException("验证码失效");
} }
if (!codeKey.equals(data.get(CaptchaEntity.CODE.CAPTCHA_KEY.getValue()))) { if (!codeKey.equals(data.get(CaptchaEntity.CODE.CAPTCHA_KEY.getValue()))) {
log.info("登录:验证码与验证对象不匹配!"); log.info("登录:验证码与验证对象不匹配!");
throw new LoginException("Verification code does not match the verification object"); throw new LoginException("验证码与验证对象不匹配");
} }
if (!code.equalsIgnoreCase((String) data.get(CaptchaEntity.CODE.CAPTCHA_VALUE.getValue()))) { if (!code.equalsIgnoreCase((String) data.get(CaptchaEntity.CODE.CAPTCHA_VALUE.getValue()))) {
log.info("登录:验证码不匹配!"); log.info("登录:验证码不匹配!");
throw new LoginException("Verification code does not match"); throw new LoginException("验证码不匹配");
} }
} }
return; return;
@ -130,11 +130,11 @@ public class SysLoginServiceImpl implements SysLoginService {
SysTenant sysTenant = sysTenantService.selectById(sysUser.getTenantId()); SysTenant sysTenant = sysTenantService.selectById(sysUser.getTenantId());
if (ObjectUtils.isEmpty(sysTenant)) { if (ObjectUtils.isEmpty(sysTenant)) {
log.info("登录用户ID{} 租户不存在.", sysUser.getUserId()); log.info("登录用户ID{} 租户不存在.", sysUser.getUserId());
throw new TenantException("tenant.not.exists"); throw new TenantException("租户不存在");
} }
if (!sysTenant.getStatus().equals(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())) { if (!sysTenant.getStatus().equals(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())) {
log.info("登录用户ID{} 租户状态为禁用.", sysUser.getUserId()); log.info("登录用户ID{} 租户状态为禁用.", sysUser.getUserId());
throw new TenantException("tenant off state"); throw new TenantException("租户状态为禁用");
} }
} }

View File

@ -195,7 +195,7 @@ public class SysUserServiceImpl implements SysUserService {
// 账号查询 // 账号查询
.like(StringUtil.isNotEmpty(bo.getUserName()), "u.user_name", bo.getUserName()) .like(StringUtil.isNotEmpty(bo.getUserName()), "u.user_name", bo.getUserName())
// 账号状态 // 账号状态
.eq(StringUtil.isNotEmpty(bo.getStatus()), "u.status", bo.getStatus()) // .eq(StringUtil.isNotEmpty(bo.getStatus()), "u.status", bo.getStatus())
// 手机号 // 手机号
.like(StringUtil.isNotEmpty(bo.getPhoneNumber()), "u.phonenumber", bo.getPhoneNumber()) .like(StringUtil.isNotEmpty(bo.getPhoneNumber()), "u.phonenumber", bo.getPhoneNumber())
.and(ObjectUtil.isNotNull(bo.getDeptId()), w -> { .and(ObjectUtil.isNotNull(bo.getDeptId()), w -> {
@ -259,7 +259,10 @@ public class SysUserServiceImpl implements SysUserService {
userVo.setButCodes(list.toArray(String[]::new)); userVo.setButCodes(list.toArray(String[]::new));
//===================超级管理员拥有所有========================== //===================超级管理员拥有所有==========================
if (userVo.getUserId().equals(SystemCommonEnum.SUPER_ADMIN.getValue().toString())) { if (userVo.getUserId().equals(SystemCommonEnum.SUPER_ADMIN.getValue().toString())) {
sysRoles = sysRoleMapper.selectList(new LambdaQueryWrapper<SysRole>().eq(SysRole::getCode, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()).like(SysRole::getCode, SystemCommonEnum.SUPER_ADMIN.getCode()).orderByAsc(SysRole::getSort).last("LIMIT 1")); sysRoles = sysRoleMapper.selectList(new LambdaQueryWrapper<SysRole>()
.eq(SysRole::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())
.like(SysRole::getCode, SystemCommonEnum.SUPER_ADMIN.getCode())
.orderByAsc(SysRole::getSort).last("LIMIT 1"));
sysRoleVos = BeanCopyUtil.convert(sysRoles, SysRoleVo.class); sysRoleVos = BeanCopyUtil.convert(sysRoles, SysRoleVo.class);
List<SysFunction> functionList = sysFunctionMapper.selectList(new LambdaQueryWrapper<SysFunction>().eq(SysFunction::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()).orderByAsc(SysFunction::getSort)); List<SysFunction> functionList = sysFunctionMapper.selectList(new LambdaQueryWrapper<SysFunction>().eq(SysFunction::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()).orderByAsc(SysFunction::getSort));

View File

@ -20,12 +20,12 @@ public enum SystemCommonEnum implements IEnum<Integer> {
/** /**
* 系统状态启用 * 系统状态启用
*/ */
SYS_COMMON_STATE_OPEN(0, "common_state","系统状态-启用/有效"), SYS_COMMON_STATE_OPEN(1, "common_state","系统状态-启用/有效"),
/** /**
* 系统状态禁用 * 系统状态禁用
*/ */
SYS_COMMON_STATE_CLOSE(1, "common_state","系统状态-关闭/失效"), SYS_COMMON_STATE_CLOSE(0, "common_state","系统状态-关闭/失效"),
/** /**
* 系统默认头像 * 系统默认头像

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.sxpcwlkj.authority.LoginObject; import com.sxpcwlkj.authority.LoginObject;
import com.sxpcwlkj.common.enums.SystemCommonEnum;
import com.sxpcwlkj.common.exception.MmsException; import com.sxpcwlkj.common.exception.MmsException;
import com.sxpcwlkj.datasource.entity.BaseEntity; import com.sxpcwlkj.datasource.entity.BaseEntity;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -35,7 +36,7 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
baseEntity.setCreatedTime(current); baseEntity.setCreatedTime(current);
baseEntity.setUpdatedTime(current); baseEntity.setUpdatedTime(current);
if(baseEntity.getStatus()==null){ if(baseEntity.getStatus()==null){
baseEntity.setStatus(0); baseEntity.setStatus(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue());
} }
if(baseEntity.getSort()==null){ if(baseEntity.getSort()==null){
baseEntity.setSort(0); baseEntity.setSort(0);