diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanUtil.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanUtil.java index 00bb1020..b8ead246 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanUtil.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanUtil.java @@ -19,6 +19,7 @@ import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; /** *

@@ -161,4 +162,38 @@ public class BeanUtil extends cn.hutool.core.bean.BeanUtil { copyProperties(o, r, copyOptions); } } + + /** + * 拷贝bean到Map中 + * @param collection + * @return + * @param + */ + public static List copyToListSupportExtMap(Collection collection) { + return copyToListSupportExtMap(collection, false, false); + } + /** + * + * @param collection + * @return + * @param + */ + public static List copyToListSupportExtMap(Collection collection, final boolean isToUnderlineCase) { + return copyToListSupportExtMap(collection, isToUnderlineCase, false); + } + + /** + * + * @param collection + * @return + * @param + */ + public static List copyToListSupportExtMap(Collection collection, final boolean isToUnderlineCase, boolean ignoreNullValue) { + return collection.stream().map(item -> { + Map tails = item.getTails(); + tails.putAll(beanToMap(item, isToUnderlineCase, ignoreNullValue)); + return tails; + }).collect(Collectors.toList()); + } + } diff --git a/doc/sql/mysql/tianze-pro-update.sql b/doc/sql/mysql/tianze-pro-update.sql index 850768d0..c26ee9cd 100644 --- a/doc/sql/mysql/tianze-pro-update.sql +++ b/doc/sql/mysql/tianze-pro-update.sql @@ -358,7 +358,7 @@ ALTER TABLE teacher_open_course_merge_resources_info ADD COLUMN resources_info_f ALTER TABLE teacher_open_course_merge_schedule_session ADD COLUMN teacher_open_course_schedule_session_open_on_holidays tinyint(1) COMMENT '节假日是否排课'; -ALTER TABLE teacher_open_course_merge_schedule_session ADD COLUMN teacher_open_course_schedule_session_class_list varchar(4000) COMMENT '开课节次和班级的组合,JSON格式'; +ALTER TABLE teacher_open_course_merge_schedule_session ADD COLUMN teacher_open_course_schedule_session_class_list varchar(4000) COMMENT '开课节次和教室的组合,JSON格式'; -- 回显用 ALTER TABLE resources_question_snapshot ADD COLUMN teacher_open_course_merge_resources_question_id bigint COMMENT '开课题目ID'; diff --git a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseScheduleSessionSnapDao.java b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseScheduleSessionSnapDao.java index edcc625a..52bb941d 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseScheduleSessionSnapDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseScheduleSessionSnapDao.java @@ -44,4 +44,11 @@ public interface TeacherOpenCourseScheduleSessionSnapDao extends BaseMapper getByIds(String ids); List getValuesByQuery(TeacherOpenCourseScheduleSessionSnapQuery teacherOpenCourseScheduleSessionSnapQuery); + + /** + * 通过排课IDs去查询教室列表 + * @param sessionIds 排课sessionIds + * @return + */ + List getSessionClassNameListBySessionIds(String sessionIds); } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseScheduleSession.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseScheduleSession.java index 7f38e1f9..99f95b84 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseScheduleSession.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseScheduleSession.java @@ -121,7 +121,7 @@ public class TeacherOpenCourseScheduleSession extends BaseEntity{ private Boolean teacherOpenCourseScheduleSessionOpenOnHolidays; - // 开课节次和班级的组合JSON格式 + // 开课节次和教室的组合JSON格式 // [{班级ID:[节次ID]}] @ReadJSON diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionService.java index bec250fc..1ea8225d 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionService.java @@ -1,6 +1,7 @@ package com.ibeetl.jlw.service; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; @@ -48,6 +49,7 @@ import static cn.hutool.core.collection.CollUtil.join; import static cn.hutool.core.date.DatePattern.NORM_DATE_PATTERN; import static cn.hutool.core.date.DateUtil.offsetDay; import static cn.hutool.core.date.DateUtil.parseDate; +import static com.ibeetl.admin.core.util.BeanUtil.copyToListSupportExtMap; import static com.ibeetl.admin.core.util.DateUtil.weekNumberInList; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.toMap; @@ -310,6 +312,59 @@ public class TeacherOpenCourseScheduleSessionService extends CoreBaseService getSessionNameList2(Long teacherOpenCourseId, Long teacherId) { + TeacherOpenCourseScheduleSessionQuery query = new TeacherOpenCourseScheduleSessionQuery(); + query.setTeacherOpenCourseScheduleSessionStatus(1); + query.setTeacherOpenCourseId(teacherOpenCourseId); + if (null != teacherId) { + query.setTeacherId(teacherId); + } + List list = teacherOpenCourseScheduleSessionService.getValuesByQuery(query); + dictParser(list); + + List result = CollectionUtil.emptyIfNull(list).stream().map(item -> { + StringBuilder sb = new StringBuilder(); + TeacherOpenCourseScheduleSession scheduleSession = new TeacherOpenCourseScheduleSession(); + Long scheduleSessionId = item.getTeacherOpenCourseScheduleSessionId(); + scheduleSession.setTeacherOpenCourseScheduleSessionId(scheduleSessionId); + Map>> sessionClassListMap = ((Map) item.get("teacherOpenCourseScheduleSessionClassListJSONEntity")); + + sb.append("上课班级:"); + sb.append(item.getSchoolClassIdsText()); + sb.append("
"); + sb.append("上课周次:"); + sb.append(item.getTeacherOpenCourseScheduleSessionStatusWeekDetailText()); + sb.append("
"); + if (ObjectUtil.isNotEmpty(sessionClassListMap)) { + + // 上课教室查询 + String sessionClassIds = sessionClassListMap.keySet().stream().collect(Collectors.joining(",")); + List sessionClassNameList = teacherOpenCourseScheduleSessionSnapDao.getSessionClassNameListBySessionIds(sessionClassIds); + if(ObjectUtil.isNotEmpty(sessionClassNameList)) { + sb.append("上课教室:"); + sb.append(join(sessionClassNameList, ", ")); + sb.append("
"); + } + + String sessionTagStr = sessionClassListMap.values().stream() + .flatMap(it -> it.stream()).map(it -> it.getOrDefault("teacherOpenCourseScheduleSessionTagName", "") + it.getOrDefault("teacherOpenCourseScheduleSessionTagStartTime", "")) + .collect(Collectors.joining(",")); + sb.append("课次及上课时间:"); + sb.append(sessionTagStr); + } + + scheduleSession.set("teacherOpenCourseTitle", sb.toString()); + return scheduleSession; + }).collect(Collectors.toList()); + + return copyToListSupportExtMap(result, false, true); + } + /** * 插入返回的实体。 diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionSnapService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionSnapService.java index 0a5bded9..8389a8ba 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionSnapService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionSnapService.java @@ -123,6 +123,10 @@ public class TeacherOpenCourseScheduleSessionSnapService extends CoreBaseService return sqlManager.select(SqlId.of("jlw.teacherOpenCourseScheduleSessionSnap.getTeacherOpenCourseScheduleSessionSnapValues"), TeacherOpenCourseScheduleSessionSnap.class, paras); } + public List getSessionClassNameListBySessionIds (String ids){ + return teacherOpenCourseScheduleSessionSnapDao.getSessionClassNameListBySessionIds(ids); + } + public List getValuesByQuery (TeacherOpenCourseScheduleSessionSnapQuery teacherOpenCourseScheduleSessionSnapQuery){ return teacherOpenCourseScheduleSessionSnapDao.getValuesByQuery(teacherOpenCourseScheduleSessionSnapQuery); } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java index 74b66b20..83334fb8 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java @@ -108,8 +108,8 @@ public class TeacherOpenCourseScheduleSessionController{ if(null == coreUser){ return JsonResult.failMessage("请登录后再操作"); }else{ - List list = teacherOpenCourseScheduleSessionService - .getSessionNameList(teacherOpenCourseId, ObjectUtil.defaultIfNull(teacher, new Teacher()).getTeacherId()); + List list = (List) teacherOpenCourseScheduleSessionService + .getSessionNameList2(teacherOpenCourseId, ObjectUtil.defaultIfNull(teacher, new Teacher()).getTeacherId()); return JsonResult.success(list); } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseScheduleSessionQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseScheduleSessionQuery.java index c92cbd33..c3949b93 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseScheduleSessionQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseScheduleSessionQuery.java @@ -39,7 +39,7 @@ public class TeacherOpenCourseScheduleSessionQuery extends PageParam { @Query(name = "节假日是否排课", display = false) private Boolean teacherOpenCourseScheduleSessionOpenOnHolidays; - // 开课节次和班级的组合JSON格式 + // 开课节次和教室的组合JSON格式 // [{班级ID:[节次ID]}] @Query(name = "开课节次", display = false) diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSession.md b/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSession.md index 4df873e4..e3d92d22 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSession.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSession.md @@ -515,7 +515,6 @@ getSessionNameList WHERE 1 = 1 AND t.teacher_open_course_schedule_session_status = 1 - AND t.teacher_open_course_schedule_session_status = 1 @if(!isEmpty(teacherOpenCourseId)){ and t.teacher_open_course_id =#teacherOpenCourseId# @} diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSessionSnap.md b/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSessionSnap.md index 459647c1..b39af858 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSessionSnap.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseScheduleSessionSnap.md @@ -394,4 +394,15 @@ getValuesByQuery @} @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) + @} + +getSessionClassNameListBySessionIds +=== +* 通过排课IDs去查询教室列表 + + select distinct t.teacher_open_course_schedule_session_class_name + from teacher_open_course_schedule_session_snap t + where 1 + @if(!isEmpty(teacherOpenCourseScheduleSessionId)){ + and find_in_set(t.teacher_open_course_schedule_session_id,#teacherOpenCourseScheduleSessionId#) @} \ No newline at end of file