修改密码

This commit is contained in:
wcy 2024-09-28 19:29:57 +08:00
parent 548494822a
commit 99a8b5124c
9 changed files with 49 additions and 7 deletions

View File

@ -84,4 +84,10 @@ public interface RemoteUserService
*/
@GetMapping("/user/getUserList")
public R<List<SysUser>> getUserList(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询密码是否需要修改
*/
@GetMapping("/user/userPwdState")
public String userPwdState(String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@ -61,6 +61,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
public R<List<SysUser>> getUserList(SysUser sysUser, String source) {
return R.fail("获取用户失败:" + throwable.getMessage());
}
@Override
public String userPwdState(String username, String source) {
return null;
}
};
}
}

View File

@ -67,6 +67,14 @@ public class LoginUser implements Serializable
*/
private Set<String> roles;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
/**
* 用户信息
*/
@ -77,6 +85,16 @@ public class LoginUser implements Serializable
*/
private String loginMethod;
public String getForceChangePwd() {
return forceChangePwd;
}
public void setForceChangePwd(String forceChangePwd) {
this.forceChangePwd = forceChangePwd;
}
private String forceChangePwd;
public String getLoginMethod() {
return loginMethod;
}

View File

@ -93,14 +93,9 @@ public class SysLoginService {
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
passwordService.validate(user, password);
// 检查用户是否需要更改初始密码
if (user.getForceChangePwd().equals(1)) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "请先修改初始密码");
throw new ServiceException("请先修改初始密码");
}
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
String forceChangePwd = remoteUserService.userPwdState(username,SecurityConstants.INNER);
userInfo.setForceChangePwd(forceChangePwd);
return userInfo;
}

View File

@ -83,6 +83,12 @@ public class SysUserController extends BaseController {
return getDataTable(list);
}
@GetMapping("/userPwdState")
public String userPwdState(String username) {
startPage();
String state = userService.selectforceChangePwd(username);
return state;
}
/**
* 获取用户列表内部请求
*/

View File

@ -134,4 +134,6 @@ public interface SysUserMapper
List<SysUser> selectUserByRole(SysUser sysUser);
void updatePurchaseNoticePerson(SysUser user);
String selectforceChangePwd(String username);
}

View File

@ -224,4 +224,6 @@ public interface ISysUserService
* @return
*/
AjaxResult urgentProcessingUser(UrgentProcessingUser urgentProcessingUser);
String selectforceChangePwd(String username);
}

View File

@ -575,4 +575,9 @@ public class SysUserServiceImpl implements ISysUserService {
log.info("ToDoServiceImpl urgentProcessingUser {} end" ,urgentProcessingUser);
return success(userList);
}
@Override
public String selectforceChangePwd(String username) {
return userMapper.selectforceChangePwd(username);
}
}

View File

@ -180,6 +180,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</select>
<select id="selectforceChangePwd" resultType="java.lang.String">
select force_change_pwd from sys_user where user_name = #{username}
</select>
<insert id="insertUser" parameterType="com.bonus.sgzb.system.api.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(