Explorar o código

1、添加教务老师字段
2、布置作业

Joburgess %!s(int64=5) %!d(string=hai) anos
pai
achega
6ea28fb6c1

+ 14 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CoursesGroupServiceImpl.java

@@ -75,6 +75,8 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
     @Autowired
     private SysTenantAccountService sysTenantAccountService;
+    @Autowired
+    private StudentDao studentDao;
 
     private static final Logger LOGGER = LoggerFactory
             .getLogger(PracticeGroupService.class);
@@ -108,6 +110,8 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
             throw new BizException("请填写课程数量");
         }
 
+        studentDao.lockUser(courseGroup.getTeacherId());
+
         //总课程时长
         Integer totalCourseTime=courseCycleInfo.getCourseCount()*courseCycleInfo.getSingleClassMinutes();
         SysTenantAccount sysTenantAccount = sysTenantAccountService.get(courseGroup.getTeacherId());
@@ -306,14 +310,20 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
         if(Objects.isNull(courseGroupId)){
             throw new BizException("请指定课程组");
         }
-        List<ClassGroupStudentMapper> groupStudents = classGroupStudentMapperDao.findGroupStudents(courseGroupId.toString(), GroupType.COMM, userId, null);
-        if(!CollectionUtils.isEmpty(groupStudents)){
-            throw new BizException("您已购买过此课程组");
-        }
+
+        studentDao.lockUser(userId);
+
         CoursesGroup coursesGroup = coursesGroupDao.get(courseGroupId);
         if(Objects.isNull(coursesGroup)){
             throw new BizException("此课程组不存在");
         }
+        if(coursesGroup.getStatus().equals(GroupStatusEnum.CANCEL)){
+            throw new BizException("此课程组已关闭");
+        }
+        List<ClassGroupStudentMapper> groupStudents = classGroupStudentMapperDao.findGroupStudents(courseGroupId.toString(), GroupType.COMM, userId, null);
+        if(!CollectionUtils.isEmpty(groupStudents)){
+            throw new BizException("您已购买过此课程组");
+        }
 
         Date now=new Date();