|
@@ -38,6 +38,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.nacos.common.utils.UuidUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -542,6 +543,29 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
productApi.refundCouponByOrderId(orderId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void closeOrderByUser(String userId, Integer platform) {
|
|
|
+ List<OrdersVO> orderByUser = this.baseMapper.getOrderByUser(userId, platform);
|
|
|
+ if(CollectionUtils.isEmpty(orderByUser)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("关闭用户相同订单:{}", orderByUser);
|
|
|
+ for (OrdersVO orders : orderByUser) {
|
|
|
+ log.info("当前订单信息:{}", orders);
|
|
|
+ if (ObjectUtils.isNotEmpty(orders.getStatus()) && orders.getStatus().equals(OrderConstant.CREATED)) {
|
|
|
+ Order order = new Order();
|
|
|
+ order.setStatus(OrderConstant.CLOSED);
|
|
|
+ order.setId(orders.getId());
|
|
|
+ this.baseMapper.updateById(order);
|
|
|
+ }
|
|
|
+ //删除缓存中的订单
|
|
|
+ deleteTheCacheInTheCacheManager(orders.getEmail() + "-" + orders.getProductId() + "-" + orders.getPayment());
|
|
|
+ deleteTheCacheInTheCacheManager(orders.getUserId() + "-" + orders.getProductId() + "-" + orders.getPayment());
|
|
|
+ // 检查订单优惠券
|
|
|
+ productApi.refundCouponByOrderId(orders.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public OrderUpdateVO updateOrderSucceeded(OrderSucceededBO orderSucceeded) {
|
|
|
Order orders = new Order();
|