|
@@ -24,12 +24,15 @@ import lombok.Builder;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NoArgsConstructor;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
|
|
+import org.apache.http.impl.client.LaxRedirectStrategy;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.util.MultiValueMap;
|
|
import org.springframework.util.MultiValueMap;
|
|
@@ -228,6 +231,14 @@ public class OaFlow {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
|
|
|
+ private RestTemplate getNewRestTemplateWithoutCookie() {
|
|
|
|
|
+ return new RestTemplate(new HttpComponentsClientHttpRequestFactory(
|
|
|
|
|
+ HttpClients.custom()
|
|
|
|
|
+ .disableCookieManagement() // 彻底禁用Cookie,不保存、不携带
|
|
|
|
|
+ .setRedirectStrategy(new LaxRedirectStrategy())
|
|
|
|
|
+ .build()
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public void createOutRepairFlow(IotMaintainDO iotMaintainDO) throws Exception {
|
|
public void createOutRepairFlow(IotMaintainDO iotMaintainDO) throws Exception {
|
|
|
String token = getToken();
|
|
String token = getToken();
|
|
@@ -284,10 +295,13 @@ public class OaFlow {
|
|
|
System.out.println("------------"+JSON.toJSONString(params));
|
|
System.out.println("------------"+JSON.toJSONString(params));
|
|
|
System.out.println(headersOut);
|
|
System.out.println(headersOut);
|
|
|
|
|
|
|
|
|
|
+ RestTemplate noCookieRestTemplate = getNewRestTemplateWithoutCookie();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 3. 组合请求头和请求体
|
|
// 3. 组合请求头和请求体
|
|
|
HttpEntity<MultiValueMap<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
|
|
HttpEntity<MultiValueMap<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
|
|
|
// RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
|
|
// RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
|
|
|
- String out = restTemplate.postForObject(outMaintainUrl, requestEntityOut, String.class);
|
|
|
|
|
|
|
+ String out = noCookieRestTemplate.postForObject(outMaintainUrl, requestEntityOut, String.class);
|
|
|
JSONObject outInfo = JSON.parseObject(out);
|
|
JSONObject outInfo = JSON.parseObject(out);
|
|
|
//请求成功
|
|
//请求成功
|
|
|
if (Objects.isNull(outInfo) || !"success".equalsIgnoreCase(String.valueOf(outInfo.get("code")))) {
|
|
if (Objects.isNull(outInfo) || !"success".equalsIgnoreCase(String.valueOf(outInfo.get("code")))) {
|