一些问题

beetlsql3-dev
Mlxa0324
parent def88e745a
commit 863b298d40

@ -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;
/**
* <p>
@ -161,4 +162,38 @@ public class BeanUtil extends cn.hutool.core.bean.BeanUtil {
copyProperties(o, r, copyOptions);
}
}
/**
* beanMap
* @param collection
* @return
* @param <T>
*/
public static <T> List<Map> copyToListSupportExtMap(Collection<? extends BaseEntity> collection) {
return copyToListSupportExtMap(collection, false, false);
}
/**
*
* @param collection
* @return
* @param <T>
*/
public static <T> List<Map> copyToListSupportExtMap(Collection<? extends BaseEntity> collection, final boolean isToUnderlineCase) {
return copyToListSupportExtMap(collection, isToUnderlineCase, false);
}
/**
*
* @param collection
* @return
* @param <T>
*/
public static <T> List<Map> copyToListSupportExtMap(Collection<? extends BaseEntity> collection, final boolean isToUnderlineCase, boolean ignoreNullValue) {
return collection.stream().map(item -> {
Map<String, Object> tails = item.getTails();
tails.putAll(beanToMap(item, isToUnderlineCase, ignoreNullValue));
return tails;
}).collect(Collectors.toList());
}
}

@ -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';

@ -44,4 +44,11 @@ public interface TeacherOpenCourseScheduleSessionSnapDao extends BaseMapper<Teac
int updateStatusBySessionIds(@NotNull(message = "排课配置IDs不能为空") String teacherOpenCourseScheduleSessionIds, @NotNull Integer status);
List<TeacherOpenCourseScheduleSessionSnap> getByIds(String ids);
List<TeacherOpenCourseScheduleSessionSnap> getValuesByQuery(TeacherOpenCourseScheduleSessionSnapQuery teacherOpenCourseScheduleSessionSnapQuery);
/**
* IDs
* @param sessionIds sessionIds
* @return
*/
List<String> getSessionClassNameListBySessionIds(String sessionIds);
}

@ -121,7 +121,7 @@ public class TeacherOpenCourseScheduleSession extends BaseEntity{
private Boolean teacherOpenCourseScheduleSessionOpenOnHolidays;
// 开课节次和班级的组合JSON格式
// 开课节次和教室的组合JSON格式
// [{班级ID[节次ID]}]
@ReadJSON

@ -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<Tea
return teacherOpenCourseScheduleSessionDao.getSessionNameList(teacherOpenCourseId, teacherId);
}
/**
*
* @param teacherOpenCourseId
* @return
*/
public List<? extends Map> getSessionNameList2(Long teacherOpenCourseId, Long teacherId) {
TeacherOpenCourseScheduleSessionQuery query = new TeacherOpenCourseScheduleSessionQuery();
query.setTeacherOpenCourseScheduleSessionStatus(1);
query.setTeacherOpenCourseId(teacherOpenCourseId);
if (null != teacherId) {
query.setTeacherId(teacherId);
}
List<TeacherOpenCourseScheduleSession> list = teacherOpenCourseScheduleSessionService.getValuesByQuery(query);
dictParser(list);
List<TeacherOpenCourseScheduleSession> result = CollectionUtil.emptyIfNull(list).stream().map(item -> {
StringBuilder sb = new StringBuilder();
TeacherOpenCourseScheduleSession scheduleSession = new TeacherOpenCourseScheduleSession();
Long scheduleSessionId = item.getTeacherOpenCourseScheduleSessionId();
scheduleSession.setTeacherOpenCourseScheduleSessionId(scheduleSessionId);
Map<String, List<Map<String, String>>> sessionClassListMap = ((Map) item.get("teacherOpenCourseScheduleSessionClassListJSONEntity"));
sb.append("上课班级:");
sb.append(item.getSchoolClassIdsText());
sb.append("</br>");
sb.append("上课周次:");
sb.append(item.getTeacherOpenCourseScheduleSessionStatusWeekDetailText());
sb.append("</br>");
if (ObjectUtil.isNotEmpty(sessionClassListMap)) {
// 上课教室查询
String sessionClassIds = sessionClassListMap.keySet().stream().collect(Collectors.joining(","));
List<String> sessionClassNameList = teacherOpenCourseScheduleSessionSnapDao.getSessionClassNameListBySessionIds(sessionClassIds);
if(ObjectUtil.isNotEmpty(sessionClassNameList)) {
sb.append("上课教室:");
sb.append(join(sessionClassNameList, ", "));
sb.append("</br>");
}
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);
}
/**
*

@ -123,6 +123,10 @@ public class TeacherOpenCourseScheduleSessionSnapService extends CoreBaseService
return sqlManager.select(SqlId.of("jlw.teacherOpenCourseScheduleSessionSnap.getTeacherOpenCourseScheduleSessionSnapValues"), TeacherOpenCourseScheduleSessionSnap.class, paras);
}
public List<String> getSessionClassNameListBySessionIds (String ids){
return teacherOpenCourseScheduleSessionSnapDao.getSessionClassNameListBySessionIds(ids);
}
public List<TeacherOpenCourseScheduleSessionSnap> getValuesByQuery (TeacherOpenCourseScheduleSessionSnapQuery teacherOpenCourseScheduleSessionSnapQuery){
return teacherOpenCourseScheduleSessionSnapDao.getValuesByQuery(teacherOpenCourseScheduleSessionSnapQuery);
}

@ -108,8 +108,8 @@ public class TeacherOpenCourseScheduleSessionController{
if(null == coreUser){
return JsonResult.failMessage("请登录后再操作");
}else{
List<Map> list = teacherOpenCourseScheduleSessionService
.getSessionNameList(teacherOpenCourseId, ObjectUtil.defaultIfNull(teacher, new Teacher()).getTeacherId());
List<Map> list = (List<Map>) teacherOpenCourseScheduleSessionService
.getSessionNameList2(teacherOpenCourseId, ObjectUtil.defaultIfNull(teacher, new Teacher()).getTeacherId());
return JsonResult.success(list);
}
}

@ -39,7 +39,7 @@ public class TeacherOpenCourseScheduleSessionQuery extends PageParam {
@Query(name = "节假日是否排课", display = false)
private Boolean teacherOpenCourseScheduleSessionOpenOnHolidays;
// 开课节次和班级的组合JSON格式
// 开课节次和教室的组合JSON格式
// [{班级ID[节次ID]}]
@Query(name = "开课节次", display = false)

@ -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#
@}

@ -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#)
@}
Loading…
Cancel
Save