Browse Source

用户下单检查

he2802 3 năm trước cách đây
mục cha
commit
bf32155080

+ 33 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderUserCheckBuyBo.java

@@ -0,0 +1,33 @@
+package com.zhongzheng.modules.order.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 订单添加对象 order
+ *
+ * @author ruoyi
+ * @date 2021-11-08
+ */
+@Data
+@ApiModel("订单用户购买状态对象")
+public class OrderUserCheckBuyBo {
+
+
+    /** 商品ID */
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+
+    @ApiModelProperty("身份证号")
+    private String idCard;
+
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
+
+    @ApiModelProperty("提示内容")
+    private String msg;
+}

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderService.java

@@ -5,6 +5,7 @@ import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
 import com.zhongzheng.modules.order.bo.OrderAddBo;
 import com.zhongzheng.modules.order.bo.OrderEditBo;
 import com.zhongzheng.modules.order.bo.OrderQueryBo;
+import com.zhongzheng.modules.order.bo.OrderUserCheckBuyBo;
 import com.zhongzheng.modules.order.domain.Order;
 import com.zhongzheng.modules.order.vo.OrderListVo;
 import com.zhongzheng.modules.order.vo.OrderVo;
@@ -38,6 +39,8 @@ public interface IOrderService extends IService<Order> {
 
 	List<OrderListVo> selectRebuyList(OrderQueryBo bo);
 
+	List<OrderUserCheckBuyBo> userCheckBuyList(List<OrderUserCheckBuyBo> list);
+
 	/**
 	 * 根据新增业务对象插入订单
 	 * @param bo 订单新增业务对象

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -49,6 +49,7 @@ import com.zhongzheng.modules.order.domain.OrderPay;
 import com.zhongzheng.modules.order.mapper.OrderMapper;
 import com.zhongzheng.modules.order.service.*;
 import com.zhongzheng.modules.order.vo.*;
+import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserExamGoods;
 import com.zhongzheng.modules.user.service.IUserExamGoodsService;
 import com.zhongzheng.modules.user.service.IUserService;
@@ -223,6 +224,25 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         return orderListVos;
     }
 
+    @Override
+    public List<OrderUserCheckBuyBo> userCheckBuyList(List<OrderUserCheckBuyBo> list) {
+        for(OrderUserCheckBuyBo bo : list){
+            //订单商品
+            Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, bo.getGoodsId()));
+            if (goods.getGoodsStatus() != 1) {
+                bo.setMsg("商品已下架,请重新选择商品下单");
+                continue;
+            }
+            User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                    .eq(User::getIdCard,bo.getIdCard()).last("limit 1"));
+            if(Validator.isNull(user)){
+                bo.setMsg("该身份证用户不存在");
+                continue;
+            }
+        }
+        return list;
+    }
+
     /**
      * 实体类转化成视图对象
      *