|
|
|
@ -16,6 +16,7 @@ import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionSettingDTO;
|
|
|
|
|
import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery;
|
|
|
|
|
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;
|
|
|
|
@ -30,6 +31,7 @@ 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.function.Consumer;
|
|
|
|
|
|
|
|
|
@ -225,24 +227,12 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
|
|
|
|
|
Consumer<ResourcesQuestionSnapshot> resourcesQuestionSnapshotConsumer = snapshot -> {
|
|
|
|
|
snapshot.setTeacherOpenCourseQuestionSettingId(teacherOpenCourseQuestionSettingId);
|
|
|
|
|
};
|
|
|
|
|
snapshotList.forEach(resourcesQuestionSnapshotConsumer.andThen(otherConsumer));
|
|
|
|
|
|
|
|
|
|
Optional.ofNullable(snapshotList).orElse(Lists.emptyList())
|
|
|
|
|
.forEach(resourcesQuestionSnapshotConsumer.andThen(otherConsumer));
|
|
|
|
|
|
|
|
|
|
return snapshotList;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 根据题目ID集合
|
|
|
|
|
* 获取题目快照列表。并配置题目配置ID
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseQuestionSettingId
|
|
|
|
|
* @param questionIdPlural
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<ResourcesQuestionSnapshot> getResourcesQuestionSnapshotListByQuestionIds(
|
|
|
|
|
@NotNull(message = "开课题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId,
|
|
|
|
|
@NotBlank(message = "题目ID列表不能为空!") String questionIdPlural) {
|
|
|
|
|
return getResourcesQuestionSnapshotListByQuestionIds(teacherOpenCourseQuestionSettingId, questionIdPlural);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据题目ID集合
|
|
|
|
@ -285,14 +275,8 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
|
|
|
|
|
List<TeacherOpenCourseMergeResourcesQuestion> randomMergeResourcesQuestionList =
|
|
|
|
|
teacherOpenCourseMergeResourcesQuestionDao.getRandomMergeResourcesQuestionList(questionSettingOption);
|
|
|
|
|
|
|
|
|
|
// Copy到新对象中
|
|
|
|
|
List<ResourcesQuestionSnapshot> snapshotList = BeanUtil.copyToList(randomMergeResourcesQuestionList, ResourcesQuestionSnapshot.class);
|
|
|
|
|
snapshotList.forEach(snapshot -> {
|
|
|
|
|
snapshot.setTeacherOpenCourseQuestionSettingId(teacherOpenCourseQuestionSettingId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 放入最终的集合中
|
|
|
|
|
result.addAll(snapshotList);
|
|
|
|
|
result.addAll(getResourcesQuestionSnapshotList(randomMergeResourcesQuestionList, teacherOpenCourseQuestionSettingId, e -> {}));
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|