生态产品完善 创建订单, 确认订单, 订单详情接口 , 旅游团完善确认订单接口
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
package org.springblade.plugin.pay.api;
|
||||
|
||||
import org.springblade.plugin.pay.dto.APPPayDto;
|
||||
import org.springblade.plugin.pay.dto.APPQueryDto;
|
||||
import org.springblade.plugin.pay.response.APPPayResult;
|
||||
|
||||
public interface PaymentFacade {
|
||||
|
||||
APPPayResult appPay(APPPayDto dto) throws Exception;
|
||||
|
||||
Boolean query(APPQueryDto dto);
|
||||
|
||||
Boolean closeOrder(APPQueryDto dto);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.springblade.plugin.pay.api.PaymentFacade;
|
||||
import org.springblade.plugin.pay.config.AliPayConfiguration;
|
||||
import org.springblade.plugin.pay.config.WxPayConfiguration;
|
||||
import org.springblade.plugin.pay.dto.APPPayDto;
|
||||
import org.springblade.plugin.pay.dto.APPQueryDto;
|
||||
import org.springblade.plugin.pay.response.APPPayResult;
|
||||
import org.springblade.plugin.pay.service.IAliPayService;
|
||||
import org.springblade.plugin.pay.service.IWxPayService;
|
||||
@@ -76,43 +75,9 @@ public class PaymentFacadeImpl implements PaymentFacade {
|
||||
.setPaymentTypeEnum(paymentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean query(APPQueryDto dto){
|
||||
PaymentType paymentType = dto.getPaymentType();
|
||||
Boolean result = false;
|
||||
switch (paymentType) {
|
||||
case ALI:
|
||||
result = aliPayService.query(dto.getOrderNo(),aliPayConfig.getAppId(), aliPayConfig.getMachId());
|
||||
break;
|
||||
case WECHAT:
|
||||
|
||||
//todo 微信app查询支付结果
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException("支付类型错误");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean closeOrder(APPQueryDto dto) {
|
||||
PaymentType paymentType = dto.getPaymentType();
|
||||
Boolean result = false;
|
||||
switch (paymentType) {
|
||||
case ALI:
|
||||
result = aliPayService.closeOrder(dto.getOrderNo(),aliPayConfig.getAppId(), aliPayConfig.getMachId());
|
||||
break;
|
||||
case WECHAT:
|
||||
|
||||
//todo 微信app查询支付结果
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException("支付类型错误");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public class AliPayConfiguration {
|
||||
|
||||
private String appId;
|
||||
private String machId;
|
||||
private String aesKey;
|
||||
private String notifyUrl;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.springblade.plugin.pay.service;
|
||||
|
||||
import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||
import com.alipay.api.response.AlipayTradeRefundResponse;
|
||||
import org.springblade.plugin.pay.entityBiz.AliPayBiz;
|
||||
import org.springblade.plugin.pay.entityBiz.AliPayPageApiBiz;
|
||||
@@ -112,7 +113,7 @@ public interface IAliPayService {
|
||||
*/
|
||||
public AlipayTradeRefundResponse refund(String appId,String orderNo, String mchId, String refundMoney, String reason, String notifyUrl);
|
||||
|
||||
Boolean query(String orderNo , String appId, String mchId);
|
||||
AlipayTradeQueryResponse query(String orderNo , String appId, String mchId);
|
||||
|
||||
Boolean closeOrder(String orderNo , String appId, String mchId);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -334,6 +335,7 @@ public class AliPayServiceImpl implements IAliPayService {
|
||||
commonPayOrderEntity.setPaymentStatus(PaymentStatus.UNPAID.getCode());
|
||||
commonPayOrderEntity.setOrderNo(order.getOrderNo());
|
||||
commonPayOrderEntity.setPaymentType(PaymentType.ALI.getCode());
|
||||
commonPayOrderEntity.setCreateTime(new Date());
|
||||
commonPayOrderService.save(commonPayOrderEntity);
|
||||
AliPayAccountConfig aliPayAccountConfig = aliPayCheckBiz.getAliPayAccountConfig();
|
||||
Integer apiType = aliPayAccountConfig.getApiType();
|
||||
@@ -430,7 +432,7 @@ public class AliPayServiceImpl implements IAliPayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean query(String orderNo , String appId, String mchId) {
|
||||
public AlipayTradeQueryResponse query(String orderNo , String appId, String mchId) {
|
||||
|
||||
|
||||
AliPayAccountConfig aliPayAccountConfig = aliPayAccountConfigService.getInfoByMchIdAndAppId(mchId, appId);
|
||||
@@ -442,11 +444,11 @@ public class AliPayServiceImpl implements IAliPayService {
|
||||
try {
|
||||
response = aliPayApiService.query(orderNo, aliPayAccountConfig);
|
||||
log.info("支付宝账单:[{}]的支付结果为:{}", orderNo, response.getBody());
|
||||
return response.getTradeStatus().equalsIgnoreCase("TRADE_SUCCESS")
|
||||
|| response.getTradeStatus().equalsIgnoreCase("TRADE_FINISHED");
|
||||
return response;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("查询订单异常:{}", e.getMessage());
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -241,6 +242,7 @@ public class WxPayServiceImpl implements IWxPayService {
|
||||
commonPayOrderEntity.setPaymentStatus(PaymentStatus.UNPAID.getCode());
|
||||
commonPayOrderEntity.setOrderNo(order.getOrderNo());
|
||||
commonPayOrderEntity.setPaymentType(PaymentType.WECHAT.getCode());
|
||||
commonPayOrderEntity.setCreateTime(new Date());
|
||||
commonPayOrderService.save(commonPayOrderEntity);
|
||||
|
||||
WxPayAccountConfig wxPayAccountConfig = wxPayCheckBiz.getWxPayAccountConfig();
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springblade.core.log.logger.BladeLogger;
|
||||
import org.springblade.plugin.pay.common.AliPayException;
|
||||
import org.springblade.plugin.pay.config.AliPayConfiguration;
|
||||
import org.springblade.plugin.pay.entity.AliPayAccountConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -22,6 +23,7 @@ public class AliPayHttpUtil {
|
||||
private static final String JSON = "json";
|
||||
|
||||
private static final String CHARSETUTF8 = "UTF-8";
|
||||
private final AliPayConfiguration aliPayConfiguration;
|
||||
|
||||
/**
|
||||
* 发送POST请求
|
||||
@@ -168,7 +170,7 @@ public class AliPayHttpUtil {
|
||||
String pubKey = aliPayAccountConfig.getPubKey();
|
||||
String signType = aliPayAccountConfig.getSignType();
|
||||
aliPayClient = new DefaultAlipayClient(serviceUrl, appId, privateKey, JSON, CHARSETUTF8, pubKey, signType);
|
||||
((DefaultAlipayClient)aliPayClient).setEncryptKey(aliPayAccountConfig.getPayKey());
|
||||
((DefaultAlipayClient)aliPayClient).setEncryptKey(aliPayConfiguration.getAesKey());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user