Browse Source

fix 分班

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

+ 12 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -21,6 +21,8 @@ import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportAllVo;
 import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
 import com.zhongzheng.modules.order.bo.OrderAddBo;
+import com.zhongzheng.modules.order.service.IOrderService;
+import com.zhongzheng.modules.order.service.impl.OrderServiceImpl;
 import com.zhongzheng.modules.system.service.ISysUserService;
 import com.zhongzheng.modules.user.vo.UserExportVo;
 import io.swagger.annotations.ApiOperation;
@@ -56,6 +58,8 @@ public class CommonController
     private IGoodsService iGoodsService;
     @Autowired
     private IUserPeriodService iUserPeriodService;
+    @Autowired
+    private IOrderService iOrderService;
 
     /**
      * 通用下载请求
@@ -178,4 +182,12 @@ public class CommonController
         }
         return AjaxResult.success();
     }
+
+   /* @ApiOperation("测试分班")
+    @GetMapping("common/jzs/grade")
+    public AjaxResult<Void> testGrade()
+    {
+        iOrderService.arrangeGrade("安管继续教育网络班B类",905L,123L,null,114L,"",174L);
+        return AjaxResult.success();
+    }*/
 }

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

@@ -104,4 +104,8 @@ public interface IOrderService extends IService<Order> {
 	Long newFreeBankGoods(Long goodsId,Long orderGoodsId);
 
     List<Long> getUserGoods(Long userId);
+
+	boolean arrangeGrade(String goodsName, Long goodsId, Long orderGoodsId, Long gradeId, Long userId, String orderSn, Long businessId);
+
+
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -1441,6 +1441,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
      * @param gradeId
      * @return
      */
+    @Override
     public boolean arrangeGrade(String goodsName, Long goodsId, Long orderGoodsId, Long gradeId, Long userId, String orderSn, Long businessId) {
         //查询该学员有没有有效期内同商品班级 有就不允许添加
        /* Integer classNum = baseMapper.selectUserClass(goodsId,userId);
@@ -1491,7 +1492,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             ClassGradeVo classGradeVo = classGradeVoList.get(i);
             //临时锁定的班级学员数量
             LambdaQueryWrapper<ClassGradeUserTemp> lqwLock = new LambdaQueryWrapper<>();
-            lqwLock.eq(ClassGradeUserTemp::getGradeId, gradeId);
+            lqwLock.eq(ClassGradeUserTemp::getGradeId, classGradeVo.getGradeId());
             lqwLock.eq(ClassGradeUserTemp::getStatus, 1);
             int locakStudentNum = iClassGradeUserTempService.count(lqwLock);
             //预留0空位避免超人数