|  |  | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.model.LoginUserInfo; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.Utils; | 
 |  |  | import com.doumee.dao.system.dto.LoginDTO; | 
 |  |  | import com.doumee.dao.system.model.SystemLoginLog; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Value("${project.version}") | 
 |  |  |     private String systemVersion; | 
 |  |  |     @Value("${captcha_check}") | 
 |  |  |     private boolean captchaCheck; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private CaptchaService captchaService; | 
 |  |  | 
 |  |  |     private SystemLoginLogService systemLoginLogService; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public String loginByPassword(LoginDTO dto, HttpServletRequest request) { | 
 |  |  |     public String loginByPassword(LoginDTO dto, int type,HttpServletRequest request) { | 
 |  |  |         SystemLoginLog loginLog = new SystemLoginLog(); | 
 |  |  |         loginLog.setLoginUsername(dto.getUsername()); | 
 |  |  |         loginLog.setLoginTime(new Date()); | 
 |  |  | 
 |  |  |         loginLog.setOsInfo(Utils.User_Client.getOS(request)); | 
 |  |  |         loginLog.setServerIp(Utils.Server.getIP()); | 
 |  |  |         // 校验验证码 | 
 |  |  |         try { | 
 |  |  |             captchaService.check(dto.getUuid(), dto.getCode()); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error(e.getMessage(), e); | 
 |  |  |             loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); | 
 |  |  |             loginLog.setSuccess(Boolean.FALSE); | 
 |  |  |             systemLoginLogService.create(loginLog); | 
 |  |  |             throw e; | 
 |  |  |         if(type!= Constants.TWO){ | 
 |  |  |             try { | 
 |  |  |                 if(captchaCheck){ | 
 |  |  |                     captchaService.check(dto.getUuid(), dto.getCode()); | 
 |  |  |                 } | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 log.error(e.getMessage(), e); | 
 |  |  |                 loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); | 
 |  |  |                 loginLog.setSuccess(Boolean.FALSE); | 
 |  |  |                 systemLoginLogService.create(loginLog); | 
 |  |  |                 throw e; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         // 校验用户名和密码 | 
 |  |  |         Subject subject = SecurityUtils.getSubject(); |