|
|
|
@ -63,43 +63,56 @@ import static java.util.stream.Collectors.joining;
|
|
|
|
|
@Service
|
|
|
|
|
@Transactional
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<TeacherOpenCourseQuestionSetting> implements DeleteResourcesBy{
|
|
|
|
|
|
|
|
|
|
@Autowired private TeacherOpenCourseQuestionSettingDao teacherOpenCourseQuestionSettingDao;
|
|
|
|
|
@Autowired private ResourcesQuestionSnapshotDao resourcesQuestionSnapshotDao;
|
|
|
|
|
@Autowired private TeacherOpenCourseQuestionLogDao teacherOpenCourseQuestionLogDao;
|
|
|
|
|
@Autowired private QuestionLogSummaryDao questionLogSummaryDao;
|
|
|
|
|
@Autowired private StudentDao studentDao;
|
|
|
|
|
@Autowired private ResourcesQuestionSnapshotService resourcesQuestionSnapshotService;
|
|
|
|
|
@Autowired private TeacherOpenCourseQuestionLogService teacherOpenCourseQuestionLogService;
|
|
|
|
|
@Autowired private TeacherOpenCourseQuestionLogWrongService teacherOpenCourseQuestionLogWrongService;
|
|
|
|
|
@Autowired private ResourcesQuestionService resourcesQuestionService;
|
|
|
|
|
@Autowired private CourseInfoService courseInfoService;
|
|
|
|
|
@Autowired private TeacherOpenCourseMergeResourcesQuestionService teacherOpenCourseMergeResourcesQuestionService;
|
|
|
|
|
@Autowired private TeacherOpenCourseMergeCourseInfoService teacherOpenCourseMergeCourseInfoService;
|
|
|
|
|
@Autowired private QuestionSettingRedisDelayQueueImpl questionSettingRedisDelayQueue;
|
|
|
|
|
public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<TeacherOpenCourseQuestionSetting> implements DeleteResourcesBy {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionSettingDao teacherOpenCourseQuestionSettingDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesQuestionSnapshotDao resourcesQuestionSnapshotDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionLogDao teacherOpenCourseQuestionLogDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private QuestionLogSummaryDao questionLogSummaryDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentDao studentDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesQuestionSnapshotService resourcesQuestionSnapshotService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionLogService teacherOpenCourseQuestionLogService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionLogWrongService teacherOpenCourseQuestionLogWrongService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesQuestionService resourcesQuestionService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CourseInfoService courseInfoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeResourcesQuestionService teacherOpenCourseMergeResourcesQuestionService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeCourseInfoService teacherOpenCourseMergeCourseInfoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private QuestionSettingRedisDelayQueueImpl questionSettingRedisDelayQueue;
|
|
|
|
|
@Autowired
|
|
|
|
|
private QuestionLogSummaryService questionLogSummaryService;
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseQuestionSetting>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByCondition(query);
|
|
|
|
|
public PageQuery<TeacherOpenCourseQuestionSetting> queryByCondition(PageQuery query) {
|
|
|
|
|
PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByCondition(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseQuestionSetting>queryByConditionQuery(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByConditionQuery(query);
|
|
|
|
|
public PageQuery<TeacherOpenCourseQuestionSetting> queryByConditionQuery(PageQuery query) {
|
|
|
|
|
PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByConditionQuery(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteByList(List list){
|
|
|
|
|
public void deleteByList(List list) {
|
|
|
|
|
String ids = "";
|
|
|
|
|
ToolUtils.deleteNullList(list);
|
|
|
|
|
for(int i=0;null != list && i<list.size();i++){
|
|
|
|
|
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
|
|
|
|
for (int i = 0; null != list && i < list.size(); i++) {
|
|
|
|
|
ids += list.get(i).toString() + (i == list.size() - 1 ? "" : ",");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
if (StringUtils.isNotBlank(ids)) {
|
|
|
|
|
teacherOpenCourseQuestionSettingDao.deleteByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -113,7 +126,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
resourcesQuestionSnapshotService.deleteBySettingIds(settingIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void logicDeleteBySettingIds(String ids){
|
|
|
|
|
public void logicDeleteBySettingIds(String ids) {
|
|
|
|
|
try {
|
|
|
|
|
teacherOpenCourseQuestionSettingDao.logicDeleteBySettingIds(ids);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -121,7 +134,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String addAll(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery){
|
|
|
|
|
public String addAll(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> teacherOpenCourseQuestionSettingList = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
@ -129,11 +142,12 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
try {
|
|
|
|
|
teacherOpenCourseQuestionSettingList.add(JSONObject.parseObject(teacherOpenCourseQuestionSettingQuery.getTeacherOpenCourseQuestionSettingJsonStr(), TeacherOpenCourseQuestionSetting.class));
|
|
|
|
|
} catch (Exception e1) {}
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ToolUtils.deleteNullList(teacherOpenCourseQuestionSettingList);
|
|
|
|
|
if(null != teacherOpenCourseQuestionSettingList && teacherOpenCourseQuestionSettingList.size()>0){
|
|
|
|
|
for(int i=0;i<teacherOpenCourseQuestionSettingList.size();i++){
|
|
|
|
|
if (null != teacherOpenCourseQuestionSettingList && teacherOpenCourseQuestionSettingList.size() > 0) {
|
|
|
|
|
for (int i = 0; i < teacherOpenCourseQuestionSettingList.size(); i++) {
|
|
|
|
|
TeacherOpenCourseQuestionSetting teacherOpenCourseQuestionSetting = teacherOpenCourseQuestionSettingList.get(i);
|
|
|
|
|
teacherOpenCourseQuestionSetting.setUserId(teacherOpenCourseQuestionSettingQuery.getUserId());
|
|
|
|
|
teacherOpenCourseQuestionSetting.setOrgId(teacherOpenCourseQuestionSettingQuery.getOrgId());
|
|
|
|
@ -145,7 +159,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JsonResult add(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery){
|
|
|
|
|
public JsonResult add(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
TeacherOpenCourseQuestionSetting teacherOpenCourseQuestionSetting = teacherOpenCourseQuestionSettingQuery.pojo();
|
|
|
|
|
|
|
|
|
@ -161,7 +175,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
return jsonResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String edit(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery){
|
|
|
|
|
public String edit(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery) {
|
|
|
|
|
|
|
|
|
|
// 验证唯一
|
|
|
|
|
// verifyUniqueChapterExercise(teacherOpenCourseQuestionSettingQuery);
|
|
|
|
@ -176,7 +190,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
/**
|
|
|
|
|
* 根据开课ID + 章节名称
|
|
|
|
|
* 判断章节练习时候,的题目配置 唯一性
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 数据库设计稍微有点不严谨,暂时用名字来作为关联的条件,所以这里只能保证同一个开课ID下的名字是唯一的
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId
|
|
|
|
@ -184,14 +198,14 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void verifyUniqueName(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId,
|
|
|
|
|
@NotEmpty(message = "题目配置名称不能为空!") String teacherOpenCourseQuestionSettingName ) {
|
|
|
|
|
@NotEmpty(message = "题目配置名称不能为空!") String teacherOpenCourseQuestionSettingName) {
|
|
|
|
|
// 数据库设计稍微有点不严谨,暂时用名字来作为关联的条件,所以这里只能保证同一个开课ID下的名字是唯一的
|
|
|
|
|
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
|
|
|
|
|
settingQuery.setTeacherOpenCourseQuestionSettingName(teacherOpenCourseQuestionSettingName);
|
|
|
|
|
settingQuery.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> oneList = getValuesByQuery(settingQuery);
|
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(oneList)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(oneList)) {
|
|
|
|
|
throw new PlatformException("当前开课下的题目配置名称重复,请重新设置!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -199,7 +213,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
/**
|
|
|
|
|
* 根据开课ID + 章节名称
|
|
|
|
|
* 判断章节练习时候,的题目配置 唯一性
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 数据库设计稍微有点不严谨,暂时用名字来作为关联的条件,所以这里只能保证同一个开课ID下的名字是唯一的
|
|
|
|
|
*
|
|
|
|
|
* @param query
|
|
|
|
@ -221,35 +235,36 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
oneList.removeIf(s -> s.getTeacherOpenCourseQuestionSettingId().equals(query.getTeacherOpenCourseQuestionSettingId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(oneList)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(oneList)) {
|
|
|
|
|
throw new PlatformException("当前开课下的题目配置名称重复,请重新设置!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String updateGivenByIds(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery){
|
|
|
|
|
public String updateGivenByIds(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
if(StringUtils.isNotBlank(teacherOpenCourseQuestionSettingQuery.get_given())){
|
|
|
|
|
if (StringUtils.isNotBlank(teacherOpenCourseQuestionSettingQuery.get_given())) {
|
|
|
|
|
boolean flag = teacherOpenCourseQuestionSettingDao.updateGivenByIds(teacherOpenCourseQuestionSettingQuery) > 0;
|
|
|
|
|
if(!flag){
|
|
|
|
|
if (!flag) {
|
|
|
|
|
msg = "更新指定参数失败";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
msg = "指定参数为空";
|
|
|
|
|
}
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TeacherOpenCourseQuestionSetting> getValues (Object paras){
|
|
|
|
|
public List<TeacherOpenCourseQuestionSetting> getValues(Object paras) {
|
|
|
|
|
return sqlManager.select(SqlId.of("jlw.teacherOpenCourseQuestionSetting.getTeacherOpenCourseQuestionSettingValues"), TeacherOpenCourseQuestionSetting.class, paras);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TeacherOpenCourseQuestionSetting> getValuesByQuery (TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery){
|
|
|
|
|
public List<TeacherOpenCourseQuestionSetting> getValuesByQuery(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery) {
|
|
|
|
|
return teacherOpenCourseQuestionSettingDao.getValuesByQuery(teacherOpenCourseQuestionSettingQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置题目的分数和完成时间
|
|
|
|
|
*
|
|
|
|
|
* @param list
|
|
|
|
|
* @param student
|
|
|
|
|
*/
|
|
|
|
@ -319,23 +334,23 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TeacherOpenCourseQuestionSetting getInfo (Long teacherOpenCourseQuestionSettingId){
|
|
|
|
|
public TeacherOpenCourseQuestionSetting getInfo(Long teacherOpenCourseQuestionSettingId) {
|
|
|
|
|
TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery = new TeacherOpenCourseQuestionSettingQuery();
|
|
|
|
|
teacherOpenCourseQuestionSettingQuery.setTeacherOpenCourseQuestionSettingId(teacherOpenCourseQuestionSettingId);
|
|
|
|
|
teacherOpenCourseQuestionSettingQuery.setTeacherOpenCourseQuestionSettingStatusPlural("1");//需要根据实际情况来
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> list = teacherOpenCourseQuestionSettingDao.getValuesByQuery(teacherOpenCourseQuestionSettingQuery);
|
|
|
|
|
if(null != list && list.size()>0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
return list.get(0);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TeacherOpenCourseQuestionSetting getInfo (TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery){
|
|
|
|
|
public TeacherOpenCourseQuestionSetting getInfo(TeacherOpenCourseQuestionSettingQuery teacherOpenCourseQuestionSettingQuery) {
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> list = teacherOpenCourseQuestionSettingDao.getValuesByQuery(teacherOpenCourseQuestionSettingQuery);
|
|
|
|
|
if(null != list && list.size()>0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
return list.get(0);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -344,7 +359,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
* 根据开课的课程信息,添加题目配置和题目
|
|
|
|
|
* 这里不区分节点是什么类型的。
|
|
|
|
|
* 严格要求:
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 添加主表
|
|
|
|
|
* 任务一:添加主表
|
|
|
|
|
* 任务二:添加到题目配置主表;
|
|
|
|
@ -377,16 +392,17 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增加题目类型的数据 从开课端拉取
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 任务一;添加题目配置主表
|
|
|
|
|
* 任务二:添加题目快照表
|
|
|
|
|
*
|
|
|
|
|
* @param settingQuery
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void addSettingByOpenCourse(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair ) {
|
|
|
|
|
public void addSettingByOpenCourse(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair) {
|
|
|
|
|
|
|
|
|
|
// 编辑操作
|
|
|
|
|
if(ObjectUtil.isNotEmpty(settingQuery.getTeacherOpenCourseQuestionSettingId())) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(settingQuery.getTeacherOpenCourseQuestionSettingId())) {
|
|
|
|
|
String editSettingIds = settingQuery.getTeacherOpenCourseQuestionSettingId().toString();
|
|
|
|
|
deleteSettingAndSnapByIds(editSettingIds);
|
|
|
|
|
// 删除主键,用于下面的保存方法
|
|
|
|
@ -404,7 +420,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
Collection<QuestionSettingDTO> settingDTOList = null;
|
|
|
|
|
|
|
|
|
|
// 指定题目IDs的时候,指定题目。但是不传题目的类型,后台这里需要处理题目分类
|
|
|
|
|
if(ObjectUtil.isNotEmpty(resourcesQuestionIdPlural)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(resourcesQuestionIdPlural)) {
|
|
|
|
|
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
|
|
|
|
|
questionQuery.setQuestionStatus(1);
|
|
|
|
|
questionQuery.setTeacherOpenCourseMergeResourcesQuestionIdPlural(resourcesQuestionIdPlural);
|
|
|
|
@ -418,12 +434,14 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
// 设置分值
|
|
|
|
|
settingQuery.getQuestionSettingOptions().forEach(item -> {
|
|
|
|
|
QuestionSettingDTO settingDTO = map.get(item.getQuestionType());
|
|
|
|
|
if(ObjectUtil.isAllNotEmpty(settingDTO, item.getSingleScore())) {
|
|
|
|
|
if (ObjectUtil.isAllNotEmpty(settingDTO, item.getSingleScore())) {
|
|
|
|
|
settingDTO.setSingleScore(item.getSingleScore());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(map)) { settingDTOList = map.values(); }
|
|
|
|
|
if (ObjectUtil.isNotEmpty(map)) {
|
|
|
|
|
settingDTOList = map.values();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 随机抽取题目的方式
|
|
|
|
@ -445,7 +463,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
* @param settingQuery
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void addSettingBySystemCourse(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair ) {
|
|
|
|
|
public void addSettingBySystemCourse(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionSettingQuery settingQuery, Map<Long, Long> courseInfoIdPair) {
|
|
|
|
|
|
|
|
|
|
// 添加到作业主表中
|
|
|
|
|
add(settingQuery);
|
|
|
|
@ -459,13 +477,14 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据开课的课程信息,添加题目配置和题目
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 添加主表
|
|
|
|
|
* 任务一:添加主表
|
|
|
|
|
* 任务二:添加到题目配置主表;
|
|
|
|
|
* 任务二:也可以添加题目快照(非必选)
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表
|
|
|
|
|
*/
|
|
|
|
|
public void addSettingByOpenCourse(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId,
|
|
|
|
|
@Nullable Map<TeacherOpenCourseMergeCourseInfo, Collection<QuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
|
|
|
|
@ -498,25 +517,27 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
courseInfoIdWithQuestionSettingOptions.forEach((courseInfo, settingDtoList) -> {
|
|
|
|
|
// 判断,添加交给外部来控制
|
|
|
|
|
try {
|
|
|
|
|
if(eq.equals(func1.call(courseInfo))) {
|
|
|
|
|
if (eq.equals(func1.call(courseInfo))) {
|
|
|
|
|
settingQuery.setQuestionSettingOptions(new ArrayList<>(settingDtoList));
|
|
|
|
|
settingQuery.setTeacherOpenCourseQuestionSettingName(courseInfo.getCourseInfoName());
|
|
|
|
|
addSettingByOpenCourse(settingQuery, courseInfoIdPair);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) { }
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据开课的课程信息,添加题目配置和题目
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 添加主表
|
|
|
|
|
* 任务一:添加主表
|
|
|
|
|
* 任务二:添加到题目配置主表;
|
|
|
|
|
* 任务二:也可以添加题目快照(非必选)
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param courseInfoIdWithQuestionSettingOptions Key:课程名称,Value:题型和题目ID的组合列表
|
|
|
|
|
*/
|
|
|
|
|
public void addSettingBySystemCourse(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId,
|
|
|
|
|
@Nullable Map<CourseInfo, Collection<QuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions,
|
|
|
|
@ -548,12 +569,13 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
courseInfoIdWithQuestionSettingOptions.forEach((courseInfo, settingDtoList) -> {
|
|
|
|
|
// 判断,添加交给外部来控制
|
|
|
|
|
try {
|
|
|
|
|
if(eq.equals(func1.call(courseInfo))) {
|
|
|
|
|
if (eq.equals(func1.call(courseInfo))) {
|
|
|
|
|
settingQuery.setQuestionSettingOptions(new ArrayList<>(settingDtoList));
|
|
|
|
|
settingQuery.setTeacherOpenCourseQuestionSettingName(courseInfo.getCourseInfoName());
|
|
|
|
|
addSettingBySystemCourse(settingQuery, courseInfoIdPair);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) { }
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -574,11 +596,12 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
/**
|
|
|
|
|
* 可以删除子表数据的方法
|
|
|
|
|
* 根据名称
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId
|
|
|
|
|
* @param teacherOpenCourseQuestionSettingName (可为空,为空则不指定名称删除)
|
|
|
|
|
* @param teacherOpenCourseQuestionSettingName (可为空,为空则不指定名称删除)
|
|
|
|
|
*/
|
|
|
|
|
public void deleteWithSubDataByParams(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId,
|
|
|
|
|
@Nullable String teacherOpenCourseQuestionSettingName) {
|
|
|
|
|
@Nullable String teacherOpenCourseQuestionSettingName) {
|
|
|
|
|
// 条件
|
|
|
|
|
TeacherOpenCourseQuestionSetting condition = new TeacherOpenCourseQuestionSetting();
|
|
|
|
|
condition.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
@ -590,7 +613,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
List<Long> idList = settingList.stream()
|
|
|
|
|
.map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isAllNotEmpty(teacherOpenCourseId, teacherOpenCourseQuestionSettingName)) {
|
|
|
|
|
if (ObjectUtil.isAllNotEmpty(teacherOpenCourseId, teacherOpenCourseQuestionSettingName)) {
|
|
|
|
|
// 获取完ID以后,删除主表数据
|
|
|
|
|
sqlManager.lambdaQuery(TeacherOpenCourseQuestionSetting.class)
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
@ -615,9 +638,9 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
* 并保存到题目配置和题目快照表
|
|
|
|
|
* 从系统题库表拷贝!!!
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param courseInfos 当前课程下的子节点
|
|
|
|
|
* @param courseInfoIdPair 课程的新旧ID片段集合
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param courseInfos 当前课程下的子节点
|
|
|
|
|
* @param courseInfoIdPair 课程的新旧ID片段集合
|
|
|
|
|
*/
|
|
|
|
|
public void copySystemQuestionChapterTestQuestionToOpenCourse(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId,
|
|
|
|
|
Collection<CourseInfo> courseInfos, Map<Long, Long> courseInfoIdPair) {
|
|
|
|
@ -631,7 +654,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
List<ResourcesQuestion> questionList = resourcesQuestionService.getByCourseInfoIds(allCourseInfoIds);
|
|
|
|
|
|
|
|
|
|
// 有题目才继续执行
|
|
|
|
|
if(ObjectUtil.isNotEmpty(questionList)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(questionList)) {
|
|
|
|
|
Map<ResourcesQuestionTypeEnum, QuestionSettingDTO> map = resourcesQuestionService.buildSettingDtoListByNoDiffQuestionList(questionList);
|
|
|
|
|
Map<CourseInfo, Collection<QuestionSettingDTO>> courseInfoIdWithQuestionSettingOptions = new HashMap<>(1);
|
|
|
|
|
courseInfoIdWithQuestionSettingOptions.put(courseInfo, map.values());
|
|
|
|
@ -691,7 +714,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
add(questionSettingQuery);
|
|
|
|
|
|
|
|
|
|
// 如果有关联的题目,则添加到题目快照表
|
|
|
|
|
if(ObjectUtil.isNotEmpty(resourcesQuestionList)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(resourcesQuestionList)) {
|
|
|
|
|
// 构造章节练习的题目快照
|
|
|
|
|
List<ResourcesQuestionSnapshot> resourcesQuestionSnapshots = BeanUtil.copyToList(resourcesQuestionList, ResourcesQuestionSnapshot.class);
|
|
|
|
|
resourcesQuestionSnapshots.forEach(item -> item.setTeacherOpenCourseQuestionSettingId(questionSettingQuery.getTeacherOpenCourseQuestionSettingId()));
|
|
|
|
@ -713,6 +736,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据题目配置ID查询当前时间,是否可以参加进行题目测试
|
|
|
|
|
*
|
|
|
|
|
* @param questionSettingId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -728,6 +752,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
/**
|
|
|
|
|
* 根据题目配置ID查询当前时间,是否可以参加进行题目测试
|
|
|
|
|
* 抛出异常
|
|
|
|
|
*
|
|
|
|
|
* @param questionSettingId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -810,7 +835,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
resourcesQuestionSnapshots.forEach(value -> {
|
|
|
|
|
// 1单选 2多选进行打乱,其他的不变
|
|
|
|
|
if (value.getQuestionType() <= 2) {
|
|
|
|
|
shuffleQuestion(value, "questionStem","questionOption",
|
|
|
|
|
shuffleQuestion(value, "questionStem", "questionOption",
|
|
|
|
|
"questionAnswer", "questionType");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -903,15 +928,15 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
* 功能描述: <br>
|
|
|
|
|
* 错题练习,错题库根据试卷来
|
|
|
|
|
*
|
|
|
|
|
* @param questionSettingId 题目配置ID(试卷ID)
|
|
|
|
|
* @param tuckOrError 练习的类型
|
|
|
|
|
* @param student 学生
|
|
|
|
|
* @param questionSettingId 题目配置ID(试卷ID)
|
|
|
|
|
* @param tuckOrError 练习的类型
|
|
|
|
|
* @param student 学生
|
|
|
|
|
* @return {@link JsonResult}
|
|
|
|
|
* @Author: 87966
|
|
|
|
|
* @Date: 2022/12/1 9:27
|
|
|
|
|
*/
|
|
|
|
|
public List<TeacherOpenCourseQuestionLog> questionDetailTest(@NotNull(message = "题目配置ID不能为空!") Long questionSettingId,
|
|
|
|
|
@NotNull(message = "练习类型不能为空!") TuckOrErrorEnum tuckOrError, @NotNull(message = "该接口只能学生访问") Student student) {
|
|
|
|
|
@NotNull(message = "练习类型不能为空!") TuckOrErrorEnum tuckOrError, @NotNull(message = "该接口只能学生访问") Student student) {
|
|
|
|
|
final Long studentId = student.getStudentId();
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseQuestionLogQuery logQuery = new TeacherOpenCourseQuestionLogQuery();
|
|
|
|
@ -930,7 +955,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
// 错题库,本来是一张表管理的。
|
|
|
|
|
else if(ERROR_TEST.equals(tuckOrError)) {
|
|
|
|
|
else if (ERROR_TEST.equals(tuckOrError)) {
|
|
|
|
|
// logQuery.setIsErrorFavorite(true);
|
|
|
|
|
// TeacherOpenCourseQuestionLogWrongQuery wrongQuery = new TeacherOpenCourseQuestionLogWrongQuery();
|
|
|
|
|
// wrongQuery.setStudentId(studentId);
|
|
|
|
@ -963,8 +988,8 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
* 功能描述: <br>
|
|
|
|
|
* 分析汇总
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param questionSettingType 题目配置类型
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @param questionSettingType 题目配置类型
|
|
|
|
|
* @Author: 87966
|
|
|
|
|
* @Date: 2022/12/21 22:40
|
|
|
|
|
*/
|
|
|
|
@ -978,7 +1003,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> settingList = teacherOpenCourseQuestionSettingDao.getValuesByQueryNotWithPermission(settingQuery);
|
|
|
|
|
List<String> questionSettingIdList = CollectionUtil.emptyIfNull(settingList).stream()
|
|
|
|
|
.map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).map(Objects::toString).collect(Collectors.toList());
|
|
|
|
|
String questionSettingIds = join( ",", questionSettingIdList);
|
|
|
|
|
String questionSettingIds = join(",", questionSettingIdList);
|
|
|
|
|
|
|
|
|
|
OpenCourseQuestionSettingAnalysisAvgVO analysisAvgVO = new OpenCourseQuestionSettingAnalysisAvgVO();
|
|
|
|
|
|
|
|
|
@ -1003,6 +1028,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 填充选中的题目,和该课程下的总题目
|
|
|
|
|
*
|
|
|
|
|
* @param list
|
|
|
|
|
*/
|
|
|
|
|
public void fullQuestionSettingOptions(List<TeacherOpenCourseQuestionSetting> list) {
|
|
|
|
|