|
|
|
@ -2,7 +2,9 @@ package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
@ -10,9 +12,12 @@ 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.StudentHandsOnTaskStepDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
import com.ibeetl.jlw.entity.StudentHandsOnTaskStep;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnSimulationTasksDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.web.query.StudentHandsOnTaskStepQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksAssessmentQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery;
|
|
|
|
|
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,7 +48,9 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
|
|
|
|
public class StudentHandsOnTaskStepService extends CoreBaseService<StudentHandsOnTaskStep>{
|
|
|
|
|
|
|
|
|
|
@Autowired private StudentHandsOnTaskStepDao studentHandsOnTaskStepDao;
|
|
|
|
|
|
|
|
|
|
@Autowired private StudentService studentService;
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnSimulationTasksDao tasksService;
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnSimulationTasksAssessmentService assessmentService;
|
|
|
|
|
public PageQuery<StudentHandsOnTaskStep>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = studentHandsOnTaskStepDao.queryByCondition(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
@ -208,10 +215,6 @@ public class StudentHandsOnTaskStepService extends CoreBaseService<StudentHandsO
|
|
|
|
|
"课程实操",
|
|
|
|
|
"课程实操任务",
|
|
|
|
|
"题干",
|
|
|
|
|
"题型",
|
|
|
|
|
"我的选项",
|
|
|
|
|
"正确答案",
|
|
|
|
|
"状态",
|
|
|
|
|
"得分",
|
|
|
|
|
"创建时间",
|
|
|
|
|
"教师",
|
|
|
|
@ -320,10 +323,6 @@ public class StudentHandsOnTaskStepService extends CoreBaseService<StudentHandsO
|
|
|
|
|
studentHandsOnTaskStep.setHandsOnId(Long.parseLong(handsOnId));
|
|
|
|
|
studentHandsOnTaskStep.setHandsOnTaskId(Long.parseLong(handsOnTaskId));
|
|
|
|
|
studentHandsOnTaskStep.setStem(stem);
|
|
|
|
|
studentHandsOnTaskStep.setQuestionType(new BigDecimal(questionType));
|
|
|
|
|
studentHandsOnTaskStep.setMyOptions(new BigDecimal(myOptions));
|
|
|
|
|
studentHandsOnTaskStep.setRightKey(new BigDecimal(rightKey));
|
|
|
|
|
studentHandsOnTaskStep.setTheoryStatus(new BigDecimal(theoryStatus));
|
|
|
|
|
studentHandsOnTaskStep.setTheoryScore(new BigDecimal(theoryScore));
|
|
|
|
|
studentHandsOnTaskStep.setCreateTime(TimeTool.getTime(createTime));
|
|
|
|
|
studentHandsOnTaskStep.setOrgId(coreUser.getOrgId());
|
|
|
|
@ -350,4 +349,51 @@ public class StudentHandsOnTaskStepService extends CoreBaseService<StudentHandsO
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JsonResult<StudentHandsOnTaskStep> getHandsOnTaskkStepByTaskId(Long taskId, CoreUser coreUser) {
|
|
|
|
|
//查询登录用的学生id
|
|
|
|
|
if (!coreUser.isStudent()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Student student = studentService.getByUserId(coreUser.getId());
|
|
|
|
|
StudentHandsOnTaskStep studentHandsOnTaskStep = this.sqlManager.lambdaQuery(StudentHandsOnTaskStep.class).andEq(StudentHandsOnTaskStep::getHandsOnTaskId, taskId)
|
|
|
|
|
.andEq(StudentHandsOnTaskStep::getStudentId, student.getStudentId()).singleSimple();
|
|
|
|
|
if (studentHandsOnTaskStep == null) {
|
|
|
|
|
studentHandsOnTaskStep = new StudentHandsOnTaskStep();
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksAssessmentQuery assessmentQuery = new TeacherOpenCourseHandsOnSimulationTasksAssessmentQuery();
|
|
|
|
|
assessmentQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasksAssessment> assessmentList = assessmentService.getValuesByQueryNotWithPermission(assessmentQuery);
|
|
|
|
|
if (CollectionUtils.isEmpty(assessmentList)) {
|
|
|
|
|
return JsonResult.fail();
|
|
|
|
|
}
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
|
|
|
|
|
tasksQuery.setTaskId(taskId);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> tasks = tasksService.getValuesByQueryNotWithPermission(tasksQuery);
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = tasks.get(0);
|
|
|
|
|
studentHandsOnTaskStep.setHandsOnTaskId(teacherOpenCourseHandsOnSimulationTasks.getTaskId());
|
|
|
|
|
studentHandsOnTaskStep.setStudentId(student.getStudentId());
|
|
|
|
|
studentHandsOnTaskStep.setHandsOnId(teacherOpenCourseHandsOnSimulationTasks.getHandsOnId());
|
|
|
|
|
studentHandsOnTaskStep.setTeacherOpenCourseId(teacherOpenCourseHandsOnSimulationTasks.getTeacherOpenCourseId());
|
|
|
|
|
studentHandsOnTaskStep.setCreateTime(new Date());
|
|
|
|
|
studentHandsOnTaskStep.setTheoryScore(BigDecimal.ZERO);
|
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
|
for (TeacherOpenCourseHandsOnSimulationTasksAssessment assessment : assessmentList) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("question", assessment.getHandsOnSimulationTasksAssessmentQuestion());
|
|
|
|
|
map.put("rightAnswer", assessment.getHandsOnSimulationTasksAssessmentAnswer());
|
|
|
|
|
map.put("studentAnswer", "");
|
|
|
|
|
map.put("score", assessment.getHandsOnSimulationTasksAssessmentScore());
|
|
|
|
|
list.add(map);
|
|
|
|
|
}
|
|
|
|
|
studentHandsOnTaskStep.setStem(JSONArray.toJSONString(list));
|
|
|
|
|
studentHandsOnTaskStep.setStems(list);
|
|
|
|
|
this.insert(studentHandsOnTaskStep);
|
|
|
|
|
}else {
|
|
|
|
|
String videoFile = studentHandsOnTaskStep.getStem();
|
|
|
|
|
if (StringUtils.isNotEmpty(videoFile)) {
|
|
|
|
|
studentHandsOnTaskStep.setStems(JSONArray.parseObject(videoFile, new TypeReference<List<Map<String,Object>>>(){}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JsonResult.success(studentHandsOnTaskStep);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|