解决账号无法返回kdservice-sessionid
This commit is contained in:
parent
697aad3cd3
commit
a96448fce7
@ -1,6 +1,7 @@
|
|||||||
package com.gatedge.jindie.service.impl;
|
package com.gatedge.jindie.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@ -20,6 +21,8 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,8 +42,8 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
|||||||
private String Primary_Meter="Fid,FBILLNO,FProjectName,FSrcBillNo,FSupplierId.FNumber,FSupplierName,FOpenDate,FPriceStatus,FQuoteDate,FExpiryDate,FContact,FPhone,FMail,FCurrId.FName,FIsIncludedTax,FDATE,FBuyer.FName,FCheckerId,FDocumentStatus";
|
private String Primary_Meter="Fid,FBILLNO,FProjectName,FSrcBillNo,FSupplierId.FNumber,FSupplierName,FOpenDate,FPriceStatus,FQuoteDate,FExpiryDate,FContact,FPhone,FMail,FCurrId.FName,FIsIncludedTax,FDATE,FBuyer.FName,FCheckerId,FDocumentStatus";
|
||||||
private String Detailed_List="FEntity_FEntryID, FMATERIALID.FNumber,FMaterialId.FName, FUnitID.FName,FQty, FPrice, FTaxRate, FTaxPrice,FNote,FPayConditionId.FName";
|
private String Detailed_List="FEntity_FEntryID, FMATERIALID.FNumber,FMaterialId.FName, FUnitID.FName,FQty, FPrice, FTaxRate, FTaxPrice,FNote,FPayConditionId.FName";
|
||||||
|
|
||||||
private String QUERY_DATA_URL="http://1.14.142.111:9090/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
private String QUERY_DATA_URL="http://192.168.61.20:18081/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||||
private String SAVA_DATA_URL="http://1.14.142.111:9090/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
private String SAVA_DATA_URL="http://192.168.61.20:18081/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -215,7 +218,7 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
|||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// String url = "http://1.14.142.111:9090/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
// String url = "http://192.168.61.20:18081/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||||
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
||||||
System.out.println(jsonData);
|
System.out.println(jsonData);
|
||||||
// 发送POST请求
|
// 发送POST请求
|
||||||
@ -233,15 +236,17 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
|||||||
|
|
||||||
public String loginAPI(String apiCookie) {
|
public String loginAPI(String apiCookie) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("acctID", "63e200975197e2");
|
// params.put("acctID", "63e200975197e2");
|
||||||
params.put("Username", "王扶民");
|
params.put("acctID", "639130a0cbb6ae");
|
||||||
|
params.put("Username", "ERP1");
|
||||||
|
// params.put("Username", "王扶民");
|
||||||
params.put("Password", "888888");
|
params.put("Password", "888888");
|
||||||
params.put("Lcid", "2052");
|
params.put("Lcid", "2052");
|
||||||
// 设置请求头信息
|
// 设置请求头信息
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.set("Content-Type", "application/json");
|
headers.set("Content-Type", "application/json");
|
||||||
if (apiCookie != null) {
|
if (apiCookie != null) {
|
||||||
headers.set("kdservice-sessionid", "54f0d8ff-00a7-4db0-992b-cfe9abed566e");
|
headers.set("kdservice-sessionid", "95db4c18-10cd-420c-a0eb-96e2ee2db7f8");
|
||||||
}
|
}
|
||||||
// 设置请求参数
|
// 设置请求参数
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
@ -251,16 +256,25 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
|||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String url = "http://1.14.142.111:9090/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
|
String url = "http://192.168.61.20:18081/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
|
||||||
|
// String url = "http://1.14.142.111:9090/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
|
||||||
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
||||||
|
|
||||||
// 发送POST请求
|
// 发送POST请求
|
||||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
||||||
|
|
||||||
|
HttpHeaders headersResponse = responseEntity.getHeaders();
|
||||||
|
List<String> list = headersResponse.get("Set-Cookie");
|
||||||
// 获取返回信息
|
// 获取返回信息
|
||||||
String response = responseEntity.getBody();
|
String sessionId = null;
|
||||||
Map<String, Object> resultMap = JSON.parseObject(response);
|
String str = list.get(0);
|
||||||
return resultMap.get("KDSVCSessionId").toString();
|
Pattern pattern = Pattern.compile("kdservice-sessionid=(.*?);");
|
||||||
|
Matcher matcher = pattern.matcher(str);
|
||||||
|
if (matcher.find()) {
|
||||||
|
sessionId = matcher.group(1);
|
||||||
|
System.out.println(sessionId); // 输出:d57b692d-9358-4242-a6ee-553d6f6b3b4f
|
||||||
|
}
|
||||||
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,6 +25,8 @@ const routes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
|
mode: 'hash',
|
||||||
|
base: process.env.BASE_URL,
|
||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user