'提交代码'

dev-discount
= 3 years ago
parent 37ce1c4e19
commit 4185b7916b
  1. 17
      hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java

@ -74,24 +74,23 @@ public class HuiLianTongConfig {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("token", "a::57D9BBA185484EAD82737168B28EDA62"); map.put("token", "a::57D9BBA185484EAD82737168B28EDA62");
// jsonData 加密后,再转码
map.put("jsonData", get3DESEncryptECB(JSON.toJSONString(param), appKey)); map.put("jsonData", get3DESEncryptECB(JSON.toJSONString(param), appKey));
StringJoiner joiner = new StringJoiner("&"); StringJoiner joiner = new StringJoiner("&");
joiner.add("jsonData=" + MapUtils.getString(map, "jsonData")); joiner.add("jsonData=" + JSON.toJSONString(param));
joiner.add("secretKey=" + appSecret); joiner.add("secretKey=" + appSecret);
// 签名
map.put("sign", md5Capital(joiner.toString())); map.put("sign", md5Capital(joiner.toString()));
map.put("jsonData", URLEncoder.encode(MapUtils.getString(map, "jsonData"),"UTF-8"));
Map<String,Object> map1 = new HashMap<>(); 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"); 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)); map1.put("from", "");
return HttpsUtils.doSmsPost("https://gzapitest.deepermobile.com.cn:441/coupon/api/coupon_corp/couJointDist?token="+MapUtils.getString(map,"token")+"&jsonData=", map1, new HashMap<>()); return HttpsUtils.doSmsPost("https://gzapitest.deepermobile.com.cn:441/coupon/api/coupon_corp/couJointDist?"+fromStr, map1, new HashMap<>());
} }
public static void main(String[] args) { public static void main(String[] args) throws UnsupportedEncodingException {
System.out.println(get3DESDecryptECB("855UlANuLluq2IOR6iFT+AWY11mCkSSo9+EYFPhhYhJpzJhR5RXPjFfiW+3gzLoB9MajturQx0kmEg6m3S+HU+E2IaytBw68KrGZjPSHwesUxT2iGb6Php9uSFq6UfX+mAIMZnFP43L6sCeyfyalZhEsshwKGgAfuSCwATDJR3eKxzqRTACe4vvCZWhpFh8Sh8GmsPFYilQOce2mcXLWY5G1qDkfq4c2225ANtpFpnCuZHcW+JP0pA==", "FA28E95ACABFA4B2B8E25857437B07F1")); String decode = URLDecoder.decode("jkE2O4ZKfL6F2IWQyf01oNXbCY%252FM1xZ7OP1%252BJVeXCfpWZgaFjIjZaVTPdJHkxRUlPJikskS6rQs1OMbMiu9ZgKaHftjA%252BJ7f%252BSFzsOPDPpnACegOBBR%252BjN5ZxOH%252FDPe9pOoGA53gBbAIEuqkDlqirxJyNR%252FJHip%252BoAQ2%252FN00pD1pIyvBqGsks%252Bx0w2w7GzYGcacU7iQrVHPhcFdyGFJUhWOaBMhRgNi0lJw9Pjt8xuY5IXwAjgk0EQ%253D%253D", "UTF-8");
System.out.println(decode);
System.out.println(get3DESDecryptECB(decode, "FA28E95ACABFA4B2B8E25857437B07F1"));
} }
public static String get3DESEncryptECB(String src,String secretKey) { public static String get3DESEncryptECB(String src,String secretKey) {

Loading…
Cancel
Save