Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
tiger_zhou 2024-03-04 14:39:22 +08:00
commit 7fb4199e1b
17 changed files with 2991 additions and 685 deletions

@ -1 +1 @@
Subproject commit 72be1cb35325478a4c996d7e4f747abde44745b3 Subproject commit 4ed56c6655935a7cbc3dd9edbb3468a96c875ffd

View File

@ -0,0 +1,73 @@
package club.joylink.rtss.bo.race;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.race.RaceApplication;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode.Builder;
import club.joylink.rtss.vo.race.RaceTask;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO.ChildNodeType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class RaceContent {
private long userId;
private long paperId;
private int moduleId;
/**
* 训练使用到的任务树
*/
private RaceTask.RacePaperSingleModuleGroupTask taskTree;
/**
* 训练结果
*/
private RaceApplication.RacePracticeResult.Builder result;
/**
* 结果节点映射仅为了通过ID找节点
*/
private Map<Long, Builder> resultNodeMap = new HashMap<>();
public RaceContent(long userId, long paperId, int moduleId,
RacePaperSingleModuleGroupTask taskTree) {
this.userId = userId;
this.paperId = paperId;
this.moduleId = moduleId;
this.taskTree = taskTree;
this.result = RaceApplication.RacePracticeResult.newBuilder();
result.setCustomModuleId(taskTree.getCustomModuleId());
List<Builder> nodeBuilderList = result.getNodeBuilderList();
buildResultNodeTree(taskTree.getChildList(), nodeBuilderList);
}
public Builder getResultNode(long taskId) {
Builder builder = resultNodeMap.get(taskId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(builder,
String.format("任务[%d]不存在", taskId));
return builder;
}
private void buildResultNodeTree(List<RaceTaskChildVO> childrenList,
List<Builder> nodeBuilderList) {
for (RaceTaskChildVO childVO : childrenList) {
//构建对应的结果Node
Builder nodeBuilder = ResultNode.newBuilder();
nodeBuilder.setName(childVO.getName());
nodeBuilder.setType(childVO.getNodeType());
nodeBuilderList.add(nodeBuilder);
//构建任务映射
if (ChildNodeType.TASK == childVO.getNodeType()) {
resultNodeMap.put(childVO.getId(), nodeBuilder);
}
//递归
buildResultNodeTree(childVO.getChildrenList(), nodeBuilder.getChildBuilderList());
}
}
}

View File

@ -1,6 +1,18 @@
package club.joylink.rtss.controller.racetr; package club.joylink.rtss.controller.racetr;
import org.springframework.web.bind.annotation.*; import club.joylink.rtss.services.race.RaceApplicationService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.race.RaceApplication;
import club.joylink.rtss.vo.race.RaceTaskFinishParamDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 赛题训练接口 * 赛题训练接口
@ -8,59 +20,66 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("/api/race") @RequestMapping("/api/race")
public class RaceApplicationController { public class RaceApplicationController {
/**
* 开始训练
*
* @param paperId 赛题ID
* @return 训练的信息
*/
@PostMapping("/{paperId}")
public Object start(@PathVariable long paperId) {
//暂时就用用户id作为竞赛上下文的id也就是说一个用户同时只能开一个竞赛
return null;
}
/** private RaceApplicationService raceApplicationService;
* 加载场景
*
* @param simulationId 场景依托的仿真
* @param sceneId 场景的ID
*/
@PutMapping("/{simulationId}/{sceneId}/load")
public void loadScene(@PathVariable String simulationId, @PathVariable String sceneId) {
} /**
* 开始训练
* <p>
* 目前用用户id作为训练上下文的ID即用户同时进行一个训练
*
* @param paperId 赛题ID
* @return 训练的信息
*/
@PostMapping("/{paperId}/{moduleId}")
public Object start(@PathVariable long paperId, @PathVariable int moduleId,
@RequestAttribute AccountVO user) {
return raceApplicationService.start(paperId, moduleId, user.getId());
}
/** /**
* 完成任务 * 加载场景
* *
* @param taskId 任务ID * @param simulationId 场景依托的仿真
* @param record 任务记录需要前端进行判定的操作的记录 * @param sceneId 场景的ID
*/ */
@PutMapping("/{taskId}/finish") @PutMapping("/{simulationId}/load/{sceneId}")
public void finishTask(@PathVariable long taskId, @RequestBody Object record) { public void loadScene(@PathVariable String simulationId, @PathVariable long sceneId,
@RequestAttribute LoginUserInfoVO loginInfo) {
raceApplicationService.loadScene(simulationId, sceneId, loginInfo);
}
} /**
* 完成任务
*
* @param taskId 任务ID
* @param paramDTO 完成任务所需的参数主要就是需要前端做判定的操作/步骤
*/
@PutMapping("/{taskId}/finish")
public void finishTask(@PathVariable long taskId, @RequestBody RaceTaskFinishParamDTO paramDTO,
@RequestAttribute AccountVO user) {
raceApplicationService.finishTask(taskId, paramDTO, user);
}
/** /**
* 完成训练 * 完成训练
* *
* @return 评分结果 * @return 评分结果
*/ */
public Object finish() { public RaceApplication.RacePracticeResult finish(@RequestAttribute AccountVO user) {
return null; return raceApplicationService.finish(user.getId());
} }
/** /**
* 获取用户正在进行的竞赛信息 * 获取用户正在进行的竞赛信息
* <p> * <p>
* 目前想到的使用场景就是页面刷新后 * 目前想到的使用场景就是页面刷新后
* *
* @return 竞赛信息 * @return 竞赛信息
*/ */
@GetMapping("") @GetMapping("")
public Object getRaceInfo() { public Object getRaceInfo() {
return null; return null;
} }
} }

View File

@ -48,7 +48,8 @@ public class RacePaperController {
* @param user * @param user
*/ */
@PostMapping("/{id}") @PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RacePaperCreateVO updateVO, @RequestAttribute AccountVO user) { public void update(@PathVariable("id") Long id, @RequestBody RacePaperCreateVO updateVO,
@RequestAttribute AccountVO user) {
this.racePaperService.update(id, updateVO, user); this.racePaperService.update(id, updateVO, user);
} }
@ -68,7 +69,8 @@ public class RacePaperController {
* @param user * @param user
*/ */
@PostMapping("/{id}/config") @PostMapping("/{id}/config")
public void configSeting(@PathVariable("id") Long id, @RequestBody RacePaperModuleVO moduleVO, @RequestAttribute AccountVO user) { public void configSeting(@PathVariable("id") Long id, @RequestBody RacePaperModuleVO moduleVO,
@RequestAttribute AccountVO user) {
this.racePaperService.configSeting(id, moduleVO, user); this.racePaperService.configSeting(id, moduleVO, user);
} }
@ -112,7 +114,8 @@ public class RacePaperController {
*/ */
@GetMapping("/{paperId}/module/{moduleId}/task") @GetMapping("/{paperId}/module/{moduleId}/task")
public RacePaperSingleModuleGroupTask paperModuleTask(@PathVariable("paperId") Long id, @PathVariable("moduleId") Integer moduleId) { public RacePaperSingleModuleGroupTask paperModuleTask(@PathVariable("paperId") Long id,
@PathVariable("moduleId") Integer moduleId) {
return this.racePaperService.singlePaperModuleTask(id, moduleId); return this.racePaperService.singlePaperModuleTask(id, moduleId);
} }

View File

@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -37,12 +36,14 @@ public class RaceTaskController {
} }
@PostMapping("/{id}") @PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RaceTaskCreateVO vo, @RequestAttribute AccountVO user) { public void update(@PathVariable("id") Long id, @RequestBody RaceTaskCreateVO vo,
@RequestAttribute AccountVO user) {
this.taskService.update(id, vo, user); this.taskService.update(id, vo, user);
} }
@PostMapping("/{taskId}/bind") @PostMapping("/{taskId}/bind")
public void bind(@PathVariable("taskId") Long taskId, @RequestBody List<RaceTaskBind> bind, @RequestAttribute AccountVO user) { public void bind(@PathVariable("taskId") Long taskId, @RequestBody List<RaceTaskBind> bind,
@RequestAttribute AccountVO user) {
this.taskService.bind(taskId, bind, user); this.taskService.bind(taskId, bind, user);
} }

View File

@ -0,0 +1,118 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.bo.race.RaceContent;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training2.Training2Service;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
import club.joylink.rtss.vo.race.RaceApplication.RacePracticeResult;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode.Builder;
import club.joylink.rtss.vo.race.RaceSceneOuterClass;
import club.joylink.rtss.vo.race.RaceTask;
import club.joylink.rtss.vo.race.RaceTaskFinishParamDTO;
import club.joylink.rtss.websocket.StompMessageService;
import com.google.protobuf.InvalidProtocolBufferException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class RaceApplicationService {
private RacePaperService racePaperService;
private GroupSimulationService groupSimulationService;
private MemberManager memberManager;
private SimulationLifeCycleService simulationLifeCycleService;
private ApplicationContext applicationContext;
private StompMessageService stompMessageService;
private Training2Service training2Service;
private RaceSceneService raceSceneService;
private static final Map<Long, RaceContent> raceContentMap = new HashMap<>();
/**
* 开始训练
*
* @return 模块任务树
*/
public RaceTask.RacePaperSingleModuleGroupTask start(long paperId, int moduleId, long userId) {
RaceContent content = new RaceContent(userId, paperId, moduleId,
racePaperService.singlePaperModuleTask(paperId, moduleId));
RaceContent oldContent = raceContentMap.put(userId, content);
if (oldContent != null) {
log.info("用户[%d]开始了[赛题:{}|模块:{}]的训练,并且覆盖了就训练", paperId, moduleId);
} else {
log.info("用户[%d]开始了[赛题:{}|模块:{}]的训练", paperId, moduleId);
}
return content.getTaskTree();
}
public void loadScene(String simulationId, long sceneId, LoginUserInfoVO loginInfo) {
RaceContent content = getContent(loginInfo.getAccountVO().getId());
//获取场景数据
RaceSceneOuterClass.StorageSimulation scene;
try {
scene = RaceSceneOuterClass.Scene
.parseFrom(raceSceneService.findById(sceneId).getProto()).getStorageSimulation();
} catch (InvalidProtocolBufferException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("场景数据解析出错", e);
}
//场景数据转实训数据
DraftTraining2WithBLOBs draftTraining2 = new DraftTraining2WithBLOBs();
draftTraining2.setBgSceneJson(scene.getBgSceneJson());
// draftTraining2.setOperaJson(scene.get); operaJson没了
draftTraining2.setStepJson(scene.getStepJson());
draftTraining2.setScoringRuleJson(scene.getScoringRuleJson());
draftTraining2.setMemberJson(scene.getMemberJson());
draftTraining2.setPlayerIdJson(JsonUtils.writeValueAsString(scene.getPlayerIdsList()));
// draftTraining2.setClient(scene); client没了
training2Service.trainingDataValid.accept(draftTraining2);
//加载实训
training2Service.simulationLoadTraining(simulationId, draftTraining2, loginInfo);
}
public void finishTask(long taskId, RaceTaskFinishParamDTO paramDTO, AccountVO user) {
if (paramDTO == null) {
return;
}
RaceContent content = getContent(user.getId());
List<PaperTrainAnswerDetail> result = training2Service.finishTraining2(
paramDTO.getSimulationId(), user, paramDTO.getScoreList());
Builder resultNode = content.getResultNode(taskId);
int fullScore = 0;
int score = 0;
for (PaperTrainAnswerDetail paperTrainAnswerDetail : result) {
fullScore += paperTrainAnswerDetail.getRuleScore();
score += paperTrainAnswerDetail.getScore();
}
resultNode.setFullScore(fullScore);
resultNode.setScore(score);
}
public RacePracticeResult finish(long userId) {
RaceContent content = getContent(userId);
RacePracticeResult result = content.getResult().build();
raceContentMap.remove(userId);
log.info("用户[{}]完成[赛题:{} | 模块:{}]", userId, content.getPaperId(),
content.getModuleId());
return result;
}
private RaceContent getContent(long userId) {
RaceContent content = raceContentMap.get(userId);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(content,
String.format("未找到用户[%d]的训练上下文", userId));
return content;
}
}

View File

@ -4,12 +4,10 @@ import club.joylink.rtss.dao.racetr.RacetrTaskDAO;
import club.joylink.rtss.entity.racetr.RacetrTask; import club.joylink.rtss.entity.racetr.RacetrTask;
import club.joylink.rtss.entity.racetr.RacetrTaskExample; import club.joylink.rtss.entity.racetr.RacetrTaskExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO; import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind; import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind.TaskBindType; import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind.TaskBindType;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskCreateVO; import club.joylink.rtss.vo.race.RaceTask.RaceTaskCreateVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskDetailVO; import club.joylink.rtss.vo.race.RaceTask.RaceTaskDetailVO;
import club.joylink.rtss.vo.race.RaceTaskDetailDTO; import club.joylink.rtss.vo.race.RaceTaskDetailDTO;
@ -40,14 +38,17 @@ public class RaceTaskService {
private RacetrTask findById(Long id) { private RacetrTask findById(Long id) {
RacetrTask task = this.raceTaskDAO.selectByPrimaryKey(id); RacetrTask task = this.raceTaskDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task), "没有找到对应的任务"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task),
"没有找到对应的任务");
return task; return task;
} }
public RaceTaskDetailVO detail(Long id) { public RaceTaskDetailVO detail(Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id), "请选择对应的任务"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),
"请选择对应的任务");
RaceTaskDetailDTO task = this.raceTaskDAO.details(id); RaceTaskDetailDTO task = this.raceTaskDAO.details(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task), "未找到对应的任务数据"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task),
"未找到对应的任务数据");
RaceTaskDetailVO.Builder vo = RaceTaskDetailVO.newBuilder(); RaceTaskDetailVO.Builder vo = RaceTaskDetailVO.newBuilder();
vo.setId(task.getId()); vo.setId(task.getId());
@ -56,7 +57,9 @@ public class RaceTaskService {
vo.setContent(task.getContent()); vo.setContent(task.getContent());
vo.setStandards(task.getStandards()); vo.setStandards(task.getStandards());
vo.setParentId(task.getParentId()); vo.setParentId(task.getParentId());
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(task.getCreatorId(), task.getCreatorName(), task.getUpdaterId(), task.getUpdaterName(), task.getCreateTime(), task.getUpdateTime()); ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(task.getCreatorId(),
task.getCreatorName(), task.getUpdaterId(), task.getUpdaterName(), task.getCreateTime(),
task.getUpdateTime());
vo.setModifyInfo(modifyInfoVO); vo.setModifyInfo(modifyInfoVO);
if (Objects.nonNull(task.getSceneId())) { if (Objects.nonNull(task.getSceneId())) {
vo.setSceneId(task.getSceneId()); vo.setSceneId(task.getSceneId());
@ -97,11 +100,14 @@ public class RaceTaskService {
} }
public void bind(Long taskId, List<RaceTaskBind> bind, AccountVO user) { public void bind(Long taskId, List<RaceTaskBind> bind, AccountVO user) {
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(bind), "请选择要绑定的数据"); BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(bind),
"请选择要绑定的数据");
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bind.size() <= 2, "最多绑定只能选择2个类型"); BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bind.size() <= 2, "最多绑定只能选择2个类型");
if (bind.size() > 1) { if (bind.size() > 1) {
List<TaskBindType> bindTypes = bind.stream().map(RaceTaskBind::getBindType).distinct().collect(Collectors.toList()); List<TaskBindType> bindTypes = bind.stream().map(RaceTaskBind::getBindType).distinct()
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bindTypes.size() != 1, "最多绑定只能选择2个类型"); .collect(Collectors.toList());
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bindTypes.size() != 1,
"最多绑定只能选择2个类型");
} }
RacetrTask task = this.findById(taskId); RacetrTask task = this.findById(taskId);
@ -130,7 +136,8 @@ public class RaceTaskService {
public List<RaceTaskTreeVO> tree() { public List<RaceTaskTreeVO> tree() {
List<RacetrTask> taskList = this.raceTaskDAO.selectByExample(null); List<RacetrTask> taskList = this.raceTaskDAO.selectByExample(null);
Map<Long, List<RaceTaskTreeVO>> mapList = taskList.stream().map(RaceTaskTreeVO::new).collect(Collectors.groupingBy(RaceTaskTreeVO::getParentId)); Map<Long, List<RaceTaskTreeVO>> mapList = taskList.stream().map(RaceTaskTreeVO::new)
.collect(Collectors.groupingBy(RaceTaskTreeVO::getParentId));
List<RaceTaskTreeVO> rootTaskList = mapList.get(TASK_ROOT_ID); List<RaceTaskTreeVO> rootTaskList = mapList.get(TASK_ROOT_ID);
if (CollectionUtils.isEmpty(rootTaskList)) { if (CollectionUtils.isEmpty(rootTaskList)) {
return Collections.emptyList(); return Collections.emptyList();
@ -163,7 +170,8 @@ public class RaceTaskService {
List<RaceTaskTreeVO> collection = Lists.newArrayList(new RaceTaskTreeVO(rt)); List<RaceTaskTreeVO> collection = Lists.newArrayList(new RaceTaskTreeVO(rt));
this.collectAllChildren(rt.getId(), collection); this.collectAllChildren(rt.getId(), collection);
List<Long> deleteIds = collection.stream().map(RaceTaskTreeVO::getId).distinct().collect(Collectors.toList()); List<Long> deleteIds = collection.stream().map(RaceTaskTreeVO::getId).distinct()
.collect(Collectors.toList());
log.info("删除任务[{}] 对应所有的子节点id[{}]", id, deleteIds); log.info("删除任务[{}] 对应所有的子节点id[{}]", id, deleteIds);
RacetrTaskExample example = new RacetrTaskExample(); RacetrTaskExample example = new RacetrTaskExample();
example.createCriteria().andIdIn(deleteIds); example.createCriteria().andIdIn(deleteIds);
@ -188,7 +196,8 @@ public class RaceTaskService {
*/ */
public Map<Long, List<RaceTaskDetailDTO>> recursiveFindTask(List<Long> taskIds) { public Map<Long, List<RaceTaskDetailDTO>> recursiveFindTask(List<Long> taskIds) {
List<RaceTaskDetailDTO> taskDtoList = this.raceTaskDAO.recursiveFindTask(taskIds); List<RaceTaskDetailDTO> taskDtoList = this.raceTaskDAO.recursiveFindTask(taskIds);
Map<Long, List<RaceTaskDetailDTO>> dtoMapList = taskDtoList.stream().collect(Collectors.groupingBy(RaceTaskDetailDTO::getParentId)); Map<Long, List<RaceTaskDetailDTO>> dtoMapList = taskDtoList.stream()
.collect(Collectors.groupingBy(RaceTaskDetailDTO::getParentId));
return dtoMapList; return dtoMapList;
} }
} }

View File

@ -637,7 +637,7 @@ public class Training2Service {
/** /**
* 仿真加载实训 初始化仿真 - 替换实训信息 - 加载背景 * 仿真加载实训 初始化仿真 - 替换实训信息 - 加载背景
*/ */
private void simulationLoadTraining(String group, DraftTraining2WithBLOBs draftTraining2, public void simulationLoadTraining(String group, DraftTraining2WithBLOBs draftTraining2,
LoginUserInfoVO loginUserInfoVO) { LoginUserInfoVO loginUserInfoVO) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
// 重置仿真状态 // 重置仿真状态
@ -931,7 +931,7 @@ public class Training2Service {
/** /**
* 检验实训数据是否合规 * 检验实训数据是否合规
*/ */
private Consumer<DraftTraining2WithBLOBs> trainingDataValid = (training) -> { public Consumer<DraftTraining2WithBLOBs> trainingDataValid = (training) -> {
if (!StringUtils.hasText(training.getPlayerIdJson())) { if (!StringUtils.hasText(training.getPlayerIdJson())) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation throw new SimulationException(SimulationExceptionType.Invalid_Operation
, String.format("实训{id:[%s]}没有参训角色", training.getId())); , String.format("实训{id:[%s]}没有参训角色", training.getId()));

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: modify_info.proto // source: common/modify_info.proto
package club.joylink.rtss.vo.common; package club.joylink.rtss.vo.common;
@ -1146,12 +1146,12 @@ public final class ModifyInfo {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\021modify_info.proto\022\006common\"\214\001\n\014ModifyIn" + "\n\030common/modify_info.proto\022\006common\"\214\001\n\014M" +
"foVO\022\022\n\ncreator_id\030\001 \001(\003\022\023\n\013create_time\030" + "odifyInfoVO\022\022\n\ncreator_id\030\001 \001(\003\022\023\n\013creat" +
"\002 \001(\t\022\022\n\nupdater_id\030\003 \001(\003\022\023\n\013update_time" + "e_time\030\002 \001(\t\022\022\n\nupdater_id\030\003 \001(\003\022\023\n\013upda" +
"\030\004 \001(\t\022\024\n\014creator_name\030\005 \001(\t\022\024\n\014updater_" + "te_time\030\004 \001(\t\022\024\n\014creator_name\030\005 \001(\t\022\024\n\014u" +
"name\030\006 \001(\tB\035\n\033club.joylink.rtss.vo.commo" + "pdater_name\030\006 \001(\tB\035\n\033club.joylink.rtss.v" +
"nb\006proto3" "o.commonb\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: page_query.proto // source: common/page_query.proto
package club.joylink.rtss.vo.common; package club.joylink.rtss.vo.common;
@ -552,9 +552,9 @@ public final class PageQuery {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\020page_query.proto\022\006common\")\n\013PageQueryV" + "\n\027common/page_query.proto\022\006common\")\n\013Pag" +
"O\022\014\n\004page\030\001 \001(\005\022\014\n\004size\030\002 \001(\005B\035\n\033club.jo" + "eQueryVO\022\014\n\004page\030\001 \001(\005\022\014\n\004size\030\002 \001(\005B\035\n\033" +
"ylink.rtss.vo.commonb\006proto3" "club.joylink.rtss.vo.commonb\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race_module.proto // source: race/race_module.proto
package club.joylink.rtss.vo.race; package club.joylink.rtss.vo.race;
@ -5593,23 +5593,23 @@ public final class RaceModule {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\021race_module.proto\022\004race\032\030common/modify" + "\n\026race/race_module.proto\022\004race\032\030common/m" +
"_info.proto\"\256\001\n\014RaceModuleVO\022\n\n\002id\030\001 \001(\003" + "odify_info.proto\"\256\001\n\014RaceModuleVO\022\n\n\002id\030" +
"\022\014\n\004code\030\003 \001(\t\022\014\n\004desc\030\004 \001(\t\022\020\n\010paper_id" + "\001 \001(\003\022\014\n\004code\030\003 \001(\t\022\014\n\004desc\030\004 \001(\t\022\020\n\010pap" +
"\030\005 \001(\003\022\'\n\014task_setting\030\006 \001(\0132\021.race.Task" + "er_id\030\005 \001(\003\022\'\n\014task_setting\030\006 \001(\0132\021.race" +
"Setting\022\020\n\010duration\030\007 \001(\005\022)\n\013modify_info" + ".TaskSetting\022\020\n\010duration\030\007 \001(\005\022)\n\013modify" +
"\030\010 \001(\0132\024.common.ModifyInfoVO\"\235\001\n\020RaceMod" + "_info\030\010 \001(\0132\024.common.ModifyInfoVO\"\235\001\n\020Ra" +
"uleListVO\022\n\n\002id\030\001 \001(\003\022\014\n\004code\030\003 \001(\t\022\014\n\004d" + "ceModuleListVO\022\n\n\002id\030\001 \001(\003\022\014\n\004code\030\003 \001(\t" +
"esc\030\004 \001(\t\022\020\n\010paper_id\030\005 \001(\003\022\022\n\npaper_nam" + "\022\014\n\004desc\030\004 \001(\t\022\020\n\010paper_id\030\005 \001(\003\022\022\n\npape" +
"e\030\006 \001(\t\022\020\n\010duration\030\007 \001(\005\022)\n\013modify_info" + "r_name\030\006 \001(\t\022\020\n\010duration\030\007 \001(\005\022)\n\013modify" +
"\030\010 \001(\0132\024.common.ModifyInfoVO\"T\n\022RaceModu" + "_info\030\010 \001(\0132\024.common.ModifyInfoVO\"T\n\022Rac" +
"leCreateVO\022\014\n\004code\030\001 \001(\t\022\014\n\004desc\030\002 \001(\t\022\020" + "eModuleCreateVO\022\014\n\004code\030\001 \001(\t\022\014\n\004desc\030\002 " +
"\n\010paper_id\030\003 \001(\003\022\020\n\010duration\030\004 \001(\005\"\206\001\n\013T" + "\001(\t\022\020\n\010paper_id\030\003 \001(\003\022\020\n\010duration\030\004 \001(\005\"" +
"askSetting\022&\n\005group\030\002 \003(\0132\027.race.TaskSet" + "\206\001\n\013TaskSetting\022&\n\005group\030\002 \003(\0132\027.race.Ta" +
"ting.Group\032O\n\005Group\022\020\n\010task_ids\030\001 \003(\003\022&\n" + "skSetting.Group\032O\n\005Group\022\020\n\010task_ids\030\001 \003" +
"\005group\030\002 \003(\0132\027.race.TaskSetting.Group\022\014\n" + "(\003\022&\n\005group\030\002 \003(\0132\027.race.TaskSetting.Gro" +
"\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo.race" + "up\022\014\n\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo" +
"b\006proto3" ".raceb\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race_paper.proto // source: race/race_paper.proto
package club.joylink.rtss.vo.race; package club.joylink.rtss.vo.race;
@ -6875,29 +6875,29 @@ public final class RacePaper {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\020race_paper.proto\022\004race\032\030common/modify_" + "\n\025race/race_paper.proto\022\004race\032\030common/mo" +
"info.proto\032\026race/race_season.proto\"\257\001\n\013R" + "dify_info.proto\032\026race/race_season.proto\"" +
"acePaperVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004" + "\257\001\n\013RacePaperVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(" +
"desc\030\003 \001(\t\022\021\n\tseason_id\030\005 \001(\003\022\023\n\013season_" + "\t\022\014\n\004desc\030\003 \001(\t\022\021\n\tseason_id\030\005 \001(\003\022\023\n\013se" +
"name\030\006 \001(\t\022)\n\013modify_info\030\010 \001(\0132\024.common" + "ason_name\030\006 \001(\t\022)\n\013modify_info\030\010 \001(\0132\024.c" +
".ModifyInfoVO\022%\n\005group\030\t \001(\0162\026.race.Race" + "ommon.ModifyInfoVO\022%\n\005group\030\t \001(\0162\026.race" +
"Season.Group\"\320\001\n\021RacePaperDetailVO\022\n\n\002id" + ".RaceSeason.Group\"\320\001\n\021RacePaperDetailVO\022" +
"\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 \001(\t\022*\n\tmo" + "\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 \001(\t\022" +
"dule_vo\030\004 \001(\0132\027.race.RacePaperModuleVO\022\021" + "*\n\tmodule_vo\030\004 \001(\0132\027.race.RacePaperModul" +
"\n\tseason_id\030\005 \001(\003\022\023\n\013season_name\030\006 \001(\t\022\024" + "eVO\022\021\n\tseason_id\030\005 \001(\003\022\023\n\013season_name\030\006 " +
"\n\014support_copy\030\007 \001(\010\022)\n\013modify_info\030\010 \001(" + "\001(\t\022\024\n\014support_copy\030\007 \001(\010\022)\n\013modify_info" +
"\0132\024.common.ModifyInfoVO\"B\n\021RacePaperCrea" + "\030\010 \001(\0132\024.common.ModifyInfoVO\"B\n\021RacePape" +
"teVO\022\014\n\004name\030\001 \001(\t\022\014\n\004desc\030\002 \001(\t\022\021\n\tseas" + "rCreateVO\022\014\n\004name\030\001 \001(\t\022\014\n\004desc\030\002 \001(\t\022\021\n" +
"on_id\030\003 \001(\003\"\275\002\n\021RacePaperModuleVO\0224\n\007mod" + "\tseason_id\030\003 \001(\003\"\275\002\n\021RacePaperModuleVO\0224" +
"ules\030\001 \003(\0132#.race.RacePaperModuleVO.Pape" + "\n\007modules\030\001 \003(\0132#.race.RacePaperModuleVO" +
"rModule\032\232\001\n\013PaperModule\022\023\n\013module_name\030\001" + ".PaperModule\032\232\001\n\013PaperModule\022\023\n\013module_n" +
" \001(\t\022\020\n\010duration\030\002 \001(\005\022,\n\005group\030\003 \003(\0132\035." + "ame\030\001 \001(\t\022\020\n\010duration\030\002 \001(\005\022,\n\005group\030\003 \003" +
"race.RacePaperModuleVO.Group\022\034\n\024module_s" + "(\0132\035.race.RacePaperModuleVO.Group\022\034\n\024mod" +
"core_rule_id\030\004 \001(\003\022\030\n\020custom_module_id\030\005" + "ule_score_rule_id\030\004 \001(\003\022\030\n\020custom_module" +
" \001(\005\032U\n\005Group\022\020\n\010task_ids\030\001 \003(\003\022,\n\005group" + "_id\030\005 \001(\005\032U\n\005Group\022\020\n\010task_ids\030\001 \003(\003\022,\n\005" +
"\030\002 \003(\0132\035.race.RacePaperModuleVO.Group\022\014\n" + "group\030\002 \003(\0132\035.race.RacePaperModuleVO.Gro" +
"\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo.race" + "up\022\014\n\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo" +
"b\006proto3" ".raceb\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race_scene.proto // source: race/race_scene.proto
package club.joylink.rtss.vo.race; package club.joylink.rtss.vo.race;
@ -5593,26 +5593,26 @@ public final class RaceSceneOuterClass {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\020race_scene.proto\022\004race\032\030common/modify_" + "\n\025race/race_scene.proto\022\004race\032\030common/mo" +
"info.proto\"\305\001\n\013RaceSceneVO\022\n\n\002id\030\001 \001(\003\022\014" + "dify_info.proto\"\305\001\n\013RaceSceneVO\022\n\n\002id\030\001 " +
"\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.RaceSc" + "\001(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.R" +
"ene.Type\022\022\n\nfunctionId\030\004 \001(\003\022\032\n\005scene\030\005 " + "aceScene.Type\022\022\n\nfunctionId\030\004 \001(\003\022\032\n\005sce" +
"\001(\0132\013.race.Scene\022(\n\nmodifyInfo\030\006 \001(\0132\024.c" + "ne\030\005 \001(\0132\013.race.Scene\022(\n\nmodifyInfo\030\006 \001(" +
"ommon.ModifyInfoVO\022\r\n\005mapId\030\007 \001(\003\022\017\n\007map" + "\0132\024.common.ModifyInfoVO\022\r\n\005mapId\030\007 \001(\003\022\017" +
"Name\030\010 \001(\t\"\234\001\n\017RaceSceneListVO\022\n\n\002id\030\001 \001" + "\n\007mapName\030\010 \001(\t\"\234\001\n\017RaceSceneListVO\022\n\n\002i" +
"(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.Ra" + "d\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.ra" +
"ceScene.Type\022\016\n\006map_id\030\004 \001(\003\022\020\n\010map_name" + "ce.RaceScene.Type\022\016\n\006map_id\030\004 \001(\003\022\020\n\010map" +
"\030\005 \001(\t\022)\n\013modify_info\030\006 \001(\0132\024.common.Mod" + "_name\030\005 \001(\t\022)\n\013modify_info\030\006 \001(\0132\024.commo" +
"ifyInfoVO\"3\n\022RaceScenePublishVO\022\017\n\007dafit" + "n.ModifyInfoVO\"3\n\022RaceScenePublishVO\022\017\n\007" +
"id\030\001 \001(\003\022\014\n\004name\030\003 \001(\t\"I\n\005Scene\022\013\n\003url\030\001" + "dafitid\030\001 \001(\003\022\014\n\004name\030\003 \001(\t\"I\n\005Scene\022\013\n\003" +
" \001(\t\0223\n\022storage_simulation\030\002 \001(\0132\027.race." + "url\030\001 \001(\t\0223\n\022storage_simulation\030\002 \001(\0132\027." +
"StorageSimulation\"\201\001\n\021StorageSimulation\022" + "race.StorageSimulation\"\201\001\n\021StorageSimula" +
"\025\n\rbg_scene_json\030\001 \001(\t\022\021\n\tstep_json\030\002 \001(" + "tion\022\025\n\rbg_scene_json\030\001 \001(\t\022\021\n\tstep_json" +
"\t\022\023\n\013member_json\030\003 \001(\t\022\022\n\nplayer_ids\030\004 \003" + "\030\002 \001(\t\022\023\n\013member_json\030\003 \001(\t\022\022\n\nplayer_id" +
"(\t\022\031\n\021scoring_rule_json\030\005 \001(\t\"5\n\tRaceSce" + "s\030\004 \003(\t\022\031\n\021scoring_rule_json\030\005 \001(\t\"5\n\tRa" +
"ne\"(\n\004Type\022\013\n\007Unknown\020\000\022\t\n\005Local\020\001\022\010\n\004Li" + "ceScene\"(\n\004Type\022\013\n\007Unknown\020\000\022\t\n\005Local\020\001\022" +
"nk\020\002B\033\n\031club.joylink.rtss.vo.raceb\006proto" + "\010\n\004Link\020\002B\033\n\031club.joylink.rtss.vo.raceb\006" +
"3" "proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race_season.proto // source: race/race_season.proto
package club.joylink.rtss.vo.race; package club.joylink.rtss.vo.race;
@ -2495,16 +2495,16 @@ public final class RaceSeasonOuterClass {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\021race_season.proto\022\004race\032\030common/modify" + "\n\026race/race_season.proto\022\004race\032\030common/m" +
"_info.proto\"\210\001\n\014RaceSeasonVO\022\n\n\002id\030\001 \001(\003" + "odify_info.proto\"\210\001\n\014RaceSeasonVO\022\n\n\002id\030" +
"\022\014\n\004code\030\002 \001(\t\022%\n\005group\030\003 \001(\0162\026.race.Rac" + "\001 \001(\003\022\014\n\004code\030\002 \001(\t\022%\n\005group\030\003 \001(\0162\026.rac" +
"eSeason.Group\022\014\n\004term\030\004 \001(\t\022)\n\013modify_in" + "e.RaceSeason.Group\022\014\n\004term\030\004 \001(\t\022)\n\013modi" +
"fo\030\005 \001(\0132\024.common.ModifyInfoVO\"W\n\022RaceSe" + "fy_info\030\005 \001(\0132\024.common.ModifyInfoVO\"W\n\022R" +
"asonCreateVO\022\014\n\004code\030\001 \001(\t\022%\n\005group\030\002 \001(" + "aceSeasonCreateVO\022\014\n\004code\030\001 \001(\t\022%\n\005group" +
"\0162\026.race.RaceSeason.Group\022\014\n\004term\030\003 \001(\t\"" + "\030\002 \001(\0162\026.race.RaceSeason.Group\022\014\n\004term\030\003" +
"2\n\nRaceSeason\"$\n\005Group\022\013\n\007Unknown\020\000\022\006\n\002Z" + " \001(\t\"2\n\nRaceSeason\"$\n\005Group\022\013\n\007Unknown\020\000" +
"Z\020\001\022\006\n\002GZ\020\002B\033\n\031club.joylink.rtss.vo.race" + "\022\006\n\002ZZ\020\001\022\006\n\002GZ\020\002B\033\n\031club.joylink.rtss.vo" +
"b\006proto3" ".raceb\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,

View File

@ -0,0 +1,20 @@
package club.joylink.rtss.vo.race;
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
import java.util.List;
import lombok.Data;
/**
* 赛题训练任务完成接口的参数
* <p>
* 目前仅支持有本地场景的任务
*/
@Data
public class RaceTaskFinishParamDTO {
private String simulationId;
/**
* 实训评分参数与完成实训接口的参数相同
*/
private List<PaperTrainAnswerDetail> scoreList;
}