From fe3bec4214b249c9c30a222c7a38e36ab3bbb3e8 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Sat, 12 Nov 2022 21:50:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=AF=BE=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A2=98=E7=9B=AE=E9=85=8D=E7=BD=AE+?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E5=BF=AB=E7=85=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/core/service/CoreBaseService.java | 60 --- .../jlw/dao/ResourcesQuestionSnapshotDao.java | 7 + ...erOpenCourseMergeResourcesQuestionDao.java | 10 + .../dao/TeacherOpenCourseQuestionLogDao.java | 8 + .../TeacherOpenCourseQuestionLogWrongDao.java | 7 + .../com/ibeetl/jlw/entity/CourseInfo.java | 2 + .../TeacherOpenCourseQuestionSettingDTO.java | 16 +- .../ibeetl/jlw/service/CourseInfoService.java | 35 +- .../jlw/service/ResourcesQuestionService.java | 13 + .../ResourcesQuestionSnapshotService.java | 204 +++++++++- .../TeacherMergeApplicationService.java | 4 +- .../TeacherOpenCourseChatLogService.java | 5 +- .../TeacherOpenCourseHandsOnService.java | 9 +- ...urseHandsOnSimulationTasksFileService.java | 5 +- ...enCourseHandsOnSimulationTasksService.java | 11 +- ...enCourseKnowledgePointRelationService.java | 5 +- ...eacherOpenCourseKnowledgePointService.java | 5 +- ...acherOpenCourseMergeCourseInfoService.java | 177 +++++---- ...erOpenCourseMergeResourcesInfoService.java | 69 +++- ...enCourseMergeResourcesQuestionService.java | 110 +++++- ...OpenCourseMergeScheduleSessionService.java | 5 +- ...cherOpenCourseMergeSchoolClassService.java | 5 +- .../TeacherOpenCourseMergeStudentService.java | 4 +- .../TeacherOpenCourseMergeTeacherService.java | 4 +- .../TeacherOpenCourseNoticeService.java | 5 +- .../TeacherOpenCourseQuestionLogService.java | 20 +- ...cherOpenCourseQuestionLogWrongService.java | 17 +- ...acherOpenCourseQuestionSettingService.java | 348 +++++++++++++++++- ...OpenCourseScheduleSessionClassService.java | 5 +- ...acherOpenCourseScheduleSessionService.java | 4 +- ...rOpenCourseScheduleSessionSnapService.java | 5 +- ...erOpenCourseScheduleSessionTagService.java | 5 +- ...eacherOpenCourseScoreDashboardService.java | 5 +- .../TeacherOpenCourseScoreWeightService.java | 5 +- .../jlw/service/TeacherOpenCourseService.java | 2 + ...cherOpenCourseStudentSigninLogService.java | 4 +- ...OpenCourseStudentSigninSettingService.java | 4 +- ...erOpenCourseMergeCourseInfoController.java | 3 +- ...erOpenCourseQuestionSettingController.java | 9 +- ...TeacherOpenCourseMergeCourseInfoQuery.java | 8 +- ...TeacherOpenCourseQuestionSettingQuery.java | 35 +- .../resources/sql/jlw/resourcesQuestion.md | 6 + .../sql/jlw/resourcesQuestionSnapshot.md | 8 + ...teacherOpenCourseMergeResourcesQuestion.md | 43 +++ .../sql/jlw/teacherOpenCourseQuestionLog.md | 7 + .../jlw/teacherOpenCourseQuestionLogWrong.md | 7 + ...nCourseMergeSchoolClassControllerTest.java | 4 - 47 files changed, 1080 insertions(+), 259 deletions(-) diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreBaseService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreBaseService.java index 179e7dba..2ee7507d 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreBaseService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreBaseService.java @@ -1,13 +1,9 @@ package com.ibeetl.admin.core.service; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.ReUtil; import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.admin.core.util.enums.DelFlagEnum; import org.beetl.sql.core.SQLManager; import org.beetl.sql.core.TailBean; -import org.beetl.sql.core.query.LambdaQuery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -206,62 +202,6 @@ public class CoreBaseService extends CoreBaseAnnotationParser { return ret == 1; } - - /** - * 根据条件删除,不一定是主键ID,必须有一个删除条件 - * @param condition - * @return - */ - public boolean deleteByCondition(T condition) { - - if (condition == null) { return false; } - - /** - * 忽略的字段, 考虑到正则的关键字 - */ - String[] ignores = new String[]{ - "org_id", "user_id", "_add_time", "create_time", "_create_time", "update_time", - "_update_time" - }; - - /** - * 增加结尾符号 - * | 代表或者的意思,$代表从后面开始向前匹配 - * ArrayUtil.map(ignores, ReUtil::escape) 每个元素将正则的关键字转义,以防万一 - * 生成的正则大概的样子:[org_id|user_id|_add_time|]$ - */ - String regex = String.format("[%s]$", ArrayUtil.join(ArrayUtil.map(ignores, ReUtil::escape).toArray(), "|")); - log.debug("生成的正则:{}", regex); - - // 构建LambdaQuery - Class currentEntityClass = getCurrentEntityClassz(); - LambdaQuery tLambdaQuery = sqlManager.lambdaQuery(currentEntityClass); - - // 实体类属性转Map - Map stringObjectMap = BeanUtil.beanToMap(condition, true, true); - - // 移除空值或者忽略字段 - for (String k : stringObjectMap.keySet()) { - /** - * 移除在忽略列表中的值 - */ - if (ReUtil.isMatch(regex, k)) { - stringObjectMap.remove(k); - } - } - - // 目前只支持 等于操作,将条件追加到Query中 - stringObjectMap.forEach(tLambdaQuery::andEq); - log.debug("生成的SQL预览 {}", tLambdaQuery.getSql()); - - // 如果没有查询条件,则直接返回 - if(tLambdaQuery.getParams().isEmpty()) { - return false; - } - // 执行删除 - return tLambdaQuery.delete() > 0; - } - /** * 根据id删除数据 * diff --git a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionSnapshotDao.java b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionSnapshotDao.java index e40ec67e..7483695d 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionSnapshotDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesQuestionSnapshotDao.java @@ -41,4 +41,11 @@ public interface ResourcesQuestionSnapshotDao extends BaseMapper getRandomMergeResourcesQuestionList(TeacherOpenCourseQuestionSettingDTO questionSettingDTO); /** * 根据开课ID获取下面的题目类型和类型下的总题数 + * @param questionSettingDTO + * @return + */ + List getRandomMergeResourcesQuestionListBySystem(TeacherOpenCourseQuestionSettingDTO questionSettingDTO); + + /** + * 根据开课ID获取下面的题目类型和类型下的总题数 + * 从开课题库获取 * @param teacherOpenCourseId * @return */ List getGroupQuestionTypeCount(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId); + } diff --git a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseQuestionLogDao.java b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseQuestionLogDao.java index 1702332b..10335fe4 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseQuestionLogDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseQuestionLogDao.java @@ -34,5 +34,13 @@ public interface TeacherOpenCourseQuestionLogDao extends BaseMapper getByIds(String ids); List getValuesByQuery(TeacherOpenCourseQuestionLogWrongQuery teacherOpenCourseQuestionLogWrongQuery); List>getExcelValues(TeacherOpenCourseQuestionLogWrongQuery teacherOpenCourseQuestionLogWrongQuery); + + /** + * 根据题目配置ID 批量真删除 + * @param settingIds + */ + @Update + void deleteByTeacherOpenCourseQuestionSettingIds(String settingIds); } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java index 3bd896d9..bbc56f19 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java @@ -2,6 +2,7 @@ package com.ibeetl.jlw.entity; import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.entity.BaseEntity; +import lombok.EqualsAndHashCode; import org.beetl.sql.annotation.entity.AutoID; import javax.validation.constraints.NotNull; @@ -12,6 +13,7 @@ import java.util.List; * 课程管理 - 课程配置 * gen by Spring Boot2 Admin 2021-06-24 */ +@EqualsAndHashCode(callSuper=false) public class CourseInfo extends BaseEntity{ //ID diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionSettingDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionSettingDTO.java index 3f56ba82..18be64bb 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionSettingDTO.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionSettingDTO.java @@ -1,19 +1,27 @@ package com.ibeetl.jlw.entity.dto; import cn.jlw.validate.ValidateConfig; -import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesQuestion; import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import javax.validation.constraints.NotNull; import java.math.BigDecimal; /** - *题目配置入参 + * 题目配置 + * 抽题配置类 * * @author mlx */ @Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = true) public class TeacherOpenCourseQuestionSettingDTO { /** @@ -51,10 +59,6 @@ public class TeacherOpenCourseQuestionSettingDTO { * * 注意: * 如果该实体类是查询的返回值,这个字段会被填充该题目类型下的题目ID集合。 - * - * 该字段保存到是 teacher_open_course_merge_resources_question 中的主键。 - * 对应的是{@link TeacherOpenCourseMergeResourcesQuestion#getTeacherOpenCourseMergeResourcesQuestionId()} - * 简写为 resourcesQuestionIdPlural,不要理解错了 */ private String resourcesQuestionIdPlural; diff --git a/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java b/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java index 04124673..8dd43f84 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java @@ -4,6 +4,7 @@ package com.ibeetl.jlw.service; import cn.hutool.core.util.ObjectUtil; import cn.jlw.Interceptor.GetFile; import cn.jlw.util.ToolUtils; +import com.beust.jcommander.internal.Maps; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.service.CoreBaseService; import com.ibeetl.admin.core.service.CorePlatformService; @@ -22,16 +23,14 @@ import org.beetl.sql.core.SqlId; import org.beetl.sql.core.engine.PageQuery; import org.beetl.sql.core.query.LambdaQuery; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.validation.constraints.NotNull; import java.io.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.*; import java.util.stream.Collectors; @@ -187,6 +186,7 @@ public class CourseInfoService extends CoreBaseService{ return courseInfoDao.getCourseInfoValues(courseInfoQuery); } + @Cacheable(value = "courseInfoService.getById", key = "#courseInfoId", unless = "#courseInfoId == null") public CourseInfo getById(Long courseInfoId){ CourseInfo courseInfo = courseInfoDao.getById(courseInfoId); @@ -385,6 +385,33 @@ public class CourseInfoService extends CoreBaseService{ return courseInfos; } + /** + * 通过传入的题目列表, + * 通过章节分组 + * + * @param courseInfos 系统课程章节列表 + * @return + */ + public Map> getCourseChapterInfoIdsWithChildren(Collection courseInfos) { + if (ObjectUtil.isEmpty(courseInfos)) { + return Maps.newHashMap(); + } + + Map> result = new HashMap<>(); + // 只取章节节点 + Set set = courseInfos.stream() + .filter(item -> (item.getCourseInfoType() == 2 && item.getCourseInfoStatus() == 1)).collect(Collectors.toSet()); + + // 取出来所有的课程章、节的ID。大于等于2,就是章和他下面的子集 + for (CourseInfo courseInfo : set) { + List courseResources = getCourseResources(courseInfo.getCourseInfoId()); + // 加上章节本身 + courseResources.add(courseInfo); + result.put(courseInfo, courseResources); + } + return result; + } + /** * 根据课程(章节、小节)ID,获取该ID下的子集,返回一维集合 * 不包含他本身 diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java index 46258ba7..b5a3ab76 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java @@ -646,4 +646,17 @@ public class ResourcesQuestionService extends CoreBaseService shuffleOrderOptions(resourcesQuestion, "questionAnswer","questionOption", true); }); } + + /** + * 通过课程章节ID来获取题目 + * + * @param allCourseInfoIds + * @return + */ + public List getByCourseInfoIds(String allCourseInfoIds) { + ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); + resourcesQuestionQuery.setCourseInfoIds(allCourseInfoIds); + resourcesQuestionQuery.setQuestionStatus(1); + return getValuesByQuery(resourcesQuestionQuery); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java index 95de043b..e7b5f411 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java @@ -15,26 +15,29 @@ import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesQuestionDao; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO; import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery; +import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionSettingQuery; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; import org.beetl.sql.core.SQLReady; import org.beetl.sql.core.SqlId; import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import javax.annotation.Nullable; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.function.Consumer; +import java.util.stream.Collectors; +import static cn.hutool.core.util.ArrayUtil.join; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId; /** @@ -45,11 +48,14 @@ import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId; @Service @Transactional @Validated -public class ResourcesQuestionSnapshotService extends CoreBaseService{ +@Slf4j +public class ResourcesQuestionSnapshotService extends CoreBaseService implements DeleteResourcesBy{ @Autowired private ResourcesQuestionSnapshotDao resourcesQuestionSnapshotDao; @Autowired private StudentDao studentDao; @Autowired private TeacherOpenCourseMergeResourcesQuestionDao teacherOpenCourseMergeResourcesQuestionDao; + @Autowired @Lazy + private TeacherOpenCourseQuestionSettingService teacherOpenCourseQuestionSettingService; public PageQueryqueryByCondition(PageQuery query){ PageQuery ret = resourcesQuestionSnapshotDao.queryByCondition(query); @@ -82,6 +88,18 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService resourcesQuestionSnapshotList = new ArrayList<>(); @@ -165,29 +183,127 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService questionSettingOptions, Map courseInfoIdPair) { + + // 在插入之前,先清空列表。这种情况下,支持题目配置还在,重置题目列表的操作。 + deleteByTeacherOpenCourseQuestionSettingIds(teacherOpenCourseQuestionSettingId.toString()); + + // 题目设置,来动态获取题目 + if(ObjectUtil.isNotEmpty(questionSettingOptions)) { + // 数据库动态设置分数,并获取题目列表 + List insertList = getOpenResourcesQuestionSnapListBySettingOptions( + teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair); + + resourcesQuestionSnapshotDao.insertBatch(insertList); + } + } + + /** + * 传入题目ID 批量导入到快照表中 + * 从系统题库导入 + * + * @param teacherOpenCourseQuestionSettingId 开课题目配置ID + * @param questionSettingOptions 根据题型动态分配题目 + * @param courseInfoIdPair 根据题型动态分配题目 */ - public void insertBatchByQuestionIds(@NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, - List questionSettingOptions) { + public void insertBatchBySystemResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, + @Nullable List questionSettingOptions, Map courseInfoIdPair) { // 在插入之前,先清空列表。这种情况下,支持题目配置还在,重置题目列表的操作。 - ResourcesQuestionSnapshot deleteCondition = new ResourcesQuestionSnapshot(); - deleteCondition.setTeacherOpenCourseQuestionSettingId(teacherOpenCourseQuestionSettingId); - deleteCondition.setQuestionStatus(1); - deleteByCondition(deleteCondition); + deleteByTeacherOpenCourseQuestionSettingIds(teacherOpenCourseQuestionSettingId.toString()); // 题目设置,来动态获取题目 if(ObjectUtil.isNotEmpty(questionSettingOptions)) { - List insertList = getResourcesQuestionSnapshotListByQuestionSettingOptions( - teacherOpenCourseQuestionSettingId, questionSettingOptions); + // 数据库动态设置分数,并获取题目列表 + List insertList = getMergeResourcesQuestionSnapListByQuestionSettingOptionsBySystem( + teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair); + + insertList.forEach(item -> item.setTeacherOpenCourseQuestionSettingId(teacherOpenCourseQuestionSettingId)); + + setNewCourseInfoId(insertList, courseInfoIdPair); resourcesQuestionSnapshotDao.insertBatch(insertList); } } + /** + * 从开课题库中获取题目。可以单独设置类型下的分数 + * + * @param teacherOpenCourseQuestionSettingId 开课题目配置ID + * @param questionSettingOptions 根据题型动态分配题目 + * @param courseInfoIdPair 根据题型动态分配题目 + */ + public List getByOpenCourseResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, + @Nullable List questionSettingOptions, Map courseInfoIdPair) { + // 题目设置,来动态获取题目 + if(ObjectUtil.isNotEmpty(questionSettingOptions)) { + // 数据库动态设置分数,并获取题目列表 + List insertList = getOpenResourcesQuestionSnapListBySettingOptions( + teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair); + setNewCourseInfoId(insertList, courseInfoIdPair); + return insertList; + } + + return Lists.emptyList(); + } + + /** + * 从系统题库中获取题目。可以单独设置类型下的分数 + * + * @param teacherOpenCourseQuestionSettingId 开课题目配置ID + * @param questionSettingOptions 根据题型动态分配题目 + * @param courseInfoIdPair 根据题型动态分配题目 + */ + public List getBySystemResourcesQuestion(@NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, + @Nullable List questionSettingOptions, Map courseInfoIdPair) { + // 题目设置,来动态获取题目 + if(ObjectUtil.isNotEmpty(questionSettingOptions)) { + // 数据库动态设置分数,并获取题目列表 + List insertList = getMergeResourcesQuestionSnapListByQuestionSettingOptionsBySystem( + teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair); + setNewCourseInfoId(insertList, courseInfoIdPair); + + return insertList; + } + + return Lists.emptyList(); + } + + /** + * 根据课程新旧ID片段集合,设置新的课程ID + * + * @param insertList + * @param courseInfoIdPair + */ + public void setNewCourseInfoId(@NotNull List insertList, @NotNull Map courseInfoIdPair) { + insertList.forEach(item -> { + Long courseMergeCourseInfoId = item.getTeacherOpenCourseMergeCourseInfoId(); + item.setTeacherOpenCourseMergeCourseInfoId(courseInfoIdPair.getOrDefault(courseMergeCourseInfoId, courseMergeCourseInfoId)); + }); + } + + /** + * 根据课程新旧ID片段集合,设置新的课程ID + * + * @param insertList + * @param courseInfoIdPair + */ + public void setRQNewCourseInfoId(@NotNull List insertList, @NotNull Map courseInfoIdPair) { + insertList.forEach(item -> { + Long courseMergeCourseInfoId = item.getTeacherOpenCourseMergeCourseInfoId(); + item.setTeacherOpenCourseMergeCourseInfoId(courseInfoIdPair.getOrDefault(courseMergeCourseInfoId, courseMergeCourseInfoId)); + }); + } + + /** * 根据题目ID集合 * 获取题目快照列表。并配置题目配置ID @@ -219,7 +335,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService getResourcesQuestionSnapshotList( + public List getResourcesQuestionSnapshotList ( @NotEmpty(message = "开课题库列表不能为空!") final List questionList, @NotBlank(message = "题目配置ID不能为空!") Long teacherOpenCourseQuestionSettingId, Consumer otherConsumer) { // 批量插入快照表 @@ -243,7 +359,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService getResourcesQuestionSnapshotListByQuestionIds( + public List getResourcesQuestionSnapshotListByQuestionIds ( @NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, @NotBlank(message = "题目ID列表不能为空!") String questionIdPlural, @NotNull(message = "题目分数不能为空!") final BigDecimal questionScore) { @@ -257,16 +373,16 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService getResourcesQuestionSnapshotListByQuestionSettingOptions( + public List getOpenResourcesQuestionSnapListBySettingOptions ( @NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, - @NotBlank(message = "题目设置不能为空!") List questionSettingOptions) { + @NotBlank(message = "题目设置不能为空!") List questionSettingOptions, Map courseInfoIdPair) { List result = new ArrayList<>(); @@ -275,6 +391,36 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService randomMergeResourcesQuestionList = teacherOpenCourseMergeResourcesQuestionDao.getRandomMergeResourcesQuestionList(questionSettingOption); + setRQNewCourseInfoId(randomMergeResourcesQuestionList, courseInfoIdPair); + + // 放入最终的集合中 + result.addAll(getResourcesQuestionSnapshotList(randomMergeResourcesQuestionList, teacherOpenCourseQuestionSettingId, e -> {})); + } + return result; + } + /** + * 根据题目类型配置。从系统题库获取 + * 获取题目快照列表。并配置题目配置ID + * 导入课程,用此方法。 + * 会从系统题库查找 + * + * @param teacherOpenCourseQuestionSettingId + * @param questionSettingOptions + * @return + */ + public List getMergeResourcesQuestionSnapListByQuestionSettingOptionsBySystem ( + @NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId, + @NotBlank(message = "题目设置不能为空!") List questionSettingOptions, Map courseInfoIdPair) { + + List result = new ArrayList<>(); + + for (TeacherOpenCourseQuestionSettingDTO questionSettingOption : questionSettingOptions) { + // 根据配置随机出题。这里直接设置题目的分值。 + List randomMergeResourcesQuestionList = + teacherOpenCourseMergeResourcesQuestionDao.getRandomMergeResourcesQuestionListBySystem(questionSettingOption); + + setRQNewCourseInfoId(randomMergeResourcesQuestionList, courseInfoIdPair); + // 放入最终的集合中 result.addAll(getResourcesQuestionSnapshotList(randomMergeResourcesQuestionList, teacherOpenCourseQuestionSettingId, e -> {})); } @@ -360,4 +506,24 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService teacherOpenCourseKnowledgePointsIds) { return null; } + + @Override + public void resetOperationByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { + log.info("重置题目快照!"); + TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery = new TeacherOpenCourseQuestionSettingQuery(); + teacherOpenCourseQuestionSettingQuery.setTeacherOpenCourseId(teacherOpenCourseId); + List valuesByQuery = + teacherOpenCourseQuestionSettingService.getValuesByQuery(teacherOpenCourseQuestionSettingQuery); + + if (ObjectUtil.isNotEmpty(valuesByQuery)) { + Set settingIdSet = valuesByQuery.stream() + .map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toSet()); + deleteByTeacherOpenCourseQuestionSettingIds(join(settingIdSet.toArray(), ",")); + } + } + + @Override + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { + log.info("需要实现删除操作!"); + } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherMergeApplicationService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherMergeApplicationService.java index 31a1c11d..54d85a45 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherMergeApplicationService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherMergeApplicationService.java @@ -246,11 +246,11 @@ public class TeacherMergeApplicationService extends CoreBaseService handsOnList = handsOnService.getValuesByQuery(handsOnQuery); - TeacherOpenCourseHandsOn handsOn = new TeacherOpenCourseHandsOn(); - handsOn.setCourseInfoId(courseInfoId); - deleteByCondition(handsOn); + sqlManager.lambdaQuery(TeacherOpenCourseHandsOn.class).andEq(TeacherOpenCourseHandsOn::getCourseInfoId, courseInfoId).delete(); List teacherOpenCourseHandsOns = BeanUtil.copyToList(handsOnList, TeacherOpenCourseHandsOn.class); StringJoiner joiner = new StringJoiner(","); for (TeacherOpenCourseHandsOn teacherOpenCourseHandsOn : teacherOpenCourseHandsOns) { @@ -274,11 +273,11 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService teacherOpenCourseHandsOnSimulationTasksFiles = JSONArray.parseArray(tasksFile, TeacherOpenCourseHandsOnSimulationTasksFileQuery.class); for (TeacherOpenCourseHandsOnSimulationTasksFileQuery teacherOpenCourseHandsOnSimulationTasksFile : teacherOpenCourseHandsOnSimulationTasksFiles) { @@ -354,11 +355,11 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - log.info("不需要实现重置操作!"); + log.info("可能需要实现重置操作!"); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { log.info("需要实现删除操作!"); } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointRelationService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointRelationService.java index c35e81a7..df181207 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointRelationService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointRelationService.java @@ -19,6 +19,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @@ -154,11 +155,11 @@ public class TeacherOpenCourseKnowledgePointRelationService extends CoreBaseServ @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - log.info("不需要实现重置操作!"); + log.info("可能需要实现重置操作!"); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { log.info("需要实现删除操作!"); } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointService.java index 4c4eca47..735d1907 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseKnowledgePointService.java @@ -19,6 +19,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @@ -150,11 +151,11 @@ public class TeacherOpenCourseKnowledgePointService extends CoreBaseService implements DeleteResourcesBy { @Autowired private TeacherOpenCourseMergeCourseInfoDao teacherOpenCourseMergeCourseInfoDao; @Autowired private CourseInfoService courseInfoService; @Autowired private TeacherOpenCourseMergeResourcesQuestionService teacherOpenCourseMergeResourcesQuestionService; @Autowired private StudentService studentService; + @Autowired @Lazy private TeacherOpenCourseQuestionSettingService teacherOpenCourseQuestionSettingService; @Autowired private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService; @Autowired @@ -189,6 +191,12 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService questionSettingOptions, Map courseInfoIdPair) { + // 添加开课课程表 + JsonResult jsonResult = add(teacherOpenCourseMergeCourseInfoQuery); + + // 开课课程:2 章节节点 + if(Integer.valueOf(2).equals(teacherOpenCourseMergeCourseInfoQuery.getCourseInfoType())) { + // 添加到题目配置和开课题目快照表,这里null 不拷贝题目 + teacherOpenCourseQuestionSettingService.addTeacherOpenCourseQuestionByCourseInfo(teacherOpenCourseMergeCourseInfoQuery, questionSettingOptions, courseInfoIdPair); + } + + return jsonResult; + } + + + public String edit(TeacherOpenCourseMergeCourseInfoQuery teacherOpenCourseMergeCourseInfoQuery){ String msg = ""; TeacherOpenCourseMergeCourseInfo teacherOpenCourseMergeCourseInfo = teacherOpenCourseMergeCourseInfoQuery.pojo(); @@ -480,11 +515,11 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService copyToList, - final Long parentId, ConcurrentHashMap idPair) { + final Long parentId, ConcurrentHashMap courseInfoIdPair) { // 转换成线程安全的集合,来并行操作。 List safeList = new CopyOnWriteArrayList<>(copyToList); @@ -496,8 +531,8 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService batchUpdateArrayListSomeMergeId(List copyToList, // 不能为空,但是可以传递empty的Map - @NotNull(message = "初始化ID对不能为空!") Map initIdPair) { + @NotNull(message = "初始化ID对不能为空!") Map initcourseInfoIdPair) { - Map idPair = new HashMap<>(initIdPair); + Map courseInfoIdPair = new HashMap<>(initcourseInfoIdPair); // 查找列表中所有的ID Set mergeCourseInfoIdSet = copyToList.stream() @@ -520,15 +555,15 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService courseInfoList, - @NotEmpty(message = "ID对不能为空!") Map someIdPair) { + @NotEmpty(message = "ID对不能为空!") Map somecourseInfoIdPair) { for (CourseInfo courseInfo : courseInfoList) { - someIdPair.forEach((oldId, newId) -> { + somecourseInfoIdPair.forEach((oldId, newId) -> { if(courseInfo.getCourseInfoId().equals(oldId)) { courseInfo.setCourseInfoId(newId); } @@ -626,12 +661,12 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService courseInfoList, - @NotEmpty(message = "ID对不能为空!") Map someIdPair) { + @NotEmpty(message = "ID对不能为空!") Map somecourseInfoIdPair) { for (TeacherOpenCourseMergeCourseInfo courseInfo : courseInfoList) { - someIdPair.forEach((oldId, newId) -> { + somecourseInfoIdPair.forEach((oldId, newId) -> { if(courseInfo.getTeacherOpenCourseMergeCourseInfoId().equals(oldId)) { courseInfo.setTeacherOpenCourseMergeCourseInfoId(newId); } @@ -654,7 +689,7 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService copyFromCourseInfo(@NotEmpty(message = "系统课程ID不能为空!") Set courseInfoIds, @NotNull(message = "开课ID不能为空!") final Long teacherOpenCourseId) { - ConcurrentHashMap idPair = new ConcurrentHashMap<>(); + ConcurrentHashMap courseInfoIdPair = new ConcurrentHashMap<>(16); // 查询是否绑定过课程 boolean notExists = teacherOpenCourseMergeCourseInfoDao.isNotExistsByTeacherOpenCourseId(teacherOpenCourseId); @@ -672,30 +707,39 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService chapterList = courseInfoService.getCourseResources(courseInfoId); // 全部归类到教师开课时候,创建的开课课程ID下。支持一对多个系统课程的拷贝 - idPair.put(currentCourseInfo.getCourseInfoId(), openCourseTargetInfo.getTeacherOpenCourseMergeCourseInfoId()); + courseInfoIdPair.put(currentCourseInfo.getCourseInfoId(), openCourseTargetInfo.getTeacherOpenCourseMergeCourseInfoId()); // 先根据ID清楚现有的课程章节小节这个表 - String delCourseInfoIds = chapterList.stream().map(CourseInfo::getCourseInfoId).collect(CollectorUtil.joining(",")); - deleteTeacherOpenCourseMergeCourseInfo(delCourseInfoIds); - - // 拷贝部分字段映射 - CopyOptions copyOptions = CopyOptions.create().setFieldMapping(MapUtil.of("courseInfoId", "teacherOpenCourseMergeCourseInfoId")); - List copyToList = - BeanUtil.copyToList(chapterList, TeacherOpenCourseMergeCourseInfo.class, copyOptions); - if (ObjectUtil.isEmpty(copyToList)) { return; } - // 设置开课ID - copyToList.forEach(item -> { - item.setTeacherOpenCourseId(teacherOpenCourseId); - item.setCourseInfoName(item.getCourseInfoName().replaceAll(" ", "")); - }); + resetOperationByTeacherOpenCourseId(teacherOpenCourseId); + + List copyToList = new ArrayList<>(); + // 类转换 + courseInfoListConvertTeacherOpenCourseMergeCourseInfoList(chapterList, copyToList); - // 最右侧的idPair 可以理解成是初始化的Map。Map特性Key是唯一的。 - idPair.putAll(batchUpdateArrayListSomeMergeId(copyToList, idPair)); + if (ObjectUtil.isNotEmpty(copyToList)) { + // 设置开课ID + copyToList.forEach(item -> { + item.setTeacherOpenCourseId(teacherOpenCourseId); + item.setCourseInfoName(item.getCourseInfoName().replaceAll(" ", "")); + }); - // 批量插入 - teacherOpenCourseMergeCourseInfoDao.insertBatch(copyToList); + // 最右侧的courseInfoIdPair 可以理解成是初始化的Map。Map特性Key是唯一的。 + courseInfoIdPair.putAll(batchUpdateArrayListSomeMergeId(copyToList, courseInfoIdPair)); + + // 批量插入 + teacherOpenCourseMergeCourseInfoDao.insertBatch(copyToList); + } }); - return idPair; + return Collections.unmodifiableMap(courseInfoIdPair); + } + + private void courseInfoListConvertTeacherOpenCourseMergeCourseInfoList(@NotNull List chapterList, @NotNull Collection result) { + // 拷贝部分字段映射 + CopyOptions copyOptions = CopyOptions.create().setFieldMapping(MapUtil.of("courseInfoId", "teacherOpenCourseMergeCourseInfoId")); + List copyToList = + BeanUtil.copyToList(chapterList, TeacherOpenCourseMergeCourseInfo.class, copyOptions); + + result.addAll(copyToList); } /** @@ -710,39 +754,28 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService courseInfoIds, @NotNull(message = "开课ID不能为空!") final Long teacherOpenCourseId) { - // 拷贝课程章节 - Map idPair = copyFromCourseInfo(courseInfoIds, teacherOpenCourseId); + // 拷贝课程章节。返回的Map是不可修改的。 + Map courseInfoIdPair = copyFromCourseInfo(courseInfoIds, teacherOpenCourseId); // 开启并行处理 courseInfoIds.stream().parallel().forEach(courseInfoId -> { + // 当前的课程节点信息 +// CourseInfo currentCourseInfo = courseInfoService.getById(courseInfoId); // 获取这个课程章节下的所有的子章节信息 + // #courseInfoId 这里指的是课程节点的ID List chapterList = courseInfoService.getCourseResources(courseInfoId); + // 去重后的章和节 HashSet courseInfos = CollectionUtil.newHashSet(chapterList); // 如果课程章节没查到记录,则下面的资源也没必要执行,资源依赖课程章节 - if (ObjectUtil.isEmpty(courseInfos)) { return; } - - // 取出来所有的课程章节ID - String allCourseInfoIdsJoin = courseInfos.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(",")); - - ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); - resourcesQuestionQuery.setCourseInfoIds(allCourseInfoIdsJoin); - resourcesQuestionQuery.setQuestionStatus(1); - List resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery); - - // 系统题目库ID集合 - Set resourcesQuestionIds = resourcesQuestionList.stream().map(ResourcesQuestion::getResourcesQuestionId).collect(toSet()); - // 拷贝系统题目库到教师开课 - teacherOpenCourseMergeResourcesQuestionService.copyFromQuestion(resourcesQuestionIds, teacherOpenCourseId, idPair); - - ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery(); - resourcesInfoQuery.setCourseInfoIds(allCourseInfoIdsJoin); - List resourcesInfoList = resourcesInfoService.getValuesByQuery(resourcesInfoQuery); - - // 系统资源库ID集合 - Set resourcesInfoIds = resourcesInfoList.stream().map(ResourcesInfo::getResourcesInfoId).collect(toSet()); - // 拷贝系统资源库到教师开课 - teacherOpenCourseMergeResourcesInfoService.copyFromResourcesInfo(resourcesInfoIds, teacherOpenCourseId, idPair); + if (ObjectUtil.isNotEmpty(courseInfos)) { + // 拷贝系统题目库到教师开课 + teacherOpenCourseMergeResourcesQuestionService.copyFromQuestionByCourseChapterInfoIds(teacherOpenCourseId, courseInfos, courseInfoIdPair); + // 取出来所有的课程章、节的ID。大于等于2,就是章和他的子节点 + teacherOpenCourseQuestionSettingService.processGroupChapterListToQuestionSetting(teacherOpenCourseId, courseInfos, courseInfoIdPair); + // 拷贝系统资源库到教师开课 + teacherOpenCourseMergeResourcesInfoService.copyFromQuestionByCourseChapterInfoIds(teacherOpenCourseId, courseInfos, courseInfoIdPair); + } }); } @@ -772,6 +805,7 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService delIdList = values.stream().map(TeacherOpenCourseMergeCourseInfo::getTeacherOpenCourseMergeCourseInfoId).collect(toSet()); - deleteTeacherOpenCourseMergeCourseInfo(join(delIdList.toArray(), ",")); + if(ObjectUtil.isNotEmpty(delIdList)) { + deleteTeacherOpenCourseMergeCourseInfo(join(delIdList.toArray(), ",")); + } } + /** + * 指定开课ID清空所有的章节信息 + * + * @param teacherOpenCourseId + */ @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { TeacherOpenCourseMergeCourseInfoQuery courseInfoQuery = new TeacherOpenCourseMergeCourseInfoQuery(); courseInfoQuery.setTeacherOpenCourseId(teacherOpenCourseId); List values = getValuesByQueryNotWithPermission(courseInfoQuery); diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesInfoService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesInfoService.java index 6c1b776e..92b8f485 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesInfoService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesInfoService.java @@ -13,11 +13,13 @@ import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesInfoDao; +import com.ibeetl.jlw.entity.CourseInfo; import com.ibeetl.jlw.entity.FileEntity; import com.ibeetl.jlw.entity.ResourcesInfo; import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesInfo; import com.ibeetl.jlw.web.query.ResourcesInfoQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesInfoQuery; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; @@ -31,11 +33,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import javax.annotation.Nullable; import javax.validation.constraints.NotNull; import java.io.*; import java.util.*; import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toSet; import static org.apache.commons.lang3.StringUtils.join; /** @@ -46,6 +51,7 @@ import static org.apache.commons.lang3.StringUtils.join; @Service @Transactional @Validated +@Slf4j public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService implements DeleteResourcesBy { @Autowired private TeacherOpenCourseMergeResourcesInfoDao teacherOpenCourseMergeResourcesInfoDao; @@ -316,6 +322,46 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService< return teacherOpenCourseMergeResourcesInfoDao.getExcelValues(teacherOpenCourseMergeResourcesInfoQuery); } + /** + * 根据指定的课程ID和章节ID集合,去从系统资源拷贝到开课资源库 + * + * @param teacherOpenCourseId 开课ID + * @param allCourseInfo 指定的所有课程章节 + * @param courseInfoIdPair 拷贝过来的ID段,旧ID和新ID的一个映射关系(非必填) + */ + public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + Collection allCourseInfo, @Nullable Map courseInfoIdPair) { + ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery(); + // 取出所有的课程章节ID + String courseInfoIds = allCourseInfo.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(",")); + resourcesInfoQuery.setCourseInfoIds(courseInfoIds); + List resourcesInfoList = resourcesInfoService.getValuesByQuery(resourcesInfoQuery); + + // 系统资源库ID集合 + Set resourcesInfoIds = resourcesInfoList.stream().map(ResourcesInfo::getResourcesInfoId).collect(toSet()); + // 拷贝系统资源库到教师开课 + copyFromResourcesInfo(resourcesInfoIds, teacherOpenCourseId, courseInfoIdPair); + } + + /** + * 根据指定的课程ID和章节ID集合,去从系统资源拷贝到开课资源库 + * + * @param teacherOpenCourseId 开课ID + * @param allCourseInfoIdsJoin 指定的所有课程章节ID + * @param courseInfoIdPair 拷贝过来的ID段,旧ID和新ID的一个映射关系(非必填) + */ + public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + String allCourseInfoIdsJoin, @Nullable Map courseInfoIdPair) { + ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery(); + resourcesInfoQuery.setCourseInfoIds(allCourseInfoIdsJoin); + List resourcesInfoList = resourcesInfoService.getValuesByQuery(resourcesInfoQuery); + + // 系统资源库ID集合 + Set resourcesInfoIds = resourcesInfoList.stream().map(ResourcesInfo::getResourcesInfoId).collect(toSet()); + // 拷贝系统资源库到教师开课 + copyFromResourcesInfo(resourcesInfoIds, teacherOpenCourseId, courseInfoIdPair); + } + /** * 教师端-导入资源操作,逻辑拆分 @@ -324,11 +370,11 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService< * * @param resourcesInfoIds 资源信息ID集合 * @param teacherOpenCourseId 开课ID - * @param idPair + * @param courseInfoIdPair * @return */ public void copyFromResourcesInfo(Set resourcesInfoIds, - @NotNull(message = "开课ID不能为空!") final Long teacherOpenCourseId, Map idPair) { + @NotNull(message = "开课ID不能为空!") final Long teacherOpenCourseId, Map courseInfoIdPair) { if (ObjectUtil.isEmpty(resourcesInfoIds)) { return; } ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery(); @@ -342,7 +388,7 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService< BeanUtil.copyToList(resourcesInfoList, TeacherOpenCourseMergeResourcesInfo.class, copyOptions); copyToList.forEach(item -> item.setTeacherOpenCourseId(teacherOpenCourseId)); - resetNewId(copyToList, idPair); + resetNewId(copyToList, courseInfoIdPair); // 批量插入资源和开课关联表 insertBatch(copyToList); @@ -351,12 +397,12 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService< /** * 重置开课课程ID。需要拿到新旧改变的关系 * @param copyToList - * @param idPair + * @param courseInfoIdPair */ - public void resetNewId(List copyToList, Map idPair) { - if (ObjectUtil.isEmpty(idPair)) {return;} + public void resetNewId(List copyToList, Map courseInfoIdPair) { + if (ObjectUtil.isEmpty(courseInfoIdPair)) {return;} copyToList.forEach(item -> { - item.setTeacherOpenCourseMergeCourseInfoId(idPair.get(item.getTeacherOpenCourseMergeCourseInfoId())); + item.setTeacherOpenCourseMergeCourseInfoId(courseInfoIdPair.get(item.getTeacherOpenCourseMergeCourseInfoId())); }); } @@ -368,13 +414,14 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService< */ @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - TeacherOpenCourseMergeResourcesInfo teacherOpenCourseMergeResourcesInfo = new TeacherOpenCourseMergeResourcesInfo(); - teacherOpenCourseMergeResourcesInfo.setTeacherOpenCourseId(teacherOpenCourseId); - deleteByCondition(teacherOpenCourseMergeResourcesInfo); + log.info("重置开课课程资源"); + sqlManager.lambdaQuery(TeacherOpenCourseMergeResourcesInfo.class) + .andEq(TeacherOpenCourseMergeResourcesInfo::getTeacherOpenCourseId, teacherOpenCourseId) + .delete(); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesQuestionService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesQuestionService.java index 26bf97c3..28b6ee21 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesQuestionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeResourcesQuestionService.java @@ -14,12 +14,14 @@ import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.jlw.dao.ResourcesQuestionDao; import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesQuestionDao; +import com.ibeetl.jlw.entity.CourseInfo; import com.ibeetl.jlw.entity.FileEntity; import com.ibeetl.jlw.entity.ResourcesQuestion; import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesQuestion; import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionSettingVO; import com.ibeetl.jlw.web.query.ResourcesQuestionQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesQuestionQuery; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; @@ -40,6 +42,8 @@ import java.util.*; import static cn.hutool.core.util.ArrayUtil.join; import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toSet; /** * 开课题目拉取 Service @@ -49,10 +53,12 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; @Service @Transactional @Validated +@Slf4j public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseService implements DeleteResourcesBy { @Autowired private TeacherOpenCourseMergeResourcesQuestionDao teacherOpenCourseMergeResourcesQuestionDao; @Autowired private ResourcesQuestionDao resourcesQuestionDao; + @Autowired private ResourcesQuestionService resourcesQuestionService; public PageQueryqueryByCondition(PageQuery query){ PageQuery ret = teacherOpenCourseMergeResourcesQuestionDao.queryByCondition(query); @@ -366,6 +372,55 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ return teacherOpenCourseMergeResourcesQuestionDao.getExcelValues(teacherOpenCourseMergeResourcesQuestionQuery); } + /** + * 根据指定的课程ID和章节ID集合,去从系统题目拷贝到开课题目库 + * + * @param teacherOpenCourseId 开课ID + * @param allCourseInfo 指定的所有课程章节信息 + * @param courseInfoIdPair 拷贝过来的ID段,旧ID和新ID的一个映射关系(非必填) + */ + public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + Collection allCourseInfo, @NotNull Map courseInfoIdPair) { + + // 待拷贝的系统课程ID不能为空.才会执行 + if (ObjectUtil.isNotEmpty(allCourseInfo)) { + ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); + // 取出所有的课程章节ID + String courseInfoIds = allCourseInfo.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(",")); + resourcesQuestionQuery.setCourseInfoIds(courseInfoIds); + resourcesQuestionQuery.setQuestionStatus(1); + List resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery); + + // 系统题目库ID集合 + Set resourcesQuestionIds = resourcesQuestionList.stream().map(ResourcesQuestion::getResourcesQuestionId).collect(toSet()); + // 拷贝系统题目库到教师开课 + copyFromQuestion(resourcesQuestionIds, teacherOpenCourseId, courseInfoIdPair); + } + } + + /** + * 根据指定的课程ID和章节ID集合,去从系统题目拷贝到开课题目库 + * + * @param teacherOpenCourseId 开课ID + * @param allCourseInfoIdsJoin 指定的所有课程章节ID + * @param courseInfoIdPair 拷贝过来的ID段,旧ID和新ID的一个映射关系(非必填) + */ + public void copyFromQuestionByCourseChapterInfoIds(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + String allCourseInfoIdsJoin, @NotNull Map courseInfoIdPair) { + + // 待拷贝的系统课程ID不能为空.才会执行 + if (ObjectUtil.isNotEmpty(allCourseInfoIdsJoin)) { + ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); + resourcesQuestionQuery.setCourseInfoIds(allCourseInfoIdsJoin); + resourcesQuestionQuery.setQuestionStatus(1); + List resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery); + + // 系统题目库ID集合 + Set resourcesQuestionIds = resourcesQuestionList.stream().map(ResourcesQuestion::getResourcesQuestionId).collect(toSet()); + // 拷贝系统题目库到教师开课 + copyFromQuestion(resourcesQuestionIds, teacherOpenCourseId, courseInfoIdPair); + } + } /** * 从resources_question 表,拷贝数据。类似从模板中,拉取数据 @@ -375,11 +430,11 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ * * @param resourcesQuestionIds * @param teacherOpenCourseId - * @param idPair + * @param courseInfoIdPair * @return */ public void copyFromQuestion(Set resourcesQuestionIds, - @NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, Map idPair) { + @NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, Map courseInfoIdPair) { if (ObjectUtil.isEmpty(resourcesQuestionIds)) { return; } // 题目ID集合 @@ -390,22 +445,35 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ resourcesQuestionQuery.setQuestionStatus(1); List resourcesQuestions = resourcesQuestionDao.getValuesByQuery(resourcesQuestionQuery); + // 转换后的数据暂存 + List convertedList = new ArrayList<>(); + // 类转换方法 + resourcesQuestionConvertToTeacherOpenCourseMergeResourcesQuestion(resourcesQuestions, convertedList, courseInfoIdPair ); + // 设置开课ID + convertedList.forEach(item -> item.setTeacherOpenCourseId(teacherOpenCourseId)); + // 批量插入 + teacherOpenCourseMergeResourcesQuestionDao.insertBatch(convertedList); + } + + /** + * 类转换 ResourcesQuestion => TeacherOpenCourseMergeResourcesQuestion + * @param from + * @param to + * @param courseInfoIdPair + */ + public void resourcesQuestionConvertToTeacherOpenCourseMergeResourcesQuestion( + @NotNull Collection from, + @NotNull Collection to, + Map courseInfoIdPair) { // 拷贝部分字段映射 CopyOptions copyOptions = CopyOptions.create().setFieldMapping(MapUtil.of("courseInfoId", "teacherOpenCourseMergeCourseInfoId")); // 拷贝 - List copyToList = - BeanUtil.copyToList(resourcesQuestions, TeacherOpenCourseMergeResourcesQuestion.class, copyOptions); - + to.addAll(BeanUtil.copyToList(from, TeacherOpenCourseMergeResourcesQuestion.class, copyOptions)); - if (ObjectUtil.isEmpty(copyToList)) { return; } - // 设置开课ID - copyToList.forEach(item -> item.setTeacherOpenCourseId(teacherOpenCourseId)); + if (ObjectUtil.isAllEmpty(to, courseInfoIdPair)) { return; } // 重置开课课程ID - resetNewId(copyToList, idPair); - - // 批量插入 - teacherOpenCourseMergeResourcesQuestionDao.insertBatch(copyToList); + resetNewId(to, courseInfoIdPair); } /** @@ -417,25 +485,27 @@ public class TeacherOpenCourseMergeResourcesQuestionService extends CoreBaseServ @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - TeacherOpenCourseMergeResourcesQuestion teacherOpenCourseIdCondition = new TeacherOpenCourseMergeResourcesQuestion(); - teacherOpenCourseIdCondition.setTeacherOpenCourseId(teacherOpenCourseId); - deleteByCondition(teacherOpenCourseIdCondition); + log.info("重置开课课程题目"); + sqlManager.lambdaQuery(TeacherOpenCourseMergeResourcesQuestion.class) + .andEq(TeacherOpenCourseMergeResourcesQuestion::getTeacherOpenCourseId, teacherOpenCourseId) + .delete(); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { resetOperationByTeacherOpenCourseId(teacherOpenCourseId); } /** * 重置开课课程ID。需要拿到新旧改变的关系 * @param copyToList - * @param idPair + * @param courseInfoIdPair */ - public void resetNewId(List copyToList, Map idPair) { - if (ObjectUtil.isEmpty(idPair)) {return;} + public void resetNewId(@NotNull Collection copyToList, @NotNull Map courseInfoIdPair) { + if (ObjectUtil.isEmpty(courseInfoIdPair)) {return;} copyToList.forEach(item -> { - item.setTeacherOpenCourseMergeCourseInfoId(idPair.get(item.getTeacherOpenCourseMergeCourseInfoId())); + Long mergeCourseInfoId = item.getTeacherOpenCourseMergeCourseInfoId(); + item.setTeacherOpenCourseMergeCourseInfoId(courseInfoIdPair.getOrDefault(mergeCourseInfoId, mergeCourseInfoId)); }); } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeScheduleSessionService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeScheduleSessionService.java index 3c338b20..613db590 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeScheduleSessionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeScheduleSessionService.java @@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotNull; import java.io.*; import java.util.*; @@ -292,11 +293,11 @@ public class TeacherOpenCourseMergeScheduleSessionService extends CoreBaseServic @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - log.info("不需要实现重置操作!"); + log.info("可能需要实现重置操作!"); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { log.info("需要实现删除操作!"); } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeSchoolClassService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeSchoolClassService.java index 78564caf..b5018711 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeSchoolClassService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseMergeSchoolClassService.java @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -162,11 +163,11 @@ public class TeacherOpenCourseMergeSchoolClassService extends CoreBaseServicequeryByCondition(PageQuery query){ @@ -95,6 +97,18 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService teacherOpenCourseQuestionLogWrongList = new ArrayList<>(); @@ -409,11 +422,11 @@ public class TeacherOpenCourseQuestionLogWrongService extends CoreBaseServicequeryByCondition(PageQuery query){ PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByCondition(query); @@ -153,10 +178,49 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService courseInfoIdPair ) { + + if (null == settingQuery.getTeacherOpenCourseQuestionSettingStatus()) { + settingQuery.setTeacherOpenCourseQuestionSettingStatus(1); + } + if (null == settingQuery.getTeacherOpenCourseQuestionSettingPushStatus()) { + settingQuery.setTeacherOpenCourseQuestionSettingPushStatus(1); + } + + // 添加到作业主表中 + add(settingQuery); + + // 插入快照 + Long teacherOpenCourseQuestionSettingId = settingQuery.getTeacherOpenCourseQuestionSettingId(); + List questionSettingOptions = settingQuery.getQuestionSettingOptions(); + resourcesQuestionSnapshotService.insertBatchByMergeResourcesQuestion(teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair); + } + + + /** + * 增加题目类型的数据 + * 从系统题库中拉取 + *

+ * 任务一;添加题目配置主表 + * 任务二:添加题目快照表 + * * @param settingQuery * @return */ - public void addQuestionByType(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery) { + public void addQuestionByTypeFromSystem(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map courseInfoIdPair ) { + + if (null == settingQuery.getTeacherOpenCourseQuestionSettingStatus()) { + settingQuery.setTeacherOpenCourseQuestionSettingStatus(1); + } + if (null == settingQuery.getTeacherOpenCourseQuestionSettingPushStatus()) { + settingQuery.setTeacherOpenCourseQuestionSettingPushStatus(1); + } // 添加到作业主表中 add(settingQuery); @@ -164,17 +228,289 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService questionSettingOptions = settingQuery.getQuestionSettingOptions(); - resourcesQuestionSnapshotService.insertBatchByQuestionIds(teacherOpenCourseQuestionSettingId, questionSettingOptions); + resourcesQuestionSnapshotService.insertBatchBySystemResourcesQuestion(teacherOpenCourseQuestionSettingId, questionSettingOptions, courseInfoIdPair); + } + + + + /** + * 通过无类别区分的题目ID,对题目进行分组。并构建需要的数据 + * 只适用于手动出题这块。 + * + * @param noDiffResourcesQuestionIdPlural 题目ID来自ResourcesQuestion表。 + * @return + */ + public Map buildSettingDtoListByNoDiffQuestionIds( + @NotEmpty(message = "系统题目ID不能为空!") String noDiffResourcesQuestionIdPlural) { + + // 只查询正常状态的题目列表 + ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); + resourcesQuestionQuery.setQuestionStatus(1); + resourcesQuestionQuery.setResourcesQuestionIds(noDiffResourcesQuestionIdPlural); + List valuesByQuery = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery); + + return buildSettingDtoListByNoDiffQuestionList(valuesByQuery); + } + + + /** + * 处理章节节点,下面所有的题目 + * 并保存到题目配置和题目快照表 + * 从系统题库表拷贝!!! + * + * @param teacherOpenCourseId 开课ID + * @param courseInfos 当前课程下的子节点 + * @param courseInfoIdPair 课程的新旧ID片段集合 + */ + public void processGroupChapterListToQuestionSetting(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + Collection courseInfos, Map courseInfoIdPair) { + + // 章节对应下面的所有子集 + Map> courseChapterInfoIdsWithChildren = courseInfoService.getCourseChapterInfoIdsWithChildren(courseInfos); + + courseChapterInfoIdsWithChildren.forEach((courseInfo, chapterInfoList) -> { + // 该列表下的所有ID合并 + String allCourseInfoIds = chapterInfoList.stream().map(item -> item.getCourseInfoId().toString()).collect(joining(",")); + List questionList = resourcesQuestionService.getByCourseInfoIds(allCourseInfoIds); + + // 有题目才继续执行 + if(ObjectUtil.isNotEmpty(questionList)) { + Map map = buildSettingDtoListByNoDiffQuestionList(questionList); + Map> courseInfoIdWithQuestionSettingOptions = new HashMap<>(1); + courseInfoIdWithQuestionSettingOptions.put(courseInfo, map.values()); + addTeacherOpenCourseQuestionBySystemCourseInfo(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, courseInfoIdPair); + } + }); + } + + /** + * 根据开课的课程信息,添加题目配置和题目 + * 这里不区分节点是什么类型的。 + * 严格要求: + * + * 添加主表 + * 任务一:添加主表 + * 任务二:添加到题目配置主表; + * 任务二:也可以添加题目快照(非必选) + */ + public void addTeacherOpenCourseQuestionByCourseInfo(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseMergeCourseInfoQuery teacherOpenCourseMergeCourseInfoQuery, + @Nullable Collection questionSettingOptions, Map courseInfoIdPair) { + + Long teacherOpenCourseId = teacherOpenCourseMergeCourseInfoQuery.getTeacherOpenCourseId(); + TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery(); + + // 设置章节练习的默认配置,并设置开课ID + settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId); + settingQuery.setTeacherOpenCourseQuestionSettingName(teacherOpenCourseMergeCourseInfoQuery.getCourseInfoName()); + settingQuery.setQuestionSettingOptions(new ArrayList<>(questionSettingOptions)); + addQuestionByTypeFromSystem(settingQuery, courseInfoIdPair); + } + + + /** + * 根据开课的课程信息,添加题目配置和题目 + * + * 添加主表 + * 任务一:添加主表 + * 任务二:添加到题目配置主表; + * 任务二:也可以添加题目快照(非必选) + * @param teacherOpenCourseId 开课ID + * @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表 + */ + public void addTeacherOpenCourseQuestionByCourseInfo(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + @Nullable Map> courseInfoIdWithQuestionSettingOptions, + @NotNull Map courseInfoIdPair) { + addTeacherOpenCourseQuestionByCourseInfo(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, Integer.valueOf(2), TeacherOpenCourseMergeCourseInfo::getCourseInfoType, courseInfoIdPair); + } + + + /** + * 根据开课的课程信息,添加题目配置和题目 + *

+ * 添加主表 + * 任务一:添加主表 + * 任务二:添加到题目配置主表; + * 任务二:也可以添加题目快照(非必选) + * + * @param teacherOpenCourseId 开课ID + * @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表 + * @param eq 待比对的值 + * @param func1 比对的字段取值接口 + * @param courseInfoIdPair + */ + public void addTeacherOpenCourseQuestionByCourseInfo(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + @Nullable Map> courseInfoIdWithQuestionSettingOptions, + @NotNull Object eq, @NotNull Func1 func1, @NotNull Map courseInfoIdPair) { + TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery(); + // 设置章节练习的默认配置,并设置开课ID + settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId); + + courseInfoIdWithQuestionSettingOptions.forEach((courseInfo, settingDtoList) -> { + // 判断,添加交给外部来控制 + try { + if(eq.equals(func1.call(courseInfo))) { + settingQuery.setQuestionSettingOptions(new ArrayList<>(settingDtoList)); + settingQuery.setTeacherOpenCourseQuestionSettingName(courseInfo.getCourseInfoName()); + addByMergeQuestion(settingQuery, courseInfoIdPair); + } + } catch (Exception e) { } + }); + } + + + /** + * 根据开课的课程信息,添加题目配置和题目 + * + * 添加主表 + * 任务一:添加主表 + * 任务二:添加到题目配置主表; + * 任务二:也可以添加题目快照(非必选) + * @param teacherOpenCourseId 开课ID + * @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表 + */ + public void addTeacherOpenCourseQuestionBySystemCourseInfo(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + @Nullable Map> courseInfoIdWithQuestionSettingOptions, + @NotNull Map courseInfoIdPair) { + addTeacherOpenCourseQuestionBySystemCourseInfo(teacherOpenCourseId, courseInfoIdWithQuestionSettingOptions, Integer.valueOf(2), CourseInfo::getCourseInfoType, courseInfoIdPair); + } + + /** + * 根据开课的课程信息,添加题目配置和题目 + *

+ * 添加主表 + * 任务一:添加主表 + * 任务二:添加到题目配置主表; + * 任务二:也可以添加题目快照(非必选) + * + * @param teacherOpenCourseId 开课ID + * @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表 + * @param eq 待比对的值 + * @param func1 比对的字段取值接口 + * @param courseInfoIdPair + */ + public void addTeacherOpenCourseQuestionBySystemCourseInfo(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + @Nullable Map> courseInfoIdWithQuestionSettingOptions, + @NotNull Object eq, @NotNull Func1 func1, @NotNull Map courseInfoIdPair) { + TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery(); + // 设置章节练习的默认配置,并设置开课ID + settingQuery.setCourseTestDefault().setTeacherOpenCourseId(teacherOpenCourseId); + + courseInfoIdWithQuestionSettingOptions.forEach((courseInfo, settingDtoList) -> { + // 判断,添加交给外部来控制 + try { + if(eq.equals(func1.call(courseInfo))) { + settingQuery.setQuestionSettingOptions(new ArrayList<>(settingDtoList)); + settingQuery.setTeacherOpenCourseQuestionSettingName(courseInfo.getCourseInfoName()); + addQuestionByTypeFromSystem(settingQuery, courseInfoIdPair); + } + } catch (Exception e) { } + }); + } + + + /** + * 通过无类别区分的题目列表,对题目进行分组。并构建需要的数据 + * 只适用于手动出题这块。 + * + * @param resourcesQuestionList + * @return + */ + public Map buildSettingDtoListByNoDiffQuestionList( + List resourcesQuestionList) { + + if (ObjectUtil.isEmpty(resourcesQuestionList)) { + return null; + } + + // 先构建初始的属性 + Function buildFunc = + item -> TeacherOpenCourseQuestionSettingDTO.builder() + .questionType(EnumUtil.likeValueOf(ResourcesQuestionTypeEnum.class, item.getQuestionType())) + .resourcesQuestionIdPlural(item.getResourcesQuestionId().toString()) + .singleScore(item.getQuestionScore()) + .build(); + + // 根据类型分组 + Map> groupMap = + resourcesQuestionList.stream().map(buildFunc).collect(groupingBy(TeacherOpenCourseQuestionSettingDTO::getQuestionType)); + + Map result = new ConcurrentHashMap<>(5); + + // 分组后的数据,再处理 + groupMap.forEach((key, value) -> { + + // resourcesQuestionIdPlural 上面暂存的是单个题目ID,这里将所有的题目ID处理成逗号隔开的字符 + String questionIds = value.stream() + .map(TeacherOpenCourseQuestionSettingDTO::getResourcesQuestionIdPlural).collect(joining(",")); + + // 查询到的题目的数量 + Integer selectCount = ObjectUtil.defaultIfNull(value, Lists.emptyList()).size(); + + // 设置其他属性,如果集合长度不为空的话 + if (selectCount > 0) { + TeacherOpenCourseQuestionSettingDTO teacherOpenCourseQuestionSettingDTO = value.get(0); + // 该类型下,单个题目的分数 + BigDecimal singleScore = teacherOpenCourseQuestionSettingDTO.getSingleScore(); + teacherOpenCourseQuestionSettingDTO.setResourcesQuestionIdPlural(questionIds) + .setSingleTypeTotalScore(NumberUtil.mul(singleScore, selectCount)) + .setSelectCount(selectCount); + + // 放入结果集中 + result.put(key, teacherOpenCourseQuestionSettingDTO); + } + }); + return result; } @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - log.info("不需要实现重置操作!"); + log.info("重置开课题目配置"); + sqlManager.lambdaQuery(TeacherOpenCourseQuestionSetting.class) + .andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId) + .delete(); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { log.info("需要实现删除操作!"); + deleteWithSubDataByParams(teacherOpenCourseId, null); + } + + /** + * 可以删除子表数据的方法 + * 根据名称 + * @param teacherOpenCourseId + * @param teacherOpenCourseQuestionSettingName (可为空,为空则不指定名称删除) + */ + public void deleteWithSubDataByParams(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId, + @Nullable String teacherOpenCourseQuestionSettingName) { + // 条件 + TeacherOpenCourseQuestionSetting condition = new TeacherOpenCourseQuestionSetting(); + condition.setTeacherOpenCourseId(teacherOpenCourseId); + condition.setTeacherOpenCourseQuestionSettingName(teacherOpenCourseQuestionSettingName); + + List settingList = getValues(condition); + + // 获取需要删除的ID集合 + List idList = settingList.stream() + .map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList()); + + // 获取完ID以后,删除主表数据 + sqlManager.lambdaQuery(TeacherOpenCourseQuestionSetting.class) + .andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId) + .andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingName, teacherOpenCourseQuestionSettingName) + .delete(); + + // 获取题目配置ID集合 + String settingIds = join(",", idList); + if (ObjectUtil.isNotEmpty(settingIds)) { + // 删除子表的数据(题目快照) + resourcesQuestionSnapshotService.deleteByTeacherOpenCourseQuestionSettingIds(settingIds); + // 删除子表的数据(题目配置) + teacherOpenCourseQuestionLogService.deleteByTeacherOpenCourseQuestionSettingIds(settingIds); + // 删除子表的数据(错题库) + teacherOpenCourseQuestionLogWrongService.deleteByTeacherOpenCourseQuestionSettingIds(settingIds); + } } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionClassService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionClassService.java index 6664f5f7..94a31697 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionClassService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionClassService.java @@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.validation.constraints.NotNull; import java.util.*; import java.util.stream.Collectors; @@ -239,11 +240,11 @@ public class TeacherOpenCourseScheduleSessionClassService extends CoreBaseServic @Override public void resetOperationByTeacherOpenCourseId(Long teacherOpenCourseId) { - log.info("不需要实现重置操作!"); + log.info("可能需要实现重置操作!"); } @Override - public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long teacherOpenCourseId) { + public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) { log.info("需要实现删除操作!"); } 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 57b69013..456a54f3 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScheduleSessionService.java @@ -405,11 +405,11 @@ public class TeacherOpenCourseScheduleSessionService extends CoreBaseService return teacherOpenCourseDao.getValuesByQuery(teacherOpenCourseQuery); } + @Cacheable(value="teacherOpenCourseService.getInfo", key="#teacherOpenCourseId") public TeacherOpenCourse getInfo (Long teacherOpenCourseId){ TeacherOpenCourseQuery teacherOpenCourseQuery = new TeacherOpenCourseQuery(); teacherOpenCourseQuery.setTeacherOpenCourseId(teacherOpenCourseId); diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java index 4c54ac14..196f09b2 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java @@ -626,11 +626,11 @@ public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService()); } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java index a65e1ee8..4febbe0a 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java @@ -20,6 +20,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; +import java.util.HashMap; import java.util.List; /** @@ -90,13 +91,7 @@ public class TeacherOpenCourseQuestionSettingController{ Assert.notNull(coreUser, "请登录后再操作"); teacherOpenCourseQuestionSettingQuery.setUserId(coreUser.getId()); teacherOpenCourseQuestionSettingQuery.setOrgId(coreUser.getOrgId()); - if (null == teacherOpenCourseQuestionSettingQuery.getTeacherOpenCourseQuestionSettingStatus()) { - teacherOpenCourseQuestionSettingQuery.setTeacherOpenCourseQuestionSettingStatus(1); - } - if (null == teacherOpenCourseQuestionSettingQuery.getTeacherOpenCourseQuestionSettingPushStatus()) { - teacherOpenCourseQuestionSettingQuery.setTeacherOpenCourseQuestionSettingPushStatus(1); - } - teacherOpenCourseQuestionSettingService.addQuestionByType(teacherOpenCourseQuestionSettingQuery); + teacherOpenCourseQuestionSettingService.addByMergeQuestion(teacherOpenCourseQuestionSettingQuery, new HashMap<>(1)); return JsonResult.success(); } diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseMergeCourseInfoQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseMergeCourseInfoQuery.java index 0cd28feb..8b4f23c3 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseMergeCourseInfoQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseMergeCourseInfoQuery.java @@ -5,6 +5,7 @@ import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.web.query.PageParam; import com.ibeetl.jlw.entity.TeacherOpenCourseMergeCourseInfo; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; /** @@ -14,8 +15,12 @@ public class TeacherOpenCourseMergeCourseInfoQuery extends PageParam { @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) @Query(name = "ID", display = false) private Long teacherOpenCourseMergeCourseInfoId; - @Query(name = "开课名称", display = true,type=Query.TYPE_DICT,dict="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") + + @NotNull(message = "开课ID不能为空", groups =ValidateConfig.ADD.class) + @Query(name = "开课ID", display = true,type=Query.TYPE_DICT,dict="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") private Long teacherOpenCourseId; + + @NotEmpty(message = "章节名称不能为空", groups =ValidateConfig.ADD.class) @Query(name = "名称(课程名 或 章名 或 节名)", display = false) private String courseInfoName; @Query(name = "课程缩略图", display = false) @@ -29,6 +34,7 @@ public class TeacherOpenCourseMergeCourseInfoQuery extends PageParam { @Query(name = "状态(1启用 2禁用 3删除)", display = false) private Integer courseInfoStatus; @Query(name = "类型(1课程 2章 3节)", display = false) + @NotNull(message = "类型不能为空", groups =ValidateConfig.ADD.class) private Integer courseInfoType; @Query(name = "父节点ID", display = false) private Long courseInfoParentId; diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java index d8da725a..468e3faa 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java @@ -1,5 +1,6 @@ package com.ibeetl.jlw.web.query; +import cn.hutool.core.date.DateField; import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.web.query.PageParam; @@ -14,6 +15,8 @@ import javax.validation.constraints.NotNull; import java.util.Date; import java.util.List; +import static cn.hutool.core.date.DateUtil.offset; + /** *题目配置查询 */ @@ -113,6 +116,10 @@ public class TeacherOpenCourseQuestionSettingQuery extends PageParam { return pojo; } + /** + * 考试的默认配置 + * @param setting + */ public static void setDefault(TeacherOpenCourseQuestionSettingQuery setting) { setting.setTeacherOpenCourseQuestionSettingStatus(1); setting.setTeacherOpenCourseQuestionSettingAddTime(new Date()); @@ -124,7 +131,33 @@ public class TeacherOpenCourseQuestionSettingQuery extends PageParam { setting.setTeacherOpenCourseQuestionSettingSchoolClassIds("ALL"); } - public void setDefault() { + /** + * 章节练习的默认配置 + * @param setting + */ + public static void setCourseTestDefault(TeacherOpenCourseQuestionSettingQuery setting) { + setting.setTeacherOpenCourseQuestionSettingStatus(1); + setting.setTeacherOpenCourseQuestionSettingAddTime(new Date()); + setting.setTeacherOpenCourseQuestionSettingOptionNoOrder(1); + setting.setTeacherOpenCourseQuestionSettingQuestionNoOrder(1); + setting.setTeacherOpenCourseQuestionSettingEndShowTrueFalse(1); + setting.setTeacherOpenCourseQuestionSettingEndShowQa(1); + setting.setTeacherOpenCourseQuestionSettingDoCount(1000); + setting.setTeacherOpenCourseQuestionSettingType(ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE); + setting.setTeacherOpenCourseQuestionSettingSchoolClassIds("ALL"); + setting.setTeacherOpenCourseQuestionSettingPushStatus(1); + setting.setTeacherOpenCourseQuestionStartTime(new Date()); + // 结束时间设置为20年后 + setting.setTeacherOpenCourseQuestionEndTime(offset(new Date(), DateField.YEAR, 20)); + } + + public TeacherOpenCourseQuestionSettingQuery setCourseTestDefault() { + setCourseTestDefault(this); + return this; + } + + public TeacherOpenCourseQuestionSettingQuery setDefault() { setDefault(this); + return this; } } diff --git a/web/src/main/resources/sql/jlw/resourcesQuestion.md b/web/src/main/resources/sql/jlw/resourcesQuestion.md index e3528d99..0cd08ae5 100644 --- a/web/src/main/resources/sql/jlw/resourcesQuestion.md +++ b/web/src/main/resources/sql/jlw/resourcesQuestion.md @@ -123,6 +123,9 @@ getValuesByQuery @if(!isEmpty(questionType)){ and t.question_type =#questionType# @} + @if(!isEmpty(questionStatus)){ + and t.question_status =#questionStatus# + @} @if(!isEmpty(questionScore)){ and t.question_score =#questionScore# @} @@ -226,6 +229,9 @@ getResourcesQuestionValues @if(!isEmpty(userId)){ and t.user_id =#userId# @} + @if(!isEmpty(questionStatus)){ + and t.question_status =#questionStatus# + @} getValuesToCourseInfo diff --git a/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md b/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md index 225bf855..dfea990e 100644 --- a/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md +++ b/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md @@ -172,6 +172,14 @@ deleteResourcesQuestionSnapshotByIds delete from resources_question_snapshot where find_in_set(resources_question_snapshot_id,#ids#) +deleteByTeacherOpenCourseQuestionSettingIds +=== + +* 批量删除(通过题目配置ID) + + delete from resources_question_snapshot where find_in_set(teacher_open_course_question_setting_id,#settingIds#) + + getByIds === diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseMergeResourcesQuestion.md b/web/src/main/resources/sql/jlw/teacherOpenCourseMergeResourcesQuestion.md index 2e2c3c74..b8c9cf45 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseMergeResourcesQuestion.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseMergeResourcesQuestion.md @@ -740,6 +740,49 @@ getRandomMergeResourcesQuestionList @} @} + +getRandomMergeResourcesQuestionListBySystem +=== +* 根据题目设置随机出题(从系统的题库获取) + + select + @if(!isEmpty(singleScore)){ + '' as teacher_open_course_merge_resources_question_id, + '' as teacher_open_course_id, + t.course_info_id as teacher_open_course_merge_course_info_id, + t.question_type, + t.question_stem, + t.question_option_a, + t.question_option_b, + t.question_option_c, + t.question_option_d, + t.question_option_e, + t.question_answer, + #singleScore# as question_score, + t.question_analysis, + t.question_status, + t.user_id, + t.org_id + @} else { + t.* + @} + from resources_question t + where 1=1 + and t.question_status = 1 + @// 题目ID优先级高 + @if(!isEmpty(resourcesQuestionIdPlural)) { + and find_in_set(t.resources_question_id, #resourcesQuestionIdPlural#) + @} else { + @// 随机抽题,根据题目配置动态抽取题目。会存在题库抽不够数的情况。 + @if(!isEmpty(questionType)){ + and find_in_set(t.question_type, #questionType#) + @} + @if(!isEmpty(selectCount)){ + ORDER BY RAND() + limit #selectCount# + @} + @} + getGroupQuestionTypeCount === * 开课离线题库,根据题目类型分组查询数量 diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLog.md b/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLog.md index 65527dd7..a36dfc96 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLog.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLog.md @@ -331,6 +331,13 @@ deleteByIds delete from teacher_open_course_question_log where find_in_set(teacher_open_course_question_log_id,#ids#) +deleteByTeacherOpenCourseQuestionSettingIds +=== + +* 根据题目配置ID 批量(真删除) + + delete from teacher_open_course_question_log where find_in_set(teacher_open_course_question_setting_id, settingIds#) + getByIds diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLogWrong.md b/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLogWrong.md index f7398f9a..56c5e5a7 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLogWrong.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLogWrong.md @@ -210,6 +210,13 @@ deleteByIds delete from teacher_open_course_question_log_wrong where find_in_set(teacher_open_course_question_log_wrong_id,#ids#) +deleteByTeacherOpenCourseQuestionSettingIds +=== + +* 批量删除(通过题目配置ID) + + delete from teacher_open_course_question_log_wrong where find_in_set(teacher_open_course_question_setting_id,#settingIds#) + getByIds === diff --git a/web/src/test/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeSchoolClassControllerTest.java b/web/src/test/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeSchoolClassControllerTest.java index 1e83bff4..567dcfc4 100644 --- a/web/src/test/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeSchoolClassControllerTest.java +++ b/web/src/test/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeSchoolClassControllerTest.java @@ -122,8 +122,4 @@ public class TeacherOpenCourseMergeSchoolClassControllerTest extends BaseTest { public void delete() { } - @Test - public void deleteByCondition() { - } - } \ No newline at end of file