Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2

This commit is contained in:
weizhihong 2023-04-10 15:03:55 +08:00
commit cf592fe9ff
23 changed files with 1665 additions and 17 deletions

33
pom.xml
View File

@ -146,6 +146,39 @@
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>3.19.3</version> <version>3.19.3</version>
</dependency> </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> </dependencies>
<build> <build>

View File

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

View File

@ -0,0 +1,41 @@
package club.joylink.rtss.dao.voice;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfig;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigWithBLOBs;
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(VoiceDiscriminateConfigWithBLOBs record);
int insertSelective(VoiceDiscriminateConfigWithBLOBs record);
List<VoiceDiscriminateConfigWithBLOBs> selectByExampleWithBLOBs(VoiceDiscriminateConfigExample example);
List<VoiceDiscriminateConfig> selectByExample(VoiceDiscriminateConfigExample example);
VoiceDiscriminateConfigWithBLOBs selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") VoiceDiscriminateConfigWithBLOBs record, @Param("example") VoiceDiscriminateConfigExample example);
int updateByExampleWithBLOBs(@Param("record") VoiceDiscriminateConfigWithBLOBs record, @Param("example") VoiceDiscriminateConfigExample example);
int updateByExample(@Param("record") VoiceDiscriminateConfig record, @Param("example") VoiceDiscriminateConfigExample example);
int updateByPrimaryKeySelective(VoiceDiscriminateConfigWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(VoiceDiscriminateConfigWithBLOBs record);
int updateByPrimaryKey(VoiceDiscriminateConfig record);
}

View File

@ -0,0 +1,40 @@
package club.joylink.rtss.entity.voice;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
* @author
*
*/
@Data
public class VoiceDiscriminateConfig implements Serializable {
private Long id;
/**
* 关键字正则
*/
private String keyWordRules;
private Long mapId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Long operateId;
/**
* 描述
*/
private String describe;
/**
* 状态0=编辑,1=使用
*/
private Integer status;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,723 @@
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 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

@ -0,0 +1,28 @@
package club.joylink.rtss.entity.voice;
import java.io.Serializable;
import lombok.Data;
/**
* @author
*
*/
@Data
public class VoiceDiscriminateConfigWithBLOBs extends VoiceDiscriminateConfig implements Serializable {
/**
* 所需参数
*/
private String paramsRules;
/**
* 执行指令系统操作指令
*/
private String execOperateRule;
/**
* 回复指令系统指令操作完毕或者无系统指令时交互回复
*/
private String replyRule;
private static final long serialVersionUID = 1L;
}

View File

@ -59,6 +59,10 @@ public enum BusinessExceptionAssertEnum implements BusinessExceptionAssert {
INCORRECT_VERIFICATION_CODE(40051, "incorrect verification code"), INCORRECT_VERIFICATION_CODE(40051, "incorrect verification code"),
THIRD_SERVICE_CALL_EXCEPTION(40071, "the third service call exception"), THIRD_SERVICE_CALL_EXCEPTION(40071, "the third service call exception"),
VOICE_COMMAND_PARSE_ERROR(40061,"voice command parse error"), 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"), PAY_ERROR(50000, "pay error"),
WECHAT_NOTIFY_ERROR(401, "wechat notify error") WECHAT_NOTIFY_ERROR(401, "wechat notify error")

View File

@ -117,13 +117,13 @@ public class MapService implements IMapService, ApplicationRunner {
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
//缓存所有地图数据 //缓存所有地图数据
log.info("开始缓存地图数据"); log.info("开始缓存地图数据");
for (MapVO mapVO : listOnline()) { /* for (MapVO mapVO : listOnline()) {
try { try {
getMapDetail(mapVO.getId()); getMapDetail(mapVO.getId());
} catch (Exception e) { } catch (Exception e) {
log.error(String.format("[id:%s]的地图缓存失败", mapVO.getId()), e); log.error(String.format("[id:%s]的地图缓存失败", mapVO.getId()), e);
} }
} }*/
log.info("缓存地图数据结束"); log.info("缓存地图数据结束");
} }

View File

@ -0,0 +1,11 @@
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;
public interface IVoiceDataConfigService {
PageVO<VoiceDiscriminateConfigVO> query();
VoiceDiscriminateConfigVO byId(Long id);
void saveOrUpdate(VoiceDiscriminateConfigVO configVO , LoginUserInfoVO userInfo);
}

View File

@ -0,0 +1,75 @@
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.VoiceDiscriminateConfigExample;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigWithBLOBs;
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 lombok.extern.slf4j.Slf4j;
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 VoiceDiscriminateConfigWithBLOBs findById(Long id){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),"数据id不能为空");
VoiceDiscriminateConfigWithBLOBs 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() {
return null;
}
@Override
public VoiceDiscriminateConfigVO byId(Long id) {
VoiceDiscriminateConfigWithBLOBs data = this.findById(id);
return VoiceDiscriminateConfigVO.convertVO(data);
}
@Override
public void saveOrUpdate(VoiceDiscriminateConfigVO configVO, LoginUserInfoVO userInfo) {
LocalDateTime dateTime = LocalDateTime.now();
VoiceDiscriminateConfigWithBLOBs newData = configVO.convertToEntry();
newData.setOperateId(userInfo.getAccountVO().getId());
if(Objects.isNull(configVO.getId())){
newData.setCreateTime(dateTime);
newData.setUpdateTime(dateTime);
this.configDAO.insert(newData);
}else{
VoiceDiscriminateConfigWithBLOBs data = this.findById(configVO.getId());
newData.setCreateTime(data.getCreateTime());
newData.setUpdateTime(dateTime);
this.configDAO.updateByPrimaryKeyWithBLOBs(newData);
}
}
@Override
public List<VoiceDiscriminateRule> findRuleByMapId(Long mapId) {
VoiceQueryVO queryVO = new VoiceQueryVO();
queryVO.setMapId(mapId);
queryVO.setStatus(BusinessConsts.STATUS_USE_INT);
List<VoiceDiscriminateConfigWithBLOBs> list = this.configDAO.selectByExampleWithBLOBs(queryVO.buildQueryExample());
return list.stream().map(VoiceDiscriminateConfigVO::convertRule).collect(Collectors.toList());
}
}

