Merge branch 'test'

This commit is contained in:
thesai 2024-03-04 17:26:29 +08:00
commit deb7fa11fc
32 changed files with 4336 additions and 1114 deletions

@ -1 +1 @@
Subproject commit 64053645db2ecf352e7fdf8e4d19ec607d03c887
Subproject commit 4ed56c6655935a7cbc3dd9edbb3468a96c875ffd

View File

@ -0,0 +1,78 @@
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.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.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());
for (RaceTaskChildVO childVO : taskTree.getChildList()) {
Builder nodeBuilder = result.addNodeBuilder();
nodeBuilder.setName(childVO.getName());
nodeBuilder.setType(childVO.getNodeType());
//构建任务映射
if (ChildNodeType.TASK == childVO.getNodeType()) {
resultNodeMap.put(childVO.getId(), nodeBuilder);
}
//递归
buildResultNodeTree(childVO, nodeBuilder);
}
}
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(RaceTaskChildVO children, Builder parentNode) {
for (RaceTaskChildVO childVO : children.getChildrenList()) {
//构建对应的结果Node
Builder nodeBuilder = parentNode.addChildBuilder();
nodeBuilder.setName(childVO.getName());
nodeBuilder.setType(childVO.getNodeType());
//构建任务映射
if (ChildNodeType.TASK == childVO.getNodeType()) {
resultNodeMap.put(childVO.getId(), nodeBuilder);
}
//递归
buildResultNodeTree(childVO, nodeBuilder);
}
}
}

View File

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

View File

@ -40,8 +40,16 @@ 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) {
public void update(@PathVariable("id") Long id, @RequestBody RacePaperCreateVO updateVO,
@RequestAttribute AccountVO user) {
this.racePaperService.update(id, updateVO, user);
}
@ -53,16 +61,36 @@ 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) {
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,8 +105,17 @@ 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) {
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,32 +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

@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.DeleteMapping;
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;
@ -37,33 +36,56 @@ public class RaceTaskController {
}
@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);
}
@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);
}
//返回基本信息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

@ -0,0 +1,119 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.bo.race.RaceContent;
import club.joylink.rtss.entity.racetr.RacetrScene;
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.training2.Training2.Type;
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 com.google.protobuf.InvalidProtocolBufferException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@AllArgsConstructor
public class RaceApplicationService {
private RacePaperService racePaperService;
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) {
//获取场景数据
RacetrScene scene = raceSceneService.findById(sceneId);
RaceSceneOuterClass.StorageSimulation sceneProto;
try {
sceneProto = RaceSceneOuterClass.Scene.parseFrom(scene.getProto()).getStorageSimulation();
} catch (InvalidProtocolBufferException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("场景数据解析出错", e);
}
//场景数据转实训数据
DraftTraining2WithBLOBs draftTraining2 = new DraftTraining2WithBLOBs();
draftTraining2.setName(scene.getName());
draftTraining2.setBgSceneJson(sceneProto.getBgSceneJson());
// draftTraining2.setOperaJson(sceneProto.get); operaJson没了
draftTraining2.setStepJson(sceneProto.getStepJson());
draftTraining2.setScoringRuleJson(sceneProto.getScoringRuleJson());
draftTraining2.setMemberJson(sceneProto.getMemberJson());
draftTraining2.setPlayerIdJson(JsonUtils.writeValueAsString(sceneProto.getPlayerIdsList()));
// draftTraining2.setClient(sceneProto); client没了
draftTraining2.setType(Type.SCENE.name()); //数据里没存暂时固定用此类型
training2Service.trainingDataValid(draftTraining2);
//加载实训
training2Service.simulationLoadTraining(simulationId, draftTraining2, loginInfo);
}
public List<PaperTrainAnswerDetail> finishTask(long taskId, RaceTaskFinishParamDTO paramDTO,
AccountVO user) {
if (paramDTO == null) {
return null;
}
RaceContent content = getContent(user.getId());
List<PaperTrainAnswerDetail> result = training2Service.finishTraining2(
paramDTO.getSimulationId(), user, paramDTO.getScoreList());
Builder resultNode = content.getResultNode(taskId);
float fullScore = 0;
float score = 0;
for (PaperTrainAnswerDetail paperTrainAnswerDetail : result) {
if (paperTrainAnswerDetail.getRuleScore() != null) {
fullScore += paperTrainAnswerDetail.getRuleScore();
}
if (paperTrainAnswerDetail.getScore() != null) {
score += paperTrainAnswerDetail.getScore();
}
}
resultNode.setFullScore(fullScore);
resultNode.setScore(score);
return result;
}
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

