Browse Source

[车流][整理]:etcp异常结果处理

release_toaliyun_real
Stormeye Wu 7 years ago
parent
commit
a016e06a82
2 changed files with 22 additions and 5 deletions
  1. +18
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxCarController.java
  2. +4
    -3
      mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java

+ 18
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxCarController.java View File

@@ -11,6 +11,7 @@ import com.iformall.domain.vo.WxCouponCarVo;
import com.iformall.enums.EnumCarVendor;
import com.iformall.enums.EnumCouponStatus;
import com.iformall.enums.EnumETCPCode;
import com.iformall.exception.MallinkException;
import com.iformall.service.*;
import com.iformall.utils.ETCPUtil;
import com.iformall.utils.TJDCarUtil;
@@ -148,7 +149,13 @@ public class WxCarController extends BaseController {
// 1期只有一个虚拟商户,可以写在商场配置里
businessId = objParams.getString("businessId");
}
String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId);
String ret = "";
try {
ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId);
} catch (MallinkException e) {
return new ResultData(e.getErrorCode(), e.getMessage());
}

if (ret == null) {
logger.error("quanTemplate failed, 优免券模板未发现");
return new ResultData(ErrorCode.ETCP_CMD_FAIL.getCode(), "获取优免券模板异常");
@@ -300,6 +307,7 @@ public class WxCarController extends BaseController {
String version = objParams.getString("version");
if (park.getParkingId() == null) {
// those code is not supported
/*
String lat = objParams.getString("lat");
String lon = objParams.getString("lon");
String radius = objParams.getString("radius");
@@ -323,10 +331,18 @@ public class WxCarController extends BaseController {
}
}
}
*/
}

if (park.getParkingId() != null) {
String ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId());
String ret = "";
try {
ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId());
} catch (MallinkException e) {
logger.error("ETCP failed: " + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
}

JSONObject retObj = JSON.parseObject(ret);
if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) {
if (retObj.get("data") != null) {


+ 4
- 3
mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java View File

@@ -114,7 +114,7 @@ public class WxCarController extends BaseController {
try {
ret = etcp.userSignin(url, appId, merchantNo, merchantKey, version, phone);
} catch (MallinkException e) {
logger.error("ETCP fail: " + e.getMessage());
logger.error("ETCP failed: " + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
}
JSONObject retObj = JSON.parseObject(ret);
@@ -167,6 +167,7 @@ public class WxCarController extends BaseController {
try {
ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken);
} catch (MallinkException e) {
logger.error("ETCP failed: " + e.getMessage());
throw new MallinkException(e.getErrorCode(), e.getMessage());
}
retObj = JSON.parseObject(ret);
@@ -270,7 +271,7 @@ public class WxCarController extends BaseController {
try {
ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null);
} catch (MallinkException e) {
logger.error("ETCP fail: " + e.getMessage());
logger.error("ETCP failed: " + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
}
JSONObject retObj = JSON.parseObject(ret);
@@ -400,7 +401,7 @@ public class WxCarController extends BaseController {
try {
ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber);
} catch (MallinkException e) {
logger.error("ETCP fail: " + e.getMessage());
logger.error("ETCP failed: " + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
}



Loading…
Cancel
Save