收藏题目

beetlsql3-dev
Mlxa0324
parent 00e195318f
commit 0670c9fdf1

@ -51,6 +51,7 @@ import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.FINALLY_SUBMIT;
import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.PRE_SUBMIT;
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.joining;
/**
* Service
@ -593,7 +594,7 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
* @param teacherOpenCourseQuestionLogIds
* @param isTuck
*/
public void tuck(@NotEmpty(message = "题目日志ID不能为空") String teacherOpenCourseQuestionLogIds, final boolean isTuck) {
public void tuckByLogIds(@NotEmpty(message = "题目日志ID不能为空") String teacherOpenCourseQuestionLogIds, final boolean isTuck) {
Function<String, TeacherOpenCourseQuestionLog> stringTeacherOpenCourseQuestionLogFunction = logId -> {
TeacherOpenCourseQuestionLog questionLog = new TeacherOpenCourseQuestionLog();
@ -607,6 +608,35 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
updateBatchTemplate(logSet);
}
/**
* ID + ID
*
* @param questionSettingId ID
* @param questionSnapshotIds IDs
* @param isTuck true false
* @param student
*/
public void tuck(@NotNull(message = "题目配置ID不能为空") Long questionSettingId,
@NotBlank(message = "题目快照IDs不能为空") String questionSnapshotIds, boolean isTuck,
@NotNull(message = "学生信息不能为空!") Student student) {
TeacherOpenCourseQuestionLogQuery logQuery = new TeacherOpenCourseQuestionLogQuery();
logQuery.setTeacherOpenCourseQuestionSettingId(questionSettingId);
logQuery.setResourcesQuestionSnapshotIdPlural(questionSnapshotIds);
logQuery.setTeacherOpenCourseQuestionLogStatus(1);
logQuery.setStudentId(student.getStudentId());
List<TeacherOpenCourseQuestionLog> list = getValuesByQueryNotWithPermission(logQuery);
if (ObjectUtil.isEmpty(list)) {
throw new PlatformException("收藏失败,未查询到要收藏的题目");
}
String logIds = list.stream()
.map(o -> o.getTeacherOpenCourseQuestionLogId().toString()).collect(joining(","));
// 根据做题的日志ID收藏题目
tuckByLogIds(logIds, isTuck);
}
/**
*
* @param teacherOpenCourseQuestionLogIds
@ -660,4 +690,5 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
return false;
}
}

@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
@ -202,13 +203,30 @@ public class TeacherOpenCourseQuestionLogController {
/**
* /
* @param teacherOpenCourseQuestionLogIds ID
* @param isTuck true, false
* @param questionSettingId ID
* @param questionSnapshotIds IDs
* @param isTuck true, false
* @return
*/
@PostMapping(API + "/tuck.do")
public JsonResult tuck(String questionSettingId, String questionSnapshotIds, String teacherOpenCourseQuestionLogIds, boolean isTuck) {
teacherOpenCourseQuestionLogService.tuck(teacherOpenCourseQuestionLogIds, isTuck);
public JsonResult tuck(Long questionSettingId, String questionSnapshotIds, boolean isTuck) {
Student student = getStudent();
Assert.notNull(student, "该接口只能学生操作!");
teacherOpenCourseQuestionLogService.tuck(questionSettingId, questionSnapshotIds, isTuck, student);
return JsonResult.success();
}
/**
* /
* @param teacherOpenCourseQuestionLogIds IDs
* @param isTuck true, false
* @return
*/
@PostMapping(API + "/tuckByLogIds.do")
public JsonResult tuck(@NotBlank(message = "题目日志IDs不能为空") String teacherOpenCourseQuestionLogIds, boolean isTuck) {
Student student = getStudent();
Assert.notNull(student, "该接口只能学生操作!");
teacherOpenCourseQuestionLogService.tuckByLogIds(teacherOpenCourseQuestionLogIds, isTuck);
return JsonResult.success();
}
@ -219,7 +237,7 @@ public class TeacherOpenCourseQuestionLogController {
@GetMapping(API + "/tuckList.do")
public JsonResult tuckList(PageParam pageParam) {
Student student = getStudent();
Assert.notNull(student, "非学生身份,无法获取题目分析!");
Assert.notNull(student, "非学生身份,无法获取收藏的题目!");
PageQuery query = new PageQuery(pageParam.getPage().longValue(), pageParam.getLimit().longValue());
query.setPara("studentId", student.getStudentId());
query.setPara("teacherOpenCourseQuestionLogStatus", 1);

Loading…
Cancel
Save