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

This commit is contained in:
tiger_zhou 2023-04-14 15:51:48 +08:00
commit 3580f135a0
78 changed files with 5635 additions and 104 deletions

33
pom.xml
View File

@ -146,6 +146,39 @@
<artifactId>protobuf-java</artifactId>
<version>3.19.3</version>
</dependency>
<!-- <dependency>
<groupId>com.chenlb.mmseg4j</groupId>
<artifactId>mmseg4j-core</artifactId>
<version>1.10.0</version>
</dependency>-->
<!-- <dependency>
<groupId>org.ansj</groupId>
<artifactId>ansj_seg</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
</dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<!-- <dependency>
<groupId>info.debatty</groupId>
<artifactId>java-string-similarity</artifactId>
<version>2.0.0</version>
</dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,3 @@
ALTER TABLE `joylink`.`rts_published_training2` ADD COLUMN `shared` int NULL DEFAULT 0 COMMENT '0 不共享1共享' AFTER `client`;
update rts_published_training2 SET shared = 1 WHERE creator_id = 0 ;

View File

@ -75,4 +75,19 @@ public class TaskExecutorConfiguration {
taskExecutor.initialize();
return taskExecutor;
}
/**
* 语音识别业务处理线程
*/
@Bean("voiceDiscriminateExecutor")
public TaskExecutor voiceDiscriminateExecutor(Environment env) {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setThreadNamePrefix("ns-voice-discriminate-executor-");
taskExecutor.setCorePoolSize(2);
taskExecutor.setMaxPoolSize(2);
taskExecutor.setQueueCapacity(100);
taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
taskExecutor.initialize();
return taskExecutor;
}
}

View File

@ -8,11 +8,13 @@ public interface BusinessConsts {
* 状态 1-启用/有效
*/
String STATUS_USE = "1";
int STATUS_USE_INT = 1;
/**
* 状态 0-禁用/无效
*/
String STATUS_NOT_USE = "0";
int STATUS_NOT_USE_INT = 0;
/**
* 验证码有效期: 单位 分钟

View File

@ -0,0 +1,53 @@
package club.joylink.rtss.controller.conversation;
import club.joylink.rtss.services.conversation.ConversationGroupServiceImpl;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.conversation.ConversationGroupQueryVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 项目会话群设置controller
*/
@RestController
@RequestMapping("/api/conversationGroup")
public class ConversationGroupController {
@Autowired
private ConversationGroupServiceImpl conversationGroupService;
@GetMapping("/list")
public List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, @RequestAttribute AccountVO user) {
return conversationGroupService.queryList(queryVO, user);
}
@GetMapping("/page/users")
public PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, @RequestAttribute AccountVO user) {
return conversationGroupService.pagingQuery(queryVO, user);
}
@GetMapping("/{id}")
public ConversationGroupVO getById(@PathVariable Long id) {
return conversationGroupService.getById(id);
}
@PostMapping("")
public String create(@RequestBody ConversationGroupVO vo, @RequestAttribute AccountVO user) {
return conversationGroupService.create(vo, user);
}
@PutMapping("/{id}/data")
public void update(@PathVariable Long id, @RequestBody ConversationGroupVO vo) {
vo.setId(id);
conversationGroupService.update(vo);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
conversationGroupService.delete(id);
}
}

View File

@ -111,8 +111,8 @@ public class ProjectInfoController {
}
@GetMapping("/check/markKey")
public boolean checkProjectViewMarkKey(String markKey) {
return projectService.checkProjectViewMarkKey(markKey);
public boolean checkProjectViewMarkKey(String markKey, Long id) {
return projectService.checkProjectViewMarkKey(markKey, id);
}
@GetMapping("/simple")

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.controller.training2;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role;
@ -35,22 +36,33 @@ public class TrainingV2PublishController {
* 已发布实训上架
*/
@PostMapping("/put/on")
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(@RequestBody PutOnPublishedTraining2ReqVo req){
return this.publishService.putOnPublishedTrainings(req);
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(@RequestBody PutOnPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
return this.publishService.putOnPublishedTrainings(req,userInfoVO);
}
/**
* 已发布实训下架
*/
@PostMapping("/pull/off")
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(@RequestBody PullOffPublishedTraining2ReqVo req){
return this.publishService.pullOffPublishedTrainings(req);
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(@RequestBody PullOffPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
return this.publishService.pullOffPublishedTrainings(req,userInfoVO);
}
/**
* 变更共享状态
* @param id
* @param shared
* @param userInfoVO
*/
@GetMapping("/{id}/{shared}")
public void changeSharedStatus(@PathVariable(name="id") Long id,@PathVariable(name="shared") Integer shared,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
this.publishService.changeSharedStatus(id,shared,userInfoVO);
}
/**
* 删除已发布实训
*/
@DeleteMapping
public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req){
return this.publishService.deletePublishedTrainings(req);
public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
return this.publishService.deletePublishedTrainings(req,userInfoVO);
}
@ -60,8 +72,9 @@ public class TrainingV2PublishController {
* @return
*/
@PostMapping("/manage/infos")
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo){
return this.publishService.findTrainingInfoForPage(vo);
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
vo.setOrgId(userInfoVO.getTopOrgId());
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,true);
}
/**
@ -73,17 +86,17 @@ public class TrainingV2PublishController {
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@RequestBody PublishedTrainingListRspVo vo
,@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
//只查询以上架
vo.setState(1);
vo.setState(BusinessConsts.STATUS_USE_INT);
vo.setOrgId(loginUserInfoVO.getTopOrgId());
return this.publishService.findTrainingInfo(vo);
return this.publishService.findTrainingInfo(vo,loginUserInfoVO);
}
/**
* 查所有的已发布场景实训的基础信息
*/
@Role(value = RoleEnum.SuperAdmin)
@GetMapping("/list")
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo){
return this.publishService.findTrainingInfoForPage(vo);
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,false);
}
/**

View File

@ -0,0 +1,52 @@
package club.joylink.rtss.controller.voice;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.services.voice.IVoiceDataConfigService;
import club.joylink.rtss.services.voice.IVoiceTrainingService;
import club.joylink.rtss.services.voice.baidu.TokenHolder;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
import club.joylink.rtss.vo.voice.VoiceQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* 语音AI接口
*/
@RestController
@RequestMapping("/api/voice/manage")
public class VoiceManageController {
@Autowired
private IVoiceDataConfigService configService;
@PostMapping("saveOrUpdate")
public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO, @RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
this.configService.saveOrUpdate(configVO,userInfoVO);
}
@GetMapping("find/{id}")
public VoiceDiscriminateConfigVO find(@PathVariable(value = "id") Long id) {
return this.configService.byId(id);
}
@GetMapping("query")
public PageVO<VoiceDiscriminateConfigVO> query(@ModelAttribute VoiceQueryVO queryVO){
return this.configService.query(queryVO);
}
/**
* 获取百度语音识别token
*/
@GetMapping("{id}/{status}")
public void changeStatus(@PathVariable(value = "id") Long id,@PathVariable(value = "status")Integer status,@RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
this.configService.changeStatus(id,status,userInfoVO);
}
}

View File

