提交代码
parent
5561d11cb3
commit
64a606452e
|
@ -5,6 +5,8 @@ import javax.annotation.Resource;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.system.mapper.SysUserMapper;
|
import com.ruoyi.system.mapper.SysUserMapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
@ -41,6 +43,8 @@ import com.ruoyi.system.service.ISysUserService;
|
||||||
@Component
|
@Component
|
||||||
public class SysLoginService
|
public class SysLoginService
|
||||||
{
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SysLoginService.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@ -167,13 +171,15 @@ public class SysLoginService
|
||||||
//进入这里先把用户的密码修改,登录成功后在修改回去
|
//进入这里先把用户的密码修改,登录成功后在修改回去
|
||||||
SysUser sysUser = sysUserMapper.selectUserByUserName(username);
|
SysUser sysUser = sysUserMapper.selectUserByUserName(username);
|
||||||
String userAuth = sysUser.getPassword();
|
String userAuth = sysUser.getPassword();
|
||||||
String password = Convert.toStr(System.currentTimeMillis());
|
|
||||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
|
||||||
sysUserMapper.updateUser(sysUser);
|
|
||||||
// 用户验证
|
// 用户验证
|
||||||
Authentication authentication = null;
|
Authentication authentication = null;
|
||||||
try
|
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);
|
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||||
AuthenticationContextHolder.setContext(authenticationToken);
|
AuthenticationContextHolder.setContext(authenticationToken);
|
||||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||||
|
@ -194,9 +200,10 @@ public class SysLoginService
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
AuthenticationContextHolder.clearContext();
|
|
||||||
sysUser.setPassword(userAuth);
|
sysUser.setPassword(userAuth);
|
||||||
sysUserMapper.updateUser(sysUser);
|
sysUserMapper.updateUser(sysUser);
|
||||||
|
log.info("【"+username+"】...密码已更新==>{}",userAuth);
|
||||||
|
AuthenticationContextHolder.clearContext();
|
||||||
}
|
}
|
||||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||||
|
|
|
@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'>
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'>
|
||||||
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 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 )
|
||||||
</if>
|
</if>
|
||||||
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> 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)</if>
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> 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)</if>
|
||||||
<if test='activeName == "jxz"'>
|
<if test='activeName == "jxz"'>
|
||||||
<if test='nowRole == "4"'> and fl.approve_status in ('20','31')</if>
|
<if test='nowRole == "4"'> and fl.approve_status in ('20','31')</if>
|
||||||
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
||||||
|
@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test='nowRole == "4"'> and fl.approve_status in ('20','21','31','30','100') and sp.deptId = #{nowDept}</if>
|
<if test='nowRole == "4"'> and fl.approve_status in ('20','21','31','30','100') and sp.deptId = #{nowDept}</if>
|
||||||
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
<!--监理单位/总包公司/分包单位查询当前关联数据-->
|
||||||
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> 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 )</if>
|
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> 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 )</if>
|
||||||
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> 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)</if>
|
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17"'> 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)</if>
|
||||||
</where>
|
</where>
|
||||||
group by fl.approve_status
|
group by fl.approve_status
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue