|
@@ -233,6 +233,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
@Override
|
|
|
public Map<String, Object> checkCanApplyFreePracticeGroup(Integer userId) {
|
|
|
Map<String,Object> result=new HashMap<>();
|
|
|
+ SysConfig practiceFreeApplyExpireDateConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
|
|
|
+ result.put("practiceFreeApplyExpireDate", practiceFreeApplyExpireDateConfig.getParanValue());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -754,6 +756,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
SysConfig practiceApplyEndTimeConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_APPLY_END_TIME);
|
|
|
SysConfig practiceApplyIntervalTimeConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
|
|
|
SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
|
|
|
+ SysConfig practiceFreeApplyExpireDateConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
|
|
|
Student student = studentDao.get(userId);
|
|
|
List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig.getParanValue());
|
|
|
List<Integer> subjectIds = Arrays.asList(practiceSubjectIdListConfig.getParanValue().split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
|
|
@@ -772,6 +775,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
|
|
|
result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
|
|
|
result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
|
|
|
+ result.put("practiceFreeApplyExpireDate", practiceFreeApplyExpireDateConfig.getParanValue());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -941,6 +945,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ SysConfig practiceFreeApplyExpireDateConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
|
|
|
+ Date practiceFreeApplyExpireDate = DateUtil.stringToDate(practiceFreeApplyExpireDateConfig.getParanValue());
|
|
|
+
|
|
|
Date now = new Date();
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setFirstDayOfWeek(Calendar.MONDAY);
|
|
@@ -951,7 +958,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
calendar.add(Calendar.DATE, 1);
|
|
|
Date applyStartDate = calendar.getTime();
|
|
|
- Date applyEndDate = DateUtil.stringToDate("2020-05-24", "yyyy-MM-dd");
|
|
|
+ Date applyEndDate = practiceFreeApplyExpireDate;
|
|
|
Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDate, Calendar.MONDAY);
|
|
|
Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDate, Calendar.SUNDAY);
|
|
|
|
|
@@ -1294,7 +1301,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if (Objects.isNull(subjectId)) {
|
|
|
throw new BizException("请选择声部");
|
|
|
}
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserById(userId);
|
|
|
+ SysUser sysUser = teacherDao.getUser(userId);
|
|
|
if (Objects.isNull(sysUser)) {
|
|
|
throw new BizException("用户不存在");
|
|
|
}
|
|
@@ -1342,6 +1349,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
checkTeacherLeaveDate = false;
|
|
|
}
|
|
|
|
|
|
+ SysConfig practiceFreeApplyExpireDateConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
|
|
|
+ Date practiceFreeApplyExpireDate = DateUtil.stringToDate(practiceFreeApplyExpireDateConfig.getParanValue());
|
|
|
+
|
|
|
Date now = new Date();
|
|
|
if (now.before(applyStartDay)) {
|
|
|
now = applyStartDay;
|
|
@@ -1352,13 +1362,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
calendar.set(Calendar.MINUTE, 0);
|
|
|
calendar.set(Calendar.SECOND, 0);
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
- while (calendar.getTime().before(activityEndDate)) {
|
|
|
+ while (calendar.getTime().before(practiceFreeApplyExpireDate)) {
|
|
|
calendar.add(Calendar.DATE, 1);
|
|
|
Date applyStartDay = calendar.getTime();
|
|
|
calendar.add(Calendar.DATE, 6);
|
|
|
Date applyEndDay = calendar.getTime();
|
|
|
- if (applyEndDay.after(activityEndDate)) {
|
|
|
- applyEndDay = activityEndDate;
|
|
|
+ if (applyEndDay.after(practiceFreeApplyExpireDate)) {
|
|
|
+ applyEndDay = practiceFreeApplyExpireDate;
|
|
|
}
|
|
|
Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDay, Calendar.MONDAY);
|
|
|
Date secondMonday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.MONDAY);
|
|
@@ -1694,18 +1704,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
practiceGroup.setSecondCourseTime(practiceGroup.getFirstCourseTime());
|
|
|
practiceGroup.setFirstCourseTime(tmp);
|
|
|
}
|
|
|
- if (practiceGroup.getFirstCourseTime().before(now)
|
|
|
- || practiceGroup.getFirstCourseTime().after(activityEndDate)) {
|
|
|
- result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
- result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
- return result;
|
|
|
- }
|
|
|
- if (practiceGroup.getSecondCourseTime().before(now)
|
|
|
- || practiceGroup.getSecondCourseTime().after(activityEndDate)) {
|
|
|
- result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
- result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
- return result;
|
|
|
- }
|
|
|
+// if (practiceGroup.getFirstCourseTime().before(now)
|
|
|
+// || practiceGroup.getFirstCourseTime().after(activityEndDate)) {
|
|
|
+// result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
+// result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// if (practiceGroup.getSecondCourseTime().before(now)
|
|
|
+// || practiceGroup.getSecondCourseTime().after(activityEndDate)) {
|
|
|
+// result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
+// result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
+// return result;
|
|
|
+// }
|
|
|
if (DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), practiceGroup.getSecondCourseTime())) {
|
|
|
result.put("status", "TWO_DATE_ON_ONE_DAY");
|
|
|
result.put("info", "预约失败,网管课选择时间重复,请重试。");
|
|
@@ -1754,18 +1764,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
allCourseDates.remove(3);
|
|
|
allCourseDates.add(DateUtil.addDays(tempDate, 7));
|
|
|
}
|
|
|
- if (allCourseDates.get(2).before(now)
|
|
|
- || allCourseDates.get(2).after(courseExpireDate)) {
|
|
|
- result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
- result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
- return result;
|
|
|
- }
|
|
|
- if (allCourseDates.get(3).before(now)
|
|
|
- || allCourseDates.get(3).after(courseExpireDate)) {
|
|
|
- result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
- result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
- return result;
|
|
|
- }
|
|
|
+// if (allCourseDates.get(2).before(now)
|
|
|
+// || allCourseDates.get(2).after(courseExpireDate)) {
|
|
|
+// result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
+// result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// if (allCourseDates.get(3).before(now)
|
|
|
+// || allCourseDates.get(3).after(courseExpireDate)) {
|
|
|
+// result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
+// result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
|
|
|
+// return result;
|
|
|
+// }
|
|
|
allCourseDates.sort(Comparator.comparing(Date::getTime));
|
|
|
|
|
|
studentDao.lockUser(practiceGroup.getStudentId());
|
|
@@ -1783,7 +1793,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
SysUser sysUser = sysUserFeignService.queryUserById(practiceGroup.getStudentId());
|
|
|
|
|
|
practiceGroup.setCoursesStartDate(allCourseDates.get(0));
|
|
|
- practiceGroup.setCoursesExpireDate(courseExpireDate);
|
|
|
+ practiceGroup.setCoursesExpireDate(allCourseDates.get(3));
|
|
|
Teacher teacher = teacherService.getDetail(practiceGroup.getUserId());
|
|
|
if (Objects.isNull(teacher)) {
|
|
|
throw new BizException("老师不存在");
|
|
@@ -3006,8 +3016,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
|
|
|
try {
|
|
|
-// courseScheduleService.checkNewCourseSchedules(practiceCourses,false);
|
|
|
- courseScheduleService.checkNewCourseSchedulesWithoutMusicGroup(practiceCourses,false);
|
|
|
+ courseScheduleService.checkNewCourseSchedules(practiceCourses,false);
|
|
|
+// courseScheduleService.checkNewCourseSchedulesWithoutMusicGroup(practiceCourses,false);
|
|
|
} catch (Exception e) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
String errMessage=new String();
|
|
@@ -3273,6 +3283,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
+ studentDao.updateStudentServiceOrOperatingTag(practiceGroup.getStudentId(),null,YesOrNoEnum.YES.getCode(),null);
|
|
|
+
|
|
|
List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|
|
|
if(Objects.nonNull(practiceGroup.getEducationalTeacherId())){
|
|
|
imGroupMemberList.add(new ImGroupMember(practiceGroup.getEducationalTeacherId().toString()));
|