|  |  | @ -1,5 +1,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package com.glxp.api.controller.auth; |  |  |  | package com.glxp.api.controller.auth; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import cn.hutool.core.date.DateUnit; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import cn.hutool.crypto.SecureUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.beans.BeanUtils; |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.util.StrUtil; |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.annotation.AuthRuleAnnotation; |  |  |  | import com.glxp.api.annotation.AuthRuleAnnotation; | 
			
		
	
	
		
		
			
				
					|  |  | @ -79,10 +81,14 @@ public class LoginController extends BaseController { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (authAdmin == null) { |  |  |  |         if (authAdmin == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); |  |  |  |             throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | // &&  !PasswordUtils.authAdminPwd(loginRequest.getPassword()).equals(authAdmin.getPassWord())
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (!PasswordUtils.authAdminPwd(loginRequest.getPassword()).equals(authAdmin.getPassWord())) { |  |  |  |         if (!PasswordUtils.authAdminPwd(loginRequest.getPassword()).equals(SecureUtil.sha256(authAdmin.getPassWord()))) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); |  |  |  |             throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        if (!PasswordUtils.authAdminPwd(loginRequest.getPassword()).equals(authAdmin.getPassWord())) {
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误");
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        }
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (authAdmin.getUserFlag() == 0) { |  |  |  |         if (authAdmin.getUserFlag() == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!"); |  |  |  |             throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
	
		
		
			
				
					|  |  | @ -109,7 +115,7 @@ public class LoginController extends BaseController { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, Object> claims = new HashMap<>(); |  |  |  |         Map<String, Object> claims = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         claims.put("admin_id", authAdmin.getId()); |  |  |  |         claims.put("admin_id", authAdmin.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String token = JwtUtils.createToken(claims, 86400L); // 一天后过期
 |  |  |  |         String token = JwtUtils.createToken(claims, 1800l); // 一天后过期
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, Object> map = new HashMap<>(); |  |  |  |         Map<String, Object> map = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         map.put("id", authAdmin.getId()); |  |  |  |         map.put("id", authAdmin.getId()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -120,7 +126,8 @@ public class LoginController extends BaseController { | 
			
		
	
		
		
			
				
					
					|  |  |  |         loginResponse.setToken(token); |  |  |  |         loginResponse.setToken(token); | 
			
		
	
		
		
			
				
					
					|  |  |  |         loginResponse.setDept(authAdmin.getLocDeptCode()); |  |  |  |         loginResponse.setDept(authAdmin.getLocDeptCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         loginResponse.setDeptName(authAdmin.getDeptName()); |  |  |  |         loginResponse.setDeptName(authAdmin.getDeptName()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |         loginResponse.setNeedChangePwd(cn.hutool.core.date.DateUtil.between(authAdmin.getLastUpdatePwdTime() == null ? cn.hutool.core.date.DateUtil.date() : authAdmin.getLastUpdatePwdTime() | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 , cn.hutool.core.date.DateUtil.date(), DateUnit.DAY) >= 90); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logininforService.recordLogininfor(authAdmin.getEmployeeName(), Constant.LOGIN_SUCCESS, "登录成功!", request); |  |  |  |         logininforService.recordLogininfor(authAdmin.getEmployeeName(), Constant.LOGIN_SUCCESS, "登录成功!", request); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success(loginResponse); |  |  |  |         return ResultVOUtils.success(loginResponse); | 
			
		
	
	
		
		
			
				
					|  |  | @ -370,6 +377,7 @@ public class LoginController extends BaseController { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         AuthAdmin authAdminUp = new AuthAdmin(); |  |  |  |         AuthAdmin authAdminUp = new AuthAdmin(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         authAdminUp.setId(authAdmin.getId()); |  |  |  |         authAdminUp.setId(authAdmin.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         authAdminUp.setLastUpdatePwdTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String newPwd = PasswordUtils.authAdminPwd(updatePasswordRequest.getNewPassword()); |  |  |  |         String newPwd = PasswordUtils.authAdminPwd(updatePasswordRequest.getNewPassword()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         authAdminUp.setPassWord(newPwd); |  |  |  |         authAdminUp.setPassWord(newPwd); | 
			
		
	
		
		
			
				
					
					|  |  |  |         authAdmin.setLastModifyTime(new Date()); |  |  |  |         authAdmin.setLastModifyTime(new Date()); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |