实训流程修改&贵装备课程查询逻辑修改
This commit is contained in:
parent
d9eb31e884
commit
5cd012cc66
@ -70,8 +70,8 @@ public class MapSystemController {
|
||||
|
||||
@ApiOperation(value = "查询子系统详情")
|
||||
@GetMapping("/{id}/detail")
|
||||
public MapSystemDetailVO getMapSystemDetail(@PathVariable Long id, @RequestAttribute UserVO user) {
|
||||
return iMapSystemService.getMapSystemDetail(id, user);
|
||||
public MapSystemDetailVO getMapSystemDetail(@PathVariable Long id, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iMapSystemService.getMapSystemDetail(id, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除地图系统")
|
||||
|
@ -2,8 +2,8 @@ package club.joylink.rtss.controller.training;
|
||||
|
||||
import club.joylink.rtss.constants.RoleEnum;
|
||||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.services.training.ITrainingV1Service;
|
||||
import club.joylink.rtss.services.training.GenerateTask;
|
||||
import club.joylink.rtss.services.training.ITrainingV1Service;
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -85,8 +85,8 @@ public class TrainingV1Controller {
|
||||
|
||||
@ApiOperation(value="实训开始")
|
||||
@GetMapping(path="/{id}/start")
|
||||
public TrainingNewVO trainingStart(@PathVariable Long id, String group, String mode) {
|
||||
return this.iTrainingService.trainingStart(id, group, mode);
|
||||
public void trainingStart(@PathVariable Long id, String group, String mode) {
|
||||
this.iTrainingService.trainingStart(id, group, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,4 +189,10 @@ public class TrainingV1Controller {
|
||||
public void deleteUserTraining(@PathVariable Long id, @ApiIgnore @RequestAttribute UserVO user) {
|
||||
this.iTrainingService.deleteUserTraining(id, user);
|
||||
}
|
||||
|
||||
@ApiOperation("加载实训到仿真中")
|
||||
@PutMapping("/{group}/{id}/loadTraining")
|
||||
public TrainingNewVO loadTraining(@PathVariable String group, @PathVariable Long id) {
|
||||
return iTrainingService.loadTraining(group, id);
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,8 @@ package club.joylink.rtss.dao;
|
||||
|
||||
import club.joylink.rtss.entity.LsLesson;
|
||||
import club.joylink.rtss.entity.LsLessonExample;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import club.joylink.rtss.vo.client.LessonVO;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -36,4 +35,38 @@ public interface LsLessonDAO extends MyBatisBaseDao<LsLesson, Long, LsLessonExam
|
||||
" </foreach>" +
|
||||
"</script>")
|
||||
int batchInsertWithId(@Param("list") List<LsLesson> lessonList);
|
||||
|
||||
@Results(id = "one",
|
||||
value = {
|
||||
@Result (column="id", property="id"),
|
||||
@Result (column="map_id", property="mapId"),
|
||||
@Result (column="prd_type", property="prdType"),
|
||||
@Result (column="name", property="name"),
|
||||
@Result (column="remarks", property="remarks"),
|
||||
@Result (column="author_id", property="authorId"),
|
||||
@Result (column="update_time", property="updateTime"),
|
||||
@Result (column="creator_id", property="creatorId"),
|
||||
@Result (column="city_code", property="cityCode"),
|
||||
@Result (column="status", property="status")
|
||||
}
|
||||
)
|
||||
@Select("<script>" +
|
||||
"SELECT\n" +
|
||||
"\tls_lesson.*\n" +
|
||||
"FROM\n" +
|
||||
"\tls_lesson\n" +
|
||||
"INNER JOIN map_info ON ls_lesson.map_id = map_info.id\n" +
|
||||
"WHERE\n" +
|
||||
"\tmap_info.`status` = 1\n" +
|
||||
"AND ls_lesson.id IN " +
|
||||
"<foreach item=\"id\" index=\"index\" collection=\"ids\" open=\"(\" separator=\",\" close=\")\">\n" +
|
||||
" #{id}\n" +
|
||||
"</foreach>\n" +
|
||||
"<if test=\"prdType != null\">" +
|
||||
" AND ls_lesson.prd_type = #{prdType}\n" +
|
||||
"</if>" +
|
||||
"ORDER BY\n" +
|
||||
"\tls_lesson.id ASC" +
|
||||
"</script>")
|
||||
List<LessonVO> getValidLesson(List<Long> ids, String prdType);
|
||||
}
|
@ -135,4 +135,9 @@ public interface ILessonService {
|
||||
|
||||
@Transactional
|
||||
void generateLessonAndExam(List<Long> mapIds, UserVO userVO);
|
||||
|
||||
/**
|
||||
* 获取有效的课程
|
||||
*/
|
||||
List<LessonVO> getValidLesson(List<Long> ids, String prdType);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.TreeNode;
|
||||
@ -61,10 +62,10 @@ public interface IMapSystemService {
|
||||
/**
|
||||
* 根据系统类型和地图产品code查询详细信息
|
||||
* @param id
|
||||
* @param user
|
||||
* @param loginInfo
|
||||
* @return
|
||||
*/
|
||||
MapSystemDetailVO getMapSystemDetail(Long id, UserVO user);
|
||||
MapSystemDetailVO getMapSystemDetail(Long id, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 删除地图系统
|
||||
|
@ -15,12 +15,14 @@ import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -33,6 +35,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Validated
|
||||
public class LessonService implements ILessonService {
|
||||
|
||||
@Autowired
|
||||
@ -591,6 +594,11 @@ public class LessonService implements ILessonService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LessonVO> getValidLesson(@NonNull List<Long> ids, String prdType) {
|
||||
return lessonDAO.getValidLesson(ids, prdType);
|
||||
}
|
||||
|
||||
private void generateLessonBy(UserVO userVO, MapVO mapVO, BusinessConsts.Lesson.PrdInfo prdLessonInfo, String prdType) {
|
||||
//课程
|
||||
LsLesson lesson = new LsLesson();
|
||||
|
@ -1,15 +1,17 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.constants.MapSystemType;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.constants.StatusEnum;
|
||||
import club.joylink.rtss.dao.MapSystemDAO;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.entity.MapSystem;
|
||||
import club.joylink.rtss.entity.MapSystemExample;
|
||||
import club.joylink.rtss.entity.StudentRelIdClass;
|
||||
import club.joylink.rtss.entity.StudentRelLessonClass;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.student.IClassStudentUserService;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.LessonVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -20,12 +22,14 @@ import club.joylink.rtss.vo.client.sub.MapSystemDetailVO;
|
||||
import club.joylink.rtss.vo.client.sub.MapSystemQueryVO;
|
||||
import club.joylink.rtss.vo.client.sub.MapSystemVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -199,13 +203,10 @@ public class MapSystemService implements IMapSystemService {
|
||||
|
||||
/**
|
||||
* 根据mapSystem表id查询该产品下
|
||||
*
|
||||
* @param id
|
||||
* @param userVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MapSystemDetailVO getMapSystemDetail(Long id, UserVO userVO) {
|
||||
public MapSystemDetailVO getMapSystemDetail(Long id, LoginUserInfoVO loginInfo) {
|
||||
UserVO userVO = loginInfo.getUserVO();
|
||||
MapSystem mapSystem = getEntity(id);
|
||||
MapSystemDetailVO mapSystemDetailVO = new MapSystemDetailVO(mapSystem);
|
||||
|
||||
@ -220,11 +221,11 @@ public class MapSystemService implements IMapSystemService {
|
||||
List<LessonVO> lessonVOList = null;
|
||||
//用户存在班级关系时,根据班级课程关系查询课程,目前仅GZB使用
|
||||
List<StudentRelIdClass> studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId());
|
||||
if(!CollectionUtils.isEmpty(studentRelIdClasses)){
|
||||
if(loginInfo.getProject().equals(Project.GZB) && !CollectionUtils.isEmpty(studentRelIdClasses)){
|
||||
Integer classId = studentRelIdClasses.get(0).getClassId();//学生只关联一个班
|
||||
List<StudentRelLessonClass> relLessonsByClass = this.iClassStudentUserService.getRelLessonsByClass(classId);
|
||||
if(!CollectionUtils.isEmpty(relLessonsByClass)){
|
||||
lessonVOList = iLessonService.getByIdsWithPrdType(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()),mapSystem.getPrdType());
|
||||
lessonVOList = iLessonService.getValidLesson(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType());
|
||||
}
|
||||
|
||||
}else{
|
||||
|
@ -169,7 +169,8 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
|
||||
|
||||
@Override
|
||||
public List<LessonVO> getLessonByClass(Integer classId){
|
||||
return getRelLessonsByClass(classId).stream().map(studentRelLessonClass -> this.lessonService.getLessonInfo(studentRelLessonClass.getLessonId())).collect(Collectors.toList());
|
||||
List<Long> lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList());
|
||||
return lessonService.getValidLesson(lessonIds, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,4 +176,9 @@ public interface ITrainingV1Service {
|
||||
Map<Long, Long> copyAllOfMapAndPrd(Long sourceMapId, Long targetMapId);
|
||||
|
||||
List<Training> queryTrainingsBy(Long mapId, String prdType, String trainingType);
|
||||
|
||||
/**
|
||||
* 加载实训到仿真中
|
||||
*/
|
||||
TrainingNewVO loadTraining(String group, Long trainingId);
|
||||
}
|
||||
|
@ -111,7 +111,8 @@ public class TrainingV1Service implements ITrainingV1Service {
|
||||
@Override
|
||||
public TrainingNewVO getTrainingDetail(Long id, String group) {
|
||||
Assert.hasText(group, "group不能为空!");
|
||||
return this.prepareTrainingData(id, group);
|
||||
return groupTrainingDataCache.getTrainingByGroup(group);
|
||||
// return this.prepareTrainingData(id, group);
|
||||
}
|
||||
|
||||
private TrainingNewVO prepareTrainingData(Long id, String group) {
|
||||
@ -196,18 +197,7 @@ public class TrainingV1Service implements ITrainingV1Service {
|
||||
|
||||
@Override
|
||||
public TrainingNewVO trainingStart(Long id, String group, String mode) {
|
||||
Assert.hasText(group, "group不能为空!");
|
||||
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(simulation, String.format("仿真[%s]不存在", group));
|
||||
//准备实训数据
|
||||
TrainingWithBLOBs training = trainingDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(training, "实训数据不存在");
|
||||
TrainingNewVO trainingVo = new TrainingNewVO(training);
|
||||
this.groupTrainingDataCache.saveGroupTraining(group, trainingVo);
|
||||
if (StringUtils.hasText(training.getSteps())) {
|
||||
trainingVo.setSteps(JsonUtils.read(training.getSteps(), JsonUtils.getCollectionType(List.class, TrainingStepVO.class)));
|
||||
}
|
||||
groupSimulationService.loadScenes(group, training.getScenes());
|
||||
TrainingNewVO trainingVo = loadTraining(group, id);
|
||||
trainingVo.clearActualSteps();
|
||||
return trainingVo;
|
||||
}
|
||||
@ -680,4 +670,21 @@ public class TrainingV1Service implements ITrainingV1Service {
|
||||
List<Training> trainings = this.trainingDAO.selectByExample(te);
|
||||
return trainings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainingNewVO loadTraining(String group, Long trainingId) {
|
||||
Assert.hasText(group, "group不能为空!");
|
||||
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(simulation, String.format("仿真[%s]不存在", group));
|
||||
//准备实训数据
|
||||
TrainingWithBLOBs training = trainingDAO.selectByPrimaryKey(trainingId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(training, "实训数据不存在");
|
||||
TrainingNewVO trainingVo = new TrainingNewVO(training);
|
||||
this.groupTrainingDataCache.saveGroupTraining(group, trainingVo);
|
||||
if (StringUtils.hasText(training.getSteps())) {
|
||||
trainingVo.setSteps(JsonUtils.read(training.getSteps(), JsonUtils.getCollectionType(List.class, TrainingStepVO.class)));
|
||||
}
|
||||
groupSimulationService.loadScenes(group, training.getScenes());
|
||||
return trainingVo;
|
||||
}
|
||||
}
|
||||
|
@ -337,6 +337,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
Simulation simulation = this.create(loginUserInfoVO, training.getMapId(),
|
||||
MapPrdTypeEnum.getMapPrdTypeEnumByCode(training.getPrdType()),
|
||||
Simulation.FunctionalType.LESSON);
|
||||
iTrainingV1Service.loadTraining(simulation.getGroup(), trainingId);
|
||||
return simulation.getGroup();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user