|
@@ -3,12 +3,12 @@ package com.fdkk.sxz.webApi.controller;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkk.sxz.annotation.auth.NoAuthentication;
|
|
|
import com.fdkk.sxz.annotation.log.AroundLog;
|
|
|
import com.fdkk.sxz.base.Result;
|
|
|
import com.fdkk.sxz.util.CreateObjUtil;
|
|
|
-import com.fdkk.sxz.util.OkHttpUtils;
|
|
|
import com.fdkk.sxz.util.SnowIdUtil;
|
|
|
import com.fdkk.sxz.util.UploadToOssUtil;
|
|
|
import com.fdkk.sxz.vo.request.RequestForwardPost;
|
|
@@ -27,8 +27,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.File;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author Xiewj
|
|
@@ -91,10 +89,12 @@ public class OfflineController {
|
|
|
if (ObjectUtil.isNotNull(request.getHeader("token")) && StrUtil.isNotEmpty(request.getHeader("token"))) {
|
|
|
String url = mainUrl + "api/sso/user/checkToken";
|
|
|
OfflineController.log.info("验证token的url:{}", url);
|
|
|
- Map<String, String> header = new HashMap<>();
|
|
|
- header.put("token", request.getHeader("token"));
|
|
|
-
|
|
|
- JSONObject resObject = OkHttpUtils.httpPostJson(url, null, header);
|
|
|
+ String res = HttpRequest.post(localNetworkUrl + dto.getAction())
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .header("token", request.getHeader("token"))
|
|
|
+ .execute().body();
|
|
|
+ OfflineController.log.info("checkToken返回:{}", res);
|
|
|
+ JSONObject resObject = JSONObject.parseObject(res);
|
|
|
if (null != resObject) {
|
|
|
if (resObject.containsKey("code")) {
|
|
|
int code = resObject.getInteger("code");
|
|
@@ -104,9 +104,11 @@ public class OfflineController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- String checkResult = OkHttpUtils.httpPostJson(localNetworkUrl + dto.getAction(), dto.getParams());
|
|
|
- return JSONObject.toJSONString(checkResult);
|
|
|
+ String result2 = HttpRequest.post(localNetworkUrl + dto.getAction())
|
|
|
+ .body(JSONObject.parseObject(dto.getParams()).toJSONString())
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .execute().body();
|
|
|
+ return JSONObject.parseObject(result2).toJSONString();
|
|
|
|
|
|
}
|
|
|
}
|