@ -13,9 +13,8 @@ import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO.PaperModule;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperPageVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
import club.joylink.rtss.vo.race.RaceTask.RacePaperModuleTask;
import club.joylink.rtss.vo.race.RaceTask.RacePaperModuleTask.PaperModuleGroup;
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;
@ -203,6 +202,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) {
@ -222,41 +228,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);
@ -266,6 +244,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)) {
@ -286,12 +271,14 @@ public class RacePaperService {
cb.setContent(dto.getContent());
cb.setStandards(dto.getStandards());
cb.setParentId(dto.getParentId());
if (StringUtils.isNotEmpty(dto.getSceneType())) {
cb.setSceneType(Type.valueOf(dto.getSceneType()));
}
if (Objects.nonNull(dto.getSceneId())) {
cb.setSceneId(dto.getSceneId());
}
if (Objects.nonNull(dto.getRuleId())) {
cb.setRuleId(dto.getRuleId());
}
}
cb.setNodeType(nodeType);
@ -301,6 +288,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) {
@ -309,6 +302,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())) {
@ -316,6 +315,5 @@ public class RacePaperService {
this.collectTaskIds(group1, collectorList);
}
}
}
}

View File

@ -88,7 +88,7 @@ public class RaceSceneService {
RacetrTaskExample taskExample = new RacetrTaskExample();
taskExample.createCriteria().andSceneIdEqualTo(id);
long bindTaskCount = this.taskDAO.countByExample(taskExample);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindTaskCount > 0, "此场景已被任务绑定不能删除");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindTaskCount <= 0, "此场景已被任务绑定不能删除");
this.sceneDAO.deleteByPrimaryKey(id);
}

View File

@ -100,7 +100,7 @@ public class RaceScoreRuleService {
RacetrTaskExample taskExample = new RacetrTaskExample();
taskExample.createCriteria().andScoreRuleIdEqualTo(id);
long bindCount = this.taskDAO.countByExample(taskExample);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindCount > 0, "该规则已经绑定了对应方的任务,无法删除");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindCount <= 0, "该规则已经绑定了对应方的任务,无法删除");
ruleDAO.deleteByPrimaryKey(id);
}

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.RacetrTaskExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind.TaskBindType;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskCreateVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskDetailVO;
import club.joylink.rtss.vo.race.RaceTaskDetailDTO;
@ -40,14 +38,17 @@ public class RaceTaskService {
private RacetrTask findById(Long 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;
}
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);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task), "未找到对应的任务数据");
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task),
"未找到对应的任务数据");
RaceTaskDetailVO.Builder vo = RaceTaskDetailVO.newBuilder();
vo.setId(task.getId());
@ -56,13 +57,15 @@ public class RaceTaskService {
vo.setContent(task.getContent());
vo.setStandards(task.getStandards());
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);
if (Objects.nonNull(task.getSceneId())) {
vo.setSceneId(task.getSceneId());
vo.setSceneName(task.getSceneName());
}
if (Objects.nonNull(task.getSceneId())) {
if (Objects.nonNull(task.getRuleId())) {
vo.setRuleId(task.getRuleId());
vo.setRuleName(task.getRuleName());
}
@ -97,11 +100,14 @@ public class RaceTaskService {
}
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个类型");
if (bind.size() > 1) {
List<TaskBindType> bindTypes = bind.stream().map(RaceTaskBind::getBindType).distinct().collect(Collectors.toList());
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bindTypes.size() != 1, "最多绑定只能选择2个类型");
List<TaskBindType> bindTypes = bind.stream().map(RaceTaskBind::getBindType).distinct()
.collect(Collectors.toList());
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bindTypes.size() != 1,
"最多绑定只能选择2个类型");
}
RacetrTask task = this.findById(taskId);
@ -130,7 +136,8 @@ public class RaceTaskService {
public List<RaceTaskTreeVO> tree() {
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);
if (CollectionUtils.isEmpty(rootTaskList)) {
return Collections.emptyList();
@ -163,7 +170,8 @@ public class RaceTaskService {
List<RaceTaskTreeVO> collection = Lists.newArrayList(new RaceTaskTreeVO(rt));
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);
RacetrTaskExample example = new RacetrTaskExample();
example.createCriteria().andIdIn(deleteIds);
@ -180,9 +188,16 @@ 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));
Map<Long, List<RaceTaskDetailDTO>> dtoMapList = taskDtoList.stream()
.collect(Collectors.groupingBy(RaceTaskDetailDTO::getParentId));
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) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
// 重置仿真状态
@ -931,13 +931,20 @@ public class Training2Service {
/**
* 检验实训数据是否合规
*/
private Consumer<DraftTraining2WithBLOBs> trainingDataValid = (training) -> {
public Consumer<DraftTraining2WithBLOBs> trainingDataValid = (training) -> {
if (!StringUtils.hasText(training.getPlayerIdJson())) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation
, String.format("实训{id:[%s]}没有参训角色", training.getId()));
}
};
/**
* 和上面的对象是相同作用将此Service注入其它Bean后上面的对象是null
*/
public void trainingDataValid(DraftTraining2WithBLOBs training) {
trainingDataValid.accept(training);
}
/**
* 检验语音输入是否正确
*/

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race_scene.proto
// source: race/race_scene.proto
package club.joylink.rtss.vo.race;
@ -5593,26 +5593,26 @@ public final class RaceSceneOuterClass {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\020race_scene.proto\022\004race\032\030common/modify_" +
"info.proto\"\305\001\n\013RaceSceneVO\022\n\n\002id\030\001 \001(\003\022\014" +
"\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.RaceSc" +
"ene.Type\022\022\n\nfunctionId\030\004 \001(\003\022\032\n\005scene\030\005 " +
"\001(\0132\013.race.Scene\022(\n\nmodifyInfo\030\006 \001(\0132\024.c" +
"ommon.ModifyInfoVO\022\r\n\005mapId\030\007 \001(\003\022\017\n\007map" +
"Name\030\010 \001(\t\"\234\001\n\017RaceSceneListVO\022\n\n\002id\030\001 \001" +
"(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.Ra" +
"ceScene.Type\022\016\n\006map_id\030\004 \001(\003\022\020\n\010map_name" +
"\030\005 \001(\t\022)\n\013modify_info\030\006 \001(\0132\024.common.Mod" +
"ifyInfoVO\"3\n\022RaceScenePublishVO\022\017\n\007dafit" +
"id\030\001 \001(\003\022\014\n\004name\030\003 \001(\t\"I\n\005Scene\022\013\n\003url\030\001" +
" \001(\t\0223\n\022storage_simulation\030\002 \001(\0132\027.race." +
"StorageSimulation\"\201\001\n\021StorageSimulation\022" +
"\025\n\rbg_scene_json\030\001 \001(\t\022\021\n\tstep_json\030\002 \001(" +
"\t\022\023\n\013member_json\030\003 \001(\t\022\022\n\nplayer_ids\030\004 \003" +
"(\t\022\031\n\021scoring_rule_json\030\005 \001(\t\"5\n\tRaceSce" +
"ne\"(\n\004Type\022\013\n\007Unknown\020\000\022\t\n\005Local\020\001\022\010\n\004Li" +
"nk\020\002B\033\n\031club.joylink.rtss.vo.raceb\006proto" +
"3"
"\n\025race/race_scene.proto\022\004race\032\030common/mo" +
"dify_info.proto\"\305\001\n\013RaceSceneVO\022\n\n\002id\030\001 " +
"\001(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.R" +
"aceScene.Type\022\022\n\nfunctionId\030\004 \001(\003\022\032\n\005sce" +
"ne\030\005 \001(\0132\013.race.Scene\022(\n\nmodifyInfo\030\006 \001(" +
"\0132\024.common.ModifyInfoVO\022\r\n\005mapId\030\007 \001(\003\022\017" +
"\n\007mapName\030\010 \001(\t\"\234\001\n\017RaceSceneListVO\022\n\n\002i" +
"d\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.ra" +
"ce.RaceScene.Type\022\016\n\006map_id\030\004 \001(\003\022\020\n\010map" +
"_name\030\005 \001(\t\022)\n\013modify_info\030\006 \001(\0132\024.commo" +
"n.ModifyInfoVO\"3\n\022RaceScenePublishVO\022\017\n\007" +
"dafitid\030\001 \001(\003\022\014\n\004name\030\003 \001(\t\"I\n\005Scene\022\013\n\003" +
"url\030\001 \001(\t\0223\n\022storage_simulation\030\002 \001(\0132\027." +
"race.StorageSimulation\"\201\001\n\021StorageSimula" +
"tion\022\025\n\rbg_scene_json\030\001 \001(\t\022\021\n\tstep_json" +
"\030\002 \001(\t\022\023\n\013member_json\030\003 \001(\t\022\022\n\nplayer_id" +
"s\030\004 \003(\t\022\031\n\021scoring_rule_json\030\005 \001(\t\"5\n\tRa" +
"ceScene\"(\n\004Type\022\013\n\007Unknown\020\000\022\t\n\005Local\020\001\022" +
"\010\n\004Link\020\002B\033\n\031club.joylink.rtss.vo.raceb\006" +
"proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.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!
// source: race_season.proto
// source: race/race_season.proto
package club.joylink.rtss.vo.race;
@ -2495,16 +2495,16 @@ public final class RaceSeasonOuterClass {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\021race_season.proto\022\004race\032\030common/modify" +
"_info.proto\"\210\001\n\014RaceSeasonVO\022\n\n\002id\030\001 \001(\003" +
"\022\014\n\004code\030\002 \001(\t\022%\n\005group\030\003 \001(\0162\026.race.Rac" +
"eSeason.Group\022\014\n\004term\030\004 \001(\t\022)\n\013modify_in" +
"fo\030\005 \001(\0132\024.common.ModifyInfoVO\"W\n\022RaceSe" +
"asonCreateVO\022\014\n\004code\030\001 \001(\t\022%\n\005group\030\002 \001(" +
"\0162\026.race.RaceSeason.Group\022\014\n\004term\030\003 \001(\t\"" +
"2\n\nRaceSeason\"$\n\005Group\022\013\n\007Unknown\020\000\022\006\n\002Z" +
"Z\020\001\022\006\n\002GZ\020\002B\033\n\031club.joylink.rtss.vo.race" +
"b\006proto3"
"\n\026race/race_season.proto\022\004race\032\030common/m" +
"odify_info.proto\"\210\001\n\014RaceSeasonVO\022\n\n\002id\030" +
"\001 \001(\003\022\014\n\004code\030\002 \001(\t\022%\n\005group\030\003 \001(\0162\026.rac" +
"e.RaceSeason.Group\022\014\n\004term\030\004 \001(\t\022)\n\013modi" +
"fy_info\030\005 \001(\0132\024.common.ModifyInfoVO\"W\n\022R" +
"aceSeasonCreateVO\022\014\n\004code\030\001 \001(\t\022%\n\005group" +
"\030\002 \001(\0162\026.race.RaceSeason.Group\022\014\n\004term\030\003" +
" \001(\t\"2\n\nRaceSeason\"$\n\005Group\022\013\n\007Unknown\020\000" +
"\022\006\n\002ZZ\020\001\022\006\n\002GZ\020\002B\033\n\031club.joylink.rtss.vo" +
".raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -5515,6 +5515,10 @@ public final class RaceTask {
int index);
}
/**
* <pre>
*试卷考试显示模块任务单独树形结构显示
* </pre>
*
* Protobuf type {@code race.RacePaperModuleTask}
*/
public static final class RacePaperModuleTask extends
@ -7045,6 +7049,10 @@ public final class RaceTask {
return builder;
}
/**
* <pre>
*试卷考试显示模块任务单独树形结构显示
* </pre>
*
* Protobuf type {@code race.RacePaperModuleTask}
*/
public static final class Builder extends
@ -7740,6 +7748,25 @@ public final class RaceTask {
* @return The nodeType.
*/
club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO.ChildNodeType getNodeType();
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return The enum numeric value on the wire for sceneType.
*/
int getSceneTypeValue();
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return The sceneType.
*/
club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type getSceneType();
}
/**
* Protobuf type {@code race.RaceTaskChildVO}
@ -7760,6 +7787,7 @@ public final class RaceTask {
standards_ = "";
children_ = java.util.Collections.emptyList();
nodeType_ = 0;
sceneType_ = 0;
}
@java.lang.Override
@ -8205,6 +8233,32 @@ public final class RaceTask {
return result == null ? club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO.ChildNodeType.UNRECOGNIZED : result;
}
public static final int SCENETYPE_FIELD_NUMBER = 11;
private int sceneType_ = 0;
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return The enum numeric value on the wire for sceneType.
*/
@java.lang.Override public int getSceneTypeValue() {
return sceneType_;
}
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return The sceneType.
*/
@java.lang.Override public club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type getSceneType() {
club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type result = club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type.forNumber(sceneType_);
return result == null ? club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type.UNRECOGNIZED : result;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@ -8249,6 +8303,9 @@ public final class RaceTask {
if (nodeType_ != club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO.ChildNodeType.MODULE_GROUP.getNumber()) {
output.writeEnum(10, nodeType_);
}
if (sceneType_ != club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type.Unknown.getNumber()) {
output.writeEnum(11, sceneType_);
}
getUnknownFields().writeTo(output);
}
@ -8294,6 +8351,10 @@ public final class RaceTask {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(10, nodeType_);
}
if (sceneType_ != club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type.Unknown.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(11, sceneType_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@ -8328,6 +8389,7 @@ public final class RaceTask {
if (!getChildrenList()
.equals(other.getChildrenList())) return false;
if (nodeType_ != other.nodeType_) return false;
if (sceneType_ != other.sceneType_) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@ -8365,6 +8427,8 @@ public final class RaceTask {
}
hash = (37 * hash) + NODE_TYPE_FIELD_NUMBER;
hash = (53 * hash) + nodeType_;
hash = (37 * hash) + SCENETYPE_FIELD_NUMBER;
hash = (53 * hash) + sceneType_;
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@ -8512,6 +8576,7 @@ public final class RaceTask {
}
bitField0_ = (bitField0_ & ~0x00000100);
nodeType_ = 0;
sceneType_ = 0;
return this;
}
@ -8585,6 +8650,9 @@ public final class RaceTask {
if (((from_bitField0_ & 0x00000200) != 0)) {
result.nodeType_ = nodeType_;
}
if (((from_bitField0_ & 0x00000400) != 0)) {
result.sceneType_ = sceneType_;
}
}
@java.lang.Override
@ -8660,6 +8728,9 @@ public final class RaceTask {
if (other.nodeType_ != 0) {
setNodeTypeValue(other.getNodeTypeValue());
}
if (other.sceneType_ != 0) {
setSceneTypeValue(other.getSceneTypeValue());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@ -8744,6 +8815,11 @@ public final class RaceTask {
bitField0_ |= 0x00000200;
break;
} // case 80
case 88: {
sceneType_ = input.readEnum();
bitField0_ |= 0x00000400;
break;
} // case 88
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@ -9637,6 +9713,79 @@ public final class RaceTask {
onChanged();
return this;
}
private int sceneType_ = 0;
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return The enum numeric value on the wire for sceneType.
*/
@java.lang.Override public int getSceneTypeValue() {
return sceneType_;
}
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @param value The enum numeric value on the wire for sceneType to set.
* @return This builder for chaining.
*/
public Builder setSceneTypeValue(int value) {
sceneType_ = value;
bitField0_ |= 0x00000400;
onChanged();
return this;
}
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return The sceneType.
*/
@java.lang.Override
public club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type getSceneType() {
club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type result = club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type.forNumber(sceneType_);
return result == null ? club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type.UNRECOGNIZED : result;
}
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @param value The sceneType to set.
* @return This builder for chaining.
*/
public Builder setSceneType(club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000400;
sceneType_ = value.getNumber();
onChanged();
return this;
}
/**
* <pre>
*Local 场景;Link 可能是3D;
* </pre>
*
* <code>.race.RaceScene.Type sceneType = 11;</code>
* @return This builder for chaining.
*/
public Builder clearSceneType() {
bitField0_ = (bitField0_ & ~0x00000400);
sceneType_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
@ -9736,6 +9885,10 @@ public final class RaceTask {
int index);
}
/**
* <pre>
*试卷考试显示模块任务单独树形结构显示通过RaceTaskChildVO的属性node_type 进行区分目前节点是什么类型
* </pre>
*
* Protobuf type {@code race.RacePaperSingleModuleGroupTask}
*/
public static final class RacePaperSingleModuleGroupTask extends
@ -9994,6 +10147,10 @@ public final class RaceTask {
return builder;
}
/**
* <pre>
*试卷考试显示模块任务单独树形结构显示通过RaceTaskChildVO的属性node_type 进行区分目前节点是什么类型
* </pre>
*
* Protobuf type {@code race.RacePaperSingleModuleGroupTask}
*/
public static final class Builder extends
@ -10597,17 +10754,18 @@ public final class RaceTask {
"Group\022\022\n\ngroup_name\030\001 \001(\t\022\'\n\010treeData\030\002 " +
"\003(\0132\025.race.RaceTaskChildVO\022@\n\014module_gro" +
"up\030\003 \003(\0132*.race.RacePaperModuleTask.Pape" +
"rModuleGroup\"\241\002\n\017RaceTaskChildVO\022\n\n\002id\030\001" +
"rModuleGroup\"\312\002\n\017RaceTaskChildVO\022\n\n\002id\030\001" +
" \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 \001(\t\022\017\n\007cont" +
"ent\030\004 \001(\t\022\021\n\tstandards\030\005 \001(\t\022\020\n\010scene_id" +
"\030\006 \001(\003\022\017\n\007rule_id\030\007 \001(\003\022\021\n\tparent_id\030\010 \001" +
"(\003\022\'\n\010children\030\t \003(\0132\025.race.RaceTaskChil" +
"dVO\0226\n\tnode_type\030\n \001(\0162#.race.RaceTaskCh" +
"ildVO.ChildNodeType\"+\n\rChildNodeType\022\020\n\014" +
"MODULE_GROUP\020\000\022\010\n\004TASK\020\001\"`\n\036RacePaperSin" +
"gleModuleGroupTask\022\030\n\020custom_module_id\030\001" +
" \001(\005\022$\n\005child\030\002 \003(\0132\025.race.RaceTaskChild" +
"VOB\033\n\031club.joylink.rtss.vo.raceb\006proto3"
"ildVO.ChildNodeType\022\'\n\tsceneType\030\013 \001(\0162\024" +
".race.RaceScene.Type\"+\n\rChildNodeType\022\020\n" +
"\014MODULE_GROUP\020\000\022\010\n\004TASK\020\001\"`\n\036RacePaperSi" +
"ngleModuleGroupTask\022\030\n\020custom_module_id\030" +
"\001 \001(\005\022$\n\005child\030\002 \003(\0132\025.race.RaceTaskChil" +
"dVOB\033\n\031club.joylink.rtss.vo.raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@ -10656,7 +10814,7 @@ public final class RaceTask {
internal_static_race_RaceTaskChildVO_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_race_RaceTaskChildVO_descriptor,
new java.lang.String[] { "Id", "Name", "Desc", "Content", "Standards", "SceneId", "RuleId", "ParentId", "Children", "NodeType", });
new java.lang.String[] { "Id", "Name", "Desc", "Content", "Standards", "SceneId", "RuleId", "ParentId", "Children", "NodeType", "SceneType", });
internal_static_race_RacePaperSingleModuleGroupTask_descriptor =
getDescriptor().getMessageTypes().get(6);
internal_static_race_RacePaperSingleModuleGroupTask_fieldAccessorTable = new

View File

@ -25,4 +25,5 @@ public class RaceTaskDetailDTO {
private LocalDateTime updateTime;
private String creatorName;
private String updaterName;
private String sceneType;
}

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

View File

@ -330,6 +330,6 @@
</foreach>
UNION all
select A.id,A.name,A.desc,A.content,A.standards,A.score_rule_id,A.score_rule_id as ruleId,A.parent_id from racetr_task A, task B where A.parent_id = B.id)
select * from task
select A.*,B.type as sceneType from task A left join racetr_scene B on A.scene_id = B.id
</select>
</mapper>

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.bo.race;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import club.joylink.rtss.vo.race.RaceApplication.RacePracticeResult;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask.Builder;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO;
import org.junit.jupiter.api.Test;
class RaceContentTest {
@Test
public void newInstance() {
Builder builder = RacePaperSingleModuleGroupTask.newBuilder();
for (int i = 0; i < 2; i++) {
RaceTaskChildVO.Builder childBuilder = builder.addChildBuilder();
childBuilder.setId(i);
for (int j = 0; j < 3; j++) {
childBuilder.addChildren(RaceTaskChildVO.newBuilder().setId(j));
}
}
RaceContent content = new RaceContent(1, 1, 1, builder.build());
RacePracticeResult result = content.getResult().build();
assertNotNull(result);
assertEquals(2, result.getNodeList().size());
for (ResultNode node : result.getNodeList()) {
assertEquals(3, node.getChildList().size());
}
}
}

View File

@ -24,48 +24,49 @@ import java.util.Objects;
@Slf4j
@SpringBootTest
public class VoiceDiscriminateTest {
@Autowired
private SimulationManager simulationManager;
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
private SimulationService simulationService;
@Autowired
private ProjectServiceImpl projectService;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
private IAuthenticateService iAuthenticateService;
@Autowired
private ProjectServiceImpl projectService;
@Autowired
private IOrgProjectService orgProjectService;
@Autowired
private IAuthenticateService iAuthenticateService;
@Test
public void entityTest() throws InterruptedException {
LoginUserVO loginInfo = new LoginUserVO();
loginInfo.setAccount("15388519623");
loginInfo.setClientId("1");
loginInfo.setPassword("e10adc3949ba59abbe56e057f20f883e");
loginInfo.setProject("DEFAULT");
loginInfo.setSecret("joylink");
String token = iAuthenticateService.loginWithPwd(loginInfo);
LoginUserInfoVO loginUserInfoVO = this.iAuthenticateService.getLoginUserInfoByToken(token);
orgProjectService.signInOrg(124L, loginUserInfoVO);
String simulationId = simulationService.createSimulation(10645L, loginUserInfoVO);
Simulation simulation = simulationManager.getById(simulationId);
voiceDiscriminateService.doAnalysis((club.joylink.rtss.simulation.cbtc.Simulation) simulation, "车站二站办理X0202-X0103_1进路");
Route r = ((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getRepository().getRouteList()
.stream().filter(route -> Objects.equals("X0202-X0103_1", route.getName()))
.findFirst().orElse(null);
assert r != null;
boolean checkLock = true;
do {
if (r.isLock()) {
checkLock = false;
log.info("进路办理结束");
}
} while (checkLock);
}
@Autowired
private IOrgProjectService orgProjectService;
@Test
public void entityTest() throws InterruptedException {
LoginUserVO loginInfo = new LoginUserVO();
loginInfo.setAccount("15388519623");
loginInfo.setClientId("1");
loginInfo.setPassword("e10adc3949ba59abbe56e057f20f883e");
loginInfo.setProject("DEFAULT");
loginInfo.setSecret("joylink");
String token = iAuthenticateService.loginWithPwd(loginInfo);
LoginUserInfoVO loginUserInfoVO = this.iAuthenticateService.getLoginUserInfoByToken(token);
orgProjectService.signInOrg(124L, loginUserInfoVO);
String simulationId = simulationService.createSimulation(10645L, null, loginUserInfoVO);
Simulation simulation = simulationManager.getById(simulationId);
voiceDiscriminateService.doAnalysis((club.joylink.rtss.simulation.cbtc.Simulation) simulation, "车站二站办理X0202-X0103_1进路");
Route r = ((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getRepository().getRouteList()
.stream().filter(route -> Objects.equals("X0202-X0103_1", route.getName()))
.findFirst().orElse(null);
assert r != null;
boolean checkLock = true;
do {
if (r.isLock()) {
checkLock = false;
log.info("进路办理结束");
}
} while (checkLock);
}
}

View File

@ -20,32 +20,32 @@ import java.io.IOException;
@SpringBootTest
public class SimulationVoiceStandTest {
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
private LoginUserInfoVO getInfo(){
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData,LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
private LoginUserInfoVO getInfo() {
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData, LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
@Test
public void test1(){
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
@Test
public void test1() {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L, null, userInfoVO);
Simulation simulation = (Simulation) this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"办理车站一站上行站台扣车");
}
voiceDiscriminateService.doAnalysis(simulation, "办理车站一站上行站台扣车");
}
}

View File

@ -15,32 +15,32 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class SimulationVoiceStationAuthorizeTest {
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
private LoginUserInfoVO getInfo(){
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData,LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
private LoginUserInfoVO getInfo() {
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData, LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
@Test
public void test1(){
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
@Test
public void test1() {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L, null, userInfoVO);
Simulation simulation = (Simulation) this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"处理车站一站权限下放");
}
voiceDiscriminateService.doAnalysis(simulation, "处理车站一站权限下放");
}
}

View File

@ -25,52 +25,53 @@ import java.util.concurrent.TimeUnit;
@SpringBootTest
public class SimulationVoiceSwitchTest {
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
@Qualifier("voiceDiscriminateExecutor")
private TaskExecutor voiceDiscriminateExecutor;
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
@Qualifier("voiceDiscriminateExecutor")
private TaskExecutor voiceDiscriminateExecutor;
private LoginUserInfoVO getInfo(){
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData,LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
private LoginUserInfoVO getInfo() {
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData, LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
@Test
public void testSource() throws InterruptedException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
@Test
public void testSource() throws InterruptedException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L, null, userInfoVO);
Simulation simulation = (Simulation) this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"办理道岔w0101定位123123");
ThreadPoolTaskExecutor poolTaskExecutor = (ThreadPoolTaskExecutor) this.voiceDiscriminateExecutor;
while(poolTaskExecutor.getActiveCount() > 0){
TimeUnit.SECONDS.sleep(5);
}
voiceDiscriminateService.doAnalysis(simulation, "办理道岔w0101定位123123");
ThreadPoolTaskExecutor poolTaskExecutor = (ThreadPoolTaskExecutor) this.voiceDiscriminateExecutor;
while (poolTaskExecutor.getActiveCount() > 0) {
TimeUnit.SECONDS.sleep(5);
}
@Test
public void testSwitchFan() throws InterruptedException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
}
voiceDiscriminateService.doAnalysis(simulation,"办理道岔w0101反位123123");
ThreadPoolTaskExecutor poolTaskExecutor = (ThreadPoolTaskExecutor) this.voiceDiscriminateExecutor;
while(poolTaskExecutor.getActiveCount() > 0){
TimeUnit.SECONDS.sleep(5);
}
@Test
public void testSwitchFan() throws InterruptedException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L, null, userInfoVO);
Simulation simulation = (Simulation) this.simulationManager.getById(simKey);
voiceDiscriminateService.doAnalysis(simulation, "办理道岔w0101反位123123");
ThreadPoolTaskExecutor poolTaskExecutor = (ThreadPoolTaskExecutor) this.voiceDiscriminateExecutor;
while (poolTaskExecutor.getActiveCount() > 0) {
TimeUnit.SECONDS.sleep(5);
}
}
}