View File

@ -80,11 +80,16 @@ public class VoiceParseServiceImpl implements VoiceParseService {
*/ */
private void matchCommand(Simulation simulation, VoiceDiscriminateResult result) { private void matchCommand(Simulation simulation, VoiceDiscriminateResult result) {
// 加载本地图的规则信息列表从数据库中获取 // 加载本地图的规则信息列表从数据库中获取
List<VoiceDiscriminateRule> ruleList = List.of(new VoiceDiscriminateRule()); List<VoiceDiscriminateRule> ruleList = simulation.getVoiceRuleList();
// BusinessExceptionAssertEnum.VOICE_COMMAND_CONFIG_NULL.assertTrue(!CollectionUtils.isEmpty(ruleList),"该线路没有语音配置的数据");
if(CollectionUtils.isEmpty(ruleList)){
result.setSuccess(false);
result.setMsg("该线路没有语音配置的数据");
return;
}
// 匹配指令 // 匹配指令
List<String> matchGroupList = null;
for (VoiceDiscriminateRule rule : ruleList) { for (VoiceDiscriminateRule rule : ruleList) {
matchGroupList = keyWordsMatch(rule.getKeyWordRules(), result.getMatchOriginContent()); List<String> matchGroupList = keyWordsMatch(rule.getKeyWordRules(), result.getMatchOriginContent());
if (!CollectionUtils.isEmpty(matchGroupList)) { if (!CollectionUtils.isEmpty(matchGroupList)) {
result.setRule(rule); result.setRule(rule);
result.setMatchGroupList(matchGroupList); result.setMatchGroupList(matchGroupList);

View File

@ -6,7 +6,6 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog; import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams; import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.command.VoiceCommandBO; import club.joylink.rtss.simulation.cbtc.command.VoiceCommandBO;
import club.joylink.rtss.simulation.cbtc.competition.CompetitionBO; import club.joylink.rtss.simulation.cbtc.competition.CompetitionBO;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
@ -22,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.Heb1IbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PscConfig; 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.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.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
@ -60,6 +60,11 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
// */ // */
// private String id; // 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.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.services.permission.PermissionSubjectService; import club.joylink.rtss.services.permission.PermissionSubjectService;
import club.joylink.rtss.simulation.SimulationManager; 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.event.SimulationCreateSuccessEvent;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
@ -66,6 +68,9 @@ public class SimulationServiceImpl implements SimulationService {
@Autowired @Autowired
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired
private IVoiceDiscriminateRule discriminateRule;
@Override @Override
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) { public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) {
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO, createUserType).getId(); 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) { public Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String,Boolean> createUserType) {
//获取仿真工作服务 //获取仿真工作服务
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType()); SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType());
//创建仿真 //创建仿真
String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId); String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId);
Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId); Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId);
//语音配置数据
List<VoiceDiscriminateRule> ruleList = this.discriminateRule.findRuleByMapId(mapId);
simulation.setVoiceRuleList(ruleList);
simulation.setMapFunctionId(mapFunctionId); simulation.setMapFunctionId(mapFunctionId);
simulation.setCreateUserType(createUserType); simulation.setCreateUserType(createUserType);
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo(); LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();

View File

@ -1,10 +1,21 @@
package club.joylink.rtss.simulation.cbtc.discriminate; package club.joylink.rtss.simulation.cbtc.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation; 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.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.util.PinYinUtil; import club.joylink.rtss.util.PinYinUtil;
import lombok.Getter; import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.similarity.JaroWinklerSimilarity;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@ -21,16 +32,18 @@ public enum ExtractRule {
if (sourceStr == null || sourceStr.length == 0) { if (sourceStr == null || sourceStr.length == 0) {
throw new IllegalArgumentException("定位参数不缺失"); throw new IllegalArgumentException("定位参数不缺失");
} }
// 这里可能需要做对入参做一些处理 // 这里可能需要做对入参做一些处理
String stationName = sourceStr[0]; String stationName = sourceStr[0];
return findDevice(simulation, MapElement.DeviceType.STATION,Station.class,stationName);
Optional<Station> stationOptional = simulation.getRepository().getStationList().stream() /* Optional<Station> stationOptional = simulation.getRepository().getStationList().stream()
.filter(station -> Objects.equals(stationName, PinYinUtil.toPinYin(station.getName()))) .filter(station -> Objects.equals(stationName, PinYinUtil.toPinYin(station.getName())))
.findFirst(); .findFirst();
if (stationOptional.isPresent()) { if (stationOptional.isPresent()) {
return stationOptional.get(); return stationOptional.get();
} }
throw new IllegalArgumentException("未找到【" + stationName + "】车站"); throw new IllegalArgumentException("未找到【" + stationName + "】车站");*/
} }
}, },
ROUTE_NAME_EXTRACT("根据进路名称匹配进路") { ROUTE_NAME_EXTRACT("根据进路名称匹配进路") {
@ -41,14 +54,14 @@ public enum ExtractRule {
} }
// 这里可能对XS做处理 // 这里可能对XS做处理
String routeName = sourceStr[0]; String routeName = sourceStr[0];
return findDevice(simulation, MapElement.DeviceType.ROUTE,Route.class,routeName);
Optional<Route> routeOptional = simulation.getRepository().getRouteList().stream() /* Optional<Route> routeOptional = simulation.getRepository().getRouteList().stream()
.filter(route -> Objects.equals(route.getName(), routeName)) .filter(route -> Objects.equals(route.getName(), routeName))
.findFirst(); .findFirst();
if (routeOptional.isPresent()) { if (routeOptional.isPresent()) {
return routeOptional.get(); return routeOptional.get();
} }
throw new IllegalArgumentException("未找到【" + routeName + "】进路"); throw new IllegalArgumentException("未找到【" + routeName + "】进路");*/
} }
}, },
ROUTE_SIGNAL_EXTRACT("根据起始、终点信号机匹配进路") { ROUTE_SIGNAL_EXTRACT("根据起始、终点信号机匹配进路") {
@ -81,8 +94,24 @@ public enum ExtractRule {
} }
String stationName = sourceStr[0], upDown = sourceStr[1]; String stationName = sourceStr[0], upDown = sourceStr[1];
Station station = (Station) STATION_NAME_EXTRACT.matchParam(simulation, stationName); Station station = (Station) STATION_NAME_EXTRACT.matchParam(simulation, stationName);
boolean right = "SHANG".equals(upDown); Boolean right = (Boolean) UP_DOWN_WAY.matchParam(simulation,upDown);
return station.getStandOf(right); List<Stand> stands = station.getStandOf(right);
if(CollectionUtils.isEmpty(stands)){
throw new IllegalArgumentException(String.format("不能获取对应的站台 车站[%s-%s],上下行[%s-%s]",stationName,station.getCode(),upDown,right));
}
return station.getStandOf(right).get(0);
}
},UP_DOWN_WAY("车辆上下行"){
@Override
public Object matchParam(Simulation simulation, String... sourceStr) {
String way = sourceStr[0];
if(StringUtils.containsAnyIgnoreCase(way,"shang")){
return true;
}else if(StringUtils.containsAnyIgnoreCase(way,"xia")){
return false;
}
throw new IllegalArgumentException(String.format("不能解析上下行[%s]",way));
} }
}, },
; ;
@ -97,4 +126,20 @@ public enum ExtractRule {
} }
public abstract Object matchParam(Simulation simulation, String... sourceStr); public abstract Object matchParam(Simulation simulation, String... sourceStr);
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;
}
} }

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

