|
|
|
@ -2,6 +2,7 @@ package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.lang.Snowflake;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
@ -14,6 +15,7 @@ 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.enums.GlobalUpStatusEnum;
|
|
|
|
|
import com.ibeetl.jlw.enums.HandsOnTaskEnum;
|
|
|
|
|
import com.ibeetl.jlw.web.query.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -26,11 +28,14 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 教师开课-课程实操 Service
|
|
|
|
|
* 当分布式ID开启后请勿使用insert(*,true)
|
|
|
|
@ -40,49 +45,75 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Transactional
|
|
|
|
|
@Validated
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpenCourseHandsOn> implements DeleteResourcesBy{
|
|
|
|
|
|
|
|
|
|
@Autowired private TeacherOpenCourseHandsOnDao teacherOpenCourseHandsOnDao;
|
|
|
|
|
@Autowired private HandsOnService handsOnService;
|
|
|
|
|
@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;
|
|
|
|
|
|
|
|
|
|
@Autowired private TeacherOpenCourseScoreDashboardService teacherOpenCourseScoreDashboardService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseHandsOn>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseHandsOnDao.queryByCondition(query);
|
|
|
|
|
public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpenCourseHandsOn> implements DeleteResourcesBy {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseHandsOnDao teacherOpenCourseHandsOnDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private HandsOnService handsOnService;
|
|
|
|
|
@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;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseScoreDashboardService teacherOpenCourseScoreDashboardService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HandsOnSimulationTasksAssessmentService handsOnSimulationTasksAssessmentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseHandsOnSimulationTasksAssessmentService teacherOpenCourseHandsOnSimulationTasksAssessmentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HandsOnSimulationTasksFileService handsOnSimulationTasksFileService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseHandsOnSimulationTasksFileService teacherOpenCourseHandsOnSimulationTasksFileService;
|
|
|
|
|
|
|
|
|
|
// 这里简单使用一个雪花算法,来生成新的ID
|
|
|
|
|
private static final Snowflake snowflake = new Snowflake();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseHandsOn> queryByCondition(PageQuery query) {
|
|
|
|
|
PageQuery ret = teacherOpenCourseHandsOnDao.queryByCondition(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseHandsOn>queryByConditionQuery(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseHandsOnDao.queryByConditionQuery(query);
|
|
|
|
|
public PageQuery<TeacherOpenCourseHandsOn> queryByConditionQuery(PageQuery query) {
|
|
|
|
|
PageQuery ret = teacherOpenCourseHandsOnDao.queryByConditionQuery(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteByList(List list){
|
|
|
|
|
public void deleteByList(List list) {
|
|
|
|
|
String ids = "";
|
|
|
|
|
ToolUtils.deleteNullList(list);
|
|
|
|
|
for(int i=0;null != list && i<list.size();i++){
|
|
|
|
|
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
|
|
|
|
for (int i = 0; null != list && i < list.size(); i++) {
|
|
|
|
|
ids += list.get(i).toString() + (i == list.size() - 1 ? "" : ",");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
if (StringUtils.isNotBlank(ids)) {
|
|
|
|
|
teacherOpenCourseHandsOnDao.deleteTeacherOpenCourseHandsOnByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteTeacherOpenCourseHandsOn(String ids){
|
|
|
|
|
public void deleteTeacherOpenCourseHandsOn(String ids) {
|
|
|
|
|
try {
|
|
|
|
|
teacherOpenCourseHandsOnDao.deleteTeacherOpenCourseHandsOnByIds(ids);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -90,7 +121,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String addAll(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public String addAll(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
List<TeacherOpenCourseHandsOn> teacherOpenCourseHandsOnList = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
@ -98,11 +129,12 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
try {
|
|
|
|
|
teacherOpenCourseHandsOnList.add(JSONObject.parseObject(teacherOpenCourseHandsOnQuery.getTeacherOpenCourseHandsOnJsonStr(), TeacherOpenCourseHandsOn.class));
|
|
|
|
|
} catch (Exception e1) {}
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ToolUtils.deleteNullList(teacherOpenCourseHandsOnList);
|
|
|
|
|
if(null != teacherOpenCourseHandsOnList && teacherOpenCourseHandsOnList.size()>0){
|
|
|
|
|
for(int i=0;i<teacherOpenCourseHandsOnList.size();i++){
|
|
|
|
|
if (null != teacherOpenCourseHandsOnList && teacherOpenCourseHandsOnList.size() > 0) {
|
|
|
|
|
for (int i = 0; i < teacherOpenCourseHandsOnList.size(); i++) {
|
|
|
|
|
TeacherOpenCourseHandsOn teacherOpenCourseHandsOn = teacherOpenCourseHandsOnList.get(i);
|
|
|
|
|
teacherOpenCourseHandsOn.setUserId(teacherOpenCourseHandsOnQuery.getUserId());
|
|
|
|
|
teacherOpenCourseHandsOn.setOrgId(teacherOpenCourseHandsOnQuery.getOrgId());
|
|
|
|
@ -112,7 +144,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JsonResult add(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public JsonResult add(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
TeacherOpenCourseHandsOn teacherOpenCourseHandsOn = teacherOpenCourseHandsOnQuery.pojo();
|
|
|
|
|
teacherOpenCourseHandsOnDao.insert(teacherOpenCourseHandsOn);
|
|
|
|
@ -124,61 +156,62 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
return jsonResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String edit(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public String edit(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
TeacherOpenCourseHandsOn teacherOpenCourseHandsOn = teacherOpenCourseHandsOnQuery.pojo();
|
|
|
|
|
teacherOpenCourseHandsOnDao.updateTemplateById(teacherOpenCourseHandsOn);
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String updateGivenByIds(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public String updateGivenByIds(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
String msg = "";
|
|
|
|
|
if(StringUtils.isNotBlank(teacherOpenCourseHandsOnQuery.get_given())){
|
|
|
|
|
if (StringUtils.isNotBlank(teacherOpenCourseHandsOnQuery.get_given())) {
|
|
|
|
|
boolean flag = teacherOpenCourseHandsOnDao.updateGivenByIds(teacherOpenCourseHandsOnQuery) > 0;
|
|
|
|
|
if(!flag){
|
|
|
|
|
if (!flag) {
|
|
|
|
|
msg = "更新指定参数失败";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
msg = "指定参数为空";
|
|
|
|
|
}
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TeacherOpenCourseHandsOn> getValues (Object paras){
|
|
|
|
|
public List<TeacherOpenCourseHandsOn> getValues(Object paras) {
|
|
|
|
|
return sqlManager.select(SqlId.of("jlw.teacherOpenCourseHandsOn.getTeacherOpenCourseHandsOnValues"), TeacherOpenCourseHandsOn.class, paras);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TeacherOpenCourseHandsOn> getValuesByQuery (TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public List<TeacherOpenCourseHandsOn> getValuesByQuery(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
return teacherOpenCourseHandsOnDao.getValuesByQuery(teacherOpenCourseHandsOnQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TeacherOpenCourseHandsOn> getValuesByQueryNotWithPermission (TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public List<TeacherOpenCourseHandsOn> getValuesByQueryNotWithPermission(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
return teacherOpenCourseHandsOnDao.getValuesByQueryNotWithPermission(teacherOpenCourseHandsOnQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TeacherOpenCourseHandsOn getInfo (Long handsOnId){
|
|
|
|
|
public TeacherOpenCourseHandsOn getInfo(Long handsOnId) {
|
|
|
|
|
TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery = new TeacherOpenCourseHandsOnQuery();
|
|
|
|
|
teacherOpenCourseHandsOnQuery.setHandsOnId(handsOnId);
|
|
|
|
|
List<TeacherOpenCourseHandsOn> list = teacherOpenCourseHandsOnDao.getValuesByQuery(teacherOpenCourseHandsOnQuery);
|
|
|
|
|
if(null != list && list.size()>0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
return list.get(0);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TeacherOpenCourseHandsOn getInfo (TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery){
|
|
|
|
|
public TeacherOpenCourseHandsOn getInfo(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
List<TeacherOpenCourseHandsOn> list = teacherOpenCourseHandsOnDao.getValuesByQuery(teacherOpenCourseHandsOnQuery);
|
|
|
|
|
if(null != list && list.size()>0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
return list.get(0);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 同步课程实操
|
|
|
|
|
* @param courseInfoId 课程id
|
|
|
|
|
*
|
|
|
|
|
* @param courseInfoId 课程id
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -191,7 +224,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
StringJoiner joiner = new StringJoiner(",");
|
|
|
|
|
for (TeacherOpenCourseHandsOn teacherOpenCourseHandsOn : teacherOpenCourseHandsOns) {
|
|
|
|
|
teacherOpenCourseHandsOn.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
joiner.add(teacherOpenCourseHandsOn.getHandsOnId()+"");
|
|
|
|
|
joiner.add(teacherOpenCourseHandsOn.getHandsOnId() + "");
|
|
|
|
|
}
|
|
|
|
|
insertBatch(teacherOpenCourseHandsOns);
|
|
|
|
|
if (StringUtils.isNoneEmpty(joiner.toString())) {
|
|
|
|
@ -203,21 +236,21 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseHandsOnList> getHandsOnList(GetHandsOnListParam param) {
|
|
|
|
|
PageQuery<TeacherOpenCourseHandsOnList> teacherOpenCourseHandsOns = teacherOpenCourseHandsOnDao.getHandsOnList(param.getPageQuery());
|
|
|
|
|
handsOnListHandler(teacherOpenCourseHandsOns.getList(),param);
|
|
|
|
|
handsOnListHandler(teacherOpenCourseHandsOns.getList(), param);
|
|
|
|
|
return teacherOpenCourseHandsOns;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TeacherOpenCourseHandsOnList> getHandsOnListNotPage(GetHandsOnListParam param) {
|
|
|
|
|
List<TeacherOpenCourseHandsOnList> teacherOpenCourseHandsOns = teacherOpenCourseHandsOnDao.getHandsOnListNotPage(param);
|
|
|
|
|
handsOnListHandler(teacherOpenCourseHandsOns,param);
|
|
|
|
|
handsOnListHandler(teacherOpenCourseHandsOns, param);
|
|
|
|
|
return teacherOpenCourseHandsOns;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handsOnListHandler(List<TeacherOpenCourseHandsOnList> teacherOpenCourseHandsOnLists,GetHandsOnListParam param){
|
|
|
|
|
private void handsOnListHandler(List<TeacherOpenCourseHandsOnList> teacherOpenCourseHandsOnLists, GetHandsOnListParam param) {
|
|
|
|
|
List<Long> handIds = teacherOpenCourseHandsOnLists.stream().map(TeacherOpenCourseHandsOnList::getHandsOnId).collect(Collectors.toList());
|
|
|
|
|
List<HandsOnAchievement> achievementList = new ArrayList<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(handIds)) {
|
|
|
|
@ -239,7 +272,6 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> getExcelValues(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
|
|
|
|
|
return teacherOpenCourseHandsOnDao.getExcelValues(teacherOpenCourseHandsOnQuery);
|
|
|
|
|
}
|
|
|
|
@ -300,7 +332,6 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
return teacherOpenCourseHandsOnList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -315,6 +346,7 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询课程实操
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId
|
|
|
|
|
* @param coreUser
|
|
|
|
|
* @return
|
|
|
|
@ -362,10 +394,10 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
if (CollectionUtils.isNotEmpty(videoList)) {
|
|
|
|
|
StudentHandsOnTaskVideo studentHandsOnTaskVideo = videoList.get(0);
|
|
|
|
|
BigDecimal videoScore = studentHandsOnTaskVideo.getVideoScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO:videoScore);
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if(HandsOnTaskEnum.TASK_PPT.status.equals(task.getTaskType())) {
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_PPT.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskPptQuery pptQuery = new StudentHandsOnTaskPptQuery();
|
|
|
|
|
pptQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
pptQuery.setStudentId(studentId);
|
|
|
|
@ -373,20 +405,20 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pptList)) {
|
|
|
|
|
StudentHandsOnTaskPpt studentHandsOnTaskPpt = pptList.get(0);
|
|
|
|
|
BigDecimal videoScore = studentHandsOnTaskPpt.getPptScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO: videoScore);
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if(HandsOnTaskEnum.TASK_THEORY.status.equals(task.getTaskType())) {
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_THEORY.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskTheoryQuery theoryQuery = new StudentHandsOnTaskTheoryQuery();
|
|
|
|
|
theoryQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
theoryQuery.setStudentId(studentId);
|
|
|
|
|
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);
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if(HandsOnTaskEnum.TASK_PRACTICAL_TRAINING.status.equals(task.getTaskType())) {
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_PRACTICAL_TRAINING.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskStepQuery stepQuery = new StudentHandsOnTaskStepQuery();
|
|
|
|
|
stepQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
stepQuery.setStudentId(studentId);
|
|
|
|
@ -394,25 +426,25 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
if (CollectionUtils.isNotEmpty(stepList)) {
|
|
|
|
|
StudentHandsOnTaskStep taskTheory = stepList.get(0);
|
|
|
|
|
BigDecimal videoScore = taskTheory.getTheoryScore();
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO: videoScore);
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}else if(HandsOnTaskEnum.TASK_REPORT_WRITING.status.equals(task.getTaskType())) {
|
|
|
|
|
} else if (HandsOnTaskEnum.TASK_REPORT_WRITING.status.equals(task.getTaskType())) {
|
|
|
|
|
StudentHandsOnTaskReportQuery reportQuery = new StudentHandsOnTaskReportQuery();
|
|
|
|
|
reportQuery.setHandsOnTaskId(taskId);
|
|
|
|
|
reportQuery.setStudentId(studentId);
|
|
|
|
|
List<StudentHandsOnTaskReport> reportList =reportService.getValuesByQueryNotWithPermission(reportQuery);
|
|
|
|
|
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);
|
|
|
|
|
bigDecimal = bigDecimal.add(videoScore == null ? BigDecimal.ZERO : videoScore);
|
|
|
|
|
decimal = decimal.add(BigDecimal.ONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int schedule = NumberUtil.div(decimal, BigDecimal.valueOf(tasksList.size()),2).multiply(BigDecimal.valueOf(100)).intValue();
|
|
|
|
|
int schedule = NumberUtil.div(decimal, BigDecimal.valueOf(tasksList.size()), 2).multiply(BigDecimal.valueOf(100)).intValue();
|
|
|
|
|
studentHandsOnVO.setSchedule(schedule);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
studentHandsOnVO.setSchedule(0);
|
|
|
|
|
}
|
|
|
|
|
studentHandsOnVO.setStudentScore(bigDecimal);
|
|
|
|
@ -428,17 +460,156 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
|
|
|
|
|
dashboard.setRealOperationScore(b);
|
|
|
|
|
teacherOpenCourseScoreDashboardService.insert(dashboard);
|
|
|
|
|
dashboard.setCreateTime(new Date());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
TeacherOpenCourseScoreDashboard dashboard1 = serviceValues.get(0);
|
|
|
|
|
dashboard1.setRealOperationScore(b);
|
|
|
|
|
teacherOpenCourseScoreDashboardService.update(dashboard1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return JsonResult.success(studentHandsOnVOS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 复制系统授权课实训到开课
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseId 老师公开课id
|
|
|
|
|
* @param courseInfoId 课程信息id,传最顶级即可
|
|
|
|
|
* @param courseInfoIdPair 课程信息id对
|
|
|
|
|
* @author zhouzhao
|
|
|
|
|
* @date 2023/04/28 03:59:44
|
|
|
|
|
*/
|
|
|
|
|
public void copySystemHandsToOpenCourse(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId,
|
|
|
|
|
@NotNull(message = "课程ID不能为空!") Long courseInfoId,
|
|
|
|
|
@Nullable Map<Long, Long> courseInfoIdPair) {
|
|
|
|
|
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
CoreUser currentUser = getUser();
|
|
|
|
|
if (currentUser==null){
|
|
|
|
|
throw new PlatformException("请先登录");
|
|
|
|
|
}
|
|
|
|
|
HandsOnQuery handsOnQuery = new HandsOnQuery();
|
|
|
|
|
//归属课程
|
|
|
|
|
handsOnQuery.setCourseInfoId(courseInfoId);
|
|
|
|
|
// 已上架的
|
|
|
|
|
handsOnQuery.setHandsOnStatus(GlobalUpStatusEnum.UP.getCode());
|
|
|
|
|
List<HandsOn> handsOnList = handsOnService.getValuesByQuery(handsOnQuery);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(handsOnList)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//handsOnList 转换为 TeacherOpenCourseHandsOn
|
|
|
|
|
|
|
|
|
|
// 拷贝部分字段映射
|
|
|
|
|
// 拷贝
|
|
|
|
|
List<TeacherOpenCourseHandsOn> teacherOpenCourseHandsOnList = new ArrayList<>(BeanUtil.copyToList(handsOnList, TeacherOpenCourseHandsOn.class));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<Long, Long> handsOnIdOldToNewMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
for (TeacherOpenCourseHandsOn teacherOpenCourseHandsOn : teacherOpenCourseHandsOnList) {
|
|
|
|
|
Long handsOnIdTemp = teacherOpenCourseHandsOn.getHandsOnId();
|
|
|
|
|
String courseChildNodeTemp = teacherOpenCourseHandsOn.getCourseChildNode();
|
|
|
|
|
|
|
|
|
|
Long newHandsOnId = snowflake.nextId();
|
|
|
|
|
handsOnIdOldToNewMap.put(handsOnIdTemp, newHandsOnId);
|
|
|
|
|
teacherOpenCourseHandsOn.setCourseChildNode(courseInfoIdPair.get(Long.parseLong(courseChildNodeTemp)).toString());
|
|
|
|
|
teacherOpenCourseHandsOn.setHandsOnId(newHandsOnId);
|
|
|
|
|
teacherOpenCourseHandsOn.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
//别问我这里为什么放这个,他们自己的代码就是这样的
|
|
|
|
|
teacherOpenCourseHandsOn.setCourseInfoId(teacherOpenCourseId);
|
|
|
|
|
teacherOpenCourseHandsOn.setOrgId(currentUser.getOrgId());
|
|
|
|
|
teacherOpenCourseHandsOn.setUserId(currentUser.getId());
|
|
|
|
|
teacherOpenCourseHandsOn.setAddTime(now);
|
|
|
|
|
}
|
|
|
|
|
// 批量插入
|
|
|
|
|
insertBatch(teacherOpenCourseHandsOnList);
|
|
|
|
|
|
|
|
|
|
String handsOnIds = handsOnIdOldToNewMap.keySet().stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
|
HandsOnSimulationTasksQuery handsOnSimulationTasksQuery = new HandsOnSimulationTasksQuery();
|
|
|
|
|
handsOnSimulationTasksQuery.setHandsOnIdPlural(handsOnIds);
|
|
|
|
|
List<HandsOnSimulationTasks> handsOnSimulationTasksList = handsOnSimulationTasksService.getValuesByQuery(handsOnSimulationTasksQuery);
|
|
|
|
|
|
|
|
|
|
// 拷贝部分字段映射
|
|
|
|
|
// 拷贝
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> teacherOpenCourseHandsOnSimulationTasksList = new ArrayList<>(BeanUtil.copyToList(handsOnSimulationTasksList, TeacherOpenCourseHandsOnSimulationTasks.class));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<Long, Long> simulationTaskOldToNewMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksList.forEach(teacherOpenCourseHandsOnSimulationTasks -> {
|
|
|
|
|
Long newHandsOnId = handsOnIdOldToNewMap.get(teacherOpenCourseHandsOnSimulationTasks.getHandsOnId());
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasks.setHandsOnId(newHandsOnId);
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasks.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasks.setOrgId(currentUser.getOrgId());
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasks.setUserId(currentUser.getId());
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasks.setAddTime(now);
|
|
|
|
|
|
|
|
|
|
Long oldTaskId = teacherOpenCourseHandsOnSimulationTasks.getTaskId();
|
|
|
|
|
Long newTaskId = snowflake.nextId();
|
|
|
|
|
simulationTaskOldToNewMap.put(oldTaskId, newTaskId);
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasks.setTaskId(newTaskId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 批量插入
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksService.insertBatch(teacherOpenCourseHandsOnSimulationTasksList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HandsOnSimulationTasksAssessmentQuery handsOnSimulationTasksAssessmentQuery = new HandsOnSimulationTasksAssessmentQuery();
|
|
|
|
|
handsOnSimulationTasksAssessmentQuery.setHandsOnIdPlural(handsOnIds);
|
|
|
|
|
|
|
|
|
|
List<HandsOnSimulationTasksAssessment> handsOnSimulationTasksAssessmentList = handsOnSimulationTasksAssessmentService.getValuesByQuery(handsOnSimulationTasksAssessmentQuery);
|
|
|
|
|
|
|
|
|
|
// 拷贝部分字段映射
|
|
|
|
|
// 拷贝
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasksAssessment> teacherOpenCourseHandsOnSimulationTasksAssessmentList = new ArrayList<>(BeanUtil.copyToList(handsOnSimulationTasksAssessmentList, TeacherOpenCourseHandsOnSimulationTasksAssessment.class));
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessmentList.forEach(teacherOpenCourseHandsOnSimulationTasksAssessment -> {
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessment.setHandsOnTaskId(simulationTaskOldToNewMap.get(teacherOpenCourseHandsOnSimulationTasksAssessment.getHandsOnTaskId()));
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessment.setHandsOnId(handsOnIdOldToNewMap.get(teacherOpenCourseHandsOnSimulationTasksAssessment.getHandsOnId()));
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessment.setOrgId(currentUser.getOrgId());
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessment.setUserId(currentUser.getId());
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessment.setHandsOnSimulationTasksAssessmentId(snowflake.nextId());
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessment.setAddTime(now);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 批量插入
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksAssessmentService.insertBatch(teacherOpenCourseHandsOnSimulationTasksAssessmentList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HandsOnSimulationTasksFileQuery handsOnSimulationTasksFileQuery = new HandsOnSimulationTasksFileQuery();
|
|
|
|
|
handsOnSimulationTasksFileQuery.setHandsOnIdPlural(handsOnIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<HandsOnSimulationTasksFile> handsOnSimulationTasksFileList = handsOnSimulationTasksFileService.getValuesByQuery(handsOnSimulationTasksFileQuery);
|
|
|
|
|
|
|
|
|
|
// 拷贝部分字段映射
|
|
|
|
|
// 拷贝
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasksFile> teacherOpenCourseHandsOnSimulationTasksFileList = new ArrayList<>(BeanUtil.copyToList(handsOnSimulationTasksFileList, TeacherOpenCourseHandsOnSimulationTasksFile.class));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksFileList.forEach(item -> {
|
|
|
|
|
item.setTaskId(simulationTaskOldToNewMap.get(item.getTaskId()));
|
|
|
|
|
item.setHandsOnId(handsOnIdOldToNewMap.get(item.getHandsOnId()));
|
|
|
|
|
item.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
item.setOrgId(currentUser.getOrgId());
|
|
|
|
|
item.setUserId(currentUser.getId());
|
|
|
|
|
item.setTaskFileId(snowflake.nextId());
|
|
|
|
|
item.setAddTime(now);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 批量插入
|
|
|
|
|
teacherOpenCourseHandsOnSimulationTasksFileService.insertBatch(teacherOpenCourseHandsOnSimulationTasksFileList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|