|
|
|
@ -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,11 @@ 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.StudentHandsOnTaskVideoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
import com.ibeetl.jlw.entity.StudentHandsOnTaskVideo;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnSimulationTasksDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.web.query.StudentHandsOnTaskVideoQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksFileQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery;
|
|
|
|
|
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 StudentHandsOnTaskVideoService extends CoreBaseService<StudentHandsOnTaskVideo>{
|
|
|
|
|
|
|
|
|
|
@Autowired private StudentHandsOnTaskVideoDao studentHandsOnTaskVideoDao;
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnSimulationTasksFileService fileService;
|
|
|
|
|
@Autowired private StudentService studentService;
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnSimulationTasksDao tasksService;
|
|
|
|
|
|
|
|
|
|
public PageQuery<StudentHandsOnTaskVideo>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = studentHandsOnTaskVideoDao.queryByCondition(query);
|
|
|
|
@ -322,4 +329,45 @@ public class StudentHandsOnTaskVideoService extends CoreBaseService<StudentHands
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JsonResult<StudentHandsOnTaskVideo> getHandsOnTaskkVideoByTaskId(Long taskId, CoreUser coreUser) {
|
|
|
|
|
//查询登录用的学生id
|
|
|
|
|
if (!coreUser.isStudent()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Student student = studentService.getByUserId(coreUser.getId());
|
|
|
|
|
StudentHandsOnTaskVideo studentHandsOnTaskVideo = this.sqlManager.lambdaQuery(StudentHandsOnTaskVideo.class).andEq(StudentHandsOnTaskVideo::getHandsOnTaskId, taskId)
|
|
|
|
|
.andEq(StudentHandsOnTaskVideo::getStudentId, student.getStudentId()).singleSimple();
|
|
|
|
|
if (studentHandsOnTaskVideo == null) {
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksFileQuery fileQuery = new TeacherOpenCourseHandsOnSimulationTasksFileQuery();
|
|
|
|
|
fileQuery.setTaskId(taskId);
|
|
|
|
|
//查询视频
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasksFile> videoFile = fileService.getValuesByQueryNotWithPermission(fileQuery);
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
|
|
|
|
|
tasksQuery.setTaskId(taskId);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> tasks = tasksService.getValuesByQueryNotWithPermission(tasksQuery);
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = tasks.get(0);
|
|
|
|
|
studentHandsOnTaskVideo.setHandsOnTaskId(teacherOpenCourseHandsOnSimulationTasks.getTaskId());
|
|
|
|
|
studentHandsOnTaskVideo.setStudentId(student.getStudentId());
|
|
|
|
|
studentHandsOnTaskVideo.setHandsOnId(teacherOpenCourseHandsOnSimulationTasks.getHandsOnId());
|
|
|
|
|
studentHandsOnTaskVideo.setTeacherOpenCourseId(teacherOpenCourseHandsOnSimulationTasks.getTeacherOpenCourseId());
|
|
|
|
|
studentHandsOnTaskVideo.setCreateTime(new Date());
|
|
|
|
|
studentHandsOnTaskVideo.setVideoScore(BigDecimal.ZERO);
|
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
|
for (TeacherOpenCourseHandsOnSimulationTasksFile file : videoFile) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("fileName", file.getFileName());
|
|
|
|
|
map.put("schedule", 0);
|
|
|
|
|
map.put("fileUrl", file.getFileUrl());
|
|
|
|
|
list.add(map);
|
|
|
|
|
}
|
|
|
|
|
studentHandsOnTaskVideo.setVideoFile(JSONArray.toJSONString(list));
|
|
|
|
|
studentHandsOnTaskVideo.setVideoFiles(list);
|
|
|
|
|
}else {
|
|
|
|
|
String videoFile = studentHandsOnTaskVideo.getVideoFile();
|
|
|
|
|
if (StringUtils.isNotEmpty(videoFile)) {
|
|
|
|
|
studentHandsOnTaskVideo.setVideoFiles(JSONArray.parseObject(videoFile, new TypeReference<List<Map<String,Object>>>(){}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return JsonResult.success(studentHandsOnTaskVideo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|