| | |
| | | * 获取token |
| | | */ |
| | | public static String queryToken(Operator operator){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.QUERY_TOKEN.getUrl()); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.QUERY_TOKEN.getUrl()); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", operator.getOurOperatorId()); |
| | | info.put("OperatorSecret", operator.getOperatorSecret()); |
| | |
| | | * @param info |
| | | */ |
| | | public static NotificationStationStatusResult notificationStationStatus(Operator operator, ConnectorStatusInfo info) { |
| | | HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_STATION_STATUS.getUrl()); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STATION_STATUS.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | |
| | | * @return |
| | | */ |
| | | public static NotificationStartChargeResult notificationStartChargeResult(Operator operator, NotificationStartCharge info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_START_CHARGE_RESULT.getUrl()); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_START_CHARGE_RESULT.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | |
| | | * @return |
| | | */ |
| | | public static NotificationEquipChargeStatusResult notificationEquipChargeStatus(Operator operator, QueryEquipChargeStatusResult info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getUrl()); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | |
| | | * @return |
| | | */ |
| | | public static NotificationStopCharge notificationStopChargeResult(Operator operator, NotificationStopChargeResult info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_STOP_CHARGE_RESULT.getUrl()); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STOP_CHARGE_RESULT.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | |
| | | * @return |
| | | */ |
| | | public static NotificationChargeOrderInfoResult notificationChargeOrderInfo(Operator operator, NotificationChargeOrderInfo info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getTestUrl() + InterfaceUrlEnum.NOTIFICATION_CHARGE_ORDER_INFO.getUrl()); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_CHARGE_ORDER_INFO.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | |
| | | sign = SignUtil.bytesToHexString(hmacMd5); |
| | | break; |
| | | case "KuaiDian": |
| | | sign = SignUtil.hmacSign(model.getData(), key); |
| | | //进行字符串拼接、计算 |
| | | String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | // 打印计算得到的签名Sig |
| | | sign = SignUtil.hmacSign(m1, key); |
| | | break; |
| | | } |
| | | return sign; |
| | |
| | | sign = SignUtil.bytesToHexString(hmacMd5); |
| | | break; |
| | | case "KuaiDian": |
| | | sign = SignUtil.hmacSign(model.getData(), key); |
| | | //进行字符串拼接、计算 |
| | | String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | sign = SignUtil.hmacSign(m1, key); |
| | | break; |
| | | } |
| | | return sign; |
| | | } |
| | | public static String ourBuildSignJianGuan(BaseModel model){ |
| | | Operator operator = model.getOperator(); |
| | | if(null == operator){ |
| | | return ""; |
| | | } |
| | | //签名秘钥SigSecret |
| | | String key = operator.getOurSigSecret(); |
| | | String sign = ""; |
| | | //进行字符串拼接、计算 |
| | | String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | sign = SignUtil.hmacSign(m1, key); |
| | | return sign; |
| | | } |
| | | |
| | | |
| | | |
| | | |