|
|
|
@ -10,9 +10,13 @@ import com.ibeetl.admin.core.util.TimeTool;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.StudentHandsOnTaskTheoryDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
import com.ibeetl.jlw.entity.StudentHandsOnTaskTheory;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnSimulationTasksDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesQuestionDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.web.query.StudentHandsOnTaskTheoryQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesQuestionQuery;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
@ -43,6 +47,9 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
|
|
|
|
public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHandsOnTaskTheory>{
|
|
|
|
|
|
|
|
|
|
@Autowired private StudentHandsOnTaskTheoryDao studentHandsOnTaskTheoryDao;
|
|
|
|
|
@Autowired private StudentService studentService;
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnSimulationTasksDao tasksService;
|
|
|
|
|
@Autowired private TeacherOpenCourseMergeResourcesQuestionService questionService;
|
|
|
|
|
|
|
|
|
|
public PageQuery<StudentHandsOnTaskTheory>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = studentHandsOnTaskTheoryDao.queryByCondition(query);
|
|
|
|
@ -320,10 +327,10 @@ public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHand
|
|
|
|
|
studentHandsOnTaskTheory.setHandsOnId(Long.parseLong(handsOnId));
|
|
|
|
|
studentHandsOnTaskTheory.setHandsOnTaskId(Long.parseLong(handsOnTaskId));
|
|
|
|
|
studentHandsOnTaskTheory.setStem(stem);
|
|
|
|
|
studentHandsOnTaskTheory.setQuestionType(new BigDecimal(questionType));
|
|
|
|
|
studentHandsOnTaskTheory.setMyOptions(new BigDecimal(myOptions));
|
|
|
|
|
studentHandsOnTaskTheory.setRightKey(new BigDecimal(rightKey));
|
|
|
|
|
studentHandsOnTaskTheory.setTheoryStatus(new BigDecimal(theoryStatus));
|
|
|
|
|
// studentHandsOnTaskTheory.setQuestionType(questionType);
|
|
|
|
|
studentHandsOnTaskTheory.setMyOptions(myOptions);
|
|
|
|
|
studentHandsOnTaskTheory.setRightKey(rightKey);
|
|
|
|
|
// studentHandsOnTaskTheory.setTheoryStatus(theoryStatus);
|
|
|
|
|
studentHandsOnTaskTheory.setTheoryScore(new BigDecimal(theoryScore));
|
|
|
|
|
studentHandsOnTaskTheory.setCreateTime(TimeTool.getTime(createTime));
|
|
|
|
|
studentHandsOnTaskTheory.setOrgId(coreUser.getOrgId());
|
|
|
|
@ -350,4 +357,99 @@ public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHand
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JsonResult<List<TeacherOpenCourseMergeResourcesQuestion>> getHandsOnTaskkTheoryByTaskId(Long taskId, CoreUser coreUser) {
|
|
|
|
|
//查询登录用的学生id
|
|
|
|
|
if (!coreUser.isStudent()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Student student = studentService.getByUserId(coreUser.getId());
|
|
|
|
|
List<StudentHandsOnTaskTheory> theoryList = this.sqlManager.lambdaQuery(StudentHandsOnTaskTheory.class).andEq(StudentHandsOnTaskTheory::getHandsOnTaskId, taskId)
|
|
|
|
|
.andEq(StudentHandsOnTaskTheory::getStudentId, student.getStudentId()).select();
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
|
|
|
|
|
tasksQuery.setTaskId(taskId);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = tasksService.getValuesByQueryNotWithPermission(tasksQuery);
|
|
|
|
|
if (CollectionUtils.isEmpty(tasksList)) {
|
|
|
|
|
return JsonResult.fail();
|
|
|
|
|
}
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasks tasks = tasksList.get(0);
|
|
|
|
|
String taskList = tasks.getTaskList();
|
|
|
|
|
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
|
|
|
|
|
questionQuery.setTeacherOpenCourseMergeResourcesQuestionIdPlural(taskList);
|
|
|
|
|
List<TeacherOpenCourseMergeResourcesQuestion> resourcesQuestions = questionService.getValuesByQueryNotWithPermission(questionQuery);
|
|
|
|
|
if (CollectionUtils.isEmpty(resourcesQuestions)) {
|
|
|
|
|
return JsonResult.success(resourcesQuestions);
|
|
|
|
|
}
|
|
|
|
|
for (TeacherOpenCourseMergeResourcesQuestion resourcesQuestion : resourcesQuestions) {
|
|
|
|
|
StudentHandsOnTaskTheory taskTheory = theoryList.stream().filter(v -> v.getOrgId().equals(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId()))
|
|
|
|
|
.filter(v -> v.getStudentId().equals(student.getStudentId())).filter(v -> v.getHandsOnTaskId().equals(taskId)).findFirst().orElse(null);
|
|
|
|
|
if (taskTheory == null) {
|
|
|
|
|
resourcesQuestion.set("myOptions", "");
|
|
|
|
|
resourcesQuestion.set("taskId", taskId);
|
|
|
|
|
}else {
|
|
|
|
|
resourcesQuestion.set("myOptions", taskTheory.getMyOptions());
|
|
|
|
|
resourcesQuestion.set("taskId", taskId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JsonResult.success(resourcesQuestions);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JsonResult<String> editDo(List<TeacherOpenCourseMergeResourcesQuestion> teacherOpenCourseMergeResourcesQuestionQueries, CoreUser coreUser) {
|
|
|
|
|
//查询登录用的学生id
|
|
|
|
|
if (!coreUser.isStudent()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtils.isEmpty(teacherOpenCourseMergeResourcesQuestionQueries)) {
|
|
|
|
|
return JsonResult.fail();
|
|
|
|
|
}
|
|
|
|
|
Long taskId = Long.parseLong(teacherOpenCourseMergeResourcesQuestionQueries.get(0).get("taskId")+"");
|
|
|
|
|
Student student = studentService.getByUserId(coreUser.getId());
|
|
|
|
|
List<StudentHandsOnTaskTheory> theoryList = this.sqlManager.lambdaQuery(StudentHandsOnTaskTheory.class).andEq(StudentHandsOnTaskTheory::getHandsOnTaskId, taskId)
|
|
|
|
|
.andEq(StudentHandsOnTaskTheory::getStudentId, student.getStudentId()).select();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(theoryList)) {
|
|
|
|
|
return JsonResult.fail("已提交,重复提交");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
|
|
|
|
|
tasksQuery.setTaskId(taskId);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = tasksService.getValuesByQueryNotWithPermission(tasksQuery);
|
|
|
|
|
if (CollectionUtils.isEmpty(tasksList)) {
|
|
|
|
|
return JsonResult.fail();
|
|
|
|
|
}
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasks tasks = tasksList.get(0);
|
|
|
|
|
List<StudentHandsOnTaskTheory> taskTheoryList = new ArrayList<>();
|
|
|
|
|
for (TeacherOpenCourseMergeResourcesQuestion resourcesQuestion : teacherOpenCourseMergeResourcesQuestionQueries) {
|
|
|
|
|
StudentHandsOnTaskTheory taskTheory = new StudentHandsOnTaskTheory();
|
|
|
|
|
taskTheory.setTeacherOpenCourseId(tasks.getTeacherOpenCourseId());
|
|
|
|
|
taskTheory.setHandsOnId(tasks.getHandsOnId());
|
|
|
|
|
taskTheory.setHandsOnTaskId(tasks.getTaskId());
|
|
|
|
|
taskTheory.setStem(resourcesQuestion.getQuestionStem());
|
|
|
|
|
Integer questionType = resourcesQuestion.getQuestionType();
|
|
|
|
|
taskTheory.setQuestionType(questionType);
|
|
|
|
|
taskTheory.setMyOptions(resourcesQuestion.get("myOptions")+"");
|
|
|
|
|
taskTheory.setRightKey(resourcesQuestion.getQuestionAnswer());
|
|
|
|
|
if (resourcesQuestion.getQuestionAnswer().equals(resourcesQuestion.get("myOptions")+"")) {
|
|
|
|
|
if (questionType.equals(1)) {
|
|
|
|
|
taskTheory.setTheoryScore(tasks.getSingleScore());
|
|
|
|
|
}else if (questionType.equals(2)){
|
|
|
|
|
taskTheory.setTheoryScore(tasks.getMultipleScore());
|
|
|
|
|
}else if (questionType.equals(3)){
|
|
|
|
|
taskTheory.setTheoryScore(tasks.getJudgeScore());
|
|
|
|
|
}else if (questionType.equals(4)){
|
|
|
|
|
taskTheory.setTheoryScore(tasks.getFillScore());
|
|
|
|
|
}else if (questionType.equals(5)){
|
|
|
|
|
taskTheory.setTheoryScore(tasks.getAnalysisScore());
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
taskTheory.setTheoryScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
taskTheory.setCreateTime(new Date());
|
|
|
|
|
taskTheory.setStudentId(student.getStudentId());
|
|
|
|
|
taskTheory.setUserId(coreUser.getId());
|
|
|
|
|
taskTheory.setOrgId(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId());
|
|
|
|
|
taskTheoryList.add(taskTheory);
|
|
|
|
|
}
|
|
|
|
|
this.insertBatch(taskTheoryList);
|
|
|
|
|
return JsonResult.success("提交成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|