|
|
|
@@ -2,6 +2,8 @@ package com.iformall.utils.car; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
import org.apache.http.Consts; |
|
|
|
import org.apache.http.HttpEntity; |
|
|
|
@@ -92,6 +94,13 @@ public class ShangAnUtil { |
|
|
|
return signValue; |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean checkRespFailed(String resp) { |
|
|
|
if(resp.startsWith("<html>") || resp.startsWith("<!DOCTYPE html>")) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public static String couponSend(String url, String key, String parkNumber, String couponModelId, Date expireTime, String plate, String position) { |
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
|
params.put("parkNum", parkNumber); |
|
|
|
@@ -101,6 +110,12 @@ public class ShangAnUtil { |
|
|
|
params.put("position", position); |
|
|
|
try { |
|
|
|
String result = Proc(url, key, parkNumber, params); |
|
|
|
if(result == null) { |
|
|
|
throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); |
|
|
|
} |
|
|
|
if(checkRespFailed(result)) { |
|
|
|
throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} catch (Exception e) { |
|
|
|
return null; |
|
|
|
|