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

This commit is contained in:
joylink_zhangsai 2021-04-12 18:49:42 +08:00
commit 87aab8ab15
16 changed files with 1208 additions and 90 deletions

36
pom.xml
View File

@ -108,27 +108,27 @@
<version>0.2.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.huawei.sis</groupId>-->
<!-- <artifactId>huaweicloud-java-sdk-sis</artifactId>-->
<!-- <version>1.3.2</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.huawei.sis</groupId>
<artifactId>huaweicloud-java-sdk-sis</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>sis-repo</id>-->
<!-- <name>Sis Release Repository</name>-->
<!-- <url>https://mirrors.huaweicloud.com/repository/maven/huaweicloudsdk</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>false</enabled>-->
<!-- </snapshots>-->
<!-- </repository>-->
<!-- </repositories>-->
<repositories>
<repository>
<id>sis-repo</id>
<name>Sis Release Repository</name>
<url>https://mirrors.huaweicloud.com/repository/maven/huaweicloudsdk</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>

View File

@ -796,4 +796,8 @@ public interface BusinessConsts {
String VALID = "1";
}
}
enum MapGroupType{
DATA,RUNPLAN;
}
}

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.controller.publish;
import club.joylink.rtss.services.IMapGroupService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.ReleaseVO;
import club.joylink.rtss.vo.client.map.MapGroupQueryVO;
import club.joylink.rtss.vo.client.map.MapGroupVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = {"地图数据组管理"})
@RestController
@RequestMapping("/api/mapGroup")
public class MapGroupController {
@Autowired
private IMapGroupService iMapGroupService;
@ApiOperation(value = "添加地图数据组")
@PostMapping(path = "")
public void createMapGroup(@RequestBody @Validated MapGroupVO mapGroupVO) {
this.iMapGroupService.create(mapGroupVO);
}
@ApiOperation(value = "修改地图数据组")
@PutMapping(path = "{groupId}")
public void updateMapGroup(@PathVariable Long groupId, @RequestBody @Validated MapGroupVO mapGroupVO) {
this.iMapGroupService.update(groupId, mapGroupVO);
}
@ApiOperation(value = "地图数据组关联地图")
@PutMapping(path = "{groupId}/ref/map/{mapId}")
public void refMap2Group(@PathVariable Long groupId, @PathVariable Long mapId) {
this.iMapGroupService.relMap2Group(groupId, mapId);
}
@ApiOperation(value = "删除地图数据组")
@DeleteMapping(path = "{groupId}")
public void deleteMapGroup(@PathVariable Long groupId) {
this.iMapGroupService.delete(groupId);
}
@ApiOperation(value = "分页获取所有地图数据组")
@GetMapping(path = "page")
public PageVO<MapGroupVO> getPageMapGroups(MapGroupQueryVO queryVO) {
return this.iMapGroupService.getPage(queryVO);
}
@ApiOperation("同步导入地图相关数据")
@PutMapping("/syc/import")
public void importFromJson(@RequestBody ReleaseVO json, @RequestAttribute UserVO user) {
iMapGroupService.syncImportMapData(json, user);
}
}

View File

@ -0,0 +1,30 @@
package club.joylink.rtss.controller.voice;
import club.joylink.rtss.services.IVoiceService;
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@Api("语音AI接口")
@RestController
@RequestMapping("/api/voice")
public class VoiceController {
@Autowired
@Qualifier("HuaWeiVoiceService")
private IVoiceService iVoiceService;
@ApiOperation("语音识别")
@PostMapping("recognition")
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
return this.iVoiceService.voiceRecognition(file, "");
}
}

View File

@ -0,0 +1,27 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.MapGroup;
import club.joylink.rtss.entity.MapGroupExample;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
* MapGroupDAO继承基类
*/
@Repository
public interface MapGroupDAO extends MyBatisBaseDao<MapGroup, Long, MapGroupExample> {
@Select("SELECT\n" + "*\n" + "FROM\n" +
"map_group\n" +
"WHERE\n" +
"group_type = #{type}\n" +
"AND\n" +
"(map_ids LIKE CONCAT('[',#{mapId},',%')\n" +
"OR\n" +
"map_ids LIKE CONCAT('%,',#{mapId},']')\n" +
"OR\n" +
"map_ids LIKE CONCAT('%,',#{mapId},',%'))\n" +
"LIMIT 1")
MapGroup findEntityByMapId(String type,Long mapId);
}

View File

