Merge branch '5.X' into future/flowable

This commit is contained in:
songgaoshuai
2023-10-18 15:19:32 +08:00
18 changed files with 109 additions and 69 deletions

View File

@@ -68,8 +68,8 @@ public class SysConfigController extends BaseController {
* @param configKey 参数Key
*/
@GetMapping(value = "/configKey/{configKey}")
public R<Void> getConfigKey(@PathVariable String configKey) {
return R.ok(configService.selectConfigByKey(configKey));
public R<String> getConfigKey(@PathVariable String configKey) {
return R.ok("操作成功", configService.selectConfigByKey(configKey));
}
/**

View File

@@ -11,6 +11,7 @@ import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.bo.SysUserBo;
import org.dromara.system.domain.bo.SysUserPasswordBo;
import org.dromara.system.domain.bo.SysUserProfileBo;
import org.dromara.system.domain.vo.AvatarVo;
import org.dromara.system.domain.vo.ProfileVo;
@@ -76,22 +77,21 @@ public class SysProfileController extends BaseController {
/**
* 重置密码
*
* @param newPassword 旧密码
* @param oldPassword 新密码
* @param bo 新旧密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public R<Void> updatePwd(String oldPassword, String newPassword) {
public R<Void> updatePwd(@Validated @RequestBody SysUserPasswordBo bo) {
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
String password = user.getPassword();
if (!BCrypt.checkpw(oldPassword, password)) {
if (!BCrypt.checkpw(bo.getOldPassword(), password)) {
return R.fail("修改密码失败,旧密码错误");
}
if (BCrypt.checkpw(newPassword, password)) {
if (BCrypt.checkpw(bo.getNewPassword(), password)) {
return R.fail("新密码不能与旧密码相同");
}
if (userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(newPassword)) > 0) {
if (userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.getNewPassword())) > 0) {
return R.ok();
}
return R.fail("修改密码异常,请联系管理员");

View File

@@ -0,0 +1,29 @@
package org.dromara.system.domain.bo;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 用户密码修改bo
*/
@Data
public class SysUserPasswordBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 旧密码
*/
@NotBlank(message = "旧密码不能为空")
private String oldPassword;
/**
* 新密码
*/
@NotBlank(message = "新密码不能为空")
private String newPassword;
}

View File

@@ -49,11 +49,8 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
ids.add(deptId);
List<SysDept> list = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
.select(SysDept::getDeptId)
.in(SysDept::getDeptId, ids));
if (CollUtil.isNotEmpty(list)) {
return StreamUtils.join(list, d -> Convert.toStr(d.getDeptId()));
if (CollUtil.isNotEmpty(ids)) {
return StreamUtils.join(ids, Convert::toStr);
}
return null;
}

View File

@@ -53,6 +53,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) {
Map<String, Object> params = operLog.getParams();
LambdaQueryWrapper<SysOperLog> lqw = new LambdaQueryWrapper<SysOperLog>()
.like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp())
.like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
.eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0,
SysOperLog::getBusinessType, operLog.getBusinessType())
@@ -96,6 +97,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) {
Map<String, Object> params = operLog.getParams();
return baseMapper.selectVoList(new LambdaQueryWrapper<SysOperLog>()
.like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp())
.like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
.eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0,
SysOperLog::getBusinessType, operLog.getBusinessType())

View File

@@ -102,6 +102,8 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
validEntityBeforeSave(config);
boolean flag = baseMapper.insert(config) > 0;
if (flag) {
// 从数据库查询完整的数据做缓存
config = baseMapper.selectById(config.getOssConfigId());
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
}
return flag;
@@ -119,6 +121,8 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId());
boolean flag = baseMapper.update(config, luw) > 0;
if (flag) {
// 从数据库查询完整的数据做缓存
config = baseMapper.selectById(config.getOssConfigId());
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
}
return flag;

View File

@@ -14,15 +14,15 @@
<resultMap id="deptResult" type="org.dromara.system.domain.vo.SysDeptVo">
<id property="deptId" column="dept_id"/>
<id property="email" column="dept_email"/>
<id property="status" column="dept_status"/>
<id property="createTime" column="dept_create_time"/>
<result property="email" column="dept_email"/>
<result property="status" column="dept_status"/>
<result property="createTime" column="dept_create_time"/>
</resultMap>
<resultMap id="RoleResult" type="org.dromara.system.domain.vo.SysRoleVo">
<id property="roleId" column="role_id"/>
<id property="status" column="role_status"/>
<id property="createTime" column="role_create_time"/>
<result property="status" column="role_status"/>
<result property="createTime" column="role_create_time"/>
</resultMap>
<sql id="selectUserVo">