|
@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
@@ -9,11 +10,13 @@ import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
+import com.ym.mec.biz.dal.mapper.CourseSchedulePlusMapper;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.dal.school.dto.ClassesForDayDto;
|
|
|
import com.ym.mec.biz.dal.school.dto.CourseStudentDto;
|
|
|
import com.ym.mec.biz.dal.school.dto.DailySummaryOfClassesForTheCurrentSemesterDto;
|
|
|
import com.ym.mec.biz.dal.school.dto.SummaryOfCurrentSemesterCoursesDto;
|
|
|
+import com.ym.mec.biz.dal.wrapper.TeachingPointWrapper;
|
|
|
import com.ym.mec.biz.event.source.CourseEventSource;
|
|
|
import com.ym.mec.biz.event.source.SendSeoMessageSource;
|
|
|
import com.ym.mec.biz.service.*;
|
|
@@ -53,6 +56,7 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.time.temporal.IsoFields;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
@@ -175,6 +179,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
@Autowired
|
|
|
private CourseScheduleConvertDao courseScheduleConvertDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CourseSchedulePlusMapper courseSchedulePlusMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TeacherService teacherService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TeacherAttendanceService teacherAttendanceService;
|
|
|
+
|
|
|
private final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(this.getClass());
|
|
|
|
|
@@ -449,7 +462,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (type == CourseScheduleType.VIP) {
|
|
|
throw new BizException("暂不支持vip课加课");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(type == CourseSchedule.CourseScheduleType.HIGH){
|
|
|
type = CourseScheduleType.HIGH_ONLINE;
|
|
|
}
|
|
@@ -761,7 +774,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
//基础技能提高课
|
|
|
if(type == CourseScheduleType.HIGH_ONLINE || type == CourseScheduleType.HIGH){
|
|
|
-
|
|
|
+
|
|
|
if(StringUtils.isBlank(tdms.getSalaryRuleJson())){
|
|
|
throw new BizException("线上基础技能课课酬设置异常");
|
|
|
}
|
|
@@ -4112,10 +4125,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if(musicGroup != null){
|
|
|
musicGroup.setFirstCourseStartTime(courseSchedule.getClassDate());
|
|
|
musicGroup.setGroupMemberNum(courseScheduleStudentPaymentDao.countStudentNum(courseSchedule.getId().intValue()));
|
|
|
-
|
|
|
+
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
musicGroupIdList.add(courseSchedule.getMusicGroupId());
|
|
|
}
|
|
|
}
|
|
@@ -6009,7 +6022,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<Integer, List<DailySummaryOfClassesForTheCurrentSemesterDto>> getDailySummaryOfClassesForTheCurrentSemester(Integer coopId) {
|
|
|
+ public Map<String, List<DailySummaryOfClassesForTheCurrentSemesterDto>> getDailySummaryOfClassesForTheCurrentSemester(Integer coopId) {
|
|
|
//获取合作单位关联的所有乐团列表
|
|
|
List<String> musicGroupIds = musicGroupDao.findNormalByCooperationId(coopId);
|
|
|
//获取当前学期
|
|
@@ -6022,13 +6035,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}else {
|
|
|
summary = courseScheduleDao.getDailySummaryOfClassesForTheCurrentSemester(musicGroupIds, startTerm, endTerm);
|
|
|
}
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate startDate = LocalDate.parse(startTerm, formatter);
|
|
|
LocalDate endDate = LocalDate.parse(endTerm, formatter);
|
|
|
- Map<Integer, List<DailySummaryOfClassesForTheCurrentSemesterDto>> result = new HashMap<>();
|
|
|
+ Map<String, List<DailySummaryOfClassesForTheCurrentSemesterDto>> result = new LinkedHashMap<>(30);
|
|
|
LocalDate currentWeekStart = startDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
|
|
+ StringBuffer sb;
|
|
|
while (!currentWeekStart.isAfter(endDate)) {
|
|
|
- int currentWeekNumber = currentWeekStart.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
|
|
|
+ int currentWeekNumber = (int) ChronoUnit.WEEKS.between(startDate, currentWeekStart);
|
|
|
+ sb = new StringBuffer("第").append(toChineseNumber(currentWeekNumber)).append("周");
|
|
|
LocalDate currentWeekEnd = currentWeekStart.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
|
|
|
List<DailySummaryOfClassesForTheCurrentSemesterDto> currentWeekDates = new ArrayList<>();
|
|
|
for (DailySummaryOfClassesForTheCurrentSemesterDto dto : summary) {
|
|
@@ -6036,12 +6051,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
currentWeekDates.add(dto);
|
|
|
}
|
|
|
}
|
|
|
- result.put(currentWeekNumber, currentWeekDates);
|
|
|
+ result.put(sb.toString(), currentWeekDates);
|
|
|
currentWeekStart = currentWeekEnd.plusDays(1);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private static String toChineseNumber(int n) {
|
|
|
+ String[] chineseNumbers = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八",
|
|
|
+ "十九", "二十", "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十", "三十一", "三十二", "三十三", "三十四",
|
|
|
+ "三十五", "三十六", "三十七", "三十八", "三十九", "四十", "四十一", "四十二", "四十三", "四十四", "四十五", "四十六", "四十七", "四十八", "四十九", "五十"};
|
|
|
+ if (n <= 50) {
|
|
|
+ return chineseNumbers[n];
|
|
|
+ } else {
|
|
|
+ return Integer.toString(n);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<ClassesForDayDto> getListClassesForDay(Integer coopId,String classDate) {
|
|
|
//获取合作单位关联的所有乐团列表
|
|
@@ -6061,6 +6087,119 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
return listClassesForDay.get(0);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询课程信息
|
|
|
+ *
|
|
|
+ * @param queryInfo 查询条件
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<TeachingPointWrapper.CourseTeachingPoint> teachingPointCourse(TeachingPointWrapper.TeachingPointQuery queryInfo) {
|
|
|
+ IPage<TeachingPointWrapper.CourseTeachingPoint> page = com.microsvc.toolkit.common.response.paging.QueryInfo.getPage(queryInfo);
|
|
|
+ List<TeachingPointWrapper.CourseTeachingPoint> courseTeachingPoints = courseSchedulePlusMapper
|
|
|
+ .teachingPointCourse(page, queryInfo);
|
|
|
+ if (CollectionUtils.isEmpty(courseTeachingPoints)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置老师信息
|
|
|
+
|
|
|
+ // 老师ID集合
|
|
|
+ List<Integer> teacherIds = courseTeachingPoints.stream()
|
|
|
+ .map(TeachingPointWrapper.CourseTeachingPoint::getTeacherId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Integer, Teacher> teacherMap = teacherService.getMapByIds(teacherIds);
|
|
|
+
|
|
|
+ // 设置签到/签退信息
|
|
|
+
|
|
|
+ // 课程ID集合
|
|
|
+ List<Long> courseIds = courseTeachingPoints.stream()
|
|
|
+ .map(TeachingPointWrapper.CourseTeachingPoint::getCourseId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Long, TeacherAttendance> attendanceMap = teacherAttendanceService.getMapByCourseIds(courseIds);
|
|
|
+
|
|
|
+ for (TeachingPointWrapper.CourseTeachingPoint courseTeachingPoint : courseTeachingPoints) {
|
|
|
+
|
|
|
+ // 设置老师信息
|
|
|
+ if (courseTeachingPoint.getTeacherId() != null) {
|
|
|
+ Teacher teacher = teacherMap.get(courseTeachingPoint.getTeacherId());
|
|
|
+ if (teacher != null) {
|
|
|
+ courseTeachingPoint.setTeacherName(teacher.getRealName());
|
|
|
+ courseTeachingPoint.setTeacherAvatar(teacher.getAvatar());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置签到/签退信息
|
|
|
+ TeacherAttendance attendance = attendanceMap.get(courseTeachingPoint.getCourseId());
|
|
|
+ if (attendance != null) {
|
|
|
+ courseTeachingPoint.setSignPhoto(attendance.getSignInAttachments());
|
|
|
+ courseTeachingPoint.setSignOutPhoto(attendance.getSignOutAttachments());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return page.setRecords(courseTeachingPoints);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<TeachingPointWrapper.ClassTeachingPoint> teachingPointClass(TeachingPointWrapper.TeachingPointQuery queryInfo) {
|
|
|
+ IPage<TeachingPointWrapper.ClassTeachingPoint> page = com.microsvc.toolkit.common.response.paging.QueryInfo.getPage(queryInfo);
|
|
|
+ List<TeachingPointWrapper.ClassTeachingPoint> courseTeachingPoints = courseSchedulePlusMapper
|
|
|
+ .teachingPointClass(page, queryInfo);
|
|
|
+ if (CollectionUtils.isEmpty(courseTeachingPoints)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 班级主教信息
|
|
|
+
|
|
|
+ // 班级ID集合
|
|
|
+ List<Integer> classIds = courseTeachingPoints.stream()
|
|
|
+ .map(TeachingPointWrapper.ClassTeachingPoint::getClassGroupId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Integer, Teacher> teacherMap = classGroupTeacherMapperService.getTeacherByClassIds(classIds);
|
|
|
+
|
|
|
+ for (TeachingPointWrapper.ClassTeachingPoint courseTeachingPoint : courseTeachingPoints) {
|
|
|
+
|
|
|
+ // 设置老师信息
|
|
|
+ if (courseTeachingPoint.getTeacherId() != null) {
|
|
|
+ Teacher teacher = teacherMap.get(courseTeachingPoint.getClassGroupId());
|
|
|
+ if (teacher != null) {
|
|
|
+ courseTeachingPoint.setTeacherId(teacher.getId());
|
|
|
+ courseTeachingPoint.setTeacherName(teacher.getRealName());
|
|
|
+ courseTeachingPoint.setTeacherAvatar(teacher.getAvatar());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return page.setRecords(courseTeachingPoints);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置教学点
|
|
|
+ *
|
|
|
+ * @param teachingPoint 教学点信息
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public Boolean teachingPoint(TeachingPointWrapper.TeachingPoint teachingPoint) {
|
|
|
+
|
|
|
+ ClassGroup classGroup = new ClassGroup();
|
|
|
+ classGroup.setId(teachingPoint.getClassGroupId());
|
|
|
+ classGroup.setTeachingPoint(teachingPoint.getTeachingPoint());
|
|
|
+ classGroupDao.update(classGroup);
|
|
|
+
|
|
|
+ // 未开始的课程修改教学点
|
|
|
+ courseScheduleDao.updateTeachingPointByClassGroupId(teachingPoint.getClassGroupId(), teachingPoint.getTeachingPoint());
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<CourseStudentDto> queryCourseStudentList(Long courseId) {
|
|
|
List<CourseStudentDto> courseStudentDtos = studentAttendanceDao.queryCourseStudentList(courseId);
|