|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
@ -11,12 +12,10 @@ 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.HandsOnDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.HandsOn;
|
|
|
|
|
import com.ibeetl.jlw.entity.HandsOnSimulationTasks;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.entity.vo.StudentHandsOnVO;
|
|
|
|
|
import com.ibeetl.jlw.web.query.HandsOnQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.HandsOnSimulationTasksQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnQuery;
|
|
|
|
|
import com.ibeetl.jlw.enums.HandsOnTaskEnum;
|
|
|
|
|
import com.ibeetl.jlw.web.query.*;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
@ -26,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -46,6 +46,25 @@ public class HandsOnService extends CoreBaseService<HandsOn>{
|
|
|
|
|
@Autowired private HandsOnDao handsOnDao;
|
|
|
|
|
@Autowired private HandsOnSimulationTasksService handsOnSimulationTasksService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentService studentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskVideoService videoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskPptService pptService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskTheoryService theoryService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskStepService stepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskReportService reportService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<HandsOn>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = handsOnDao.queryByCondition(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
@ -263,4 +282,123 @@ public class HandsOnService extends CoreBaseService<HandsOn>{
|
|
|
|
|
return studentHandsOnVOS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询课程课程中心实操 FIXME 这里应该是分页的,但是没做,赶不及,已通知前端改为不分页
|
|
|
|
|
*
|
|
|
|
|
* @param courseInfo
|
|
|
|
|
* @param coreUser
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public JsonResult<List<StudentHandsOnVO>> getCourseCentreHandsListByOpenCourseIdAndStudent(Long courseInfo, CoreUser coreUser) {
|
|
|
|
|
Long userId = coreUser.getId();
|
|
|
|
|
Student student = studentService.getByUserId(userId);
|
|
|
|
|
if (student == null) {
|
|
|
|
|
return JsonResult.fail();
|
|
|
|
|
}
|
|
|
|
|
Long studentId = student.getStudentId();
|
|
|
|
|
HandsOnQuery handsOnQuery = new HandsOnQuery();
|
|
|
|
|
handsOnQuery.setCourseInfoId(courseInfo);
|
|
|
|
|
handsOnQuery.setHandsOnStatus(1);
|
|
|
|
|
List<HandsOn> handsOnList = this.getValuesByQueryNotPermission(handsOnQuery);
|
|
|
|
|
|
|
|
|
|
List<HandsOnSimulationTasks> tasksList = new ArrayList<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(handsOnList)) {
|
|
|
|
|
//查询实操任务
|
|
|
|
|
List<Long> handIds = handsOnList.stream().map(HandsOn::getHandsOnId).collect(Collectors.toList());
|
|
|
|
|
HandsOnSimulationTasksQuery tasksQuery = new HandsOnSimulationTasksQuery();
|
|
|
|
|
tasksQuery.setHandsOnIdPlural(CollectionUtil.join(handIds, ","));
|
|
|
|
|
tasksList = handsOnSimulationTasksService.getValuesByQueryNotPermission(tasksQuery);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
List<StudentHandsOnVO> studentHandsOnVOS = new ArrayList<>();
|
|
|
|
|
for (HandsOn handsOn : handsOnList) {
|
|
|
|
|
StudentHandsOnVO studentHandsOnVO = new StudentHandsOnVO();
|
|
|
|
|
Long handsOnId = handsOn.getHandsOnId();
|
|
|
|
|
studentHandsOnVO.setChapterId(handsOn.getCourseChildNode());
|
|
|
|
|
studentHandsOnVO.setTeacherOpenCourseId(handsOn.getTeacherOpenCourseId());
|
|
|
|
|
List<HandsOnSimulationTasks> 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 (HandsOnSimulationTasks task : tasks) {
|
|
|
|
|
Long taskId = task.getTaskId();
|
|
|
|
|
if (HandsOnTaskEnum.TASK_VIDEO.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskVideoQuery videoQuery = new StudentHandsOnTaskVideoQuery();
|
|
|
|
|
videoQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
videoQuery.setStudentId(studentId);
|
|
|
|
|
videoQuery.setCourseType(2);
|
|
|
|
|
List<StudentHandsOnTaskVideo> videoList = videoService.getValuesByQueryNotWithPermission(videoQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(videoList)) {
|
|
|
|
|
StudentHandsOnTaskVideo studentHandsOnTaskVideo = videoList.get(0);
|
|
|
|
|
BigDecimal videoScore = studentHandsOnTaskVideo.getVideoScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_PPT.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskPptQuery pptQuery = new StudentHandsOnTaskPptQuery();
|
|
|
|
|
pptQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
pptQuery.setStudentId(studentId);
|
|
|
|
|
pptQuery.setCourseType(2);
|
|
|
|
|
List<StudentHandsOnTaskPpt> pptList = pptService.getValuesByQueryNotWithPermission(pptQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pptList)) {
|
|
|
|
|
StudentHandsOnTaskPpt studentHandsOnTaskPpt = pptList.get(0);
|
|
|
|
|
BigDecimal videoScore = studentHandsOnTaskPpt.getPptScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_THEORY.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskTheoryQuery theoryQuery = new StudentHandsOnTaskTheoryQuery();
|
|
|
|
|
theoryQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
theoryQuery.setStudentId(studentId);
|
|
|
|
|
theoryQuery.setCourseType(2);
|
|
|
|
|
List<StudentHandsOnTaskTheory> taskTheoryList = theoryService.getValuesByQueryNotWithPermission(theoryQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(taskTheoryList)) {
|
|
|
|
|
BigDecimal videoScore = taskTheoryList.stream().map(StudentHandsOnTaskTheory::getTheoryScore).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_PRACTICAL_TRAINING.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskStepQuery stepQuery = new StudentHandsOnTaskStepQuery();
|
|
|
|
|
stepQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
stepQuery.setStudentId(studentId);
|
|
|
|
|
stepQuery.setCourseType(2);
|
|
|
|
|
List<StudentHandsOnTaskStep> stepList = stepService.getValuesByQueryNotWithPermission(stepQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(stepList)) {
|
|
|
|
|
StudentHandsOnTaskStep taskTheory = stepList.get(0);
|
|
|
|
|
BigDecimal videoScore = taskTheory.getTheoryScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_REPORT_WRITING.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskReportQuery reportQuery = new StudentHandsOnTaskReportQuery();
|
|
|
|
|
reportQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
reportQuery.setStudentId(studentId);
|
|
|
|
|
reportQuery.setCourseType(2);
|
|
|
|
|
List<StudentHandsOnTaskReport> reportList = reportService.getValuesByQueryNotWithPermission(reportQuery);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(reportList)) {
|
|
|
|
|
StudentHandsOnTaskReport taskTheory = reportList.get(0);
|
|
|
|
|
BigDecimal videoScore = taskTheory.getReportScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int schedule = NumberUtil.div(decimal, BigDecimal.valueOf(tasks.size()), 2).multiply(BigDecimal.valueOf(100)).intValue();
|
|
|
|
|
studentHandsOnVO.setSchedule(schedule);
|
|
|
|
|
} else {
|
|
|
|
|
studentHandsOnVO.setSchedule(0);
|
|
|
|
|
}
|
|
|
|
|
studentHandsOnVO.setStudentScore(bigDecimal);
|
|
|
|
|
studentHandsOnVOS.add(studentHandsOnVO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JsonResult.success(studentHandsOnVOS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|