@ -52,7 +52,7 @@ public interface PublishedTraining2DAO {
@Insert(value = "<script>" +
"insert into published_training2 (name, map_id, description, type, label_json, map_location_json, bg_scene_json," +
" run_plan_id, opera_json, step_json, scoring_rule_json, member_json, player_id_json, failure_condition_json," +
" creator_id, create_time, update_time, state, final_scenes_json, org_id, client)" +
" creator_id, create_time, update_time, state, final_scenes_json, org_id, client, shared)" +
"values " +
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
" (#{entity.name,jdbcType=VARCHAR}, #{entity.mapId,jdbcType=BIGINT}, #{entity.description,jdbcType=VARCHAR}, " +
@ -61,7 +61,7 @@ public interface PublishedTraining2DAO {
" #{entity.stepJson,jdbcType=LONGVARCHAR}, #{entity.scoringRuleJson,jdbcType=LONGVARCHAR}, #{entity.memberJson,jdbcType=LONGVARCHAR}," +
" #{entity.playerIdJson,jdbcType=LONGVARCHAR}, #{entity.failureConditionJson,jdbcType=VARCHAR}, #{entity.creatorId,jdbcType=BIGINT}," +
" #{entity.createTime,jdbcType=DATETIME}, #{entity.updateTime,jdbcType=DATETIME}, #{entity.state,jdbcType=INT}," +
" #{entity.finalScenesJson,jdbcType=LONGVARCHAR}, #{entity.orgId,jdbcType=BIGINT}, #{entity.client,jdbcType=VARCHAR})" +
" #{entity.finalScenesJson,jdbcType=LONGVARCHAR}, #{entity.orgId,jdbcType=BIGINT}, #{entity.client,jdbcType=VARCHAR}, #{entity.shared, jdbcType=INT})" +
" </foreach>" +
"</script>")
void batchInsert(@Param("list") PublishedTraining2 list);
@ -72,4 +72,6 @@ public interface PublishedTraining2DAO {
List<Map<String, Long>> selectTrainingByRuleId(@Param("ruleIdList") List<Long> ruleIdList, @Param("mapIdList") List<Long> mapIdList);
List<Long> selectTrainingIdByRuleNameAndMapId(@Param("ruleNameList") List<Map<String,String>> ruleNameMapList, @Param("mapId") Long mapId);
int updateTrainingOrgByMapIdList(@Param("orgId") Long orgId, @Param("mapIdList") List<Long> mapIdList);
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfo;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface RtsConversationGroupInfoMapper extends MyBatisBaseDao<RtsConversationGroupInfo, Long, RtsConversationGroupInfoExample> {
List<RtsConversationGroupInfo> selectByExampleWithBLOBs(RtsConversationGroupInfoExample example);
int updateByExampleWithBLOBs(@Param("record") RtsConversationGroupInfo record, @Param("example") RtsConversationGroupInfoExample example);
int updateByPrimaryKeyWithBLOBs(RtsConversationGroupInfo record);
}

View File

@ -65,6 +65,7 @@ public interface TrainingDAO extends MyBatisBaseDao<Training, Long, TrainingExam
"<when test=\"null != trainingName and '' != trainingName \"> and training.name like CONCAT('%',#{trainingName},'%') </when>" +
"<when test=\"null != userName and '' != userName \"> and user.name like CONCAT('%',#{userName},'%') </when>" +
"<when test=\"null != userMobile and '' != userMobile \"> and user.mobile like CONCAT('%',#{userMobile},'%') </when>" +
"<when test=\"null != userId and '' != userId \"> and user.id = #{userId} </when>" +
" order by id DESC " +
"</script>")
Page<UserTrainingListVO> queryPagedUserTraining(UserTrainingQueryVO queryVO);

View File

@ -54,6 +54,7 @@ public interface UserExamMapper {
"<when test=\"null != examName and '' != examName \"> and ue.exam_name like CONCAT('%',#{examName},'%') </when>" +
"<when test=\"null != userName and '' != userName \"> and user.name like CONCAT('%',#{userName},'%') </when>" +
"<when test=\"null != userMobile and '' != userMobile \"> and user.mobile like CONCAT('%',#{userMobile},'%') </when>" +
"<when test=\"null != userId and '' != userId \"> and user.id = #{userId} </when>" +
"<when test=\"null != result and '' != result \"> and ue.result = #{result} </when>" +
" order by end_time DESC " +
"</script>")

View File

@ -0,0 +1,40 @@
package club.joylink.rtss.dao.voice;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfig;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface VoiceDiscriminateConfigDAO {
long countByExample(VoiceDiscriminateConfigExample example);
int deleteByExample(VoiceDiscriminateConfigExample example);
int deleteByPrimaryKey(Long id);
int insert(VoiceDiscriminateConfig record);
int insertSelective(VoiceDiscriminateConfig record);
List<VoiceDiscriminateConfig> selectByExampleWithBLOBs(VoiceDiscriminateConfigExample example);
List<VoiceDiscriminateConfig> selectByExample(VoiceDiscriminateConfigExample example);
VoiceDiscriminateConfig selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") VoiceDiscriminateConfig record, @Param("example") VoiceDiscriminateConfigExample example);
int updateByExampleWithBLOBs(@Param("record") VoiceDiscriminateConfig record, @Param("example") VoiceDiscriminateConfigExample example);
int updateByExample(@Param("record") VoiceDiscriminateConfig record, @Param("example") VoiceDiscriminateConfigExample example);
int updateByPrimaryKeySelective(VoiceDiscriminateConfig record);
int updateByPrimaryKeyWithBLOBs(VoiceDiscriminateConfig record);
int updateByPrimaryKey(VoiceDiscriminateConfig record);
}

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.entity.conversation;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 群组信息
*/
@Data
public class RtsConversationGroupInfo {
/**
* 主键
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 地图
*/
private Long mapId;
/**
* 项目code
*/
private String projectCode;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 创建者
*/
private Long creatorId;
/**
* 状态1为有效
*/
private Integer status;
/**
* 群组ID
*/
private Long leaderId;
/**
* 成员ID
*/
private String memberIds;
}

View File

@ -0,0 +1,771 @@
package club.joylink.rtss.entity.conversation;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RtsConversationGroupInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RtsConversationGroupInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLike(Long value) {
addCriterion("map_id like", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotLike(Long value) {
addCriterion("map_id not like", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andLeaderIdIsNull() {
addCriterion("leader_id is null");
return (Criteria) this;
}
public Criteria andLeaderIdIsNotNull() {
addCriterion("leader_id is not null");
return (Criteria) this;
}
public Criteria andLeaderIdEqualTo(Long value) {
addCriterion("leader_id =", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdNotEqualTo(Long value) {
addCriterion("leader_id <>", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdGreaterThan(Long value) {
addCriterion("leader_id >", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdGreaterThanOrEqualTo(Long value) {
addCriterion("leader_id >=", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdLessThan(Long value) {
addCriterion("leader_id <", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdLessThanOrEqualTo(Long value) {
addCriterion("leader_id <=", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdIn(List<Long> values) {
addCriterion("leader_id in", values, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdNotIn(List<Long> values) {
addCriterion("leader_id not in", values, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdBetween(Long value1, Long value2) {
addCriterion("leader_id between", value1, value2, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdNotBetween(Long value1, Long value2) {
addCriterion("leader_id not between", value1, value2, "leaderId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -78,5 +78,10 @@ public class PublishedTraining2 implements Serializable {
private String client;
/**
* 是否共享0 不共享1共享
*/
private Integer shared;
private static final long serialVersionUID = 1L;
}

View File

@ -1054,6 +1054,66 @@ public class PublishedTraining2Example {
addCriterion("org_id not between", value1, value2, "orgId");
return (Criteria) this;
}
public Criteria andSharedIsNull() {
addCriterion("shared is null");
return (Criteria) this;
}
public Criteria andSharedIsNotNull() {
addCriterion("shared is not null");
return (Criteria) this;
}
public Criteria andSharedEqualTo(Integer value) {
addCriterion("shared =", value, "shared");
return (Criteria) this;
}
public Criteria andSharedNotEqualTo(Integer value) {
addCriterion("shared <>", value, "shared");
return (Criteria) this;
}
public Criteria andSharedGreaterThan(Integer value) {
addCriterion("shared >", value, "shared");
return (Criteria) this;
}
public Criteria andSharedGreaterThanOrEqualTo(Integer value) {
addCriterion("shared >=", value, "shared");
return (Criteria) this;
}
public Criteria andSharedLessThan(Integer value) {
addCriterion("shared <", value, "shared");
return (Criteria) this;
}
public Criteria andSharedLessThanOrEqualTo(Integer value) {
addCriterion("shared <=", value, "shared");
return (Criteria) this;
}
public Criteria andSharedIn(List<Integer> values) {
addCriterion("shared in", values, "shared");
return (Criteria) this;
}
public Criteria andSharedNotIn(List<Integer> values) {
addCriterion("shared not in", values, "shared");
return (Criteria) this;
}
public Criteria andSharedBetween(Integer value1, Integer value2) {
addCriterion("shared between", value1, value2, "shared");
return (Criteria) this;
}
public Criteria andSharedNotBetween(Integer value1, Integer value2) {
addCriterion("shared not between", value1, value2, "shared");
return (Criteria) this;
}
}
/**

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.entity.voice;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import club.joylink.rtss.simulation.cbtc.discriminate.OperateRule;
import club.joylink.rtss.simulation.cbtc.discriminate.ParamExtractRule;
import club.joylink.rtss.simulation.cbtc.discriminate.ReplyRule;
import lombok.Data;
/**
* @author
*
*/
@Data
public class VoiceDiscriminateConfig implements Serializable {
private Long id;
/**
* 关键字正则
*/
private String keyWordRules;
/**
* 执行指令系统操作指令
* {@link OperateRule}
*/
private String execOperateRule;
/**
* 回复指令系统指令操作完毕或者无系统指令时交互回复
* {@link ReplyRule}
*/
private String replyRule;
private Long mapId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Long operateId;
/**
* 描述
*/
private String describe;
/**
* 状态0=编辑,1=使用
*/
private Integer status;
/**
* 所需参数 List
* {@link ParamExtractRule}
*/
private String paramsRules;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,863 @@
package club.joylink.rtss.entity.voice;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class VoiceDiscriminateConfigExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public VoiceDiscriminateConfigExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andKeyWordRulesIsNull() {
addCriterion("key_word_rules is null");
return (Criteria) this;
}
public Criteria andKeyWordRulesIsNotNull() {
addCriterion("key_word_rules is not null");
return (Criteria) this;
}
public Criteria andKeyWordRulesEqualTo(String value) {
addCriterion("key_word_rules =", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesNotEqualTo(String value) {
addCriterion("key_word_rules <>", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesGreaterThan(String value) {
addCriterion("key_word_rules >", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesGreaterThanOrEqualTo(String value) {
addCriterion("key_word_rules >=", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesLessThan(String value) {
addCriterion("key_word_rules <", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesLessThanOrEqualTo(String value) {
addCriterion("key_word_rules <=", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesLike(String value) {
addCriterion("key_word_rules like", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesNotLike(String value) {
addCriterion("key_word_rules not like", value, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesIn(List<String> values) {
addCriterion("key_word_rules in", values, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesNotIn(List<String> values) {
addCriterion("key_word_rules not in", values, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesBetween(String value1, String value2) {
addCriterion("key_word_rules between", value1, value2, "keyWordRules");
return (Criteria) this;
}
public Criteria andKeyWordRulesNotBetween(String value1, String value2) {
addCriterion("key_word_rules not between", value1, value2, "keyWordRules");
return (Criteria) this;
}
public Criteria andExecOperateRuleIsNull() {
addCriterion("exec_operate_rule is null");
return (Criteria) this;
}
public Criteria andExecOperateRuleIsNotNull() {
addCriterion("exec_operate_rule is not null");
return (Criteria) this;
}
public Criteria andExecOperateRuleEqualTo(String value) {
addCriterion("exec_operate_rule =", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleNotEqualTo(String value) {
addCriterion("exec_operate_rule <>", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleGreaterThan(String value) {
addCriterion("exec_operate_rule >", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleGreaterThanOrEqualTo(String value) {
addCriterion("exec_operate_rule >=", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleLessThan(String value) {
addCriterion("exec_operate_rule <", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleLessThanOrEqualTo(String value) {
addCriterion("exec_operate_rule <=", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleLike(String value) {
addCriterion("exec_operate_rule like", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleNotLike(String value) {
addCriterion("exec_operate_rule not like", value, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleIn(List<String> values) {
addCriterion("exec_operate_rule in", values, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleNotIn(List<String> values) {
addCriterion("exec_operate_rule not in", values, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleBetween(String value1, String value2) {
addCriterion("exec_operate_rule between", value1, value2, "execOperateRule");
return (Criteria) this;
}
public Criteria andExecOperateRuleNotBetween(String value1, String value2) {
addCriterion("exec_operate_rule not between", value1, value2, "execOperateRule");
return (Criteria) this;
}
public Criteria andReplyRuleIsNull() {
addCriterion("reply_rule is null");
return (Criteria) this;
}
public Criteria andReplyRuleIsNotNull() {
addCriterion("reply_rule is not null");
return (Criteria) this;
}
public Criteria andReplyRuleEqualTo(String value) {
addCriterion("reply_rule =", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleNotEqualTo(String value) {
addCriterion("reply_rule <>", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleGreaterThan(String value) {
addCriterion("reply_rule >", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleGreaterThanOrEqualTo(String value) {
addCriterion("reply_rule >=", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleLessThan(String value) {
addCriterion("reply_rule <", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleLessThanOrEqualTo(String value) {
addCriterion("reply_rule <=", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleLike(String value) {
addCriterion("reply_rule like", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleNotLike(String value) {
addCriterion("reply_rule not like", value, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleIn(List<String> values) {
addCriterion("reply_rule in", values, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleNotIn(List<String> values) {
addCriterion("reply_rule not in", values, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleBetween(String value1, String value2) {
addCriterion("reply_rule between", value1, value2, "replyRule");
return (Criteria) this;
}
public Criteria andReplyRuleNotBetween(String value1, String value2) {
addCriterion("reply_rule not between", value1, value2, "replyRule");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andOperateIdIsNull() {
addCriterion("operate_id is null");
return (Criteria) this;
}
public Criteria andOperateIdIsNotNull() {
addCriterion("operate_id is not null");
return (Criteria) this;
}
public Criteria andOperateIdEqualTo(Long value) {
addCriterion("operate_id =", value, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdNotEqualTo(Long value) {
addCriterion("operate_id <>", value, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdGreaterThan(Long value) {
addCriterion("operate_id >", value, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdGreaterThanOrEqualTo(Long value) {
addCriterion("operate_id >=", value, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdLessThan(Long value) {
addCriterion("operate_id <", value, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdLessThanOrEqualTo(Long value) {
addCriterion("operate_id <=", value, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdIn(List<Long> values) {
addCriterion("operate_id in", values, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdNotIn(List<Long> values) {
addCriterion("operate_id not in", values, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdBetween(Long value1, Long value2) {
addCriterion("operate_id between", value1, value2, "operateId");
return (Criteria) this;
}
public Criteria andOperateIdNotBetween(Long value1, Long value2) {
addCriterion("operate_id not between", value1, value2, "operateId");
return (Criteria) this;
}
public Criteria andDescribeIsNull() {
addCriterion("`describe` is null");
return (Criteria) this;
}
public Criteria andDescribeIsNotNull() {
addCriterion("`describe` is not null");
return (Criteria) this;
}
public Criteria andDescribeEqualTo(String value) {
addCriterion("`describe` =", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeNotEqualTo(String value) {
addCriterion("`describe` <>", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeGreaterThan(String value) {
addCriterion("`describe` >", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeGreaterThanOrEqualTo(String value) {
addCriterion("`describe` >=", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeLessThan(String value) {
addCriterion("`describe` <", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeLessThanOrEqualTo(String value) {
addCriterion("`describe` <=", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeLike(String value) {
addCriterion("`describe` like", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeNotLike(String value) {
addCriterion("`describe` not like", value, "describe");
return (Criteria) this;
}
public Criteria andDescribeIn(List<String> values) {
addCriterion("`describe` in", values, "describe");
return (Criteria) this;
}
public Criteria andDescribeNotIn(List<String> values) {
addCriterion("`describe` not in", values, "describe");
return (Criteria) this;
}
public Criteria andDescribeBetween(String value1, String value2) {
addCriterion("`describe` between", value1, value2, "describe");
return (Criteria) this;
}
public Criteria andDescribeNotBetween(String value1, String value2) {
addCriterion("`describe` not between", value1, value2, "describe");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -59,6 +59,10 @@ public enum BusinessExceptionAssertEnum implements BusinessExceptionAssert {
INCORRECT_VERIFICATION_CODE(40051, "incorrect verification code"),
THIRD_SERVICE_CALL_EXCEPTION(40071, "the third service call exception"),
VOICE_COMMAND_PARSE_ERROR(40061,"voice command parse error"),
VOICE_COMMAND_CONFIG_NULL(40062,"voice command config is null"),
VOICE_COMMAND_DEVICE_UNDEFINED(40063,"device undefined"),
VOICE_COMMAND_WORK_UNDEFINED(40064,"device work undefined"),
//支付异常
PAY_ERROR(50000, "pay error"),
WECHAT_NOTIFY_ERROR(401, "wechat notify error")

View File

@ -367,4 +367,11 @@ public interface IMapService {
* 查询用户相关的地图列表
*/
List<MapVO> listMapsOfUser(LoginUserInfoVO loginInfo);
/**
* 通过项目编码列表获取地图ID
* @param projectCodes 项目编码列表
* @return 地图ID列表
*/
List<Long> getMapIdByProjectList(List<String> projectCodes);
}

View File

@ -941,6 +941,17 @@ public class MapService implements IMapService, ApplicationRunner {
return MapVO.convert2VOList(mapInfos);
}
@Override
public List<Long> getMapIdByProjectList(List<String> projectCodes) {
if (CollectionUtils.isEmpty(projectCodes)) {
return null;
}
MapInfoExample example = new MapInfoExample();
MapInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(MapStatus.Online.getCode());
criteria.andProjectCodeIn(projectCodes);
return mapInfoDAO.selectByExample(example).stream().map(MapInfo::getId).collect(Collectors.toList());
}
/**
* 该版本的地图数据是否存在
*/

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.services.conversation;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.conversation.ConversationGroupQueryVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import java.util.List;
/**
* 项目会话群组管理service接口
*/
public interface ConversationGroupService {
/**
* 查询会话群组列表
*
* @param queryVO 查询参数
* @param user 用户
* @return 群组列表
*/
List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, AccountVO user);
/**
* 查询带参数的会话群组列表
*
* @param queryVO 查询参数
* @param user 用户
* @return 群组列表
*/
PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, AccountVO user);
/**
* 根据ID获取会话群组信息
*
* @param id 主键
* @return 群组信息
*/
ConversationGroupVO getById(Long id);
/**
* 创建群组信息
*
* @param vo 群组信息
* @param user 用户信息
* @return 创建结果
*/
String create(ConversationGroupVO vo, AccountVO user);
/**
* 更新群组信息
* @param vo 群组信息
*/
void update(ConversationGroupVO vo);
/**
* 删除群组信息
*
* @param id 主键
*/
void delete(Long id);
}

View File

@ -0,0 +1,105 @@
package club.joylink.rtss.services.conversation;
import club.joylink.rtss.dao.RtsConversationGroupInfoMapper;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfo;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.conversation.ConversationGroupQueryVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import club.joylink.rtss.vo.project.ProjectInfoVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* 项目会话群组管理service
*/
@Slf4j
@Service
public class ConversationGroupServiceImpl implements ConversationGroupService {
private static final int VALID = 1;
@Autowired
private RtsConversationGroupInfoMapper conversationGroupInfoMapper;
@Override
public List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, AccountVO user) {
List<RtsConversationGroupInfo> conversationGroupInfoList = conversationGroupInfoMapper.selectByExampleWithBLOBs(getExample(queryVO));
return conversationGroupInfoList.stream().map(ConversationGroupVO::new).collect(Collectors.toList());
}
@Override
public PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, AccountVO user) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<RtsConversationGroupInfo> page = (Page<RtsConversationGroupInfo>) conversationGroupInfoMapper.selectByExampleWithBLOBs(getExample(queryVO));
return PageVO.convert(page, page.getResult().stream().map(ConversationGroupVO::new).collect(Collectors.toList()));
}
@Override
public ConversationGroupVO getById(Long id) {
RtsConversationGroupInfo rtsConversationGroupInfo = conversationGroupInfoMapper.selectByPrimaryKey(id);
return new ConversationGroupVO(rtsConversationGroupInfo);
}
@Override
public String create(ConversationGroupVO vo, AccountVO user) {
if (vo.getId() != null) {
update(vo);
} else {
RtsConversationGroupInfo rtsConversationGroupInfo = vo.toEntity();
rtsConversationGroupInfo.setCreateTime(LocalDateTime.now());
rtsConversationGroupInfo.setUpdateTime(LocalDateTime.now());
rtsConversationGroupInfo.setStatus(VALID);
conversationGroupInfoMapper.insert(rtsConversationGroupInfo);
}
return "保存成功";
}
@Override
public void update(ConversationGroupVO vo) {
if (vo.getId() != null) {
RtsConversationGroupInfo rtsConversationGroupInfo = vo.toEntity();
rtsConversationGroupInfo.setUpdateTime(LocalDateTime.now());
conversationGroupInfoMapper.updateByPrimaryKeySelective(rtsConversationGroupInfo);
}
}
@Override
public void delete(Long id) {
conversationGroupInfoMapper.deleteByPrimaryKey(id);
}
/**
* 获取查询条件
*
* @param queryVO 查询条件实体
* @return 条件实体
*/
private RtsConversationGroupInfoExample getExample(ConversationGroupQueryVO queryVO) {
RtsConversationGroupInfoExample example = new RtsConversationGroupInfoExample();
RtsConversationGroupInfoExample.Criteria criteria = example.createCriteria();
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
if (CollectionUtils.isEmpty(queryVO.getMapIds())) {
criteria.andMapIdIn(queryVO.getMapIds());
}
if (StringUtils.hasText(queryVO.getProjectCode())) {
criteria.andProjectCodeEqualTo(queryVO.getProjectCode());
}
criteria.andStatusEqualTo(VALID);
return example;
}
}

View File

@ -5,7 +5,9 @@ import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.OrgProjectDAO;
import club.joylink.rtss.dao.OrgUserDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.LoginSessionManager;
import club.joylink.rtss.services.training2.Training2PublishService;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.vo.AccountVO;
@ -41,6 +43,12 @@ public class OrgProjectService implements IOrgProjectService {
@Autowired
private IOrgUserService iOrgUserService;
@Autowired
private IMapService iMapService;
@Autowired
private Training2PublishService training2PublishService;
@Override
public List<OrgProject> queryOrgProjectListByOrgId(Long orgId) {
OrgProjectExample orgProjectExample = new OrgProjectExample();
@ -125,6 +133,7 @@ public class OrgProjectService implements IOrgProjectService {
List<String> newCodeList = projectList.stream().filter(code -> !oldProjectList.contains(code)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(newCodeList)) {
save(orgId, newCodeList, user);
changeDefaultTrainingOrgId(orgId, newCodeList);
}
}
}
@ -183,4 +192,13 @@ public class OrgProjectService implements IOrgProjectService {
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(orgIdList);
return orgDAO.selectByExample(orgExample);
}
// 20230412 将项目下所有地图生成的实训组织修改为此组织
private void changeDefaultTrainingOrgId(Long orgId, List<String> projectCodes) {
List<Long> mapIdList = iMapService.getMapIdByProjectList(projectCodes);
if (!CollectionUtils.isEmpty(mapIdList)) {
training2PublishService.updatePublishTrainingOrgIdByMapId(orgId, mapIdList);
}
}
}

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.dao.paper.*;
import club.joylink.rtss.entity.paper.*;
@ -283,7 +284,7 @@ public class PaperUserCreateService {
PaperExceptionAssert.PrNotExisted.assertTrue(!CollectionUtils.isEmpty(rule.getSceneInfo()),"场景实训规则不存在");
List<Long> allIds = rule.getSceneInfo().stream().map(PaperCompositionWithRuleVo.ScenePagerRuleVO::getPublishTrainId).collect(Collectors.toList());
PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andStateEqualTo(1).andIdIn(allIds);
example.createCriteria().andStateEqualTo(BusinessConsts.STATUS_USE_INT).andIdIn(allIds);
long count = trainingDAO.countByExample(example);
PaperExceptionAssert.PqEnough.assertTrue(allIds.size() == count, "没有足够的符合条件的实训题目");
rule.getSceneInfo().forEach(q -> {
@ -311,11 +312,15 @@ public class PaperUserCreateService {
// PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
String subTypeStr = this.paperUserService.getTrainingType(rule.getSubtype());
PublishedTraining2Example questionExample = new PublishedTraining2Example();
PublishedTraining2Example.Criteria criteria = questionExample.createCriteria();
/*PublishedTraining2Example.Criteria criteria = questionExample.createCriteria();
if(!CollectionUtils.isEmpty(existTrainIds)){
criteria.andIdNotIn(existTrainIds);
}*/
PublishedTraining2Example.Criteria criteria = this.training2PublishService.basicQueryCriteria(questionExample,pc.getMapId(),pc.getOrgId(), StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null);
if(!CollectionUtils.isEmpty(existTrainIds)){
criteria.andIdNotIn(existTrainIds);
}
this.training2PublishService.basicQueryCriteria(criteria,pc.getMapId(),pc.getOrgId(), StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null);
if(!CollectionUtils.isEmpty(rule.getTags())){
for (String tag : rule.getTags()) {
criteria.andLabelJsonLike(String.format("%%%s%%", tag));

View File

@ -103,7 +103,7 @@ public interface ProjectService {
/**
* 检查项目编码是否存在
*/
boolean checkProjectViewMarkKey(String markKey);
boolean checkProjectViewMarkKey(String markKey, Long id);
/************************** runtime ***************************/
/**

View File

@ -258,7 +258,7 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public void saveProjectView(ProjectView projectView) {
if (checkProjectViewMarkKey(projectView.getMarkKey())) {
if (checkProjectViewMarkKey(projectView.getMarkKey(), null)) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "项目已存在");
}
projectView.setCreateTime(LocalDateTime.now());
@ -268,9 +268,13 @@ public class ProjectServiceImpl implements ProjectService {
}
@Override
public boolean checkProjectViewMarkKey(String markKey) {
public boolean checkProjectViewMarkKey(String markKey, Long id) {
ProjectViewExample projectExample = new ProjectViewExample();
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
ProjectViewExample.Criteria criteria = projectExample.createCriteria();
criteria.andStatusEqualTo(EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
if (id != null) {
criteria.andIdNotEqualTo(id);
}
long num = projectViewDAO.countByExample(projectExample);
return num > 0;
}

View File

@ -7,6 +7,7 @@ import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
@ -80,6 +81,8 @@ public class Training2Convertor {
rsp.setMapLocationJson(from.getMapLocationJson());
rsp.setState(from.getState());
rsp.setClient(from.getClient());
rsp.setShared(from.getShared());
rsp.setOrgId(from.getOrgId());
return rsp;
}
}

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.services.training2;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.DraftTraining2DAO;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.entity.training2.*;
@ -38,6 +39,8 @@ public class Training2DraftPublishService {
DraftTraining2WithBLOBs draft = dtFinds.get(0);
//
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
//加入共享默认不共享
pub.setShared(BusinessConsts.STATUS_NOT_USE_INT);
if(null!=req.getReName()&&req.getReName().trim().length()>0){
pub.setName(req.getReName());
}

View File

@ -1,16 +1,16 @@
package club.joylink.rtss.services.training2;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.training2.publish.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -33,7 +33,8 @@ import java.util.stream.Collectors;
public class Training2PublishService {
@Autowired
private PublishedTraining2DAO publishedDao;
@Autowired
private IMapService mapService;
@Transactional(readOnly = true)
public PublishedTraining2 findById(Long id) {
PublishedTraining2Example example = new PublishedTraining2Example();
@ -48,8 +49,8 @@ public class Training2PublishService {
*/
public Long queryCountForLabel(Long mapId,@Deprecated Long orgId,String type,String label){
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = example.createCriteria();
this.basicQueryCriteria(c,mapId,orgId,type);
// PublishedTraining2Example.Criteria c = example.createCriteria();
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type);
if(Objects.nonNull(label)){
c.andLabelJsonLike(String.format("%%%s%%", label));
}
@ -61,8 +62,8 @@ public class Training2PublishService {
*/
public Collection<String> findAllLabel(Long mapId,Long orgId, String type){
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = example.createCriteria();
this.basicQueryCriteria(c,mapId,orgId,type);
// PublishedTraining2Example.Criteria c = example.createCriteria();
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type);
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
if(CollectionUtils.isEmpty(dataList)){
return Collections.emptyList();
@ -73,14 +74,34 @@ public class Training2PublishService {
}).flatMap(d->d.stream()).collect(Collectors.toSet());
}
public void basicQueryCriteria(PublishedTraining2Example.Criteria criteria, Long mapId, Long orgId, String type){
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, Long mapId, Long orgId, String type){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
// criteria.createCriteria()
PublishedTraining2Example.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId);
// c.andOrgIdEqualTo(orgId);
criteria.andOrgIdEqualTo(orgId);
criteria.andTypeEqualTo(type);
criteria.andStateEqualTo(1);//上架
criteria.andStateEqualTo(BusinessConsts.STATUS_USE_INT);//上架
//查询共享的数据
PublishedTraining2Example.Criteria or = example.or();
or.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
or.andMapIdEqualTo(mapId);
or.andTypeEqualTo(type);
// or.andOrgIdNotEqualTo(orgId);
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT);
// PublishedTraining2Example.Criteria or2 = example.or();
// or2.andMapIdEqualTo(mapId);
// or2.andOrgIdEqualTo(orgId);
// or2.andTypeEqualTo(type);
// or2.andStateEqualTo(BusinessConsts.STATUS_USE_INT);//上架
return criteria;
}
/**
@ -140,10 +161,28 @@ public class Training2PublishService {
* 已发布实训上架
*/
@Transactional(rollbackFor = Exception.class)
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req) {
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req,LoginUserInfoVO userInfoVO) {
final PutOnPublishedTraining2RspVo rsp = new PutOnPublishedTraining2RspVo();
rsp.setIds(new ArrayList<>());
req.getIds().forEach(id -> {
if(CollectionUtils.isEmpty(req.getIds())){
return rsp;
}
List<Long> newIds = this.pretreatmentFindData(req.getIds(),userInfoVO);
for (Long newId : newIds) {
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
pub.setId(newId);
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
pub.setUpdateTime(LocalDateTime.now());
//
PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andIdEqualTo(pub.getId());
//
int urt = this.publishedDao.updateByExampleSelective(pub, example);
if (urt > 0) {//记录更新成功的
rsp.getIds().add(newId.toString());
}
}
/* req.getIds().forEach(id -> {
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
pub.setId(Long.valueOf(id));
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
@ -156,20 +195,30 @@ public class Training2PublishService {
if (urt > 0) {//记录更新成功的
rsp.getIds().add(id);
}
});
});*/
return rsp;
}
public void changeSharedStatus(Long id ,Integer shared,LoginUserInfoVO userInfoVO){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),"id信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared),"未知共享类型");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT,"未知共享类型");
}
/**
* 已发布实训下架
*/
@Transactional(rollbackFor = Exception.class)
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(PullOffPublishedTraining2ReqVo req) {
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(PullOffPublishedTraining2ReqVo req,LoginUserInfoVO userInfoVO) {
final PullOffPublishedTraining2RspVo rsp = new PullOffPublishedTraining2RspVo();
rsp.setIds(new ArrayList<>());
req.getIds().forEach(id -> {
if(CollectionUtils.isEmpty(req.getIds())){
return rsp;
}
List<Long> newIds = this.pretreatmentFindData(req.getIds(),userInfoVO);
for (Long newId : newIds) {
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
pub.setId(Long.valueOf(id));
pub.setId(newId);
pub.setState(PublishedTraining2StateEnum.PullOff.getState());
pub.setUpdateTime(LocalDateTime.now());
//
@ -178,9 +227,10 @@ public class Training2PublishService {
//
int urt = this.publishedDao.updateByExampleSelective(pub, example);
if (urt > 0) {//记录更新成功的
rsp.getIds().add(id);
rsp.getIds().add(newId.toString());
}
});
}
return rsp;
}
@ -188,34 +238,76 @@ public class Training2PublishService {
* 删除已发布实训
*/
@Transactional(rollbackFor = Exception.class)
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req) {
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
DeletePublishedTraining2RspVo rsp = new DeletePublishedTraining2RspVo();
rsp.setIds(new ArrayList<>());
//
if (null != req.getIds()) {
req.getIds().forEach(id -> {
if(CollectionUtils.isEmpty(req.getIds())){
return rsp;
}
List<Long> newIds = this.pretreatmentFindData(req.getIds(),userInfoVO);
for (Long newId : newIds) {
int drt = this.publishedDao.deleteByPrimaryKey(newId);
if (drt > 0) {
rsp.getIds().add(newId.toString());
}
}
/*req.getIds().forEach(id -> {
int drt = this.publishedDao.deleteByPrimaryKey(Long.valueOf(id));
if (drt > 0) {
rsp.getIds().add(id);
}
});
}
});*/
//
return rsp;
}
/**
* 根据mapId查所有的已发布单操或场景实训的基础信息
*
*/
public List<PublishedTraining2InfoRspVo> findAllTrainingBasicInfoByMapIdAndType(PublishedTrainingListRspVo vo){
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(vo.getMapId()),"请选择对应的地图");
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(vo.getType()),"请选择对应的类型");
return findTrainingInfo(vo);
}
private PublishedTraining2Example createQueryExample(PublishedTrainingListRspVo reqVO){
private List<Long> pretreatmentFindData(List<String> ids, LoginUserInfoVO userInfoVO){
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria criteria = example.createCriteria();
List<Long> idLong = ids.stream().map(Long::valueOf).collect(Collectors.toList());
criteria.andIdIn(idLong);
List<PublishedTraining2> t2 = this.publishedDao.selectByExample(example);
List<PublishedTraining2> notExeList = t2.stream().filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(notExeList)){
String names = notExeList.stream().map(d->d.getName()).collect(Collectors.joining(","));
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false,String.format("共享数据[%s]不能删除",names));
}
List<Long> findIds = t2.stream()
.filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId()))
.map(d->d.getId()).collect(Collectors.toList());
return findIds;
}
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example , PublishedTrainingListRspVo reqVO,List<Long> mapIdList){
PublishedTraining2Example.Criteria criteria = example.createCriteria();
// PublishedTraining2Example.Criteria or = example.or();
if (reqVO.getMapId() != null) {
criteria.andMapIdEqualTo(reqVO.getMapId());
}else{
criteria.andMapIdIn(mapIdList);
}
if (reqVO.getType() != null) {
criteria.andTypeEqualTo(reqVO.getType().value());
}
if(StringUtils.hasText(reqVO.getName())){
criteria.andNameLike(String.format("%%%s%%", reqVO.getName()));
}
if(Objects.nonNull(reqVO.getState())){
criteria.andStateEqualTo(reqVO.getState());
}
if(!CollectionUtils.isEmpty(reqVO.getLabels())){
for (String label : reqVO.getLabels()) {
criteria.andLabelJsonLike(String.format("%%%s%%", label));
}
}
if (reqVO.getOrgId() != null) {
criteria.andOrgIdEqualTo(reqVO.getOrgId());
}
return criteria;
}
/* private PublishedTraining2Example.Criteria createQueryExample(PublishedTraining2Example example ,PublishedTrainingListRspVo reqVO){
PublishedTraining2Example.Criteria criteria = example.createCriteria();
if (reqVO.getMapId() != null) {
criteria.andMapIdEqualTo(reqVO.getMapId());
@ -237,34 +329,31 @@ public class Training2PublishService {
if (reqVO.getOrgId() != null) {
criteria.andOrgIdEqualTo(reqVO.getOrgId());
}
/*if(!CollectionUtils.isEmpty(reqVO.getLabels())){
StringBuilder sqlBuilder = new StringBuilder("(");
List<String> labels = reqVO.getLabels().stream().filter(StringUtils::hasText).distinct().collect(Collectors.toList());
for (int i = 0; i < labels.size(); i++) {
String label = labels.get(i);
if(i != 0){
sqlBuilder.append(" or ");
}
sqlBuilder.append(String.format(" label_json like '%%%s%%'", label));
}
sqlBuilder.append(")");
Class<?> criteriaCls = criteria.getClass();
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
try{
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
addCriterion.setAccessible(true);
addCriterion.invoke(criteria, sqlBuilder.toString());
}catch (Exception e){
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
}
return criteria;
}*/
return example;
}
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(PublishedTrainingListRspVo reqVO,LoginUserInfoVO userInfoVO,boolean findSharedData){
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList());
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(PublishedTrainingListRspVo reqVO){
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example,reqVO,mapIdList);
if(findSharedData){
PublishedTraining2Example.Criteria or = example.or();
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
if (reqVO.getType() != null) {
or.andTypeEqualTo(reqVO.getType().value());
}
if(Objects.isNull(reqVO.getMapId())){
or.andMapIdIn(mapIdList);
}else{
or.andMapIdEqualTo(reqVO.getMapId());
}
// if(Objects.nonNull(reqVO.getOrgId())){
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
// }
}
PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize());
PublishedTraining2Example example = this.createQueryExample(reqVO);
Page<PublishedTraining2> page = (Page<PublishedTraining2>)this.publishedDao.selectByExample(example);
if(page.isEmpty()){
return PageVO.convert(page,Collections.emptyList());
@ -275,8 +364,21 @@ public class Training2PublishService {
/**
* 根据地图ID和类型查询实训列表
*/
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO) {
PublishedTraining2Example example = this.createQueryExample(reqVO);
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO,LoginUserInfoVO userInfoVO) {
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList());
PublishedTraining2Example example = new PublishedTraining2Example();
this.createQueryOrExample(example,reqVO,mapIdList);
PublishedTraining2Example.Criteria or = example.or();
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
or.andMapIdEqualTo(reqVO.getMapId());
if (reqVO.getType() != null) {
or.andTypeEqualTo(reqVO.getType().value());
}
// if(reqVO.getOrgId() !=null){
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
// }
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return List.of();
@ -319,4 +421,13 @@ public class Training2PublishService {
}
return null;
}
/**
* 根据地图ID列表修改生成实训的组织ID
*/
public void updatePublishTrainingOrgIdByMapId(Long orgId, List<Long> mapIdList) {
if (!CollectionUtils.isEmpty(mapIdList)) {
publishedDao.updateTrainingOrgByMapIdList(orgId, mapIdList);
}
}
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.services.training2;
import club.joylink.rtss.constants.MapStatus;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.dao.MapInfoDAO;
import club.joylink.rtss.dao.PublishedTraining2DAO;
@ -12,6 +13,7 @@ import club.joylink.rtss.entity.RtsMapFunction;
import club.joylink.rtss.entity.RtsMapFunctionExample;
import club.joylink.rtss.entity.training2.*;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.services.project.ProjectService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationService;
@ -20,6 +22,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.training2.rule.BgSceneStatusRule;
import club.joylink.rtss.vo.training2.rule.MapLocationRule;
import club.joylink.rtss.vo.training2.rule.Training2Rule;
@ -64,6 +67,9 @@ public class Training2RuleService {
@Autowired
private RtsMapFunctionDAO rtsMapFunctionDAO;
@Autowired
private ProjectService projectService;
/**
* 正在生成的地图Id
*/
@ -165,7 +171,7 @@ public class Training2RuleService {
// 地图列表
MapInfoExample example = new MapInfoExample();
MapInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(MapStatus.Online.getCode());
criteria.andLineCodeIn(lineCodeRuleMap.keySet().stream().collect(Collectors.toList()));
criteria.andLineCodeIn(new ArrayList<>(lineCodeRuleMap.keySet()));
List<MapInfo> mapList = mapInfoDAO.selectByExample(example);
List<String> errorMsgList = new ArrayList<>();

View File

@ -0,0 +1,13 @@
package club.joylink.rtss.services.voice;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
import club.joylink.rtss.vo.voice.VoiceQueryVO;
public interface IVoiceDataConfigService {
PageVO<VoiceDiscriminateConfigVO> query(VoiceQueryVO queryVO);
VoiceDiscriminateConfigVO byId(Long id);
void saveOrUpdate(VoiceDiscriminateConfigVO configVO , LoginUserInfoVO userInfo);
void changeStatus(Long id,Integer status, LoginUserInfoVO userInfo);
}

View File

@ -0,0 +1,18 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
import club.joylink.rtss.simulation.cbtc.Simulation;
import org.springframework.stereotype.Service;
/**
* 纠正源信息问题
*/
@Service("correctSourceServiceImpl")
public class CorrectSourceServiceImpl implements VoiceTransactionalService {
@Override
public void doExec(VoiceDiscriminateResult result, Simulation simulation) {
}
}

View File

@ -0,0 +1,126 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.ATS.operation.ATSManager;
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
import club.joylink.rtss.simulation.cbtc.ATS.operation.OperateMethod;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.discriminate.*;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.Parameter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* 操作解析
*/
@Service("operateParseServiceImpl")
@Slf4j
public class OperateParseServiceImpl implements VoiceTransactionalService {
@Autowired
private ATSManager atsManager;
@Autowired
private AtsOperationDispatcher atsOperationDispatcher;
@Override
@Async("voiceDiscriminateExecutor")
public void doExec(VoiceDiscriminateResult result, Simulation simulation) {
if (!result.isSuccess()) {
return;
}
OperateRule operateRule = result.getRule().getExecOperateRule();
if (operateRule == null) {
return;
}
// 参数解析
List<ParamExtractResult> paramExtractResults = result.getParamExtractResultList();
Map<Integer,ParamExtractResult> paramExtractResultMap = IntStream.range(0,paramExtractResults.size()).boxed().collect(Collectors.toMap(i->++i,paramExtractResults::get));
OperateResult operateResult = new OperateResult(operateRule.getType());
int paramSize = paramExtractResults.size();
for (CommandParamRule paramRule : operateRule.getParamRules()) {
ParamExtractResult[] paramArr = new ParamExtractResult[paramRule.getIndexArr().length];
for (int index = 0, len = paramArr.length; index < len; index ++) {
int paramRuleIndex = paramRule.getIndexArr()[index];
if (paramSize < paramRuleIndex) {
// 参数处理出错
return;
}
paramArr[index] = paramExtractResultMap.get(paramRuleIndex);
}
Object val = newParamValObj(paramRule, paramRule.getDefaultValue() != null ?
paramRule.getDefaultValue() : paramRule.getParseRule().extractParam(simulation, paramArr));
if (StringUtils.hasText(paramRule.getName())) {
operateResult.putParam(paramRule.getName(), val);
} else if (paramRule.getParamIndex() != null) {
operateResult.putParam(getMethodParamName(paramRule.getParamIndex(), operateRule.getType().name()), val);
} else {
// 参数位置未指定
return;
}
}
// 成员解析
MemberRule memberRule = operateRule.getMemberRule();
if (memberRule != null) {
List<SimulationMember> simulationMemberList = null;
if (memberRule.getIndex() == null) {
simulationMemberList = memberRule.getParseRule().matchMember(simulation, null);
} else if (memberRule.getIndex() < paramExtractResults.size()) {
simulationMemberList = memberRule.getParseRule().matchMember(simulation, paramExtractResultMap.get(memberRule.getIndex()));
} else {
return;
}
if (CollectionUtils.isEmpty(simulationMemberList)) {
return;
}
operateResult.setMember(simulationMemberList.get(0));
}
// 执行操作
try {
atsOperationDispatcher.execute(simulation, operateResult.getMember(), operateResult.getType().name(), operateResult.getParams());
log.info("执行语音指令操作成功,操作[{}] 源指令[{}]",operateResult.getType().name(),result.getOriginContent());
} catch (Exception e) {
log.error("执行操作失败[{}] 输入源指令[{}] msg[{}]",operateResult.getType().name(),result.getOriginContent(),e.getMessage(),e);
}
}
/**
* 根据执行不同指令返回不同参数的类型
* @param paramRule
* @param valObj
* @return
*/
private Object newParamValObj(CommandParamRule paramRule,Object valObj){
if(paramRule.getParamType() == CommandParamRule.ParamType.LIST){
return Arrays.asList(valObj);
}
return valObj;
}
/**
* 获取参数名称
*
* @param index 参数位置
* @param operateName 操作名称
* @return 参数名称
*/
public String getMethodParamName(int index, String operateName) {
OperateMethod handlerMethod = this.atsManager.getHandlerMethod(operateName);
Parameter[] parameters = handlerMethod.getMethod().getParameters();
if (parameters.length < index) {
throw new IllegalArgumentException(); // 参数抛错
}
return parameters[index].getName();
}
}

View File

@ -0,0 +1,75 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationManagerService;
import club.joylink.rtss.simulation.cbtc.discriminate.*;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 合成回复内容
*/
@Service("replyParseServiceImpl")
public class ReplyParseServiceImpl implements VoiceTransactionalService {
@Autowired
private ConversationManagerService conversationManagerService;
@Override
@Async("voiceDiscriminateExecutor")
public void doExec(VoiceDiscriminateResult result, Simulation simulation) {
if (!result.isSuccess()) {
return;
}
ReplyRule replyRule = result.getRule().getReplyRule();
if (replyRule == null) {
return;
}
List<ParamExtractResult> paramExtractResults = result.getParamExtractResultList();
ReplyResult replyResult = new ReplyResult(replyRule.getParamRules().size());
ParamExtractResult[] paramArr = null;
int paramSize = paramExtractResults.size();
for (CommandParamRule paramRule : replyRule.getParamRules()) {
paramArr = new ParamExtractResult[paramRule.getIndexArr().length];
for (int index = 0, len = paramArr.length; index < len; index ++) {
if (paramSize < paramRule.getIndexArr()[index]) {
// 参数处理出错
return;
}
paramArr[index] = paramExtractResults.get(paramRule.getIndexArr()[index] - 1); // 这里因为配置是从1开始需要减1做对应
}
replyResult.addParams(paramRule.getParseRule().extractParam(simulation, paramArr));
}
// 格式化回复语句
Object[] objArr = new Object[replyResult.getParamList().size()];
replyResult.getParamList().toArray(objArr);
replyResult.setContent(String.format(replyRule.getMessageFormat(), objArr));
// 匹配回复人员
MemberRule memberRule = replyRule.getMemberRule();
if (memberRule != null) {
List<SimulationMember> simulationMemberList = null;
if (memberRule.getIndex() == null) {
simulationMemberList = memberRule.getParseRule().matchMember(simulation, null);
} else if (memberRule.getIndex() < paramExtractResults.size()) {
simulationMemberList = memberRule.getParseRule().matchMember(simulation, paramExtractResults.get(memberRule.getIndex() - 1));
} else {
return;
}
if (CollectionUtils.isEmpty(simulationMemberList)) {
return;
}
replyResult.setSimulationMemberList(simulationMemberList);
}
// 执行回复
replyResult.getSimulationMemberList().forEach(member -> {
conversationManagerService.conversationChat(simulation, member, replyResult.getContent(), null);
});
}
}

View File

@ -0,0 +1,102 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.voice.VoiceDiscriminateConfigDAO;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfig;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.voice.IVoiceDataConfigService;
import club.joylink.rtss.simulation.cbtc.discriminate.IVoiceDiscriminateRule;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
import club.joylink.rtss.vo.voice.VoiceQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
@Slf4j
@Transactional
public class VoiceDataConfigServiceImpl implements IVoiceDataConfigService, IVoiceDiscriminateRule {
@Autowired
private VoiceDiscriminateConfigDAO configDAO;
private VoiceDiscriminateConfig findById(Long id){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),"数据id不能为空");
VoiceDiscriminateConfig data = this.configDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(data),String.format("未找到对应的数据id:%s",id));
return data;
}
@Override
public PageVO<VoiceDiscriminateConfigVO> query(VoiceQueryVO query) {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<VoiceDiscriminateConfig> page = (Page<VoiceDiscriminateConfig>) this.configDAO.selectByExampleWithBLOBs(query.buildQueryExample());
List<VoiceDiscriminateConfigVO> voList = page.getResult().stream().map(VoiceDiscriminateConfigVO::convertVO).collect(Collectors.toList());
return PageVO.convert(page, voList);
}
@Override
public VoiceDiscriminateConfigVO byId(Long id) {
VoiceDiscriminateConfig data = this.findById(id);
return VoiceDiscriminateConfigVO.convertVO(data);
}
@Override
public void saveOrUpdate(VoiceDiscriminateConfigVO configVO, LoginUserInfoVO userInfo) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(configVO.getMapId()),"请选择对应的线路");
LocalDateTime dateTime = LocalDateTime.now();
VoiceDiscriminateConfig newData = configVO.convertToEntry();
newData.setOperateId(userInfo.getAccountVO().getId());
newData.setStatus(BusinessConsts.STATUS_NOT_USE_INT);
newData.setCreateTime(dateTime);
newData.setUpdateTime(dateTime);
if(Objects.isNull(configVO.getId())){
this.configDAO.insert(newData);
}else{
VoiceDiscriminateConfig data = this.findById(configVO.getId());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(data.getStatus()== BusinessConsts.STATUS_NOT_USE_INT,"正在使用的配置数据不能编辑");
newData.setCreateTime(data.getCreateTime());
this.configDAO.updateByPrimaryKeyWithBLOBs(newData);
}
}
@Override
public void changeStatus(Long id, Integer status, LoginUserInfoVO userInfo) {
VoiceDiscriminateConfig data = this.findById(id);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(status == BusinessConsts.STATUS_NOT_USE_INT || status == BusinessConsts.STATUS_USE_INT,"变更状态参数错误");
if(status == BusinessConsts.STATUS_USE_INT){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.isNotEmpty(data.getParamsRules()),"匹配参数不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.isNotEmpty(data.getExecOperateRule()),"执行指令参数不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.isNotEmpty(data.getReplyRule()),"回复指令参数不能为空");
}
VoiceDiscriminateConfig update = new VoiceDiscriminateConfig();
update.setId(id);
update.setStatus(status);
update.setUpdateTime(LocalDateTime.now());
update.setOperateId(userInfo.getAccountVO().getId());
this.configDAO.updateByPrimaryKeySelective(update);
}
@Override
public List<VoiceDiscriminateRule> findRuleByMapId(Long mapId) {
VoiceQueryVO queryVO = new VoiceQueryVO();
queryVO.setMapId(mapId);
queryVO.setStatus(BusinessConsts.STATUS_USE_INT);
List<VoiceDiscriminateConfig> list = this.configDAO.selectByExampleWithBLOBs(queryVO.buildQueryExample());
return list.stream().map(VoiceDiscriminateConfigVO::convertRule).collect(Collectors.toList());
}
}

View File

@ -0,0 +1,53 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
import club.joylink.rtss.simulation.cbtc.Simulation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
/**
* 语音识别服务类(多例)
*/
@Slf4j
@Service
public class VoiceDiscriminateService {
@Autowired
private VoiceParseService voiceParseService;
@Autowired
@Qualifier(value = "operateParseServiceImpl")
private VoiceTransactionalService operateParseService;
@Autowired
@Qualifier(value = "replyParseServiceImpl")
private VoiceTransactionalService replyParseService;
@Autowired
@Qualifier(value = "correctSourceServiceImpl")
private VoiceTransactionalService correctSourceService;
/**
* 接受语音文件资源等必要条件解析开始
*/
public void doAnalysis(Simulation simulation, MultipartFile file) {
VoiceDiscriminateResult result = voiceParseService.doParse(simulation, file);
operateParseService.doExec(result, simulation); // 指令执行
replyParseService.doExec(result, simulation); // 回复执行
correctSourceService.doExec(result, simulation);// 原信息纠错
}
/**
* 接受语音文件资源等必要条件解析开始
*/
public void doAnalysis(Simulation simulation, String content) {
VoiceDiscriminateResult result = voiceParseService.doParse(simulation, content);
operateParseService.doExec(result, simulation); // 指令执行
replyParseService.doExec(result, simulation); // 回复执行
correctSourceService.doExec(result, simulation);// 原信息纠错
}
}

View File

@ -0,0 +1,30 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
import org.springframework.web.multipart.MultipartFile;
/**
* 语音解析步骤服务
*/
public interface VoiceParseService {
/**
* 解析语音任务
*
* @param simulation 仿真
* @param file 文件
* @return 解析结果
*/
VoiceDiscriminateResult doParse(Simulation simulation, MultipartFile file);
/**
* 对语音文字进行任务
*
* @param simulation 仿真
* @param content 语音文字
* @return 解析结果
*/
VoiceDiscriminateResult doParse(Simulation simulation, String content);
}

View File

@ -0,0 +1,185 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.exception.BusinessException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.voice.VoiceService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.discriminate.ParamExtractResult;
import club.joylink.rtss.simulation.cbtc.discriminate.ParamExtractRule;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
import club.joylink.rtss.util.PinYinUtil;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO;
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.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 语音文件解析服务
*/
@Service
@Slf4j
public class VoiceParseServiceImpl implements VoiceParseService {
/**
* 语音解析服务
*/
@Autowired
private VoiceService voiceService;
@Override
public VoiceDiscriminateResult doParse(Simulation simulation, MultipartFile file) {
VoiceRecognitionVO vo = VoiceRecognitionVO.load(file);
VoiceRecognitionResult voiceRecognitionResult = voiceService.voiceRecognition(vo);
return doParse(simulation, voiceRecognitionResult.getResult());
}
@Override
public VoiceDiscriminateResult doParse(Simulation simulation, String content) {
VoiceDiscriminateResult result = new VoiceDiscriminateResult();
if (StringUtils.isEmpty(content)) {
return result;
}
result.setSuccess(true);
result.setOriginContent(content);
// 处理拼音信息
translateToPinYin(result, content);
// 匹配指令
matchCommand(simulation, result);
// 参数抽取
if (result.isSuccess()) {
paramExtract(simulation, result);
}
return result;
}
/**
* 翻译标准拼音
*
* @param content 语音文字
* @return 拼音信息
*/
private void translateToPinYin(VoiceDiscriminateResult result, String content) {
char[] chars = content.toCharArray();
String[] pinYinArr = new String[chars.length];
String pinYin = null;
for (int index = 0, size = chars.length; index < size; index++) {
pinYin = PinYinUtil.toPinYin(chars[index]);
pinYinArr[index] = pinYin;
}
result.setContentPinYinArr(pinYinArr);
}
/**
* 匹配指令
*
* @param simulation 仿真
* @param result 结果信息
*/
private void matchCommand(Simulation simulation, VoiceDiscriminateResult result) {
// 加载本地图的规则信息列表从数据库中获取
List<VoiceDiscriminateRule> ruleList = simulation.getVoiceRuleList();
if(CollectionUtils.isEmpty(ruleList)){
result.setSuccess(false);
result.setMsg("该线路没有语音配置的数据");
return;
}
// 匹配指令
for (VoiceDiscriminateRule rule : ruleList) {
Matcher matcher = keyWordsMatch(rule.getKeyWordRules(), result.getMatchOriginContent());
if (matcher != null) {
result.setRule(rule);
result.setMatcher(matcher);
return;
}
}
// 出错未匹配到指令
result.setSuccess(false);
result.setMsg("未匹配到对应指令");
}
/**
* 正则表达式匹配
* @param patternStr 正则表达式字符串
* @param content 语音内容
* @return groupList
*/
private Matcher keyWordsMatch(String patternStr, String content) {
Pattern pattern = Pattern.compile(PinYinUtil.toPinYin(patternStr));// 匹配的模式
Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
return matcher;
}
return null;
}
/**
* 参数抽取
*
* @param simulation 仿真
* @param result 结果信息
*/
private void paramExtract(Simulation simulation, VoiceDiscriminateResult result) {
List<ParamExtractRule> paramsRules = result.getRule().getParamsRules();
boolean hasEmpty = paramsRules.stream().anyMatch(d->ArrayUtils.isEmpty(d.getIndexArr()));
if(hasEmpty){
log.error("参数解析配置数据错误,原文:[{}],匹配规则:[{}]",result.getOriginContent(),result.getRule().getKeyWordRules());
throw new BusinessException(BusinessExceptionAssertEnum.VOICE_COMMAND_CONFIG_NULL);
}
boolean paramError = paramsRules.stream().flatMap(d-> Arrays.stream(d.getIndexArr())).anyMatch(item-> result.getGroupCount() < item);
if(paramError){
log.error("提取参数出错,原文:[{}],匹配规则:[{}]",result.getOriginContent(),result.getRule().getKeyWordRules());
result.setSuccess(false);
result.setMsg("提取参数出错");
return;
}
List<ParamExtractResult> paramExtractResults = new ArrayList<>(paramsRules.size());
for (ParamExtractRule rule : paramsRules) {
String[] originGroupArr = new String[rule.getIndexArr().length];
String[] correctGroupArr = new String[rule.getIndexArr().length];
for (int index = 0, len = originGroupArr.length; index < len; index ++) {
Integer paramIndex = rule.getIndexArr()[index];
originGroupArr[index] = result.getGroup(paramIndex);
correctGroupArr[index] = result.getCorrectGroup(paramIndex);
}
ParamExtractResult extractResult = rule.getParseRule().matchParam(simulation, originGroupArr, correctGroupArr);
paramExtractResults.add(extractResult);
// 对已纠正过的数据进行记录
handleCorrectGroup(result, extractResult, originGroupArr, rule.getIndexArr());
}
result.setParamExtractResultList(paramExtractResults);
}
/**
* 处理纠正过的Group信息
* @param result 最终结果新
* @param extractResult 处理过的参数信息
* @param originArr 原始group数组
* @param indexArr group对应索引
*/
private void handleCorrectGroup(VoiceDiscriminateResult result, ParamExtractResult extractResult, String[] originArr, Integer[] indexArr) {
if (indexArr == null || extractResult.getCorrectGroupMap() == null) {
return;
}
String origin = null, correct = null;
for (int index = 0, len = indexArr.length; index < len; index++) {
origin = originArr[index];
correct = extractResult.getCorrectGroupMap().get(origin);
if (StringUtils.hasText(correct)) {
result.setCorrectGroup(indexArr[index], correct);
}
}
}
}

View File

@ -0,0 +1,12 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
import club.joylink.rtss.simulation.cbtc.Simulation;
/**
* 语音业务执行步骤无返回值不影响其他业务步骤执行
*/
public interface VoiceTransactionalService {
void doExec(VoiceDiscriminateResult result, Simulation simulation);
}

View File

@ -21,6 +21,7 @@ import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDevice
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1IbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PscConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PslConfig;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
@ -59,6 +60,11 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
// */
// private String id;
/**
* 语音配置数据
*/
private List<VoiceDiscriminateRule> voiceRuleList;
/**
* 仿真构建参数
*/

View File

@ -6,6 +6,8 @@ import club.joylink.rtss.services.RunPlanDraftService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.services.permission.PermissionSubjectService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.discriminate.IVoiceDiscriminateRule;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
import club.joylink.rtss.simulation.cbtc.event.SimulationCreateSuccessEvent;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
@ -66,6 +68,9 @@ public class SimulationServiceImpl implements SimulationService {
@Autowired
private ISysUserService iSysUserService;
@Autowired
private IVoiceDiscriminateRule discriminateRule;
@Override
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) {
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO, createUserType).getId();
@ -289,9 +294,17 @@ public class SimulationServiceImpl implements SimulationService {
public Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String,Boolean> createUserType) {
//获取仿真工作服务
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType());
//创建仿真
String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId);
Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId);
//语音配置数据
List<VoiceDiscriminateRule> ruleList = this.discriminateRule.findRuleByMapId(mapId);
simulation.setVoiceRuleList(ruleList);
simulation.setMapFunctionId(mapFunctionId);
simulation.setCreateUserType(createUserType);
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();

View File

@ -0,0 +1,22 @@
package club.joylink.rtss.simulation.cbtc.conversation;
/**
* 会话类型
*/
public enum ConversationType {
/**
* 电话 (兼容之前调度电话)
*/
PHONE(),
/**
* 群聊 (聊天室)
*/
GROUP_CHAT(),
/**
* 私聊 (成员一对一)
*/
PRIVATE_CHAT();
}

View File

@ -0,0 +1,44 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import lombok.Getter;
/**
* 参数的提取规则
*/
@Getter
public enum CommandParamParseRule {
MAP_ELEMENT_CODE("获取地图元素Code") {
@Override
public Object extractParam(Simulation simulation, ParamExtractResult... extractResults) {
if (extractResults == null || extractResults.length ==0) {
throw new IllegalArgumentException("执行方法参数为空");
}
ParamExtractResult paramResult = extractResults[0];
if (paramResult.getValue() instanceof MapElement) {
return ((MapElement) paramResult.getValue()).getCode();
}
throw new IllegalArgumentException("参数类型【MAP_ELEMENT_CODE】不匹配");
}
},
PARAM_VALUE("获取参数值") { // 像限速上下行等已经处理后的参数可直接使用
@Override
public Object extractParam(Simulation simulation, ParamExtractResult... extractResults) {
if (extractResults == null || extractResults.length ==0) {
throw new IllegalArgumentException("执行方法参数为空");
}
return extractResults[0].getValue();
}
}
;
private String description;
CommandParamParseRule(String description) {
this.description = description;
}
public abstract Object extractParam(Simulation simulation, ParamExtractResult... extractResults);
}

View File

@ -0,0 +1,51 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 指令匹配规则
*/
@Data
public class CommandParamRule {
/**
* 方法参数对应的参数名优先使用
*/
private String name;
/**
* 方法参数所在位置通过反射获取
*/
private Integer paramIndex;
@NotNull
private ParamType paramType;
/**
* 对应解析参数位置{@link VoiceDiscriminateResult.paramExtractResultList}的位置
*/
private Integer[] indexArr;
/**
* 解析规则
*/
private CommandParamParseRule parseRule;
/**
* 定值参数直接指定
*/
private Object defaultValue;
public enum ParamType{
/**
* 默认字符串
*/
DEFAULT,
/**
* 操作接受数据类型
*/
LIST;
}
}

View File

@ -0,0 +1,324 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.util.PinYinUtil;
import club.joylink.rtss.util.StrUtils;
import com.google.common.collect.Maps;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
/**
* 参数的提取规则
*/
@Getter
public enum ExtractRule {
STATION_NAME_EXTRACT("根据车站名称匹配车站") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数不缺失");
}
ParamExtractResult result = new ParamExtractResult();
MapNamedElement mapNamedElement = null;
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
mapNamedElement = findDeviceByCorrect(simulation, MapElement.DeviceType.STATION, correctArr[0]);
} else {
// 这里可能需要做对入参做一些处理
String stationName = originArr[0];
mapNamedElement = findDevice(simulation, MapElement.DeviceType.STATION, Station.class, stationName);
if (mapNamedElement != null) { // 不为空将信息放入纠错信息中
result.setCorrectGroupMap(stationName, mapNamedElement.getName());
}
}
if (mapNamedElement != null) {
result.setValue(mapNamedElement);
return result;
}
throw new IllegalArgumentException(String.format("未找到车站[%s]", originArr[0]));
}
},
ROUTE_NAME_EXTRACT("根据进路名称匹配进路") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数不缺失");
}
ParamExtractResult result = new ParamExtractResult();
MapNamedElement mapNamedElement = null;
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
mapNamedElement = findDeviceByCorrect(simulation, MapElement.DeviceType.ROUTE, correctArr[0]);
} else {
// 这里可能对XS做处理
String routeName = originArr[0];
mapNamedElement = findDevice(simulation, MapElement.DeviceType.ROUTE, Route.class, routeName);
if (mapNamedElement != null) { // 不为空将信息放入纠错信息中
result.setCorrectGroupMap(routeName, mapNamedElement.getName());
}
}
if (mapNamedElement != null) {
result.setValue(mapNamedElement);
return result;
}
throw new IllegalArgumentException(String.format("未找到进路[%s]", originArr[0]));
}
},
ROUTE_SIGNAL_EXTRACT("根据起始、终点信号机匹配进路") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length < 2) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
// 查找起始信号机
ParamExtractResult startSignalResult = SIGNAL_NAME_EXTRACT.matchParam(simulation
, new String[] { originArr[0] }, new String[] { correctArr[0] });
result.setCorrectGroupMap(startSignalResult.getCorrectGroupMap());
// 查找起始信号机
ParamExtractResult endSignalResult = SIGNAL_NAME_EXTRACT.matchParam(simulation
, new String[] { originArr[1] }, new String[] { correctArr[1] });
result.setCorrectGroupMap(endSignalResult.getCorrectGroupMap());
// 始端终端信号机编号
String startCode = ((MapElement) startSignalResult.getValue()).getCode(),
endCode = ((MapElement) endSignalResult.getValue()).getCode();
// 查找进路
Optional<Route> routeOptional = simulation.getRepository().getRouteList().stream()
.filter(route -> {
if (route.getStart() == null || route.getDestination() == null) {
return false;
}
return Objects.equals(startCode, route.getStart().getCode()) || Objects.equals(endCode, route.getDestination().getCode());
}).findFirst();
if (routeOptional.isPresent()) {
result.setValue(routeOptional.get());
return result;
}
throw new IllegalArgumentException(String.format("未找到信号机始端[%s],终端[%s]", originArr[0], originArr[1]));
}
},
STAND_STATION_UP_DOWN_EXTRACT("根据车站、上下行匹配站台") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length < 2) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
// 车站匹配结果
ParamExtractResult stationResult = STATION_NAME_EXTRACT.matchParam(simulation, new String[] { originArr[0] }, new String[] { correctArr[0] });
result.setCorrectGroupMap(stationResult.getCorrectGroupMap());
// 上行匹配结果
ParamExtractResult upDownResult = UP_DOWN_WAY.matchParam(simulation, new String[] { originArr[1] }, new String[] { correctArr[1] });
result.setCorrectGroupMap(upDownResult.getCorrectGroupMap());
// 获取站台列表
List<Stand> stands = ((Station) stationResult.getValue()).getStandOf((Boolean) upDownResult.getValue());
if(CollectionUtils.isEmpty(stands)){
throw new IllegalArgumentException(String.format("不能获取对应的站台 车站[%s],上下行[%s]",originArr[0], originArr[1]));
}
result.setValue(stands.get(0));
return result;
}
},
UP_DOWN_WAY("车辆上下行"){
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
String way = originArr[0];
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
String correctArrStr = correctArr[0];
boolean isRight = true;
if(StringUtils.equals(correctArrStr,"")){
isRight = false;
}
result.setValue(isRight);
result.setCorrectGroupMap(way,isRight ? "" : "");
return result;
} else {
Boolean isRight = null;
if(StringUtils.containsIgnoreCase(way,"shang")) {
isRight = true;
// result.setValue(true);
// result.setCorrectGroupMap(way, "");
// return result;
}else if(StringUtils.containsIgnoreCase(way,"xia")){
isRight = false;
// result.setValue(false);
// result.setCorrectGroupMap(way, "");
// return result;
}else{
throw new IllegalArgumentException(String.format("不能解析上下行[%s]", originArr[0]));
}
result.setValue(isRight);
result.setCorrectGroupMap(way,isRight ? "" : "");
return result;
}
}
},
SWITCH_NAME("道岔名称"){
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
// 查找起始信号机
MapNamedElement switchElement = null;
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
switchElement = findDeviceByCorrect(simulation, MapElement.DeviceType.SWITCH, correctArr[0]);
} else {
String switchName = originArr[0];
switchElement = findDevice(simulation, MapElement.DeviceType.SWITCH, Switch.class, switchName);
if (switchElement != null) { // 不为空将信息放入纠错信息中
result.setCorrectGroupMap(switchName, switchElement.getName());
}
}
if (switchElement != null) {
result.setValue(switchElement);
return result;
}
throw new IllegalArgumentException(String.format("未找到道岔[%s]", originArr[0]));
}
},
SIGNAL_NAME_EXTRACT("根据信号机名称匹配信号机") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
// 查找起始信号机
MapNamedElement signal = null;
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
signal = findDeviceByCorrect(simulation, MapElement.DeviceType.SIGNAL, correctArr[0]);
} else {
String signalName = originArr[0];
signal = findDevice(simulation, MapElement.DeviceType.SIGNAL, Signal.class, signalName);
if (signal != null) { // 不为空将信息放入纠错信息中
result.setCorrectGroupMap(signalName, signal.getName());
}
}
if (signal != null) {
result.setValue(signal);
return result;
}
throw new IllegalArgumentException(String.format("未找到信号机[%s]", originArr[0]));
}
},
SECTION_NAME_EXTRACT("根据区段名称匹配区段") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
MapNamedElement section = null;
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
section = findDeviceByCorrect(simulation, MapElement.DeviceType.SECTION, correctArr[0]);
} else {
String sectionName = originArr[0];
section = findDevice(simulation, MapElement.DeviceType.SECTION, Section.class, sectionName);
if (section != null) { // 不为空将信息放入纠错信息中
result.setCorrectGroupMap(sectionName, section.getName());
}
}
if (section != null) {
result.setValue(section);
return result;
}
throw new IllegalArgumentException(String.format("未找到区段[%s]", originArr[0]));
}
},
NUMBER_EXTRACT("数字抽取") {
@Override
public ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr) {
if (originArr == null || originArr.length == 0) {
throw new IllegalArgumentException("定位参数缺失");
}
ParamExtractResult result = new ParamExtractResult();
if (correctArr != null && correctArr[0] != null) { // 有正确值直接匹配
result.setValue(correctArr[0]);
} else {
String numberStr = originArr[0]; // 这里可能是拼音状态的数字
String correctStr = null;
if (StringUtils.isNumeric(numberStr)) { // 数字状态的直接返回
correctStr = numberStr;
result.setValue(numberStr);
} else {
}
result.setCorrectGroupMap(numberStr, correctStr);
}
return result;
}
}
;
/**
* 规则描述
*/
private String description;
ExtractRule(String description) {
this.description = description;
}
/**
* 解析参数
*
* @param simulation 仿真信息
* @param originArr 原始的group信息
* @param correctArr 已经纠正过的group信息
* @return 解析结果
*/
public abstract ParamExtractResult matchParam(Simulation simulation, String[] originArr, String[] correctArr);
private static MapNamedElement findDevice(Simulation simulation, MapElement.DeviceType dt, Class<? extends MapNamedElement> eleClass,String matchVal){
List<? extends MapNamedElement> eleList = simulation.getRepository().getListByType(dt,eleClass);
Map<Double,MapNamedElement> elementMap = Maps.newHashMap();
for (MapNamedElement ele : eleList) {
String namePinYin = PinYinUtil.toPinYin(ele.getName());
double ratio = StrUtils.getJaroWinklerSimilarityRatio(namePinYin,matchVal);
elementMap.put(ratio,ele);
}
Double d = elementMap.keySet().stream().mapToDouble(k->k).max().orElse(0D);
MapNamedElement nameEle = elementMap.get(d);
if(Objects.isNull(nameEle)){
return null;
}
return nameEle;
}
/**
* 根据正确的名称信息获取设备信息
*
* @param simulation 仿真
* @param type 设备类型
* @param matchVal 匹配信息
* @return 设备信息
*/
private static MapNamedElement findDeviceByCorrect(Simulation simulation, MapElement.DeviceType type, String matchVal) {
return simulation.getRepository().getDeviceMap().values().stream()
.filter(mapElement -> Objects.equals(mapElement.getDeviceType(), type))
.map(mapElement -> (MapNamedElement) mapElement)
.filter(mapElement -> Objects.equals(mapElement.getName(), matchVal))
.findFirst().orElse(null);
}
}

View File

@ -0,0 +1,8 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import java.util.List;
public interface IVoiceDiscriminateRule {
List<VoiceDiscriminateRule> findRuleByMapId(Long mapId);
}

View File

@ -0,0 +1,52 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 人员匹配规则
*
* 根据实际人员处理做拓展
*/
public enum MemberParseRule {
STATION_SUPERVISOR("获取指定车站值班员") {
@Override
public List<SimulationMember> matchMember(Simulation simulation, ParamExtractResult extractResult) {
if (extractResult == null || !(extractResult.getValue() instanceof Station)) {
throw new IllegalArgumentException("人员匹配入参为空");
}
SimulationMember member =
simulation.getSimulationMember((MapElement) extractResult.getValue(), SimulationMember.Type.STATION_SUPERVISOR);
return Arrays.asList(member);
}
},
ALL_STATION_SUPERVISOR("全体车站值班员") {
@Override
public List<SimulationMember> matchMember(Simulation simulation, ParamExtractResult extractResult) {
List<SimulationMember> simulationMemberList = simulation.getSimulationMembers().stream()
.filter(simulationMember -> Objects.equals(SimulationMember.Type.STATION_SUPERVISOR, simulationMember.getType()))
.collect(Collectors.toList());
return simulationMemberList;
}
};
/**
* 规则描述
*/
private String description;
MemberParseRule(String description) {
this.description = description;
}
public abstract List<SimulationMember> matchMember(Simulation simulation, ParamExtractResult extractResult);
}

View File

@ -0,0 +1,19 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import lombok.Data;
/**
* 指令匹配规则
*/
@Data
public class MemberRule {
/**
* 对应{@link VoiceDiscriminateResult.paramExtractResultList}位置, 索引从1开始
*/
private Integer index;
/**
* 解析规则
*/
private MemberParseRule parseRule;
}

View File

@ -0,0 +1,47 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* 指令匹配结果
*/
@Data
public class OperateResult {
/**
* 指令
*/
private Operation.Type type;
// private Boolean operationResult;
// private String errResultMsg;
/**
* 指令参数
*/
private Map<String, Object> params = new HashMap<>();
/**
* 角色ID
*/
private SimulationMember member;
public OperateResult(Operation.Type type) {
this.type = type;
}
/**
* 参数放入集合
* @param key 集合key
* @param value 参数值
*/
public void putParam(String key, Object value) {
params.put(key, value);
}
}

View File

@ -0,0 +1,27 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import lombok.Data;
import java.util.List;
/**
* 指令匹配规则
*/
@Data
public class OperateRule {
/**
* 操作指令
*/
private Operation.Type type;
/**
* 参数提取规则
*/
private List<CommandParamRule> paramRules;
/**
* 人员匹配规则
*/
private MemberRule memberRule;
}

View File

@ -0,0 +1,57 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 参数提取结果
*/
@Data
public class ParamExtractResult {
/**
* 矫正后的group信息
* key为传入信息
*/
private Map<String, String> correctGroupMap;
/**
* 参数解析出的相关数据
*/
private Object value;
/**
* 放入纠正结果
*
* @param origin 原始信息
* @param correct 纠错信息
*/
public void setCorrectGroupMap(String origin, String correct) {
if (StringUtils.isEmpty(origin) || StringUtils.isEmpty(correct)) {
return;
}
if (correctGroupMap == null) {
correctGroupMap = new HashMap<>();
}
correctGroupMap.put(origin, correct);
}
/**
* 放入纠正结果
*
* @param correctGroupMap 纠正过的map信息
*/
public void setCorrectGroupMap(Map<String, String> correctGroupMap) {
if (CollectionUtils.isEmpty(correctGroupMap)) {
return;
}
if (this.correctGroupMap == null) {
this.correctGroupMap = new HashMap<>();
}
this.correctGroupMap.putAll(correctGroupMap);
}
}

View File

@ -0,0 +1,19 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import lombok.Data;
/**
* 参数提取规则
*/
@Data
public class ParamExtractRule {
/**
* 解析规则
*/
private ExtractRule parseRule;
/**
* group位置索引,有时需要多个参数信息定位具体值始终信号机定位进路
*/
private Integer[] indexArr;
}

View File

@ -0,0 +1,39 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 回复内容
*/
@Data
public class ReplyResult {
/**
* 回复人员列表
*/
private List<SimulationMember> simulationMemberList;
/**
* 回复内容
*/
private String content;
/**
* 解析的结果列表
*/
private List<String> paramList;
public ReplyResult(int size) {
this.paramList = new ArrayList<>(size);
}
public void addParams(Object param) {
if (param instanceof String) {
paramList.add(param.toString());
}
throw new IllegalArgumentException();
}
}

View File

@ -0,0 +1,26 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import lombok.Data;
import java.util.List;
/**
* 回复格式
*/
@Data
public class ReplyRule {
/**
* 人员类型
*/
private MemberRule memberRule;
/**
* 消息格式
*/
private String messageFormat;
/**
* 对应参数列表
*/
private List<CommandParamRule> paramRules;
}

View File

@ -0,0 +1,142 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
/**
* 语音解析结果
*/
@Data
public class VoiceDiscriminateResult {
/**
* 状态是否正常
*/
private boolean success;
private String msg;
/**
* 语音原始内容
*/
private String originContent;
/**
* 原始语音拼音数组
*/
private String[] contentPinYinArr;
/**
* 匹配到的指令规则
*/
private VoiceDiscriminateRule rule;
/**
* 原始匹配指令结果
*/
private Matcher matcher;
/**
* 纠正过的group map
*/
private Map<Integer, String> correctGroupStr;
/**
* 参数提取集合
*/
private List<ParamExtractResult> paramExtractResultList;
/**
* 匹配人员集合
*/
private List<SimulationMember> simulationMemberList;
/**
* 获取匹配指令的语音内容
*/
public String getMatchOriginContent() {
if (this.contentPinYinArr != null) {
return String.join(StringUtils.EMPTY, this.contentPinYinArr);
}
return this.originContent;
}
/**
* 获取匹配到group数量
* @return 数量
*/
public int getGroupCount() {
return matcher == null ? 0 : matcher.groupCount();
}
/**
* 根据索引获取group 原始
*
* @param index 位置
* @return group
*/
public String getGroup(int index) {
if (index > getGroupCount()) {
throw new IllegalArgumentException("out of index");
}
return matcher.group(index);
}
/**
* 根据索引获取正确的group
* @return
*/
public String getCorrectGroup(int index) {
return this.correctGroupStr == null ? null : this.correctGroupStr.get(index);
}
/**
* 给正确MAP中赋值
*
* @param index GROUP 索引
* @param correct 正确值
*/
public void setCorrectGroup(Integer index, String correct) {
if (this.correctGroupStr == null) {
this.correctGroupStr = new HashMap<>();
}
this.correctGroupStr.put(index, correct);
}
/**
* 根据拼音Group的Index获取字符串在原内容中定位信息
*
* @param index GROUP索引
* @return 起始位置终止位置
*/
public int[] getPinYinGroupAtOriginStartAndEndIndex(int index) {
String group = getGroup(index); // 获取到group
int[] indexArr = new int[2]; // 索引数组
// 读取起始位置group长度读取结束位置
int groupLen = group.length(), readIndex = 0, endIndex = 0;
String pinYin = null;
for (int i = 0, len = contentPinYinArr.length; i < len; i ++) {
pinYin = contentPinYinArr[i];
endIndex = readIndex + pinYin.length();
if (groupLen >= endIndex && Objects.equals(group.substring(readIndex, endIndex), pinYin)) { // 字符一致
if (readIndex == 0) { // 如果是0代表刚开始匹配记录开始索引
indexArr[0] = i;
}
readIndex = endIndex;
} else { // 字符不一致重新匹配位置
readIndex = 0;
}
if (readIndex == groupLen) { // 结束位置
indexArr[1] = i;
break;
}
}
return indexArr;
}
}

View File

@ -0,0 +1,33 @@
package club.joylink.rtss.simulation.cbtc.discriminate;
import lombok.Data;
import java.util.List;
/**
* 语音解析规则
*/
@Data
public class VoiceDiscriminateRule {
// private Long id;
/**
* 关键字正则
*/
private String keyWordRules;
/**
* 所需参数
*/
private List<ParamExtractRule> paramsRules;
/**
* 执行指令系统操作指令
*/
private OperateRule execOperateRule;
/**
* 回复指令系统指令操作完毕或者无系统指令时交互回复
*/
private ReplyRule replyRule;
}

View File

@ -0,0 +1,74 @@
package club.joylink.rtss.util;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
/**
* 汉字转拼音工具类
*/
public class PinYinUtil {
private final static HanyuPinyinOutputFormat PIN_YIN_FORMAT = new HanyuPinyinOutputFormat();
static{
/**
* 输出大小写设置
*
* LOWERCASE:输出小写
* UPPERCASE:输出大写
*/
PIN_YIN_FORMAT.setCaseType(HanyuPinyinCaseType.UPPERCASE);
/**
* 输出音标设置
*
* WITH_TONE_MARK:直接用音标符必须设置WITH_U_UNICODE否则会抛出异常
* WITH_TONE_NUMBER1-4数字表示音标
* WITHOUT_TONE没有音标
*/
PIN_YIN_FORMAT.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
}
/**
* 汉字转拼音
*
* @param content 内容
* @return 拼音信息
*/
public static String toPinYin(String content) {
StringBuilder sb = new StringBuilder();
for(char c : content.toCharArray()){
if(Character.toString(c).matches("[\\u4E00-\\u9FA5]+")) {
try {
String[] ss = PinyinHelper.toHanyuPinyinStringArray(c,PIN_YIN_FORMAT);
sb.append(ss[0]);
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
}else{
sb.append(c);
}
}
return sb.toString();
}
/**
*
* @param c
* @return
*/
public static String toPinYin(char c) {
if(Character.toString(c).matches("[\\u4E00-\\u9FA5]+")) {
try {
String[] ss = PinyinHelper.toHanyuPinyinStringArray(c,PIN_YIN_FORMAT);
return ss[0];
} catch (BadHanyuPinyinOutputFormatCombination e) {
throw new IllegalArgumentException(e);
}
} else {
return String.valueOf(c);
}
}
}

View File

@ -1,7 +1,14 @@
package club.joylink.rtss.util;
import org.apache.commons.text.similarity.JaroWinklerSimilarity;
public class StrUtils {
private StrUtils(){
}
final static JaroWinklerSimilarity SIMILARITY = new JaroWinklerSimilarity();
/**
* 清理语音识别中的标点符号
* @param source
@ -30,6 +37,10 @@ public class StrUtils {
return false;
}
public static double getJaroWinklerSimilarityRatio(String str,String target){
return SIMILARITY.apply(str,target);
}
/**
* 获取两字符串的相似度
*/
@ -38,6 +49,7 @@ public class StrUtils {
return 1 - (float) compare(str, target) / max;
}
/**
* 比较两个字符串的相识度
* 核心算法用一个二维数组记录每个字符串是否相同如果相同记为0不相同记为1每行每列相同个数累加

View File

@ -26,4 +26,7 @@ public class UserExamQueryVO extends PageQueryVO {
*/
private String result;
private Long userId;
}

View File

@ -31,4 +31,6 @@ public class UserTrainingQueryVO extends PageQueryVO {
*/
private String trainingName;
private Long userId;
}

View File

@ -0,0 +1,29 @@
package club.joylink.rtss.vo.conversation;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class ConversationGroupQueryVO extends PageQueryVO {
/**
* 群组名称
*/
private String name;
/**
* 项目编码
*/
private String projectCode;
/**
* 地图ID
*/
private List<Long> mapIds;
}

View File

@ -0,0 +1,77 @@
package club.joylink.rtss.vo.conversation;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfo;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Getter
@Setter
@NoArgsConstructor
public class ConversationGroupVO {
/**
* 主键
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 地图ID
*/
private Long mapId;
/**
* 项目编码
*/
private String projectCode;
/**
* 群主角色ID
*/
private Long leaderId;
/**
* 群成员ID
*/
private List<Long> memberIds;
public ConversationGroupVO(RtsConversationGroupInfo info) {
this.id = info.getId();
this.name = info.getName();
this.mapId = info.getMapId();
this.leaderId = info.getLeaderId();
this.projectCode = info.getProjectCode();
if (StringUtils.hasText(info.getMemberIds())) {
this.memberIds = Arrays.stream(info.getMemberIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
}
}
/**
* 转数据库存放实体
*
* @return 数据库实体
*/
public RtsConversationGroupInfo toEntity() {
RtsConversationGroupInfo info = new RtsConversationGroupInfo();
info.setId(this.id);
info.setName(this.name);
info.setMapId(this.mapId);
info.setProjectCode(this.projectCode);
info.setLeaderId(this.leaderId);
if (this.memberIds != null) {
info.setMemberIds(this.memberIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
}
return info;
}
}

View File

@ -80,4 +80,12 @@ public class PublishedTraining2InfoRspVo {
*/
private Integer state;
/**
* 是否共享 0= 1=
*/
private Integer shared;
/**
* 数据所属组织
*/
private Long orgId;
}

View File

@ -110,7 +110,6 @@ public class Training2Rule {
if (name != null) {
copyTraining2.setName(PropertyValueRule.resolveContentFormat(name, simulation, mapElement));
}
copyTraining2.setOrgId(simulation.getProjectVO().getDefaultOrg());
if (locationRule != null) {
copyTraining2.setMapLocationJson(locationRule.doHandle(simulation, mapElement));
}
@ -154,6 +153,7 @@ public class Training2Rule {
copyTraining2.setUpdateTime(LocalDateTime.now());
copyTraining2.setClient(this.client);
copyTraining2.setState(1);
copyTraining2.setShared(1);
return copyTraining2;
}
}

View File

@ -0,0 +1,97 @@
package club.joylink.rtss.vo.voice;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfig;
import club.joylink.rtss.simulation.cbtc.discriminate.OperateRule;
import club.joylink.rtss.simulation.cbtc.discriminate.ParamExtractRule;
import club.joylink.rtss.simulation.cbtc.discriminate.ReplyRule;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
import club.joylink.rtss.util.JsonUtils;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Data
public class VoiceDiscriminateConfigVO implements Serializable {
private Long id;
/**
* 描述
*/
private String describe;
/**
* 关键字正则
*/
private String keyWordRules;
private Long mapId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Long operateId;
/**
* 所需参数
* {@link List ParamExtractRule}
*/
private List<ParamExtractRule> paramsRules;
/**
* 执行指令系统操作指令
* {@link OperateRule}
*/
private OperateRule execOperateRule;
/**
* 回复指令系统指令操作完毕或者无系统指令时交互回复
* {@link ReplyRule}
*/
private ReplyRule replyRule;
public VoiceDiscriminateConfig convertToEntry(){
VoiceDiscriminateConfig data = new VoiceDiscriminateConfig();
BeanUtils.copyProperties(this, data);
if(!CollectionUtils.isEmpty(this.paramsRules)){
data.setParamsRules(JsonUtils.writeValueAsString(this.paramsRules));
}
if(Objects.nonNull(this.execOperateRule)){
data.setExecOperateRule(JsonUtils.writeValueAsString(this.execOperateRule));
}
if(Objects.nonNull(this.replyRule)){
data.setReplyRule(JsonUtils.writeValueAsString(this.replyRule));
}
return data;
}
public static VoiceDiscriminateConfigVO convertVO(VoiceDiscriminateConfig data){
VoiceDiscriminateConfigVO vo = new VoiceDiscriminateConfigVO();
BeanUtils.copyProperties(data, vo);
if(StringUtils.hasText(data.getParamsRules())){
vo.setParamsRules(JsonUtils.readCollection(data.getParamsRules(), ArrayList.class,ParamExtractRule.class));
}
if(StringUtils.hasText(data.getExecOperateRule())){
vo.setExecOperateRule(JsonUtils.read(data.getExecOperateRule(),OperateRule.class));
}
if(StringUtils.hasText(data.getReplyRule())){
vo.setReplyRule(JsonUtils.read(data.getReplyRule(),ReplyRule.class));
}
return vo;
}
public static VoiceDiscriminateRule convertRule(VoiceDiscriminateConfig data){
VoiceDiscriminateConfigVO configVO = convertVO(data);
VoiceDiscriminateRule rule = new VoiceDiscriminateRule();
rule.setKeyWordRules(configVO.getKeyWordRules());
rule.setParamsRules(configVO.getParamsRules());
rule.setExecOperateRule(configVO.getExecOperateRule());
rule.setReplyRule(configVO.getReplyRule());
return rule;
}
}

View File

@ -0,0 +1,31 @@
package club.joylink.rtss.vo.voice;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.Objects;
@Data
public class VoiceQueryVO extends PageQueryVO {
private Long mapId;
private Integer status;
private Operation.Type operation;
public VoiceDiscriminateConfigExample buildQueryExample(){
VoiceDiscriminateConfigExample example = new VoiceDiscriminateConfigExample();
VoiceDiscriminateConfigExample.Criteria criteria = example.createCriteria();
if(Objects.nonNull(this.mapId)){
criteria.andMapIdEqualTo(this.mapId);
}
if(Objects.nonNull(this.status)){
criteria.andStatusEqualTo(this.status);
}
if(Objects.nonNull(this.operation)){
criteria.andExecOperateRuleLike(String.format("%%%s%%",this.operation.name()));
}
return example;
}
}

View File

@ -18,6 +18,7 @@
<result column="org_id" jdbcType="BIGINT" property="orgId"/>
<result column="player_id_json" jdbcType="LONGVARCHAR" property="playerIdJson"/>
<result column="client" jdbcType="VARCHAR" property="client"/>
<result column="shared" jdbcType="INTEGER" property="shared"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
type="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
@ -89,7 +90,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, map_id, map_system, terminal,description, `type`, label_json, map_location_json, run_plan_id,
failure_condition_json, creator_id, create_time, update_time, `state`, org_id, player_id_json, client
failure_condition_json, creator_id, create_time, update_time, `state`, org_id, player_id_json, client, shared
</sql>
<sql id="Blob_Column_List">
bg_scene_json, opera_json, step_json, scoring_rule_json, member_json
@ -154,8 +155,7 @@
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_published_training2
where id = #{id,jdbcType=BIGINT}
delete from rts_published_training2 where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example">
@ -169,7 +169,7 @@
insert into rts_published_training2 (
id, `name`, map_id, description, `type`, label_json,
map_location_json, run_plan_id, failure_condition_json, creator_id, create_time, update_time,
`state`, org_id, bg_scene_json, opera_json, step_json, scoring_rule_json, member_json, player_id_json,client
`state`, org_id, bg_scene_json, opera_json, step_json, scoring_rule_json, member_json, player_id_json,client,shared
)
values (
#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{mapId,jdbcType=BIGINT},
@ -178,7 +178,7 @@
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{state,jdbcType=INTEGER}, #{orgId,jdbcType=BIGINT}, #{bgSceneJson,jdbcType=LONGVARCHAR},
#{operaJson,jdbcType=LONGVARCHAR}, #{stepJson,jdbcType=LONGVARCHAR}, #{scoringRuleJson,jdbcType=LONGVARCHAR},
#{memberJson,jdbcType=LONGVARCHAR}, #{playerIdJson,jdbcType=LONGVARCHAR},#{client,jdbcType=VARCHAR}
#{memberJson,jdbcType=LONGVARCHAR}, #{playerIdJson,jdbcType=LONGVARCHAR},#{client,jdbcType=VARCHAR}, #{shared,jdbcType=INTEGER}
)
</insert>
@ -186,7 +186,7 @@
insert into rts_published_training2 (
`name`, map_id, description, `type`, label_json, map_location_json, run_plan_id, failure_condition_json,
creator_id, create_time, update_time, `state`, org_id, bg_scene_json, opera_json, step_json, scoring_rule_json,
member_json, player_id_json, client
member_json, player_id_json, client, shared
)
values
<foreach collection="list" item="entity" separator=",">
@ -197,7 +197,7 @@
#{entity.createTime,jdbcType=TIMESTAMP}, #{entity.updateTime,jdbcType=TIMESTAMP}, #{entity.state,jdbcType=INTEGER},
#{entity.orgId,jdbcType=BIGINT}, #{entity.bgSceneJson,jdbcType=LONGVARCHAR}, #{entity.operaJson,jdbcType=LONGVARCHAR},
#{entity.stepJson,jdbcType=LONGVARCHAR}, #{entity.scoringRuleJson,jdbcType=LONGVARCHAR}, #{entity.memberJson,jdbcType=LONGVARCHAR},
#{entity.playerIdJson,jdbcType=LONGVARCHAR},#{entity.client,jdbcType=VARCHAR}
#{entity.playerIdJson,jdbcType=LONGVARCHAR},#{entity.client,jdbcType=VARCHAR},#{entity.shared,jdbcType=INTEGER}
)
</foreach>
</insert>
@ -268,6 +268,9 @@
<if test="client != null">
client,
</if>
<if test="shared != null">
shared,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -333,6 +336,9 @@
<if test="client != null">
#{client,jdbcType=VARCHAR},
</if>
<if test="shared != null">
#{shared,jdbcType=INTEGER},
</if>
</trim>
</insert>
@ -410,6 +416,9 @@
<if test="record.client != null">
client = #{record.client,jdbcType=VARCHAR},
</if>
<if test="record.shared != null">
shared = #{record.shared,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
@ -438,7 +447,8 @@
scoring_rule_json = #{record.scoringRuleJson,jdbcType=LONGVARCHAR},
member_json = #{record.memberJson,jdbcType=LONGVARCHAR},
player_id_json = #{record.playerIdJson,jdbcType=LONGVARCHAR},
client = #{record.client,jdbcType=VARCHAR}
client = #{record.client,jdbcType=VARCHAR},
shared = #{record.shared,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
@ -460,7 +470,8 @@
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER},
org_id = #{record.orgId,jdbcType=BIGINT},
client = #{record.client,jdbcType=VARCHAR}
client = #{record.client,jdbcType=VARCHAR},
shared = #{record.shared,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
@ -530,6 +541,9 @@
<if test="client != null">
client = #{client,jdbcType=VARCHAR},
</if>
<if test="shared != null">
shared = #{shared,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -556,7 +570,8 @@
scoring_rule_json = #{scoringRuleJson,jdbcType=LONGVARCHAR},
member_json = #{memberJson,jdbcType=LONGVARCHAR},
player_id_json = #{playerIdJson,jdbcType=LONGVARCHAR},
client = #{record.client,jdbcType=VARCHAR}
client = #{client,jdbcType=VARCHAR},
shared = #{shared,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
@ -575,7 +590,8 @@
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER},
org_id = #{orgId,jdbcType=BIGINT},
client = #{record.client,jdbcType=VARCHAR}
client = #{client,jdbcType=VARCHAR},
shared = #{shared,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
@ -608,4 +624,10 @@
</foreach>
)
</select>
<update id="updateTrainingOrgByMapIdList">
UPDATE rts_published_training2 SET org_id = #{orgId}
where creator_id = 0 and map_id in
<foreach collection="mapIdList" item="mapId" separator="," open="(" close=")"> #{mapId} </foreach>
</update>
</mapper>

View File

@ -0,0 +1,333 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.RtsConversationGroupInfoMapper">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="map_ids" jdbcType="BIGINT" property="mapId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="leader_id" jdbcType="BIGINT" property="leaderId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
<result column="member_ids" jdbcType="LONGVARCHAR" property="memberIds" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List"> id, name, map_id, project_code, create_time, update_time, creator_id, status, leader_id </sql>
<sql id="Blob_Column_List"> member_ids </sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_conversation_group_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from rts_conversation_group_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_conversation_group_info
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_conversation_group_info where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
insert into rts_conversation_group_info (id, name, map_id, project_code, create_time, update_time, creator_id, status, member_ids, leader_id )
values (
#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{mapId,jdbcType=BIGINT},
#{projectCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{creatorId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{memberIds,jdbcType=LONGVARCHAR},
#{leaderId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
insert into rts_conversation_group_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="mapId != null">
map_id,
</if>
<if test="projectCode != null">
project_code,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="status != null">
status,
</if>
<if test="memberIds != null">
member_ids,
</if>
<if test="leaderId != null">
leader_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="memberIds != null">
#{memberIds,jdbcType=LONGVARCHAR},
</if>
<if test="leaderId != null">
#{leaderId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByExampleSelective" parameterType="map">
update rts_conversation_group_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.memberIds != null">
member_ids = #{record.memberIds,jdbcType=LONGVARCHAR},
</if>
<if test="record.leaderId != null">
leader_id = #{record.leaderId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update rts_conversation_group_info
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
map_id = #{record.mapId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
status = #{record.status,jdbcType=INTEGER},
member_ids = #{record.memberIds,jdbcType=LONGVARCHAR},
leader_id = #{record.leaderId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_conversation_group_info
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
map_id = #{record.mapId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
status = #{record.status,jdbcType=INTEGER},
leader_id = #{record.leaderId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
update rts_conversation_group_info
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="memberIds != null">
member_ids = #{memberIds,jdbcType=LONGVARCHAR},
</if>
<if test="leaderId != null">
leader_id = #{leaderId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
update rts_conversation_group_info
set name = #{name,jdbcType=VARCHAR}, map_id = #{mapId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, creator_id = #{creatorId,jdbcType=BIGINT},
status = #{status,jdbcType=INTEGER}, member_ids = #{memberIds,jdbcType=LONGVARCHAR},
leader_id = #{leaderId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
update rts_conversation_group_info
set name = #{name,jdbcType=VARCHAR}, map_id = #{mapId,jdbcType=BIGINT}, project_code = #{projectCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT}, status = #{status,jdbcType=INTEGER},leader_id = #{leaderId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,368 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.voice.VoiceDiscriminateConfigDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="key_word_rules" jdbcType="VARCHAR" property="keyWordRules" />
<result column="exec_operate_rule" jdbcType="VARCHAR" property="execOperateRule" />
<result column="reply_rule" jdbcType="VARCHAR" property="replyRule" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="operate_id" jdbcType="BIGINT" property="operateId" />
<result column="describe" jdbcType="VARCHAR" property="describe" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig">
<result column="params_rules" jdbcType="LONGVARCHAR" property="paramsRules" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, key_word_rules, exec_operate_rule, reply_rule, map_id, create_time, update_time,
operate_id, `describe`, `status`
</sql>
<sql id="Blob_Column_List">
params_rules
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_voice_discriminate_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from rts_voice_discriminate_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_voice_discriminate_config
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_voice_discriminate_config
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample">
delete from rts_voice_discriminate_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig" useGeneratedKeys="true">
insert into rts_voice_discriminate_config (key_word_rules, exec_operate_rule, reply_rule,
map_id, create_time, update_time,
operate_id, `describe`, `status`,
params_rules)
values (#{keyWordRules,jdbcType=VARCHAR}, #{execOperateRule,jdbcType=VARCHAR}, #{replyRule,jdbcType=VARCHAR},
#{mapId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{operateId,jdbcType=BIGINT}, #{describe,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{paramsRules,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig" useGeneratedKeys="true">
insert into rts_voice_discriminate_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="keyWordRules != null">
key_word_rules,
</if>
<if test="execOperateRule != null">
exec_operate_rule,
</if>
<if test="replyRule != null">
reply_rule,
</if>
<if test="mapId != null">
map_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="operateId != null">
operate_id,
</if>
<if test="describe != null">
`describe`,
</if>
<if test="status != null">
`status`,
</if>
<if test="paramsRules != null">
params_rules,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="keyWordRules != null">
#{keyWordRules,jdbcType=VARCHAR},
</if>
<if test="execOperateRule != null">
#{execOperateRule,jdbcType=VARCHAR},
</if>
<if test="replyRule != null">
#{replyRule,jdbcType=VARCHAR},
</if>
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="operateId != null">
#{operateId,jdbcType=BIGINT},
</if>
<if test="describe != null">
#{describe,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="paramsRules != null">
#{paramsRules,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample" resultType="java.lang.Long">
select count(*) from rts_voice_discriminate_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update rts_voice_discriminate_config
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.keyWordRules != null">
key_word_rules = #{record.keyWordRules,jdbcType=VARCHAR},
</if>
<if test="record.execOperateRule != null">
exec_operate_rule = #{record.execOperateRule,jdbcType=VARCHAR},
</if>
<if test="record.replyRule != null">
reply_rule = #{record.replyRule,jdbcType=VARCHAR},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.operateId != null">
operate_id = #{record.operateId,jdbcType=BIGINT},
</if>
<if test="record.describe != null">
`describe` = #{record.describe,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.paramsRules != null">
params_rules = #{record.paramsRules,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update rts_voice_discriminate_config
set id = #{record.id,jdbcType=BIGINT},
key_word_rules = #{record.keyWordRules,jdbcType=VARCHAR},
exec_operate_rule = #{record.execOperateRule,jdbcType=VARCHAR},
reply_rule = #{record.replyRule,jdbcType=VARCHAR},
map_id = #{record.mapId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
operate_id = #{record.operateId,jdbcType=BIGINT},
`describe` = #{record.describe,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER},
params_rules = #{record.paramsRules,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_voice_discriminate_config
set id = #{record.id,jdbcType=BIGINT},
key_word_rules = #{record.keyWordRules,jdbcType=VARCHAR},
exec_operate_rule = #{record.execOperateRule,jdbcType=VARCHAR},
reply_rule = #{record.replyRule,jdbcType=VARCHAR},
map_id = #{record.mapId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
operate_id = #{record.operateId,jdbcType=BIGINT},
`describe` = #{record.describe,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig">
update rts_voice_discriminate_config
<set>
<if test="keyWordRules != null">
key_word_rules = #{keyWordRules,jdbcType=VARCHAR},
</if>
<if test="execOperateRule != null">
exec_operate_rule = #{execOperateRule,jdbcType=VARCHAR},
</if>
<if test="replyRule != null">
reply_rule = #{replyRule,jdbcType=VARCHAR},
</if>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="operateId != null">
operate_id = #{operateId,jdbcType=BIGINT},
</if>
<if test="describe != null">
`describe` = #{describe,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="paramsRules != null">
params_rules = #{paramsRules,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig">
update rts_voice_discriminate_config
set key_word_rules = #{keyWordRules,jdbcType=VARCHAR},
exec_operate_rule = #{execOperateRule,jdbcType=VARCHAR},
reply_rule = #{replyRule,jdbcType=VARCHAR},
map_id = #{mapId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
operate_id = #{operateId,jdbcType=BIGINT},
`describe` = #{describe,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
params_rules = #{paramsRules,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfig">
update rts_voice_discriminate_config
set key_word_rules = #{keyWordRules,jdbcType=VARCHAR},
exec_operate_rule = #{execOperateRule,jdbcType=VARCHAR},
reply_rule = #{replyRule,jdbcType=VARCHAR},
map_id = #{mapId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
operate_id = #{operateId,jdbcType=BIGINT},
`describe` = #{describe,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,71 @@
package club.joylink.rtss.services.discriminate;
import club.joylink.rtss.services.auth.IAuthenticateService;
import club.joylink.rtss.services.org.IOrgProjectService;
import club.joylink.rtss.services.project.ProjectServiceImpl;
import club.joylink.rtss.services.voice.discriminate.VoiceDiscriminateService;
import club.joylink.rtss.simulation.Simulation;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.work.SimulationWorkServiceManager;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.LoginUserVO;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
@Slf4j
@SpringBootTest
public class VoiceDiscriminateTest {
@Autowired
private SimulationManager simulationManager;
@Autowired
private SimulationService simulationService;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
private ProjectServiceImpl projectService;
@Autowired
private IAuthenticateService iAuthenticateService;
@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, 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

@ -0,0 +1,36 @@
//package club.joylink.rtss.services.util;
//
//import club.joylink.rtss.util.PinYinUtil;
//import org.ansj.domain.Result;
//import org.ansj.domain.Term;
//import org.ansj.library.DicLibrary;
//import org.ansj.splitWord.analysis.DicAnalysis;
//import org.nlpcn.commons.lang.tire.domain.Forest;
//
//public class SplitWordTest {
// public static void main(String[] args) throws Exception {
//
// DicLibrary.insert(DicLibrary.DEFAULT, "zhan tai", DicLibrary.DEFAULT_NATURE, 1);
// DicLibrary.insert(DicLibrary.DEFAULT, "zhan", "xxxws", 1);
// String source = "XXX站上行站台";
// source = PinYinUtil.toPinYinSplitBlankSpace(source);
// print(source);
// }
// private static void print(String s) throws Exception {
//// print(BaseAnalysis.parse(s));
//// print(ToAnalysis.parse(s));
//
//// print(IndexAnalysis.parse(s));
// print(DicAnalysis.parse(s/*,DicLibrary.get("user")*/));
//// print(NlpAnalysis.parse(s));
//// print(DicAnalysis.parse(s));
// }
// private static void print(Result result){
// System.out.println("------------------------------");
// for (Term term : result) {
// String d = String.format("%s->%s->%s->%s--->%s"
// ,term.getName(),term.getNatureStr(),term.getOffe(),term.getSynonyms(),term.getSubTerm());
// System.out.println(d);
// }
// }
//}

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.services.util;
import org.apache.commons.text.similarity.JaroWinklerSimilarity;
public class StringSimilarityTest {
public static void main(String[] args) {
String d = "道岔p0202范围";
System.out.println(d.substring(0,2));
System.out.println(d.substring(d.length()-2));
System.out.println(d.substring(2,d.length()-2));
JaroWinklerSimilarity similarity = new JaroWinklerSimilarity();
System.out.println(similarity.apply("p020301","p0202"));;
System.out.println(similarity.apply("p02021","啊0202"));;
System.out.println(similarity.apply("p0202","是0202"));;
System.out.println(similarity.apply("P0202","P0202"));;
}
}

View File

@ -0,0 +1,51 @@
package club.joylink.rtss.services.voice;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.services.voice.discriminate.VoiceDiscriminateService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.FileCopyUtils;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
@SpringBootTest
public class SimulationVoiceStandTest {
@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;
}
@Test
public void test1(){
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"办理车站一站上行站台扣车");
}
}

View File

@ -0,0 +1,46 @@
package club.joylink.rtss.services.voice;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.services.voice.discriminate.VoiceDiscriminateService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class SimulationVoiceStationAuthorizeTest {
@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;
}
@Test
public void test1(){
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"处理车站一站权限下放");
}
}

View File

@ -0,0 +1,76 @@
package club.joylink.rtss.services.voice;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.services.voice.discriminate.VoiceDiscriminateService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.FileCopyUtils;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
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;
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);
// simulation.setVoiceRuleList();
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);
}
}
}

View File

@ -0,0 +1,243 @@
package club.joylink.rtss.services.voice;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.discriminate.*;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import java.util.List;
@SpringBootTest
public class VoiceConfigDataTest {
@Autowired
private IVoiceDataConfigService service;
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 save(){
// this.service.saveOrUpdate();
VoiceDiscriminateConfigVO configVO = new VoiceDiscriminateConfigVO();
configVO.setDescribe("测试");
configVO.setKeyWordRules("keyword rules");
configVO.setMapId(63L);
List<ParamExtractRule> paramExtractRuleList = new ArrayList<>();
ParamExtractRule extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.ROUTE_SIGNAL_EXTRACT);
extractRule.setIndexArr(new Integer[]{0});
paramExtractRuleList.add(extractRule);
configVO.setParamsRules(paramExtractRuleList);
OperateRule operateRule = new OperateRule();
operateRule.setType(Operation.Type.Switch_Force_Turn);
List<CommandParamRule> operateParamList = new ArrayList<>();
operateRule.setParamRules(operateParamList);
CommandParamRule cpr = new CommandParamRule();
cpr.setName("stationCode");
cpr.setParamIndex(0);
cpr.setParseRule(CommandParamParseRule.MAP_ELEMENT_CODE);
cpr.setIndexArr(new Integer[]{1});
operateParamList.add(cpr);
configVO.setExecOperateRule(operateRule);
this.service.saveOrUpdate(configVO,this.getInfo());
}
@Test
public void find(){
VoiceDiscriminateConfigVO vo = this.service.byId(1L);
System.out.println(JsonUtils.writeValueAsString(vo));
}
@Test
public void update(){
VoiceDiscriminateConfigVO vo = this.service.byId(1L);
List<ParamExtractRule> paramList = vo.getParamsRules();
ParamExtractRule extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.UP_DOWN_WAY);
extractRule.setIndexArr(new Integer[]{1});
paramList.add(extractRule);
this.service.saveOrUpdate(vo,this.getInfo());
}
@Test
public void changeStatusErr(){
// this.service.changeStatus(3L,1,this.getInfo());
this.service.changeStatus(1L,3,this.getInfo());
}
@Test
public void changeStatus(){
this.service.changeStatus(1L, BusinessConsts.STATUS_NOT_USE_INT,this.getInfo());
}
@Test
public void saveForSwitchDingwei(){
// this.service.saveOrUpdate();
VoiceDiscriminateConfigVO configVO = new VoiceDiscriminateConfigVO();
configVO.setDescribe("测试道岔");
configVO.setKeyWordRules("办理道岔(.*?)定位");
configVO.setMapId(63L);
List<ParamExtractRule> paramExtractRuleList = new ArrayList<>();
ParamExtractRule extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.SWITCH_NAME);
extractRule.setIndexArr(new Integer[]{1});
paramExtractRuleList.add(extractRule);
configVO.setParamsRules(paramExtractRuleList);
OperateRule operateRule = new OperateRule();
operateRule.setType(Operation.Type.Switch_Normal_Position);
List<CommandParamRule> operateParamList = new ArrayList<>();
operateRule.setParamRules(operateParamList);
CommandParamRule cpr = new CommandParamRule();
cpr.setName("switchCode");
// cpr.setParamIndex(0);
cpr.setParamType(CommandParamRule.ParamType.DEFAULT);
cpr.setParseRule(CommandParamParseRule.MAP_ELEMENT_CODE);
cpr.setIndexArr(new Integer[]{1});
operateParamList.add(cpr);
configVO.setExecOperateRule(operateRule);
this.service.saveOrUpdate(configVO,this.getInfo());
}
@Test
public void saveForSwitchFanwei(){
// this.service.saveOrUpdate();
VoiceDiscriminateConfigVO configVO = new VoiceDiscriminateConfigVO();
configVO.setDescribe("测试道岔");
configVO.setKeyWordRules("办理道岔(.*?)反胃");
configVO.setMapId(63L);
List<ParamExtractRule> paramExtractRuleList = new ArrayList<>();
ParamExtractRule extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.SWITCH_NAME);
extractRule.setIndexArr(new Integer[]{1});
paramExtractRuleList.add(extractRule);
configVO.setParamsRules(paramExtractRuleList);
OperateRule operateRule = new OperateRule();
operateRule.setType(Operation.Type.Switch_Reverse_Position);
List<CommandParamRule> operateParamList = new ArrayList<>();
operateRule.setParamRules(operateParamList);
CommandParamRule cpr = new CommandParamRule();
cpr.setName("switchCode");
// cpr.setParamIndex(0);
cpr.setParamType(CommandParamRule.ParamType.DEFAULT);
cpr.setParseRule(CommandParamParseRule.MAP_ELEMENT_CODE);
cpr.setIndexArr(new Integer[]{1});
operateParamList.add(cpr);
configVO.setExecOperateRule(operateRule);
this.service.saveOrUpdate(configVO,this.getInfo());
}
@Test
public void saveForStand(){
// this.service.saveOrUpdate();
VoiceDiscriminateConfigVO configVO = new VoiceDiscriminateConfigVO();
configVO.setId(4L);
configVO.setDescribe("测试站台扣车");
// ^(?:BANLI|CHULI)(.*?ZHAN(?:YI|ER))ZHAN(.*?)ZHANTAIKOUCHE
configVO.setKeyWordRules("^(?:办理|处理)(.*?站(?:一|二))站(.*?)站台扣车");
configVO.setMapId(63L);
List<ParamExtractRule> paramExtractRuleList = new ArrayList<>();
ParamExtractRule extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.STATION_NAME_EXTRACT);
extractRule.setIndexArr(new Integer[]{1});
paramExtractRuleList.add(extractRule);
extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.UP_DOWN_WAY);
extractRule.setIndexArr(new Integer[]{2});
paramExtractRuleList.add(extractRule);
extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.STAND_STATION_UP_DOWN_EXTRACT);
extractRule.setIndexArr(new Integer[]{1,2});
paramExtractRuleList.add(extractRule);
configVO.setParamsRules(paramExtractRuleList);
OperateRule operateRule = new OperateRule();
operateRule.setType(Operation.Type.Stand_Set_Hold_Train);
List<CommandParamRule> operateParamList = new ArrayList<>();
operateRule.setParamRules(operateParamList);
CommandParamRule cpr = new CommandParamRule();
cpr.setName("standCode");
cpr.setParamType(CommandParamRule.ParamType.DEFAULT);
// cpr.setParamIndex(0);
cpr.setParseRule(CommandParamParseRule.MAP_ELEMENT_CODE);
cpr.setIndexArr(new Integer[]{3});
operateParamList.add(cpr);
configVO.setExecOperateRule(operateRule);
this.service.saveOrUpdate(configVO,this.getInfo());
}
@Test
public void saveForAuthorize(){
// this.service.saveOrUpdate();
VoiceDiscriminateConfigVO configVO = new VoiceDiscriminateConfigVO();
// configVO.setId(4L);
configVO.setDescribe("测试车站权限下放");
// ^(?:BANLI|CHULI)(.*?ZHAN(?:YI|ER))ZHAN(.*?)ZHANTAIKOUCHE
configVO.setKeyWordRules("(?:办理|处理)(.*?站(?:一|二))站权限下放");
configVO.setMapId(63L);
List<ParamExtractRule> paramExtractRuleList = new ArrayList<>();
ParamExtractRule extractRule = new ParamExtractRule();
extractRule.setParseRule(ExtractRule.STATION_NAME_EXTRACT);
extractRule.setIndexArr(new Integer[]{1});
paramExtractRuleList.add(extractRule);
// extractRule = new ParamExtractRule();
// extractRule.setParseRule(ExtractRule.UP_DOWN_WAY);
// extractRule.setIndexArr(new Integer[]{2});
// paramExtractRuleList.add(extractRule);
// extractRule = new ParamExtractRule();
// extractRule.setParseRule(ExtractRule.STAND_STATION_UP_DOWN_EXTRACT);
// extractRule.setIndexArr(new Integer[]{1,2});
// paramExtractRuleList.add(extractRule);
configVO.setParamsRules(paramExtractRuleList);
OperateRule operateRule = new OperateRule();
operateRule.setType(Operation.Type.CM_Apply_For_Station_Control);
List<CommandParamRule> operateParamList = new ArrayList<>();
operateRule.setParamRules(operateParamList);
CommandParamRule cpr = new CommandParamRule();
cpr.setName("stationCodes");
cpr.setParamType(CommandParamRule.ParamType.LIST);
// cpr.setParamIndex(0);
cpr.setParseRule(CommandParamParseRule.MAP_ELEMENT_CODE);
cpr.setIndexArr(new Integer[]{1});
operateParamList.add(cpr);
configVO.setExecOperateRule(operateRule);
this.service.saveOrUpdate(configVO,this.getInfo());
}
}