@@ -55,10 +55,13 @@ public class AutoOrderConsumer {
if(order == null){
return;
}
- IncrementAutoOrder incrementAutoOrder = autoOrderService.getBySubId(order.getSubscriptionId());
+ IncrementAutoOrder incrementAutoOrder = autoOrderService.getByOrderSn(order.getSubscriptionOrderSn());
if(incrementAutoOrder == null){
+ if(incrementAutoOrder.getSubscriptionId() == null){
+ autoOrderService.subOrder(order.getSubscriptionOrderSn(),order.getSubscriptionId());
+ }
switch (order.getEventType()){
case "PAYMENT.SALE.COMPLETED" : //每日扣款
@@ -17,7 +17,7 @@ public interface IIncrementAutoOrderService extends IService<IncrementAutoOrder>
void addOrder(Long userId, Integer incrementTypeId, Long incrementId, String orderSn);
- void subOrder(PayOrderVo order);
+ void subOrder(String orderSn,String subscriptionId);
IncrementAutoOrder getBySubId(String subscriptionId);
@@ -65,10 +65,10 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
@Override
- public void subOrder(PayOrderVo order) {
+ public void subOrder(String orderSn,String subscriptionId) {
LambdaUpdateWrapper<IncrementAutoOrder> wrapper = new LambdaUpdateWrapper<>();
- wrapper.eq(IncrementAutoOrder::getOrderSn,order.getOrderSn());
- wrapper.set(IncrementAutoOrder::getSubscriptionId,order.getTradeNo());
+ wrapper.eq(IncrementAutoOrder::getOrderSn,orderSn);
+ wrapper.set(IncrementAutoOrder::getSubscriptionId,subscriptionId);
this.update(wrapper);