Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
aa0bf7bf82
@ -6,6 +6,7 @@ import com.das.common.captcha.CaptchaUtils;
|
||||
import com.das.common.captcha.CaptchaVO;
|
||||
import com.das.common.result.R;
|
||||
import com.das.common.utils.AdminRedisTemplate;
|
||||
import com.das.modules.auth.domain.dto.ChangePasswordDto;
|
||||
import com.das.modules.auth.domain.dto.LoginDto;
|
||||
import com.das.modules.auth.domain.dto.RefreshTokenDto;
|
||||
import com.das.modules.auth.domain.vo.LoginUserDetailsVo;
|
||||
@ -77,5 +78,13 @@ public class LoginController {
|
||||
return R.success(loginVO);
|
||||
}
|
||||
|
||||
@PostMapping("/changePassword")
|
||||
public R<?> changePassword(@RequestBody ChangePasswordDto changePasswordDto) {
|
||||
int result = loginService.changePassword(changePasswordDto);
|
||||
if (result < 0) {
|
||||
return R.fail("密码修改失败");
|
||||
}
|
||||
return R.success("密码修改成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChangePasswordDto {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String newPassword;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -7,5 +9,6 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class DeleteDto implements Serializable {
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -8,6 +10,7 @@ import java.util.Date;
|
||||
@Data
|
||||
public class SysAuthorityDto implements Serializable {
|
||||
/** 机构id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id ;
|
||||
/** 权限编码 */
|
||||
private String authorityCode;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -8,6 +10,7 @@ import java.util.Date;
|
||||
@Data
|
||||
public class SysMenuDto implements Serializable {
|
||||
/** 菜单ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id ;
|
||||
/** 菜单名称 */
|
||||
private String menuName ;
|
||||
@ -20,8 +23,10 @@ public class SysMenuDto implements Serializable {
|
||||
/** 菜单操作参数 */
|
||||
private String funParam ;
|
||||
/** 权限ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long authorityId ;
|
||||
/** 上级菜单ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentMenuId ;
|
||||
/** 乐观锁 */
|
||||
private Integer revision ;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -7,11 +9,13 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class SysMenuQueryDto implements Serializable {
|
||||
/** 菜单ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id ;
|
||||
|
||||
/** 菜单名称 */
|
||||
private String menuName ;
|
||||
/** 上级菜单ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentMenuId ;
|
||||
|
||||
/** 是否是首次查询菜单 */
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -8,6 +10,7 @@ import java.util.Date;
|
||||
@Data
|
||||
public class SysOrgDto implements Serializable {
|
||||
/** 机构id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id ;
|
||||
/** 机构名称 */
|
||||
private String name ;
|
||||
@ -28,6 +31,7 @@ public class SysOrgDto implements Serializable {
|
||||
/** 机构简称 */
|
||||
private String aliasName;
|
||||
/** 上级组织机构id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentOrgId ;
|
||||
/** 乐观锁 */
|
||||
private Integer revision ;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -14,6 +16,8 @@ public class SysOrgQueryDto implements Serializable {
|
||||
private String city ;
|
||||
/** 区县 */
|
||||
private String county ;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentOrgId ;
|
||||
/** 是否是首次查询机构 */
|
||||
private Boolean recursive;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -8,6 +10,7 @@ import java.util.List;
|
||||
@Data
|
||||
public class SysRoleDto implements Serializable {
|
||||
/** 主键id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id ;
|
||||
/** 角色名称 */
|
||||
private String roleName ;
|
||||
|
@ -38,6 +38,7 @@ public class SysUserDto implements Serializable {
|
||||
/**
|
||||
* 所属机构id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
/**
|
||||
* 最后登录时间
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.auth.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -9,5 +11,9 @@ public class SysUserQueryDto implements Serializable {
|
||||
/** 职员名称 */
|
||||
private String userName ;
|
||||
/** 组织机构id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId ;
|
||||
/** 用户主键id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id ;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.das.modules.auth.service;
|
||||
|
||||
|
||||
import com.das.modules.auth.domain.dto.ChangePasswordDto;
|
||||
import com.das.modules.auth.domain.vo.LoginUserDetailsVo;
|
||||
import com.das.modules.auth.domain.dto.LoginDto;
|
||||
import com.das.modules.auth.domain.dto.RefreshTokenDto;
|
||||
import com.das.modules.auth.domain.vo.LoginUserDetailsVo;
|
||||
@ -36,4 +38,6 @@ public interface LoginService {
|
||||
* @return
|
||||
*/
|
||||
LoginVo refreshToken(RefreshTokenDto refreshToken);
|
||||
|
||||
int changePassword(ChangePasswordDto changePasswordDto);
|
||||
}
|
||||
|
@ -8,7 +8,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.das.common.captcha.CaptchaUtils;
|
||||
import com.das.common.config.SaTokenProperties;
|
||||
import com.das.common.config.SessionUtil;
|
||||
import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.utils.AdminRedisTemplate;
|
||||
import com.das.modules.auth.domain.dto.ChangePasswordDto;
|
||||
import com.das.modules.auth.domain.vo.LoginUserDetailsVo;
|
||||
import com.das.modules.auth.domain.dto.LoginDto;
|
||||
import com.das.modules.auth.domain.dto.RefreshTokenDto;
|
||||
import com.das.modules.auth.domain.vo.LoginUserDetailsVo;
|
||||
@ -22,8 +25,10 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author chenhaojie
|
||||
@ -63,6 +68,9 @@ public class LoginServiceImpl implements LoginService {
|
||||
loginInfo.setMsg("账号密码错误");
|
||||
return loginInfo;
|
||||
}
|
||||
// 更新用户登录时间
|
||||
sysUser.setLastLogin(new Date());
|
||||
sysUserMapper.updateById(sysUser);
|
||||
StpUtil.login(sysUser.getAccount());// 执行登录,这里username为用户唯一标识
|
||||
String refreshTokenUuid = IdUtil.fastSimpleUUID();
|
||||
String token = StpUtil.getTokenValue().replace("-", "");
|
||||
@ -125,4 +133,19 @@ public class LoginServiceImpl implements LoginService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int changePassword(ChangePasswordDto changePasswordDto) {
|
||||
if (changePasswordDto.getId() == null || StringUtils.isEmpty(changePasswordDto.getNewPassword())) {
|
||||
throw new ServiceException("非法调用,参数缺失");
|
||||
}
|
||||
String passwordEncode = BCrypt.hashpw(changePasswordDto.getNewPassword(), BCrypt.gensalt());
|
||||
SysUser sysUser = sysUserMapper.selectById(changePasswordDto.getId());
|
||||
if (sysUser == null) {
|
||||
throw new ServiceException("用户不存在");
|
||||
}
|
||||
sysUser.setPassword(passwordEncode);
|
||||
sysUser.setUpdatedTime(new Date());
|
||||
return sysUserMapper.updateById(sysUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ public class SysOrgServiceImpl implements SysOrgService {
|
||||
public void updateOrg(SysOrgDto sysOrgDto) {
|
||||
SysOrg sysOrg = new SysOrg();
|
||||
BeanCopyUtils.copy(sysOrgDto,sysOrg);
|
||||
sysOrg.setUpdatedTime(new Date());
|
||||
sysOrgMapper.updateById(sysOrg);
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@ public class SysRoleServiceImpl implements SysRoleService {
|
||||
sysRole.setRoleName(sysRoleDto.getRoleName());
|
||||
sysRole.setRoleCode(sysRoleDto.getRoleCode());
|
||||
sysRole.setId(sysRoleDto.getId());
|
||||
sysRole.setUpdatedTime(new Date());
|
||||
this.sysRoleMapper.updateById(sysRole);
|
||||
//验证权限有效性
|
||||
String errorAuths = checkErrorAuthorities(sysRoleDto.getAuthList());
|
||||
|
@ -56,7 +56,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
SysUser sysUser = new SysUser();
|
||||
BeanCopyUtils.copy(sysUserDto,sysUser);
|
||||
//密码加密
|
||||
String passwordEncode = BCrypt.hashpw(sysUserDto.getPassword(), BCrypt.gensalt());
|
||||
String passwordEncode = BCrypt.hashpw("123456789", BCrypt.gensalt());
|
||||
sysUser.setId(SequenceUtils.generateId());
|
||||
sysUser.setRevision(1);
|
||||
sysUser.setCreatedTime(new Date());
|
||||
@ -138,6 +138,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
SysUser newSysUser = new SysUser();
|
||||
BeanUtils.copyProperties(sysUserDto, newSysUser, "password");
|
||||
newSysUser.setUpdatedTime(new Date());
|
||||
sysUserMapper.updateById(newSysUser);
|
||||
|
||||
if (sysUserDto.getRoleList() != null) {
|
||||
|
@ -61,6 +61,9 @@
|
||||
<if test="sysUser.orgId != null and sysUser.orgId != ''">
|
||||
and org_id = #{sysUser.orgId}
|
||||
</if>
|
||||
<if test="sysUser.id != null and sysUser.id != ''">
|
||||
and id = #{sysUser.id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -65,9 +65,9 @@
|
||||
:rules="rules"
|
||||
style="padding: 24px 40px; font-size: 14px; line-height: 1.5; word-wrap: break-word; font-size: 20px"
|
||||
>
|
||||
<el-form-item label="菜单路径:" prop="funParam">
|
||||
<!-- <el-form-item label="菜单路径:" prop="funParam">
|
||||
<el-input v-model="fromUpDate.funParam" placeholder="" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="菜单名称:" prop="menuName">
|
||||
<el-input v-model="fromUpDate.menuName" placeholder="" clearable />
|
||||
@ -90,11 +90,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label=" 动作参数:">
|
||||
<el-input v-model="fromUpDate.funParam" :disabled="true">
|
||||
<template #append>
|
||||
<el-icon style="cursor: pointer; font-size: 23px" @click="clickParam"><Setting /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-input v-model="fromUpDate.funParam"> </el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label=" 菜单权限:">
|
||||
@ -112,7 +108,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑页面的动作参数弹框 -->
|
||||
<el-dialog v-model="visibleParam" title="选择页面" width="500" :before-close="handleCloseParam">
|
||||
<!-- <el-dialog v-model="visibleParam" title="选择页面" width="500" :before-close="handleCloseParam">
|
||||
<el-table :data="ParamTableData" style="width: 100%">
|
||||
<el-table-column label="页面名称" width="180" />
|
||||
<el-table-column label="页面路径" width="180" />
|
||||
@ -135,7 +131,7 @@
|
||||
<el-button type="primary" @click="visibleParam1"> 确定 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-dialog> -->
|
||||
<!-- 新增弹框 -->
|
||||
<el-dialog v-model="visibleAdd" title="新增菜单" width="500" :before-close="handleCloseAdd">
|
||||
<el-form
|
||||
@ -145,9 +141,9 @@
|
||||
:rules="rules"
|
||||
style="padding: 24px 40px; font-size: 14px; line-height: 1.5; word-wrap: break-word; font-size: 20px"
|
||||
>
|
||||
<el-form-item label="菜单路径:" prop="funParam">
|
||||
<!-- <el-form-item label="菜单路径:" prop="funParam">
|
||||
<el-input v-model="formInlineAdd.funParam" placeholder="" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="菜单名称:" prop="menuName">
|
||||
<el-input v-model="formInlineAdd.menuName" placeholder="" clearable />
|
||||
@ -170,11 +166,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label=" 动作参数:">
|
||||
<el-input v-model="formInlineAdd.funParam" :disabled="true">
|
||||
<template #append>
|
||||
<el-icon style="cursor: pointer; font-size: 23px" @click="clickParam"><Setting /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-input v-model="formInlineAdd.funParam"> </el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label=" 菜单权限:">
|
||||
@ -191,7 +183,7 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 新增页面动作参数弹框 -->
|
||||
<el-dialog v-model="visibleParam" title="选择页面" width="500" :before-close="handleCloseParam">
|
||||
<!-- <el-dialog v-model="visibleParam" title="选择页面" width="500" :before-close="handleCloseParam">
|
||||
<el-table :data="ParamTableData" style="width: 100%">
|
||||
<el-table-column label="页面名称" width="180" />
|
||||
<el-table-column label="页面路径" width="180" />
|
||||
@ -213,7 +205,7 @@
|
||||
<el-button type="primary" @click="visibleParam1"> 确定 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-dialog> -->
|
||||
<!-- 删除确认弹框 -->
|
||||
<el-dialog v-model="dialogVisibleDelete" title="操作提示" width="500" :before-close="handleCloseDelete">
|
||||
<span>确定是否删除?</span>
|
||||
|
Loading…
Reference in New Issue
Block a user