1、课程中心-实操-成绩

beetlsql3-dev
wgf 2 years ago
parent 822d6034ca
commit 2df9a5980b

@ -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);
}
}

@ -519,6 +519,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
StudentHandsOnTaskVideoQuery videoQuery = new StudentHandsOnTaskVideoQuery();
videoQuery.setHandsOnTaskId(taskId);
videoQuery.setStudentId(studentId);
videoQuery.setCourseType(1);
List<StudentHandsOnTaskVideo> videoList = videoService.getValuesByQueryNotWithPermission(videoQuery);
if (CollectionUtils.isNotEmpty(videoList)) {
StudentHandsOnTaskVideo studentHandsOnTaskVideo = videoList.get(0);
@ -530,6 +531,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
StudentHandsOnTaskPptQuery pptQuery = new StudentHandsOnTaskPptQuery();
pptQuery.setHandsOnTaskId(taskId);
pptQuery.setStudentId(studentId);
pptQuery.setCourseType(1);
List<StudentHandsOnTaskPpt> pptList = pptService.getValuesByQueryNotWithPermission(pptQuery);
if (CollectionUtils.isNotEmpty(pptList)) {
StudentHandsOnTaskPpt studentHandsOnTaskPpt = pptList.get(0);
@ -541,6 +543,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
StudentHandsOnTaskTheoryQuery theoryQuery = new StudentHandsOnTaskTheoryQuery();
theoryQuery.setHandsOnTaskId(taskId);
theoryQuery.setStudentId(studentId);
theoryQuery.setCourseType(1);
List<StudentHandsOnTaskTheory> taskTheoryList = theoryService.getValuesByQueryNotWithPermission(theoryQuery);
if (CollectionUtils.isNotEmpty(taskTheoryList)) {
BigDecimal videoScore = taskTheoryList.stream().map(StudentHandsOnTaskTheory::getTheoryScore).reduce(BigDecimal.ZERO, BigDecimal::add);
@ -551,6 +554,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
StudentHandsOnTaskStepQuery stepQuery = new StudentHandsOnTaskStepQuery();
stepQuery.setHandsOnTaskId(taskId);
stepQuery.setStudentId(studentId);
stepQuery.setCourseType(1);
List<StudentHandsOnTaskStep> stepList = stepService.getValuesByQueryNotWithPermission(stepQuery);
if (CollectionUtils.isNotEmpty(stepList)) {
StudentHandsOnTaskStep taskTheory = stepList.get(0);
@ -562,6 +566,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
StudentHandsOnTaskReportQuery reportQuery = new StudentHandsOnTaskReportQuery();
reportQuery.setHandsOnTaskId(taskId);
reportQuery.setStudentId(studentId);
reportQuery.setCourseType(1);
List<StudentHandsOnTaskReport> reportList = reportService.getValuesByQueryNotWithPermission(reportQuery);
if (CollectionUtils.isNotEmpty(reportList)) {
StudentHandsOnTaskReport taskTheory = reportList.get(0);

@ -422,4 +422,15 @@ public class HandsOnController{
return JsonResult.success(handsListCenterByOpenCourseId);
}
/**
*
* @param courseInfoId
* @param coreUser
* @return
*/
@GetMapping(API + "/getCourseCentreHandsListCenterByOpenCourseId.do")
public JsonResult getCourseCentreHandsListCenterByOpenCourseId(Long courseInfoId,@SCoreUser CoreUser coreUser) {
return handsOnService.getCourseCentreHandsListByOpenCourseIdAndStudent(courseInfoId,coreUser);
}
}

Loading…
Cancel
Save