|
|
|
@ -1,10 +1,13 @@ |
|
|
|
|
package com.hfkj.service.coupon.channel; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hfkj.common.utils.HttpsUtils; |
|
|
|
|
import com.hfkj.common.utils.MD5Util; |
|
|
|
|
import com.hfkj.config.CommonSysConst; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
@ -20,7 +23,9 @@ import java.util.Set; |
|
|
|
|
* @createTime 18:33 2023/11/13 |
|
|
|
|
**/ |
|
|
|
|
@Configuration |
|
|
|
|
public class PcytCNPCCouponService { |
|
|
|
|
public class PcytCNPCCouponConfig { |
|
|
|
|
|
|
|
|
|
private static Logger log = LoggerFactory.getLogger(PcytCNPCCouponConfig.class); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Author Sum1Dream |
|
|
|
@ -30,11 +35,18 @@ public class PcytCNPCCouponService { |
|
|
|
|
* @return com.alibaba.fastjson.JSONObject |
|
|
|
|
*/ |
|
|
|
|
public static JSONObject getCouponList() throws Exception { |
|
|
|
|
log.info("========================请求任务Start========================="); |
|
|
|
|
JSONObject paramMap = new JSONObject(); |
|
|
|
|
paramMap.put("method" , "api.coupon.reserve"); |
|
|
|
|
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); |
|
|
|
|
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); |
|
|
|
|
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
|
|
|
|
|
log.info("获取卡券列表-请求参数: " + JSON.toJSONString(paramMap)); |
|
|
|
|
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
log.info("获取卡券列表-回调参数: " + JSON.toJSONString(object)); |
|
|
|
|
log.info("========================请求任务End========================="); |
|
|
|
|
// 请求接口
|
|
|
|
|
return object; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -46,6 +58,7 @@ public class PcytCNPCCouponService { |
|
|
|
|
* @return com.alibaba.fastjson.JSONObject |
|
|
|
|
*/ |
|
|
|
|
public static JSONObject getCoupon(String orderNo , String mobile, String reqCode) throws Exception { |
|
|
|
|
log.info("========================请求任务Start========================="); |
|
|
|
|
JSONObject paramMap = new JSONObject(); |
|
|
|
|
|
|
|
|
|
paramMap.put("method" , "api.coupon.once"); |
|
|
|
@ -54,7 +67,14 @@ public class PcytCNPCCouponService { |
|
|
|
|
paramMap.put("reqCode" , reqCode); |
|
|
|
|
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); |
|
|
|
|
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); |
|
|
|
|
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("获取电子券-请求参数: " + JSON.toJSONString(paramMap)); |
|
|
|
|
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
log.info("获取电子券-回调参数: " + JSON.toJSONString(object)); |
|
|
|
|
log.info("========================请求任务End========================="); |
|
|
|
|
// 请求接口
|
|
|
|
|
return object; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -66,13 +86,20 @@ public class PcytCNPCCouponService { |
|
|
|
|
* @return com.alibaba.fastjson.JSONObject |
|
|
|
|
*/ |
|
|
|
|
public static JSONObject getCouponQuery(String couponCode ) throws Exception { |
|
|
|
|
log.info("========================请求任务Start========================="); |
|
|
|
|
JSONObject paramMap = new JSONObject(); |
|
|
|
|
|
|
|
|
|
paramMap.put("method" , "api.coupon.query"); |
|
|
|
|
paramMap.put("couponCode" , couponCode); |
|
|
|
|
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); |
|
|
|
|
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); |
|
|
|
|
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
|
|
|
|
|
log.info("查询电子券信息-请求参数: " + JSON.toJSONString(paramMap)); |
|
|
|
|
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
log.info("查询电子券信息-回调参数: " + JSON.toJSONString(object)); |
|
|
|
|
log.info("========================请求任务End========================="); |
|
|
|
|
// 请求接口
|
|
|
|
|
return object; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -84,13 +111,20 @@ public class PcytCNPCCouponService { |
|
|
|
|
* @return com.alibaba.fastjson.JSONObject |
|
|
|
|
*/ |
|
|
|
|
public static JSONObject getCouponDestroy(String couponCode ) throws Exception { |
|
|
|
|
|
|
|
|
|
log.info("========================请求任务Start========================="); |
|
|
|
|
JSONObject paramMap = new JSONObject(); |
|
|
|
|
|
|
|
|
|
paramMap.put("method" , "api.coupon.destroy"); |
|
|
|
|
paramMap.put("couponCode" , couponCode); |
|
|
|
|
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); |
|
|
|
|
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); |
|
|
|
|
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
log.info("作废电子券-请求参数: " + JSON.toJSONString(paramMap)); |
|
|
|
|
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); |
|
|
|
|
log.info("作废电子券-回调参数: " + JSON.toJSONString(object)); |
|
|
|
|
log.info("========================请求任务End========================="); |
|
|
|
|
// 请求接口
|
|
|
|
|
return object; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|