Merge branch 'master' into test

This commit is contained in:
joylink_zhangsai 2020-11-24 14:33:43 +08:00
commit 3b7dcaeada
22 changed files with 631 additions and 813 deletions

17
sql/20201123.sql Normal file
View File

@ -0,0 +1,17 @@
alter table map_data
add version varchar(8) default 0.1 not null comment '版本号';
drop table map_version;
alter table map_data
add time timestamp default now() not null comment '发布时间';
alter table map_data
add user_id bigint null comment '发布者的id';
alter table map_info
add version varchar(8) default 0.1 not null comment '该地图正在使用的地图数据的版本';

View File

@ -1,13 +1,15 @@
package club.joylink.rtss.controller.user;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.IUserUsageStatsService;
import club.joylink.rtss.services.user.IUserSimulationStatService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.UsageTotalStatsVO;
import club.joylink.rtss.vo.client.UserRankStatsVO;
import club.joylink.rtss.vo.client.*;
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 springfox.documentation.annotations.ApiIgnore;
@ -95,4 +97,35 @@ public class UserUsageStatsController {
public List<UsageTotalStatsVO> totalSimulationDuration(boolean filter) {
return iUserUsageStatsService.totalDuration(filter);
}
@ApiOperation("分页查询用户仿真数据")
@GetMapping("/simulation")
public PageVO<UserSimulationStatsListVO> queryPagedStats(UserSimulationStatsQueryVO queryVO) {
return iUserSimulationStatService.queryPagedStats(queryVO);
}
@Role(value = {RoleEnum.SuperAdmin, RoleEnum.Admin})
@ApiOperation(value = "添加用户仿真数据")
@PostMapping(path = "/simulation")
public void addUserSimulationStats(@RequestBody @Validated UserSimulationStatsVO statsVO,
@ApiIgnore @RequestAttribute UserVO user) {
iUserSimulationStatService.addUserSimulationStats(statsVO, user);
}
@Role(value = {RoleEnum.SuperAdmin, RoleEnum.Admin})
@ApiOperation(value = "更新用户仿真数据")
@PutMapping(path = "/{statsId}")
public void updateUserSimulationStats(@PathVariable Long statsId,
@RequestBody UserSimulationStatsVO statsVO,
@ApiIgnore @RequestAttribute UserVO user) {
iUserSimulationStatService.updateUserSimulationStats(statsId, statsVO, user);
}
@Role(value = {RoleEnum.SuperAdmin, RoleEnum.Admin})
@ApiOperation(value = "删除用户仿真数据")
@DeleteMapping(path = "/{statsId}")
public void deleteUserSimulationStats(@PathVariable Long statsId, @ApiIgnore @RequestAttribute UserVO user) {
iUserSimulationStatService.deleteUserSimulationStats(statsId, user);
}
}

View File

@ -5,12 +5,13 @@ import club.joylink.rtss.entity.MapDataExample;
import club.joylink.rtss.entity.MapDataWithBLOBs;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MapDataDAO extends MyBatisBaseDao<MapData, Long, MapDataExample> {
public interface MapDataDAO {
long countByExample(MapDataExample example);
int deleteByExample(MapDataExample example);
@ -40,12 +41,24 @@ public interface MapDataDAO extends MyBatisBaseDao<MapData, Long, MapDataExample
int updateByPrimaryKey(MapData record);
@Insert(value = "<script>" +
"insert into map_data (id, map_id, graph_data, logic_data) " +
"insert into map_data (id, map_id, graph_data, logic_data, version, time, user_id) " +
" values " +
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
" (#{entity.id,jdbcType=BIGINT}, #{entity.mapId,jdbcType=BIGINT}," +
" #{entity.graphData,jdbcType=LONGVARCHAR}, #{entity.logicData,jdbcType=LONGVARCHAR})"+
" #{entity.graphData,jdbcType=LONGVARCHAR}, #{entity.logicData,jdbcType=LONGVARCHAR}," +
" #{entity.version, jdbcType=VARCHAR}, #{entity.time, jdbcType=TIMESTAMP}, #{entity.userId, jdbcType=BIGINT})"+
" </foreach>" +
"</script>")
int batchInsertWithId(@Param("list") List<MapDataWithBLOBs> mapDataList);
@Select("SELECT\n" +
"\tmap_data.version\n" +
"FROM\n" +
"\tmap_data\n" +
"WHERE\n" +
"\tmap_data.map_id = #{mapId}\n" +
"ORDER BY\n" +
"\tmap_data.time DESC\n" +
"LIMIT 1")
String findVersion(Long mapId);
}

View File

@ -26,4 +26,4 @@ public interface MapInfoDAO extends MyBatisBaseDao<MapInfo, Long, MapInfoExample
" </foreach>" +
"</script>")
int batchInsertWithId(@Param("list") List<MapInfo> mapInfoList);
}
}

