|
|
@@ -1,7 +1,9 @@
|
|
|
package com.fdkankan.fusion.controller;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.net.URLDecoder;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.dtflys.forest.annotation.Post;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
|
import com.fdkankan.fusion.config.FusionConfig;
|
|
|
@@ -13,6 +15,7 @@ import com.fdkankan.fusion.httpClient.client.ChenanClient;
|
|
|
import com.fdkankan.fusion.httpClient.client.FdKKClient;
|
|
|
import com.fdkankan.fusion.httpClient.request.ManageLoginRequest;
|
|
|
import com.fdkankan.fusion.httpClient.request.UserParam;
|
|
|
+import com.fdkankan.fusion.request.ChenAnParam;
|
|
|
import com.fdkankan.fusion.service.ICaseService;
|
|
|
import com.fdkankan.fusion.service.IJyUserService;
|
|
|
import com.fdkankan.fusion.service.IUserService;
|
|
|
@@ -30,6 +33,7 @@ import javax.servlet.http.Cookie;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.net.URI;
|
|
|
+import java.nio.charset.Charset;
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
|
@@ -39,16 +43,22 @@ import java.util.HashMap;
|
|
|
public class ChenanController {
|
|
|
@Autowired
|
|
|
ChenAnService chenAnService;
|
|
|
+ @Autowired
|
|
|
+ FusionConfig fusionConfig;
|
|
|
|
|
|
/**
|
|
|
* 辰安获取用户信息,并登录注册
|
|
|
*/
|
|
|
- @GetMapping("/getUserInfo/{randomCode}/{caCaseId}")
|
|
|
- public synchronized ResultData userInfo(@RequestParam(required = false,value = "randomCode") String randomCode,
|
|
|
- @RequestParam(required = false,value = "caCaseId") String caCaseId){
|
|
|
-
|
|
|
- String clientIp = "http://192.168.0.125:1804";
|
|
|
- HashMap<String, String> map = chenAnService.userAndCaseInfo(randomCode, caCaseId);
|
|
|
+ @PostMapping("/getUserInfo")
|
|
|
+ public synchronized ResultData userInfo(@RequestBody ChenAnParam param){
|
|
|
+ if(StringUtils.isBlank(param.getRandomCode() )|| StringUtils.isBlank(param.getCasesId())){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ String clientIp = fusionConfig.getServerUrl();
|
|
|
+ if(StringUtils.isBlank(clientIp)){
|
|
|
+ throw new BusinessException(ResultCode.SERVER_URL_ERROR);
|
|
|
+ }
|
|
|
+ HashMap<String, String> map = chenAnService.userAndCaseInfo(param.getRandomCode(), param.getCasesId());
|
|
|
String redirectUrl = String.format("%s/mix3d/#/home/"+map.get("caseId")+"?token="+ map.get("token"), clientIp);
|
|
|
|
|
|
return ResultData.ok(redirectUrl);
|
|
|
@@ -59,10 +69,10 @@ public class ChenanController {
|
|
|
public ResponseEntity<Void> redirectWithCookieToken(@PathVariable String randomCode,@PathVariable String caCaseId,
|
|
|
HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
- //String clientIp = request.getHeader("host");
|
|
|
- String clientIp = "http://192.168.0.125:1804";
|
|
|
-
|
|
|
- HashMap<String, String> map = chenAnService.userAndCaseInfo(randomCode, caCaseId);
|
|
|
+ String clientIp = fusionConfig.getServerUrl();
|
|
|
+ String decode1 = URLDecoder.decode(randomCode, Charset.defaultCharset());
|
|
|
+ String decode2 = URLDecoder.decode(caCaseId, Charset.defaultCharset());
|
|
|
+ HashMap<String, String> map = chenAnService.userAndCaseInfo(decode1, decode2);
|
|
|
String redirectUrl = String.format("%s/mix3d/#/home/"+map.get("caseId")+"?token="+ map.get("token"), clientIp);
|
|
|
|
|
|
Cookie tokenCookie = new Cookie("token", map.get("token"));
|