dev_xds
haha 2024-04-22 23:00:38 +08:00
commit 9cf1d824c7
3 changed files with 20 additions and 7 deletions

View File

@ -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();

View File

@ -174,11 +174,14 @@ public class SurProjectAuditinfoServiceImpl implements ISurProjectAuditinfoServi
} }
SmzSspProblemmodifyWhere smzSspProblemmodifyWhere = new SmzSspProblemmodifyWhere(); SmzSspProblemmodifyWhere smzSspProblemmodifyWhere = new SmzSspProblemmodifyWhere();
smzSspProblemmodifyWhere.setProjectId(Convert.toLong(flowTaskEntity.getBusinessKey())); if(StringUtils.isNotEmpty(flowTaskEntity.getBusinessKey())){
smzSspProblemmodifyWhere.setProjectId(Convert.toLong(flowTaskEntity.getBusinessKey()));
}
smzSspProblemmodifyWhere.setInfoType(1L); smzSspProblemmodifyWhere.setInfoType(1L);
Long minRole = flowTaskEntity.getRoleIds().stream().mapToLong(Long::longValue).min().getAsLong(); Long minRole = flowTaskEntity.getRoleIds().stream().mapToLong(Long::longValue).min().getAsLong();
smzSspProblemmodifyWhere.setNowRole(Convert.toStr(minRole)); smzSspProblemmodifyWhere.setNowRole(Convert.toStr(minRole));
smzSspProblemmodifyWhere.setNowUser(flowTaskEntity.getNowUserName()); smzSspProblemmodifyWhere.setNowUser(flowTaskEntity.getNowUserName());
smzSspProblemmodifyWhere.setNowDept(flowTaskEntity.getNowDept());
int zlCount = 0; int zlCount = 0;
List<Map<String, Object>> zlDataList = smzSspProblemmodifyMapper.findProblemmodifyGroupByCheckState(smzSspProblemmodifyWhere); List<Map<String, Object>> zlDataList = smzSspProblemmodifyMapper.findProblemmodifyGroupByCheckState(smzSspProblemmodifyWhere);
if(StringUtils.isNotEmpty(zlDataList)){ if(StringUtils.isNotEmpty(zlDataList)){
@ -208,6 +211,9 @@ public class SurProjectAuditinfoServiceImpl implements ISurProjectAuditinfoServi
dataMap.put("approveCLFY",d); dataMap.put("approveCLFY",d);
//查询劳资预警审批信息 //查询劳资预警审批信息
FlowLabourInfo flowLabourInfo=new FlowLabourInfo(); FlowLabourInfo flowLabourInfo=new FlowLabourInfo();
if(StringUtils.isNotEmpty(flowTaskEntity.getBusinessKey())){
flowLabourInfo.setProjectId(Convert.toLong(flowTaskEntity.getBusinessKey()));
}
flowLabourInfo.setNowRole(flowTaskEntity.getNowRole()); flowLabourInfo.setNowRole(flowTaskEntity.getNowRole());
flowLabourInfo.setNowDept(flowTaskEntity.getNowDept()); flowLabourInfo.setNowDept(flowTaskEntity.getNowDept());
flowLabourInfo.setNowUser(flowTaskEntity.getNowUser()); flowLabourInfo.setNowUser(flowTaskEntity.getNowUser());

View File

@ -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>