| @@ -8,6 +8,11 @@ import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| /** | |||
| * 新的用NewParkAdapterService | |||
| * @author alascor | |||
| * | |||
| */ | |||
| public interface ParkAdapterService { | |||
| /** | |||
| @@ -34,17 +39,17 @@ public interface ParkAdapterService { | |||
| void unbindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception; | |||
| /** | |||
| * 获取停车费 | |||
| * 获取停车费, 给老的集成用 | |||
| */ | |||
| ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception; | |||
| /** | |||
| * 停车券使用 | |||
| * 停车券使用, 给老的集成用 | |||
| */ | |||
| ResultData useCoupon(Map<String, String> paramMap,WxPark park,WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception; | |||
| /** | |||
| * 查询停车场状态 | |||
| * 查询停车场状态, 给老的集成用 | |||
| */ | |||
| ResultData getParkStatus(WxPark park) throws Exception; | |||
| } | |||
| @@ -0,0 +1,103 @@ | |||
| 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 ParkStopFee 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();; | |||
| public ParkStopFee(String orderId,Date startTime,Date endTime,String fee,String appId,String payPath,Map extraData) { | |||
| 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; | |||
| } | |||
| } | |||
| 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; | |||
| } | |||
| } | |||
| @@ -22,6 +22,7 @@ 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.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -119,7 +120,12 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| String ret = cyf.getCarStopFee(token,park.getParkingId(),carNumber); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| return new ResultData(retObj); | |||
| Integer createTime = retObj.getInteger("inTime");//计费时间 | |||
| Integer endTime = retObj.getInteger("endTime");//离场时间 | |||
| String appId = ""; | |||
| String payPath = ""; | |||
| 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)); | |||
| }else { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| @@ -29,6 +29,7 @@ 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.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| @@ -154,7 +155,12 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| String ret = jieshun.getCarStopFee(park, parkOrderId, getCacheToken(park)); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("resultCode") == 0){ | |||
| return new ResultData(retObj); | |||
| String createTime = retObj.getString("createTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String endTime = retObj.getString("endTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String appId = "wx24b70f0ad2a9a89a"; | |||
| String payPath = "pages/thirdPayOrder/payOrder?carNo="+jieshun.handleCarNumber(carNumber)+"&parkCode="+park.getParkId(); | |||
| return new ResultData(new ParkStopFee(parkOrderId,jieshun.utcToLocal(createTime),jieshun.utcToLocal(endTime), | |||
| String.valueOf(retObj.getDouble("totalFee")),appId,payPath,null)); | |||
| }else { | |||
| logger.error("jieshunCarStopFee error. paramMap: {} . jieshunResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("message"); | |||
| @@ -122,7 +122,7 @@ public class JieShunUtil { | |||
| return map; | |||
| } | |||
| private String handleCarNumber(String carNumber) { | |||
| public String handleCarNumber(String carNumber) { | |||
| if (carNumber.contains("-")) { | |||
| return carNumber; | |||
| }else { | |||