|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
import com.alibaba.fastjson.parser.Feature; |
|
|
import com.alibaba.fastjson.parser.Feature; |
|
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
|
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
|
|
|
|
|
import com.shop.cereshop.business.page.shop.Shop; |
|
|
import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo; |
|
|
import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo; |
|
|
import com.shop.cereshop.business.pay.xs.domain.XsRequestBo; |
|
|
import com.shop.cereshop.business.pay.xs.domain.XsRequestBo; |
|
|
import com.shop.cereshop.business.pay.xs.service.XsPayService; |
|
|
import com.shop.cereshop.business.pay.xs.service.XsPayService; |
|
@ -14,10 +15,10 @@ import com.shop.cereshop.business.pay.xs.utils.HttpUtils; |
|
|
import com.shop.cereshop.business.service.order.CereShopOrderService; |
|
|
import com.shop.cereshop.business.service.order.CereShopOrderService; |
|
|
import com.shop.cereshop.commons.config.XspayConfig; |
|
|
import com.shop.cereshop.commons.config.XspayConfig; |
|
|
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|
|
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|
|
|
|
|
import com.shop.cereshop.commons.constant.IntegerEnum; |
|
|
import com.shop.cereshop.commons.constant.WxPayEnum; |
|
|
import com.shop.cereshop.commons.constant.WxPayEnum; |
|
|
import com.shop.cereshop.commons.constant.XsPayEnum; |
|
|
import com.shop.cereshop.commons.constant.XsPayEnum; |
|
|
import com.shop.cereshop.commons.exception.CoBusinessException; |
|
|
import com.shop.cereshop.commons.exception.CoBusinessException; |
|
|
import com.shop.cereshop.commons.utils.EmptyUtils; |
|
|
|
|
|
import com.shop.cereshop.commons.utils.StringUtils; |
|
|
import com.shop.cereshop.commons.utils.StringUtils; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.http.client.utils.URIBuilder; |
|
|
import org.apache.http.client.utils.URIBuilder; |
|
@ -176,7 +177,7 @@ public class XsPayServiceImpl implements XsPayService { |
|
|
//构建请求参数 |
|
|
//构建请求参数 |
|
|
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); |
|
|
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); |
|
|
|
|
|
|
|
|
Map<String, Object> contentMap = buildPayContentMap(orderFormid, money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode(), XspayConfig.BUSINESS_RETURN_URL, |
|
|
|
|
|
|
|
|
Map<String, Object> contentMap = build05ContentMap(orderFormid, money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode(), XspayConfig.BUSINESS_RETURN_URL, |
|
|
XspayConfig.BUSINESS_NOTICE_URL); |
|
|
XspayConfig.BUSINESS_NOTICE_URL); |
|
|
//head+content做md5并根据加签方式加密 |
|
|
//head+content做md5并根据加签方式加密 |
|
|
String msg = CommonUtils.getRequestMsg(headMap, contentMap); |
|
|
String msg = CommonUtils.getRequestMsg(headMap, contentMap); |
|
@ -224,7 +225,7 @@ public class XsPayServiceImpl implements XsPayService { |
|
|
//构建请求参数 |
|
|
//构建请求参数 |
|
|
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); |
|
|
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); |
|
|
|
|
|
|
|
|
Map<String, Object> contentMap = buildPayContentMap(orderFormid, money, tradeType, payType, XspayConfig.APP_RETURN_URL, |
|
|
|
|
|
|
|
|
Map<String, Object> contentMap = build05ContentMap(orderFormid, money, tradeType, payType, XspayConfig.APP_RETURN_URL, |
|
|
XspayConfig.APP_NOTICE_URL); |
|
|
XspayConfig.APP_NOTICE_URL); |
|
|
|
|
|
|
|
|
XsRequestBo xsRequestBo = new XsRequestBo(); |
|
|
XsRequestBo xsRequestBo = new XsRequestBo(); |
|
@ -255,8 +256,8 @@ public class XsPayServiceImpl implements XsPayService { |
|
|
* 构建content请求参数——商家端的支付保证金,属于国内支付,不需要一些强制信息 |
|
|
* 构建content请求参数——商家端的支付保证金,属于国内支付,不需要一些强制信息 |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private static Map<String,Object> buildPayContentMap(String orderFormid, BigDecimal money, String tradeType, |
|
|
|
|
|
String payType, String returnUrl, String noticeUrl){ |
|
|
|
|
|
|
|
|
private static Map<String,Object> build05ContentMap(String orderFormid, BigDecimal money, String tradeType, |
|
|
|
|
|
String payType, String returnUrl, String noticeUrl){ |
|
|
// 设置请求正文 contentMap有序,顺序按照文档从上到下,为空字段可不传该字段 |
|
|
// 设置请求正文 contentMap有序,顺序按照文档从上到下,为空字段可不传该字段 |
|
|
Map<String, Object> contentMap = new LinkedHashMap<>(); |
|
|
Map<String, Object> contentMap = new LinkedHashMap<>(); |
|
|
//商户订单号 |
|
|
//商户订单号 |
|
@ -331,6 +332,54 @@ public class XsPayServiceImpl implements XsPayService { |
|
|
return contentMap; |
|
|
return contentMap; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 构建content请求参数 |
|
|
|
|
|
* @param operationType 0-初始化 1-新增 2-修改 |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private static Map<String,Object> build15ContentMap(Shop shop, String operationType){ |
|
|
|
|
|
Map<String, Object> contentMap = new LinkedHashMap<>(); |
|
|
|
|
|
contentMap.put("subUserId", shop.getShopId()); |
|
|
|
|
|
contentMap.put("name", shop.getShopName()); |
|
|
|
|
|
if(IntegerEnum.PERSONAL.getCode().equals(shop.getAuthenType())){ |
|
|
|
|
|
//个体 |
|
|
|
|
|
contentMap.put("type", "0"); |
|
|
|
|
|
contentMap.put("idNo", shop.getPersonal().getPersonalIdCard()); |
|
|
|
|
|
}else if(IntegerEnum.INDIVIDUAL.getCode().equals(shop.getAuthenType())){ |
|
|
|
|
|
//个体工商户 |
|
|
|
|
|
contentMap.put("type", "1"); |
|
|
|
|
|
contentMap.put("idNo", shop.getIndividualBusinesses().getSubjectCode()); |
|
|
|
|
|
}else if(IntegerEnum.ORGANIZATION.getCode().equals(shop.getAuthenType())){ |
|
|
|
|
|
//其他组织 |
|
|
|
|
|
contentMap.put("type", "1"); |
|
|
|
|
|
contentMap.put("idNo", shop.getOtherOrganizations().getOtherCode()); |
|
|
|
|
|
}else { |
|
|
|
|
|
//企业 |
|
|
|
|
|
contentMap.put("type", "1"); |
|
|
|
|
|
contentMap.put("idNo", shop.getEnterprise().getEnterpriseCode()); |
|
|
|
|
|
} |
|
|
|
|
|
contentMap.put("currencyCode", "CNY"); |
|
|
|
|
|
contentMap.put("operationType", operationType); |
|
|
|
|
|
contentMap.put("region", "0"); |
|
|
|
|
|
contentMap.put("country", "CHN"); |
|
|
|
|
|
|
|
|
|
|
|
contentMap.put("province", ""); |
|
|
|
|
|
contentMap.put("city", ""); |
|
|
|
|
|
|
|
|
|
|
|
contentMap.put("bankName", "中国工商银行"); |
|
|
|
|
|
//银行行号,各个银行节点对外的行号,没有人会记得,所以这先不用传值 |
|
|
|
|
|
contentMap.put("bankNo", ""); |
|
|
|
|
|
contentMap.put("bankAcctNo", "6212262201023557228"); |
|
|
|
|
|
contentMap.put("bankAddr", ""); |
|
|
|
|
|
contentMap.put("bankPeoNo", ""); |
|
|
|
|
|
|
|
|
|
|
|
contentMap.put("resv1", ""); |
|
|
|
|
|
contentMap.put("resv2", ""); |
|
|
|
|
|
|
|
|
|
|
|
contentMap.put("noticeUrl", "http://lcoalhost:8080/gatewayTest/notify"); |
|
|
|
|
|
return contentMap; |
|
|
|
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 构建分账明细 |
|
|
* 构建分账明细 |
|
|
* @return |
|
|
* @return |
|
|