9 changed files with 763 additions and 2 deletions
@ -0,0 +1,333 @@ |
|||
package com.zdxt.code.domain; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 民生诉求工单DTO |
|||
*/ |
|||
public class MssqAddOrder extends MssqBaseDomain { |
|||
|
|||
/** |
|||
* 诉求标题 |
|||
*/ |
|||
private String requestTopic; |
|||
/** |
|||
* 诉求内容 |
|||
*/ |
|||
private String requestContent; |
|||
|
|||
/** |
|||
* 联系人姓名 |
|||
*/ |
|||
private String contactName; |
|||
|
|||
/** |
|||
* 联系人电话 |
|||
*/ |
|||
private String contactTel; |
|||
|
|||
/** |
|||
* 证件类型:字典参数类型:zjlx |
|||
*/ |
|||
private String certType; |
|||
|
|||
/** |
|||
* 证件号码 |
|||
*/ |
|||
private String certCode; |
|||
|
|||
/** |
|||
* 联系地址 |
|||
*/ |
|||
private String contactAddress; |
|||
/** |
|||
* 事发地址 |
|||
*/ |
|||
private String requestArea; |
|||
|
|||
/** |
|||
* 事发详细地址X坐标 |
|||
*/ |
|||
private String addressX; |
|||
|
|||
/** |
|||
* 事发详细地址Y坐标 |
|||
*/ |
|||
private String addressY; |
|||
/** |
|||
* 来源渠道:字典参数类型:sqly |
|||
*/ |
|||
private Integer requestFrom; |
|||
|
|||
/** |
|||
* 公开意向 y—公开 n—不公开 |
|||
*/ |
|||
private String pubIntent; |
|||
|
|||
/** |
|||
* 工单类型:字典参数类型:sqlx |
|||
*/ |
|||
private Integer orderType; |
|||
|
|||
/** |
|||
* 是否党员: 1: 是; 0: 否 |
|||
*/ |
|||
private Integer isParty; |
|||
/** |
|||
* 第三方系统工单id |
|||
*/ |
|||
private String extendId; |
|||
|
|||
/** |
|||
* 事发地址所属区 |
|||
*/ |
|||
private String area; |
|||
|
|||
/** |
|||
* 事发地址所属街道 |
|||
*/ |
|||
private String street; |
|||
|
|||
/** |
|||
* 是否保密: 1: 是; 0: 否 |
|||
*/ |
|||
private Integer isSecrecy; |
|||
/** |
|||
* 事项编码 |
|||
*/ |
|||
private String actCode; |
|||
|
|||
/** |
|||
* 诉求分类(个人/商事主体): 1: 个人; 2: 商事主体 |
|||
*/ |
|||
private String formUserNature; |
|||
/** |
|||
* 涉事主体 |
|||
*/ |
|||
private String thingSubject; |
|||
|
|||
/** |
|||
* 涉事主体地址(如:**区**街道**) |
|||
*/ |
|||
private String subjectAddress; |
|||
|
|||
/** |
|||
* 上传附件数据集 |
|||
*/ |
|||
private List<FileData> fileDatas; |
|||
|
|||
|
|||
private class FileData{ |
|||
/** |
|||
* 附件名称 |
|||
*/ |
|||
private String fileName; |
|||
/** |
|||
* 附件数据流,需要转成Base64编码格式 |
|||
*/ |
|||
private String fileBytes; |
|||
|
|||
public String getFileName() { |
|||
return fileName; |
|||
} |
|||
|
|||
public void setFileName(String fileName) { |
|||
this.fileName = fileName; |
|||
} |
|||
|
|||
public String getFileBytes() { |
|||
return fileBytes; |
|||
} |
|||
|
|||
public void setFileBytes(String fileBytes) { |
|||
this.fileBytes = fileBytes; |
|||
} |
|||
} |
|||
|
|||
|
|||
public String getRequestTopic() { |
|||
return requestTopic; |
|||
} |
|||
|
|||
public void setRequestTopic(String requestTopic) { |
|||
this.requestTopic = requestTopic; |
|||
} |
|||
|
|||
public String getRequestContent() { |
|||
return requestContent; |
|||
} |
|||
|
|||
public void setRequestContent(String requestContent) { |
|||
this.requestContent = requestContent; |
|||
} |
|||
|
|||
public String getContactName() { |
|||
return contactName; |
|||
} |
|||
|
|||
public void setContactName(String contactName) { |
|||
this.contactName = contactName; |
|||
} |
|||
|
|||
public String getContactTel() { |
|||
return contactTel; |
|||
} |
|||
|
|||
public void setContactTel(String contactTel) { |
|||
this.contactTel = contactTel; |
|||
} |
|||
|
|||
public String getCertType() { |
|||
return certType; |
|||
} |
|||
|
|||
public void setCertType(String certType) { |
|||
this.certType = certType; |
|||
} |
|||
|
|||
public String getCertCode() { |
|||
return certCode; |
|||
} |
|||
|
|||
public void setCertCode(String certCode) { |
|||
this.certCode = certCode; |
|||
} |
|||
|
|||
public String getContactAddress() { |
|||
return contactAddress; |
|||
} |
|||
|
|||
public void setContactAddress(String contactAddress) { |
|||
this.contactAddress = contactAddress; |
|||
} |
|||
|
|||
public String getRequestArea() { |
|||
return requestArea; |
|||
} |
|||
|
|||
public void setRequestArea(String requestArea) { |
|||
this.requestArea = requestArea; |
|||
} |
|||
|
|||
public String getAddressX() { |
|||
return addressX; |
|||
} |
|||
|
|||
public void setAddressX(String addressX) { |
|||
this.addressX = addressX; |
|||
} |
|||
|
|||
public String getAddressY() { |
|||
return addressY; |
|||
} |
|||
|
|||
public void setAddressY(String addressY) { |
|||
this.addressY = addressY; |
|||
} |
|||
|
|||
public Integer getRequestFrom() { |
|||
return requestFrom; |
|||
} |
|||
|
|||
public void setRequestFrom(Integer requestFrom) { |
|||
this.requestFrom = requestFrom; |
|||
} |
|||
|
|||
public String getPubIntent() { |
|||
return pubIntent; |
|||
} |
|||
|
|||
public void setPubIntent(String pubIntent) { |
|||
this.pubIntent = pubIntent; |
|||
} |
|||
|
|||
public Integer getOrderType() { |
|||
return orderType; |
|||
} |
|||
|
|||
public void setOrderType(Integer orderType) { |
|||
this.orderType = orderType; |
|||
} |
|||
|
|||
public Integer getIsParty() { |
|||
return isParty; |
|||
} |
|||
|
|||
public void setIsParty(Integer isParty) { |
|||
this.isParty = isParty; |
|||
} |
|||
|
|||
public String getExtendId() { |
|||
return extendId; |
|||
} |
|||
|
|||
public void setExtendId(String extendId) { |
|||
this.extendId = extendId; |
|||
} |
|||
|
|||
public String getArea() { |
|||
return area; |
|||
} |
|||
|
|||
public void setArea(String area) { |
|||
this.area = area; |
|||
} |
|||
|
|||
public String getStreet() { |
|||
return street; |
|||
} |
|||
|
|||
public void setStreet(String street) { |
|||
this.street = street; |
|||
} |
|||
|
|||
public Integer getIsSecrecy() { |
|||
return isSecrecy; |
|||
} |
|||
|
|||
public void setIsSecrecy(Integer isSecrecy) { |
|||
this.isSecrecy = isSecrecy; |
|||
} |
|||
|
|||
public String getActCode() { |
|||
return actCode; |
|||
} |
|||
|
|||
public void setActCode(String actCode) { |
|||
this.actCode = actCode; |
|||
} |
|||
|
|||
public String getFormUserNature() { |
|||
return formUserNature; |
|||
} |
|||
|
|||
public void setFormUserNature(String formUserNature) { |
|||
this.formUserNature = formUserNature; |
|||
} |
|||
|
|||
public String getThingSubject() { |
|||
return thingSubject; |
|||
} |
|||
|
|||
public void setThingSubject(String thingSubject) { |
|||
this.thingSubject = thingSubject; |
|||
} |
|||
|
|||
public String getSubjectAddress() { |
|||
return subjectAddress; |
|||
} |
|||
|
|||
public void setSubjectAddress(String subjectAddress) { |
|||
this.subjectAddress = subjectAddress; |
|||
} |
|||
|
|||
public List<FileData> getFileDatas() { |
|||
return fileDatas; |
|||
} |
|||
|
|||
public void setFileDatas(List<FileData> fileDatas) { |
|||
this.fileDatas = fileDatas; |
|||
} |
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,65 @@ |
|||
package com.zdxt.code.domain; |
|||
|
|||
public class MssqBaseDomain { |
|||
|
|||
/** |
|||
* 认证token |
|||
*/ |
|||
private String accessToken; |
|||
/** |
|||
* 分配的appId |
|||
*/ |
|||
private String appId; |
|||
/** |
|||
* 请求头携带的appId |
|||
*/ |
|||
private String gatewayAppId; |
|||
/** |
|||
* 请求头携带的签名 |
|||
*/ |
|||
private String gatewaySig; |
|||
/** |
|||
* 请求头携带的当前时间的时间戳 |
|||
*/ |
|||
private String gatewayRtime; |
|||
|
|||
public String getAccessToken() { |
|||
return accessToken; |
|||
} |
|||
|
|||
public void setAccessToken(String accessToken) { |
|||
this.accessToken = accessToken; |
|||
} |
|||
|
|||
public String getAppId() { |
|||
return appId; |
|||
} |
|||
|
|||
public void setAppId(String appId) { |
|||
this.appId = appId; |
|||
} |
|||
|
|||
public String getGatewayAppId() { |
|||
return gatewayAppId; |
|||
} |
|||
|
|||
public void setGatewayAppId(String gatewayAppId) { |
|||
this.gatewayAppId = gatewayAppId; |
|||
} |
|||
|
|||
public String getGatewaySig() { |
|||
return gatewaySig; |
|||
} |
|||
|
|||
public void setGatewaySig(String gatewaySig) { |
|||
this.gatewaySig = gatewaySig; |
|||
} |
|||
|
|||
public String getGatewayRtime() { |
|||
return gatewayRtime; |
|||
} |
|||
|
|||
public void setGatewayRtime(String gatewayRtime) { |
|||
this.gatewayRtime = gatewayRtime; |
|||
} |
|||
} |
|||
@ -0,0 +1,293 @@ |
|||
package com.zdxt.code.utils; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.codec.binary.Base64; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.crypto.*; |
|||
import javax.crypto.spec.GCMParameterSpec; |
|||
import javax.crypto.spec.SecretKeySpec; |
|||
import java.io.*; |
|||
import java.net.ConnectException; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.security.InvalidAlgorithmParameterException; |
|||
import java.security.InvalidKeyException; |
|||
import java.security.NoSuchAlgorithmException; |
|||
import java.security.SecureRandom; |
|||
|
|||
/** |
|||
* 民生诉求氢气 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public class ServiceInvocation { |
|||
|
|||
/** |
|||
* 密钥生成【核心网关】 |
|||
* |
|||
* @param appKey 授权码 |
|||
* @param appId 请求者标识 |
|||
* @param rtime 请求时间戳 |
|||
* @return 加密后的sign |
|||
*/ |
|||
public static String gatewaySignEncode(String appId, String appKey, String rtime) throws Exception { |
|||
String inputString = appId + rtime; |
|||
return encode(appKey, inputString); |
|||
} |
|||
|
|||
/** |
|||
* 应用公钥appKey进行HMAC-SHA256计算并进行base64转码产生签名 |
|||
* |
|||
* @param appKey |
|||
* @param inputStr |
|||
* @return |
|||
* @throws NoSuchAlgorithmException |
|||
* @throws UnsupportedEncodingException |
|||
* @throws InvalidKeyException |
|||
*/ |
|||
private static String encode(String appKey, String inputStr) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { |
|||
String sign; |
|||
Mac hmacSha256 = Mac.getInstance("HmacSHA256"); |
|||
byte[] keyBytes = appKey.getBytes("UTF-8"); |
|||
hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, "HmacSHA256")); |
|||
byte[] hmacSha256Bytes = hmacSha256.doFinal(inputStr.getBytes("UTF-8")); |
|||
sign = new String(Base64.encodeBase64(hmacSha256Bytes), "UTF-8"); |
|||
return sign; |
|||
} |
|||
|
|||
/** |
|||
* 解密 解密过程: 1.构造密钥生成器 2.根据ecnodeRules规则初始化密钥生成器 3.产生密钥 4.创建和初始化密码器 |
|||
* 5.将加密后的字符串反纺成byte[]数组 6.将加密内容解密 |
|||
*/ |
|||
public static String gatewayAesDecode(String encryptPass, String base64Content) { |
|||
byte[] content = cn.hutool.core.codec.Base64.decode(base64Content); |
|||
if (content.length < 28) { |
|||
throw new IllegalArgumentException(); |
|||
} else { |
|||
GCMParameterSpec params = new GCMParameterSpec(128, content, 0, 12); |
|||
|
|||
try { |
|||
Cipher cipher = Cipher.getInstance("AES/GCM/PKCS5Padding"); |
|||
cipher.init(2, getSecretKey(encryptPass), params); |
|||
byte[] decryptData = cipher.doFinal(content, 12, content.length - 12); |
|||
return new String(decryptData); |
|||
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException | InvalidKeyException var6) { |
|||
log.error("解密失败:{}", var6.getMessage()); |
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
|
|||
private static SecretKeySpec getSecretKey(String encryptPass) throws NoSuchAlgorithmException { |
|||
KeyGenerator kg = KeyGenerator.getInstance("AES"); |
|||
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); |
|||
secureRandom.setSeed(encryptPass.getBytes()); |
|||
kg.init(128, secureRandom); |
|||
SecretKey secretKey = kg.generateKey(); |
|||
return new SecretKeySpec(secretKey.getEncoded(), "AES"); |
|||
} |
|||
|
|||
/** |
|||
* http请求过程 |
|||
* |
|||
* @param requestUrl 请求的url,在服务调用过程中url为获取token的url(格式为ip:port/auth/token)或者是服务调用的url |
|||
* @param requestMethod 获取token时,请求方法为POST;调用服务是请求方法依据服务注册时定义。 |
|||
* @param appIdorSecretKey 获取token时该参数为appId;抵用服务时该参数为SecretKey |
|||
* @param currTime 该参数为当前时间 |
|||
* @param sign 该参数为head参数gateway_sig,由秘钥生成方法gatewaySignEncode生成。 |
|||
* @return |
|||
*/ |
|||
public static JSONObject httpRequest(String requestUrl, String requestMethod, String reqBody, String appIdorSecretKey, |
|||
String currTime, String sign) throws Exception { |
|||
JSONObject jsonObject; |
|||
StringBuffer buffer = new StringBuffer(); |
|||
InputStream inputStream = null; |
|||
try { |
|||
System.setProperty("http.agent", "Chrome"); |
|||
URL url = new URL(requestUrl); |
|||
HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection(); |
|||
httpUrlConnection.setRequestMethod(requestMethod); |
|||
httpUrlConnection.setDoOutput(true); |
|||
httpUrlConnection.setDoInput(true); |
|||
httpUrlConnection.setRequestProperty("gateway_appid", appIdorSecretKey); |
|||
httpUrlConnection.setRequestProperty("gateway_rtime", currTime); |
|||
httpUrlConnection.setRequestProperty("gateway_sig", sign); |
|||
if ("POST".equalsIgnoreCase(requestMethod) && StringUtils.isNotBlank(reqBody)) { |
|||
httpUrlConnection.setRequestProperty("Content-Type", "application/json"); |
|||
httpUrlConnection.setRequestProperty("Accept", "application/json"); |
|||
OutputStream os = httpUrlConnection.getOutputStream(); |
|||
OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8"); |
|||
osw.write(reqBody); |
|||
osw.flush(); |
|||
osw.close(); |
|||
} |
|||
httpUrlConnection.connect(); |
|||
inputStream = httpUrlConnection.getInputStream(); |
|||
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8"); |
|||
BufferedReader bufferReader = new BufferedReader(inputStreamReader); |
|||
String str; |
|||
while ((str = bufferReader.readLine()) != null) { |
|||
buffer.append(str); |
|||
} |
|||
String buffer2str = buffer.toString(); |
|||
jsonObject = JSONObject.parseObject(buffer2str); |
|||
bufferReader.close(); |
|||
inputStreamReader.close(); |
|||
inputStream.close(); |
|||
inputStream = null; |
|||
httpUrlConnection.disconnect(); |
|||
} catch (ConnectException ce) { |
|||
log.error("Server connect time out!",ce); |
|||
System.out.println("Server connect time out!"); |
|||
throw new ConnectException(); |
|||
} catch (IOException ioe) { |
|||
log.error("ioexception request error",ioe); |
|||
throw new IOException(); |
|||
} catch (Exception e) { |
|||
log.error("http request error!",e); |
|||
throw e; |
|||
} finally { |
|||
try { |
|||
if (inputStream != null) { |
|||
inputStream.close(); |
|||
} |
|||
} catch (IOException ioe) { |
|||
ioe.printStackTrace(); |
|||
} |
|||
} |
|||
return jsonObject; |
|||
} |
|||
private static JSONObject httpRequestForInterface(String requestUrl, String requestMethod, String reqBody, String appIdorSecretKey, |
|||
String currTime, String sign) throws Exception { |
|||
JSONObject jsonObject=new JSONObject(); |
|||
StringBuffer buffer = new StringBuffer(); |
|||
InputStream inputStream = null; |
|||
try { |
|||
System.setProperty("http.agent", "Chrome"); |
|||
URL url = new URL(requestUrl); |
|||
HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection(); |
|||
httpUrlConnection.setRequestMethod(requestMethod); |
|||
httpUrlConnection.setDoOutput(true); |
|||
httpUrlConnection.setDoInput(true); |
|||
httpUrlConnection.setRequestProperty("gateway_appid", appIdorSecretKey); |
|||
httpUrlConnection.setRequestProperty("gateway_rtime", currTime); |
|||
httpUrlConnection.setRequestProperty("gateway_sig", sign); |
|||
if ("POST".equalsIgnoreCase(requestMethod) && StringUtils.isNotBlank(reqBody)) { |
|||
httpUrlConnection.setRequestProperty("Content-Type", "application/json"); |
|||
httpUrlConnection.setRequestProperty("Accept", "application/json"); |
|||
OutputStream os = httpUrlConnection.getOutputStream(); |
|||
OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8"); |
|||
osw.write(reqBody); |
|||
osw.flush(); |
|||
osw.close(); |
|||
} |
|||
httpUrlConnection.connect(); |
|||
inputStream = httpUrlConnection.getInputStream(); |
|||
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8"); |
|||
BufferedReader bufferReader = new BufferedReader(inputStreamReader); |
|||
String str; |
|||
while ((str = bufferReader.readLine()) != null) { |
|||
buffer.append(str); |
|||
} |
|||
String buffer2str = buffer.toString(); |
|||
|
|||
jsonObject.put("code",httpUrlConnection.getResponseCode()); |
|||
jsonObject.put("result",buffer2str); |
|||
bufferReader.close(); |
|||
inputStreamReader.close(); |
|||
inputStream.close(); |
|||
inputStream = null; |
|||
httpUrlConnection.disconnect(); |
|||
} catch (ConnectException ce) { |
|||
log.error("Server connect time out!",ce); |
|||
throw new ConnectException(); |
|||
} catch (IOException ioe) { |
|||
log.error("ioexception request error",ioe); |
|||
throw new IOException(); |
|||
} catch (Exception e) { |
|||
log.error("http request error!",e); |
|||
throw e; |
|||
} finally { |
|||
try { |
|||
if (inputStream != null) { |
|||
inputStream.close(); |
|||
} |
|||
} catch (IOException ioe) { |
|||
ioe.printStackTrace(); |
|||
} |
|||
} |
|||
return jsonObject; |
|||
} |
|||
|
|||
private static void test(String id, String code,String invokingServiceRequestMethod, String invokingServiceUrl,String reqBodyForUrl) throws Exception { |
|||
// 参数设定
|
|||
String appId = id; |
|||
String appKey = code; |
|||
String currTime = System.currentTimeMillis() + ""; |
|||
//服务聚合获取tokenUrl
|
|||
String generateTokenUrl = "http://10.132.108.3/mssqApi/auth/token"; |
|||
// 服务调用的请求方法
|
|||
// 1.获取本地签名
|
|||
String tokenSign = gatewaySignEncode(appId, appKey, currTime); |
|||
// 2.调用获取token接口
|
|||
JSONObject jsonObject = httpRequest(generateTokenUrl, "POST", "", appId, currTime, tokenSign); |
|||
JSONObject jsonObjectBody = JSONObject.parseObject(jsonObject.getString("body")); |
|||
if (jsonObjectBody != null) { |
|||
String accessToken = jsonObjectBody.getString("access_token"); |
|||
// 3.在获得服务调用秘钥access_token后,根据自己的appKey使用AES解密算法对返回值进行解密,最终获取签名密钥secretKey
|
|||
String secretKey = gatewayAesDecode(appKey, accessToken); |
|||
// 4.获取本地签名
|
|||
String sign = gatewaySignEncode(appId, secretKey, currTime); |
|||
//4.调用服务接口
|
|||
JSONObject serviceJsonData = httpRequestForInterface(invokingServiceUrl, invokingServiceRequestMethod, reqBodyForUrl, appId, currTime, sign); |
|||
String codeValue = serviceJsonData.getString("code"); |
|||
if (codeValue.equals("200")) { |
|||
log.info("请求url:{},响应成功!",invokingServiceUrl); |
|||
} else { |
|||
log.error("请求url:{},响应失败!",invokingServiceUrl); |
|||
} |
|||
} else { |
|||
} |
|||
} |
|||
|
|||
public static void main(String[] args) throws Exception { |
|||
// 参数设定
|
|||
String appId = "67a83c8a136346cd98f844359902a23c"; |
|||
String appKey = "NjdhODNjOGExMzYzNDZjZDk4Zjg0NDM1OTkwMmEyM2M6TXNzcTIwMjQ="; |
|||
/*String appId = "ea5acb3cceb24365b415e9affa560d49"; |
|||
String appKey = "ZWE1YWNiM2NjZWIyNDM2NWI0MTVlOWFmZmE1NjBkNDk6eDEyMzQ1Ng==";*/ |
|||
|
|||
String currTime = String.valueOf(System.currentTimeMillis()); |
|||
//服务聚合获取tokenUrl
|
|||
String generateTokenUrl = "http://10.132.108.3/mssqApi/auth/token"; |
|||
String invokingServiceUrl="http://10.132.108.3/mssqApi/auth/token"; |
|||
String invokingServiceRequestMethod="POST"; |
|||
// 服务调用的请求方法
|
|||
// 1.获取本地签名
|
|||
String tokenSign = gatewaySignEncode(appId, appKey, currTime); |
|||
// 2.调用获取token接口
|
|||
JSONObject jsonObject = httpRequest(generateTokenUrl, "POST", "", appId, currTime, tokenSign); |
|||
JSONObject jsonObjectBody = JSONObject.parseObject(jsonObject.getString("body")); |
|||
System.out.println(jsonObject); |
|||
if (jsonObjectBody != null) { |
|||
String accessToken = jsonObjectBody.getString("access_token"); |
|||
// 3.在获得服务调用秘钥access_token后,根据自己的appKey使用AES解密算法对返回值进行解密,最终获取签名密钥secretKey
|
|||
String secretKey = gatewayAesDecode(appKey, accessToken); |
|||
// 4.获取本地签名
|
|||
String sign = gatewaySignEncode(appId, secretKey, currTime); |
|||
// //4.调用服务接口
|
|||
JSONObject serviceJsonData = httpRequestForInterface(invokingServiceUrl, invokingServiceRequestMethod, "", appId, currTime, sign); |
|||
// String codeValue = serviceJsonData.getString("code");
|
|||
// if (codeValue.equals("200")) {
|
|||
// log.info("请求url:{},响应成功!",invokingServiceUrl);
|
|||
// } else {
|
|||
// log.error("请求url:{},响应失败!",invokingServiceUrl);
|
|||
// }
|
|||
} else {} |
|||
// test(appId,appKey,"post","","");
|
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue