|
|
|
@ -1,15 +1,19 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.entity.vo.StudentHandsOnVO;
|
|
|
|
|
import com.ibeetl.jlw.web.query.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
@ -22,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -44,6 +49,15 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnSimulationTasksService teacherOpenCourseHandsOnSimulationTasksService;
|
|
|
|
|
@Autowired private HandsOnSimulationTasksService handsOnSimulationTasksService;
|
|
|
|
|
@Autowired private HandsOnAchievementService handsOnAchievementService;
|
|
|
|
|
@Autowired private StudentService studentService;
|
|
|
|
|
|
|
|
|
|
@Autowired private StudentHandsOnTaskVideoService videoService;
|
|
|
|
|
@Autowired private StudentHandsOnTaskPptService pptService;
|
|
|
|
|
@Autowired private StudentHandsOnTaskStepService stepService;
|
|
|
|
|
@Autowired private StudentHandsOnTaskTheoryService theoryService;
|
|
|
|
|
@Autowired private StudentHandsOnTaskReportService reportService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseHandsOn>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseHandsOnDao.queryByCondition(query);
|
|
|
|
@ -289,4 +303,107 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
public void deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) {
|
|
|
|
|
log.info("需要实现删除操作!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询课程实操
|
|
|
|
|
* @param teacherOpenCourseId
|
|
|
|
|
* @param coreUser
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public JsonResult<List<StudentHandsOnVO>> getHandsListByOpenCourseIdAndStudent(Long teacherOpenCourseId, CoreUser coreUser) {
|
|
|
|
|
Long userId = coreUser.getId();
|
|
|
|
|
Student student = studentService.getByUserId(userId);
|
|
|
|
|
Long studentId = student == null ? 0 :student.getStudentId();
|
|
|
|
|
TeacherOpenCourseHandsOnQuery handsOnQuery = new TeacherOpenCourseHandsOnQuery();
|
|
|
|
|
handsOnQuery.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
List<TeacherOpenCourseHandsOn> handsOnList = this.getValuesByQueryNotWithPermission(handsOnQuery);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = new ArrayList<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(handsOnList)) {
|
|
|
|
|
List<Long> handIds = handsOnList.stream().map(TeacherOpenCourseHandsOn::getHandsOnId).collect(Collectors.toList());
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
|
|
|
|
|
tasksQuery.setHandsOnIdPlural(CollectionUtil.join(handIds, ","));
|
|
|
|
|
tasksList = teacherOpenCourseHandsOnSimulationTasksService.getValuesByQueryNotWithPermission(tasksQuery);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
List<StudentHandsOnVO> studentHandsOnVOS = new ArrayList<>();
|
|
|
|
|
for (TeacherOpenCourseHandsOn handsOn : handsOnList) {
|
|
|
|
|
StudentHandsOnVO studentHandsOnVO = new StudentHandsOnVO();
|
|
|
|
|
Long handsOnId = handsOn.getHandsOnId();
|
|
|
|
|
studentHandsOnVO.setTeacherOpenCourseId(handsOn.getTeacherOpenCourseId());
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> tasks = tasksList.stream().filter(v -> v.getHandsOnId().equals(handsOnId)).collect(Collectors.toList());
|
|
|
|
|
studentHandsOnVO.setHandsOnId(handsOnId);
|
|
|
|
|
studentHandsOnVO.setHandsOnName(handsOn.getHandsOnName());
|
|
|
|
|
studentHandsOnVO.setHandsOnTaskNum(tasks.size());
|
|
|
|
|
BigDecimal bigDecimal = BigDecimal.ZERO;
|
|
|
|
|
if (CollectionUtils.isNotEmpty(tasks)) {
|
|
|
|
|
BigDecimal decimal = BigDecimal.ZERO;
|
|
|
|
|
for (TeacherOpenCourseHandsOnSimulationTasks task : tasks) {
|
|
|
|
|
Long taskId = task.getTaskId();
|
|
|
|
|
if ("1".equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskVideoQuery videoQuery = new StudentHandsOnTaskVideoQuery();
|
|
|
|
|
videoQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
videoQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentHandsOnTaskVideo> videoList = videoService.getValuesByQueryNotWithPermission(videoQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(videoList)) {
|
|
|
|
|
StudentHandsOnTaskVideo studentHandsOnTaskVideo = videoList.get(0);
|
|
|
|
|
BigDecimal videoScore = studentHandsOnTaskVideo.getVideoScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore);
|
|
|
|
|
decimal = bigDecimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if("2".equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskPptQuery pptQuery = new StudentHandsOnTaskPptQuery();
|
|
|
|
|
pptQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
pptQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentHandsOnTaskPpt> pptList = pptService.getValuesByQueryNotWithPermission(pptQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pptList)) {
|
|
|
|
|
StudentHandsOnTaskPpt studentHandsOnTaskPpt = pptList.get(0);
|
|
|
|
|
BigDecimal videoScore = studentHandsOnTaskPpt.getPptScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore);
|
|
|
|
|
decimal = bigDecimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if("3".equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskTheoryQuery theoryQuery = new StudentHandsOnTaskTheoryQuery();
|
|
|
|
|
theoryQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
theoryQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentHandsOnTaskTheory> taskTheoryList = theoryService.getValuesByQueryNotWithPermission(theoryQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(taskTheoryList)) {
|
|
|
|
|
StudentHandsOnTaskTheory taskTheory = taskTheoryList.get(0);
|
|
|
|
|
BigDecimal videoScore = taskTheory.getTheoryScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore);
|
|
|
|
|
decimal = bigDecimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if("4".equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskStepQuery stepQuery = new StudentHandsOnTaskStepQuery();
|
|
|
|
|
stepQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
stepQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentHandsOnTaskStep> stepList = stepService.getValuesByQueryNotWithPermission(stepQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(stepList)) {
|
|
|
|
|
StudentHandsOnTaskStep taskTheory = stepList.get(0);
|
|
|
|
|
BigDecimal videoScore = taskTheory.getTheoryScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore);
|
|
|
|
|
decimal = bigDecimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if("5".equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskReportQuery reportQuery = new StudentHandsOnTaskReportQuery();
|
|
|
|
|
reportQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
reportQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentHandsOnTaskReport> reportList =reportService.getValuesByQueryNotWithPermission(reportQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(reportList)) {
|
|
|
|
|
StudentHandsOnTaskReport taskTheory = reportList.get(0);
|
|
|
|
|
BigDecimal videoScore = taskTheory.getReportScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore);
|
|
|
|
|
decimal = bigDecimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int schedule = NumberUtil.div(decimal, BigDecimal.valueOf(tasksList.size()),2).multiply(BigDecimal.valueOf(100)).intValue();
|
|
|
|
|
studentHandsOnVO.setSchedule(schedule);
|
|
|
|
|
}else {
|
|
|
|
|
studentHandsOnVO.setSchedule(0);
|
|
|
|
|
}
|
|
|
|
|
studentHandsOnVO.setStudentScore(bigDecimal);
|
|
|
|
|
studentHandsOnVOS.add(studentHandsOnVO);
|
|
|
|
|
}
|
|
|
|
|
return JsonResult.success(studentHandsOnVOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|