|
@@ -902,33 +902,23 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIdsStr, Integer teacherId) {
|
|
|
+ public Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIdsStr, Integer teacherId, Integer tenantId) {
|
|
|
Map<String, Object> result=new HashMap<>();
|
|
|
-
|
|
|
+
|
|
|
Set<Long> teacherServeCourseIds = studentServeService.getTeacherServeCourseIds(teacherId);
|
|
|
if(teacherServeCourseIds.contains(courseScheduleId)){
|
|
|
- result.put("enableAssignHomework", 1);
|
|
|
+ result.put("enableAssignHomework", 1);//是否要布置作业
|
|
|
}else{
|
|
|
result.put("enableAssignHomework", 0);
|
|
|
}
|
|
|
|
|
|
if(Objects.isNull(courseScheduleId) && Objects.isNull(studentIdsStr)){
|
|
|
- result.put("isAssignHomework", 0);
|
|
|
+ result.put("isAssignHomework", 0);//是否有布置作业
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-// String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
|
|
|
-// if(StringUtils.isEmpty(configValue)){
|
|
|
-// configValue = "0";
|
|
|
-// }
|
|
|
List<Integer> studentIds=new ArrayList<>();
|
|
|
if(StringUtils.isNotBlank(studentIdsStr)){
|
|
|
-// if(configValue.equals("0")){
|
|
|
-// result.put("memberNum",0);
|
|
|
-// }else {
|
|
|
- //获取有会员的学员数
|
|
|
-// result.put("memberNum", studentDao.getMemberNum(studentIdsStr));
|
|
|
-// }
|
|
|
studentIds= Arrays.asList(studentIdsStr.split(",")).stream().map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
@@ -939,21 +929,8 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
result.put("courseStudentNum", students.size());
|
|
|
CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
|
|
|
if(Objects.isNull(courseSchedule)){
|
|
|
- result.put("isAssignHomework", 0);
|
|
|
- return result;
|
|
|
+ throw new BizException("课程[{}]信息查询失败", courseScheduleId);
|
|
|
}
|
|
|
-// if(configValue.equals("0")){
|
|
|
-// result.put("memberNum",0);
|
|
|
-// result.put("courseViewType", CourseViewTypeEnum.COURSE_FEE);
|
|
|
-// }else {
|
|
|
-// MusicGroup musicGroup = musicGroupDao.get(courseSchedule.getMusicGroupId());
|
|
|
-// if(musicGroup != null){
|
|
|
-// result.put("courseViewType", musicGroup.getCourseViewType());
|
|
|
-// }else if(result.get("memberNum") == null){
|
|
|
-// Set<Integer> collect = students.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
|
|
|
-// result.put("memberNum", studentDao.getMemberNum(StringUtils.join(collect,",")));
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
localDate=LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseScheduleId);
|
|
@@ -967,17 +944,30 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
LocalDate monDayDate = localDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
|
|
|
LocalDate sunDayDate = localDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
|
|
|
|
|
|
- //课后作业
|
|
|
- Set<Integer> hss = studentCourseHomeworkDao.checkStudentHaveHomeworkInDateRange(monDayDate.toString(), sunDayDate.toString(), studentIds);
|
|
|
- //课外训练
|
|
|
- //Set<Integer> ess = extracurricularExercisesReplyDao.checkStudentHaveExercisesInDateRange(monDayDate.toString(), sunDayDate.toString(), studentIds);
|
|
|
- for (Integer studentId : studentIds) {
|
|
|
- if(!hss.contains(studentId)){
|
|
|
- result.put("isAssignHomework", 0);
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
- result.put("isAssignHomework", 1);
|
|
|
+ if (tenantId == 1) {
|
|
|
+ // 课后作业
|
|
|
+ Set<Integer> hss = studentCourseHomeworkDao.checkStudentHaveHomeworkInDateRange(monDayDate.toString(), sunDayDate.toString(), studentIds);
|
|
|
+ // 课外训练
|
|
|
+ for (Integer studentId : studentIds) {
|
|
|
+ if (!hss.contains(studentId)) {
|
|
|
+ result.put("isAssignHomework", 0);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.put("isAssignHomework", 1);
|
|
|
+ } else {
|
|
|
+ if(courseScheduleId != null){
|
|
|
+ List<Long> courseIds = new ArrayList<Long>();
|
|
|
+ courseIds.add(courseScheduleId);
|
|
|
+
|
|
|
+ List<StudentCourseHomework> courseHomeworkList = studentCourseHomeworkDao.findByCourses(courseIds);
|
|
|
+ if (courseHomeworkList == null || courseHomeworkList.size() == 0) {
|
|
|
+ result.put("isAssignHomework", 0);// 是否有布置作业
|
|
|
+ } else {
|
|
|
+ result.put("isAssignHomework", 1);// 是否有布置作业
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|