Pārlūkot izejas kodu

Merge branch 'master' into review-zjh

# Conflicts:
#	mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/Pay.java
周箭河 5 gadi atpakaļ
vecāks
revīzija
2da34837a0

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -28,12 +28,14 @@ import com.ym.mec.util.collection.ListUtil;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.json.JsonUtil;
+
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -76,6 +78,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     @Autowired
     private SysMessageService sysMessageService;
     @Autowired
+    @Lazy
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
     @Autowired
     private VipGroupDao vipGroupDao;
@@ -106,6 +109,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     @Autowired
     private PracticeGroupDao practiceGroupDao;
     @Autowired
+    @Lazy
     private VipGroupService vipGroupService;
     @Autowired
     private MusicGroupService musicGroupService;
@@ -1930,6 +1934,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                 if (Objects.isNull(vipGroup)) {
                     throw new BizException("指定课程不存在");
                 }
+				if(!VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())){
+					throw new BizException("非进行中课程组不允许进行此操作");
+				}
                 singleClassMinutes = vipGroup.getSingleClassMinutes();
                 courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(),groupType.getCode());
         }
@@ -2699,6 +2706,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 						if (vipGroup == null) {
 							throw new BizException("课程[{}]记录存在异常,请联系管理员", courseScheduleId);
 						}
+						if(!VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())){
+							throw new BizException("非进行中课程组不允许进行此操作");
+						}
 
 						BigDecimal teacherSalary=BigDecimal.ZERO;
 
@@ -4051,6 +4061,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if(courseScheduleId == null || courseScheduleId.size() == 0){
             throw new BizException("课程已结算,无法清除考勤");
         }
+        if(courseScheduleId.size()==1){
+			VipGroup vipGroup = vipGroupDao.findByCourseSchedule(courseScheduleId.get(0));
+			if(Objects.nonNull(vipGroup)&&!VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())){
+				throw new BizException("当前课程组状态非进行中,无法进行该操作");
+			}
+		}
         teacherAttendanceDao.batchCleanCourseTeacherSignInfo(courseScheduleId);
         studentAttendanceDao.deleteByCourseSchedules(courseScheduleId);
         //重置学生人数

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -17,10 +17,12 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
@@ -45,6 +47,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
     @Autowired
     private SysUserCashAccountService sysUserCashAccountService;
     @Autowired
+    @Lazy
     private VipGroupService vipGroupService;
     @Autowired
     private SchoolService schoolService;

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -24,11 +24,13 @@ import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
@@ -52,6 +54,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	@Autowired
 	private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
 	@Autowired
+	@Lazy
 	private CourseScheduleService courseScheduleService;
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
@@ -86,6 +89,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Autowired
 	private SubjectDao subjectDao;
     @Autowired
+    @Lazy
 	private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
     @Autowired
 	private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.ClassGroupDao;
 import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.dto.BatchInsertCoursesDto;
 import com.ym.mec.biz.dal.dto.CoursePostponeDto;
 import com.ym.mec.biz.dal.dto.CreateCourseScheduleDto;
@@ -65,6 +66,8 @@ public class CourseScheduleController extends BaseController {
     
     @Autowired
     private EmployeeDao employeeDao;
+    @Autowired
+    private VipGroupDao vipGroupDao;
 
     @ApiOperation(value = "排课")
     @PostMapping("/batchAddCourseSchedule")
@@ -162,6 +165,12 @@ public class CourseScheduleController extends BaseController {
         if(Objects.isNull(oldCourseSchedule)){
             return failed("未找到指定课程");
         }
+        if(GroupType.VIP.equals(oldCourseSchedule.getGroupType())){
+            VipGroup vipGroup = vipGroupDao.findByCourseSchedule(courseSchedule.getId());
+            if(!VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())){
+                throw new BizException("当前课程组状态非进行中,无法进行该操作");
+            }
+        }
         if(Objects.isNull(courseSchedule.getClassGroupId())){
             courseSchedule.setClassGroupId(oldCourseSchedule.getClassGroupId());
         }