修改法大大合同请求地址
parent
17c8cb4aad
commit
be19f870dc
|
@ -5,6 +5,8 @@ import aiyh.utils.httpUtil.HttpArgsType;
|
|||
import aiyh.utils.httpUtil.ResponeVo;
|
||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||
import aiyh.utils.zwl.common.ToolUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
@ -16,6 +18,7 @@ import weaver.aiyh_pcn.fadada.entity.FileInfo;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -38,11 +41,17 @@ public class FaDDRequestUtils {
|
|||
private final static ToolUtil TOOL_UTIL = new ToolUtil();
|
||||
|
||||
static {
|
||||
header.put("appId", "100001");
|
||||
String appId = TOOL_UTIL.getSystemParamValue("FDD_appId");
|
||||
if(StringUtils.isNullOrEmpty(appId)){
|
||||
appId = "100001";
|
||||
TOOL_UTIL.writeErrorLog("查询到的FDD_appId为空!");
|
||||
}
|
||||
header.put("appId", appId);
|
||||
header.put("signType", "SHA256");
|
||||
String apiKey = TOOL_UTIL.getSystemParamValue("FDD_apiKey");
|
||||
if(StringUtils.isNullOrEmpty(apiKey)){
|
||||
apiKey = "TulQxnZSRKeHoQfmeZzOUzGn6KpTDkDK";
|
||||
TOOL_UTIL.writeErrorLog("查询到的FDD_apiKey为空!");
|
||||
}
|
||||
header.put("apikey", apiKey);
|
||||
header.put("Content-Type", HttpArgsType.APPLICATION_JSON);
|
||||
|
@ -144,7 +153,7 @@ public class FaDDRequestUtils {
|
|||
header.put("sign", builderSign(data));
|
||||
ResponeVo responeVo = null;
|
||||
try {
|
||||
responeVo = httpUtils.apiPost("https://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/sign/detail/view",
|
||||
responeVo = httpUtils.apiPost("https://apigwaws.porsche-cloudservice.com/env-101/por-econtract/econtract/contract/api/v1/contract/sign/detail/view",
|
||||
data, null);
|
||||
TOOL_UTIL.writeDebuggerLog("查询合同状态:" + JSONObject.toJSONString(data));
|
||||
TOOL_UTIL.writeDebuggerLog(responeVo.getEntityString() + "\n");
|
||||
|
@ -164,22 +173,30 @@ public class FaDDRequestUtils {
|
|||
"&signType=" + header.get("signType") +
|
||||
"×tamp=" + header.get("timestamp");
|
||||
// System.out.println(signStr);
|
||||
String appKey = "L7P59oqA2An0XgJ1LeMN0fRu1";
|
||||
String appKey = TOOL_UTIL.getSystemParamValue("FDD_appKey");
|
||||
if(StringUtils.isNullOrEmpty(appKey)){
|
||||
TOOL_UTIL.writeErrorLog("查询到的FDD_appKey为空!");
|
||||
appKey = "L7P59oqA2An0XgJ1LeMN0fRu1";
|
||||
}
|
||||
TOOL_UTIL.writeErrorLog("app签名:" + appKey);
|
||||
TOOL_UTIL.writeErrorLog("signStr:" + signStr);
|
||||
TOOL_UTIL.writeDebuggerLog("请求头信息:" + JSONObject.toJSONString(header));
|
||||
// String appKey = "L7P59oqA2An0XgJ1LeMN0fRu1";
|
||||
String sha256 = string2SHA256(signStr) + appKey;
|
||||
// System.out.println(sign);
|
||||
return Base64.getEncoder().encodeToString(string2SHA256(sha256).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public static String builderBizContent(Map<String, Object> data) {
|
||||
String jsonString = JSONObject.toJSONString(data);
|
||||
String jsonString = JSONUtil.toJsonStr(data);
|
||||
TOOL_UTIL.writeDebuggerLog("bizContent进行JSON编码:" + jsonString);
|
||||
String encode = null;
|
||||
try {
|
||||
encode = URLEncoder.encode(jsonString, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return Base64.getEncoder().encodeToString(encode.getBytes(StandardCharsets.UTF_8));
|
||||
// encode = URLEncoder.encode(jsonString, "UTF-8");
|
||||
encode = URLUtil.encodeAll(jsonString, StandardCharsets.UTF_8);
|
||||
TOOL_UTIL.writeDebuggerLog("bizContent进行JSON编码后URLEncoder编码:" + encode);
|
||||
String s = Base64.getEncoder().encodeToString(encode.getBytes(StandardCharsets.UTF_8));
|
||||
TOOL_UTIL.writeDebuggerLog("bizContent进行JSON编码后URLEncoder编码后进行base64编码:" + s);
|
||||
return s;
|
||||
}
|
||||
|
||||
private static String string2SHA256(String str) {
|
||||
|
@ -189,10 +206,13 @@ public class FaDDRequestUtils {
|
|||
messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
byte[] hash = messageDigest.digest(str.getBytes(StandardCharsets.UTF_8));
|
||||
encdeStr = Hex.encodeHexString(hash);
|
||||
TOOL_UTIL.writeDebuggerLog("进行SHA-256加密:" + encdeStr);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return encdeStr.toUpperCase();
|
||||
String s = encdeStr.toUpperCase();
|
||||
TOOL_UTIL.writeDebuggerLog("进行SHA-256加密后转为全大写:" + s);
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue