大赛管理功能方法注释

This commit is contained in:
tiger_zhou 2024-02-29 18:00:54 +08:00
parent 902a2e78b1
commit 4a1316e1bd
8 changed files with 163 additions and 46 deletions

@ -1 +1 @@
Subproject commit 71cf9d49fb9dbe951b43a482b7649b5f7bf58a3b
Subproject commit 64053645db2ecf352e7fdf8e4d19ec607d03c887

View File

@ -40,6 +40,13 @@ public class RacePaperController {
racePaperService.create(createVO, user);
}
/**
* 更新试卷内容
*
* @param id
* @param updateVO
* @param user
*/
@PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RacePaperCreateVO updateVO, @RequestAttribute AccountVO user) {
this.racePaperService.update(id, updateVO, user);
@ -53,16 +60,35 @@ public class RacePaperController {
return racePaperService.pageQuery(queryVO);
}
/**
* 试卷配置
*
* @param id
* @param moduleVO
* @param user
*/
@PostMapping("/{id}/config")
public void configSeting(@PathVariable("id") Long id, @RequestBody RacePaperModuleVO moduleVO, @RequestAttribute AccountVO user) {
this.racePaperService.configSeting(id, moduleVO, user);
}
/**
* 获取明细
*
* @param id
* @return
*/
@GetMapping("/{id}")
public RacePaperDetailVO detail(@PathVariable("id") Long id) {
return this.racePaperService.detail(id);
}
/**
* 拷贝功能
*
* @param id
* @param user
*/
@PutMapping("/{id}/copy")
public void copy(@PathVariable("id") Long id, @RequestAttribute AccountVO user) {
this.racePaperService.copy(id, user);
@ -77,6 +103,14 @@ public class RacePaperController {
racePaperService.delete(id);
}
/**
* 获取试卷对应模块的模块任务树
*
* @param id
* @param moduleId
* @return
*/
@GetMapping("/{paperId}/module/{moduleId}/task")
public RacePaperSingleModuleGroupTask paperModuleTask(@PathVariable("paperId") Long id, @PathVariable("moduleId") Integer moduleId) {
return this.racePaperService.singlePaperModuleTask(id, moduleId);

View File

@ -27,23 +27,45 @@ public class RaceSceneController {
@Autowired
private RaceSceneService sceneService;
//草稿实训发布到场景
/**
* 草稿实训发布到场景
*
* @param vo
* @param user
*/
@PostMapping("/publish/training")
public void publishHere(@RequestBody RaceScenePublishVO vo, @RequestAttribute AccountVO user) {
this.sceneService.publishHere(vo, user);
}
/**
* 获取明细
*
* @param id
* @return
*/
@GetMapping("/{id}")
public RaceSceneVO detail(@PathVariable("id") Long id) {
return this.sceneService.detail(id);
}
/**
* 分页
*
* @param query
* @return
*/
@GetMapping("/page")
public PageVO<RaceSceneListVO> page(RaceSceneQueryVO query) {
return this.sceneService.page(query);
}
/**
* 删除
*
* @param id
*/
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {
this.sceneService.delete(id);

View File

@ -28,31 +28,58 @@ public class RaceScoreRuleController {
@Autowired
private RaceScoreRuleService scoreRuleService;
//任务评分的大致流程
//1.创建基础信息
//2.编辑评分具体的内容
/**
* 1.创建基础信息
*
* @param nameMap
* @param user
*/
@PostMapping
public void saveBasic(@RequestBody Map<String, String> nameMap, @RequestAttribute AccountVO user) {
this.scoreRuleService.saveBasic(nameMap.get("name"), user);
}
/**
* 评分配置
*
* @param ruleId
* @param rule
* @param user
*/
@PostMapping("/edit/rule/{ruleId}")
public void editRule(@PathVariable("ruleId") Long ruleId, @RequestBody Rule rule, @RequestAttribute AccountVO user) {
this.scoreRuleService.editRule(ruleId, rule, user);
}
/**
* 明细
*
* @param id
* @return
*/
@GetMapping(value = "/{id}")
public RaceScoringRuleVO detail(@PathVariable("id") Long id) {
return this.scoreRuleService.detail(id);
}
/**
* 分页
*
* @param query
* @return
*/
@GetMapping("/page")
public PageVO<RaceScoringRuleListVO> page(TaskRuleQueryVO query) {
return this.scoreRuleService.page(query);
}
/**
* 删除
*
* @param id
*/
@DeleteMapping("{id}")
public void delete(@PathVariable("id") Long id) {
this.scoreRuleService.delete(id);

View File

@ -28,7 +28,7 @@ public class RaceSeasonController {
private RaceSeasonService raceSeasonService;
/**
* 添加编辑
* 添加
*
* @param dto
* @param user
@ -38,6 +38,13 @@ public class RaceSeasonController {
this.raceSeasonService.save(dto, user);
}
/**
* 修改
*
* @param id
* @param dto
* @param user
*/
@PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RaceSeasonCreateVO dto, @RequestAttribute AccountVO user) {
this.raceSeasonService.update(id, dto, user);
@ -55,6 +62,11 @@ public class RaceSeasonController {
return raceSeasonService.page(query);
}
/**
* 删除
*
* @param id
*/
//绑定过的数据不能删除没有绑定的可以删除物理删除
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {

View File

@ -47,23 +47,44 @@ public class RaceTaskController {
}
//返回基本信息id,name
/**
* 返回任务数据以""的结构
*
* @return
*/
@GetMapping("/tree")
public List<RaceTaskTreeVO> tree() {
return this.taskService.tree();
}
/**
* 删除
*
* @param id
*/
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {
this.taskService.delete(id);
}
/**
* 获取一个节点下的所有数据
*
* @param id
* @return
*/
@GetMapping("/{id}/children")
public List<RaceTaskTreeVO> childList(@PathVariable("id") Long id) {
return this.taskService.findChildren(id);
}
/**
* 获取一个节点的明细
*
* @param id
* @return
*/
@GetMapping("/{id}")
public RaceTaskDetailVO detail(@PathVariable("id") Long id) {
return this.taskService.detail(id);

View File

@ -205,6 +205,13 @@ public class RacePaperService {
return modultTask.build();
}
/**
* 获取模块下的所有数据包括""
*
* @param groupList
* @param allTaskMapList
* @return
*/
private List<RaceTaskChildVO> singleTreeConvertModuleGroup(List<RacePaperModuleVO.Group> groupList, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<RaceTaskChildVO> groups = new ArrayList<>();
for (RacePaperModuleVO.Group group : groupList) {
@ -224,43 +231,13 @@ public class RacePaperService {
return groups;
}
/* public RacePaperModuleTask paperModuleTask(Long paperId, Integer moduleId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(moduleId), "请选择对应的模型");
RacePaperDetailVO detailVO = this.detail(paperId);
RacePaperModuleVO moduleVO = detailVO.getModuleVo();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(moduleVO.getModulesList()), "此试卷没有模块数据");
PaperModule pm = moduleVO.getModulesList().stream().filter(d -> d.getCustomModuleId() == moduleId).findFirst().orElse(null);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(pm), "没有找到对应的模块");
List<Long> allGroupTaskIds = this.collectAllTaskIds(pm.getGroupList());
Map<Long, List<RaceTaskDetailDTO>> taskMapList = this.taskService.recursiveFindTask(allGroupTaskIds);
RacePaperModuleTask.Builder modultTask = RacePaperModuleTask.newBuilder();
modultTask.setCustomModuleId(pm.getCustomModuleId());
List<PaperModuleGroup> convertGroupList = this.convertModuleGroup(pm.getGroupList(), taskMapList);
modultTask.addAllModuleGroup(convertGroupList);
return modultTask.build();
}*/
/*
private List<PaperModuleGroup> convertModuleGroup(List<RacePaperModuleVO.Group> groupList, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<PaperModuleGroup> groups = new ArrayList<>();
for (RacePaperModuleVO.Group group : groupList) {
PaperModuleGroup.Builder groupBuilder = PaperModuleGroup.newBuilder();
groupBuilder.setGroupName(group.getName());
for (Long taskId : group.getTaskIdsList()) {
RaceTaskChildVO taskVO = this.findTask(taskId, allTaskMapList);
groupBuilder.addTreeData(taskVO);
}
if (!CollectionUtils.isEmpty(group.getGroupList())) {
List<PaperModuleGroup> childGroup = this.convertModuleGroup(group.getGroupList(), allTaskMapList);
groupBuilder.addAllModuleGroup(childGroup);
}
groups.add(groupBuilder.build());
}
return groups;
}
*/
/**
* 获取任务树的根节点
*
* @param taskId
* @param allTaskMapList
* @return
*/
private RaceTaskChildVO findTask(Long taskId, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<RaceTaskDetailDTO> dtoList = allTaskMapList.get(RaceTaskService.TASK_ROOT_ID);
RaceTaskDetailDTO taskDto = dtoList.stream().filter(d -> Objects.equals(d.getId(), taskId)).findFirst().orElse(null);
@ -270,6 +247,13 @@ public class RacePaperService {
return vo.build();
}
/**
* 获取任务树的所有子节点
*
* @param vob
* @param allTaskMapList
*/
private void findChildTask(RaceTaskChildVO.Builder vob, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<RaceTaskDetailDTO> childDto = allTaskMapList.get(vob.getId());
if (!CollectionUtils.isEmpty(childDto)) {
@ -307,6 +291,12 @@ public class RacePaperService {
}
/**
* 收集模块及子模块所有的任务id
*
* @param groupList
* @return
*/
private List<Long> collectAllTaskIds(List<RacePaperModuleVO.Group> groupList) {
List<Long> allTaskIds = Lists.newArrayList();
for (RacePaperModuleVO.Group group : groupList) {
@ -315,6 +305,12 @@ public class RacePaperService {
return allTaskIds.stream().distinct().collect(Collectors.toList());
}
/**
* 收集所有子级任务ID
*
* @param group
* @param collectorList
*/
private void collectTaskIds(RacePaperModuleVO.Group group, List<Long> collectorList) {
collectorList.addAll(group.getTaskIdsList());
if (!CollectionUtils.isEmpty(group.getGroupList())) {
@ -322,6 +318,5 @@ public class RacePaperService {
this.collectTaskIds(group1, collectorList);
}
}
}
}

View File

@ -180,6 +180,12 @@ public class RaceTaskService {
}
}
/**
* 递归查找taskId下相关的所有数据
*
* @param taskIds
* @return
*/
public Map<Long, List<RaceTaskDetailDTO>> recursiveFindTask(List<Long> taskIds) {
List<RaceTaskDetailDTO> taskDtoList = this.raceTaskDAO.recursiveFindTask(taskIds);
Map<Long, List<RaceTaskDetailDTO>> dtoMapList = taskDtoList.stream().collect(Collectors.groupingBy(RaceTaskDetailDTO::getParentId));