@ -0,0 +1,95 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* map_group
* @author
*/
public class MapGroup implements Serializable {
private Long id;
private String groupName;
private String groupType;
private String mapIds;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getGroupType() {
return groupType;
}
public void setGroupType(String groupType) {
this.groupType = groupType;
}
public String getMapIds() {
return mapIds;
}
public void setMapIds(String mapIds) {
this.mapIds = mapIds;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
MapGroup other = (MapGroup) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getGroupName() == null ? other.getGroupName() == null : this.getGroupName().equals(other.getGroupName()))
&& (this.getGroupType() == null ? other.getGroupType() == null : this.getGroupType().equals(other.getGroupType()))
&& (this.getMapIds() == null ? other.getMapIds() == null : this.getMapIds().equals(other.getMapIds()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
result = prime * result + ((getGroupType() == null) ? 0 : getGroupType().hashCode());
result = prime * result + ((getMapIds() == null) ? 0 : getMapIds().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(", groupName=").append(groupName);
sb.append(", groupType=").append(groupType);
sb.append(", mapIds=").append(mapIds);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,492 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class MapGroupExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public MapGroupExample() {
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 andGroupNameIsNull() {
addCriterion("group_name is null");
return (Criteria) this;
}
public Criteria andGroupNameIsNotNull() {
addCriterion("group_name is not null");
return (Criteria) this;
}
public Criteria andGroupNameEqualTo(String value) {
addCriterion("group_name =", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameNotEqualTo(String value) {
addCriterion("group_name <>", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameGreaterThan(String value) {
addCriterion("group_name >", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameGreaterThanOrEqualTo(String value) {
addCriterion("group_name >=", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameLessThan(String value) {
addCriterion("group_name <", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameLessThanOrEqualTo(String value) {
addCriterion("group_name <=", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameLike(String value) {
addCriterion("group_name like", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameNotLike(String value) {
addCriterion("group_name not like", value, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameIn(List<String> values) {
addCriterion("group_name in", values, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameNotIn(List<String> values) {
addCriterion("group_name not in", values, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameBetween(String value1, String value2) {
addCriterion("group_name between", value1, value2, "groupName");
return (Criteria) this;
}
public Criteria andGroupNameNotBetween(String value1, String value2) {
addCriterion("group_name not between", value1, value2, "groupName");
return (Criteria) this;
}
public Criteria andGroupTypeIsNull() {
addCriterion("group_type is null");
return (Criteria) this;
}
public Criteria andGroupTypeIsNotNull() {
addCriterion("group_type is not null");
return (Criteria) this;
}
public Criteria andGroupTypeEqualTo(String value) {
addCriterion("group_type =", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeNotEqualTo(String value) {
addCriterion("group_type <>", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeGreaterThan(String value) {
addCriterion("group_type >", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeGreaterThanOrEqualTo(String value) {
addCriterion("group_type >=", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeLessThan(String value) {
addCriterion("group_type <", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeLessThanOrEqualTo(String value) {
addCriterion("group_type <=", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeLike(String value) {
addCriterion("group_type like", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeNotLike(String value) {
addCriterion("group_type not like", value, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeIn(List<String> values) {
addCriterion("group_type in", values, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeNotIn(List<String> values) {
addCriterion("group_type not in", values, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeBetween(String value1, String value2) {
addCriterion("group_type between", value1, value2, "groupType");
return (Criteria) this;
}
public Criteria andGroupTypeNotBetween(String value1, String value2) {
addCriterion("group_type not between", value1, value2, "groupType");
return (Criteria) this;
}
public Criteria andMapIdsIsNull() {
addCriterion("map_ids is null");
return (Criteria) this;
}
public Criteria andMapIdsIsNotNull() {
addCriterion("map_ids is not null");
return (Criteria) this;
}
public Criteria andMapIdsEqualTo(String value) {
addCriterion("map_ids =", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsNotEqualTo(String value) {
addCriterion("map_ids <>", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsGreaterThan(String value) {
addCriterion("map_ids >", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsGreaterThanOrEqualTo(String value) {
addCriterion("map_ids >=", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsLessThan(String value) {
addCriterion("map_ids <", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsLessThanOrEqualTo(String value) {
addCriterion("map_ids <=", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsLike(String value) {
addCriterion("map_ids like", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsNotLike(String value) {
addCriterion("map_ids not like", value, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsIn(List<String> values) {
addCriterion("map_ids in", values, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsNotIn(List<String> values) {
addCriterion("map_ids not in", values, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsBetween(String value1, String value2) {
addCriterion("map_ids between", value1, value2, "mapIds");
return (Criteria) this;
}
public Criteria andMapIdsNotBetween(String value1, String value2) {
addCriterion("map_ids not between", value1, value2, "mapIds");
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.services;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.ReleaseVO;
import club.joylink.rtss.vo.client.map.MapGroupQueryVO;
import club.joylink.rtss.vo.client.map.MapGroupVO;
import java.util.List;
public interface IMapGroupService {
void create(MapGroupVO mapGroupVO);
void update(Long id, MapGroupVO mapGroupVO);
void relMap2Group(Long id, Long mapId);
MapGroupVO getMapGroupByMapId(Long mapId, BusinessConsts.MapGroupType type);
void delete(Long id);
List<MapGroupVO> getAll();
PageVO<MapGroupVO> getPage(MapGroupQueryVO queryVO);
void syncImportMapData(ReleaseVO releaseVO, UserVO user);
}

View File

@ -0,0 +1,104 @@
package club.joylink.rtss.services;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.MapGroupDAO;
import club.joylink.rtss.entity.MapGroup;
import club.joylink.rtss.entity.MapGroupExample;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.ReleaseVO;
import club.joylink.rtss.vo.client.map.MapGroupQueryVO;
import club.joylink.rtss.vo.client.map.MapGroupVO;
import club.joylink.rtss.vo.client.map.RealLineListVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Objects;
@Service
public class MapGroupService implements IMapGroupService {
@Autowired
private MapGroupDAO mapGroupDAO;
@Autowired
private IReleaseService iReleaseService;
@Override
public void create(MapGroupVO mapGroupVO) {
MapGroup mapGroup = mapGroupVO.convert2DB();
this.mapGroupDAO.insert(mapGroup);
}
@Override
public void update(Long id, MapGroupVO mapGroupVO) {
MapGroup mapGroup = mapGroupVO.convert2DB();
mapGroup.setId(id);
this.mapGroupDAO.updateByPrimaryKey(mapGroup);
}
@Override
public void relMap2Group(Long id, Long mapId) {
MapGroup mapGroup = mapGroupDAO.selectByPrimaryKey(id);
List<Long> o = JsonUtils.readCollection(mapGroup.getMapIds(), List.class, Long.class);
mapGroup.setMapIds(JsonUtils.writeValueAsString(o.add(mapId)));
this.mapGroupDAO.updateByPrimaryKey(mapGroup);
}
@Override
public MapGroupVO getMapGroupByMapId(Long mapId, BusinessConsts.MapGroupType type) {
MapGroup mapGroup = mapGroupDAO.findEntityByMapId(type.name(), mapId);
if (Objects.isNull(mapGroup)) return null;
return new MapGroupVO(mapGroup);
}
@Override
public void delete(Long id) {
this.mapGroupDAO.deleteByPrimaryKey(id);
}
@Override
public List<MapGroupVO> getAll() {
MapGroupExample e = new MapGroupExample();
List<MapGroup> mapGroups = this.mapGroupDAO.selectByExample(e);
return MapGroupVO.convert2VOList(mapGroups);
}
@Override
public PageVO<MapGroupVO> getPage(MapGroupQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
MapGroupExample e = new MapGroupExample();
MapGroupExample.Criteria criteria = e.createCriteria();
if (StringUtils.hasText(queryVO.getName())) {
criteria.andGroupNameLike(String.format("%%%s%%", queryVO.getName()));
}
if (Objects.nonNull(queryVO.getType())) {
criteria.andGroupTypeEqualTo(queryVO.getType().name());
}
Page<MapGroup> page = (Page<MapGroup>) this.mapGroupDAO.selectByExample(e);
return PageVO.convert(page, MapGroupVO.convert2VOList(page.getResult()));
}
@Override
public void syncImportMapData(ReleaseVO releaseVO, UserVO user) {
MapGroupVO mapGroup = getMapGroupByMapId(releaseVO.getMapId(), BusinessConsts.MapGroupType.DATA);
if (Objects.isNull(mapGroup) || CollectionUtils.isEmpty(mapGroup.getMapIds())) {
return;
}
mapGroup.getMapIds().forEach(mapId -> {
if (Objects.equals(mapId, releaseVO.getMapId())) return;
iReleaseService.importFromJson(releaseVO.getMapId(), releaseVO, user);
});
}
}

View File

@ -160,6 +160,7 @@ public class MapService implements IMapService {
return MapVO.convert2VOList(list);
}
@Override
public List<MapVO> listOnline() {
MapInfoExample example = new MapInfoExample();
MapInfoExample.Criteria criteria = example.createCriteria();

View File

@ -69,7 +69,8 @@ public class ReleaseService implements IReleaseService {
@Override
public ReleaseVO exportAsJson(Long mapId, ReleaseConfigVO config) {
ReleaseVO releaseVO = new ReleaseVO();
ReleaseVO releaseVO = new ReleaseVO(mapId);
MapVO mapInfo = iMapService.getMapInfoById(mapId);
//地图数据强制选择
releaseVO.setMapData(getMapDataWithBLOBs(mapId, mapInfo.getVersion()));
@ -163,12 +164,14 @@ public class ReleaseService implements IReleaseService {
return releaseVO;
}
@Transactional
@Override
public void importFromJson(Long mapId, ReleaseVO releaseVO, UserVO user) {
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(releaseVO.getMapData());
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(releaseVO.getRealLineConfig());
MapVO selectedMapInfo = iMapService.getMapInfoById(mapId);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(Objects.equals(selectedMapInfo.getLineCode(), releaseVO.getRealLineConfig().getCode()));

View File

@ -1,71 +1,63 @@
//package club.joylink.rtss.services.voice.huawei;
//
//import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
//import club.joylink.rtss.services.IVoiceService;
//import club.joylink.rtss.services.voice.baidu.AsrService;
//import club.joylink.rtss.services.voice.baidu.TokenHolder;
//import club.joylink.rtss.services.voice.baidu.TtsService;
//import club.joylink.rtss.services.voice.baidu.VoiceAsrResult;
//import club.joylink.rtss.vo.client.VoiceRecognitionResult;
//import com.huawei.sis.bean.AuthInfo;
//import com.huawei.sis.bean.SisConfig;
//import com.huawei.sis.bean.request.AsrCustomShortRequest;
//import com.huawei.sis.bean.response.AsrCustomShortResponse;
//import com.huawei.sis.client.AsrCustomizationClient;
//import com.huawei.sis.exception.SisException;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.web.client.RestTemplate;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.ByteArrayInputStream;
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.Base64;
//
//@Slf4j
//@Service("HuaweiVoiceService")
//public class HuaweiVoiceServiceImpl implements IVoiceService {
//
// /**
// * 华为语音识别配置
// */
// private final String ak = "YDUXTXRYGAHGPHAIXZCU";
// private final String sk = "Kcbm3sTDCYEou8kGeAhKxfBkgWybIn6IjJyGBX3p";
// private final String region = "cn-north-4";
// private final String projectId = "0aada8176180f28c2f34c0196f5394e8";
//
//
// @Override
// public String synthesis(String message, String per) {
// throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现");
// }
//
// @Override
// public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
// String filePath;
// try {
// filePath = IVoiceService.handleAndSaveFile(file);
// } catch (IOException e) {
// throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e);
// }
// AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
// SisConfig sisConfig = new SisConfig();
// AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
// String data;
// try {
// data = Base64.getEncoder().encodeToString(file.getBytes());
// } catch (IOException e) {
// throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件编码失败", e);
// }
// try {
// AsrCustomShortRequest request = new AsrCustomShortRequest(data, "pcm16k16bit", "chinese_16k_common");
// AsrCustomShortResponse response = client.getAsrShortResponse(request);
// return new VoiceRecognitionResult(filePath, response.getResult().getText());
// } catch (SisException e) {
// throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音识别失败", e);
// }
// }
//
//}
package club.joylink.rtss.services.voice.huawei;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IVoiceService;
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
import com.huawei.sis.bean.AuthInfo;
import com.huawei.sis.bean.SisConfig;
import com.huawei.sis.bean.request.AsrCustomShortRequest;
import com.huawei.sis.bean.response.AsrCustomShortResponse;
import com.huawei.sis.client.AsrCustomizationClient;
import com.huawei.sis.exception.SisException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Base64;
@Slf4j
@Service("HuaWeiVoiceService")
public class HuaweiVoiceServiceImpl implements IVoiceService {
/**
* 华为语音识别配置
*/
private final String ak = "YDUXTXRYGAHGPHAIXZCU";
private final String sk = "Kcbm3sTDCYEou8kGeAhKxfBkgWybIn6IjJyGBX3p";
private final String region = "cn-north-4";
private final String projectId = "0aada8176180f28c2f34c0196f5394e8";
@Override
public String synthesis(String message, String per) {
throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现");
}
@Override
public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
String filePath;
try {
filePath = IVoiceService.handleAndSaveFile(file);
} catch (IOException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件上传失败", e);
}
AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
SisConfig sisConfig = new SisConfig();
AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
String data;
try {
data = Base64.getEncoder().encodeToString(file.getBytes());
} catch (IOException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音文件编码失败", e);
}
try {
AsrCustomShortRequest request = new AsrCustomShortRequest(data, "pcm16k16bit", "chinese_16k_common");
AsrCustomShortResponse response = client.getAsrShortResponse(request);
return new VoiceRecognitionResult(filePath, response.getResult().getText());
} catch (SisException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音识别失败", e);
}
}
}

View File

@ -11,6 +11,8 @@ import java.util.List;
@Setter
@NoArgsConstructor
public class ReleaseVO {
private Long mapId;
/**
* 地图数据
*/
@ -60,4 +62,7 @@ public class ReleaseVO {
private List<CompetitionWithBLOBs> competitions;
public ReleaseVO(Long mapId) {
this.mapId = mapId;
}
}

View File

@ -0,0 +1,18 @@
package club.joylink.rtss.vo.client.map;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class MapGroupQueryVO extends PageQueryVO {
private String name;
private BusinessConsts.MapGroupType type;
}

View File

@ -0,0 +1,59 @@
package club.joylink.rtss.vo.client.map;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.entity.MapGroup;
import club.joylink.rtss.util.JsonUtils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@ApiModel(value = "地图数据组VO")
@Getter
@Setter
@NoArgsConstructor
public class MapGroupVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@NotBlank(message = "组名不能为空")
private String name;
@NotNull(message = "分组类型不能为空")
private BusinessConsts.MapGroupType type;
private List<Long> mapIds;
public MapGroupVO(MapGroup mapGroup) {
id = mapGroup.getId();
name = mapGroup.getGroupName();
type = BusinessConsts.MapGroupType.valueOf(mapGroup.getGroupType());
mapIds = JsonUtils.readCollection(mapGroup.getMapIds(),List.class,Long.class);
}
public MapGroup convert2DB() {
MapGroup mapGroup = new MapGroup();
mapGroup.setId(id);
mapGroup.setGroupName(name);
mapGroup.setGroupType(type.name());
mapGroup.setMapIds(JsonUtils.writeValueAsString(mapIds));
return mapGroup;
}
public static List<MapGroupVO> convert2VOList(List<MapGroup> list) {
List<MapGroupVO> voList = new ArrayList<>();
if(!CollectionUtils.isEmpty(list)) {
list.forEach(mapGroup -> voList.add(new MapGroupVO(mapGroup)));
}
return voList;
}
}

View File

@ -0,0 +1,198 @@
<?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.MapGroupDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.MapGroup">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="group_name" jdbcType="VARCHAR" property="groupName" />
<result column="group_type" jdbcType="VARCHAR" property="groupType" />
<result column="map_ids" jdbcType="VARCHAR" property="mapIds" />
</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, group_name, group_type, map_ids
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.MapGroupExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from map_group
<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 map_group
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from map_group
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.MapGroupExample">
delete from map_group
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapGroup" useGeneratedKeys="true">
insert into map_group (group_name, group_type, map_ids
)
values (#{groupName,jdbcType=VARCHAR}, #{groupType,jdbcType=VARCHAR}, #{mapIds,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapGroup" useGeneratedKeys="true">
insert into map_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupName != null">
group_name,
</if>
<if test="groupType != null">
group_type,
</if>
<if test="mapIds != null">
map_ids,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupName != null">
#{groupName,jdbcType=VARCHAR},
</if>
<if test="groupType != null">
#{groupType,jdbcType=VARCHAR},
</if>
<if test="mapIds != null">
#{mapIds,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.MapGroupExample" resultType="java.lang.Long">
select count(*) from map_group
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update map_group
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.groupName != null">
group_name = #{record.groupName,jdbcType=VARCHAR},
</if>
<if test="record.groupType != null">
group_type = #{record.groupType,jdbcType=VARCHAR},
</if>
<if test="record.mapIds != null">
map_ids = #{record.mapIds,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update map_group
set id = #{record.id,jdbcType=BIGINT},
group_name = #{record.groupName,jdbcType=VARCHAR},
group_type = #{record.groupType,jdbcType=VARCHAR},
map_ids = #{record.mapIds,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.MapGroup">
update map_group
<set>
<if test="groupName != null">
group_name = #{groupName,jdbcType=VARCHAR},
</if>
<if test="groupType != null">
group_type = #{groupType,jdbcType=VARCHAR},
</if>
<if test="mapIds != null">
map_ids = #{mapIds,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.MapGroup">
update map_group
set group_name = #{groupName,jdbcType=VARCHAR},
group_type = #{groupType,jdbcType=VARCHAR},
map_ids = #{mapIds,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>