| @@ -660,48 +660,6 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| /** | |||
| * 停车费抵扣 | |||
| * | |||
| */ | |||
| @ApiOperation(value = "停车费抵扣", notes ="TJD: {\"tradeId\":\"string\",\"accountId\":\"string\",\"couponOrderId\":\"string\"}") | |||
| @PostMapping("/deductionFee") | |||
| public ResultData deductionFee(@RequestBody Map<String, String > paramMap) { | |||
| /// 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantId()); | |||
| if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||
| String tradeId = paramMap.get("tradeId"); | |||
| String accountId = paramMap.get("accountId"); | |||
| String outTradeNo = paramMap.get("couponOrderId"); | |||
| if (StringUtils.isBlank(tradeId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "tradeId为空"); | |||
| } | |||
| if (StringUtils.isBlank(accountId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "accountId为空"); | |||
| } | |||
| if (StringUtils.isBlank(outTradeNo)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId为空"); | |||
| } | |||
| WxCouponOrder couponOrder = wxCouponOrderService.getById(Long.valueOf(outTradeNo)); | |||
| WxCoupon coupon = couponService.getById(couponOrder.getCouponId()); | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString("url"); | |||
| String partner = objParams.getString("partner"); | |||
| String key = objParams.getString("key"); | |||
| String version = objParams.getString("version"); | |||
| String ret = tjd.deductionForDetail(url, partner, key, version, | |||
| tradeId, accountId, couponOrder, coupon); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getString(TJDUtil.TJD_RETURN_CODE).equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||
| return new ResultData(); | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_DEDUCE_FEE_FAIL.getCode(), "停车费抵扣失败"); | |||
| } | |||
| } | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费抵扣失败"); | |||
| } | |||
| private String getETCPBusinessID(Long merchantId) { | |||
| String businessId; | |||
| WxMerchant wxMerchant = wxMerchantService.getById(merchantId); | |||
| @@ -715,44 +673,44 @@ public class WxCarController extends BaseController { | |||
| * 优免券领取 | |||
| * 优免券不可退 | |||
| */ | |||
| @ApiOperation(value = "优免券领取", notes="ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\",\"couponOrderId\"=\"String\"},输出\n{}") | |||
| @ApiOperation(value = "停车券使用", notes="ETCP:={\"etcpToken\":\"string(ETCP专用)\",\"carNumber\":\"string\",\"couponOrderId\"=\"String\"},输出\n{}\n" + | |||
| "TJD:{\"carNumber\":\"string\",\"tradeId\":\"string\",\"accountId\":\"string\",\"couponOrderId\":\"string\"}") | |||
| @PostMapping("/getCoupon") | |||
| public ResultData getCoupon(@RequestBody Map<String, String > paramMap) { | |||
| /// 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantId()); | |||
| String carNumber = paramMap.get("carNumber"); | |||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId为空"); | |||
| } | |||
| Long couponOrderId = 0L; | |||
| try { | |||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId转化失败"); | |||
| } | |||
| WxCouponOrderCarCVo userCar = null; | |||
| WxCouponOrder userCarQ = new WxCouponOrder(); | |||
| userCarQ.setTenantId(getTenantId()); | |||
| userCarQ.setCUserId(getUserId()); | |||
| userCarQ.setId(couponOrderId); | |||
| userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| List<WxCouponOrderCarCVo> list = wxCouponOrderService.carListCUserVo(userCarQ); | |||
| if (list.size() > 0) { | |||
| userCar = list.get(0); | |||
| } | |||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | |||
| String etcpToken = paramMap.get("etcpToken"); | |||
| String carNumber = paramMap.get("carNumber"); | |||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||
| if (StringUtils.isBlank(etcpToken)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||
| } | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId为空"); | |||
| } | |||
| Long couponOrderId = 0L; | |||
| try { | |||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId转化失败"); | |||
| } | |||
| WxCouponOrderCarCVo userCar = null; | |||
| WxCouponOrder userCarQ = new WxCouponOrder(); | |||
| userCarQ.setTenantId(getTenantId()); | |||
| userCarQ.setCUserId(getUserId()); | |||
| userCarQ.setId(couponOrderId); | |||
| userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| List<WxCouponOrderCarCVo> list = wxCouponOrderService.carListCUserVo(userCarQ); | |||
| if (list.size() > 0) { | |||
| userCar = list.get(0); | |||
| } | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString("url"); | |||
| @@ -800,6 +758,34 @@ public class WxCarController extends BaseController { | |||
| } else { | |||
| return new ResultData(ErrorCode.ETCP_QUAN_SEND_FAIL.getCode(), retObj.getString("message")); | |||
| } | |||
| } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | |||
| String tradeId = paramMap.get("tradeId"); | |||
| String accountId = paramMap.get("accountId"); | |||
| if (StringUtils.isBlank(tradeId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "tradeId为空"); | |||
| } | |||
| if (StringUtils.isBlank(accountId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "accountId为空"); | |||
| } | |||
| WxCoupon coupon = couponService.getById(userCar.getCouponId()); | |||
| if (coupon == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | |||
| } | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString(TJDUtil.TJD_URL); | |||
| String partner = objParams.getString(TJDUtil.TJD_ACCOUNT); | |||
| String key = objParams.getString(TJDUtil.TJD_ACCOUNT_KEY); | |||
| String version = objParams.getString(TJDUtil.TJD_VERSION); | |||
| String ret = tjd.deductionForDetail(url, partner, key, version, | |||
| tradeId, accountId, userCar, coupon); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getString(TJDUtil.TJD_RETURN_CODE).equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||
| return new ResultData(); | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_DEDUCE_FEE_FAIL.getCode(), "停车费抵扣失败"); | |||
| } | |||
| } | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "优免券领取失败"); | |||
| } | |||