| @@ -36,7 +36,7 @@ public class WxPark extends TenantEntity { | |||
| private Integer vendorType; | |||
| @io.swagger.annotations.ApiModelProperty(value="厂商参数etcp{\"url\":\"http://mapi.test.etcp.cn\",\"appId\":\"FMLK\",\"merchantNo\":\"C7AEAF80BA8C44ADB42F3DB3CBC7D18A\",\"merchantKey\":\"C292FFC7DCFB46AFB02792CD43F6DCC7\",\"version\": \"1.0.0\",\"parkId\":\"Wj7YdvqyiYM=\"},TJD{\"url\":\"http://prep.tingjiandan.com/openapi/gateway\",\"partner\":\"7dbc8ec9037d403b822cb60addfdc681\",\"key\":\"f356cb1bf5a74fb7a564e86128d2c49f\",\"version\":\"1.0\"}",name="vendorParams") | |||
| private String vendorParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="优惠券配置参数",name="couponParams") | |||
| @io.swagger.annotations.ApiModelProperty(value="优惠券配置参数,WxParkCouponConfig",name="couponParams") | |||
| private String couponParams; | |||
| } | |||
| @@ -18,7 +18,6 @@ public class WxCouponCarVo extends WxCoupon implements Serializable { | |||
| private String vendorType; | |||
| @io.swagger.annotations.ApiModelProperty(value="车场厂商相关信息",name="vendorParams") | |||
| private String vendorParams; | |||
| @TableField(exist = false) | |||
| private Integer status; | |||
| } | |||
| @@ -16,6 +16,9 @@ public class WxCouponOrderCarCVo extends WxCouponOrderCVo { | |||
| @io.swagger.annotations.ApiModelProperty(value="couponFreeId",name="couponFreeId") | |||
| private Integer couponFreeId; | |||
| @io.swagger.annotations.ApiModelProperty(value="车场厂商相关信息",name="vendorParams") | |||
| private String vendorParams; | |||
| @TableField(exist = false) | |||
| private String cUserPhone; | |||
| @@ -0,0 +1,42 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.*; | |||
| @TableName(value = "wx_park") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxPark extends TenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="停车场图片",name="imgUrl") | |||
| private String imgUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="停车场地址",name="addr") | |||
| private String addr; | |||
| @io.swagger.annotations.ApiModelProperty(value="车位数",name="number") | |||
| private Integer number; | |||
| @io.swagger.annotations.ApiModelProperty(value="出入口数量",name="entryExit") | |||
| private Integer entryExit; | |||
| @io.swagger.annotations.ApiModelProperty(value="停车费",name="stopFee") | |||
| private String stopFee; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="第三方停车场ID(密文)",name="parkId") | |||
| private String parkId; | |||
| @io.swagger.annotations.ApiModelProperty(value="第三方停车场ID(明文)",name="parkingId") | |||
| private String parkingId; | |||
| @io.swagger.annotations.ApiModelProperty(value="厂商类型(1:ETCP,2:停简单)",name="vendorType") | |||
| private Integer vendorType; | |||
| @io.swagger.annotations.ApiModelProperty(value="厂商参数etcp{\"url\":\"http://mapi.test.etcp.cn\",\"appId\":\"FMLK\",\"merchantNo\":\"C7AEAF80BA8C44ADB42F3DB3CBC7D18A\",\"merchantKey\":\"C292FFC7DCFB46AFB02792CD43F6DCC7\",\"version\": \"1.0.0\",\"parkId\":\"Wj7YdvqyiYM=\"},TJD{\"url\":\"http://prep.tingjiandan.com/openapi/gateway\",\"partner\":\"7dbc8ec9037d403b822cb60addfdc681\",\"key\":\"f356cb1bf5a74fb7a564e86128d2c49f\",\"version\":\"1.0\"}",name="vendorParams") | |||
| private String vendorParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="优惠券配置参数",name="couponParams") | |||
| private String couponParams; | |||
| } | |||
| @@ -0,0 +1,67 @@ | |||
| package com.iformall.domain.vo; | |||
| import java.io.Serializable; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.junit.platform.commons.util.StringUtils; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| public class WxParkCouponConfig implements Serializable{ | |||
| private static final long serialVersionUID = 1L; | |||
| /*配置项名称**/ | |||
| private String title; | |||
| /*配置项key**/ | |||
| private String configkey; | |||
| /*配置项说明**/ | |||
| private String remark; | |||
| /*配置项的值**/ | |||
| private String configValue; | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String title) { | |||
| this.title = title; | |||
| } | |||
| public String getConfigkey() { | |||
| return configkey; | |||
| } | |||
| public void setConfigkey(String configkey) { | |||
| this.configkey = configkey; | |||
| } | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setRemark(String remark) { | |||
| this.remark = remark; | |||
| } | |||
| public String getConfigValue() { | |||
| return configValue; | |||
| } | |||
| public void setConfigValue(String configValue) { | |||
| this.configValue = configValue; | |||
| } | |||
| public static Map<String,String> parseValue(String content) { | |||
| if (StringUtils.isBlank(content)) { | |||
| return null; | |||
| } | |||
| JSONArray arrays = JSON.parseArray(content); | |||
| if (null != arrays && arrays.size() > 0 ) { | |||
| Map<String,String> retMap = new HashMap<String,String>(); | |||
| for (int i = 0 ; i < arrays.size(); i++) { | |||
| JSONObject object = arrays.getJSONObject(i); | |||
| retMap.put(object.getString("configkey"), object.getString("configValue")); | |||
| } | |||
| return retMap; | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -23,6 +23,7 @@ import com.iformall.domain.po.WxCarJSOrder; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.domain.vo.WxParkCouponConfig; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -198,10 +199,6 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| */ | |||
| @Override | |||
| public ResultData useCoupon(Map<String, String> paramMap, WxPark park, WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception{ | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String orderNo = objParams.getString("jsOrderId"); | |||
| if (null == userCar) { | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(),"当前用户未查询到优惠券!"); | |||
| } | |||
| @@ -209,7 +206,16 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| if (StringUtils.isBlank(userCar.getCUserPhone())) { | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(),"当前用户未查询到手机号!"+userCar.getcUserId()); | |||
| } | |||
| String ret = jieshun.getCoupon(park, userCar.getCUserPhone(), getCacheToken(park)); | |||
| Map<String,String> valueMap = WxParkCouponConfig.parseValue(userCar.getVendorParams()); | |||
| if (null == valueMap) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券没有关联停车场优惠券配置。"+coupon.getTitle()); | |||
| } | |||
| String orderNo = paramMap.get("jsOrderId"); | |||
| String planNo = valueMap.get("planNo"); | |||
| String ret = jieshun.getCoupon(park, planNo,userCar.getCUserPhone(), getCacheToken(park)); | |||
| logger.info("jieshun getCoupon result:"+ret); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("resultCode") == 0){ | |||
| @@ -218,7 +224,7 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| JSONObject coupoo = couponArrays.getJSONObject(0); | |||
| String couponNo = coupoo.getString("couponsNo"); | |||
| String rret = jieshun.useCoupon(park, couponNo, orderNo, getCacheToken(park)); | |||
| logger.info("jieshun useCoupon["+orderNo+"] result:"+rret); | |||
| logger.info("jieshun useCoupon[couponOrderId:"+userCar.getId()+";jieshunOrderNo:"+orderNo+"] result:"+rret); | |||
| JSONObject rretObj = JSON.parseObject(rret); | |||
| if (rretObj.getIntValue("resultCode") == 0){ | |||
| return new ResultData(); | |||
| @@ -164,11 +164,9 @@ public class JieShunUtil { | |||
| /** | |||
| * 获取优惠券 | |||
| **/ | |||
| public String getCoupon(WxPark wxPark,String phone,String token){ | |||
| public String getCoupon(WxPark wxPark,String planNo,String phone,String token){ | |||
| String vendroParams = wxPark.getVendorParams(); | |||
| JSONObject vp = JSON.parseObject(vendroParams); | |||
| String planNo = vp.getString("planNo"); | |||
| Map param = new HashMap(); | |||
| param.put("businesserCode", vp.get("businesserCode"));//商户编号 | |||
| param.put("planNo", planNo);//优惠券编号 | |||
| @@ -1255,7 +1255,7 @@ | |||
| <sql id="allCUserCouponOrderCarListColumns"> | |||
| co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.pay_vendor, | |||
| c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit, | |||
| json_extract(car.vendor_params,'$.id') as coupon_free_id | |||
| json_extract(car.vendor_params,'$.id') as coupon_free_id,car.vendor_params | |||
| </sql> | |||
| <resultMap id="CCarVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCarCVo"> | |||
| @@ -1286,6 +1286,7 @@ | |||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||
| <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" /> | |||
| <result column="coupon_free_id" jdbcType="INTEGER" property="couponFreeId"/> | |||