|
|
|
@@ -2,6 +2,8 @@ package com.iformall.utils.car; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.WxCouponOrder; |
|
|
|
import com.iformall.utils.MapUtil; |
|
|
|
import org.apache.http.Consts; |
|
|
|
import org.apache.http.HttpEntity; |
|
|
|
@@ -36,6 +38,7 @@ public class TJDUtil { |
|
|
|
public static final String TJD_VERSION = "version"; |
|
|
|
|
|
|
|
public static final String TJD_CHARSET = "charset"; |
|
|
|
public static final String TJD_UTF_8 = "utf-8"; |
|
|
|
|
|
|
|
public static final String TJD_RETURN_CODE = "returnCode"; |
|
|
|
public static final String TJD_RETURN_SUCC = "T"; |
|
|
|
@@ -56,6 +59,21 @@ public class TJDUtil { |
|
|
|
public static final String TJD_PAY_AMT = "payAmount"; |
|
|
|
public static final String TJD_PAY_DT = "payDt"; |
|
|
|
public static final String TJD_FREE_MINS = "freeMins"; |
|
|
|
public static final String TJD_ACCOUNT_ID = "accountId"; |
|
|
|
public static final String TJD_PREPAY_TYPE = "prePayType"; |
|
|
|
public static final String TJD_PREPAY_TYPE_3 = "3"; // 三方合作方支付 |
|
|
|
public static final String TJD_PREPAY_TYPE_20 = "20"; // 手机场内支付 |
|
|
|
public static final String TJD_DETAIL_LIST = "detailList"; |
|
|
|
public static final String TJD_OUT_TRADE_NO = "outTradeNo"; |
|
|
|
public static final String TJD_TYPE = "type"; |
|
|
|
public static final String TJD_TYPE_DISCOUNT = "0"; |
|
|
|
public static final String TJD_TYPE_COUPON = "1"; |
|
|
|
public static final String TJD_COUPON_TYPE = "couponType"; |
|
|
|
public static final String TJD_CHANNEL = "channel"; |
|
|
|
public static final String TJD_AMOUNT = "amount"; |
|
|
|
public static final String TJD_MINUTES = "minutes"; |
|
|
|
public static final String TJD_CREDIT = "integral"; |
|
|
|
public static final String TJD_MEMO = "memo"; |
|
|
|
|
|
|
|
public static final SimpleDateFormat dateInFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
public static final SimpleDateFormat dateOutFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
|
|
|
@@ -177,7 +195,7 @@ public class TJDUtil { |
|
|
|
if (outCarId != null) { |
|
|
|
paramMap.put("outCardId", outCarId); |
|
|
|
} |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -220,7 +238,7 @@ public class TJDUtil { |
|
|
|
|
|
|
|
Map<String, String> paramMap = MapUtil.getOrderMap(); |
|
|
|
paramMap.put("carId", carId); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -267,7 +285,7 @@ public class TJDUtil { |
|
|
|
//paramMap.put("pmParkId", ""); |
|
|
|
paramMap.put(TJD_FREE_MINS, freeMins); |
|
|
|
//paramMap.put("tradeId", ""); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -299,40 +317,92 @@ public class TJDUtil { |
|
|
|
* @param partner |
|
|
|
* @param key // 密钥 |
|
|
|
* @param version |
|
|
|
* type 可选值:0=抵扣、1=优惠券 |
|
|
|
* couponType type=1时必填,可选值:0=金额、1=时长、2=全免、3=时间区间 |
|
|
|
* channel 可选值: type=0时:5013=微信、5014=支付宝、5015=抵扣其他 |
|
|
|
* type=1时:2202=会员等级、2203=会员积分、2204=会员卡券、2205=会员补贴、2206=会员其他 |
|
|
|
* amount: type=0时、couponType=0必填,单位(元),保留小数点后两位,金额类型使用 |
|
|
|
* minutes: couponType=1时必填,单位(分钟),时长类型使用 |
|
|
|
* integral: 大于等于0的整数值,积分类型使用,如果使用了积分兑换,可填写积分值 |
|
|
|
* expireDt: type=1时选填,格式:yyyyMMddHHmmss,如果不填,则永不过期,若填写,则出场时间在此 时间之后,认为此记录已经过期,不再使用 |
|
|
|
* membershipGrade: 调用方系统会员等级标识,如:LV1、VIP2、金卡等,长度不超过64位 |
|
|
|
* identityType: identityId非空时,此值必填,可选值:01=手机号、02=会员卡号、03=车牌号、04=身份证号 |
|
|
|
* identityId: identityType非空时,此值必填,对应身份标识类型的唯一值,长度不超过100位 |
|
|
|
* { |
|
|
|
"service": "parkhub.order.deductionForDetail", |
|
|
|
"partner": "120a565de377427184de35ca0f320764", |
|
|
|
"sign": "3347b109a1e44f3fd5baa78b74a84948", |
|
|
|
"signType": "md5", |
|
|
|
"charset": "utf-8", |
|
|
|
"version": "1.0", |
|
|
|
"timestamp": "2016-05-26 11:30:10", |
|
|
|
"tradeId": "c39d3aac49d04e12a187681e6189f841", |
|
|
|
"accountId": "a9b2963c98344bb292e0fa3f7dd70946", |
|
|
|
"prePayType": "3", |
|
|
|
"giveFreeTimeOut": "false", |
|
|
|
"detailList":"[{ |
|
|
|
},{ |
|
|
|
},{ |
|
|
|
\"outTradeNo\":\"PLDKY01\", \"identityType\":\"01\", \"identityId\":\"17710111111\", \"membershipGrade\":\"LV1\", \"amount\":\"12.50\", \"type\":\"0\", \"channel\":\"5013\", \"memo\":\"批量抵扣-金额-微信\" |
|
|
|
\"outTradeNo\":\"PLDKY02\", \"identityType\":\"01\", \"identityId\":\"17710111111\", \"membershipGrade\":\"LV1\", \"couponType\":\"1\", \"minutes\":\"60\", \"type\":\"1\", \"channel\":\"2204\", \"memo\":\"批量抵扣-时长-会员卡券\" |
|
|
|
\"outTradeNo\":\"PLDKY03\", \"identityType\":\"01\", \"identityId\":\"17710111111\", \"membershipGrade\":\"LV1\", \"couponType\":\"3\", \"startDt\":\"20180901110000\", \"endDt\":\"20180901170000\", \"integral\":\"500\", |
|
|
|
\"type\":\"1\", |
|
|
|
\"channel\":\"2205\", \"memo\":\"批量抵扣-区间-积分-会员补贴\" |
|
|
|
}]" |
|
|
|
"service": "parkhub.order.deductionForDetail", |
|
|
|
"partner": "120a565de377427184de35ca0f320764", |
|
|
|
"sign": "3347b109a1e44f3fd5baa78b74a84948", |
|
|
|
"signType": "md5", |
|
|
|
"charset": "utf-8", |
|
|
|
"version": "1.0", |
|
|
|
"timestamp": "2016-05-26 11:30:10", |
|
|
|
"tradeId": "c39d3aac49d04e12a187681e6189f841", |
|
|
|
"accountId": "a9b2963c98344bb292e0fa3f7dd70946", |
|
|
|
"prePayType": "3", |
|
|
|
"giveFreeTimeOut": "false", |
|
|
|
"detailList":"[{ |
|
|
|
\"outTradeNo\":\"PLDKY01\", |
|
|
|
\"identityType\":\"01\", |
|
|
|
\"identityId\":\"17710111111\", |
|
|
|
\"membershipGrade\":\"LV1\", |
|
|
|
\"amount\":\"12.50\", |
|
|
|
\"type\":\"0\", |
|
|
|
\"channel\":\"5013\", |
|
|
|
\"memo\":\"批量抵扣-金额-微信\" |
|
|
|
},{ |
|
|
|
\"outTradeNo\":\"PLDKY02\", |
|
|
|
\"identityType\":\"01\", |
|
|
|
\"identityId\":\"17710111111\", |
|
|
|
\"membershipGrade\":\"LV1\", |
|
|
|
\"couponType\":\"1\", |
|
|
|
\"minutes\":\"60\", |
|
|
|
\"type\":\"1\", |
|
|
|
\"channel\":\"2204\", |
|
|
|
\"memo\":\"批量抵扣-时长-会员卡券\" |
|
|
|
},{ |
|
|
|
\"outTradeNo\":\"PLDKY03\", |
|
|
|
\"identityType\":\"01\", |
|
|
|
\"identityId\":\"17710111111\", |
|
|
|
\"membershipGrade\":\"LV1\", |
|
|
|
\"couponType\":\"3\", |
|
|
|
\"startDt\":\"20180901110000\", |
|
|
|
\"endDt\":\"20180901170000\", |
|
|
|
\"integral\":\"500\", |
|
|
|
\"type\":\"1\", |
|
|
|
\"channel\":\"2205\", \"memo\":\"批量抵扣-区间-积分-会员补贴\" |
|
|
|
}]" |
|
|
|
} |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
public static String deductionForDetail(String url, String partner, String key, String version, |
|
|
|
String tradeId, String outTradeNo, String accountId, String deductionAmount) { |
|
|
|
public static String deductionForDetail( |
|
|
|
String url, String partner, String key, String version, |
|
|
|
String tradeId, String accountId, |
|
|
|
WxCouponOrder couponOrder, WxCoupon coupon) { |
|
|
|
// 为指定订单抵扣停车费,如果此时车辆已经出场,返回isSuccess错误码为3,停简单系统不再接收此笔抵扣信息,对方系统 需要给用户发起退款。 |
|
|
|
String service = "parkhub.order.deductionNotSettle"; |
|
|
|
String service = "parkhub.order.deductionForDetail"; |
|
|
|
Map<String, String> paramMap = MapUtil.getOrderMap(); |
|
|
|
paramMap.put(TJD_TRADE_ID, tradeId); |
|
|
|
paramMap.put("deductionAmount", deductionAmount); |
|
|
|
paramMap.put("outTradeNo", outTradeNo); |
|
|
|
paramMap.put("accountId", accountId); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_ACCOUNT_ID, accountId); |
|
|
|
paramMap.put(TJD_PREPAY_TYPE, TJD_PREPAY_TYPE_3); |
|
|
|
|
|
|
|
Map<String, String> detailMap = MapUtil.getOrderMap(); |
|
|
|
detailMap.put(TJD_OUT_TRADE_NO, String.valueOf(couponOrder.getId())); |
|
|
|
detailMap.put(TJD_TYPE, TJD_TYPE_COUPON); |
|
|
|
detailMap.put(TJD_CHANNEL, "2204"); |
|
|
|
String memo = "会员优惠券"; |
|
|
|
if (coupon.getUnit().equals(0)) { |
|
|
|
detailMap.put(TJD_COUPON_TYPE, "0"); |
|
|
|
detailMap.put(TJD_AMOUNT, coupon.getPriceStr()); |
|
|
|
memo += "-金额"; |
|
|
|
} else { |
|
|
|
detailMap.put(TJD_COUPON_TYPE, "1"); |
|
|
|
detailMap.put(TJD_MINUTES, String.valueOf(coupon.getPrice()*60)); |
|
|
|
memo += "-时长"; |
|
|
|
} |
|
|
|
detailMap.put(TJD_MEMO, memo); |
|
|
|
paramMap.put(TJD_DETAIL_LIST, JSON.toJSONString(detailMap)); |
|
|
|
|
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -380,7 +450,7 @@ public class TJDUtil { |
|
|
|
paramMap.put("deductionAmount", deductionAmount); |
|
|
|
paramMap.put("outTradeNo", outTradeNo); |
|
|
|
paramMap.put("accountId", accountId); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -431,7 +501,7 @@ public class TJDUtil { |
|
|
|
paramMap.put("prePayType", prePayType); |
|
|
|
paramMap.put("minutes", minutes); |
|
|
|
paramMap.put("memo", memo); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -487,7 +557,7 @@ public class TJDUtil { |
|
|
|
paramMap.put("EndDt", EndDt); |
|
|
|
paramMap.put("expireDt", expireDt); |
|
|
|
paramMap.put("memo", memo); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
@@ -530,7 +600,7 @@ public class TJDUtil { |
|
|
|
Map<String, String> paramMap = MapUtil.getOrderMap(); |
|
|
|
paramMap.put("tradeId", tradeId); |
|
|
|
paramMap.put("ticketid", ticketid); |
|
|
|
paramMap.put(TJD_CHARSET, "utf-8"); |
|
|
|
paramMap.put(TJD_CHARSET, TJD_UTF_8); |
|
|
|
paramMap.put(TJD_ACCOUNT, partner); |
|
|
|
paramMap.put(TJD_VERSION, version); |
|
|
|
|
|
|
|
|