diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index f74acce0..f418c399 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -222,7 +222,7 @@ public class HighTestController { @ApiOperation(value = "测试") public ResponseData test3() { try { - return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.queryBalance()); + return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.queryCardInfo()); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); diff --git a/hai-service/src/main/java/com/hai/common/security/DesUtil.java b/hai-service/src/main/java/com/hai/common/security/DesUtil.java index a7662e44..64ccb4fd 100644 --- a/hai-service/src/main/java/com/hai/common/security/DesUtil.java +++ b/hai-service/src/main/java/com/hai/common/security/DesUtil.java @@ -251,7 +251,8 @@ public class DesUtil { /*String s = encode("中国", Charset.forName("UTF-8"),"12345678"); System.out.println(s);*/ - String data = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDwYfnUdBVz6Kj4HS2oCA1TTiqJkCUIYa5ckMhJeByBCAMsqu21LmFjb/hdW0y1Tt0Wk5PqmO8FAg=="; + //String data = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDwYfnUdBVz6Kj4HS2oCA1TTiqJkCUIYa5ckMhJeByBCAMsqu21LmFjb/hdW0y1Tt0Wk5PqmO8FAg=="; + String data = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YBr4/b4yBwN2FIVZZn+Xg9KQTDoTCLu3YtByaWh7zPmdcpBr9FGARduhPrwSnYTFJ0VVVSK/UzPWdHN2YYd4yHGQRJ2HEr/1egt2JUHpWr0JA=="; /* { "success": true, "message": "ok", diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java index 9fb0bf81..80bf5ab5 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java @@ -53,7 +53,6 @@ public class HuiLianTongUnionCardConfig { map.put("sign", MD5Util.MD5Encode(str, "UTF-8").toUpperCase()); System.out.println(MapUtils.getString(map, "sign")); return HttpsUtils.doPost("http://hltgz.com:4010/api/v2/execute.json", JSON.toJSONString(map)); - // return null; } /** @@ -97,5 +96,47 @@ public class HuiLianTongUnionCardConfig { // return null; } + /** + * 获取token + * @return + * @throws Exception + */ + public static JSONObject queryCardInfo() throws Exception { + // 签名码 + String signCode = "F8E91A3C"; + + Map map = new LinkedHashMap<>(); + map.put("accessCode", "6FCAE1470CEF465988351BB65ABAA8AE"); + map.put("requestId", new Date().getTime()); + map.put("method", "qgk/queryCardInfo"); + + // 业务数据 + Map dataMap = new HashMap<>(); + dataMap.put("cardNo", "8800030115015107746"); + + // 转换成json + String dataJson = JSONObject.toJSONString(dataMap); + System.out.println(dataJson); + + // DES加密 + map.put("data", DesUtil.encode(dataJson, Charset.forName("UTF-8"),signCode)); + System.out.println(MapUtils.getString(map,"data")); + + // 数据签名字符串 + String str = (MapUtils.getString(map,"accessCode")+signCode); + str +=(MapUtils.getString(map,"requestId")+signCode) ; + str += (MapUtils.getString(map,"method") + signCode); + str += (MapUtils.getString(map,"data") + signCode); + System.out.println(str); + + // MD5加密 + map.put("sign", MD5Util.MD5Encode(str, "UTF-8").toUpperCase()); + System.out.println(MapUtils.getString(map, "sign")); + return HttpsUtils.doPost("http://hltgz.com:4010/api/v2/execute.json", JSON.toJSONString(map)); + // return null; + } + + + }