From 64a606452e98863afb86be74af3cb1d40470f672 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?=
<7507756+jiang_yuqi@user.noreply.gitee.com>
Date: Mon, 22 Apr 2024 22:10:38 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../framework/web/service/SysLoginService.java | 15 +++++++++++----
.../mapper/flow/FlowLabourInfoMapper.xml | 4 ++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index b9f1d13d..94a3a6dd 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -5,6 +5,8 @@ import javax.annotation.Resource;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.SysUserMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
@@ -41,6 +43,8 @@ import com.ruoyi.system.service.ISysUserService;
@Component
public class SysLoginService
{
+ private static final Logger log = LoggerFactory.getLogger(SysLoginService.class);
+
@Autowired
private TokenService tokenService;
@@ -167,13 +171,15 @@ public class SysLoginService
//进入这里先把用户的密码修改,登录成功后在修改回去
SysUser sysUser = sysUserMapper.selectUserByUserName(username);
String userAuth = sysUser.getPassword();
- String password = Convert.toStr(System.currentTimeMillis());
- sysUser.setPassword(SecurityUtils.encryptPassword(password));
- sysUserMapper.updateUser(sysUser);
// 用户验证
Authentication authentication = null;
try
{
+ String password = Convert.toStr(System.currentTimeMillis());
+ sysUser.setPassword(SecurityUtils.encryptPassword(password));
+ sysUserMapper.updateUser(sysUser);
+ log.info("【password】...密文==>{}",sysUser.getPassword());
+ log.info("【"+username+"】...临时登录密码是==>{},旧密码是==>{}",password,userAuth);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
@@ -194,9 +200,10 @@ public class SysLoginService
}
finally
{
- AuthenticationContextHolder.clearContext();
sysUser.setPassword(userAuth);
sysUserMapper.updateUser(sysUser);
+ log.info("【"+username+"】...密码已更新==>{}",userAuth);
+ AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
diff --git a/yanzhu-jh/src/main/resources/mapper/flow/FlowLabourInfoMapper.xml b/yanzhu-jh/src/main/resources/mapper/flow/FlowLabourInfoMapper.xml
index 8858a00f..a4d34c21 100644
--- a/yanzhu-jh/src/main/resources/mapper/flow/FlowLabourInfoMapper.xml
+++ b/yanzhu-jh/src/main/resources/mapper/flow/FlowLabourInfoMapper.xml
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )
- and fl.approve_status in ('10','20','21','30','31','100') and sp.id in (select spui.project_id from sur_project_userinfo spui where spui.dept_id = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.is_del=0)
+ and fl.approve_status in ('10','20','21','30','31','100') and sp.id in (select spui.project_id from sur_project_userinfo spui where spui.dept_id = #{nowDept} and spui.user_id=(select su.user_id from sys_user su where su.user_name=#{nowUser}) and spui.job_type='24' and spui.is_del=0)
and fl.approve_status in ('20','31')
@@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and fl.approve_status in ('20','21','31','30','100') and sp.deptId = #{nowDept}
and fl.approve_status in ('10','20','21','30','31','100') and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{nowDept} and spui.job_type='24' and spui.del_flag=0 )
- and fl.approve_status in ('10','20','21','30','31','100') and sp.id in (select spui.project_id from sur_project_userinfo spui where spui.dept_id = #{nowDept} and spui.user_id=#{nowUser} and spui.job_type='24' and spui.is_del=0)
+ and fl.approve_status in ('10','20','21','30','31','100') and sp.id in (select spui.project_id from sur_project_userinfo spui where spui.dept_id = #{nowDept} and spui.user_id=(select su.user_id from sys_user su where su.user_name=#{nowUser}) and spui.job_type='24' and spui.is_del=0)
group by fl.approve_status