View File

@ -1,26 +0,0 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.MapVersion;
import club.joylink.rtss.entity.MapVersionExample;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* MapVersionDAO继承基类
*/
@Repository
public interface MapVersionDAO extends MyBatisBaseDao<MapVersion, Long, MapVersionExample> {
@Insert(value = "<script>" +
"insert into map_version (id, version, update_time, author_id, map_id) " +
" values " +
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
" (#{entity.id,jdbcType=BIGINT}, #{entity.version,jdbcType=VARCHAR}, #{entity.updateTime,jdbcType=TIMESTAMP}," +
" #{entity.authorId,jdbcType=BIGINT}, #{entity.mapId,jdbcType=BIGINT})"+
" </foreach>" +
"</script>")
int batchInsertWithId(@Param("list") List<MapVersion> mapVersionList);
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* map_data
@ -14,6 +15,21 @@ public class MapData implements Serializable {
*/
private Long mapId;
/**
* 版本号
*/
private String version;
/**
* 发布时间
*/
private LocalDateTime time;
/**
* 发布者的id
*/
private Long userId;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -32,6 +48,30 @@ public class MapData implements Serializable {
this.mapId = mapId;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public LocalDateTime getTime() {
return time;
}
public void setTime(LocalDateTime time) {
this.time = time;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
@ -45,7 +85,10 @@ public class MapData implements Serializable {
}
MapData other = (MapData) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()));
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()))
&& (this.getTime() == null ? other.getTime() == null : this.getTime().equals(other.getTime()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()));
}
@Override
@ -54,6 +97,9 @@ public class MapData implements Serializable {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
result = prime * result + ((getTime() == null) ? 0 : getTime().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
return result;
}
@ -65,6 +111,9 @@ public class MapData implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", mapId=").append(mapId);
sb.append(", version=").append(version);
sb.append(", time=").append(time);
sb.append(", userId=").append(userId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -243,6 +244,196 @@ public class MapDataExample {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andVersionIsNull() {
addCriterion("version is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(String value) {
addCriterion("version =", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(String value) {
addCriterion("version <>", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThan(String value) {
addCriterion("version >", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(String value) {
addCriterion("version >=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThan(String value) {
addCriterion("version <", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(String value) {
addCriterion("version <=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLike(String value) {
addCriterion("version like", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotLike(String value) {
addCriterion("version not like", value, "version");
return (Criteria) this;
}
public Criteria andVersionIn(List<String> values) {
addCriterion("version in", values, "version");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<String> values) {
addCriterion("version not in", values, "version");
return (Criteria) this;
}
public Criteria andVersionBetween(String value1, String value2) {
addCriterion("version between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andVersionNotBetween(String value1, String value2) {
addCriterion("version not between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andTimeIsNull() {
addCriterion("`time` is null");
return (Criteria) this;
}
public Criteria andTimeIsNotNull() {
addCriterion("`time` is not null");
return (Criteria) this;
}
public Criteria andTimeEqualTo(LocalDateTime value) {
addCriterion("`time` =", value, "time");
return (Criteria) this;
}
public Criteria andTimeNotEqualTo(LocalDateTime value) {
addCriterion("`time` <>", value, "time");
return (Criteria) this;
}
public Criteria andTimeGreaterThan(LocalDateTime value) {
addCriterion("`time` >", value, "time");
return (Criteria) this;
}
public Criteria andTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("`time` >=", value, "time");
return (Criteria) this;
}
public Criteria andTimeLessThan(LocalDateTime value) {
addCriterion("`time` <", value, "time");
return (Criteria) this;
}
public Criteria andTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("`time` <=", value, "time");
return (Criteria) this;
}
public Criteria andTimeIn(List<LocalDateTime> values) {
addCriterion("`time` in", values, "time");
return (Criteria) this;
}
public Criteria andTimeNotIn(List<LocalDateTime> values) {
addCriterion("`time` not in", values, "time");
return (Criteria) this;
}
public Criteria andTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("`time` between", value1, value2, "time");
return (Criteria) this;
}
public Criteria andTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("`time` not between", value1, value2, "time");
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;
}
}
/**

View File

@ -49,6 +49,9 @@ public class MapDataWithBLOBs extends MapData implements Serializable {
MapDataWithBLOBs other = (MapDataWithBLOBs) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()))
&& (this.getTime() == null ? other.getTime() == null : this.getTime().equals(other.getTime()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getGraphData() == null ? other.getGraphData() == null : this.getGraphData().equals(other.getGraphData()))
&& (this.getLogicData() == null ? other.getLogicData() == null : this.getLogicData().equals(other.getLogicData()));
}
@ -59,6 +62,9 @@ public class MapDataWithBLOBs extends MapData implements Serializable {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
result = prime * result + ((getTime() == null) ? 0 : getTime().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getGraphData() == null) ? 0 : getGraphData().hashCode());
result = prime * result + ((getLogicData() == null) ? 0 : getLogicData().hashCode());
return result;

View File

@ -49,6 +49,11 @@ public class MapInfo implements Serializable {
*/
private Integer orderNumber;
/**
* 该地图正在使用的地图数据的版本
*/
private String version;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -123,6 +128,14 @@ public class MapInfo implements Serializable {
this.orderNumber = orderNumber;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@Override
public boolean equals(Object that) {
if (this == that) {
@ -143,7 +156,8 @@ public class MapInfo implements Serializable {
&& (this.getProject() == null ? other.getProject() == null : this.getProject().equals(other.getProject()))
&& (this.getProjectCode() == null ? other.getProjectCode() == null : this.getProjectCode().equals(other.getProjectCode()))
&& (this.getDrawWay() == null ? other.getDrawWay() == null : this.getDrawWay().equals(other.getDrawWay()))
&& (this.getOrderNumber() == null ? other.getOrderNumber() == null : this.getOrderNumber().equals(other.getOrderNumber()));
&& (this.getOrderNumber() == null ? other.getOrderNumber() == null : this.getOrderNumber().equals(other.getOrderNumber()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
}
@Override
@ -159,6 +173,7 @@ public class MapInfo implements Serializable {
result = prime * result + ((getProjectCode() == null) ? 0 : getProjectCode().hashCode());
result = prime * result + ((getDrawWay() == null) ? 0 : getDrawWay().hashCode());
result = prime * result + ((getOrderNumber() == null) ? 0 : getOrderNumber().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result;
}
@ -177,6 +192,7 @@ public class MapInfo implements Serializable {
sb.append(", projectCode=").append(projectCode);
sb.append(", drawWay=").append(drawWay);
sb.append(", orderNumber=").append(orderNumber);
sb.append(", version=").append(version);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -713,6 +713,76 @@ public class MapInfoExample {
addCriterion("order_number not between", value1, value2, "orderNumber");
return (Criteria) this;
}
public Criteria andVersionIsNull() {
addCriterion("version is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(String value) {
addCriterion("version =", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(String value) {
addCriterion("version <>", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThan(String value) {
addCriterion("version >", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(String value) {
addCriterion("version >=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThan(String value) {
addCriterion("version <", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(String value) {
addCriterion("version <=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLike(String value) {
addCriterion("version like", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotLike(String value) {
addCriterion("version not like", value, "version");
return (Criteria) this;
}
public Criteria andVersionIn(List<String> values) {
addCriterion("version in", values, "version");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<String> values) {
addCriterion("version not in", values, "version");
return (Criteria) this;
}
public Criteria andVersionBetween(String value1, String value2) {
addCriterion("version between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andVersionNotBetween(String value1, String value2) {
addCriterion("version not between", value1, value2, "version");
return (Criteria) this;
}
}
/**

View File

@ -1,121 +0,0 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* map_version
* @author
*/
public class MapVersion implements Serializable {
private Long id;
/**
* 版本号
*/
private String version;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 作者ID
*/
private Long authorId;
/**
* 地图id
*/
private Long mapId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Long getAuthorId() {
return authorId;
}
public void setAuthorId(Long authorId) {
this.authorId = authorId;
}
public Long getMapId() {
return mapId;
}
public void setMapId(Long mapId) {
this.mapId = mapId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
MapVersion other = (MapVersion) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getAuthorId() == null ? other.getAuthorId() == null : this.getAuthorId().equals(other.getAuthorId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getAuthorId() == null) ? 0 : getAuthorId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().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(", version=").append(version);
sb.append(", updateTime=").append(updateTime);
sb.append(", authorId=").append(authorId);
sb.append(", mapId=").append(mapId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -1,533 +0,0 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class MapVersionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public MapVersionExample() {
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 andVersionIsNull() {
addCriterion("version is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(String value) {
addCriterion("version =", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(String value) {
addCriterion("version <>", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThan(String value) {
addCriterion("version >", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(String value) {
addCriterion("version >=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThan(String value) {
addCriterion("version <", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(String value) {
addCriterion("version <=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLike(String value) {
addCriterion("version like", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotLike(String value) {
addCriterion("version not like", value, "version");
return (Criteria) this;
}
public Criteria andVersionIn(List<String> values) {
addCriterion("version in", values, "version");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<String> values) {
addCriterion("version not in", values, "version");
return (Criteria) this;
}
public Criteria andVersionBetween(String value1, String value2) {
addCriterion("version between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andVersionNotBetween(String value1, String value2) {
addCriterion("version not between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(LocalDateTime value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andAuthorIdIsNull() {
addCriterion("author_id is null");
return (Criteria) this;
}
public Criteria andAuthorIdIsNotNull() {
addCriterion("author_id is not null");
return (Criteria) this;
}
public Criteria andAuthorIdEqualTo(Long value) {
addCriterion("author_id =", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdNotEqualTo(Long value) {
addCriterion("author_id <>", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdGreaterThan(Long value) {
addCriterion("author_id >", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdGreaterThanOrEqualTo(Long value) {
addCriterion("author_id >=", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdLessThan(Long value) {
addCriterion("author_id <", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdLessThanOrEqualTo(Long value) {
addCriterion("author_id <=", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdIn(List<Long> values) {
addCriterion("author_id in", values, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdNotIn(List<Long> values) {
addCriterion("author_id not in", values, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdBetween(Long value1, Long value2) {
addCriterion("author_id between", value1, value2, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdNotBetween(Long value1, Long value2) {
addCriterion("author_id not between", value1, value2, "authorId");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
}
/**
*/
public 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

@ -1,19 +1,19 @@
package club.joylink.rtss.services;
import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training.ITrainingV1Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.MapStatus;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.*;
import club.joylink.rtss.dao.Map3dDataDAO;
import club.joylink.rtss.dao.MapDataDAO;
import club.joylink.rtss.dao.MapInfoDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.services.simulation.SchedulingService;
import club.joylink.rtss.services.training.ITrainingV1Service;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.util.VersionUtil;
import club.joylink.rtss.vo.UserVO;
@ -28,13 +28,15 @@ import club.joylink.rtss.vo.client.map.newmap.MapStationStandNewVO;
import club.joylink.rtss.vo.client.runplan.RunPlanLoadVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.text.Collator;
import java.time.LocalDateTime;
@ -57,9 +59,6 @@ public class MapService implements IMapService {
@Autowired
private MapDataDAO mapDataDAO;
@Autowired
private MapVersionDAO mapVersionDAO;
@Autowired
private Map3dDataDAO map3dDataDAO;
@ -198,12 +197,11 @@ public class MapService implements IMapService {
@Override
public PageVO<MapVersionVO> queryPagedMapVersions(Long id, PageQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
MapVersionExample versionExample = new MapVersionExample();
versionExample.createCriteria().andMapIdEqualTo(id);
versionExample.setOrderByClause("update_time desc");
Page<MapVersion> page = (Page<MapVersion>) mapVersionDAO.selectByExample(versionExample);
List<MapVersionVO> mapVersionVOList = MapVersionVO.convert2VOList(page.getResult());
return PageVO.convert(page, mapVersionVOList);
MapDataExample example = new MapDataExample();
example.setOrderByClause("time desc");
example.createCriteria().andMapIdEqualTo(id);
Page<MapData> page = (Page<MapData>) mapDataDAO.selectByExample(example);
return PageVO.convert(page, MapVersionVO.convert2VOList(page.getResult()));
}
@Override
@ -212,8 +210,6 @@ public class MapService implements IMapService {
MapVO mapVO = this.findMapBaseInfoById(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mapVO,
String.format("id为[%s]的地图数据不存在", id));
String version = this.findMapVersion(id);
mapVO.setVersion(version);
return mapVO;
}
@ -285,14 +281,16 @@ public class MapService implements IMapService {
@Override
public String findMapVersion(Long mapId) {
MapVersionExample example = new MapVersionExample();
example.createCriteria().andMapIdEqualTo(mapId);
example.setOrderByClause("update_time desc");
List<MapVersion> versionList = this.mapVersionDAO.selectByExample(example);
if (!CollectionUtils.isEmpty(versionList)) {
return versionList.get(0).getVersion();
}
return null;
return mapDataDAO.findVersion(mapId);
// MapVersionExample example = new MapVersionExample();
// example.createCriteria().andMapIdEqualTo(mapId);
// example.setOrderByClause("update_time desc");
// List<MapVersion> versionList = this.mapVersionDAO.selectByExample(example);
// if (!CollectionUtils.isEmpty(versionList)) {
// return versionList.get(0).getVersion();
// }
// return null;
}
@Override
@ -340,8 +338,7 @@ public class MapService implements IMapService {
@Override
@Transactional
public MapVO publish(MapVO mapVO, MapDataVO mapDataVO, UserVO userVO) {
// todo 通知课程修改城市后续处理
// 地图信息
//地图信息
MapInfoExample infoExample = new MapInfoExample();
infoExample.createCriteria()
.andNameEqualTo(mapVO.getName())
@ -368,46 +365,101 @@ public class MapService implements IMapService {
"存在名称相同但基于不同关联城市的地图");
}
}
// 地图数据
MapDataWithBLOBs mapData;
MapDataExample dataExample = new MapDataExample();
dataExample.createCriteria().andMapIdEqualTo(map.getId());
List<MapDataWithBLOBs> mapDataList = mapDataDAO.selectByExampleWithBLOBs(dataExample);
if (CollectionUtils.isEmpty(mapDataList)) {
mapData = new MapDataWithBLOBs();
mapData.setMapId(map.getId());
if (map.getDrawWay()) {
// 清除shapeData中的皮肤属性
mapDataVO.getShapeDataNew().setSkinVO(null);
mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeDataNew()));
mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicDataNew()));
} else {
mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeData()));
mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicData()));
}
mapDataDAO.insert(mapData);
//地图数据
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
mapData.setMapId(map.getId());
if (map.getDrawWay()) {
// 清除shapeData中的皮肤属性
mapDataVO.getShapeDataNew().setSkinVO(null);
mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeDataNew()));
mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicDataNew()));
} else {
mapData = mapDataList.get(0);
if (map.getDrawWay()) {
mapDataVO.getShapeDataNew().setSkinVO(null);
mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeDataNew()));
mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicDataNew()));
} else {
mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeData()));
mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicData()));
}
mapDataDAO.updateByPrimaryKeyWithBLOBs(mapData);
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("意外的老版仿真地图数据");
}
// 地图版本
MapVersion newMapVersion = buildAndInsertMapVersion(map, userVO);
mapData.setVersion(VersionUtil.generateNext(findMapVersion(map.getId())));
mapData.setTime(LocalDateTime.now());
mapData.setUserId(userVO.getId());
mapDataDAO.insert(mapData);
// 更新地图当前使用的地图数据版本
map.setVersion(mapData.getVersion());
mapInfoDAO.updateByPrimaryKey(map);
// 保存站间运行数据
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(map.getDrawWay());
iCacheService.remove(BusinessConsts.CachePrefix.Map + map.getId());
MapVO newMapVO = new MapVO(map);
newMapVO.setVersion(newMapVersion.getVersion());
MapDataVO dataVO = new MapDataVO(mapData, map.getDrawWay());
newMapVO.setMapData(dataVO);
return newMapVO;
// // todo 通知课程修改城市后续处理
// // 地图信息
// MapInfoExample infoExample = new MapInfoExample();
// infoExample.createCriteria()
// .andNameEqualTo(mapVO.getName())
// .andStatusNotEqualTo(MapStatus.Delete.getCode());
// List<MapInfo> mapInfoList = mapInfoDAO.selectByExample(infoExample);
// MapInfo map;
// if (ObjectUtils.isEmpty(mapInfoList)) {
// map = new MapInfo();
// map.setName(mapVO.getName());
// map.setCityCode(mapVO.getCityCode());
// map.setLineCode(mapVO.getLineCode());
// map.setStatus(MapStatus.Online.getCode());
// map.setProject(false);
// map.setDrawWay(mapVO.isDrawWay());
// mapInfoDAO.insert(map);
// } else {
// map = mapInfoList.get(0);
// if (!MapStatus.Delete.getCode().equals(map.getStatus())) {
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getLineCode(), mapVO.getLineCode(),
// "存在名称相同但基于不同真实线路的地图");
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getDrawWay(), mapVO.isDrawWay(),
// "存在名称相同但基于不同绘制方式的地图");
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getCityCode(), mapVO.getCityCode(),
// "存在名称相同但基于不同关联城市的地图");
// }
// }
// // 地图数据
// MapDataWithBLOBs mapData;
// MapDataExample dataExample = new MapDataExample();
// dataExample.createCriteria().andMapIdEqualTo(map.getId());
// List<MapDataWithBLOBs> mapDataList = mapDataDAO.selectByExampleWithBLOBs(dataExample);
// if (CollectionUtils.isEmpty(mapDataList)) {
// mapData = new MapDataWithBLOBs();
// mapData.setMapId(map.getId());
// if (map.getDrawWay()) {
// // 清除shapeData中的皮肤属性
// mapDataVO.getShapeDataNew().setSkinVO(null);
// mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeDataNew()));
// mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicDataNew()));
// } else {
// mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeData()));
// mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicData()));
// }
// mapDataDAO.insert(mapData);
// } else {
// mapData = mapDataList.get(0);
// if (map.getDrawWay()) {
// mapDataVO.getShapeDataNew().setSkinVO(null);
// mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeDataNew()));
// mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicDataNew()));
// } else {
// mapData.setGraphData(JsonUtils.writeValueAsString(mapDataVO.getShapeData()));
// mapData.setLogicData(JsonUtils.writeValueAsString(mapDataVO.getLogicData()));
// }
// mapDataDAO.updateByPrimaryKeyWithBLOBs(mapData);
// }
// // 地图版本
// MapVersion newMapVersion = buildAndInsertMapVersion(map, userVO);
// // 保存站间运行数据
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(map.getDrawWay());
// iCacheService.remove(BusinessConsts.CachePrefix.Map + map.getId());
// MapVO newMapVO = new MapVO(map);
// newMapVO.setVersion(newMapVersion.getVersion());
// MapDataVO dataVO = new MapDataVO(mapData, map.getDrawWay());
// newMapVO.setMapData(dataVO);
// return newMapVO;
}
@Override
@ -449,29 +501,6 @@ public class MapService implements IMapService {
}
}
/**
* 创建并插入地图版本信息
*/
private MapVersion buildAndInsertMapVersion(MapInfo map, UserVO userVO) {
String version = this.findMapVersion(map.getId());
MapVersion newVersion = buildVersion(map, version, userVO);
mapVersionDAO.insert(newVersion);
return newVersion;
}
/**
* 创建新的版本信息
*/
private MapVersion buildVersion(MapInfo map, String old, UserVO userVO) {
String version = VersionUtil.generateNext(old);
MapVersion mapVersion = new MapVersion();
mapVersion.setMapId(map.getId());
mapVersion.setAuthorId(userVO.getId());
mapVersion.setUpdateTime(LocalDateTime.now());
mapVersion.setVersion(version);
return mapVersion;
}
@Override
public List<MapVO> getMapListByLineCode(String lineCode) {
MapInfoExample mapExample = new MapInfoExample();
@ -719,6 +748,10 @@ public class MapService implements IMapService {
mapInfo.setLineCode(updateVO.getLineCode());
update = true;
}
if (StringUtils.hasText(updateVO.getVersion()) && versionExist(id, updateVO.getVersion())) {
mapInfo.setVersion(updateVO.getVersion());
update = true;
}
if (update) {
this.mapInfoDAO.updateByPrimaryKey(mapInfo);
this.iCacheService.remove(BusinessConsts.CachePrefix.Map + id);
@ -801,4 +834,14 @@ public class MapService implements IMapService {
}
}
/**
* 该版本的地图数据是否存在
*/
private boolean versionExist(Long mapId, String version) {
MapDataExample example = new MapDataExample();
example.createCriteria().andMapIdEqualTo(mapId).andVersionEqualTo(version);
List<MapData> mapData = mapDataDAO.selectByExample(example);
return !CollectionUtils.isEmpty(mapData);
}
}

View File

@ -55,9 +55,6 @@ public class LocalDataServiceImpl implements LocalDataService {
@Autowired
private MapSystemDAO mapSystemDAO;
@Autowired
private MapVersionDAO mapVersionDAO;
@Autowired
private ProjectDeviceDAO projectDeviceDAO;
@ -141,12 +138,6 @@ public class LocalDataServiceImpl implements LocalDataService {
.andMapIdIn(mapIdList);
List<Ibp> ibpList = this.ibpDAO.selectByExampleWithBLOBs(ibpExample);
localDataVO.setIbpList(ibpList);
// 地图版本
MapVersionExample mapVersionExample = new MapVersionExample();
mapVersionExample.createCriteria()
.andMapIdIn(mapIdList);
List<MapVersion> mapVersionList = this.mapVersionDAO.selectByExample(mapVersionExample);
localDataVO.setMapVersionList(mapVersionList);
// 地图系统
MapSystemExample mapSystemExample = new MapSystemExample();
mapSystemExample.createCriteria()
@ -285,10 +276,6 @@ public class LocalDataServiceImpl implements LocalDataService {
if (!CollectionUtils.isEmpty(localDataVO.getProjectDeviceList())) {
this.projectDeviceDAO.batchInsertWithId(localDataVO.getProjectDeviceList());
}
// 地图版本
if (!CollectionUtils.isEmpty(localDataVO.getMapVersionList())) {
this.mapVersionDAO.batchInsertWithId(localDataVO.getMapVersionList());
}
// 地图系统
if (!CollectionUtils.isEmpty(localDataVO.getMapSystemList())) {
this.mapSystemDAO.batchInsertWithId(localDataVO.getMapSystemList());

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.cbtc;
import club.joylink.rtss.services.IVirtualRealityIbpService;
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
import club.joylink.rtss.simulation.cbtc.ATP.ground.ZCLogicLoop;
import club.joylink.rtss.simulation.cbtc.ATS.ATSLogicLoop;
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
@ -9,6 +11,7 @@ import club.joylink.rtss.simulation.cbtc.command.CommandExecuteService;
import club.joylink.rtss.simulation.cbtc.communication.Joylink3DMessageService;
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
import club.joylink.rtss.simulation.cbtc.competition.CompetitionAndScriptManager;
import club.joylink.rtss.simulation.cbtc.competition.ScriptExecuteService;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
@ -32,9 +35,6 @@ import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPLogicLoop;
import club.joylink.rtss.simulation.cbtc.robot.RobotLogicLoop;
import club.joylink.rtss.simulation.cbtc.script.ScriptActionBO;
import club.joylink.rtss.services.IVirtualRealityIbpService;
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
import club.joylink.rtss.simulation.cbtc.competition.ScriptExecuteService;
import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
@ -678,7 +678,7 @@ public class SimulationMainThread {
Set<String> users = simulation.getSimulationUserIds();
SocketMessageVO<String> message = SocketMessageFactory.build(
WebSocketMessageType.Simulation_Run_Plan_Reload,
simulation.getGroup(), "");
simulation.getGroup(), "1");
this.stompMessageService.sendToUser(users, message);
}

View File

@ -27,8 +27,6 @@ public class LocalDataVO {
List<Ibp> ibpList;
List<MapVersion> mapVersionList;
List<MapSystem> mapSystemList;
List<CommandDefinition> commandDefinitionList;

View File

@ -20,4 +20,7 @@ public class MapInfoUpdateVO {
@ApiModelProperty(value = "所属城市编码")
private String cityCode;
@ApiModelProperty("使用的地图数据的版本")
private String version;
}

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.vo.client.map;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.entity.DraftMap;
import club.joylink.rtss.entity.DraftMapWithBLOBs;
import club.joylink.rtss.entity.MapInfo;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.MapPrdVO;
import club.joylink.rtss.vo.client.map.newmap.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -119,6 +119,7 @@ public class MapVO {
this.setProjectCode(map.getProjectCode());
this.status = map.getStatus();
this.drawWay = map.getDrawWay();
this.version = map.getVersion();
}
public static MapVO fromDraftMapEntity(DraftMapWithBLOBs draftMap) {

View File

@ -1,8 +1,8 @@
package club.joylink.rtss.vo.client.map;
import club.joylink.rtss.entity.MapData;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.entity.MapVersion;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.Setter;
@ -24,13 +24,13 @@ public class MapVersionVO {
private String version;
public MapVersionVO(MapVersion version) {
this.userId = version.getAuthorId();
this.publishTime = version.getUpdateTime();
this.version = version.getVersion();
public MapVersionVO(MapData mapData) {
this.userId = mapData.getUserId();
this.publishTime = mapData.getTime();
this.version = mapData.getVersion();
}
public static List<MapVersionVO> convert2VOList(List<MapVersion> list) {
public static List<MapVersionVO> convert2VOList(List<MapData> list) {
if (!CollectionUtils.isEmpty(list)) {
return list.stream().map(MapVersionVO::new).collect(Collectors.toList());
}

View File

@ -2,11 +2,11 @@ package club.joylink.rtss.websocket;
import club.joylink.rtss.vo.client.SocketMessageVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Collection;
import java.util.Objects;
@ -47,7 +47,7 @@ public class StompMessageService {
if (messageVO.getBody() instanceof String) {
String body = (String) messageVO.getBody();
if (!body.startsWith("{") && !body.startsWith("[")) {
body = StringUtils.quote(body);
body = "\"" + body + "\"";
}
send = "{\"type\":\"" + messageVO.getType() + "\",\"body\":" + body + "}";
}

View File

@ -4,6 +4,9 @@
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.MapData">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="version" jdbcType="VARCHAR" property="version" />
<result column="time" jdbcType="TIMESTAMP" property="time" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.MapDataWithBLOBs">
<result column="graph_data" jdbcType="LONGVARCHAR" property="graphData" />
@ -68,7 +71,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, map_id
id, map_id, version, `time`, user_id
</sql>
<sql id="Blob_Column_List">
graph_data, logic_data
@ -138,9 +141,11 @@
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapDataWithBLOBs" useGeneratedKeys="true">
insert into map_data (map_id, graph_data, logic_data
insert into map_data (map_id, version, `time`,
user_id, graph_data, logic_data
)
values (#{mapId,jdbcType=BIGINT}, #{graphData,jdbcType=LONGVARCHAR}, #{logicData,jdbcType=LONGVARCHAR}
values (#{mapId,jdbcType=BIGINT}, #{version,jdbcType=VARCHAR}, #{time,jdbcType=TIMESTAMP},
#{userId,jdbcType=BIGINT}, #{graphData,jdbcType=LONGVARCHAR}, #{logicData,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapDataWithBLOBs" useGeneratedKeys="true">
@ -149,6 +154,15 @@
<if test="mapId != null">
map_id,
</if>
<if test="version != null">
version,
</if>
<if test="time != null">
`time`,
</if>
<if test="userId != null">
user_id,
</if>
<if test="graphData != null">
graph_data,
</if>
@ -160,6 +174,15 @@
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
<if test="time != null">
#{time,jdbcType=TIMESTAMP},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="graphData != null">
#{graphData,jdbcType=LONGVARCHAR},
</if>
@ -183,6 +206,15 @@
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=VARCHAR},
</if>
<if test="record.time != null">
`time` = #{record.time,jdbcType=TIMESTAMP},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.graphData != null">
graph_data = #{record.graphData,jdbcType=LONGVARCHAR},
</if>
@ -198,6 +230,9 @@
update map_data
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
version = #{record.version,jdbcType=VARCHAR},
`time` = #{record.time,jdbcType=TIMESTAMP},
user_id = #{record.userId,jdbcType=BIGINT},
graph_data = #{record.graphData,jdbcType=LONGVARCHAR},
logic_data = #{record.logicData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -207,7 +242,10 @@
<update id="updateByExample" parameterType="map">
update map_data
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT}
map_id = #{record.mapId,jdbcType=BIGINT},
version = #{record.version,jdbcType=VARCHAR},
`time` = #{record.time,jdbcType=TIMESTAMP},
user_id = #{record.userId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -218,6 +256,15 @@
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="version != null">
version = #{version,jdbcType=VARCHAR},
</if>
<if test="time != null">
`time` = #{time,jdbcType=TIMESTAMP},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="graphData != null">
graph_data = #{graphData,jdbcType=LONGVARCHAR},
</if>
@ -230,13 +277,19 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.MapDataWithBLOBs">
update map_data
set map_id = #{mapId,jdbcType=BIGINT},
version = #{version,jdbcType=VARCHAR},
`time` = #{time,jdbcType=TIMESTAMP},
user_id = #{userId,jdbcType=BIGINT},
graph_data = #{graphData,jdbcType=LONGVARCHAR},
logic_data = #{logicData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.MapData">
update map_data
set map_id = #{mapId,jdbcType=BIGINT}
set map_id = #{mapId,jdbcType=BIGINT},
version = #{version,jdbcType=VARCHAR},
`time` = #{time,jdbcType=TIMESTAMP},
user_id = #{userId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -11,6 +11,7 @@
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="draw_way" jdbcType="BIT" property="drawWay" />
<result column="order_number" jdbcType="INTEGER" property="orderNumber" />
<result column="version" jdbcType="VARCHAR" property="version" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -71,7 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, line_code, city_code, `status`, project, project_code, draw_way, order_number
id, `name`, line_code, city_code, `status`, project, project_code, draw_way, order_number,
version
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.MapInfoExample" resultMap="BaseResultMap">
select
@ -114,10 +116,12 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapInfo" useGeneratedKeys="true">
insert into map_info (`name`, line_code, city_code,
`status`, project, project_code,
draw_way, order_number)
draw_way, order_number, version
)
values (#{name,jdbcType=VARCHAR}, #{lineCode,jdbcType=VARCHAR}, #{cityCode,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{project,jdbcType=BIT}, #{projectCode,jdbcType=VARCHAR},
#{drawWay,jdbcType=BIT}, #{orderNumber,jdbcType=INTEGER})
#{drawWay,jdbcType=BIT}, #{orderNumber,jdbcType=INTEGER}, #{version,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapInfo" useGeneratedKeys="true">
insert into map_info
@ -146,6 +150,9 @@
<if test="orderNumber != null">
order_number,
</if>
<if test="version != null">
version,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
@ -172,6 +179,9 @@
<if test="orderNumber != null">
#{orderNumber,jdbcType=INTEGER},
</if>
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.MapInfoExample" resultType="java.lang.Long">
@ -210,6 +220,9 @@
<if test="record.orderNumber != null">
order_number = #{record.orderNumber,jdbcType=INTEGER},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -225,7 +238,8 @@
project = #{record.project,jdbcType=BIT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
draw_way = #{record.drawWay,jdbcType=BIT},
order_number = #{record.orderNumber,jdbcType=INTEGER}
order_number = #{record.orderNumber,jdbcType=INTEGER},
version = #{record.version,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -257,6 +271,9 @@
<if test="orderNumber != null">
order_number = #{orderNumber,jdbcType=INTEGER},
</if>
<if test="version != null">
version = #{version,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -269,7 +286,8 @@
project = #{project,jdbcType=BIT},
project_code = #{projectCode,jdbcType=VARCHAR},
draw_way = #{drawWay,jdbcType=BIT},
order_number = #{orderNumber,jdbcType=INTEGER}
order_number = #{orderNumber,jdbcType=INTEGER},
version = #{version,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>