1、我的课程-实操-理论

beetlsql3-dev
wgf 2 years ago
parent 058dd77c96
commit 0a84b3a406

@ -0,0 +1,21 @@
package com.ibeetl.jlw.entity.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ibeetl.jlw.entity.ResourcesQuestion;
import lombok.Data;
/**
*
*
* @Version 0.0.1
* @Author
* @Date 2022/12/7 21:42
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResourcesQuestionVO extends ResourcesQuestion {
private String myOptions;
private String taskId;
}

@ -19,6 +19,7 @@ import com.ibeetl.jlw.dao.HandsOnDao;
import com.ibeetl.jlw.dao.StudentHandsOnTaskTheoryDao;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.entity.dto.FillAndAnalysisScoreDTO;
import com.ibeetl.jlw.entity.vo.ResourcesQuestionVO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseMergeResourcesQuestionVO;
import com.ibeetl.jlw.enums.HandsOnTaskEnum;
import com.ibeetl.jlw.service.handson.HandsOnTaskQueue;
@ -966,154 +967,226 @@ public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHand
List<StudentHandsOnTaskTheory> taskTheoryList = new ArrayList<>();
//1 教师开课 2 系统授权
if (ObjectUtil.equals(courseType, 2)) {
HandsOnSimulationTasksQuery simulationTasksQuery = new HandsOnSimulationTasksQuery();
simulationTasksQuery.setTaskId(taskId);
List<HandsOnSimulationTasks> handsOnSimulationTasksList = handsOnSimulationTasksService.getValuesByQueryNotPermission(simulationTasksQuery);
if (CollectionUtils.isEmpty(handsOnSimulationTasksList)) {
return JsonResult.fail();
}
HandsOnSimulationTasks handsOnSimulationTasks = handsOnSimulationTasksList.get(0);
handsOnId = handsOnSimulationTasks.getHandsOnId();
String taskList = handsOnSimulationTasks.getTaskList();
ResourcesQuestionQuery questionQuery = new ResourcesQuestionQuery();
questionQuery.setResourcesQuestionIds(taskList);
List<ResourcesQuestion> resourcesQuestionList = resourcesQuestionService.getValuesByQueryNotWithPermission(questionQuery);
for (TeacherOpenCourseMergeResourcesQuestionVO resourcesQuestion : teacherOpenCourseMergeResourcesQuestionQueries) {
//根据实操id 获取课程id
List<HandsOn> handsOns = ObjectUtil.isEmpty(handsOnSimulationTasks.getHandsOnId()) ? new ArrayList<>() : handsOnDao.getByIds(handsOnSimulationTasks.getHandsOnId().toString());
StudentHandsOnTaskTheory taskTheory = new StudentHandsOnTaskTheory();
taskTheory.setCourseType(courseType);
taskTheory.setTeacherOpenCourseId(CollectionUtils.isEmpty(handsOns) ? null : handsOns.get(0).getCourseInfoId());
taskTheory.setHandsOnId(handsOnSimulationTasks.getHandsOnId());
taskTheory.setHandsOnTaskId(handsOnSimulationTasks.getTaskId());
taskTheory.setStem(resourcesQuestion.getQuestionStem());
Integer questionType = resourcesQuestion.getQuestionType();
taskTheory.setQuestionType(questionType);
String myOptions = ObjectUtil.defaultIfBlank(resourcesQuestion.getMyOptions(), "");
taskTheory.setMyOptions(myOptions);
ResourcesQuestion resourcesQuestionItem = resourcesQuestionList.stream().filter(v -> v.getResourcesQuestionId().equals(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId())).findFirst().orElse(new ResourcesQuestion());
String questionAnswer = ObjectUtil.defaultIfBlank(resourcesQuestionItem.getQuestionAnswer(), "");
taskTheory.setRightKey(questionAnswer);
if (questionType.equals(1)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getSingleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(2)) {
String[] split = Arrays.stream(questionAnswer.split(",")).sorted().toArray(String[]::new);
String[] split1 = Arrays.stream(myOptions.split(",")).sorted().toArray(String[]::new);
;
if (ArrayUtil.equals(split, split1)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getMultipleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(3)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getJudgeScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(4)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getFillScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(5)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getAnalysisScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
tasksQuery.setTaskId(taskId);
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = teacherOpenCourseHandsOnSimulationTasksService.getValuesByQueryNotWithPermission(tasksQuery);
if (CollectionUtils.isEmpty(tasksList)) {
return JsonResult.fail();
}
TeacherOpenCourseHandsOnSimulationTasks tasks = tasksList.get(0);
handsOnId = tasks.getHandsOnId();
String taskList = tasks.getTaskList();
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
questionQuery.setTeacherOpenCourseMergeResourcesQuestionIdPlural(taskList);
List<TeacherOpenCourseMergeResourcesQuestion> resourcesQuestions = teacherOpenCourseMergeResourcesQuestionService.getValuesByQueryNotWithPermission(questionQuery);
for (TeacherOpenCourseMergeResourcesQuestionVO resourcesQuestion : teacherOpenCourseMergeResourcesQuestionQueries) {
StudentHandsOnTaskTheory taskTheory = new StudentHandsOnTaskTheory();
taskTheory.setCourseType(courseType);
taskTheory.setTeacherOpenCourseId(tasks.getTeacherOpenCourseId());
taskTheory.setHandsOnId(tasks.getHandsOnId());
taskTheory.setHandsOnTaskId(tasks.getTaskId());
taskTheory.setStem(resourcesQuestion.getQuestionStem());
Integer questionType = resourcesQuestion.getQuestionType();
taskTheory.setQuestionType(questionType);
String myOptions = ObjectUtil.defaultIfBlank(resourcesQuestion.getMyOptions(), "");
taskTheory.setMyOptions(myOptions);
TeacherOpenCourseMergeResourcesQuestion teacherOpenCourseMergeResourcesQuestion = resourcesQuestions.stream().filter(v -> v.getTeacherOpenCourseMergeResourcesQuestionId().equals(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId())).findFirst().orElse(new TeacherOpenCourseMergeResourcesQuestion());
String questionAnswer = ObjectUtil.defaultIfBlank(teacherOpenCourseMergeResourcesQuestion.getQuestionAnswer(), "");
taskTheory.setRightKey(questionAnswer);
if (questionType.equals(1)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(tasks.getSingleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(2)) {
String[] split = Arrays.stream(questionAnswer.split(",")).sorted().toArray(String[]::new);
String[] split1 = Arrays.stream(myOptions.split(",")).sorted().toArray(String[]::new);
;
if (ArrayUtil.equals(split, split1)) {
taskTheory.setTheoryScore(tasks.getMultipleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(3)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(tasks.getJudgeScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(4)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(tasks.getFillScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(5)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(tasks.getAnalysisScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
taskTheory.setIsCourseCentre(2);
taskTheory.setCreateTime(new Date());
taskTheory.setStudentId(student.getStudentId());
taskTheory.setUserId(coreUser.getId());
taskTheory.setOrgId(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId());
taskTheoryList.add(taskTheory);
}
taskTheory.setIsCourseCentre(2);
taskTheory.setCreateTime(new Date());
taskTheory.setStudentId(student.getStudentId());
taskTheory.setUserId(coreUser.getId());
taskTheory.setOrgId(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId());
taskTheoryList.add(taskTheory);
}
} else {
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
tasksQuery.setTaskId(taskId);
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = teacherOpenCourseHandsOnSimulationTasksService.getValuesByQueryNotWithPermission(tasksQuery);
if (CollectionUtils.isEmpty(tasksList)) {
return JsonResult.fail();
//更新成绩
if (CollUtil.isNotEmpty(taskTheoryList)) {
BigDecimal totalScore = new BigDecimal(0);
for (StudentHandsOnTaskTheory studentHandsOnTaskTheory : taskTheoryList) {
BigDecimal theoryScore = studentHandsOnTaskTheory.getTheoryScore();
totalScore = totalScore.add(ObjectUtil.defaultIfNull(theoryScore, BigDecimal.ZERO));
}
TeacherOpenCourseHandsOnSimulationTasks tasks = tasksList.get(0);
handsOnId = tasks.getHandsOnId();
String taskList = tasks.getTaskList();
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
questionQuery.setTeacherOpenCourseMergeResourcesQuestionIdPlural(taskList);
List<TeacherOpenCourseMergeResourcesQuestion> resourcesQuestions = teacherOpenCourseMergeResourcesQuestionService.getValuesByQueryNotWithPermission(questionQuery);
for (TeacherOpenCourseMergeResourcesQuestionVO resourcesQuestion : teacherOpenCourseMergeResourcesQuestionQueries) {
StudentHandsOnTaskTheory taskTheory = new StudentHandsOnTaskTheory();
taskTheory.setCourseType(courseType);
taskTheory.setTeacherOpenCourseId(tasks.getTeacherOpenCourseId());
taskTheory.setHandsOnId(tasks.getHandsOnId());
taskTheory.setHandsOnTaskId(tasks.getTaskId());
taskTheory.setStem(resourcesQuestion.getQuestionStem());
Integer questionType = resourcesQuestion.getQuestionType();
taskTheory.setQuestionType(questionType);
String myOptions = ObjectUtil.defaultIfBlank(resourcesQuestion.getMyOptions(), "");
taskTheory.setMyOptions(myOptions);
TeacherOpenCourseMergeResourcesQuestion teacherOpenCourseMergeResourcesQuestion = resourcesQuestions.stream().filter(v -> v.getTeacherOpenCourseMergeResourcesQuestionId().equals(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId())).findFirst().orElse(new TeacherOpenCourseMergeResourcesQuestion());
String questionAnswer = ObjectUtil.defaultIfBlank(teacherOpenCourseMergeResourcesQuestion.getQuestionAnswer(), "");
taskTheory.setRightKey(questionAnswer);
if (questionType.equals(1)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(tasks.getSingleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(2)) {
String[] split = Arrays.stream(questionAnswer.split(",")).sorted().toArray(String[]::new);
String[] split1 = Arrays.stream(myOptions.split(",")).sorted().toArray(String[]::new);
;
if (ArrayUtil.equals(split, split1)) {
taskTheory.setTheoryScore(tasks.getMultipleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(3)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(tasks.getJudgeScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(4)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(tasks.getFillScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(5)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(tasks.getAnalysisScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
}
taskTheory.setIsCourseCentre(2);
taskTheory.setCreateTime(new Date());
taskTheory.setStudentId(student.getStudentId());
taskTheory.setUserId(coreUser.getId());
taskTheory.setOrgId(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId());
taskTheoryList.add(taskTheory);
HandsOnAchievement build = HandsOnAchievement.builder()
.handOnId(handsOnId)
.studentId(student.getStudentId())
.classId(student.getClassId())
.theoryScore(totalScore.toPlainString())
.courseType(courseType)
.isCourseCentre(2)
.orgId(student.getOrgId())
.userId(student.getUserId()).build();
handsOnAchievementService.setHandsOnAchievement(build, HandsOnTaskEnum.TASK_THEORY);
}
this.insertBatch(taskTheoryList);
questions.remove(s);
return JsonResult.success("提交成功");
}
/**
*
*
* @param
* @param coreUser
* @param i 1 2
* @param courseType 1 2
* @return
*/
public JsonResult<String> addSystemTheoreticalEvaluation(List<ResourcesQuestionVO> resourcesQuestionQueries, CoreUser coreUser, int i, int courseType) {
//查询登录用的学生id
if (!coreUser.isStudent()) {
return null;
}
if (CollectionUtils.isEmpty(resourcesQuestionQueries)) {
return JsonResult.fail();
}
Long taskId = Long.parseLong(resourcesQuestionQueries.get(0).getTaskId() + "");
Student student = studentService.getByUserId(coreUser.getId());
String s = student.getStudentId() + "&" + taskId;
//如果==2 说明是临时保存
if (i == 2) {
Map<String, Object> map = questions.get(s);
Record record = MapUtil.get(map, "record", Record.class);
Map<String, Object> map1 = new HashMap<>();
map1.put("resourcesQuestions", resourcesQuestionQueries);
if (record == null) {
record = new Record();
record.setStudentId(student.getStudentId());
record.setTaskId(taskId);
Date date = new Date();
record.setStartTime(date);
record.setEndTime(DateUtil.offsetHour(date, 3));
}
map1.put("record", record);
questions.put(s, map1);
return JsonResult.success("临时保存成功");
}
List<StudentHandsOnTaskTheory> theoryList = this.sqlManager.lambdaQuery(StudentHandsOnTaskTheory.class).andEq(StudentHandsOnTaskTheory::getHandsOnTaskId, taskId)
.andEq(StudentHandsOnTaskTheory::getCourseType, courseType)
.andEq(StudentHandsOnTaskTheory::getIsCourseCentre,2)
.andEq(StudentHandsOnTaskTheory::getStudentId, student.getStudentId()).select();
if (CollectionUtils.isNotEmpty(theoryList)) {
return JsonResult.fail("已提交,重复提交");
}
Long handsOnId = null;
List<StudentHandsOnTaskTheory> taskTheoryList = new ArrayList<>();
HandsOnSimulationTasksQuery simulationTasksQuery = new HandsOnSimulationTasksQuery();
simulationTasksQuery.setTaskId(taskId);
List<HandsOnSimulationTasks> handsOnSimulationTasksList = handsOnSimulationTasksService.getValuesByQueryNotPermission(simulationTasksQuery);
if (CollectionUtils.isEmpty(handsOnSimulationTasksList)) {
return JsonResult.fail();
}
HandsOnSimulationTasks handsOnSimulationTasks = handsOnSimulationTasksList.get(0);
handsOnId = handsOnSimulationTasks.getHandsOnId();
String taskList = handsOnSimulationTasks.getTaskList();
ResourcesQuestionQuery questionQuery = new ResourcesQuestionQuery();
questionQuery.setResourcesQuestionIds(taskList);
List<ResourcesQuestion> resourcesQuestionList = resourcesQuestionService.getValuesByQueryNotWithPermission(questionQuery);
for (ResourcesQuestionVO resourcesQuestion : resourcesQuestionQueries) {
//根据实操id 获取课程id
List<HandsOn> handsOns = ObjectUtil.isEmpty(handsOnSimulationTasks.getHandsOnId()) ? new ArrayList<>() : handsOnDao.getByIds(handsOnSimulationTasks.getHandsOnId().toString());
StudentHandsOnTaskTheory taskTheory = new StudentHandsOnTaskTheory();
taskTheory.setCourseType(courseType);
taskTheory.setTeacherOpenCourseId(CollectionUtils.isEmpty(handsOns) ? null : handsOns.get(0).getCourseInfoId());
taskTheory.setHandsOnId(handsOnSimulationTasks.getHandsOnId());
taskTheory.setHandsOnTaskId(handsOnSimulationTasks.getTaskId());
taskTheory.setStem(resourcesQuestion.getQuestionStem());
Integer questionType = resourcesQuestion.getQuestionType();
taskTheory.setQuestionType(questionType);
String myOptions = ObjectUtil.defaultIfBlank(resourcesQuestion.getMyOptions(), "");
taskTheory.setMyOptions(myOptions);
ResourcesQuestion resourcesQuestionItem = resourcesQuestionList.stream().filter(v -> v.getResourcesQuestionId().equals(resourcesQuestion.getResourcesQuestionId())).findFirst().orElse(new ResourcesQuestion());
String questionAnswer = ObjectUtil.defaultIfBlank(resourcesQuestionItem.getQuestionAnswer(), "");
taskTheory.setRightKey(questionAnswer);
if (questionType.equals(1)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getSingleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(2)) {
String[] split = Arrays.stream(questionAnswer.split(",")).sorted().toArray(String[]::new);
String[] split1 = Arrays.stream(myOptions.split(",")).sorted().toArray(String[]::new);
;
if (ArrayUtil.equals(split, split1)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getMultipleScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(3)) {
if (questionAnswer.contains(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getJudgeScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(4)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getFillScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
} else if (questionType.equals(5)) {
if (questionAnswer.equals(myOptions)) {
taskTheory.setTheoryScore(handsOnSimulationTasks.getAnalysisScore());
} else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
}
taskTheory.setIsCourseCentre(2);
taskTheory.setCreateTime(new Date());
taskTheory.setStudentId(student.getStudentId());
taskTheory.setUserId(coreUser.getId());
taskTheory.setOrgId(resourcesQuestion.getOrgId());
taskTheoryList.add(taskTheory);
}

@ -431,6 +431,11 @@ public class HandsOnController{
*/
@GetMapping(API + "/getCourseCentreHandsListCenterByOpenCourseId.do")
public JsonResult getCourseCentreHandsListCenterByOpenCourseId(Long courseInfoId,@SCoreUser CoreUser coreUser) {
return handsOnService.getCourseCentreHandsListByOpenCourseIdAndStudent(courseInfoId,coreUser);
if (coreUser.isTeacher()){
List<StudentHandsOnVO> handsListCenterByOpenCourseId = handsOnService.getHandsListCenterByOpenCourseId(courseInfoId);
return JsonResult.success(handsListCenterByOpenCourseId);
}else {
return handsOnService.getCourseCentreHandsListByOpenCourseIdAndStudent(courseInfoId,coreUser);
}
}
}

@ -20,6 +20,7 @@ import com.ibeetl.jlw.entity.ResourcesQuestion;
import com.ibeetl.jlw.entity.StudentHandsOnTaskTheory;
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesQuestion;
import com.ibeetl.jlw.entity.dto.FillAndAnalysisScoreDTO;
import com.ibeetl.jlw.entity.vo.ResourcesQuestionVO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseMergeResourcesQuestionVO;
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
import com.ibeetl.jlw.service.StudentHandsOnTaskTheoryService;
@ -715,9 +716,14 @@ public class StudentHandsOnTaskTheoryController {
if (ObjectUtil.isEmpty(courseType)){
return JsonResult.failMessage("缺少课程类型" );
}
List<TeacherOpenCourseMergeResourcesQuestionVO> teacherOpenCourseMergeResourcesQuestionVOS = JSONObject.parseArray(teacherOpenCourseMergeResourcesQuestionQuery,TeacherOpenCourseMergeResourcesQuestionVO.class);
if (ObjectUtil.equals(courseType,2)){
List<ResourcesQuestionVO> teacherOpenCourseMergeResourcesQuestionVOS = JSONObject.parseArray(teacherOpenCourseMergeResourcesQuestionQuery,ResourcesQuestionVO.class);
return studentHandsOnTaskTheoryService.addSystemTheoreticalEvaluation(teacherOpenCourseMergeResourcesQuestionVOS, coreUser, temporarily,courseType);
}else {
List<TeacherOpenCourseMergeResourcesQuestionVO> teacherOpenCourseMergeResourcesQuestionVOS = JSONObject.parseArray(teacherOpenCourseMergeResourcesQuestionQuery,TeacherOpenCourseMergeResourcesQuestionVO.class);
return studentHandsOnTaskTheoryService.addTheoreticalEvaluation(teacherOpenCourseMergeResourcesQuestionVOS, coreUser, temporarily,courseType);
return studentHandsOnTaskTheoryService.addTheoreticalEvaluation(teacherOpenCourseMergeResourcesQuestionVOS, coreUser, temporarily,courseType);
}
}
}

Loading…
Cancel
Save