Browse Source

深i企后端接口调用

v2
chenrui 3 years ago
parent
commit
2b824d472d
  1. 2
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/HttpUtil.java
  2. 24
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/IdCardCryptoUtil.java

2
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/HttpUtil.java

@ -178,7 +178,7 @@ public class HttpUtil {
URL uri = new URL(url); URL uri = new URL(url);
HttpURLConnection connection = (HttpURLConnection) uri.openConnection(); HttpURLConnection connection = (HttpURLConnection) uri.openConnection();
connection.setRequestMethod("POST"); connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Type","application/json");
for (Map.Entry<String, Object> entry : heardMap.entrySet()) { for (Map.Entry<String, Object> entry : heardMap.entrySet()) {
// 对value进行相应的操作 // 对value进行相应的操作
connection.setRequestProperty(entry.getKey(), String.valueOf(entry.getValue())); connection.setRequestProperty(entry.getKey(), String.valueOf(entry.getValue()));

24
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/IdCardCryptoUtil.java

@ -41,20 +41,28 @@ public class IdCardCryptoUtil {
String userIdCode = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "1608434855568265217"); String userIdCode = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "1608434855568265217");
String userNameCode = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "汤家荣"); String userNameCode = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "汤家荣");
String secret = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "fed73fcc-0cae-44da-bbae-5a47f9688b4e"); // String secret = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "fed73fcc-0cae-44da-bbae-5a47f9688b4e");
// String phone = IdCardCryptoUtil.symmetricDecryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "0PPEx9wD2DLva7zpWJt8MQ=="); // String phone = IdCardCryptoUtil.symmetricDecryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", "0PPEx9wD2DLva7zpWJt8MQ==");
// System.out.println(userIdCode); // System.out.println(userIdCode);
// System.out.println(phone); // System.out.println(phone);
// System.out.println(userNameCode); // System.out.println(userNameCode);
System.out.println(secret); // System.out.println(secret);
// Map<String,Object> heardMap = new HashMap<>(); Map<String,Object> heardMap = new HashMap<>();
// heardMap.put("x-auth-channel", IdUtil.simpleUUID()); heardMap.put("x-auth-channel", IdUtil.simpleUUID());
// heardMap.put("x-auth-app-code","zfjdm"); heardMap.put("x-auth-app-code","zfjdm");
// String s = IdCardCryptoUtil.httpSendPost("http://egbpub.siqhz.com/egb/api/thirdauth/pub/auth/token?userId=" +userIdCode+ "&userName="+ userNameCode, String s = IdCardCryptoUtil.httpSendPost("http://egbpub.siqhz.com/egb/api/thirdauth/pub/auth/token",userIdCode,userNameCode,"zfjdm");
// "userId= " + userIdCode + "&userName=" + userNameCode, heardMap); System.out.println(s);
// System.out.println(s);
String secret = IdCardCryptoUtil.symmetricEncryptIdCard("eWIzY3BMRVNEQXhvUUlXMA==", s);
Map<String,Object> params = new HashMap<>();
params.put("accessKeySign",secret);
params.put("appCode","zfjdm");
String data = HttpUtil.httpSendPost("http://egbpub.siqhz.com/egb/api/thirdauth/pub/auth/getUserInfo",
JSONObject.toJSONString(params),new HashMap<>());
System.out.println(data);
} }

Loading…
Cancel
Save