调用同步接口
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
package com.sczx.pay.mapper;
|
||||
|
||||
import com.sczx.pay.entity.OrderMain;
|
||||
import com.sczx.pay.entity.PayStatus;
|
||||
import com.sczx.pay.entity.PaymentRecord;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -56,7 +57,7 @@ public interface OrderPayMapper {
|
||||
@Param("refundId") String refundId);
|
||||
|
||||
|
||||
@Select("select suborder_id from zc_order_sub where payment_id = #{paymentId}")
|
||||
@Select("select suborder_id from zc_order_sub where payment_id = #{paymentId} and suborder_type = 'RENTBATTEY' limit 1")
|
||||
Long getSubOrderIdByTradeNo(@Param("paymentId") String paymentId);
|
||||
|
||||
|
||||
|
||||
@ -407,20 +407,22 @@ public class WechatPayService {
|
||||
logger.info("微信支付记录状态已更新,订单号: {}, 微信交易号: {}", outTradeNo, transactionId);
|
||||
//更新主订单状态
|
||||
OrderMain orderMain = orderPayMapper.getOrderStatusByOrderNo(outTradeNo);
|
||||
String subOrderId = orderPayMapper.getSubOrderIdByTradeNo(outTradeNo).toString();
|
||||
|
||||
String OrderStatus = orderMain.getOrderStatus();
|
||||
|
||||
if(OrderStatus.equals("WAIT_PAY")){
|
||||
orderPayMapper.updateOrderStatus(orderMain.getOrderNo(),"WAIT_PICK");
|
||||
String subOrderId = orderPayMapper.getSubOrderIdByTradeNo(outTradeNo).toString();
|
||||
if (!subOrderId.isEmpty()) {
|
||||
String result = sendSubOrderId(subOrderId);
|
||||
logger.info("调用subOrder接口结果: {}", result);
|
||||
}
|
||||
}else if (OrderStatus.equals("RERENT_WAIT_PAY")){
|
||||
orderPayMapper.updateOrderStatus(orderMain.getOrderNo(),"RENT_ING");
|
||||
}
|
||||
orderPayMapper.updateSubOrderPaymentStatus(outTradeNo,"WX_PAY",PayStatus.SUCCESS.getCode(),transactionId);
|
||||
|
||||
if (subOrderId != null && !subOrderId.isEmpty()) {
|
||||
String result = sendSubOrderId(subOrderId);
|
||||
logger.info("调用subOrder接口结果: {}", result);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
logger.warn("未找到对应的微信支付记录,订单号: {}", outTradeNo);
|
||||
|
||||
Reference in New Issue
Block a user