|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package com.hai.config; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hai.common.pay.util.sdk.WXPayConstants; |
|
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
@ -14,6 +15,8 @@ import sun.misc.BASE64Encoder; |
|
|
|
|
import javax.crypto.Cipher; |
|
|
|
|
import javax.crypto.spec.SecretKeySpec; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.net.URLDecoder; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.security.MessageDigest; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
@ -33,11 +36,64 @@ public class HuiLianTongConfig { |
|
|
|
|
*/ |
|
|
|
|
public static JSONObject getToken() throws Exception { |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("appNo", "gzhltcs"); |
|
|
|
|
map.put("appKey", MD5Util.encode("3SCg%2BNnjR54YSUWM2iKgb5Hmdqg0ze4ciZ5kUTzVduWgasPdO3g5egbLYZMAIA3obS7f6Q7hycqkEBNQ2fx8i5qlGAoZcYtiqdBrofYPtqXpLexLrhg%2Bcqti%2BcpOd0xDc2VWEWvFJbxJ1%2Fd82A9x9hg2kYV7CTK9jdZsDL1eoZln0lcCuuaqYpTsfCnZ9pi86jC6rBii4POp4YOHITOA4ryGQGwzoQQt".getBytes())); |
|
|
|
|
map.put("appNo", "guizhouhltcs"); |
|
|
|
|
map.put("appKey", MD5Util.encode("g%2BNnjR54YSUWM2iKg%2Fd82A9x9hg2kYV7".getBytes())); |
|
|
|
|
return HttpsUtils.doPost("https://gzapitest.deepermobile.com.cn:441/api/api/auth/getAccessToken", JSON.toJSONString(map)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static JSONObject getCorpCouTypes() throws Exception { |
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("token", "a::57D9BBA185484EAD82737168B28EDA62"); |
|
|
|
|
map.put("jsonData", get3DESEncryptECB(JSON.toJSONString(param), "FA28E95ACABFA4B2B8E25857437B07F1")); |
|
|
|
|
StringJoiner urlParamStr = new StringJoiner("&"); |
|
|
|
|
urlParamStr.add(String.format("jsonData=%s", param)); |
|
|
|
|
urlParamStr.add(String.format("secretKey=%s","FA28E95ACABFA4B2B8E25857437B07F1")); |
|
|
|
|
map.put("sign", md5Capital(urlParamStr.toString())); |
|
|
|
|
return HttpsUtils.doPost("https://gzapitest.deepermobile.com.cn:441/coupon/api/coupon_corp/getCorpCouTypes", JSON.toJSONString(map)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static JSONObject couJointDist() throws Exception { |
|
|
|
|
// 券列表
|
|
|
|
|
List<Map<String,Object>> objectList = new ArrayList<>(); |
|
|
|
|
Map<String,Object> object = new HashMap<>(); |
|
|
|
|
object.put("couTypeCode", "20JY000251"); |
|
|
|
|
object.put("distCouCount", 1); |
|
|
|
|
objectList.add(object); |
|
|
|
|
|
|
|
|
|
// 参数
|
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
param.put("coupons", objectList); |
|
|
|
|
param.put("phone", "17726395120"); |
|
|
|
|
param.put("thirdUserId", "oArhO6XxKSvjI9wLP3cTK-iSG8yY"); |
|
|
|
|
param.put("orderNo", "HF"+new Date().getTime()); |
|
|
|
|
param.put("distOuCode", "guizhouhltcs"); |
|
|
|
|
|
|
|
|
|
String appKey = "g%2BNnjR54YSUWM2iKg%2Fd82A9x9hg2kYV7"; |
|
|
|
|
String appSecret = "FA28E95ACABFA4B2B8E25857437B07F1"; |
|
|
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("token", "a::57D9BBA185484EAD82737168B28EDA62"); |
|
|
|
|
// jsonData 加密后,再转码
|
|
|
|
|
map.put("jsonData", get3DESEncryptECB(JSON.toJSONString(param), appKey)); |
|
|
|
|
|
|
|
|
|
StringJoiner joiner = new StringJoiner("&"); |
|
|
|
|
joiner.add("jsonData=" + MapUtils.getString(map, "jsonData")); |
|
|
|
|
joiner.add("secretKey=" + appSecret); |
|
|
|
|
// 签名
|
|
|
|
|
map.put("sign", md5Capital(joiner.toString())); |
|
|
|
|
|
|
|
|
|
map.put("jsonData", URLEncoder.encode(MapUtils.getString(map, "jsonData"),"UTF-8")); |
|
|
|
|
Map<String,Object> map1 = new HashMap<>(); |
|
|
|
|
//String fromStr = "token="+MapUtils.getString(map, "token")+"&sign=" + MapUtils.getString(map, "sign")+"&jsonData=" + URLEncoder.encode(MapUtils.getString(map, "jsonData"),"UTF-8");
|
|
|
|
|
map1.put("from", JSON.toJSONString(map)); |
|
|
|
|
return HttpsUtils.doSmsPost("https://gzapitest.deepermobile.com.cn:441/coupon/api/coupon_corp/couJointDist?token="+MapUtils.getString(map,"token")+"&jsonData=", map1, new HashMap<>()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
System.out.println(get3DESDecryptECB("855UlANuLluq2IOR6iFT+AWY11mCkSSo9+EYFPhhYhJpzJhR5RXPjFfiW+3gzLoB9MajturQx0kmEg6m3S+HU+E2IaytBw68KrGZjPSHwesUxT2iGb6Php9uSFq6UfX+mAIMZnFP43L6sCeyfyalZhEsshwKGgAfuSCwATDJR3eKxzqRTACe4vvCZWhpFh8Sh8GmsPFYilQOce2mcXLWY5G1qDkfq4c2225ANtpFpnCuZHcW+JP0pA==", "FA28E95ACABFA4B2B8E25857437B07F1")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String get3DESEncryptECB(String src,String secretKey) { |
|
|
|
|
try { |
|
|
|
|
Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding"); |
|
|
|
|