| @@ -367,8 +367,9 @@ public class WxCarController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | ||||
| } | } | ||||
| try { | try { | ||||
| if (null == used || (null != used && used.intValue() < 1)) { | |||||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||||
| boolean ignoreUseCouponCache = parkFactory.getParkService(park.getVendorType()).ignoreUseCouponCache(); | |||||
| if (ignoreUseCouponCache) { | |||||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||||
| if (rs.code == Result.SUCCESS) { | if (rs.code == Result.SUCCESS) { | ||||
| etcpHelper.updateWxCouponOrderUsed(userCar, park); | etcpHelper.updateWxCouponOrderUsed(userCar, park); | ||||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | ||||
| @@ -376,8 +377,19 @@ public class WxCarController extends BaseController { | |||||
| }else { | }else { | ||||
| return new ResultData(rs.code,rs.message); | return new ResultData(rs.code,rs.message); | ||||
| } | } | ||||
| }else { | |||||
| if (null == used || (null != used && used.intValue() < 1)) { | |||||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||||
| if (rs.code == Result.SUCCESS) { | |||||
| etcpHelper.updateWxCouponOrderUsed(userCar, park); | |||||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||||
| return new ResultData(); | |||||
| }else { | |||||
| return new ResultData(rs.code,rs.message); | |||||
| } | |||||
| } | |||||
| return new ResultData(Result.ERROR,"已经使用过优惠券, 不能重复使用."); | |||||
| } | } | ||||
| return new ResultData(Result.ERROR,"已经使用过优惠券, 不能重复使用."); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("park getCoupon error",e); | logger.error("park getCoupon error",e); | ||||
| return new ResultData(Result.ERROR,e.getMessage()); | return new ResultData(Result.ERROR,e.getMessage()); | ||||
| @@ -45,6 +45,12 @@ public interface ParkAdapterService { | |||||
| */ | */ | ||||
| ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception; | ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception; | ||||
| /** | |||||
| * 是否忽略使用券缓存,不忽略,则走系统,根据停车场出入场通知来控制。忽略,则不需要此判断来判定停车券是否已经使用 | |||||
| * @return | |||||
| */ | |||||
| boolean ignoreUseCouponCache(); | |||||
| /** | /** | ||||
| * 停车券使用, 给老的集成用 | * 停车券使用, 给老的集成用 | ||||
| */ | */ | ||||
| @@ -109,6 +109,11 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||
| @@ -195,4 +195,9 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||
| @@ -72,4 +72,9 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||
| @@ -189,7 +189,7 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||||
| String orderNo = paramMap.get("parkOrderId"); | String orderNo = paramMap.get("parkOrderId"); | ||||
| String planNo = valueMap.get("couponNo"); | String planNo = valueMap.get("couponNo"); | ||||
| if (StringUtils.isBlank(planNo)) { | if (StringUtils.isBlank(planNo)) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券没有关联停车场优惠券配置[planNo]。"+coupon.getTitle()); | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券没有关联停车场优惠券配置[ruleId]。"+coupon.getTitle()); | |||||
| } | } | ||||
| JSONObject retObj = haikang.useCoupon(park,planNo,carNumber,orderNo, getCacheToken(park),haikang.getAuthorization(park,getCacheToken(park))); | JSONObject retObj = haikang.useCoupon(park,planNo,carNumber,orderNo, getCacheToken(park),haikang.getAuthorization(park,getCacheToken(park))); | ||||
| if (retObj.getString("code").equals("0")){ | if (retObj.getString("code").equals("0")){ | ||||
| @@ -205,6 +205,11 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||||
| public ResultData getParkStatus(WxPark park) throws Exception{ | public ResultData getParkStatus(WxPark park) throws Exception{ | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return true; | |||||
| } | |||||
| } | } | ||||
| @@ -211,6 +211,9 @@ public class HaiKangWeiShiUtil { | |||||
| return attribute; | return attribute; | ||||
| } | } | ||||
| /** | /** | ||||
| * 2、有优惠券方式 | * 2、有优惠券方式 | ||||
| 发优惠券的时候是会返回一个优惠券id(3.5.9.1), | 发优惠券的时候是会返回一个优惠券id(3.5.9.1), | ||||
| @@ -334,4 +334,9 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||
| @@ -90,4 +90,9 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||||
| public ResultData getParkStatus(WxPark park) { | public ResultData getParkStatus(WxPark park) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||
| @@ -254,4 +254,9 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||||
| public ResultData getParkStatus(WxPark park) { | public ResultData getParkStatus(WxPark park) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||