| @@ -28,4 +28,8 @@ CREATE TABLE `wx_car_pay_order` ( | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`), | |||
| UNIQUE KEY `pay_order_no` (`pay_order_no`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='支付单表'; | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='支付单表'; | |||
| ALTER TABLE `mallink`.`wx_park` | |||
| ADD COLUMN `support_pay` int(1) COMMENT '会员小程序是否支持支付enumYesOrNo'; | |||
| @@ -10,6 +10,8 @@ import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.etcp.EtcpHelper; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| @@ -228,7 +230,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| /** | |||
| * 停车费 | |||
| * 停车费查询 | |||
| * | |||
| * @param paramMap | |||
| * @return | |||
| @@ -276,7 +278,12 @@ public class WxCarController extends BaseController { | |||
| return etcpHelper.etcpCarStopFee(paramMap, park); | |||
| } else { | |||
| try { | |||
| return parkFactory.getParkService(park.getVendorType()).carStopFee(paramMap, park); | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(Result.ERROR, "carNumber为空"); | |||
| } | |||
| ParkStopFee fee = parkFactory.getParkService(park.getVendorType()).carStopFee(paramMap, park,carNumber); | |||
| return new ResultData(fee); | |||
| } catch (Exception e) { | |||
| logger.error("park getCarStopFee error",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| @@ -397,6 +404,33 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| /** | |||
| * 停车费创建支付订单,只有supportPay=true时才调用此方法 | |||
| * | |||
| * @param paramMap | |||
| * @return | |||
| */ | |||
| @ApiOperation(value = "停车费创建支付订单", notes = "") | |||
| @PostMapping("/createPayOrder") | |||
| public ResultData createPayOrder(@RequestBody Map<String, String> paramMap) { | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return null; | |||
| } else { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(Result.ERROR,"无车牌参数."); | |||
| } | |||
| try { | |||
| ParkCreatePayOrder payOrder = parkFactory.getParkService(park.getVendorType()).createPayOrder(paramMap, park,carNumber); | |||
| return new ResultData(payOrder); | |||
| } catch (Exception e) { | |||
| logger.error("park getCarStopFee error",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @ApiOperation("券包分页列表接口") | |||
| @GetMapping("/couponOrderList") | |||
| @ApiImplicitParams({ | |||
| @@ -38,5 +38,6 @@ public class WxPark extends TenantEntity { | |||
| private String vendorParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="优惠券配置参数,WxParkCouponConfig",name="couponParams") | |||
| private String couponParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="会员小程序是否支持支付enumYesOrNo",name="supportPay") | |||
| private Integer supportPay; | |||
| } | |||
| @@ -47,5 +47,4 @@ public enum EnumCarVendor { | |||
| public boolean isNotifyBatch() { | |||
| return notifyBatch; | |||
| } | |||
| } | |||
| @@ -7,6 +7,9 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| /** | |||
| * 新的用NewParkAdapterService | |||
| @@ -43,7 +46,7 @@ public interface ParkAdapterService { | |||
| /** | |||
| * 获取停车费, 给老的集成用 | |||
| */ | |||
| ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception; | |||
| ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception; | |||
| /** | |||
| * 是否忽略使用券缓存,不忽略,则走系统,根据停车场出入场通知来控制。忽略,则不需要此判断来判定停车券是否已经使用 | |||
| @@ -52,12 +55,29 @@ public interface ParkAdapterService { | |||
| boolean ignoreUseCouponCache(); | |||
| /** | |||
| * 停车券使用, 给老的集成用 | |||
| * 停车创建支付订单 | |||
| */ | |||
| ResultData useCoupon(Map<String, String> paramMap,WxPark park,WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception; | |||
| ParkCreatePayOrder createPayOrder(Map<String, String> paramMap,WxPark park,String carNumber) throws Exception; | |||
| /** | |||
| * 停车订单成功通知车场 | |||
| */ | |||
| ParkNotifyPaid notifyPaid(Map<String, String> paramMap,WxPark park,String parkOrderNumber) throws Exception; | |||
| /** | |||
| * 查询停车场状态, 给老的集成用 | |||
| */ | |||
| ResultData getParkStatus(WxPark park) throws Exception; | |||
| /** | |||
| * | |||
| * @param paramMap | |||
| * @param park | |||
| * @param userCar | |||
| * @param coupon | |||
| * @param carNumber | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| ResultData useCoupon(Map<String, String> paramMap,WxPark park,WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception; | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.iformall.service.park.entity; | |||
| import java.io.Serializable; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| public class ParkCreatePayOrder implements Serializable{ | |||
| private static final long serialVersionUID = 5585069626450856545L; | |||
| /*停车场返回的订单ID**/ | |||
| private String parkOrderNumber=""; | |||
| public ParkCreatePayOrder(String parkOrderNumber) { | |||
| if (!StringUtils.isBlank(parkOrderNumber)) { | |||
| this.parkOrderNumber = parkOrderNumber; | |||
| } | |||
| } | |||
| public String getParkOrderNumber() { | |||
| return parkOrderNumber; | |||
| } | |||
| } | |||
| @@ -0,0 +1,121 @@ | |||
| package com.iformall.service.park.entity; | |||
| import java.io.Serializable; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| public class ParkNotifyPaid implements Serializable{ | |||
| private static final long serialVersionUID = 6478840764729191197L; | |||
| /*停车场返回的订单ID**/ | |||
| private String orderId=""; | |||
| /*入场时间 格式:yyyy-MM-dd HH:mm:ss**/ | |||
| private String entranceTime=""; | |||
| /*计费结束时间 格式:yyyy-MM-dd HH:mm:ss**/ | |||
| private String exitTime=""; | |||
| /*停车费**/ | |||
| private String remainingFee=""; | |||
| /*跳转的停车费支付小程序appId**/ | |||
| private String appId=""; | |||
| /*支付小程序页面路径**/ | |||
| private String payPath=""; | |||
| /*给支付小程序的额外数据**/ | |||
| private Map extraData=new HashMap(); | |||
| /*备注**/ | |||
| private String remark=""; | |||
| private String sysNotice="";//系统提示,非车厂提示; | |||
| public ParkNotifyPaid(String orderId,Date startTime,Date endTime,String fee,String appId,String payPath,Map extraData,String remark,String sysNotice) { | |||
| if (!StringUtils.isBlank(orderId)) { | |||
| this.orderId = orderId; | |||
| } | |||
| if (null != startTime) { | |||
| this.entranceTime = getLocalDate(startTime); | |||
| } | |||
| if (null != endTime) { | |||
| this.exitTime = getLocalDate(endTime); | |||
| } | |||
| if (!StringUtils.isBlank(fee)) { | |||
| this.remainingFee = fee; | |||
| } | |||
| if (!StringUtils.isBlank(appId)) { | |||
| this.appId = appId; | |||
| } | |||
| if (!StringUtils.isBlank(payPath)) { | |||
| this.payPath = payPath; | |||
| } | |||
| if (null != extraData) { | |||
| this.extraData = extraData; | |||
| } | |||
| if (!StringUtils.isBlank(remark)) { | |||
| this.remark = remark; | |||
| } | |||
| if (!StringUtils.isBlank(sysNotice)) { | |||
| this.sysNotice = sysNotice; | |||
| } | |||
| } | |||
| private String getLocalDate(Date date){ | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| return sdf.format(date); | |||
| } | |||
| public String getOrderId() { | |||
| return orderId; | |||
| } | |||
| public void setOrderId(String orderId) { | |||
| this.orderId = orderId; | |||
| } | |||
| public String getEntranceTime() { | |||
| return entranceTime; | |||
| } | |||
| public void setEntranceTime(String entranceTime) { | |||
| this.entranceTime = entranceTime; | |||
| } | |||
| public String getExitTime() { | |||
| return exitTime; | |||
| } | |||
| public void setExitTime(String exitTime) { | |||
| this.exitTime = exitTime; | |||
| } | |||
| public String getRemainingFee() { | |||
| return remainingFee; | |||
| } | |||
| public void setRemainingFee(String remainingFee) { | |||
| this.remainingFee = remainingFee; | |||
| } | |||
| public String getAppId() { | |||
| return appId; | |||
| } | |||
| public void setAppId(String appId) { | |||
| this.appId = appId; | |||
| } | |||
| public String getPayPath() { | |||
| return payPath; | |||
| } | |||
| public void setPayPath(String payPath) { | |||
| this.payPath = payPath; | |||
| } | |||
| public Map getExtraData() { | |||
| return extraData; | |||
| } | |||
| public void setExtraData(Map extraData) { | |||
| this.extraData = extraData; | |||
| } | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setRemark(String remark) { | |||
| this.remark = remark; | |||
| } | |||
| public String getSysNotice() { | |||
| return sysNotice; | |||
| } | |||
| } | |||
| @@ -16,6 +16,9 @@ import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @Service | |||
| @@ -42,15 +45,11 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return bolinkCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return bolinkCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData bolinkCarStopFee(Map<String, String> paramMap, WxPark park) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee bolinkCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString(BoLinkUtil.BOLINK_URL); | |||
| @@ -62,13 +61,14 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| JSONObject dataObj = retObj.getJSONObject(BoLinkUtil.BOLINK_DATA); | |||
| if (dataObj.getIntValue(BoLinkUtil.BOLINK_STATE) == BoLinkUtil.BOLINK_SUCCESS) { | |||
| return new ResultData(dataObj); | |||
| //return new ResultData(dataObj); | |||
| } else { | |||
| return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| //return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| //return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| @@ -114,6 +114,20 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| } | |||
| @@ -23,6 +23,8 @@ import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -120,15 +122,11 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return cyfCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| return cyfCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData cyfCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee cyfCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| @@ -140,12 +138,12 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| String msg = retObj.getString("warmPrompt"); | |||
| String appId = ""; | |||
| String payPath = "http://wechat.cheyifu2016.com/fm-pay/#/transit?encodeURIComponent('orderNo=123&couponFee=2&actualFee=20')"; | |||
| return new ResultData(new ParkStopFee(retObj.getString("orderId"), cyf.utcToLocal(String.valueOf(createTime)), | |||
| cyf.utcToLocal(String.valueOf(endTime)), String.valueOf(retObj.getDouble("fee")),appId,payPath,null,msg,null)); | |||
| return new ParkStopFee(retObj.getString("orderId"), cyf.utcToLocal(String.valueOf(createTime)), | |||
| cyf.utcToLocal(String.valueOf(endTime)), String.valueOf(retObj.getDouble("fee")),appId,payPath,null,msg,null); | |||
| }else { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| throw new MallinkException(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| @@ -200,4 +198,16 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -13,7 +13,11 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @Service | |||
| @@ -44,21 +48,20 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return dahuaCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return dahuaCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData dahuaCarStopFee(Map<String, String> paramMap, WxPark park) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| private ParkStopFee dahuaCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| String result = DaHuaUtil.plateCharge(carNumber, park.getParkId()); | |||
| logger.info("大华查询车辆费用接口返回值:{}", result); | |||
| JSONObject jsonObject = JSONObject.parseObject(result); | |||
| String code = jsonObject.getString("code"); | |||
| if (!code.equals(DaHuaUtil.SUCCESS_CODE)) { | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费获取失败"); | |||
| throw new MallinkException(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费获取失败"); | |||
| } | |||
| Object data = jsonObject.get("data"); | |||
| return new ResultData(data); | |||
| return null; | |||
| } | |||
| @Override | |||
| @@ -77,4 +80,18 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| } | |||
| @@ -31,6 +31,8 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCarJSOrderMapper; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -139,22 +141,17 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| * 每一次查询都会产生订单,然后根据订单号查询 | |||
| */ | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return haiKangWeiShiCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| return haiKangWeiShiCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData haiKangWeiShiCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee haiKangWeiShiCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| //如果车牌号是鄂AAAAAA, 为测试车牌 | |||
| if (carNumber.equals("鄂AAAAAA")) { | |||
| return new ResultData(new ParkStopFee("-111",haikang.utcToLocal("2020-12-16 00:00:00"),haikang.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","","payPath",null,"测试车牌,仅测试用",null)); | |||
| return new ParkStopFee("-111",haikang.utcToLocal("2020-12-16 00:00:00"),haikang.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","","payPath",null,"测试车牌,仅测试用",null); | |||
| }else if(carNumber.equals("鄂AAAAAB")) { | |||
| return new ResultData(21000,"车辆未入场"); | |||
| throw new MallinkException(21000,"车辆未入场"); | |||
| } | |||
| JSONObject attribute = haikang.getFee(park, carNumber, getCacheToken(park),haikang.getAuthorization(park,getCacheToken(park))); | |||
| @@ -164,8 +161,8 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| String _createTime = attribute.getString("entranceTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String _endTime = attribute.getString("costTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String payPath = ""; | |||
| return new ResultData(new ParkStopFee(parkOrderId,haikang.utcToLocal(_createTime),haikang.utcToLocal(_endTime), | |||
| String.valueOf(attribute.getDouble("shouldCost")),appId,payPath,null,null,"0元请勿使用优惠券,无法退回。支付后15分钟内离场")); | |||
| return new ParkStopFee(parkOrderId,haikang.utcToLocal(_createTime),haikang.utcToLocal(_endTime), | |||
| String.valueOf(attribute.getDouble("shouldCost")),appId,payPath,null,null,"0元请勿使用优惠券,无法退回。支付后15分钟内离场"); | |||
| } | |||
| /** | |||
| @@ -235,6 +232,18 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "当前用户领用到海康威视停车券失败:["+retObj.getString("code")+"]"+msg); | |||
| } | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||
| @@ -245,6 +254,5 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| public boolean ignoreUseCouponCache() { | |||
| return true; | |||
| } | |||
| } | |||
| @@ -30,6 +30,8 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCarJSOrderMapper; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -161,22 +163,17 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| * 每一次查询都会产生订单,然后根据订单号查询 | |||
| */ | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return jieshunCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| return jieshunCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData jieshunCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee jieshunCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| //如果车牌号是鄂AAAAAA, 为测试车牌 | |||
| if (carNumber.equals("鄂AAAAAA")) { | |||
| return new ResultData(new ParkStopFee("-111",jieshun.utcToLocal("2020-12-16 00:00:00"),jieshun.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","wx24b70f0ad2a9a89a","payPath",null,"测试车牌,仅测试用",null)); | |||
| return new ParkStopFee("-111",jieshun.utcToLocal("2020-12-16 00:00:00"),jieshun.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","wx24b70f0ad2a9a89a","payPath",null,"测试车牌,仅测试用",null); | |||
| }else if(carNumber.equals("鄂AAAAAB")) { | |||
| return new ResultData(21000,"车辆未入场"); | |||
| throw new MallinkException(21000,"车辆未入场"); | |||
| } | |||
| //下订单; | |||
| @@ -203,18 +200,18 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| String msg = attribute.getString("retmsg"); | |||
| if (!StringUtils.isBlank(msg)) { | |||
| if (msg.contains("未入场")) { | |||
| return new ResultData(new ParkStopFee(null,jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null)); | |||
| return new ParkStopFee(null,jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null); | |||
| }else { | |||
| //0元订单结清,查询是否用过打折方案,如果用过,则需要调用接口结清订单 | |||
| Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, EnumCarVendor.CAR_JIESHUN.getMessage(), carNumber); | |||
| if (null == used || (null != used && used.intValue() < 1)) { | |||
| //未使用停车券 | |||
| return new ResultData(new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null)); | |||
| return new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null); | |||
| }else { | |||
| return new ResultData(new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,"用券抵扣后账单为0,获得15分钟免费出场时间")); | |||
| return new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,"用券抵扣后账单为0,获得15分钟免费出场时间"); | |||
| // String notifyResult = jieshun.notifyOrderResult(park, parkOrderId, getCacheToken(park)); | |||
| // JSONObject notiryRetObj = JSON.parseObject(notifyResult); | |||
| // String noticeErrorMsg = notiryRetObj.getString("message"); | |||
| @@ -255,12 +252,12 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| String createTime = retObject.getString("startTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String endTime = retObject.getString("endTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String payPath = "pages/thirdPayOrder/payOrder?carNo="+jieshun.handleCarNumber(carNumber)+"&parkCode="+park.getParkingId(); | |||
| return new ResultData(new ParkStopFee(parkOrderId,jieshun.utcToLocal(createTime),jieshun.utcToLocal(endTime), | |||
| String.valueOf(retObject.getDouble("totalFee")),appId,payPath,null,null,"请支付后15分钟内离场")); | |||
| return new ParkStopFee(parkOrderId,jieshun.utcToLocal(createTime),jieshun.utcToLocal(endTime), | |||
| String.valueOf(retObject.getDouble("totalFee")),appId,payPath,null,null,"请支付后15分钟内离场"); | |||
| }else { | |||
| logger.error("jieshunCarStopFee error. paramMap: {} . jieshunResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("message"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| throw new MallinkException(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| @@ -345,6 +342,16 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| return new ResultData(retObj.getIntValue("resultCode"), "当前用户领用到捷顺停车券失败:"+msg); | |||
| } | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||
| @@ -19,6 +19,9 @@ import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @Service | |||
| @@ -51,8 +54,8 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return new ResultData(); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return null; | |||
| } | |||
| @Override | |||
| @@ -95,4 +98,18 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||
| public boolean ignoreUseCouponCache() { | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| } | |||
| @@ -30,6 +30,9 @@ import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -190,15 +193,11 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return tjdCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return tjdCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData tjdCarStopFee(@RequestBody Map<String, String> paramMap, WxPark park) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee tjdCarStopFee(@RequestBody Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString(TJDUtil.TJD_URL); | |||
| @@ -208,9 +207,10 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||
| String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getString(TJDUtil.TJD_RETURN_CODE).equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||
| return new ResultData(retObj); | |||
| //return new ResultData(retObj); | |||
| return null; | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | |||
| throw new MallinkException(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | |||
| } | |||
| } | |||
| @@ -259,4 +259,18 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||
| public boolean ignoreUseCouponCache() { | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyPaid notifyPaid(Map<String, String> paramMap, WxPark park, String parkOrderNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| } | |||
| @@ -17,10 +17,12 @@ | |||
| <result column="vendor_type" jdbcType="INTEGER" property="vendorType"/> | |||
| <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams"/> | |||
| <result column="coupon_params" jdbcType="VARCHAR" property="couponParams"/> | |||
| <result column="support_pay" jdbcType="INTEGER" property="supportPay"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`img_url`,`addr`,`number`,`entry_exit`,`stop_fee`,`create_date`,`update_date`,`park_id`,`parking_id`,`vendor_type`,`vendor_params`,`coupon_params` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`img_url`,`addr`,`number`,`entry_exit`,`stop_fee`,`create_date`,`update_date`,`park_id`, | |||
| `parking_id`,`vendor_type`,`vendor_params`,`coupon_params`,`support_pay` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -80,6 +82,11 @@ | |||
| <if test=" null != vendorParams "> | |||
| and `vendor_params` like concat('%', #{vendorParams},'%') | |||
| </if> | |||
| <if test=" null != supportPay "> | |||
| and `support_pay` = #{supportPay} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||