|
@@ -1,6 +1,10 @@
|
|
|
package com.ruoyi.framework.web.service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
+import com.ruoyi.quartz.task.RyTask;
|
|
|
+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;
|
|
@@ -33,6 +37,7 @@ import com.ruoyi.system.service.ISysUserService;
|
|
|
@Component
|
|
|
public class SysLoginService
|
|
|
{
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(SysLoginService.class);
|
|
|
@Autowired
|
|
|
private TokenService tokenService;
|
|
|
|
|
@@ -48,6 +53,9 @@ public class SysLoginService
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RyTask ryTask;
|
|
|
+
|
|
|
/**
|
|
|
* 登录验证
|
|
|
*
|
|
@@ -93,6 +101,26 @@ public class SysLoginService
|
|
|
return tokenService.createToken(loginUser);
|
|
|
}
|
|
|
|
|
|
+ public String logindingding(String code)
|
|
|
+ {
|
|
|
+
|
|
|
+ SysUser user = ryTask.getUserByCode(code);
|
|
|
+ // 用户验证
|
|
|
+ if(user==null){
|
|
|
+ AsyncManager.me().execute(AsyncFactory.recordLogininfor(code, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
|
|
+ throw new UserPasswordNotMatchException();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ LoginUser loginUser = new LoginUser();
|
|
|
+ loginUser.setUser(user);
|
|
|
+ String token = tokenService.createToken(loginUser);
|
|
|
+ log.info("token:"+token);
|
|
|
+ AsyncManager.me().execute(AsyncFactory.recordLogininfor(user.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
|
|
+ // 生成token
|
|
|
+ return token;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 校验验证码
|
|
|
*
|