bug
This commit is contained in:
@@ -200,7 +200,7 @@ public class BuyOrderController {
|
||||
// 订单总金额
|
||||
BigDecimal totalPrice = new BigDecimal(0);
|
||||
//是否存在手摸或脚模,修改用户的脉穴权限
|
||||
List<Integer> sjc =Arrays.asList(128,129,130,131);
|
||||
List<Integer> sjc =Arrays.asList(128,129,130,131,136);
|
||||
boolean sj_check = false;
|
||||
//是否存在时辰取穴的权限触发商品
|
||||
List<Integer> scqq = Arrays.asList(133,134,135);
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package com.peanut.modules.mq.Consumer;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.book.dao.BuyOrderProductDao;
|
||||
import com.peanut.modules.book.dao.ShopProductDao;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.peanut.modules.book.entity.BuyOrderProduct;
|
||||
import com.peanut.modules.book.entity.ShopProduct;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 消息超时取消死信队列消费者
|
||||
* @Author: Cauchy
|
||||
@@ -18,6 +25,10 @@ public class OrderCancelConsumer {
|
||||
|
||||
@Autowired
|
||||
BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
BuyOrderProductDao buyOrderProductDao;
|
||||
@Autowired
|
||||
ShopProductDao shopProductDao;
|
||||
|
||||
@RabbitListener(queues = DelayQueueConfig.ORDER_CANCEL_DEAD_LETTER_QUEUE)
|
||||
public void orderConsumer(String orderId) {
|
||||
@@ -27,6 +38,16 @@ public class OrderCancelConsumer {
|
||||
}
|
||||
if(Constants.ORDER_STATUS_TO_BE_PAID.equals(buyOrder.getOrderStatus())){
|
||||
buyOrder.setOrderStatus(Constants.ORDER_STATUS_OUT_OF_TIME);
|
||||
//回滚库存
|
||||
LambdaQueryWrapper<BuyOrderProduct> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BuyOrderProduct::getOrderId,buyOrder.getOrderId());
|
||||
List<BuyOrderProduct> buyOrderProducts = buyOrderProductDao.selectList(wrapper);
|
||||
for (BuyOrderProduct b : buyOrderProducts){
|
||||
ShopProduct shopProduct = shopProductDao.selectById(b.getProductId());
|
||||
shopProduct.setProductStock(shopProduct.getProductStock()+b.getQuantity());
|
||||
shopProductDao.updateById(shopProduct);
|
||||
}
|
||||
|
||||
}
|
||||
buyOrderService.updateById(buyOrder);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
}
|
||||
|
||||
List<Integer> collect = buyOrderProductDao.selectList(new LambdaQueryWrapper<BuyOrderProduct>().eq(BuyOrderProduct::getOrderId, orderEntity.getOrderId())).stream().map(BuyOrderProduct::getProductId).collect(Collectors.toList());
|
||||
if(collect.contains(128)||collect.contains(129)||collect.contains(130)||collect.contains(131)){
|
||||
if(collect.contains(128)||collect.contains(129)||collect.contains(130)||collect.contains(131)||collect.contains(136)){
|
||||
MyUserEntity userInfo = userService.getById(orderEntity.getUserId());
|
||||
userInfo.setPointPower(1);
|
||||
userService.updateById(userInfo);
|
||||
|
||||
@@ -152,7 +152,7 @@ public class WeChatPayController {
|
||||
userEbookBuyService.saveBatch(userEbookBuyEntities);
|
||||
//手摸脚模购买后会开启用户的脉穴的功能
|
||||
List<Integer> collect = buyOrderProductDao.selectList(new LambdaQueryWrapper<BuyOrderProduct>().eq(BuyOrderProduct::getOrderId, order.getOrderId())).stream().map(BuyOrderProduct::getProductId).collect(Collectors.toList());
|
||||
if(collect.contains(128)||collect.contains(129)||collect.contains(130)||collect.contains(131)){
|
||||
if(collect.contains(128)||collect.contains(129)||collect.contains(130)||collect.contains(131)||collect.contains(136)){
|
||||
MyUserEntity userInfo = userService.getById(order.getUserId());
|
||||
userInfo.setPointPower(1);
|
||||
userService.updateById(userInfo);
|
||||
|
||||
Reference in New Issue
Block a user