|
|
|
@@ -8,6 +8,7 @@ import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.domain.vo.WxCouponOrderCarCVo; |
|
|
|
import com.iformall.domain.vo.WxMerchantVo; |
|
|
|
import com.iformall.enums.*; |
|
|
|
@@ -69,9 +70,9 @@ public class WxCarController extends BaseController { |
|
|
|
@Autowired |
|
|
|
WxCreditHistoryService wxCreditHistoryService; |
|
|
|
|
|
|
|
private WxPark getCurrentPark(String tenantId) { |
|
|
|
private WxPark getCurrentPark(TenantEntity tenantEntity) { |
|
|
|
WxPark parkQ = new WxPark(); |
|
|
|
parkQ.setTenantId(tenantId); |
|
|
|
parkQ.updateTenantInfo(tenantEntity); |
|
|
|
WxPark wxPark = wxParkService.getByObj(parkQ); |
|
|
|
// 1, get mall's park |
|
|
|
// future use redis to optimize |
|
|
|
@@ -82,7 +83,7 @@ public class WxCarController extends BaseController { |
|
|
|
@GetMapping("/getVendor") |
|
|
|
public ResultData getVendor() { |
|
|
|
// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
Map map = new HashMap(); |
|
|
|
map.put("vendor", park.getVendorType()); |
|
|
|
return new ResultData(map); |
|
|
|
@@ -99,7 +100,7 @@ public class WxCarController extends BaseController { |
|
|
|
public ResultData init(@RequestBody Map<String, String> paramMap) { |
|
|
|
WxCUser user = getUser(); |
|
|
|
// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
// 2. get vendor params |
|
|
|
if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { |
|
|
|
return initForEtcp(paramMap, user, park); |
|
|
|
@@ -150,7 +151,7 @@ public class WxCarController extends BaseController { |
|
|
|
dataObj.put("vendor", EnumCarVendor.CAR_ETCP.getCode()); |
|
|
|
String etcpToken = dataObj.getString("token"); |
|
|
|
try { |
|
|
|
JSONObject dataObj1 = etcpSyncCarNumbers(user.getId(), user.getTenantId(), park.getVendorType(), |
|
|
|
JSONObject dataObj1 = etcpSyncCarNumbers(park, user.getId(), park.getVendorType(), |
|
|
|
url, merchantNo, merchantKey, version, |
|
|
|
etcpToken); |
|
|
|
} catch (MallinkException e) { |
|
|
|
@@ -167,8 +168,8 @@ public class WxCarController extends BaseController { |
|
|
|
/** |
|
|
|
* ETCP同步 |
|
|
|
* |
|
|
|
* @param tenantEntity |
|
|
|
* @param cUserId |
|
|
|
* @param tenantId |
|
|
|
* @param iVendorType |
|
|
|
* @param url |
|
|
|
* @param merchantNo |
|
|
|
@@ -177,7 +178,7 @@ public class WxCarController extends BaseController { |
|
|
|
* @param etcpToken |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private JSONObject etcpSyncCarNumbers(Long cUserId, String tenantId, int iVendorType, |
|
|
|
private JSONObject etcpSyncCarNumbers(TenantEntity tenantEntity, Long cUserId, int iVendorType, |
|
|
|
String url, String merchantNo, String merchantKey, String version, |
|
|
|
String etcpToken) { |
|
|
|
String ret; |
|
|
|
@@ -212,7 +213,7 @@ public class WxCarController extends BaseController { |
|
|
|
Date curr = new Date(); |
|
|
|
WxCUserCar userCar = new WxCUserCar(); |
|
|
|
userCar.setCUserId(cUserId); |
|
|
|
userCar.setTenantId(tenantId); |
|
|
|
userCar.updateTenantInfo(tenantEntity); |
|
|
|
userCar.setCarNumber(_carNum); |
|
|
|
userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); |
|
|
|
userCar.setCreateDate(curr); |
|
|
|
@@ -258,7 +259,7 @@ public class WxCarController extends BaseController { |
|
|
|
@PostMapping("/bindCar") |
|
|
|
public ResultData bindCar(@RequestBody Map<String, String> paramMap) { |
|
|
|
// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
// 2. get vendor params |
|
|
|
if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { |
|
|
|
return etcpBindCar(paramMap, park); |
|
|
|
@@ -433,7 +434,7 @@ public class WxCarController extends BaseController { |
|
|
|
@PostMapping("/unbindCar") |
|
|
|
public ResultData unbindCar(@RequestBody Map<String, String> paramMap) { |
|
|
|
// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { |
|
|
|
return etcpUnbindCar(paramMap, park); |
|
|
|
} else { |
|
|
|
@@ -590,7 +591,7 @@ public class WxCarController extends BaseController { |
|
|
|
@PostMapping("/getCarStopFee") |
|
|
|
public ResultData getCarStopFee(@RequestBody Map<String, String> paramMap) { |
|
|
|
// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { |
|
|
|
return etcpCarStopFee(paramMap, park); |
|
|
|
} else if (park.getVendorType().equals(EnumCarVendor.CAR_TJD.getCode())) { |
|
|
|
@@ -707,7 +708,7 @@ public class WxCarController extends BaseController { |
|
|
|
@PostMapping("/getCoupon") |
|
|
|
public ResultData getCoupon(@RequestBody Map<String, String> paramMap) { |
|
|
|
/// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
String carNumber = paramMap.get("carNumber"); |
|
|
|
String couponOrderIdStr = paramMap.get("couponOrderId"); |
|
|
|
if (StringUtils.isBlank(carNumber)) { |
|
|
|
@@ -886,7 +887,7 @@ public class WxCarController extends BaseController { |
|
|
|
@GetMapping("/getParkStatus") |
|
|
|
public ResultData getParkStatus() { |
|
|
|
/// 1, get mall's park |
|
|
|
WxPark park = getCurrentPark(getTenantId()); |
|
|
|
WxPark park = getCurrentPark(getTenantInfo()); |
|
|
|
if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { |
|
|
|
ResultData e = etcpParkStatus(park); |
|
|
|
if (e != null) return e; |
|
|
|
|