场景语音录制
This commit is contained in:
parent
edf2973634
commit
0237c53000
@ -1,16 +1,14 @@
|
|||||||
package club.joylink.rtss.controller.competition;
|
package club.joylink.rtss.controller.competition;
|
||||||
|
|
||||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||||
|
import club.joylink.rtss.entity.CompetitionVoiceRecord;
|
||||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||||
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
|
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
|
||||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionPagedQueryVO;
|
import club.joylink.rtss.vo.client.competition.*;
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
|
||||||
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
|
||||||
import club.joylink.rtss.vo.client.pay.WxPayUnifiedOrderResultVO;
|
import club.joylink.rtss.vo.client.pay.WxPayUnifiedOrderResultVO;
|
||||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
import club.joylink.rtss.vo.client.validGroup.competition.CompetitionUpdateCheck;
|
import club.joylink.rtss.vo.client.validGroup.competition.CompetitionUpdateCheck;
|
||||||
@ -21,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -102,6 +101,30 @@ public class CompetitionPracticalController {
|
|||||||
return iCompetitionPracticalService.purchasePermission(mapId, monthAmount, user);
|
return iCompetitionPracticalService.purchasePermission(mapId, monthAmount, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询语音录制")
|
||||||
|
@GetMapping("/voice/record/query/{userId}/{competitionId}")
|
||||||
|
public List<CompetitionVoiceRecord> queryVoiceRecords(@PathVariable Long userId, @PathVariable Long competitionId) {
|
||||||
|
return iCompetitionPracticalService.queryVoiceRecords(userId, competitionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增语音录制")
|
||||||
|
@PostMapping("/voice/record/{competitionId}/{actionId}")
|
||||||
|
public CompetitionVoiceRecord voiceRecord(@PathVariable Long competitionId, @PathVariable String actionId, MultipartFile file, @RequestAttribute UserVO user) {
|
||||||
|
return iCompetitionPracticalService.voiceRecord(competitionId, actionId, file, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("更新语音录制")
|
||||||
|
@PutMapping("/voice/record/{recordId}")
|
||||||
|
public CompetitionVoiceRecord updateVoiceRecord(@PathVariable Long recordId, MultipartFile file, @RequestAttribute UserVO user) {
|
||||||
|
return iCompetitionPracticalService.updateVoiceRecord(recordId, file, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("语音录制校验")
|
||||||
|
@GetMapping("/voice/record/check/{recordId}")
|
||||||
|
public VoiceErrorSetVO voiceRecordCheck(@PathVariable Long recordId) {
|
||||||
|
return iCompetitionPracticalService.voiceRecordCheck(recordId);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------- 竞赛运行相关 ------------------------- */
|
/* ------------------------- 竞赛运行相关 ------------------------- */
|
||||||
@ApiOperation("加载竞赛场景")
|
@ApiOperation("加载竞赛场景")
|
||||||
@PutMapping("/load/{group}/{id}")
|
@PutMapping("/load/{group}/{id}")
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package club.joylink.rtss.controller.voice;
|
package club.joylink.rtss.controller.voice;
|
||||||
|
|
||||||
import club.joylink.rtss.services.IVoiceService;
|
import club.joylink.rtss.services.IVoiceService;
|
||||||
|
import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||||
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler;
|
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler;
|
||||||
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
|
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
|
||||||
|
import club.joylink.rtss.vo.client.competition.VoiceErrorSetVO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -25,13 +30,19 @@ public class VoiceController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SimulationVoiceHandler simulationVoiceHandler;
|
private SimulationVoiceHandler simulationVoiceHandler;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVoiceTrainingService iVoiceTrainingService;
|
||||||
|
|
||||||
@ApiOperation("语音识别")
|
@ApiOperation("语音识别")
|
||||||
@PostMapping("recognition")
|
@PostMapping("recognition")
|
||||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, "");
|
return iVoiceTrainingService.voiceRecognition(file);
|
||||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
}
|
||||||
return result;
|
|
||||||
|
|
||||||
|
@ApiOperation("查询语音识别错误集")
|
||||||
|
@GetMapping("/errorSet/paged")
|
||||||
|
public PageVO<VoiceErrorSetVO> pagedQueryErrorSet(PageQueryVO queryVO) {
|
||||||
|
return iVoiceTrainingService.pagedQueryErrorSet(queryVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package club.joylink.rtss.dao;
|
||||||
|
|
||||||
|
import club.joylink.rtss.entity.CompetitionVoiceRecord;
|
||||||
|
import club.joylink.rtss.entity.CompetitionVoiceRecordExample;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CompetitionVoiceRecordDAO继承基类
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface CompetitionVoiceRecordDAO extends MyBatisBaseDao<CompetitionVoiceRecord, Long, CompetitionVoiceRecordExample> {
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
package club.joylink.rtss.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CompetitionVoiceRecord implements Serializable {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private Long competitionId;
|
||||||
|
|
||||||
|
private String actionId;
|
||||||
|
|
||||||
|
private String filepath;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCompetitionId() {
|
||||||
|
return competitionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompetitionId(Long competitionId) {
|
||||||
|
this.competitionId = competitionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActionId(String actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilepath() {
|
||||||
|
return filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilepath(String filepath) {
|
||||||
|
this.filepath = filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object that) {
|
||||||
|
if (this == that) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (that == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != that.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CompetitionVoiceRecord other = (CompetitionVoiceRecord) that;
|
||||||
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||||
|
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
|
||||||
|
&& (this.getCompetitionId() == null ? other.getCompetitionId() == null : this.getCompetitionId().equals(other.getCompetitionId()))
|
||||||
|
&& (this.getActionId() == null ? other.getActionId() == null : this.getActionId().equals(other.getActionId()))
|
||||||
|
&& (this.getFilepath() == null ? other.getFilepath() == null : this.getFilepath().equals(other.getFilepath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||||
|
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
|
||||||
|
result = prime * result + ((getCompetitionId() == null) ? 0 : getCompetitionId().hashCode());
|
||||||
|
result = prime * result + ((getActionId() == null) ? 0 : getActionId().hashCode());
|
||||||
|
result = prime * result + ((getFilepath() == null) ? 0 : getFilepath().hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(getClass().getSimpleName());
|
||||||
|
sb.append(" [");
|
||||||
|
sb.append("Hash = ").append(hashCode());
|
||||||
|
sb.append(", id=").append(id);
|
||||||
|
sb.append(", userId=").append(userId);
|
||||||
|
sb.append(", competitionId=").append(competitionId);
|
||||||
|
sb.append(", actionId=").append(actionId);
|
||||||
|
sb.append(", filepath=").append(filepath);
|
||||||
|
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||||
|
sb.append("]");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,542 @@
|
|||||||
|
package club.joylink.rtss.entity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CompetitionVoiceRecordExample {
|
||||||
|
protected String orderByClause;
|
||||||
|
|
||||||
|
protected boolean distinct;
|
||||||
|
|
||||||
|
protected List<Criteria> oredCriteria;
|
||||||
|
|
||||||
|
private Integer limit;
|
||||||
|
|
||||||
|
private Long offset;
|
||||||
|
|
||||||
|
public CompetitionVoiceRecordExample() {
|
||||||
|
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 andUserIdIsNull() {
|
||||||
|
addCriterion("user_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdIsNotNull() {
|
||||||
|
addCriterion("user_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdEqualTo(Long value) {
|
||||||
|
addCriterion("user_id =", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotEqualTo(Long value) {
|
||||||
|
addCriterion("user_id <>", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdGreaterThan(Long value) {
|
||||||
|
addCriterion("user_id >", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("user_id >=", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdLessThan(Long value) {
|
||||||
|
addCriterion("user_id <", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("user_id <=", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdIn(List<Long> values) {
|
||||||
|
addCriterion("user_id in", values, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotIn(List<Long> values) {
|
||||||
|
addCriterion("user_id not in", values, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("user_id between", value1, value2, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("user_id not between", value1, value2, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdIsNull() {
|
||||||
|
addCriterion("competition_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdIsNotNull() {
|
||||||
|
addCriterion("competition_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdEqualTo(Long value) {
|
||||||
|
addCriterion("competition_id =", value, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdNotEqualTo(Long value) {
|
||||||
|
addCriterion("competition_id <>", value, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdGreaterThan(Long value) {
|
||||||
|
addCriterion("competition_id >", value, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("competition_id >=", value, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdLessThan(Long value) {
|
||||||
|
addCriterion("competition_id <", value, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("competition_id <=", value, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdIn(List<Long> values) {
|
||||||
|
addCriterion("competition_id in", values, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdNotIn(List<Long> values) {
|
||||||
|
addCriterion("competition_id not in", values, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("competition_id between", value1, value2, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCompetitionIdNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("competition_id not between", value1, value2, "competitionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdIsNull() {
|
||||||
|
addCriterion("action_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdIsNotNull() {
|
||||||
|
addCriterion("action_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdEqualTo(String value) {
|
||||||
|
addCriterion("action_id =", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdNotEqualTo(String value) {
|
||||||
|
addCriterion("action_id <>", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdGreaterThan(String value) {
|
||||||
|
addCriterion("action_id >", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("action_id >=", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdLessThan(String value) {
|
||||||
|
addCriterion("action_id <", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("action_id <=", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdLike(String value) {
|
||||||
|
addCriterion("action_id like", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdNotLike(String value) {
|
||||||
|
addCriterion("action_id not like", value, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdIn(List<String> values) {
|
||||||
|
addCriterion("action_id in", values, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdNotIn(List<String> values) {
|
||||||
|
addCriterion("action_id not in", values, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("action_id between", value1, value2, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActionIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("action_id not between", value1, value2, "actionId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathIsNull() {
|
||||||
|
addCriterion("filePath is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathIsNotNull() {
|
||||||
|
addCriterion("filePath is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathEqualTo(String value) {
|
||||||
|
addCriterion("filePath =", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathNotEqualTo(String value) {
|
||||||
|
addCriterion("filePath <>", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathGreaterThan(String value) {
|
||||||
|
addCriterion("filePath >", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("filePath >=", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathLessThan(String value) {
|
||||||
|
addCriterion("filePath <", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("filePath <=", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathLike(String value) {
|
||||||
|
addCriterion("filePath like", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathNotLike(String value) {
|
||||||
|
addCriterion("filePath not like", value, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathIn(List<String> values) {
|
||||||
|
addCriterion("filePath in", values, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathNotIn(List<String> values) {
|
||||||
|
addCriterion("filePath not in", values, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathBetween(String value1, String value2) {
|
||||||
|
addCriterion("filePath between", value1, value2, "filepath");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andFilepathNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("filePath not between", value1, value2, "filepath");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -85,13 +85,17 @@ public interface IVoiceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String handleAndSaveFile(MultipartFile file) throws IOException {
|
static String handleAndSaveFile(MultipartFile file) {
|
||||||
String contentType = file.getContentType();
|
String contentType = file.getContentType();
|
||||||
BusinessExceptionAssertEnum.UNSUPPORTED_FILE_FORMAT.assertTrue(
|
BusinessExceptionAssertEnum.UNSUPPORTED_FILE_FORMAT.assertTrue(
|
||||||
"audio/wave".equals(contentType) || "audio/wav".equals(contentType) || "audio/x-wav".equals(contentType),
|
"audio/wave".equals(contentType) || "audio/wav".equals(contentType) || "audio/x-wav".equals(contentType),
|
||||||
String.format("不支持的文件格式[%s]", contentType));
|
String.format("不支持的文件格式[%s]", contentType));
|
||||||
InputStream inputStream = file.getInputStream();
|
try {
|
||||||
return saveFile(inputStream);
|
InputStream inputStream = file.getInputStream();
|
||||||
|
return saveFile(inputStream);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,12 +3,15 @@ package club.joylink.rtss.services.completition;
|
|||||||
import club.joylink.rtss.constants.*;
|
import club.joylink.rtss.constants.*;
|
||||||
import club.joylink.rtss.dao.CompetitionDAO;
|
import club.joylink.rtss.dao.CompetitionDAO;
|
||||||
import club.joylink.rtss.dao.CompetitionRecordDAO;
|
import club.joylink.rtss.dao.CompetitionRecordDAO;
|
||||||
|
import club.joylink.rtss.dao.CompetitionVoiceRecordDAO;
|
||||||
import club.joylink.rtss.entity.*;
|
import club.joylink.rtss.entity.*;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.*;
|
import club.joylink.rtss.services.*;
|
||||||
import club.joylink.rtss.services.script.IScriptService;
|
import club.joylink.rtss.services.script.IScriptService;
|
||||||
import club.joylink.rtss.services.script.IScriptSimulationService;
|
import club.joylink.rtss.services.script.IScriptSimulationService;
|
||||||
import club.joylink.rtss.services.simulation.ProjectSimulationService;
|
import club.joylink.rtss.services.simulation.ProjectSimulationService;
|
||||||
|
import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||||
|
import club.joylink.rtss.services.voice.baidu.ConnUtil;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
|
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
|
||||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
|
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
|
||||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||||
@ -37,10 +40,21 @@ import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
|||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.tomcat.jni.OS;
|
||||||
|
import org.apache.tomcat.util.http.fileupload.FileItem;
|
||||||
|
import org.apache.tomcat.util.http.fileupload.FileItemFactory;
|
||||||
|
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.*;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -95,6 +109,12 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMapService iMapService;
|
private IMapService iMapService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompetitionVoiceRecordDAO competitionVoiceRecordDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVoiceTrainingService iVoiceTrainingService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<CompetitionVO> pagedQueryCompetition(CompetitionPagedQueryVO queryVO) {
|
public PageVO<CompetitionVO> pagedQueryCompetition(CompetitionPagedQueryVO queryVO) {
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
@ -451,6 +471,73 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
|||||||
return iOrderService.pay(order.getId(), null, "调度大赛权限");
|
return iOrderService.pay(order.getId(), null, "调度大赛权限");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompetitionVoiceRecord voiceRecord(Long competitionId, String actionId, MultipartFile file, UserVO user) {
|
||||||
|
String filePath = IVoiceService.handleAndSaveFile(file);
|
||||||
|
CompetitionVoiceRecord voiceRecord = new CompetitionVoiceRecord();
|
||||||
|
voiceRecord.setUserId(user.getId());
|
||||||
|
voiceRecord.setCompetitionId(competitionId);
|
||||||
|
voiceRecord.setActionId(actionId);
|
||||||
|
voiceRecord.setFilepath(filePath);
|
||||||
|
competitionVoiceRecordDAO.insert(voiceRecord);
|
||||||
|
return voiceRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompetitionVoiceRecord updateVoiceRecord(Long recordId, MultipartFile file, UserVO user) {
|
||||||
|
CompetitionVoiceRecord record = getVoiceRecordEntity(recordId);
|
||||||
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(record.getUserId(), user.getId());
|
||||||
|
String filePath = IVoiceService.handleAndSaveFile(file);
|
||||||
|
record.setFilepath(filePath);
|
||||||
|
competitionVoiceRecordDAO.updateByPrimaryKey(record);
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoiceErrorSetVO voiceRecordCheck(Long recordId) {
|
||||||
|
return new VoiceErrorSetVO();
|
||||||
|
// CompetitionVoiceRecord record = getVoiceRecordEntity(recordId);
|
||||||
|
// String totalFilePath = "https://oss.joylink.club/oss/joylink" + record.getFilepath();
|
||||||
|
// File file = new File(totalFilePath);
|
||||||
|
//// FileInputStream fileInputStream = new FileInputStream(file);
|
||||||
|
// FileItemFactory factory = new DiskFileItemFactory(16, null);
|
||||||
|
// FileItem item = factory.createItem(file.getName(), "text/plain", true, file.getName());
|
||||||
|
//// MultipartFile multipartFile = new CommonsMultipartFile(item);
|
||||||
|
// MultipartFile multipartFile = null;
|
||||||
|
// return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) new URL("https://oss.joylink.club/oss/joylink/AUDIO/2021-04-30/2036-47816.wav").openConnection();
|
||||||
|
conn.setConnectTimeout(10000);
|
||||||
|
conn.setRequestMethod("GET");
|
||||||
|
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
conn.setDoInput(true);
|
||||||
|
OutputStream os = conn.getOutputStream();
|
||||||
|
File file = new File("C:\\Users\\wangxj\\Desktop\\voice.wav");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CompetitionVoiceRecord> queryVoiceRecords(Long userId, Long competitionId) {
|
||||||
|
CompetitionVoiceRecordExample example = new CompetitionVoiceRecordExample();
|
||||||
|
example.createCriteria().andUserIdEqualTo(userId).andCompetitionIdEqualTo(competitionId);
|
||||||
|
return competitionVoiceRecordDAO.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompetitionVoiceRecord getVoiceRecordEntity(Long id) {
|
||||||
|
CompetitionVoiceRecord record = competitionVoiceRecordDAO.selectByPrimaryKey(id);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(record, String.format("id为[%s]的记录不存在", id));
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存结果
|
* 保存结果
|
||||||
*/
|
*/
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package club.joylink.rtss.services.completition;
|
package club.joylink.rtss.services.completition;
|
||||||
|
|
||||||
|
import club.joylink.rtss.entity.CompetitionVoiceRecord;
|
||||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionPagedQueryVO;
|
import club.joylink.rtss.vo.client.competition.*;
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
|
||||||
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
|
||||||
import club.joylink.rtss.vo.client.pay.WxPayUnifiedOrderResultVO;
|
import club.joylink.rtss.vo.client.pay.WxPayUnifiedOrderResultVO;
|
||||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -123,4 +122,12 @@ public interface ICompetitionPracticalService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
WxPayUnifiedOrderResultVO purchasePermission(Long mapId, Integer amount, UserVO user);
|
WxPayUnifiedOrderResultVO purchasePermission(Long mapId, Integer amount, UserVO user);
|
||||||
|
|
||||||
|
CompetitionVoiceRecord voiceRecord(Long competitionId, String actionId, MultipartFile file, UserVO user);
|
||||||
|
|
||||||
|
CompetitionVoiceRecord updateVoiceRecord(Long recordId, MultipartFile file, UserVO user);
|
||||||
|
|
||||||
|
VoiceErrorSetVO voiceRecordCheck(Long recordId);
|
||||||
|
|
||||||
|
List<CompetitionVoiceRecord> queryVoiceRecords(Long userId, Long competitionId);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package club.joylink.rtss.services.voice;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
|
||||||
|
import club.joylink.rtss.vo.client.competition.VoiceErrorSetVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音训练
|
||||||
|
*/
|
||||||
|
public interface IVoiceTrainingService {
|
||||||
|
|
||||||
|
PageVO<VoiceErrorSetVO> pagedQueryErrorSet(PageQueryVO queryVO);
|
||||||
|
|
||||||
|
VoiceRecognitionResult voiceRecognition(MultipartFile file);
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package club.joylink.rtss.services.voice;
|
||||||
|
|
||||||
|
import club.joylink.rtss.dao.CompetitionErrorSetDAO;
|
||||||
|
import club.joylink.rtss.entity.CompetitionErrorSet;
|
||||||
|
import club.joylink.rtss.services.IVoiceService;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler;
|
||||||
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
|
||||||
|
import club.joylink.rtss.vo.client.competition.VoiceErrorSetVO;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class VoiceTrainingService implements IVoiceTrainingService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompetitionErrorSetDAO competitionErrorSetDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("HuaWeiVoiceService")
|
||||||
|
private IVoiceService iVoiceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SimulationVoiceHandler simulationVoiceHandler;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageVO<VoiceErrorSetVO> pagedQueryErrorSet(PageQueryVO queryVO) {
|
||||||
|
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
|
List<CompetitionErrorSet> sets = competitionErrorSetDAO.selectByExample(null);
|
||||||
|
List<VoiceErrorSetVO> list = sets.stream().map(VoiceErrorSetVO::new).collect(Collectors.toList());
|
||||||
|
return PageVO.convert(page, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||||
|
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, "");
|
||||||
|
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -36,12 +36,7 @@ public class HuaweiVoiceServiceImpl implements IVoiceService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
|
public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
|
||||||
String filePath;
|
String filePath = IVoiceService.handleAndSaveFile(file);
|
||||||
try {
|
|
||||||
filePath = IVoiceService.handleAndSaveFile(file);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e);
|
|
||||||
}
|
|
||||||
AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
|
AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
|
||||||
SisConfig sisConfig = new SisConfig();
|
SisConfig sisConfig = new SisConfig();
|
||||||
AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
|
AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package club.joylink.rtss.vo.client.competition;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class CompetitionVoiceRecordCheckVO {
|
||||||
|
private Long competitionId;
|
||||||
|
|
||||||
|
private Long actionId;
|
||||||
|
|
||||||
|
|
||||||
|
private List<String> keyWords;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package club.joylink.rtss.vo.client.competition;
|
||||||
|
|
||||||
|
import club.joylink.rtss.entity.CompetitionErrorSet;
|
||||||
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VoiceErrorSetVO {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long competitionId;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private String actionId;
|
||||||
|
|
||||||
|
private String right = "道岔试验";
|
||||||
|
|
||||||
|
private String wrong = "刀叉试验";
|
||||||
|
|
||||||
|
private List<String> keyWords = List.of("道岔");
|
||||||
|
|
||||||
|
private List<String> tripNumbers = List.of("2027");
|
||||||
|
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
public VoiceErrorSetVO(CompetitionErrorSet set) {
|
||||||
|
this.id = set.getId();
|
||||||
|
this.competitionId = set.getId();
|
||||||
|
this.userId = set.getUserId();
|
||||||
|
this.actionId = set.getActionId();
|
||||||
|
this.right = set.getRight();
|
||||||
|
this.wrong = set.getWrong();
|
||||||
|
if (StringUtils.hasText(set.getKeyWords()))
|
||||||
|
this.keyWords = JsonUtils.readCollection(set.getKeyWords(), ArrayList.class, String.class);
|
||||||
|
if (StringUtils.hasText(set.getTripNumber()))
|
||||||
|
this.tripNumbers = JsonUtils.readCollection(set.getTripNumber(), ArrayList.class, String.class);
|
||||||
|
this.filePath = set.getFilePath();
|
||||||
|
}
|
||||||
|
}
|
213
src/main/resources/mybatis/mapper/CompetitionVoiceRecordDAO.xml
Normal file
213
src/main/resources/mybatis/mapper/CompetitionVoiceRecordDAO.xml
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
<?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.CompetitionVoiceRecordDAO">
|
||||||
|
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompetitionVoiceRecord">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
|
<result column="user_id" jdbcType="BIGINT" property="userId" />
|
||||||
|
<result column="competition_id" jdbcType="BIGINT" property="competitionId" />
|
||||||
|
<result column="action_id" jdbcType="VARCHAR" property="actionId" />
|
||||||
|
<result column="filePath" jdbcType="VARCHAR" property="filepath" />
|
||||||
|
</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, user_id, competition_id, action_id, filePath
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecordExample" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
|
</if>
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from competition_voice_record
|
||||||
|
<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="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from competition_voice_record
|
||||||
|
where id = #{id,jdbcType=BIGINT}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
|
delete from competition_voice_record
|
||||||
|
where id = #{id,jdbcType=BIGINT}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecordExample">
|
||||||
|
delete from competition_voice_record
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecord" useGeneratedKeys="true">
|
||||||
|
insert into competition_voice_record (user_id, competition_id, action_id,
|
||||||
|
filePath)
|
||||||
|
values (#{userId,jdbcType=BIGINT}, #{competitionId,jdbcType=BIGINT}, #{actionId,jdbcType=VARCHAR},
|
||||||
|
#{filepath,jdbcType=VARCHAR})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecord" useGeneratedKeys="true">
|
||||||
|
insert into competition_voice_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="competitionId != null">
|
||||||
|
competition_id,
|
||||||
|
</if>
|
||||||
|
<if test="actionId != null">
|
||||||
|
action_id,
|
||||||
|
</if>
|
||||||
|
<if test="filepath != null">
|
||||||
|
filePath,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">
|
||||||
|
#{userId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="competitionId != null">
|
||||||
|
#{competitionId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="actionId != null">
|
||||||
|
#{actionId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="filepath != null">
|
||||||
|
#{filepath,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecordExample" resultType="java.lang.Long">
|
||||||
|
select count(*) from competition_voice_record
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update competition_voice_record
|
||||||
|
<set>
|
||||||
|
<if test="record.id != null">
|
||||||
|
id = #{record.id,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.userId != null">
|
||||||
|
user_id = #{record.userId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.competitionId != null">
|
||||||
|
competition_id = #{record.competitionId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.actionId != null">
|
||||||
|
action_id = #{record.actionId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.filepath != null">
|
||||||
|
filePath = #{record.filepath,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExample" parameterType="map">
|
||||||
|
update competition_voice_record
|
||||||
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
|
user_id = #{record.userId,jdbcType=BIGINT},
|
||||||
|
competition_id = #{record.competitionId,jdbcType=BIGINT},
|
||||||
|
action_id = #{record.actionId,jdbcType=VARCHAR},
|
||||||
|
filePath = #{record.filepath,jdbcType=VARCHAR}
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecord">
|
||||||
|
update competition_voice_record
|
||||||
|
<set>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id = #{userId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="competitionId != null">
|
||||||
|
competition_id = #{competitionId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="actionId != null">
|
||||||
|
action_id = #{actionId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="filepath != null">
|
||||||
|
filePath = #{filepath,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=BIGINT}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CompetitionVoiceRecord">
|
||||||
|
update competition_voice_record
|
||||||
|
set user_id = #{userId,jdbcType=BIGINT},
|
||||||
|
competition_id = #{competitionId,jdbcType=BIGINT},
|
||||||
|
action_id = #{actionId,jdbcType=VARCHAR},
|
||||||
|
filePath = #{filepath,jdbcType=VARCHAR}
|
||||||
|
where id = #{id,jdbcType=BIGINT}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user