|
@@ -4,11 +4,17 @@ import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.citygis.framework.web.service.SysLoginService;
|
|
|
+import com.citygis.web.domain.TabUser;
|
|
|
+import com.citygis.web.service.ITabUserService;
|
|
|
import com.citygis.web.service.SingleLoginService;
|
|
|
+import com.citygis.web.utils.AesUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
@@ -44,6 +50,12 @@ public class SingleLoginServiceImpl implements SingleLoginService {
|
|
|
@Value("${singleLogin.userInfo}")
|
|
|
private String userInfo;
|
|
|
|
|
|
+ @Resource
|
|
|
+ ITabUserService tabUserService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ SysLoginService sysLoginService;
|
|
|
+
|
|
|
@Override
|
|
|
public void singleLogin(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
|
|
@@ -60,15 +72,24 @@ public class SingleLoginServiceImpl implements SingleLoginService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getUser(String code) throws UnsupportedEncodingException {
|
|
|
+ public String getLTYToken(String code) throws UnsupportedEncodingException {
|
|
|
String accessToken = getAccessToken(code);
|
|
|
- String user = getUserAccountInfo(accessToken);
|
|
|
- return "";
|
|
|
+ String userName = getUserAccountInfo(accessToken);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TabUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(TabUser::getName, userName);
|
|
|
+ TabUser one = tabUserService.getOne(wrapper);
|
|
|
+
|
|
|
+ String decryptedPassword = AesUtil.aesDecrypt(one.getPassword());
|
|
|
+
|
|
|
+ String token = sysLoginService.login(userName, decryptedPassword);
|
|
|
+ return token;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取token
|
|
|
+ *
|
|
|
* @param code
|
|
|
* @return
|
|
|
* @throws UnsupportedEncodingException
|
|
@@ -110,6 +131,7 @@ public class SingleLoginServiceImpl implements SingleLoginService {
|
|
|
|
|
|
/**
|
|
|
* 获取用户
|
|
|
+ *
|
|
|
* @param accessToken
|
|
|
* @return
|
|
|
*/
|