@ -9,7 +9,7 @@ import java.util.List;
*/ */
@Data @Data
public class VoiceDiscriminateRule { public class VoiceDiscriminateRule {
private Long id; // private Long id;
/** /**
* 关键字正则 * 关键字正则

View File

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

View File

@ -0,0 +1,97 @@
package club.joylink.rtss.vo.voice;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigWithBLOBs;
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 VoiceDiscriminateConfigWithBLOBs convertToEntry(){
VoiceDiscriminateConfigWithBLOBs data = new VoiceDiscriminateConfigWithBLOBs();
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(VoiceDiscriminateConfigWithBLOBs 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(VoiceDiscriminateConfigWithBLOBs 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,25 @@
package club.joylink.rtss.vo.voice;
import club.joylink.rtss.entity.voice.VoiceDiscriminateConfigExample;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Data;
import java.util.Objects;
@Data
public class VoiceQueryVO extends PageQueryVO {
private Long mapId;
private Integer status;
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);
}
return example;
}
}

View File

@ -0,0 +1,363 @@
<?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="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.VoiceDiscriminateConfigWithBLOBs">
<result column="params_rules" jdbcType="LONGVARCHAR" property="paramsRules" />
<result column="exec_operate_rule" jdbcType="LONGVARCHAR" property="execOperateRule" />
<result column="reply_rule" jdbcType="LONGVARCHAR" property="replyRule" />
</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, map_id, create_time, update_time, operate_id, `describe`, `status`
</sql>
<sql id="Blob_Column_List">
params_rules, exec_operate_rule, reply_rule
</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.VoiceDiscriminateConfigWithBLOBs" useGeneratedKeys="true">
insert into rts_voice_discriminate_config (key_word_rules, map_id, create_time,
update_time, operate_id, `describe`,
`status`, params_rules, exec_operate_rule,
reply_rule)
values (#{keyWordRules,jdbcType=VARCHAR}, #{mapId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{operateId,jdbcType=BIGINT}, #{describe,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{paramsRules,jdbcType=LONGVARCHAR}, #{execOperateRule,jdbcType=LONGVARCHAR},
#{replyRule,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfigWithBLOBs" useGeneratedKeys="true">
insert into rts_voice_discriminate_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="keyWordRules != null">
key_word_rules,
</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>
<if test="execOperateRule != null">
exec_operate_rule,
</if>
<if test="replyRule != null">
reply_rule,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="keyWordRules != null">
#{keyWordRules,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>
<if test="execOperateRule != null">
#{execOperateRule,jdbcType=LONGVARCHAR},
</if>
<if test="replyRule != null">
#{replyRule,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.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>
<if test="record.execOperateRule != null">
exec_operate_rule = #{record.execOperateRule,jdbcType=LONGVARCHAR},
</if>
<if test="record.replyRule != null">
reply_rule = #{record.replyRule,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},
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},
exec_operate_rule = #{record.execOperateRule,jdbcType=LONGVARCHAR},
reply_rule = #{record.replyRule,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},
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.VoiceDiscriminateConfigWithBLOBs">
update rts_voice_discriminate_config
<set>
<if test="keyWordRules != null">
key_word_rules = #{keyWordRules,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>
<if test="execOperateRule != null">
exec_operate_rule = #{execOperateRule,jdbcType=LONGVARCHAR},
</if>
<if test="replyRule != null">
reply_rule = #{replyRule,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.voice.VoiceDiscriminateConfigWithBLOBs">
update rts_voice_discriminate_config
set key_word_rules = #{keyWordRules,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},
exec_operate_rule = #{execOperateRule,jdbcType=LONGVARCHAR},
reply_rule = #{replyRule,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},
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,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,65 @@
package club.joylink.rtss.services.voice;
import club.joylink.rtss.entity.project.Project;
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;
import java.util.List;
@SpringBootTest
public class SimulationVoiceTest {
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
private LoginUserInfoVO getInfo(){
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
LoginUserInfoVO infoVO = JsonUtils.read(testJsonData,LoginUserInfoVO.class);
Project project = new Project();
project.setName("默认项目");
project.setCode("DEFAULT");
ProjectVO projectVO = new ProjectVO(project);
infoVO.setProjectInfo(projectVO);
return infoVO;
}
private String findLocalVoiceFileData(String filePath) throws IOException {
File file = new File(filePath);
String fileBase64 = FileCopyUtils.copyToString(new FileReader(file));
return fileBase64;
}
@Test
public void test() throws IOException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10601L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
String fileData = this.findLocalVoiceFileData("C:\\Users\\joylink\\Desktop\\voice\\5.txt");
// ParseData result = this.commandService.voiceCommand(simulation,fileData);
// System.out.println(result);
}
@Test
public void testSource3(){
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10601L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
// String fileData = this.findLocalVoiceFileData("C:\\Users\\joylink\\Desktop\\voice\\5.txt");
// ParseData result = this.commandService.voiceCommand(simulation,"道岔p0707定位");
// System.out.println(result);
}
}