change 3 lat temu
rodzic
commit
cef20f6d3e

+ 8 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamNumberServiceImpl.java

@@ -142,12 +142,19 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
                         throw new IllegalArgumentException("当前商品已启用考次配置,不可开启,请重新创建新的配置考试次数和前培次数商品");
                     }
                 }
-                if (bo.getStatus() == 0){
+                if (bo.getStatus() == -1 || bo.getStatus()==1){
                     ExamNumberGoodsQueryBo examNumberGoodsQueryBo = new ExamNumberGoodsQueryBo();
                     List<Integer> status = new ArrayList<>();
                     status.add(1);
                     examNumberGoodsQueryBo.setGoodsId(goodsId);
                     List<ExamNumberGoodsVo> examNumberGoodsVos = examApplyMapper.listGoods(examNumberGoodsQueryBo);
+                    if (CollectionUtils.isNotEmpty(examNumberGoodsVos)){
+                        for (ExamNumberGoodsVo examNumberGoodsVo : examNumberGoodsVos) {
+                            if (examNumberGoodsVo.getGoodsStatus() == 0){
+                                throw new IllegalArgumentException("当前商品已启用考试安排,不可开启或关闭");
+                            }
+                        }
+                    }
                 }
                 ExamNumberGoodsAddBo examNumberGoodsAddBo = new ExamNumberGoodsAddBo();
                 examNumberGoodsAddBo.setGoodsId(goodsId);