增加地图功能模板管理及[使用模板生成地图功能]的功能

This commit is contained in:
joylink_zhangsai 2023-02-20 17:25:40 +08:00
parent cfd13f863b
commit a5366241ef
26 changed files with 1771 additions and 204 deletions

View File

@ -5,11 +5,15 @@ import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.dao.RtsMapFunctionDAO;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.services.mapFunctionTemplate.MapFunctionTemplateService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunction.*;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateCreateVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateQueryVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateVO;
import club.joylink.rtss.vo.map.MapVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -21,7 +25,7 @@ import java.util.List;
import java.util.Map;
/**
* 地图功能管理接口
* 地图功能及模板管理接口
*/
@RestController
@RequestMapping("/api/mapFunction")
@ -29,12 +33,15 @@ public class MapFunctionController {
@Autowired
private RtsMapFunctionService rtsMapFunctionService;
@Autowired
private MapFunctionTemplateService mapFunctionTemplateService;
/**
* 创建地图功能
*/
@Role(RoleEnum.Admin)
@PostMapping("")
public void create(@RequestBody RtsMapFunctionCreateVO createVO, @RequestAttribute LoginUserInfoVO loginInfo) {
public void create(@RequestBody MapFunctionCreateVO createVO, @RequestAttribute LoginUserInfoVO loginInfo) {
rtsMapFunctionService.create(createVO, loginInfo.getAccountVO().getId());
}
@ -43,7 +50,7 @@ public class MapFunctionController {
*/
@Role(RoleEnum.Admin)
@PostMapping("/{mapId}/generate")
public List<String> generate(@PathVariable long mapId, @RequestBody @Validated RtsMapFunctionGenerateParamVO paramVO,
public List<String> generate(@PathVariable long mapId, @RequestBody @Validated MapFunctionGenerateParamVO paramVO,
@RequestAttribute LoginUserInfoVO loginInfo) {
return rtsMapFunctionService.generate(mapId, paramVO, loginInfo.getAccountVO().getId());
}
@ -52,7 +59,7 @@ public class MapFunctionController {
* 列表查询地图功能
*/
@GetMapping("/list")
public List<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO) {
public List<MapFunctionVO> listQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.listQuery(queryVO);
}
@ -60,7 +67,7 @@ public class MapFunctionController {
* 分页查询地图功能
*/
@GetMapping("/paged")
public PageVO<RtsMapFunctionVO> pagedQuery(RtsMapFunctionQueryVO queryVO) {
public PageVO<MapFunctionVO> pagedQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.pagedQuery(queryVO);
}
@ -87,7 +94,7 @@ public class MapFunctionController {
*/
@Role(RoleEnum.Admin)
@PutMapping("/{id}")
public void update(@PathVariable long id, @RequestBody RtsMapFunctionUpdateVO updateVO, @RequestAttribute LoginUserInfoVO loginInfo) {
public void update(@PathVariable long id, @RequestBody MapFunctionUpdateVO updateVO, @RequestAttribute LoginUserInfoVO loginInfo) {
rtsMapFunctionService.update(id, updateVO, loginInfo.getAccountVO().getId());
}
@ -95,7 +102,7 @@ public class MapFunctionController {
* 根据ID获取地图功能信息
*/
@GetMapping("/{id}")
public RtsMapFunctionVO queryOne(@PathVariable Long id) {
public MapFunctionVO queryOne(@PathVariable Long id) {
return rtsMapFunctionService.get(id);
}
@ -110,11 +117,61 @@ public class MapFunctionController {
}
/**
* 批量修改描述
* 跨线路批量修改线路功能
*/
@PutMapping("/desc/batch")
public void batchModifyDesc(@RequestBody RtsMapFunctionDescModifyVO vo) {
rtsMapFunctionService.batchModifyDesc(vo);
@PutMapping("/crossMap/batch")
public void batchModifyDesc(@RequestBody MapFunctionBatchModifyVO vo) {
rtsMapFunctionService.batchModify(vo);
}
/**
* 创建
*/
@PostMapping("/template")
public void create(@RequestBody MapFunctionTemplateCreateVO createVO, @RequestAttribute AccountVO user) {
mapFunctionTemplateService.create(createVO, user.getId());
}
/**
* 列表查询
*/
@GetMapping("/template/list")
public List<MapFunctionTemplateVO> listQuery(MapFunctionTemplateQueryVO queryVO) {
return mapFunctionTemplateService.listQuery(queryVO);
}
/**
* 分页查询
*/
@GetMapping("/template/paged")
public PageVO<MapFunctionTemplateVO> pagedQuery(MapFunctionTemplateQueryVO queryVO) {
return mapFunctionTemplateService.pagedQuery(queryVO);
}
/**
* 更新
*/
@PutMapping("/template/{id}")
public MapFunctionTemplateVO update(@PathVariable long id, @RequestBody MapFunctionTemplateCreateVO createVO,
@RequestAttribute AccountVO user) {
return mapFunctionTemplateService.update(id, createVO, user.getId());
}
/**
* 删除
*/
@DeleteMapping("/template/{id}")
public void deleteTemplate(@PathVariable long id) {
mapFunctionTemplateService.delete(id);
}
/**
* 根据模板生成地图功能
* @return 生成过程中的特殊情况日志
*/
@PostMapping("/generate/from/template")
public List<String> generateFromTemplate(@RequestBody MapFunctionGenerateVO vo, @RequestAttribute AccountVO user) {
return rtsMapFunctionService.generateFromTemplate(vo, user.getId());
}
@Autowired
@ -147,7 +204,7 @@ public class MapFunctionController {
public void generateAll(@RequestAttribute LoginUserInfoVO loginInfo) {
for (MapVO mapVO : iMapService.listOnline()) {
MapVO mapDetail = iMapService.getMapDetail(mapVO.getId());
RtsMapFunctionGenerateParamVO paramVO = new RtsMapFunctionGenerateParamVO();
MapFunctionGenerateParamVO paramVO = new MapFunctionGenerateParamVO();
List<Simulation.Type> types = new ArrayList<>();
if (mapDetail.getConfigVO().isRailway()) {
types.add(Simulation.Type.RAILWAY);

View File

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

View File

@ -0,0 +1,154 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
* 地图功能模板
*/
public class MapFunctionTemplate implements Serializable {
private Long id;
private String name;
/**
* 辅助参数如默认角色类型
*/
private String assistantParam;
private LocalDateTime createTime;
private Long creatorId;
private LocalDateTime updateTime;
private Long updaterId;
/**
* 地图功能参数
*/
private String mapFunctionParam;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAssistantParam() {
return assistantParam;
}
public void setAssistantParam(String assistantParam) {
this.assistantParam = assistantParam;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public Long getCreatorId() {
return creatorId;
}
public void setCreatorId(Long creatorId) {
this.creatorId = creatorId;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Long getUpdaterId() {
return updaterId;
}
public void setUpdaterId(Long updaterId) {
this.updaterId = updaterId;
}
public String getMapFunctionParam() {
return mapFunctionParam;
}
public void setMapFunctionParam(String mapFunctionParam) {
this.mapFunctionParam = mapFunctionParam;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
MapFunctionTemplate other = (MapFunctionTemplate) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getAssistantParam() == null ? other.getAssistantParam() == null : this.getAssistantParam().equals(other.getAssistantParam()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getUpdaterId() == null ? other.getUpdaterId() == null : this.getUpdaterId().equals(other.getUpdaterId()))
&& (this.getMapFunctionParam() == null ? other.getMapFunctionParam() == null : this.getMapFunctionParam().equals(other.getMapFunctionParam()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getAssistantParam() == null) ? 0 : getAssistantParam().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getUpdaterId() == null) ? 0 : getUpdaterId().hashCode());
result = prime * result + ((getMapFunctionParam() == null) ? 0 : getMapFunctionParam().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(", name=").append(name);
sb.append(", assistantParam=").append(assistantParam);
sb.append(", createTime=").append(createTime);
sb.append(", creatorId=").append(creatorId);
sb.append(", updateTime=").append(updateTime);
sb.append(", updaterId=").append(updaterId);
sb.append(", mapFunctionParam=").append(mapFunctionParam);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,663 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class MapFunctionTemplateExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public MapFunctionTemplateExample() {
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 andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andAssistantParamIsNull() {
addCriterion("assistant_param is null");
return (Criteria) this;
}
public Criteria andAssistantParamIsNotNull() {
addCriterion("assistant_param is not null");
return (Criteria) this;
}
public Criteria andAssistantParamEqualTo(String value) {
addCriterion("assistant_param =", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamNotEqualTo(String value) {
addCriterion("assistant_param <>", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamGreaterThan(String value) {
addCriterion("assistant_param >", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamGreaterThanOrEqualTo(String value) {
addCriterion("assistant_param >=", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamLessThan(String value) {
addCriterion("assistant_param <", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamLessThanOrEqualTo(String value) {
addCriterion("assistant_param <=", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamLike(String value) {
addCriterion("assistant_param like", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamNotLike(String value) {
addCriterion("assistant_param not like", value, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamIn(List<String> values) {
addCriterion("assistant_param in", values, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamNotIn(List<String> values) {
addCriterion("assistant_param not in", values, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamBetween(String value1, String value2) {
addCriterion("assistant_param between", value1, value2, "assistantParam");
return (Criteria) this;
}
public Criteria andAssistantParamNotBetween(String value1, String value2) {
addCriterion("assistant_param not between", value1, value2, "assistantParam");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(LocalDateTime value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(LocalDateTime value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<LocalDateTime> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria 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 andUpdaterIdIsNull() {
addCriterion("updater_id is null");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNotNull() {
addCriterion("updater_id is not null");
return (Criteria) this;
}
public Criteria andUpdaterIdEqualTo(Long value) {
addCriterion("updater_id =", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotEqualTo(Long value) {
addCriterion("updater_id <>", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThan(Long value) {
addCriterion("updater_id >", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThanOrEqualTo(Long value) {
addCriterion("updater_id >=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThan(Long value) {
addCriterion("updater_id <", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThanOrEqualTo(Long value) {
addCriterion("updater_id <=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdIn(List<Long> values) {
addCriterion("updater_id in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotIn(List<Long> values) {
addCriterion("updater_id not in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdBetween(Long value1, Long value2) {
addCriterion("updater_id between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotBetween(Long value1, Long value2) {
addCriterion("updater_id not between", value1, value2, "updaterId");
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

@ -7,23 +7,23 @@ import java.util.List;
import java.util.Map;
public interface RtsMapFunctionService {
void create(RtsMapFunctionCreateVO createVO, long creatorId);
void create(MapFunctionCreateVO createVO, long creatorId);
void delete(long id);
void update(long id, RtsMapFunctionUpdateVO updateVO, long updaterId);
void update(long id, MapFunctionUpdateVO updateVO, long updaterId);
RtsMapFunctionVO get(long id);
MapFunctionVO get(long id);
/**
* 列表查询地图子系统
*/
List<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO);
List<MapFunctionVO> listQuery(MapFunctionQueryVO queryVO);
/**
* 分页查询地图子系统
*/
PageVO<RtsMapFunctionVO> pagedQuery(RtsMapFunctionQueryVO queryVO);
PageVO<MapFunctionVO> pagedQuery(MapFunctionQueryVO queryVO);
/**
* 生成线路功能
@ -32,7 +32,7 @@ public interface RtsMapFunctionService {
* @param paramVO 指示生成内容的参数
* @return 一些特殊的但是算不上异常的信息
*/
List<String> generate(long mapId, RtsMapFunctionGenerateParamVO paramVO, long creatorId);
List<String> generate(long mapId, MapFunctionGenerateParamVO paramVO, long creatorId);
/**
* 生成大客流线路功能
@ -51,5 +51,10 @@ public interface RtsMapFunctionService {
void updateGroup(Map<String, List<Long>> groupMap, Long updaterId);
void batchModifyDesc(RtsMapFunctionDescModifyVO vo);
/**
* 批量修改线路功能数据目前所有的where条件见参数的注释为或
*/
void batchModify(MapFunctionBatchModifyVO vo);
List<String> generateFromTemplate(MapFunctionGenerateVO vo, Long userId);
}

View File

@ -11,6 +11,7 @@ import club.joylink.rtss.entity.RtsMapFunction;
import club.joylink.rtss.entity.RtsMapFunctionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.mapFunctionTemplate.MapFunctionTemplateService;
import club.joylink.rtss.services.publishData.MapPassengerFlowDataService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
@ -18,6 +19,7 @@ import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunction.*;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateVO;
import club.joylink.rtss.vo.client.passenger.MapPassengerFlowVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapMemberVO;
@ -32,6 +34,7 @@ import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@ -43,9 +46,11 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
private IMapService iMapService;
@Autowired
private MapPassengerFlowDataService mapPassengerFlowDataService;
@Autowired
private MapFunctionTemplateService mapFunctionTemplateService;
@Override
public void create(RtsMapFunctionCreateVO createVO, long creatorId) {
public void create(MapFunctionCreateVO createVO, long creatorId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getMapId());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(createVO.getName());
confirmNameNotExist(createVO.getMapId(), createVO.getName());
@ -61,7 +66,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
@Override
public void update(long id, RtsMapFunctionUpdateVO updateVO, long updaterId) {
public void update(long id, MapFunctionUpdateVO updateVO, long updaterId) {
RtsMapFunction entity = getEntity(id);
updateVO.override(entity);
entity.setUpdaterId(updaterId);
@ -70,13 +75,13 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
@Override
public RtsMapFunctionVO get(long id) {
public MapFunctionVO get(long id) {
RtsMapFunction entity = getEntity(id);
return new RtsMapFunctionVO(entity);
return new MapFunctionVO(entity);
}
@Override
public List<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO) {
public List<MapFunctionVO> listQuery(MapFunctionQueryVO queryVO) {
RtsMapFunctionExample example = new RtsMapFunctionExample();
RtsMapFunctionExample.Criteria criteria = example.createCriteria();
if (queryVO.getMapId() != null)
@ -85,20 +90,25 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
criteria.andNameLike(queryVO.getName());
if (queryVO.getSimType() != null)
criteria.andTypeEqualTo(queryVO.getSimType().name());
List<RtsMapFunction> entities = rtsMapFunctionDAO.selectByExampleWithBLOBs(example);
return entities.stream().map(RtsMapFunctionVO::new).collect(Collectors.toList());
List<RtsMapFunction> entities;
if (queryVO.isDetail()) {
entities = rtsMapFunctionDAO.selectByExampleWithBLOBs(example);
} else {
entities = rtsMapFunctionDAO.selectByExample(example);
}
return entities.stream().map(MapFunctionVO::new).collect(Collectors.toList());
}
@Override
public PageVO<RtsMapFunctionVO> pagedQuery(RtsMapFunctionQueryVO queryVO) {
public PageVO<MapFunctionVO> pagedQuery(MapFunctionQueryVO queryVO) {
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
List<RtsMapFunctionVO> list = listQuery(queryVO);
List<MapFunctionVO> list = listQuery(queryVO);
return PageVO.convert(page, list);
}
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
@Override
public List<String> generate(long mapId, RtsMapFunctionGenerateParamVO paramVO, long creatorId) {
public List<String> generate(long mapId, MapFunctionGenerateParamVO paramVO, long creatorId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(paramVO.getSimTypes(),
"要生成子系统的仿真系统类型不能为空");
//查询所有旧数据
@ -110,7 +120,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
String msgPrefix;
List<MapMemberVO> mapMemberVOS;
List<Supplier<RtsMapFunctionCreateVO>> createVOSuppliers;
List<Supplier<MapFunctionCreateVO>> createVOSuppliers;
for (Simulation.Type simType : paramVO.getSimTypes()) {
mapMemberVOS = mapData.getGraphDataNew().getMemberMap().get(simType);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapMemberVOS,
@ -132,8 +142,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
throw new IllegalStateException("Unexpected value: " + simType);
}
//填充参数并创建子系统
for (Supplier<RtsMapFunctionCreateVO> supplier : createVOSuppliers) {
RtsMapFunctionCreateVO createVO = supplier.get();
for (Supplier<MapFunctionCreateVO> supplier : createVOSuppliers) {
MapFunctionCreateVO createVO = supplier.get();
if (createVO != null) {
create(createVO, creatorId);
}
@ -172,8 +182,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.LPF, pfDataList.get(0).getId().toString()); //配置加载大客流数据
dispatcherOptional.ifPresent(mapMemberVO -> itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, mapMemberVO.getId())); //配置默认成员
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = buildCreateVO(mapId, name, name, Simulation.Type.METRO, null, itemMap, domConfig);
create(rtsMapFunctionCreateVO, creatorId);
MapFunctionCreateVO mapFunctionCreateVO = buildCreateVO(mapId, name, name, Simulation.Type.METRO, null, itemMap, domConfig);
create(mapFunctionCreateVO, creatorId);
return msgList;
}
@ -231,7 +241,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
boolean hasTraining = false;
boolean hasExam = false;
for (MapSystem mapSystem : mapSystems) {
Supplier<RtsMapFunctionCreateVO> supplier;
Supplier<MapFunctionCreateVO> supplier;
if (mapSystem.getType().equals("Simulation")) {
MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(mapSystem.getPrdType());
switch (prdType) {
@ -277,24 +287,24 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
default:
throw new RuntimeException();
}
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = supplier.get();
if (rtsMapFunctionCreateVO != null) {
create(rtsMapFunctionCreateVO, 1);
MapFunctionCreateVO mapFunctionCreateVO = supplier.get();
if (mapFunctionCreateVO != null) {
create(mapFunctionCreateVO, 1);
}
} else if (mapSystem.getType().equals("Lesson")) {
if (!hasTraining) {
hasTraining = true;
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType).get();
if (rtsMapFunctionCreateVO != null) {
create(rtsMapFunctionCreateVO, 1);
MapFunctionCreateVO mapFunctionCreateVO = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType).get();
if (mapFunctionCreateVO != null) {
create(mapFunctionCreateVO, 1);
}
}
} else if (mapSystem.getType().equals("Exam")) {
if (!hasExam) {
hasExam = true;
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType).get();
if (rtsMapFunctionCreateVO != null) {
create(rtsMapFunctionCreateVO, 1);
MapFunctionCreateVO mapFunctionCreateVO = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType).get();
if (mapFunctionCreateVO != null) {
create(mapFunctionCreateVO, 1);
}
}
} else {
@ -324,23 +334,72 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
@Override
public void batchModifyDesc(RtsMapFunctionDescModifyVO vo) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(vo.getFunctionName()) || StringUtils.hasText(vo.getOriginalDesc()),
"功能名称和原描述至少填一个");
RtsMapFunctionExample example = new RtsMapFunctionExample();
if (StringUtils.hasText(vo.getFunctionName())) {
example.or().andNameEqualTo(vo.getFunctionName());
}
if (StringUtils.hasText(vo.getOriginalDesc())) {
example.or().andDescEqualTo(vo.getOriginalDesc());
}
rtsMapFunctionDAO.updateByExampleSelective(vo.convert2DB(), example);
public void batchModify(MapFunctionBatchModifyVO vo) {
MapFunctionBatchModifyVO.DescModifyParamVO descModifyParamVO = vo.getDescModifyParamVO();
MapFunctionBatchModifyVO.BgUrlModifyParamVO bgUrlModifyParamVO = vo.getBgUrlModifyParamVO();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(descModifyParamVO != null || bgUrlModifyParamVO != null);
// descModifyParamVO.
}
private RtsMapFunctionCreateVO buildCreateVO(long mapId, String name, String desc, Simulation.Type simType, String group,
Map<SimulationWorkParamVO.Item, String> itemMap, SimulationWorkParamVO.DomConfigVO domConfig) {
RtsMapFunctionCreateVO createVO = new RtsMapFunctionCreateVO();
@Override
public List<String> generateFromTemplate(MapFunctionGenerateVO generateVO, Long userId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(generateVO.getTemplateIds());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(generateVO.getMapIds());
List<String> msgList = new ArrayList<>();
List<MapFunctionTemplateVO> templates = mapFunctionTemplateService.queryWithBLOBs(generateVO.getTemplateIds());
List<MapFunctionTemplateVO> checkedTemplates = new ArrayList<>();
for (MapFunctionTemplateVO template : templates) {
if (template.getMapFunctionParam() != null && StringUtils.hasText(template.getMapFunctionParam().getName()) && template.getMapFunctionParam().getParamVO() != null) {
checkedTemplates.add(template);
} else {
msgList.add(String.format("模板[id:%s][名称:%s]地图功能必要参数不足,未生成功能", template.getId(), template.getName()));
}
}
MapFunctionQueryVO mapFunctionQueryVO = new MapFunctionQueryVO();
for (Long mapId : generateVO.getMapIds()) {
MapVO mapDetail = iMapService.getMapDetail(mapId);
mapFunctionQueryVO.setMapId(mapId);
Map<String, MapFunctionVO> existMapFuncMap = listQuery(mapFunctionQueryVO).stream()
.collect(Collectors.toMap(MapFunctionVO::getName, Function.identity()));
for (MapFunctionTemplateVO template : checkedTemplates) {
MapFunctionCreateVO mapFunctionParam = template.getMapFunctionParam();
MapFunctionVO existMapFunc = existMapFuncMap.get(mapFunctionParam.getName());
if (existMapFunc != null && !generateVO.isOverwrite()) {
msgList.add(String.format("模板[名称:%s]指定的地图功能名称[%s]已存在,未生成", template.getName(), mapFunctionParam.getName()));
}
if (template.getAssistantParam() != null && StringUtils.hasText(template.getAssistantParam().getDefaultMemberType())) {
String memberType = template.getAssistantParam().getDefaultMemberType();
List<MapMemberVO> mapMemberVOS = mapDetail.getGraphDataNew().getMemberMap().get(mapFunctionParam.getParamVO().getType());
if (!CollectionUtils.isEmpty(mapMemberVOS)) {
Optional<MapMemberVO> optional = mapMemberVOS.stream()
.filter(member -> member.getType().name().equals(memberType))
.findFirst();
if (optional.isEmpty()) {
msgList.add(String.format("地图[名:%s]不存在模板[名:%s]所指定类型[%s]的角色", mapDetail.getName(), template.getName(), memberType));
} else {
mapFunctionParam.getParamVO().getItemMap().put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, optional.get().getId());
}
}
}
mapFunctionParam.setMapId(mapId);
if (existMapFunc != null && generateVO.isOverwrite()) {
update(existMapFunc.getId(), new MapFunctionUpdateVO(mapFunctionParam), userId);
}
if (existMapFunc == null) {
create(mapFunctionParam, userId);
}
}
}
return msgList;
}
private MapFunctionCreateVO buildCreateVO(long mapId, String name, String desc, Simulation.Type simType, String group,
Map<SimulationWorkParamVO.Item, String> itemMap, SimulationWorkParamVO.DomConfigVO domConfig) {
MapFunctionCreateVO createVO = new MapFunctionCreateVO();
createVO.setMapId(mapId);
createVO.setName(name);
createVO.setDesc(desc);
@ -354,7 +413,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
/**
* 构建提供{@link RtsMapFunctionCreateVO}的方法
* 构建提供{@link MapFunctionCreateVO}的方法
*
* @param mapId
* @param systemNameSet 已存在的子系统名称这些子系统不再生成
@ -362,26 +421,26 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
* @param msgPrefix 特殊信息的统一前缀
* @param simType 仿真类型
* @param mapMemberVOS 地图成员列表
* @return 调用apply方法时当该地图子系统无法或无需创建时返回null否则返回填充好所有参数的{@link RtsMapFunctionCreateVO}
* @return 调用apply方法时当该地图子系统无法或无需创建时返回null否则返回填充好所有参数的{@link MapFunctionCreateVO}
*/
private List<Supplier<RtsMapFunctionCreateVO>> buildMetroSystemCreateVOSuppliers(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<RtsMapFunctionCreateVO>> fillFunctions = new ArrayList<>();
private List<Supplier<MapFunctionCreateVO>> buildMetroSystemCreateVOSuppliers(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<MapFunctionCreateVO>> fillFunctions = new ArrayList<>();
Optional<MapMemberVO> dispatcherOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER))
.findFirst();
Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR))
.findFirst();
Supplier<RtsMapFunctionCreateVO> dispatchSystem = getDispatcherFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> stationSystem = getStationFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, stationSupervisorOptional);
Supplier<RtsMapFunctionCreateVO> driveSystem = getDriverFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, mapMemberVOS);
Supplier<RtsMapFunctionCreateVO> dispatchTrainingSystem = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> stationTrainingSystem = getSceneTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> stationExamSystem = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingRoom = getTrainingRoomFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType);
Supplier<RtsMapFunctionCreateVO> runPlanDesign = getRunPlanDesignFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> dispatchSystem = getDispatcherFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<MapFunctionCreateVO> stationSystem = getStationFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, stationSupervisorOptional);
Supplier<MapFunctionCreateVO> driveSystem = getDriverFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, mapMemberVOS);
Supplier<MapFunctionCreateVO> dispatchTrainingSystem = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> stationTrainingSystem = getSceneTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> stationExamSystem = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<MapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<MapFunctionCreateVO> trainingRoom = getTrainingRoomFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType);
Supplier<MapFunctionCreateVO> runPlanDesign = getRunPlanDesignFunctionSupplier(mapId, systemNameSet, msgList, simType);
fillFunctions.add(dispatchSystem);
fillFunctions.add(stationSystem);
@ -396,7 +455,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return fillFunctions;
}
private Supplier<RtsMapFunctionCreateVO> getTrainingRoomFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getTrainingRoomFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType) {
return () -> {
String name = "实训室";
String desc = "根据用户需求不同,搭配硬件设备组件实训室,进行软硬件的联动培训。";
@ -414,7 +473,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getTrainingDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
private Supplier<MapFunctionCreateVO> getTrainingDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
return () -> {
String name = "实训设计";
String desc = "可编制单岗位的站场图设备操作或设计多岗位的脚本化场景以供单操实训或场景实训使用。";
@ -438,7 +497,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getJointFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
private Supplier<MapFunctionCreateVO> getJointFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
//综合演练
return () -> {
String name = "综合演练";
@ -463,7 +522,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getExamFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getExamFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "考试";
String desc = "从理论、单操实训、场景实训三个方面进行设计、用户可在该功能中在线实时考试,自动评分。";
@ -479,7 +538,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getSceneTrainingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getSceneTrainingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "场景实训";
String desc = "以不同故障场景为剧本,培训各岗位在故障情境下的配合调度能力,包含各个故障场景下的标准应急流程及联动用语。" +
@ -498,7 +557,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getSingleOperationTrainingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getSingleOperationTrainingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "单操实训";
String desc = "针对行调及行值人员的具体功能操作进行解析形成专业实操课程。单操实训系统具有教学、练习及测验三种模式。";
@ -515,8 +574,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getDriverFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
private Supplier<MapFunctionCreateVO> getDriverFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
return () -> {
String name = "模拟驾驶";
String desc = "桌面版模拟驾驶仿真系统,操作驾驶界面与真实车辆驾驶台保持一致,可完成对列车驾驶的操作动作、技术、规则和技巧的练习。";
@ -541,8 +600,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getStationFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> stationSupervisorOptional) {
private Supplier<MapFunctionCreateVO> getStationFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> stationSupervisorOptional) {
//ATS现地工作站
return () -> {
String name = "车站仿真";
@ -566,8 +625,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getDispatcherFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
private Supplier<MapFunctionCreateVO> getDispatcherFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
return () -> {
String name = "调度仿真";
String desc = "调度仿真是面向地铁运营的行车调度员操作技能和专业能力培训的功能,能够实现设备的各种正常操作及常见故障仿真。";
@ -591,30 +650,30 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
/**
* 构建大铁填充{@link RtsMapFunctionCreateVO}的方法列表
* 构建大铁填充{@link MapFunctionCreateVO}的方法列表
*
* @param systemNameSet 已存在的子系统名称的集合
* @param msgList 记录特殊的但是不算异常的信息
* @param msgPrefix msgList内容的统一前缀
* @param mapMemberVOS 地图数据中的成员列表
* @return 调用apply方法时当地图子系统的参数有问题无法创建子系统时返回null否则返回填充好所有参数的{@link RtsMapFunctionCreateVO}
* @return 调用apply方法时当地图子系统的参数有问题无法创建子系统时返回null否则返回填充好所有参数的{@link MapFunctionCreateVO}
*/
private List<Supplier<RtsMapFunctionCreateVO>> buildRailwayFillCreateVOSuppliers(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<RtsMapFunctionCreateVO>> fillFunctions = new ArrayList<>();
private List<Supplier<MapFunctionCreateVO>> buildRailwayFillCreateVOSuppliers(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<MapFunctionCreateVO>> fillFunctions = new ArrayList<>();
Optional<MapMemberVO> dispatcherOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER))
.findFirst();
Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR))
.findFirst();
Supplier<RtsMapFunctionCreateVO> dispatchSystem = getRailDispatcherFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> stationSystem = getRailStationFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, stationSupervisorOptional);
Supplier<RtsMapFunctionCreateVO> singleOperationTrainingFunctionSupplier = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> sceneTrainingFunctionSupplier = getSceneTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> examFunctionSupplier = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<MapFunctionCreateVO> dispatchSystem = getRailDispatcherFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<MapFunctionCreateVO> stationSystem = getRailStationFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, stationSupervisorOptional);
Supplier<MapFunctionCreateVO> singleOperationTrainingFunctionSupplier = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> sceneTrainingFunctionSupplier = getSceneTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> examFunctionSupplier = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<MapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<MapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
fillFunctions.add(dispatchSystem);
fillFunctions.add(stationSystem);
@ -627,8 +686,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return fillFunctions;
}
private Supplier<RtsMapFunctionCreateVO> getRailStationFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> stationSupervisorOptional) {
private Supplier<MapFunctionCreateVO> getRailStationFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> stationSupervisorOptional) {
return () -> {
String name = "车站";
String desc = "模拟列车值班员工作站,用于完成铁路运输接发列车工作、铁路运输行车指挥协调、组织管理。仿真包括:联锁操作终端、车务终端、车务管理终端等终端。";
@ -651,8 +710,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getRailDispatcherFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
private Supplier<MapFunctionCreateVO> getRailDispatcherFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
return () -> {
String name = "调度台";
String desc = "模拟列车调度员工作站,具有运行计划的管理、阶段计划下达、调度命令下达等功能。";
@ -674,8 +733,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getSchedulingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
private Supplier<MapFunctionCreateVO> getSchedulingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
return () -> {
String name = "派班";
String desc = "模拟真实派班员的岗位操作系统,与真实城轨派班员的工作站操控保持一致,学员可根据列车运行图要求和车辆完好情况," +
@ -698,8 +757,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getIscsFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
private Supplier<MapFunctionCreateVO> getIscsFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
return () -> {
String name = "综合监控";
if (systemNameSet.contains(name)) {
@ -720,7 +779,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getRunPlanDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getRunPlanDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "运行图编制";
String desc = "运行图编辑系统是一套在线运行图编辑测试工具软件,具有运行图导入、导出功能及新图测试功能。" +
@ -737,7 +796,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getBigScreenFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getBigScreenFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "中心大屏";
if (systemNameSet.contains(name)) {
@ -752,8 +811,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private Supplier<RtsMapFunctionCreateVO> getDepotILFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
private Supplier<MapFunctionCreateVO> getDepotILFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
return () -> {
String name = "车辆段调度";
String desc = "模拟真实车辆段调度员岗位的操作系统,停车场/车辆段是对车辆进行运营管理、停放及维修、保养的场所,由车场调度员统一指挥。";
@ -775,20 +834,20 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
};
}
private List<Supplier<RtsMapFunctionCreateVO>> buildEmergencyFillCreateVOSuppliers(long mapId, Set<String> systemNameSet,
List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<RtsMapFunctionCreateVO>> fillFunctions = new ArrayList<>();
Supplier<RtsMapFunctionCreateVO> system = getEmergencyFunctionSupplier(mapId, systemNameSet, msgList, simType);
private List<Supplier<MapFunctionCreateVO>> buildEmergencyFillCreateVOSuppliers(long mapId, Set<String> systemNameSet,
List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<MapFunctionCreateVO>> fillFunctions = new ArrayList<>();
Supplier<MapFunctionCreateVO> system = getEmergencyFunctionSupplier(mapId, systemNameSet, msgList, simType);
fillFunctions.add(system);
return fillFunctions;
}
private Supplier<RtsMapFunctionCreateVO> getEmergencyFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
private Supplier<MapFunctionCreateVO> getEmergencyFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
//应急调度指挥系统
Supplier<RtsMapFunctionCreateVO> system = () -> {
Supplier<MapFunctionCreateVO> system = () -> {
String name = "应急调度指挥仿真";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
@ -831,7 +890,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return rtsMapFunctionDAO.selectByExample(example);
}
private interface Group{
private interface Group {
String SIMULATION = "仿真功能";
String TEACH = "教考功能";
String DESIGN = "设计功能";

View File

@ -0,0 +1,22 @@
package club.joylink.rtss.services.mapFunctionTemplate;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateCreateVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateQueryVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateVO;
import java.util.List;
public interface MapFunctionTemplateService {
void create(MapFunctionTemplateCreateVO createVO, long creatorId);
List<MapFunctionTemplateVO> listQuery(MapFunctionTemplateQueryVO queryVO);
MapFunctionTemplateVO update(long id, MapFunctionTemplateCreateVO createVO, long updaterId);
void delete(long id);
List<MapFunctionTemplateVO> queryWithBLOBs(List<Long> templateIds);
PageVO<MapFunctionTemplateVO> pagedQuery(MapFunctionTemplateQueryVO queryVO);
}

View File

@ -0,0 +1,77 @@
package club.joylink.rtss.services.mapFunctionTemplate;
import club.joylink.rtss.dao.MapFunctionTemplateDAO;
import club.joylink.rtss.entity.MapFunctionTemplate;
import club.joylink.rtss.entity.MapFunctionTemplateExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateCreateVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateQueryVO;
import club.joylink.rtss.vo.client.mapFunctionTemplate.MapFunctionTemplateVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class MapFunctionTemplateServiceImpl implements MapFunctionTemplateService {
@Autowired
private MapFunctionTemplateDAO mapFunctionTemplateDAO;
@Override
public void create(MapFunctionTemplateCreateVO createVO, long creatorId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(createVO.getName());
MapFunctionTemplate template = createVO.convert2DB();
template.setCreateTime(LocalDateTime.now());
template.setCreatorId(creatorId);
mapFunctionTemplateDAO.insert(template);
}
@Override
public List<MapFunctionTemplateVO> listQuery(MapFunctionTemplateQueryVO queryVO) {
List<MapFunctionTemplate> entities = mapFunctionTemplateDAO.selectByExampleWithBLOBs(null);
return MapFunctionTemplateVO.convertFrom(entities);
}
@Override
public MapFunctionTemplateVO update(long id, MapFunctionTemplateCreateVO createVO, long updaterId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(createVO.getName());
MapFunctionTemplate entity = createVO.convert2DB();
entity.setId(id);
entity.setUpdateTime(LocalDateTime.now());
entity.setUpdaterId(updaterId);
mapFunctionTemplateDAO.updateByPrimaryKeySelective(entity);
return new MapFunctionTemplateVO(entity);
}
@Override
public void delete(long id) {
mapFunctionTemplateDAO.deleteByPrimaryKey(id);
}
@Override
public List<MapFunctionTemplateVO> queryWithBLOBs(List<Long> templateIds) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(templateIds);
MapFunctionTemplateExample example = new MapFunctionTemplateExample();
example.createCriteria().andIdIn(templateIds);
List<MapFunctionTemplate> templates = mapFunctionTemplateDAO.selectByExampleWithBLOBs(example);
return MapFunctionTemplateVO.convertFrom(templates);
}
@Override
public PageVO<MapFunctionTemplateVO> pagedQuery(MapFunctionTemplateQueryVO queryVO) {
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
List<MapFunctionTemplateVO> vos = listQuery(queryVO);
return PageVO.convert(page, vos);
}
private MapFunctionTemplate get(long id) {
MapFunctionTemplate mapFunctionTemplate = mapFunctionTemplateDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mapFunctionTemplate,
String.format("[id:%s]的模板不存在", id));
return mapFunctionTemplate;
}
}

View File

@ -7,7 +7,7 @@ import club.joylink.rtss.entity.permission.*;
import club.joylink.rtss.services.IPermissionService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionGenerateParamVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionGenerateParamVO;
import club.joylink.rtss.vo.client.permission.PermissionQueryVO;
import club.joylink.rtss.vo.client.permission.PermissionVO;
import club.joylink.rtss.vo.permission.PermissionDistributeStatusEnum;
@ -30,10 +30,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
@ -347,7 +343,7 @@ public class OldPermissionDataSyncService {
}
}
private void generate(Simulation.Type type,MapInfo mi){
RtsMapFunctionGenerateParamVO paramVO = new RtsMapFunctionGenerateParamVO();
MapFunctionGenerateParamVO paramVO = new MapFunctionGenerateParamVO();
paramVO.setSimTypes(Arrays.asList(type));
try{
this.rtsMapFunctionService.generate(mi.getId(),paramVO,0L);

View File

@ -2,17 +2,17 @@ package club.joylink.rtss.services.permission;
import club.joylink.rtss.dao.permission.PermissionSystemAbilityDAO;
import club.joylink.rtss.dao.permission.SystemAbilityDAO;
import club.joylink.rtss.entity.permission.PermissionSystemAbility;
import club.joylink.rtss.entity.permission.PermissionSystemAbilityExample;
import club.joylink.rtss.entity.permission.SystemAbility;
import club.joylink.rtss.entity.permission.SystemAbilityExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionQueryVO;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.vo.permission.*;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionQueryVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.vo.permission.FindAbilityBasicByPageReqVo;
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
import club.joylink.rtss.vo.permission.SystemAbilityRspVo;
import club.joylink.rtss.vo.permission.convertor.SystemAbilityConvertor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -34,9 +34,6 @@ import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import static club.joylink.rtss.vo.permission.SystemAbilityStatus.Editing;
import static club.joylink.rtss.vo.permission.SystemAbilityStatus.Enable;
@Slf4j
@Service
public class SystemAbilityService {
@ -112,10 +109,10 @@ public class SystemAbilityService {
@Transactional(rollbackFor = Exception.class)
public void autoSynchMapSystemData(Long userId){
List<RtsMapFunctionVO> voList = this.rtsMapFunctionService.listQuery(new RtsMapFunctionQueryVO());
List<MapFunctionVO> voList = this.rtsMapFunctionService.listQuery(new MapFunctionQueryVO());
List<SystemAbility> abilities = this.systemAbilityDAO.selectByExample(new SystemAbilityExample());
List<SystemAbility> deleteList = Lists.newArrayList();
List<RtsMapFunctionVO> saveList = Lists.newArrayList();
List<MapFunctionVO> saveList = Lists.newArrayList();
List<SynUpdateVO> updateList = Lists.newArrayList();
if(CollectionUtils.isEmpty(abilities)){
this.batchInsert(voList,userId);
@ -125,7 +122,7 @@ public class SystemAbilityService {
Map<String,SystemAbility> abilityMap = abilities.stream().filter(d->Objects.nonNull(d.getType()) && Objects.nonNull(d.getAbilityId()) || Objects.nonNull(d.getMapId()))
.collect(Collectors.toMap(k->k.getType() + k.getAbilityId() + k.getMapId(), Function.identity()));
Map<String, RtsMapFunctionVO> mapSystemMap = voList.stream().collect(Collectors.toMap(k->k.getSimType().name() + k.getId() + k.getMapId(), Function.identity()));
Map<String, MapFunctionVO> mapSystemMap = voList.stream().collect(Collectors.toMap(k->k.getSimType().name() + k.getId() + k.getMapId(), Function.identity()));
abilityMap.forEach((k,v)->{
if(!mapSystemMap.containsKey(k)){
deleteList.add(v);
@ -145,7 +142,7 @@ public class SystemAbilityService {
}
}
private void batchInsert(List<RtsMapFunctionVO> list, Long userId){
private void batchInsert(List<MapFunctionVO> list, Long userId){
List<SystemAbility> lists = SystemAbilityConvertor.converMapSystemVOToAbility(list);
for (SystemAbility sa : lists) {
sa.setCreateTime(LocalDateTime.now());
@ -183,7 +180,7 @@ public class SystemAbilityService {
@Data
@AllArgsConstructor
public static class SynUpdateVO{
private RtsMapFunctionVO vo;
private MapFunctionVO vo;
private Long abilityId;
}
}

View File

@ -18,7 +18,7 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
@ -72,7 +72,7 @@ public class SimulationServiceImpl implements SimulationService {
}
//只获取所有与该功能相关的权限信息
private List<PermissionSubjectVO> filterUserPermission(List<PermissionSubjectVO> subjectVOList,RtsMapFunctionVO functionVO,LoginUserInfoVO loginUserInfoVO){
private List<PermissionSubjectVO> filterUserPermission(List<PermissionSubjectVO> subjectVOList, MapFunctionVO functionVO, LoginUserInfoVO loginUserInfoVO){
List<PermissionSubjectVO> newVoList = Lists.newArrayList();
for (PermissionSubjectVO subjectVO : subjectVOList) {
if(subjectVO.getStartTime().isAfter(LocalDateTime.now())){
@ -110,7 +110,7 @@ public class SimulationServiceImpl implements SimulationService {
* @param loginInfo
*/
private Map<String,Boolean> checkUserPermission(RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
private Map<String,Boolean> checkUserPermission(MapFunctionVO functionVO, LoginUserInfoVO loginInfo){
if(loginInfo.getAccountVO().isAdmin()){
return Collections.emptyMap();
}
@ -157,7 +157,7 @@ public class SimulationServiceImpl implements SimulationService {
return resultMap2;
}
private List<PermissionSubjectVO> findCanUsedPermission(List<PermissionSubjectVO> newVOLIst, RtsMapFunctionVO functionVO, LoginUserInfoVO loginInfo){
private List<PermissionSubjectVO> findCanUsedPermission(List<PermissionSubjectVO> newVOLIst, MapFunctionVO functionVO, LoginUserInfoVO loginInfo){
List<PermissionSubjectVO> canUseSubjectList = newVOLIst.stream().filter(d->Objects.equals(true,d.getForever())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(canUseSubjectList)){
List<Long> timeOverIdList = newVOLIst.stream().filter(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isAfter(LocalDateTime.now()))
@ -171,7 +171,7 @@ public class SimulationServiceImpl implements SimulationService {
}
return canUseSubjectList;
}
private boolean checkUserPermissionDetail(List<PermissionSubjectVO> newVOLIst,RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
private boolean checkUserPermissionDetail(List<PermissionSubjectVO> newVOLIst, MapFunctionVO functionVO, LoginUserInfoVO loginInfo){
boolean isForever = newVOLIst.stream().anyMatch(d->Objects.equals(true,d.getForever()));
if(Objects.equals(false,isForever)){
boolean timeOver = newVOLIst.stream().allMatch(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isBefore(LocalDateTime.now()));
@ -187,11 +187,11 @@ public class SimulationServiceImpl implements SimulationService {
@Override
public String createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo) {
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
Long mapId = rtsMapFunctionVO.getMapId();
MapFunctionVO mapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
Long mapId = mapFunctionVO.getMapId();
Map<String,Boolean> createUserType = this.checkUserPermission(rtsMapFunctionVO,loginInfo);
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
Map<String,Boolean> createUserType = this.checkUserPermission(mapFunctionVO,loginInfo);
SimulationWorkParamVO workParamVO = mapFunctionVO.getParamVO();
if (workParamVO.containsRealDeviceItem()) {
//有实体设备加载项的地图功能实训室同时只能存在一个
@ -320,13 +320,13 @@ public class SimulationServiceImpl implements SimulationService {
@Override
public Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo, boolean checkAuth) {
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
Long mapId = rtsMapFunctionVO.getMapId();
MapFunctionVO mapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
Long mapId = mapFunctionVO.getMapId();
Map<String,Boolean> createUserType = Maps.newHashMap();
if (checkAuth) {
createUserType = this.checkUserPermission(rtsMapFunctionVO,loginInfo);
createUserType = this.checkUserPermission(mapFunctionVO,loginInfo);
}
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
SimulationWorkParamVO workParamVO = mapFunctionVO.getParamVO();
if (workParamVO.containsRealDeviceItem()) {
//有实体设备加载项的地图功能实训室同时只能存在一个

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.vo.client.mapFunction;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 地图功能描述修改参数
*/
@Getter
@Setter
@NoArgsConstructor
public class MapFunctionBatchModifyVO {
/**
* 线路功能描述修改参数
*/
private DescModifyParamVO descModifyParamVO;
/**
* 线路功能bgUrl修改参数
*/
private BgUrlModifyParamVO bgUrlModifyParamVO;
@Getter
@Setter
@NoArgsConstructor
public class DescModifyParamVO {
/**
* 线路功能名称作为where条件
*/
private String functionName;
/**
* 原来的描述作为where条件
*/
private String originDesc;
/**
* 新的描述
*/
private String newDesc;
}
@Getter
@Setter
@NoArgsConstructor
public class BgUrlModifyParamVO {
/**
* 线路功能名称作为where条件
*/
private String functionName;
/**
* 原来的bgUrl作为where条件
*/
private String originBgUrl;
/**
* 新的bgUrl
*/
private String newBgUrl;
}
}

View File

@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionCreateVO {
public class MapFunctionCreateVO {
@NotNull(message = "地图id不能为空")
private Long mapId;

View File

@ -14,7 +14,7 @@ import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionGenerateParamVO {
public class MapFunctionGenerateParamVO {
/** 要生成子系统的仿真系统类型 */
@NotEmpty(message = "要生成子系统的仿真系统类型不能为空")
private List<Simulation.Type> simTypes;

View File

@ -0,0 +1,24 @@
package club.joylink.rtss.vo.client.mapFunction;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
/**
* 地图功能生成参数
*/
@Getter
@Setter
@NoArgsConstructor
public class MapFunctionGenerateVO {
private List<Long> templateIds;
private List<Long> mapIds;
/**
* 覆盖同名地图功能
*/
private boolean overwrite;
}

View File

@ -9,10 +9,16 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionQueryVO extends PageQueryVO {
public class MapFunctionQueryVO extends PageQueryVO {
private Long mapId;
private String name;
private Simulation.Type simType;
/**
* 是否需要详细信息
* todo
*/
private boolean detail = true;
}

View File

@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionUpdateVO {
public class MapFunctionUpdateVO {
@NotBlank(message = "名称不能为空")
private String name;
@ -21,14 +21,27 @@ public class RtsMapFunctionUpdateVO {
private String bgUrl;
private String subset;
@NotNull(message = "参数不能为空")
private SimulationWorkParamVO paramVO;
public MapFunctionUpdateVO(MapFunctionCreateVO createVO) {
name = createVO.getName();
desc = createVO.getDesc();
bgUrl = createVO.getBgUrl();
subset = createVO.getSubset();
paramVO = createVO.getParamVO();
}
public void override(RtsMapFunction entity) {
entity.setName(name);
entity.setDesc(desc);
entity.setBgUrl(bgUrl);
entity.setGroup(subset);
entity.setType(paramVO.getType().name());
entity.setParam(JsonUtils.writeValueAsString(paramVO));
}
}

View File

@ -7,13 +7,14 @@ import club.joylink.rtss.util.JsonUtils;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionVO {
public class MapFunctionVO {
private Long id;
private Long mapId;
@ -38,8 +39,7 @@ public class RtsMapFunctionVO {
private LocalDateTime updateTime;
public RtsMapFunctionVO(RtsMapFunction entity) {
public MapFunctionVO(RtsMapFunction entity) {
id = entity.getId();
mapId = entity.getMapId();
name = entity.getName();
@ -47,7 +47,9 @@ public class RtsMapFunctionVO {
bgUrl = entity.getBgUrl();
simType = Simulation.Type.valueOf(entity.getType());
subset = entity.getGroup();
paramVO = JsonUtils.read(entity.getParam(), SimulationWorkParamVO.class);
if (StringUtils.hasText(entity.getParam())) {
paramVO = JsonUtils.read(entity.getParam(), SimulationWorkParamVO.class);
}
creatorId = entity.getCreatorId();
createTime = entity.getCreateTime();
updaterId = entity.getUpdaterId();

View File

@ -1,35 +0,0 @@
package club.joylink.rtss.vo.client.mapFunction;
import club.joylink.rtss.entity.RtsMapFunction;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 地图功能描述修改参数
*/
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionDescModifyVO {
/**
* 功能名称与下面的原描述以或的关系作为更新条件
*/
private String functionName;
/**
* 原描述
*/
private String originalDesc;
/**
* 新描述
*/
private String newDesc;
public RtsMapFunction convert2DB() {
RtsMapFunction entity = new RtsMapFunction();
entity.setDesc(newDesc);
return entity;
}
}

View File

@ -0,0 +1,18 @@
package club.joylink.rtss.vo.client.mapFunctionTemplate;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 地图功能模板辅助参数
*/
@Getter
@Setter
@NoArgsConstructor
public class AssistantParamVO {
/**
* 默认成员类型
*/
private String defaultMemberType;
}

View File

@ -0,0 +1,31 @@
package club.joylink.rtss.vo.client.mapFunctionTemplate;
import club.joylink.rtss.entity.MapFunctionTemplate;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionCreateVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class MapFunctionTemplateCreateVO {
private String name;
private MapFunctionCreateVO mapFunctionParam;
private AssistantParamVO assistantParam;
public MapFunctionTemplate convert2DB() {
MapFunctionTemplate entity = new MapFunctionTemplate();
entity.setName(name);
if (assistantParam != null) {
entity.setAssistantParam(JsonUtils.writeValueAsString(assistantParam));
}
if (mapFunctionParam != null) {
entity.setMapFunctionParam(JsonUtils.writeValueAsString(mapFunctionParam));
}
return entity;
}
}

View File

@ -0,0 +1,10 @@
package club.joylink.rtss.vo.client.mapFunctionTemplate;
import club.joylink.rtss.vo.client.PageQueryVO;
public class MapFunctionTemplateQueryVO extends PageQueryVO {
/**
* 需要详细信息
*/
private boolean detail;
}

View File

@ -0,0 +1,54 @@
package club.joylink.rtss.vo.client.mapFunctionTemplate;
import club.joylink.rtss.entity.MapFunctionTemplate;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionCreateVO;
import lombok.Getter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
@Getter
public class MapFunctionTemplateVO {
private Long id;
private String name;
private MapFunctionCreateVO mapFunctionParam;
private AssistantParamVO assistantParam;
private LocalDateTime createTime;
private Long creatorId;
private LocalDateTime updateTime;
private Long updaterId;
public MapFunctionTemplateVO(MapFunctionTemplate entity) {
id = entity.getId();
name = entity.getName();
mapFunctionParam = StringUtils.hasText(entity.getMapFunctionParam()) ?
JsonUtils.read(entity.getMapFunctionParam(), MapFunctionCreateVO.class) : null;
assistantParam = StringUtils.hasText(entity.getAssistantParam()) ?
JsonUtils.read(entity.getAssistantParam(), AssistantParamVO.class) : null;
createTime = entity.getCreateTime();
creatorId = entity.getCreatorId();
updateTime = entity.getUpdateTime();
updaterId = entity.getUpdaterId();
}
public static List<MapFunctionTemplateVO> convertFrom(Collection<MapFunctionTemplate> entities) {
if (!CollectionUtils.isEmpty(entities)) {
return entities.stream().map(MapFunctionTemplateVO::new).collect(Collectors.toList());
} else {
return new ArrayList<>();
}
}
}

View File

@ -2,10 +2,9 @@ package club.joylink.rtss.vo.permission.convertor;
import club.joylink.rtss.entity.permission.SystemAbility;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.vo.permission.PermissionAbilityRspVo;
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
import club.joylink.rtss.vo.permission.SystemAbilityType;
import com.google.common.collect.Lists;
import java.util.List;
@ -24,7 +23,7 @@ public class SystemAbilityConvertor {
return rt;
}
public static SystemAbility converMapSystemVOToAbility(RtsMapFunctionVO vo){
public static SystemAbility converMapSystemVOToAbility(MapFunctionVO vo){
SystemAbility sa = new SystemAbility();
sa.setName(vo.getName());
sa.setAbilityId(vo.getId());
@ -33,9 +32,9 @@ public class SystemAbilityConvertor {
return sa;
}
public static List<SystemAbility> converMapSystemVOToAbility(List<RtsMapFunctionVO> vo){
public static List<SystemAbility> converMapSystemVOToAbility(List<MapFunctionVO> vo){
List<SystemAbility> list = Lists.newArrayList();
for (RtsMapFunctionVO mapSystemVO : vo) {
for (MapFunctionVO mapSystemVO : vo) {
list.add(converMapSystemVOToAbility(mapSystemVO));
}
return list;

View File

@ -0,0 +1,314 @@
<?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.MapFunctionTemplateDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.MapFunctionTemplate">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="assistant_param" jdbcType="VARCHAR" property="assistantParam" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="updater_id" jdbcType="BIGINT" property="updaterId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.MapFunctionTemplate">
<result column="map_function_param" jdbcType="LONGVARCHAR" property="mapFunctionParam" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, assistant_param, create_time, creator_id, update_time, updater_id
</sql>
<sql id="Blob_Column_List">
map_function_param
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.MapFunctionTemplateExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_map_function_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.MapFunctionTemplateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from rts_map_function_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_map_function_template
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_map_function_template
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.MapFunctionTemplateExample">
delete from rts_map_function_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapFunctionTemplate" useGeneratedKeys="true">
insert into rts_map_function_template (`name`, assistant_param, create_time,
creator_id, update_time, updater_id,
map_function_param)
values (#{name,jdbcType=VARCHAR}, #{assistantParam,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{creatorId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT},
#{mapFunctionParam,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapFunctionTemplate" useGeneratedKeys="true">
insert into rts_map_function_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="assistantParam != null">
assistant_param,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updaterId != null">
updater_id,
</if>
<if test="mapFunctionParam != null">
map_function_param,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="assistantParam != null">
#{assistantParam,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updaterId != null">
#{updaterId,jdbcType=BIGINT},
</if>
<if test="mapFunctionParam != null">
#{mapFunctionParam,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.MapFunctionTemplateExample" resultType="java.lang.Long">
select count(*) from rts_map_function_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update rts_map_function_template
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.assistantParam != null">
assistant_param = #{record.assistantParam,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updaterId != null">
updater_id = #{record.updaterId,jdbcType=BIGINT},
</if>
<if test="record.mapFunctionParam != null">
map_function_param = #{record.mapFunctionParam,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update rts_map_function_template
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
assistant_param = #{record.assistantParam,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
updater_id = #{record.updaterId,jdbcType=BIGINT},
map_function_param = #{record.mapFunctionParam,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_map_function_template
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
assistant_param = #{record.assistantParam,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
updater_id = #{record.updaterId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.MapFunctionTemplate">
update rts_map_function_template
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="assistantParam != null">
assistant_param = #{assistantParam,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updaterId != null">
updater_id = #{updaterId,jdbcType=BIGINT},
</if>
<if test="mapFunctionParam != null">
map_function_param = #{mapFunctionParam,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.MapFunctionTemplate">
update rts_map_function_template
set `name` = #{name,jdbcType=VARCHAR},
assistant_param = #{assistantParam,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater_id = #{updaterId,jdbcType=BIGINT},
map_function_param = #{mapFunctionParam,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.MapFunctionTemplate">
update rts_map_function_template
set `name` = #{name,jdbcType=VARCHAR},
assistant_param = #{assistantParam,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater_id = #{updaterId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -5,9 +5,9 @@ import club.joylink.rtss.services.mapFunction.RtsMapFunctionServiceImpl;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionCreateVO;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionQueryVO;
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionCreateVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionQueryVO;
import club.joylink.rtss.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapMemberVO;
import org.junit.jupiter.api.Test;
@ -54,7 +54,7 @@ class RtsMapFunctionServiceImplTest {
.filter(mVO -> Objects.equals(mVO.getType(), SimulationMember.Type.DISPATCHER))
.findFirst().get();
RtsMapFunctionCreateVO createVO = new RtsMapFunctionCreateVO();
MapFunctionCreateVO createVO = new MapFunctionCreateVO();
createVO.setMapId(mapId);
createVO.setName(systemName);
SimulationWorkParamVO paramVO = new SimulationWorkParamVO();
@ -63,10 +63,10 @@ class RtsMapFunctionServiceImplTest {
paramVO.setDomConfig(SimulationWorkParamVO.DomConfigVO.builder().singleMember(true).build());
rtsMapFunctionService.create(createVO, creatorId);
RtsMapFunctionQueryVO queryVO = new RtsMapFunctionQueryVO();
MapFunctionQueryVO queryVO = new MapFunctionQueryVO();
queryVO.setMapId(mapId);
List<RtsMapFunctionVO> list = rtsMapFunctionService.listQuery(queryVO);
Set<String> collect = list.stream().map(RtsMapFunctionVO::getName).collect(Collectors.toSet());
List<MapFunctionVO> list = rtsMapFunctionService.listQuery(queryVO);
Set<String> collect = list.stream().map(MapFunctionVO::getName).collect(Collectors.toSet());
assertTrue(collect.contains(systemName), "地图子系统创建后查询不到记录");
//error
}