记得上下班打卡 | git大法好,push需谨慎

Commit 71599584 authored by 胡佳晨's avatar 胡佳晨

提交 order 支持 appletb

parent b1f19ae7
...@@ -195,9 +195,16 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy { ...@@ -195,9 +195,16 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
@Override @Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) { public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
DragonOrdersDto ordersDto = dataUtilsDragon.getPayOrderByCode(code); DragonOrdersDto ordersDto = dataUtilsDragon.getPayOrderByCode(code);
Map<String, Object> resultMap = wepayBiz.tradeQuery(code,this.getAppid()); Map<String, Object> resultMap = null;
if(code.contains("b")){
resultMap = wepayBiz.tradeQuery(code, PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
resultMap = wepayBiz.tradeQuery(code,this.getAppid());
}
DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto); DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
Object returnCode = resultMap.get("return_code"); Object returnCode = resultMap.get("return_code");
// 查询失败 // 查询失败
if (null == returnCode || "FAIL".equals(returnCode)) { if (null == returnCode || "FAIL".equals(returnCode)) {
......
...@@ -32,7 +32,11 @@ public class WepayStrategyAppletImpl extends AbstractWepayStrategy{ ...@@ -32,7 +32,11 @@ public class WepayStrategyAppletImpl extends AbstractWepayStrategy{
@Override @Override
SortedMap<String, Object> appendRequestParam(SortedMap<String, Object> requestMap, DragonPayBaseReqDto dragonPayBaseReqDto) { SortedMap<String, Object> appendRequestParam(SortedMap<String, Object> requestMap, DragonPayBaseReqDto dragonPayBaseReqDto) {
requestMap.put("trade_type", "JSAPI"); requestMap.put("trade_type", "JSAPI");
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID()); requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
}
requestMap.put("openid", dragonPayBaseReqDto.getOpenId()); //只有trade_type="JSAPI"时必须传 requestMap.put("openid", dragonPayBaseReqDto.getOpenId()); //只有trade_type="JSAPI"时必须传
return requestMap; return requestMap;
} }
......
...@@ -89,6 +89,10 @@ public class PayController { ...@@ -89,6 +89,10 @@ public class PayController {
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew(); DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(payType); dragonPayBaseReqDto.setPayType(payType);
dragonPayBaseReqDto.setDeviceFrom(deviceFrom); dragonPayBaseReqDto.setDeviceFrom(deviceFrom);
if(deviceFrom.equals("appletb")){
dragonPayBaseReqDto.setDeviceFrom("applet");
dragonPayBaseReqDto.setAppIdType("b");
}
dragonPayBaseReqDto.setOpenId(openId); dragonPayBaseReqDto.setOpenId(openId);
dragonPayBaseReqDto.setType(type); dragonPayBaseReqDto.setType(type);
dragonPayBaseReqDto.setPrice(price); dragonPayBaseReqDto.setPrice(price);
......
...@@ -122,6 +122,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService ...@@ -122,6 +122,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
case DragonConstant.REFUND_TYPE_APPLET_WEPAY: case DragonConstant.REFUND_TYPE_APPLET_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime); dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break; break;
case DragonConstant.REFUND_TYPE_APPLETB_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLET_DOUYIN: case DragonConstant.REFUND_TYPE_APPLET_DOUYIN:
dataUtilsDragon.setOrderCode(orderRefundCode, orderCode); dataUtilsDragon.setOrderCode(orderRefundCode, orderCode);
dto = douYinRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localDouYinCallBackUrl, nowTime); dto = douYinRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localDouYinCallBackUrl, nowTime);
...@@ -418,6 +421,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService ...@@ -418,6 +421,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
parameters.put("appid", PayWepayUtils.getInstance().getWAP_APP_ID()); parameters.put("appid", PayWepayUtils.getInstance().getWAP_APP_ID());
}else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_MICROPAY_WEPAY.getCode())){ }else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_MICROPAY_WEPAY.getCode())){
parameters.put("appid", PayWepayUtils.getInstance().getAPP_ID()); parameters.put("appid", PayWepayUtils.getInstance().getAPP_ID());
}else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLETB_WEPAY.getCode())){
parameters.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
} }
parameters.put("nonce_str", nonceStr); parameters.put("nonce_str", nonceStr);
parameters.put("out_refund_no", refundCode); parameters.put("out_refund_no", refundCode);
......
...@@ -73,7 +73,7 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService { ...@@ -73,7 +73,7 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
public Map validateDragonPay(DragonPayBaseReqDto dragonPayBaseReqDto){ public Map validateDragonPay(DragonPayBaseReqDto dragonPayBaseReqDto){
HashMap<String, Object> map= ObjectUtilDragon.cloneHashMapStringAndObj(); HashMap<String, Object> map= ObjectUtilDragon.cloneHashMapStringAndObj();
if (dragonPayBaseReqDto.getPayType().equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) { if (dragonPayBaseReqDto.getPayType().equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) {
if (dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) { if (dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode()) ||dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLETB.getCode()) ) {
if (StringUtil.isEmpty(dragonPayBaseReqDto.getOpenId())) { if (StringUtil.isEmpty(dragonPayBaseReqDto.getOpenId())) {
map.put("resultStatus",false); map.put("resultStatus",false);
map.put("erro","微信支付openId不能为空!"); map.put("erro","微信支付openId不能为空!");
......
...@@ -33,16 +33,18 @@ public class PayWepayUtils { ...@@ -33,16 +33,18 @@ public class PayWepayUtils {
private static PayWepayUtils instance = new PayWepayUtils(); private static PayWepayUtils instance = new PayWepayUtils();
// 池化管理 // 池化管理
private static PoolingHttpClientConnectionManager poolConnManager =null; private static PoolingHttpClientConnectionManager poolConnManager = null;
private final String merchantId = "1551961491"; private final String merchantId = "1551961491";
private final String partnerKey = "itIuO65O9yKmemOu3S8g1S4orqvCGwXK"; private final String partnerKey = "itIuO65O9yKmemOu3S8g1S4orqvCGwXK";
private final String APP_ID="wx86f9777acf2cb585"; private final String APP_ID = "wx86f9777acf2cb585";
private final String WEB_APP_ID="wx3498304dda39c5a1"; private final String WEB_APP_ID = "wx3498304dda39c5a1";
private final String JS_APP_ID="wx3498304dda39c5a1"; private final String JS_APP_ID = "wx3498304dda39c5a1";
private final String WAP_APP_ID="wx3498304dda39c5a1"; private final String WAP_APP_ID = "wx3498304dda39c5a1";
private final String APPLET_APP_ID="wx4732efeaa2b08086"; private final String APPLET_APP_ID = "wx4732efeaa2b08086";
private final String APPLETB_APPID="wxe3a093ce7278d5b1";
private final String merchantBId="1614003616";
public PayWepayUtils() { public PayWepayUtils() {
} }
...@@ -76,6 +78,14 @@ public class PayWepayUtils { ...@@ -76,6 +78,14 @@ public class PayWepayUtils {
return merchantId; return merchantId;
} }
public String getAPPLETB_APPID() {
return APPLETB_APPID;
}
public String getMerchantBId() {
return merchantBId;
}
// public CloseableHttpClient getHttpClient() { // public CloseableHttpClient getHttpClient() {
// try { // try {
// if (httpClient == null) { // if (httpClient == null) {
...@@ -133,7 +143,7 @@ public class PayWepayUtils { ...@@ -133,7 +143,7 @@ public class PayWepayUtils {
// 配置同时支持 HTTP 和 HTPPS // 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build(); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build();
// 初始化连接管理器 // 初始化连接管理器
poolConnManager =new PoolingHttpClientConnectionManager(socketFactoryRegistry); poolConnManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager.setMaxTotal(4000);// 同时最多连接数 poolConnManager.setMaxTotal(4000);// 同时最多连接数
// 设置最大路由 // 设置最大路由
poolConnManager.setDefaultMaxPerRoute(2000); poolConnManager.setDefaultMaxPerRoute(2000);
...@@ -154,7 +164,7 @@ public class PayWepayUtils { ...@@ -154,7 +164,7 @@ public class PayWepayUtils {
.setConnectionManager(poolConnManager) .setConnectionManager(poolConnManager)
.setDefaultRequestConfig(config) .setDefaultRequestConfig(config)
// 设置重试次数 // 设置重试次数
.setRetryHandler(new DefaultHttpRequestRetryHandler(2,false)).build(); .setRetryHandler(new DefaultHttpRequestRetryHandler(2, false)).build();
return httpClient; return httpClient;
} }
...@@ -208,7 +218,7 @@ public class PayWepayUtils { ...@@ -208,7 +218,7 @@ public class PayWepayUtils {
public String unCodeReqInfo(String reqInfo) { public String unCodeReqInfo(String reqInfo) {
try { try {
Cipher cipher ; Cipher cipher;
String key = MD5Utils.md5(partnerKey); String key = MD5Utils.md5(partnerKey);
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "AES"); SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "AES");
Security.addProvider(new BouncyCastleProvider()); Security.addProvider(new BouncyCastleProvider());
...@@ -266,8 +276,8 @@ public class PayWepayUtils { ...@@ -266,8 +276,8 @@ public class PayWepayUtils {
SortedMap<String, Object> smap = new TreeMap<String, Object>(map); SortedMap<String, Object> smap = new TreeMap<String, Object>(map);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (Map.Entry<String, Object> m : smap.entrySet()) { for (Map.Entry<String, Object> m : smap.entrySet()) {
if(null!=m.getValue()){ if (null != m.getValue()) {
if(StringUtils.isNotBlank(m.getValue().toString())){ if (StringUtils.isNotBlank(m.getValue().toString())) {
sb.append(m.getKey()).append("=").append(m.getValue()).append("&"); sb.append(m.getKey()).append("=").append(m.getValue()).append("&");
} }
} }
...@@ -286,6 +296,6 @@ public class PayWepayUtils { ...@@ -286,6 +296,6 @@ public class PayWepayUtils {
paramMap.put("noncestr", "rGcsOnNdZ4d9zu6k3yCbVJRG8Ombp8VW"); paramMap.put("noncestr", "rGcsOnNdZ4d9zu6k3yCbVJRG8Ombp8VW");
paramMap.put("timestamp", "1627276483"); paramMap.put("timestamp", "1627276483");
String sign = PayWepayUtils.getInstance().createSign(paramMap); String sign = PayWepayUtils.getInstance().createSign(paramMap);
System.out.println("1627274771===="+sign); System.out.println("1627274771====" + sign);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment