Merge branch 'test'

This commit is contained in:
tiger_zhou 2024-03-12 10:36:14 +08:00
commit bf87b46662
17 changed files with 2209 additions and 1093 deletions

@ -1 +1 @@
Subproject commit 2aedc24640de82379bc4ebb48e428fd57cfc5e77
Subproject commit 5dd7fdb3d568c829356fa59b746b559d17da49b8

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.SceneCustomCreateVO;
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
@ -27,6 +28,16 @@ public class RaceSceneController {
@Autowired
private RaceSceneService sceneService;
@PostMapping("/custom/edit")
public void customSave(@RequestBody SceneCustomCreateVO vo, @RequestAttribute AccountVO user) {
this.sceneService.customSave(vo, user);
}
@PostMapping("/custom/{id}/edit")
public void customUpdate(@PathVariable("id") Long id, @RequestBody SceneCustomCreateVO vo, @RequestAttribute AccountVO user) {
this.sceneService.customUpdate(id, vo, user);
}
/**
* 草稿实训发布到场景
*

View File

@ -29,7 +29,7 @@ public interface RacetrSceneDAO extends MyBatisBaseDao<RacetrScene, Long, Racetr
+ " and A.name like CONCAT('%',#{vo.name},'%') "
+ "</if> "
+ "<if test='vo.type!= null and vo.type!= \"\"'> "
+ " and A.type = ${vo.type}"
+ " and A.type = #{vo.type}"
+ "</if> "
+ "</script>")
List<RaceScenePageVO> pages(@Param("vo") RaceSceneQueryVO vo);

View File

@ -17,7 +17,7 @@ import org.springframework.stereotype.Repository;
public interface RacetrTaskDAO extends MyBatisBaseDao<RacetrTask, Long, RacetrTaskExample> {
@Select("<script>"
+ "select A.id,A.name,A.desc,A.content,A.standards,A.scene_id,B.name as sceneName, "
+ "select A.id,A.name,A.desc,A.content,A.standards,B.id as scene_id,B.name as sceneName, "
+ "A.score_rule_id as rule_id,C.name as ruleName,A.parent_id,"
+ "A.creator_id,A.create_time,A.updater_id,A.update_time,D.nickname as creatorName,E.nickname as updaterName "
+ " from racetr_task A left join racetr_scene B on A.scene_id = B.id "

File diff suppressed because it is too large Load Diff

View File

@ -277,6 +277,7 @@ public class RacePaperService {
RaceTaskChildVO.Builder childVOB = RaceTaskChildVO.newBuilder();
childVOB.setName(group.getName());
childVOB.setNodeType(ChildNodeType.MODULE_GROUP);
for (Long taskId : group.getTaskIdsList()) {
RaceTaskChildVO taskVO = this.findTask(taskId, allTaskMapList);
childVOB.addChildren(taskVO);
@ -333,15 +334,15 @@ 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());
}
}
if (Objects.nonNull(dto.getRuleId())) {
cb.setRuleId(dto.getRuleId());
}
if (StringUtils.isNotEmpty(dto.getSceneType())) {
cb.setSceneType(Type.valueOf(dto.getSceneType()));
}
if (Objects.nonNull(dto.getSceneId())) {
cb.setSceneId(dto.getSceneId());
}
cb.setNodeType(nodeType);
cb.setName(dto.getName());

View File

@ -10,22 +10,26 @@ import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssert;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.exception.RacetrExceptionAssert;
import club.joylink.rtss.services.MinioService;
import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.Scene;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.SceneCustomCreateVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.StorageSimulation;
import club.joylink.rtss.vo.race.RaceScenePageVO;
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.google.protobuf.InvalidProtocolBufferException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
@ -33,10 +37,12 @@ import java.util.List;
import java.util.Objects;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestAttribute;
@Service
@Slf4j
@ -48,7 +54,8 @@ public class RaceSceneService {
private RacetrTaskDAO taskDAO;
@Autowired
private DraftTraining2DAO trainingDao;
@Autowired
private MinioService minioService;
public RacetrScene findById(Long id) {
RacetrScene rs = this.sceneDAO.selectByPrimaryKey(id);
@ -56,6 +63,47 @@ public class RaceSceneService {
return rs;
}
public void customSave(SceneCustomCreateVO vo, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrScene rs = new RacetrScene();
rs.setName(vo.getName());
rs.setType(vo.getType().name());
rs.setProto(vo.getScene().toByteArray());
rs.setCreatorId(user.getId());
rs.setUpdaterId(user.getId());
rs.setCreateTime(now);
rs.setUpdateTime(now);
this.sceneDAO.insert(rs);
}
public void customUpdate(Long id, SceneCustomCreateVO vo, AccountVO user) {
RacetrScene rs = this.findById(id);
this.removeObj(rs);
rs.setName(vo.getName());
rs.setType(vo.getType().name());
rs.setProto(vo.getScene().toByteArray());
rs.setUpdaterId(user.getId());
rs.setUpdateTime(LocalDateTime.now());
this.sceneDAO.updateByPrimaryKeySelective(rs);
}
private void removeObj(RacetrScene rs) {
byte[] protoData = rs.getProto();
if (ArrayUtils.isEmpty(protoData)) {
log.error("自定义删除场景附件proto数据不能为空 id:[{}]", rs.getId());
return;
}
try {
if (!Objects.equals(rs.getType(), Type.Video.name())) {
return;
}
Scene sceneProto = Scene.parseFrom(protoData);
this.minioService.removeMinioObject(rs.getType(), sceneProto.getFileName());
} catch (Exception e) {
log.error("场景附件处理失败 id:[{}] msg:[{}]", rs.getId(), e.getMessage(), e);
}
}
public PageVO<RaceSceneListVO> page(RaceSceneQueryVO query) {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<RaceScenePageVO> page = (Page<RaceScenePageVO>) this.sceneDAO.pages(query);
@ -70,8 +118,10 @@ public class RaceSceneService {
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(rs.getCreatorId(), rs.getCreatorName(), rs.getUpdaterId(), rs.getUpdaterName(), rs.getCreateTime(), rs.getUpdateTime());
vo.setModifyInfo(modifyInfoVO);
vo.setType(Type.valueOf(rs.getType()));
vo.setMapId(rs.getMapId());
vo.setMapName(rs.getMapName());
if (Objects.nonNull(rs.getMapId())) {
vo.setMapId(rs.getMapId());
vo.setMapName(rs.getMapName());
}
return vo.build();
}
@ -89,10 +139,13 @@ public class RaceSceneService {
}
public void delete(Long id) {
RacetrTaskExample taskExample = new RacetrTaskExample();
taskExample.createCriteria().andSceneIdEqualTo(id);
long bindTaskCount = this.taskDAO.countByExample(taskExample);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindTaskCount <= 0, "此场景已被任务绑定不能删除");
RacetrScene rs = this.findById(id);
this.removeObj(rs);
this.sceneDAO.deleteByPrimaryKey(id);
}

View File

@ -972,7 +972,9 @@ public class Training2Service {
if (!simulation.getTraining2().isJumpStep(step) && !step.getSimulationMember().isRobot()) {
applicationContext.publishEvent(
new SimulationTrainingAudioEvent(this, simulation, step, simOperation2, doCompletion));
if (!doCompletion) {
/*
取消 发送请重试语音
if (!doCompletion) {
Operation.Type operationType;
HashMap<String, Object> params = new HashMap<>(event.getParams());
SimulationMember member = null;
@ -997,7 +999,7 @@ public class Training2Service {
params.put("content", compose.getMessage());
atsOperationDispatcher.execute(simulation, member, operationType.name(), params);
}
}
}*/
}
}

View File

@ -19,66 +19,70 @@ import java.util.Objects;
@Component
public class VoiceService {
private final MinioClientUtil voiceSynthesisUtil;
private final MinioClientUtil voiceRecognitionUtil;
private final static String SYNTHESIS_FOLDER = "synthesis";
private final static String RECOGNITION_FOLDER = "recognition";
private final MinioClientUtil voiceSynthesisUtil;
private final MinioClientUtil voiceRecognitionUtil;
private final static String SYNTHESIS_FOLDER = "synthesis";
private final static String RECOGNITION_FOLDER = "recognition";
@Autowired
@Qualifier(value = "baiDuVoiceService2")
private IVoiceService2 voiceService;
@Autowired
@Qualifier(value = "baiDuVoiceService2")
private IVoiceService2 voiceService;
public VoiceService(MinioClientConfig minioClientConfig){
this.voiceSynthesisUtil = MinioClientUtil.getInstance(minioClientConfig,SYNTHESIS_FOLDER);
this.voiceRecognitionUtil = MinioClientUtil.getInstance(minioClientConfig,RECOGNITION_FOLDER);
public VoiceService(MinioClientConfig minioClientConfig) {
this.voiceSynthesisUtil = MinioClientUtil.getInstance(minioClientConfig, SYNTHESIS_FOLDER);
this.voiceRecognitionUtil = MinioClientUtil.getInstance(minioClientConfig, RECOGNITION_FOLDER);
}
/**
* 语音识别
*
* @param vo
* @return
*/
public VoiceRecognitionResult voiceRecognition(VoiceRecognitionVO vo) {
String fileName = String.format("%s.wav", System.currentTimeMillis());
this.uploadFile(voiceRecognitionUtil, vo.getData(), fileName, RECOGNITION_FOLDER);
String filePath = this.voiceRecognitionUtil.getDownLoadPath(fileName);
VoiceAsrResult voiceResult = voiceService.recognition(vo);
return new VoiceRecognitionResult(filePath, voiceResult.getResult().get(0));
}
/**
* 语音合成
*
* @param vo
* @return
*/
public VoiceCompose synthesis(BaseVoiceSynthesisVO vo) {
String md5Code = vo.md5Code();
String fileName = String.format("%s.wav", md5Code);
if (Objects.equals(false, this.voiceSynthesisUtil.checkFileIsExist(fileName))) {
byte[] bytes = voiceService.voiceSynthesis(vo);
byte[] data = bytes;
this.uploadFile(voiceSynthesisUtil, data, fileName, SYNTHESIS_FOLDER);
}
String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName);
return new VoiceCompose(filePath, md5Code, vo.getMessage());
}
/**
* 语音识别
* @param vo
* @return
*/
public VoiceRecognitionResult voiceRecognition(VoiceRecognitionVO vo){
String fileName = String.format("%s.wav",System.currentTimeMillis());
this.uploadFile(voiceRecognitionUtil,vo.getData(),fileName,RECOGNITION_FOLDER);
String filePath = this.voiceRecognitionUtil.getDownLoadPath(fileName);
VoiceAsrResult voiceResult = voiceService.recognition(vo);
return new VoiceRecognitionResult(filePath,voiceResult.getResult().get(0));
}
/**
* 语音合成返回原数据
*
* @param vo
* @return
*/
public byte[] synthesisSource(BaseVoiceSynthesisVO vo) {
byte[] data = voiceService.voiceSynthesis(vo);
return data;
}
/**
* 语音合成
* @param vo
* @return
*/
public VoiceCompose synthesis(BaseVoiceSynthesisVO vo){
String md5Code = vo.md5Code();
String fileName = String.format("%s.wav",md5Code);
if(Objects.equals(false,this.voiceSynthesisUtil.checkFileIsExist(fileName))){
byte[] data = voiceService.voiceSynthesis(vo);
this.uploadFile(voiceSynthesisUtil,data,fileName,SYNTHESIS_FOLDER);
}
String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName);
return new VoiceCompose(filePath,md5Code,vo.getMessage());
}
/**
* 语音合成返回原数据
* @param vo
* @return
*/
public byte[] synthesisSource(BaseVoiceSynthesisVO vo){
byte[] data = voiceService.voiceSynthesis(vo);
return data;
}
private void uploadFile(MinioClientUtil minioClient ,byte[] data,String fileName,String folder){
try{
minioClient.uploadBytes(data,fileName);
}catch (SimulationException e){
log.error("文件上传失败 folder:{},文件名:{} errmsg:{}",folder,fileName,e.getMessage(),e);
throw e;
}
private void uploadFile(MinioClientUtil minioClient, byte[] data, String fileName, String folder) {
try {
minioClient.uploadBytes(data, fileName);
} catch (SimulationException e) {
log.error("文件上传失败 folder:{},文件名:{} errmsg:{}", folder, fileName, e.getMessage(), e);
throw e;
}
}
}

View File

@ -14,222 +14,224 @@ import java.util.regex.Pattern;
@Component
public class SimulationVoiceHandler {
static List<Replacement> replacementList;
static List<Replacement> replacementList;
static Map<String, String> regexReplaceMap = new HashMap<>();
static Map<String, String> regexReplaceMap = new HashMap<>();
// static {
// static {
// regexReplaceMap.put("", "1");
// }
static List<Replacement> numReplacementList;
static List<Replacement> numReplacementList;
static {
replacementList = new ArrayList<>();
numReplacementList = new ArrayList<>();
static {
replacementList = new ArrayList<>();
numReplacementList = new ArrayList<>();
//------------- 数字 --------------
numReplacementList.add(new Replacement("(零|洞|栋)", "0"));
numReplacementList.add(new Replacement("(一|幺|e|E)", "1"));
numReplacementList.add(new Replacement("(二|两|r)", "2"));
numReplacementList.add(new Replacement("(三)", "3"));
numReplacementList.add(new Replacement("(四)", "4"));
numReplacementList.add(new Replacement("(五)", "5"));
numReplacementList.add(new Replacement("(六)", "6"));
numReplacementList.add(new Replacement("(七|拐)", "7"));
numReplacementList.add(new Replacement("(八)", "8"));
numReplacementList.add(new Replacement("(九)", "9"));
numReplacementList.add(new Replacement("(|。)", ""));
numReplacementList.add(new Replacement("( )", ""));
numReplacementList.add(new Replacement("(低|地|第|敌|底|递)", "d"));
//------------- 专业词汇 --------------
replacementList.add(new Replacement("(行吊|情调|神雕|性交|心跳|香蕉|星标|平调|新调)", "行调"));
replacementList.add(new Replacement("(茼蒿)", "通号"));
replacementList.add(new Replacement("", ""));
replacementList.add(new Replacement("自动折法", "自动折返"));
replacementList.add(new Replacement("(倒插|刀叉|倒茶|倒叉|到插|倒闸|到察|到厂|道碴|到差|到查)", "道岔"));
replacementList.add(new Replacement("(师表|手表|时表)", "失表"));
replacementList.add(new Replacement("攻作组", "工作组"));
replacementList.add(new Replacement("军事表", "均失表"));
replacementList.add(new Replacement("(阴道插|阴道畅)", "因道岔"));
replacementList.add(new Replacement("(费用车|背影车)", "备用车"));
replacementList.add(new Replacement("(具贝家车条件|具被介绍条件)", "具备接车条件"));
replacementList.add(new Replacement("(烟雾)", "延误"));
replacementList.add(new Replacement("(客栈)", "各站"));
replacementList.add(new Replacement("(正线队长发送)", "正线队长复诵"));
replacementList.add(new Replacement("(电影)", "点名"));
replacementList.add(new Replacement("(代理|代练|待定|待命)", "待令"));
replacementList.add(new Replacement("(伤心|绍兴|上省)", "上行"));
replacementList.add(new Replacement("(调制)", "调至"));
replacementList.add(new Replacement("(时代丽|时代绿)", "首待令"));
replacementList.add(new Replacement("(绰号)", "做好"));
replacementList.add(new Replacement("(清江|青椒|京腔)", "请讲"));
replacementList.add(new Replacement("(转换慧)", "转换轨"));
replacementList.add(new Replacement("(芝法玲时期|至发令时期|此法令时期)", "自发令时起"));
replacementList.add(new Replacement("(上有延误)", "稍有延误"));
replacementList.add(new Replacement("(歌词)", "各次"));
replacementList.add(new Replacement("(程序你)", "准许你"));
replacementList.add(new Replacement("(车法)", "折返"));
replacementList.add(new Replacement("(拉萍|拉婷)", "拉停"));
replacementList.add(new Replacement("(站街)", "站级"));
replacementList.add(new Replacement("(羡慕)", "线路"));
replacementList.add(new Replacement("(功率标|功率表|公里表|公历表|公斤标|公立标)", "公里标"));
replacementList.add(new Replacement("(赚钱折法|赚钱折返)", "站前折返"));
replacementList.add(new Replacement("(权限各次)", "全线各次"));
replacementList.add(new Replacement("(庭院)", "停运"));
replacementList.add(new Replacement("(请客|青稞|青客|轻客|轻课|青涩|听课|停课|听,可|听可|顷刻|倾刻|千克|乘车|七个|切克)", "清客"));
replacementList.add(new Replacement("(会断|会短|回断)", "回段"));
replacementList.add(new Replacement("(清朝|请朝|请钞)", "请抄"));
replacementList.add(new Replacement("(请超链|请超龄)", "请抄令"));
replacementList.add(new Replacement("(首领处所|手令处所|手链处所)", "受令处所"));
replacementList.add(new Replacement("安全保护", "安全防护"));
replacementList.add(new Replacement("(手摇质|说杨智|受邀至)", "手摇至"));
replacementList.add(new Replacement("(反胃|软位)", "反位"));
replacementList.add(new Replacement("所逼", "锁闭"));
replacementList.add(new Replacement("位直", "位置"));
replacementList.add(new Replacement("丞将|成强|成交|沉降", "乘降"));
replacementList.add(new Replacement("售电弓|售电工|收电弓|数电弓", "受电弓"));
replacementList.add(new Replacement("故障回复", "故障恢复"));
replacementList.add(new Replacement("(出入断线|出路段线)", "出入段线"));
replacementList.add(new Replacement("(控子权|控质权|放置权|矿质权|空置权)", "控制权"));
replacementList.add(new Replacement("(手机号|首信号|首信好|首信后|首信哈|手型号)", "手信号"));
replacementList.add(new Replacement("(鼓掌|部长)", "故障"));
replacementList.add(new Replacement("(向凤|下方)", "下放"));
replacementList.add(new Replacement("(占线|占先|展现|战线)", "站线"));
replacementList.add(new Replacement("(定为)", "定位"));
replacementList.add(new Replacement("(者搬迁|折返性)", "折返线"));
replacementList.add(new Replacement("(进入)", "进路"));
replacementList.add(new Replacement("(污点|5点)", "无电"));
replacementList.add(new Replacement("(出轻)", "出清"));
replacementList.add(new Replacement("(抚慰)", "复位"));
replacementList.add(new Replacement("(实业)", "实验"));
replacementList.add(new Replacement("(控线)", "空闲"));
//------------- 设备相关 --------------
replacementList.add(new Replacement("(宇花祭|玉花祭|雨化寨|氯化钙|绿化带|优化钙)", "鱼化寨"));
replacementList.add(new Replacement("(保税局)", "保税区"));
replacementList.add(new Replacement("(高桥息)", "高桥西"));
replacementList.add(new Replacement("(车站10)", "车站十"));
replacementList.add(new Replacement("(车站11)", "车站十一"));
replacementList.add(new Replacement("(车站12)", "车站十二"));
replacementList.add(new Replacement("(车站13)", "车站十三"));
replacementList.add(new Replacement("(车站14)", "车站十四"));
replacementList.add(new Replacement("(车站15)", "车站十五"));
replacementList.add(new Replacement("(车站16)", "车站十六"));
replacementList.add(new Replacement("(车站17)", "车站十七"));
replacementList.add(new Replacement("(车站18)", "车站十八"));
replacementList.add(new Replacement("(车站19)", "车站十九"));
replacementList.add(new Replacement("(车站20)", "车站二十"));
replacementList.add(new Replacement("(车站21)", "车站二十一"));
replacementList.add(new Replacement("(车站22)", "车站二十二"));
replacementList.add(new Replacement("(车站23)", "车站二十三"));
replacementList.add(new Replacement("(车站24)", "车站二十四"));
replacementList.add(new Replacement("(车站25)", "车站二十五"));
replacementList.add(new Replacement("(车站26)", "车站二十六"));
replacementList.add(new Replacement("(车站27)", "车站二十七"));
replacementList.add(new Replacement("(车站28)", "车站二十八"));
replacementList.add(new Replacement("(车站29)", "车站二十九"));
replacementList.add(new Replacement("(车站1)", "车站一"));
replacementList.add(new Replacement("(车站2)", "车站二"));
replacementList.add(new Replacement("(车站3)", "车站三"));
replacementList.add(new Replacement("(车站4)", "车站四"));
replacementList.add(new Replacement("(车站5)", "车站五"));
replacementList.add(new Replacement("(车站6)", "车站六"));
replacementList.add(new Replacement("(车站7)", "车站七"));
replacementList.add(new Replacement("(车站8)", "车站八"));
replacementList.add(new Replacement("(车站9)", "车站九"));
replacementList.add(new Replacement("(5爱3|我爱干|5爱站|5爱车|我爱他|吾爱插|我爱张|不爱张|我爱着|父爱站|我爱家|52战" +
"|於爱站|於2站|5Y站|Y站|外站|屋外站|不2战|不爱站|外传|5爱弹|污爱战|无爱站|吾隘站|无爱展|无爱占|无爱战|屋爱站)", "邬隘站"));
replacementList.add(new Replacement("(平安大道)", "民安大道"));
replacementList.add(new Replacement("(忻州路)", "新洲路"));
replacementList.add(new Replacement("(c接口)", "新街口"));
//------------- 数字 --------------
numReplacementList.add(new Replacement("(零|洞|栋)", "0"));
numReplacementList.add(new Replacement("(一|幺|e|E)", "1"));
numReplacementList.add(new Replacement("(二|两|r)", "2"));
numReplacementList.add(new Replacement("(三)", "3"));
numReplacementList.add(new Replacement("(四)", "4"));
numReplacementList.add(new Replacement("(五)", "5"));
numReplacementList.add(new Replacement("(六)", "6"));
numReplacementList.add(new Replacement("(七|拐)", "7"));
numReplacementList.add(new Replacement("(八)", "8"));
numReplacementList.add(new Replacement("(九)", "9"));
numReplacementList.add(new Replacement("(|。)", ""));
numReplacementList.add(new Replacement("( )", ""));
numReplacementList.add(new Replacement("(低|地|第|敌|底|递)", "d"));
//------------- 专业词汇 --------------
replacementList.add(new Replacement("(行吊|情调|神雕|性交|心跳|香蕉|星标|平调|新调)", "行调"));
replacementList.add(new Replacement("(茼蒿)", "通号"));
replacementList.add(new Replacement("", ""));
replacementList.add(new Replacement("自动折法", "自动折返"));
replacementList.add(new Replacement("(倒插|刀叉|倒茶|倒叉|到插|倒闸|到察|到厂|道碴|到差|到查)", "道岔"));
replacementList.add(new Replacement("(师表|手表|时表)", "失表"));
replacementList.add(new Replacement("攻作组", "工作组"));
replacementList.add(new Replacement("军事表", "均失表"));
replacementList.add(new Replacement("(阴道插|阴道畅)", "因道岔"));
replacementList.add(new Replacement("(费用车|背影车)", "备用车"));
replacementList.add(new Replacement("(具贝家车条件|具被介绍条件)", "具备接车条件"));
replacementList.add(new Replacement("(烟雾)", "延误"));
replacementList.add(new Replacement("(客栈)", "各站"));
replacementList.add(new Replacement("(正线队长发送)", "正线队长复诵"));
replacementList.add(new Replacement("(电影)", "点名"));
replacementList.add(new Replacement("(代理|代练|待定|待命)", "待令"));
replacementList.add(new Replacement("(伤心|绍兴|上省)", "上行"));
replacementList.add(new Replacement("(调制)", "调至"));
replacementList.add(new Replacement("(时代丽|时代绿)", "首待令"));
replacementList.add(new Replacement("(绰号)", "做好"));
replacementList.add(new Replacement("(清江|青椒|京腔)", "请讲"));
replacementList.add(new Replacement("(转换慧)", "转换轨"));
replacementList.add(new Replacement("(芝法玲时期|至发令时期|此法令时期)", "自发令时起"));
replacementList.add(new Replacement("(上有延误)", "稍有延误"));
replacementList.add(new Replacement("(歌词)", "各次"));
replacementList.add(new Replacement("(程序你)", "准许你"));
replacementList.add(new Replacement("(车法)", "折返"));
replacementList.add(new Replacement("(拉萍|拉婷)", "拉停"));
replacementList.add(new Replacement("(站街)", "站级"));
replacementList.add(new Replacement("(羡慕)", "线路"));
replacementList.add(new Replacement("(功率标|功率表|公里表|公历表|公斤标|公立标)", "公里标"));
replacementList.add(new Replacement("(赚钱折法|赚钱折返)", "站前折返"));
replacementList.add(new Replacement("(权限各次)", "全线各次"));
replacementList.add(new Replacement("(庭院)", "停运"));
replacementList.add(new Replacement("(请客|青稞|青客|轻客|轻课|青涩|听课|停课|听,可|听可|顷刻|倾刻|千克|乘车|七个|切克)", "清客"));
replacementList.add(new Replacement("(会断|会短|回断)", "回段"));
replacementList.add(new Replacement("(清朝|请朝|请钞)", "请抄"));
replacementList.add(new Replacement("(请超链|请超龄)", "请抄令"));
replacementList.add(new Replacement("(首领处所|手令处所|手链处所)", "受令处所"));
replacementList.add(new Replacement("安全保护", "安全防护"));
replacementList.add(new Replacement("(手摇质|说杨智|受邀至)", "手摇至"));
replacementList.add(new Replacement("(反胃|软位)", "反位"));
replacementList.add(new Replacement("所逼", "锁闭"));
replacementList.add(new Replacement("位直", "位置"));
replacementList.add(new Replacement("丞将|成强|成交|沉降", "乘降"));
replacementList.add(new Replacement("售电弓|售电工|收电弓|数电弓", "受电弓"));
replacementList.add(new Replacement("故障回复", "故障恢复"));
replacementList.add(new Replacement("(出入断线|出路段线)", "出入段线"));
replacementList.add(new Replacement("(控子权|控质权|放置权|矿质权|空置权)", "控制权"));
replacementList.add(new Replacement("(手机号|首信号|首信好|首信后|首信哈|手型号)", "手信号"));
replacementList.add(new Replacement("(鼓掌|部长)", "故障"));
replacementList.add(new Replacement("(向凤|下方)", "下放"));
replacementList.add(new Replacement("(占线|占先|展现|战线)", "站线"));
replacementList.add(new Replacement("(定为)", "定位"));
replacementList.add(new Replacement("(者搬迁|折返性)", "折返线"));
replacementList.add(new Replacement("(进入)", "进路"));
replacementList.add(new Replacement("(污点|5点)", "无电"));
replacementList.add(new Replacement("(出轻)", "出清"));
replacementList.add(new Replacement("(抚慰)", "复位"));
replacementList.add(new Replacement("(实业)", "实验"));
replacementList.add(new Replacement("(控线)", "空闲"));
//------------- 设备相关 --------------
replacementList.add(new Replacement("(宇花祭|玉花祭|雨化寨|氯化钙|绿化带|优化钙)", "鱼化寨"));
replacementList.add(new Replacement("(保税局)", "保税区"));
replacementList.add(new Replacement("(高桥息)", "高桥西"));
replacementList.add(new Replacement("(车站10)", "车站十"));
replacementList.add(new Replacement("(车站11)", "车站十一"));
replacementList.add(new Replacement("(车站12)", "车站十二"));
replacementList.add(new Replacement("(车站13)", "车站十三"));
replacementList.add(new Replacement("(车站14)", "车站十四"));
replacementList.add(new Replacement("(车站15)", "车站十五"));
replacementList.add(new Replacement("(车站16)", "车站十六"));
replacementList.add(new Replacement("(车站17)", "车站十七"));
replacementList.add(new Replacement("(车站18)", "车站十八"));
replacementList.add(new Replacement("(车站19)", "车站十九"));
replacementList.add(new Replacement("(车站20)", "车站二十"));
replacementList.add(new Replacement("(车站21)", "车站二十一"));
replacementList.add(new Replacement("(车站22)", "车站二十二"));
replacementList.add(new Replacement("(车站23)", "车站二十三"));
replacementList.add(new Replacement("(车站24)", "车站二十四"));
replacementList.add(new Replacement("(车站25)", "车站二十五"));
replacementList.add(new Replacement("(车站26)", "车站二十六"));
replacementList.add(new Replacement("(车站27)", "车站二十七"));
replacementList.add(new Replacement("(车站28)", "车站二十八"));
replacementList.add(new Replacement("(车站29)", "车站二十九"));
replacementList.add(new Replacement("(车站1)", "车站一"));
replacementList.add(new Replacement("(车站2)", "车站二"));
replacementList.add(new Replacement("(车站3)", "车站三"));
replacementList.add(new Replacement("(车站4)", "车站四"));
replacementList.add(new Replacement("(车站5)", "车站五"));
replacementList.add(new Replacement("(车站6)", "车站六"));
replacementList.add(new Replacement("(车站7)", "车站七"));
replacementList.add(new Replacement("(车站8)", "车站八"));
replacementList.add(new Replacement("(车站9)", "车站九"));
replacementList.add(new Replacement("(5爱3|我爱干|5爱站|5爱车|我爱他|吾爱插|我爱张|不爱张|我爱着|父爱站|我爱家|52战" +
"|於爱站|於2站|5Y站|Y站|外站|屋外站|不2战|不爱站|外传|5爱弹|污爱战|无爱站|吾隘站|无爱展|无爱占|无爱战|屋爱站)", "邬隘站"));
replacementList.add(new Replacement("(平安大道)", "民安大道"));
replacementList.add(new Replacement("(忻州路)", "新洲路"));
replacementList.add(new Replacement("(c接口)", "新街口"));
}
/**
* 匹配替换对象
*/
public static class Replacement {
String match;
String replace;
public Replacement(String match, String replace) {
this.match = match;
this.replace = replace;
}
/**
* 匹配替换对象
*/
public static class Replacement {
String match;
String replace;
public Replacement(String match, String replace) {
this.match = match;
this.replace = replace;
}
String matchAndReplace(String content) {
if (content != null) {
return content.replaceAll(this.match, this.replace);
}
return null;
}
String matchAndReplace(String content) {
if (content != null) {
return content.replaceAll(this.match, this.replace);
}
return null;
}
}
public String numHandle(String content){
for (Replacement replacement : numReplacementList) {
content = replacement.matchAndReplace(content);
}
return regexReplace(content);
}
/**
* 对语音识别内容进行仿真用词处理
*
* @param voiceContent
* @return
*/
public String handle(String voiceContent) {
for (Replacement replacement : replacementList) {
voiceContent = replacement.matchAndReplace(voiceContent);
}
return regexReplace(voiceContent);
public String numHandle(String content) {
for (Replacement replacement : numReplacementList) {
content = replacement.matchAndReplace(content);
}
return regexReplace(content);
}
private String regexReplace(String s) {
log.info("正则替换");
//编号替换
Pattern pattern = Pattern.compile("([一二三四五六七八九十]+)(号)");
Matcher matcher = pattern.matcher(s);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
StringBuilder sb = new StringBuilder();
String[] split = matcher.group(1).split("");
for (String str : split) {
switch (str) {
case "":
sb.append("1");
break;
case "":
sb.append("2");
break;
case "":
sb.append("3");
break;
case "":
sb.append("4");
break;
case "":
sb.append("5");
break;
case "":
sb.append("6");
break;
case "":
sb.append("7");
break;
case "":
sb.append("8");
break;
case "":
sb.append("9");
break;
case "":
sb.append("10");
break;
}
}
sb.append("$2");
matcher.appendReplacement(result, sb.toString());
}
matcher.appendTail(result);
return result.toString();
/**
* 对语音识别内容进行仿真用词处理
*
* @param voiceContent
* @return
*/
public String handle(String voiceContent) {
for (Replacement replacement : replacementList) {
voiceContent = replacement.matchAndReplace(voiceContent);
}
return regexReplace(voiceContent);
}
private String regexReplace(String s) {
log.info("正则替换 字符[{}]", s);
//编号替换
Pattern pattern = Pattern.compile("([一二三四五六七八九十]+)(号)");
Matcher matcher = pattern.matcher(s);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
StringBuilder sb = new StringBuilder();
String[] split = matcher.group(1).split("");
for (String str : split) {
switch (str) {
case "":
sb.append("1");
break;
case "":
sb.append("2");
break;
case "":
sb.append("3");
break;
case "":
sb.append("4");
break;
case "":
sb.append("5");
break;
case "":
sb.append("6");
break;
case "":
sb.append("7");
break;
case "":
sb.append("8");
break;
case "":
sb.append("9");
break;
case "":
sb.append("10");
break;
}
}
sb.append("$2");
matcher.appendReplacement(result, sb.toString());
}
matcher.appendTail(result);
return result.toString();
}
}

View File

@ -7,19 +7,25 @@ import club.joylink.rtss.simulation.cbtc.training2.Step2;
import club.joylink.rtss.simulation.cbtc.training2.Training2;
import lombok.Getter;
/**
* 发送实训当前阶段完成情况
*/
@Getter
public class SimulationTrainingAudioEvent extends AbstractSimulationEvent {
private Step2 step;
private Step2 step;
private Operation2.SimCommand2 operation2;
private Operation2.SimCommand2 operation2;
private boolean matchResult;
/**
* 结果是否匹配
*/
private boolean matchResult;
public SimulationTrainingAudioEvent(Object source, Simulation simulation,Step2 step, Operation2.SimCommand2 operation2, boolean matchResult) {
super(source, simulation);
this.step = step;
this.operation2 = operation2;
this.matchResult = matchResult;
}
public SimulationTrainingAudioEvent(Object source, Simulation simulation, Step2 step, Operation2.SimCommand2 operation2, boolean matchResult) {
super(source, simulation);
this.step = step;
this.operation2 = operation2;
this.matchResult = matchResult;
}
}

View File

@ -8,5 +8,5 @@ import lombok.Data;
public class RaceSceneQueryVO extends PageQueryVO {
private String name;
private Type type;
private String type;
}

View File

@ -106,11 +106,11 @@ logging:
club.joylink.rtss: DEBUG
minio:
endpoint: http://192.168.3.233
endpoint: http://192.168.33.233
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
replaceHttps: true
replaceHttps: false
common:
env: dev
@ -167,11 +167,11 @@ logging:
club.joylink.rtss: INFO
minio:
endpoint: http://192.168.3.233
endpoint: http://192.168.33.233
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
replaceHttps: true
replaceHttps: false
common:

View File

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

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.services.race;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
@ -29,6 +30,7 @@ public class SceneServiceTest {
RaceSceneQueryVO query = new RaceSceneQueryVO();
query.setPageNum(1);
query.setPageSize(10);
query.setType(Type.Video.name());
PageVO<RaceSceneListVO> page = this.sceneService.page(query);
System.out.println(JsonUtils.writeValueAsString(page));
@ -36,7 +38,7 @@ public class SceneServiceTest {
@Test
public void detailTest() {
RaceSceneVO vo = this.sceneService.detail(2L);
RaceSceneVO vo = this.sceneService.detail(5L);
System.out.println(JsonUtils.writeValueAsString(vo));
}
}

View File

@ -66,7 +66,7 @@ public class TaskServiceTest {
@Test
public void detailTest() {
RaceTaskDetailVO vo = this.taskService.detail(1L);
RaceTaskDetailVO vo = this.taskService.detail(44L);
System.out.println(JsonUtils.writeValueAsString(vo));
}