|
@@ -16,6 +16,8 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -28,23 +30,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.auth.api.entity.SysUserRole;
|
|
|
-import com.ym.mec.biz.dal.dao.GoodsDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentCourseFeeDetailDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SubjectDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
import com.ym.mec.biz.dal.dto.CourseFormDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentAddDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
|
|
@@ -115,6 +100,7 @@ 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.http.HttpUtil;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
@Service
|
|
|
public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, StudentRegistration> implements StudentRegistrationService {
|
|
@@ -187,6 +173,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
|
|
|
@Autowired
|
|
|
private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
|
|
|
+ @Autowired
|
|
|
+ private CourseScheduleDao courseScheduleDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentRegistration> getDAO() {
|
|
@@ -1298,14 +1286,52 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId) {
|
|
|
+ public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, Integer subjectId) {
|
|
|
List<StudentRegistration> students = studentRegistrationDao.findMusicGroupStudent(musicGroupId, subjectId);
|
|
|
List<Subject> subjectList = subjectService.findAll(new HashMap<>());
|
|
|
|
|
|
+ Map<CourseSchedule.CourseScheduleType, Integer> courseTypeCourseDurationMap = new HashMap<>();
|
|
|
+ Map<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCourseMap = new HashMap<>();
|
|
|
+ if(Objects.nonNull(classGroupId)){
|
|
|
+ List<CourseSchedule> classGroupNotStartCourse = courseScheduleDao.getClassGroupNotStartCourse(classGroupId);
|
|
|
+ typeCourseMap = classGroupNotStartCourse.stream().collect(Collectors.groupingBy(CourseSchedule::getType));
|
|
|
+ for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCoursesEntry : typeCourseMap.entrySet()) {
|
|
|
+ int totalCourseDuration = 0;
|
|
|
+ for (CourseSchedule courseSchedule : typeCoursesEntry.getValue()) {
|
|
|
+ //课程时长
|
|
|
+ int courseDuration = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
|
|
|
+ totalCourseDuration += courseDuration;
|
|
|
+ }
|
|
|
+ courseTypeCourseDurationMap.put(typeCoursesEntry.getKey(), totalCourseDuration);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findMusicGroupClassGroupByType(musicGroupId, type);
|
|
|
Iterator<StudentRegistration> iterator = students.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
StudentRegistration student = iterator.next();
|
|
|
+
|
|
|
+ boolean courseMinutesNotEnough = false;
|
|
|
+
|
|
|
+ for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> courseScheduleTypeListEntry : typeCourseMap.entrySet()) {
|
|
|
+ //当前课程类型总课程时长
|
|
|
+ Integer typeCourseDuration = courseTypeCourseDurationMap.get(courseScheduleTypeListEntry.getKey());
|
|
|
+
|
|
|
+ String batchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, student.getUserId(), courseScheduleTypeListEntry.getKey());
|
|
|
+
|
|
|
+ List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = musicGroupPaymentStudentCourseDetailDao.getUnUseWithStudentAndCourseTypeAndCourseMinutes(batchNo, student.getUserId(), courseScheduleTypeListEntry.getKey());
|
|
|
+ int totalCourseMinutes = musicGroupPaymentStudentCourseDetails.stream().mapToInt(MusicGroupPaymentStudentCourseDetail::getTotalCourseMinutes).reduce(0, Integer::sum);
|
|
|
+ if(CollectionUtils.isEmpty(musicGroupPaymentStudentCourseDetails)||totalCourseMinutes<typeCourseDuration){
|
|
|
+ iterator.remove();
|
|
|
+ courseMinutesNotEnough = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(courseMinutesNotEnough){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
for (Subject subject : subjectList) {
|
|
|
if (student.getActualSubjectId().equals(subject.getId())) {
|
|
|
student.setSubjectName(subject.getName());
|