Sfoglia il codice sorgente

fix 过期商品下单

he2802 3 anni fa
parent
commit
b191835704

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

@@ -17,11 +17,13 @@ import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
+import com.zhongzheng.modules.grade.bo.ClassGradeUserTempQueryBo;
 import com.zhongzheng.modules.grade.domain.*;
 import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
 import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserTempService;
+import com.zhongzheng.modules.grade.vo.ClassGradeUserTempVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
 import com.zhongzheng.modules.inform.service.IInformRemindService;
@@ -450,6 +452,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
     //检查是否允许重复购买商品
     public boolean canBuyRepeatGoods(Long goodsId,Long userId){
+        //判断是否还有未过期的班级
         ClassGradeQueryBo bo = new ClassGradeQueryBo();
         bo.setUserId(userId);
         bo.setGoodsId(goodsId);
@@ -458,6 +461,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         if(list!=null&&list.size()>0){
             throw new CustomException("包含购买商品班级尚未过期");
         }
+        //判断是否有锁定的班级
+        ClassGradeUserTempQueryBo gradeUserTempQueryBo = new ClassGradeUserTempQueryBo();
+        gradeUserTempQueryBo.setUserId(userId);
+        gradeUserTempQueryBo.setGoodsId(goodsId);
+        gradeUserTempQueryBo.setStatus(ClassGradeUserTemp.STATUS_CLOSE);
+        List<ClassGradeUserTempVo> list1 = iClassGradeUserTempService.queryList(gradeUserTempQueryBo);
+        if(list1!=null&&list1.size()>0){
+            throw new CustomException("待支付包含购买商品班级尚未过期");
+        }
         return true;
     }