Merge remote-tracking branch 'remotes/origin/test-training2' into test-module

# Conflicts:
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/controller/publish/MapFunctionController.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/controller/training2/TrainingV2PublishController.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/dao/MapFunctionTemplateDAO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/entity/MapFunctionTemplate.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/entity/MapFunctionTemplateExample.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/services/mapFunction/RtsMapFunctionServiceImpl.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/services/org/OrgProjectService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/services/paper/PaperUserSubmitAnswerService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/services/permission/OldPermissionDataSyncService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/services/permission/SystemAbilityService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/services/training2/Training2DraftService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/ATS/operation/vo/OperationModeParam.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/ATS/operation/vo/RouteModelParam.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/ATS/service/AtsStationService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/CI/CiLogic.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/CI/device/CiRouteService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/SimulationServiceImpl.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/data/storage/device/StorageStation.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/data/vr/VirtualRealityPsl.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/simulation/cbtc/onboard/ATP/ATPService.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionBatchModifyVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionCreateVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionGenerateParamVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionGenerateVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionQueryVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionUpdateVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/MapFunctionVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/RtsMapFunctionCreateVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/RtsMapFunctionGenerateParamVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/RtsMapFunctionQueryVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/RtsMapFunctionUpdateVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/client/mapFunction/RtsMapFunctionVO.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/permission/convertor/SystemAbilityConvertor.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/vo/training2/draft/UpdateStepReqVo.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/websocket/WebsocketConfig.java
#	jl-rtss-manage/src/main/java/club/joylink/rtss/manage/websocket/interceptor/VSimpleInterceptor.java
#	jl-rtss-manage/src/main/resources/mybatis/mapper/MapFunctionTemplateDAO.xml
#	jl-rtss-manage/src/test/java/club/joylink/rtss/manage/services/mapSystem/RtsMapFunctionServiceImplTest.java
#	src/main/java/club/joylink/rtss/vo/client/mapFunction/RtsMapFunctionCreateVO.java
#	src/main/java/club/joylink/rtss/vo/client/mapFunction/RtsMapFunctionGenerateParamVO.java
#	src/main/java/club/joylink/rtss/vo/client/mapFunction/RtsMapFunctionQueryVO.java
#	src/main/java/club/joylink/rtss/vo/client/mapFunction/RtsMapFunctionUpdateVO.java
#	src/main/java/club/joylink/rtss/vo/client/mapFunction/RtsMapFunctionVO.java
#	src/main/resources/application.yml
This commit is contained in:
weizhihong 2023-02-23 17:55:24 +08:00
commit bbb8c7588b
100 changed files with 2818 additions and 981 deletions

View File

@ -87,6 +87,7 @@ public class LoginController {
@GetMapping(path = "/getUserInfo")
public AccountVO getUserInfo(String token) {
LoginUserInfoVO loginUserInfoVO = this.iAuthenticateService.getLoginUserInfoByToken(token);
System.out.println(String.format("%s ====%s =========== from getUserInfo",loginUserInfoVO,loginUserInfoVO.getAccountVO().getCompanyId()));
return loginUserInfoVO.getAccountVO();
}

View File

@ -21,6 +21,8 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static club.joylink.rtss.manage.controller.advice.AuthenticateInterceptor.LOGIN_INFO_KEY;
/**
* 组织-项目关系管理接口
*/
@ -44,7 +46,7 @@ public class OrgProjectController {
* 选择登入组织(目前先查询顶级组织)
*/
@PutMapping("signIn/{orgId}")
public void signInOrg(@PathVariable Long orgId, @RequestAttribute LoginUserInfoVO loginInfo) {
public void signInOrg(@PathVariable Long orgId, @RequestAttribute(name = LOGIN_INFO_KEY) LoginUserInfoVO loginInfo) {
orgProjectService.signInOrg(orgId, loginInfo);
}

View File

@ -5,11 +5,15 @@ import club.joylink.rtss.manage.controller.advice.Role;
import club.joylink.rtss.manage.dao.RtsMapFunctionDAO;
import club.joylink.rtss.manage.services.IMapService;
import club.joylink.rtss.manage.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.manage.services.mapFunctionTemplate.MapFunctionTemplateService;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.vo.AccountVO;
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import club.joylink.rtss.manage.vo.client.PageVO;
import club.joylink.rtss.manage.vo.client.mapFunction.*;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateCreateVO;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateQueryVO;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateVO;
import club.joylink.rtss.manage.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,20 +59,20 @@ public class MapFunctionController {
* 列表查询地图功能
*/
@GetMapping("/list")
public List<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO) {
public List<MapFunctionVO> listQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.listQuery(queryVO);
}
/**
* 分页查询地图功能
* 分页查询地图功能
*/
@GetMapping("/paged")
public PageVO<RtsMapFunctionVO> pagedQuery(RtsMapFunctionQueryVO queryVO) {
public PageVO<MapFunctionVO> pagedQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.pagedQuery(queryVO);
}
/**
* 删除地图功能
* 删除地图功能
*/
@Role(RoleEnum.Admin)
@DeleteMapping("/{id}")
@ -83,11 +90,11 @@ 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);
}
@ -109,6 +116,64 @@ public class MapFunctionController {
rtsMapFunctionService.updateGroup(groupMap, user.getId());
}
/**
* 跨线路批量修改线路功能
*/
@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
private IMapService iMapService;
@Autowired
@ -139,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

@ -131,8 +131,8 @@ public class TrainingDraftV2Controller {
*/
@PutMapping("/{group}/{trainingId}/step/update")
public void updateSteps(@PathVariable("group") String group, @PathVariable("trainingId") Long trainingId
, @RequestBody List<Step2VO> step2VOList) {
training2DraftService.updateSteps(group, trainingId, step2VOList);
, @RequestBody UpdateStepReqVo reqParam) {
training2DraftService.updateSteps(group, trainingId, reqParam);
}
/**

View File

@ -1,9 +1,10 @@
package club.joylink.rtss.manage.controller.training2;
import club.joylink.rtss.manage.constants.RoleEnum;
import club.joylink.rtss.manage.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.manage.controller.advice.Role;
import club.joylink.rtss.manage.services.training2.Training2PublishService;
import club.joylink.rtss.manage.services.training2.Training2TypeEnum;
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import club.joylink.rtss.manage.vo.client.PageVO;
import club.joylink.rtss.manage.vo.training2.publish.*;
import lombok.extern.slf4j.Slf4j;
@ -68,9 +69,11 @@ public class TrainingV2PublishController {
* @return
*/
@PostMapping("/infos")
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@RequestBody PublishedTrainingListRspVo vo){
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@RequestBody PublishedTrainingListRspVo vo
,@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
//只查询以上架
vo.setState(1);
vo.setOrgId(loginUserInfoVO.getTopOrgId());
return this.publishService.findTrainingInfo(vo);
}
/**

View File

@ -0,0 +1,40 @@
package club.joylink.rtss.manage.dao;
import club.joylink.rtss.manage.entity.MapFunctionTemplate;
import club.joylink.rtss.manage.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.manage.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.manage.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

@ -15,24 +15,17 @@ public class RtsMapFunction implements Serializable {
*/
private Long mapId;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String desc;
/**
* 仿真类型
* 背景图片的url
*/
private String bgUrl;
private String type;
/**
* 分组
*/
private String group;
/**
@ -94,6 +87,14 @@ public class RtsMapFunction implements Serializable {
this.desc = desc;
}
public String getBgUrl() {
return bgUrl;
}
public void setBgUrl(String bgUrl) {
this.bgUrl = bgUrl;
}
public String getType() {
return type;
}
@ -166,6 +167,7 @@ public class RtsMapFunction implements Serializable {
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
&& (this.getBgUrl() == null ? other.getBgUrl() == null : this.getBgUrl().equals(other.getBgUrl()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getGroup() == null ? other.getGroup() == null : this.getGroup().equals(other.getGroup()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
@ -183,6 +185,7 @@ public class RtsMapFunction implements Serializable {
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
result = prime * result + ((getBgUrl() == null) ? 0 : getBgUrl().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getGroup() == null) ? 0 : getGroup().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
@ -203,6 +206,7 @@ public class RtsMapFunction implements Serializable {
sb.append(", mapId=").append(mapId);
sb.append(", name=").append(name);
sb.append(", desc=").append(desc);
sb.append(", bgUrl=").append(bgUrl);
sb.append(", type=").append(type);
sb.append(", group=").append(group);
sb.append(", creatorId=").append(creatorId);

View File

@ -385,6 +385,76 @@ public class RtsMapFunctionExample {
return (Criteria) this;
}
public Criteria andBgUrlIsNull() {
addCriterion("bg_url is null");
return (Criteria) this;
}
public Criteria andBgUrlIsNotNull() {
addCriterion("bg_url is not null");
return (Criteria) this;
}
public Criteria andBgUrlEqualTo(String value) {
addCriterion("bg_url =", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlNotEqualTo(String value) {
addCriterion("bg_url <>", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlGreaterThan(String value) {
addCriterion("bg_url >", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlGreaterThanOrEqualTo(String value) {
addCriterion("bg_url >=", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlLessThan(String value) {
addCriterion("bg_url <", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlLessThanOrEqualTo(String value) {
addCriterion("bg_url <=", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlLike(String value) {
addCriterion("bg_url like", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlNotLike(String value) {
addCriterion("bg_url not like", value, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlIn(List<String> values) {
addCriterion("bg_url in", values, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlNotIn(List<String> values) {
addCriterion("bg_url not in", values, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlBetween(String value1, String value2) {
addCriterion("bg_url between", value1, value2, "bgUrl");
return (Criteria) this;
}
public Criteria andBgUrlNotBetween(String value1, String value2) {
addCriterion("bg_url not between", value1, value2, "bgUrl");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;

View File

@ -306,132 +306,132 @@ public class MinioFileInfoExample {
}
public Criteria andFilenameIsNull() {
addCriterion("fileName is null");
addCriterion("file_name is null");
return (Criteria) this;
}
public Criteria andFilenameIsNotNull() {
addCriterion("fileName is not null");
addCriterion("file_name is not null");
return (Criteria) this;
}
public Criteria andFilenameEqualTo(String value) {
addCriterion("fileName =", value, "filename");
addCriterion("file_name =", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameNotEqualTo(String value) {
addCriterion("fileName <>", value, "filename");
addCriterion("file_name <>", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameGreaterThan(String value) {
addCriterion("fileName >", value, "filename");
addCriterion("file_name >", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameGreaterThanOrEqualTo(String value) {
addCriterion("fileName >=", value, "filename");
addCriterion("file_name >=", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameLessThan(String value) {
addCriterion("fileName <", value, "filename");
addCriterion("file_name <", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameLessThanOrEqualTo(String value) {
addCriterion("fileName <=", value, "filename");
addCriterion("file_name <=", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameLike(String value) {
addCriterion("fileName like", value, "filename");
addCriterion("file_name like", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameNotLike(String value) {
addCriterion("fileName not like", value, "filename");
addCriterion("file_name not like", value, "filename");
return (Criteria) this;
}
public Criteria andFilenameIn(List<String> values) {
addCriterion("fileName in", values, "filename");
addCriterion("file_name in", values, "filename");
return (Criteria) this;
}
public Criteria andFilenameNotIn(List<String> values) {
addCriterion("fileName not in", values, "filename");
addCriterion("file_name not in", values, "filename");
return (Criteria) this;
}
public Criteria andFilenameBetween(String value1, String value2) {
addCriterion("fileName between", value1, value2, "filename");
addCriterion("file_name between", value1, value2, "filename");
return (Criteria) this;
}
public Criteria andFilenameNotBetween(String value1, String value2) {
addCriterion("fileName not between", value1, value2, "filename");
addCriterion("file_name not between", value1, value2, "filename");
return (Criteria) this;
}
public Criteria andCreatetimeIsNull() {
addCriterion("createTime is null");
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreatetimeIsNotNull() {
addCriterion("createTime is not null");
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreatetimeEqualTo(Date value) {
addCriterion("createTime =", value, "createtime");
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeNotEqualTo(Date value) {
addCriterion("createTime <>", value, "createtime");
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeGreaterThan(Date value) {
addCriterion("createTime >", value, "createtime");
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeGreaterThanOrEqualTo(Date value) {
addCriterion("createTime >=", value, "createtime");
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeLessThan(Date value) {
addCriterion("createTime <", value, "createtime");
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeLessThanOrEqualTo(Date value) {
addCriterion("createTime <=", value, "createtime");
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeIn(List<Date> values) {
addCriterion("createTime in", values, "createtime");
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeNotIn(List<Date> values) {
addCriterion("createTime not in", values, "createtime");
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeBetween(Date value1, Date value2) {
addCriterion("createTime between", value1, value2, "createtime");
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreatetimeNotBetween(Date value1, Date value2) {
addCriterion("createTime not between", value1, value2, "createtime");
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}

View File

@ -13,9 +13,11 @@ import com.github.pagehelper.PageHelper;
import io.minio.http.Method;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -46,6 +48,14 @@ public class MinioServiceImpl implements MinioService {
@Override
public void saveFileInfo(AccountVO user, MinioFileInfo minioFileInfo) {
// 检查数据库中是否已存在记录
MinioFileInfoExample example = new MinioFileInfoExample();
MinioFileInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(1);
criteria.andDirectoryEqualTo(minioFileInfo.getDirectory()).andFilenameEqualTo(minioFileInfo.getFileName());
List<MinioFileInfo> oldMinioFile = this.minioFileInfoDao.selectByExample(example);
if (!CollectionUtils.isEmpty(oldMinioFile)) { // 删除旧数据
oldMinioFile.forEach(m -> this.delete(m.getId()));
}
minioFileInfo.setCreator(user.getId());
minioFileInfo.setCreateTime(LocalDateTime.now());
minioFileInfo.setStatus(1);

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);
/**
* 生成大客流线路功能
@ -50,4 +50,11 @@ public interface RtsMapFunctionService {
List<String> transferOldData(Long mapId);
void updateGroup(Map<String, List<Long>> groupMap, Long updaterId);
/**
* 批量修改线路功能数据目前所有的where条件见参数的注释为或
*/
void batchModify(MapFunctionBatchModifyVO vo);
List<String> generateFromTemplate(MapFunctionGenerateVO vo, Long userId);
}

View File

@ -11,6 +11,7 @@ import club.joylink.rtss.manage.entity.RtsMapFunction;
import club.joylink.rtss.manage.entity.RtsMapFunctionExample;
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.manage.services.IMapService;
import club.joylink.rtss.manage.services.mapFunctionTemplate.MapFunctionTemplateService;
import club.joylink.rtss.manage.services.publishData.MapPassengerFlowDataService;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.simulation.cbtc.member.SimulationMember;
@ -18,9 +19,11 @@ import club.joylink.rtss.manage.simulation.cbtc.training2.Training2;
import club.joylink.rtss.manage.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.manage.vo.client.PageVO;
import club.joylink.rtss.manage.vo.client.mapFunction.*;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateVO;
import club.joylink.rtss.manage.vo.client.passenger.MapPassengerFlowVO;
import club.joylink.rtss.manage.vo.map.MapVO;
import club.joylink.rtss.manage.vo.map.graph.MapMemberVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +35,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 +47,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 +67,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 +76,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 +91,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 +121,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 +143,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 +183,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 +242,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 +288,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 {
@ -323,9 +334,107 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
});
}
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 void batchModify(MapFunctionBatchModifyVO vo) {
MapFunctionBatchModifyVO.DescModifyParamVO descModifyParamVO = vo.getDescModifyParamVO();
MapFunctionBatchModifyVO.BgUrlModifyParamVO bgUrlModifyParamVO = vo.getBgUrlModifyParamVO();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(descModifyParamVO != null || bgUrlModifyParamVO != null);
if (descModifyParamVO != null) {
String functionName = descModifyParamVO.getFunctionName();
String originDesc = descModifyParamVO.getOriginDesc();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL
.assertTrue(StringUtils.hasText(functionName)
|| StringUtils.hasText(originDesc));
RtsMapFunctionExample example = new RtsMapFunctionExample();
if (StringUtils.hasText(functionName)) {
example.or().andNameEqualTo(functionName);
}
if (StringUtils.hasText(originDesc)) {
example.or().andDescEqualTo(originDesc);
}
RtsMapFunction mapFunction = new RtsMapFunction();
mapFunction.setDesc(descModifyParamVO.getNewDesc());
rtsMapFunctionDAO.updateByExampleSelective(mapFunction, example);
}
if (bgUrlModifyParamVO != null) {
String functionName = bgUrlModifyParamVO.getFunctionName();
String originBgUrl = bgUrlModifyParamVO.getOriginBgUrl();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL
.assertTrue(StringUtils.hasText(functionName)
|| StringUtils.hasText(originBgUrl));
RtsMapFunctionExample example = new RtsMapFunctionExample();
if (StringUtils.hasText(functionName)) {
example.or().andNameEqualTo(functionName);
}
if (StringUtils.hasText(originBgUrl)) {
example.or().andBgUrlEqualTo(originBgUrl);
}
RtsMapFunction mapFunction = new RtsMapFunction();
mapFunction.setBgUrl(bgUrlModifyParamVO.getNewBgUrl());
rtsMapFunctionDAO.updateByExampleSelective(mapFunction, example);
}
}
@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);
@ -339,7 +448,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
/**
* 构建提供{@link RtsMapFunctionCreateVO}的方法
* 构建提供{@link MapFunctionCreateVO}的方法
*
* @param mapId
* @param systemNameSet 已存在的子系统名称这些子系统不再生成
@ -347,26 +456,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);
@ -381,7 +490,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 = "根据用户需求不同,搭配硬件设备组件实训室,进行软硬件的联动培训。";
@ -399,10 +508,10 @@ 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 = "辅助学员及老师完成自主线路设计的软件系统。设计完成后的线路能够进行校验、修正、列车运行等功能,能有效的帮助老师及学生完成课程设计";
String desc = "可编制单岗位的站场图设备操作或设计多岗位的脚本化场景以供单操实训或场景实训使用";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -423,12 +532,11 @@ 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 = "综合演练";
String desc = "将不同岗位赋予不同的学员端,实现多岗位联合互动培训演练,通过场景脚本化技术,实现处置流程的多变性," +
"所有岗位的交互操作利用软件即可,不受硬件限制,增加实训的灵活性。同时也具备与硬件联动的接口和条件。";
String desc = "实现多岗位联合互动培训演练,以房间为单元,所有岗位人员实时在线参与,以模拟实际地铁运营中正常/非正常情况下的各岗位的处理能力。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -449,11 +557,10 @@ 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 = "考试系统模块具有自定义考试规则、自动生成考卷、学员成绩统计、数据曲线分析及题库管理等功能," +
"从实战操作、业务流程、故障模拟及考试规则等多角度出发,形成最符合用户需求的城市轨道交通在线交互实操类考试系统。";
String desc = "从理论、单操实训、场景实训三个方面进行设计、用户可在该功能中在线实时考试,自动评分。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -466,11 +573,11 @@ 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 = "以不同故障场景为剧本,培训各岗位在故障情境下的配合调度能力,包含各个故障场景下的标准应急流程及联动用语。" +
"如缺少人员,可由机器人顶替岗位";
"用户可选择某一角色进行练习,其他岗位由机器人自动应答指令,自动执行信号系统相关操作";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -485,11 +592,10 @@ 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 = "针对行调及行值人员的具体功能操作进行解析形成专业实操课程。" +
"单操实训系统具有教学、练习及测验三种模式,能使学员由浅及深,循序渐进的熟练掌握操作流程。";
String desc = "针对行调及行值人员的具体功能操作进行解析形成专业实操课程。单操实训系统具有教学、练习及测验三种模式。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -503,13 +609,11 @@ 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 = "桌面版模拟驾驶仿真系统,使用鼠标操作。" +
"操作驾驶界面与真实车辆驾驶台保持一致,可完成对列车驾驶的操作动作、技术、规则和技巧的练习。" +
"能够实现与行车调度的联动培训,能够完成司机模拟驾驶培训。";
String desc = "桌面版模拟驾驶仿真系统,操作驾驶界面与真实车辆驾驶台保持一致,可完成对列车驾驶的操作动作、技术、规则和技巧的练习。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -531,13 +635,12 @@ 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 = "车站仿真";
String desc = "仿真真实设备集中站/非设备集中站行车值班员岗位操作系统,仿真系统可实现但不限于如下功能:" +
"站场图显示、进路办理/取消、信号控制、道岔操作、限速控制、车站控制模式转换。";
String desc = "车站仿真是面向地铁运营的行车值班员操作技能和专业能力培训的功能,能够实现设备的各种正常操作及常见故障仿真。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -557,12 +660,11 @@ 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 = "模拟真实行车调度员岗位的操作系统,用于调度员完成调度和运营作业。调度员通过调度终端屏幕," +
"实时了解和掌握列车的实际运行情况,可以在调度工作站上发出指令,用于直接指挥列车运行。";
String desc = "调度仿真是面向地铁运营的行车调度员操作技能和专业能力培训的功能,能够实现设备的各种正常操作及常见故障仿真。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
@ -583,30 +685,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);
@ -619,8 +721,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 = "模拟列车值班员工作站,用于完成铁路运输接发列车工作、铁路运输行车指挥协调、组织管理。仿真包括:联锁操作终端、车务终端、车务管理终端等终端。";
@ -643,8 +745,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 = "模拟列车调度员工作站,具有运行计划的管理、阶段计划下达、调度命令下达等功能。";
@ -666,11 +768,11 @@ 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 = "仿真真实派班员的岗位操作系统,与真实城轨派班员的工作站操控保持一致,学员可根据列车运行图要求和车辆完好情况," +
String desc = "模拟真实派班员的岗位操作系统,与真实城轨派班员的工作站操控保持一致,学员可根据列车运行图要求和车辆完好情况," +
"合理编排好司机每日运用车辆计划,系统也可自动生成派班计划,简化派班计划管理的复杂性。";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
@ -690,8 +792,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)) {
@ -712,7 +814,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 = "运行图编辑系统是一套在线运行图编辑测试工具软件,具有运行图导入、导出功能及新图测试功能。" +
@ -729,7 +831,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)) {
@ -744,8 +846,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 = "模拟真实车辆段调度员岗位的操作系统,停车场/车辆段是对车辆进行运营管理、停放及维修、保养的场所,由车场调度员统一指挥。";
@ -767,20 +869,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));
@ -823,7 +925,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.manage.services.mapFunctionTemplate;
import club.joylink.rtss.manage.vo.client.PageVO;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateCreateVO;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateQueryVO;
import club.joylink.rtss.manage.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.manage.services.mapFunctionTemplate;
import club.joylink.rtss.manage.dao.MapFunctionTemplateDAO;
import club.joylink.rtss.manage.entity.MapFunctionTemplate;
import club.joylink.rtss.manage.entity.MapFunctionTemplateExample;
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.manage.vo.client.PageVO;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateCreateVO;
import club.joylink.rtss.manage.vo.client.mapFunctionTemplate.MapFunctionTemplateQueryVO;
import club.joylink.rtss.manage.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

@ -5,6 +5,7 @@ import club.joylink.rtss.manage.dao.OrgDAO;
import club.joylink.rtss.manage.dao.OrgProjectDAO;
import club.joylink.rtss.manage.dao.OrgUserDAO;
import club.joylink.rtss.manage.entity.*;
import club.joylink.rtss.manage.services.LoginSessionManager;
import club.joylink.rtss.manage.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.manage.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.manage.vo.AccountVO;
@ -12,6 +13,7 @@ import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import club.joylink.rtss.manage.vo.client.org.OrgProjectVO;
import club.joylink.rtss.manage.vo.client.org.OrgVO;
import club.joylink.rtss.manage.vo.project.ProjectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -76,12 +78,15 @@ public class OrgProjectService implements IOrgProjectService {
List<Org> orgList = queryOrgInfoList(orgIdList);
return orgList.stream().map(OrgProjectVO::new).collect(Collectors.toList());
}
@Autowired
private LoginSessionManager loginSessionManager;
@Override
public void signInOrg(Long orgId, LoginUserInfoVO loginInfo) {
OrgVO orgVO = iOrgService.getTopOrg(orgId);
boolean orgAdmin = iOrgUserService.userIsTheRoleInThisOrg(loginInfo.getAccountVO().getId(), orgId, BusinessConsts.OrgRole.Admin);
loginInfo.setOrgProjectVO(orgVO, orgAdmin);
loginSessionManager.addLoginUserInfo(loginInfo);
}
@Override

View File

@ -90,7 +90,7 @@ public class OrgService implements IOrgService {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria();
criteria.andParentIdIsNull();
criteria.andParentIdIsNull().andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}

View File

@ -18,13 +18,19 @@ import club.joylink.rtss.manage.vo.paper.convertor.PaperCompositionConvertor;
import club.joylink.rtss.manage.vo.paper.convertor.PaperUserConvertor;
import club.joylink.rtss.manage.vo.paper.convertor.PaperUserQuestionConvertor;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.SocketUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
@ -171,6 +177,7 @@ public class PaperUserService {
long paperTime = Duration.between(paper.getStartTime(), now).toMinutes();//实际做题时长min
for (PaperUserQuestion uq : userQuestionList) {
PaperRule rule = ruleIdMap.get(uq.getRuleId());
switch (PaperQType.GroupType.getItem(uq.getType())) {
case Common:
scoreCommon += calculateCommonScore(uq, rule);break;
@ -203,16 +210,23 @@ public class PaperUserService {
* 获取题的最终得分
*/
private int calculateCommonScore(PaperUserQuestion puq, PaperRule rule) {
// PaperQuestionExample example = new PaperQuestionExample();
// example.createCriteria().andIdEqualTo(puq.getQuestionId());
// PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
// PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
return rule.getScore();
}
return 0;
}
public static int getPercentage(double score,int sumScore,int ruleScore) {
if(score >= sumScore){
return ruleScore;
}
// int d = sumScore >=10 ? sumScore : sumScore * 100;
double t = score / sumScore;
if(t <=0.5){
return (int)Math.round(t * ruleScore);
}
return (int)Math.floor(t * ruleScore);
}
/**
* 获取题的最终得分
@ -221,16 +235,13 @@ public class PaperUserService {
if(Objects.equals(puq.getSubType(), PaperQType.SubType.Single.getValue()) && PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))){
return rule.getScore();
}else if(Objects.equals(puq.getSubType(), PaperQType.SubType.Scene.getValue())){
if(!StringUtils.hasText(puq.getTmpAnswer())){
if(Strings.isNullOrEmpty(puq.getTmpAnswer())){
return 0;
}
PaperSubmitAnswerReqVo.AnswerDetail answerDetail = JsonUtils.read(puq.getTmpAnswer(),PaperSubmitAnswerReqVo.AnswerDetail.class);
double sumScore = answerDetail.getTrainDetail().stream().mapToDouble(PaperTrainAnswerDetail::getScore).sum();
double dd = sumScore / (rule.getScore() * 100);
if(dd > 0){
return (int)Math.round(dd);
}
return 0;
int sumScore = answerDetail.getSumScore();
double totalScore = answerDetail.getTrainDetail().stream().mapToDouble(PaperTrainAnswerDetail::getScore).sum();
return getPercentage(totalScore,sumScore,rule.getScore());
}
return 0;
}

View File

@ -10,8 +10,6 @@ import club.joylink.rtss.manage.entity.paper.PaperUserQuestion;
import club.joylink.rtss.manage.entity.paper.PaperUserQuestionExample;
import club.joylink.rtss.manage.entity.paper.question.PaperQuestion;
import club.joylink.rtss.manage.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.manage.entity.training2.PublishedTraining2;
import club.joylink.rtss.manage.exception.BusinessExceptionAssert;
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.manage.exception.PaperExceptionAssert;
import club.joylink.rtss.manage.services.training2.Training2PublishService;
@ -21,9 +19,8 @@ import club.joylink.rtss.manage.vo.client.training2.ScoringRuleVO;
import club.joylink.rtss.manage.vo.client.training2.Step2VO;
import club.joylink.rtss.manage.vo.paper.*;
import club.joylink.rtss.manage.vo.training2.publish.PublishedTraining2DetailRspVo;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -77,28 +74,22 @@ public class PaperUserSubmitAnswerService {
rsp.setPqId(req.getPqId());
rsp.setType(req.getType());
rsp.setSubType(req.getSubType());
String tmpAnswer = null;
TrainAnswerVO answerVO;
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(req.getType()),"未知的考试类型");
//处理用户提交的答案
switch (req.getType()) {
case Common:
rsp.setResult(submitCommonAnswer(puq, req));
tmpAnswer = this.getAnswerFromSubmit(req);
break;
case Training:{
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
TrainAnswerVO answerVO = this.submitTrainingAnswer(req,puq);
rsp.setResult(answerVO.getState());
tmpAnswer = JsonUtils.writeValueAsString(answerVO.getDetail());
break;
}
if(req.getType() == PaperQType.GroupType.Common){
answerVO = submitCommonAnswer(puq, req);
}else{
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
answerVO = this.submitTrainingAnswer(req,puq);
}
rsp.setResult(answerVO.getState());
//记录用户答题情况
PaperUserQuestion record = new PaperUserQuestion();
record.setId(puq.getId());
record.setState(rsp.getResult().getValue());
record.setTmpAnswer(tmpAnswer);
record.setTmpAnswer(answerVO.getDetailStr());
paperUserQuestionDAO.updateByPrimaryKeySelective(record);
//
return rsp;
}
@ -115,64 +106,62 @@ public class PaperUserSubmitAnswerService {
// PaperExceptionAssert.PuqCanSubmit.assertTrue(PaperQuestionState.Undo.equals(PaperQuestionState.getItem(puq.getState())), "只有未做的题才能提交答案");
}
private TrainAnswerVO submitTrainingAnswer(PaperSubmitAnswerReqVo reqVo,PaperUserQuestion puq){
private TrainAnswerVO<PaperSubmitAnswerReqVo.AnswerDetail> submitTrainingAnswer(PaperSubmitAnswerReqVo reqVo,PaperUserQuestion puq){
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(Strings.isNullOrEmpty(reqVo.getTrainAnswerDetail().getCosplayMemberId()),"实训考试没有对应的角色");
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(CollectionUtils.isEmpty(reqVo.getTrainAnswerDetail().getTrainDetail()),"实训考试没有对应的操作");
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(reqVo.getTrainAnswerDetail().getTrainDetail().stream().anyMatch(d->Objects.isNull(d.getStepId())),"实训步骤id不能为空");
PublishedTraining2DetailRspVo detailVO = this.training2PublishService.findTrainingAllInfoById(reqVo.getPqId());
log.debug("查找对应的实训数据 type:[{}],id[{}]",reqVo.getSubType(),reqVo.getPqId());
if(CollectionUtils.isEmpty(reqVo.getTrainAnswerDetail().getTrainDetail())){
return new TrainAnswerVO(PaperQuestionState.Wrong, null);
}
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(detailVO),String.format("未找到对应的实训数据[%s]",reqVo.getPqId()));
List<Step2VO> stepList = JsonUtils.readCollection(detailVO.getStepJson(),ArrayList.class, Step2VO.class);
if(reqVo.getSubType() == PaperQType.SubType.Single){
return this.submitTrainingAnswerForSingle(reqVo,stepList,puq);
return this.submitTrainingAnswerForSingle(reqVo,detailVO/*,stepList,puq*/);
}else if(reqVo.getSubType() == PaperQType.SubType.Scene){
return this.submitTrainingAnswerForScene(detailVO,reqVo,puq);
return this.submitTrainingAnswerForScene(detailVO,reqVo);
}
return new TrainAnswerVO(PaperQuestionState.Wrong, null);
return new TrainAnswerVO<PaperSubmitAnswerReqVo.AnswerDetail>(PaperQuestionState.Wrong, null);
}
/**
* 处理实训题答案
* @param req
*
* @return
*/
private TrainAnswerVO submitTrainingAnswerForSingle(PaperSubmitAnswerReqVo req,List<Step2VO> allStepList,PaperUserQuestion puq) {
private TrainAnswerVO submitTrainingAnswerForSingle(PaperSubmitAnswerReqVo req, PublishedTraining2DetailRspVo trainDetailVO/*List<Step2VO> allStepList,PaperUserQuestion puq*/) {
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(StringUtils.hasText(trainDetailVO.getStepJson()),"场景实训没有对应的操作步骤");
List<Step2VO> allStepList = JsonUtils.readCollection(trainDetailVO.getStepJson(),ArrayList.class, Step2VO.class);
List<Step2VO> cosplayStepList = allStepList.stream().filter(d->Objects.equals(d.getMemberId(),req.getTrainAnswerDetail().getCosplayMemberId())).collect(Collectors.toList());
if(req.getTrainAnswerDetail().getTrainDetail().size() != cosplayStepList.size()){
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
return new TrainAnswerVO<>(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
}
if(req.getTrainAnswerDetail().getTrainDetail().stream().allMatch(d->d.isSuccess())){
if(req.getTrainAnswerDetail().getTrainDetail().stream().allMatch(PaperTrainAnswerDetail::isSuccess)){
return new TrainAnswerVO(PaperQuestionState.Right, req.getTrainAnswerDetail());
}
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
}
private TrainAnswerVO submitTrainingAnswerForScene(PublishedTraining2DetailRspVo trainVO,PaperSubmitAnswerReqVo req,PaperUserQuestion puq){
private TrainAnswerVO submitTrainingAnswerForScene(PublishedTraining2DetailRspVo trainVO,PaperSubmitAnswerReqVo req/*,PaperUserQuestion puq*/){
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(StringUtils.hasText(trainVO.getScoringRuleJson()),"场景实训没有对应的评分规则");
List<ScoringRuleVO> scoreList = JsonUtils.readCollection(trainVO.getScoringRuleJson(),ArrayList.class, ScoringRuleVO.class);
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(scoreList),String.format("场景实训[%s]没有评分规则",req.getPqId()));
List<ScoringRuleVO.DetailVO> allDetailVOList = scoreList.stream().filter(d->Objects.equals(d.getMemberId(),req.getTrainAnswerDetail().getCosplayMemberId())).flatMap(d->d.getDetails().stream()).collect(Collectors.toList());
List<ScoringRuleVO.DetailVO> allDetailVOList = scoreList.stream().filter(d->Objects.equals(d.getMemberId(),req.getTrainAnswerDetail().getCosplayMemberId()))
.flatMap(d->d.getDetails().stream()).collect(Collectors.toList());
List<PaperTrainAnswerDetail> answerDetailList = req.getTrainAnswerDetail().getTrainDetail();
answerDetailList = Objects.isNull(answerDetailList) ? Collections.emptyList() : answerDetailList;
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(allDetailVOList.size() == answerDetailList.size(),String.format("场景实训[%s] 评分规则与提交的答案数量不陪配",puq.getQuestionId()));
Map<String,PaperTrainAnswerDetail> answerDetailMap = answerDetailList.stream().collect(Collectors.toMap(d->d.getStepId().toString(),Function.identity()));
List<PaperTrainAnswerDetail> resultAnswerDetailList = new ArrayList<>(allDetailVOList.size());
int sumScore = allDetailVOList.stream().mapToInt(d->(int)d.getScore()).sum();
for (ScoringRuleVO.DetailVO detailVO : allDetailVOList) {
PaperTrainAnswerDetail answerDetail = answerDetailMap.get(detailVO.getElementId());
if(Objects.nonNull(answerDetail)){
answerDetail.setScore(detailVO.getScore());
}else{
answerDetail = new PaperTrainAnswerDetail();
answerDetail.setScore(0F);
@ -181,12 +170,7 @@ public class PaperUserSubmitAnswerService {
}
resultAnswerDetailList.add(answerDetail);
}
/* answerDetailList = answerDetailList.stream().peek(d->{
if(Objects.isNull(d.getScore())){
d.setScore(0F);
d.setNotExistAppend(true);
}
}).collect(Collectors.toList());*/
req.getTrainAnswerDetail().setSumScore(sumScore);
req.getTrainAnswerDetail().setTrainDetail(resultAnswerDetailList);
return new TrainAnswerVO(PaperQuestionState.SECEN_CUL,req.getTrainAnswerDetail());
@ -194,7 +178,7 @@ public class PaperUserSubmitAnswerService {
/**
* 处理理论题答案
*/
private PaperQuestionState submitCommonAnswer(PaperUserQuestion puq, PaperSubmitAnswerReqVo req) {
private TrainAnswerVO<String> submitCommonAnswer(PaperUserQuestion puq, PaperSubmitAnswerReqVo req) {
//题目
PaperQuestionExample pqExample = new PaperQuestionExample();
pqExample.createCriteria().andIdEqualTo(puq.getQuestionId());
@ -203,43 +187,22 @@ public class PaperUserSubmitAnswerService {
final String qAn = this.getAnswerFromQuestion(pq);
final String sAn = this.getAnswerFromSubmit(req);
//
return qAn.equals(sAn) ? PaperQuestionState.Right : PaperQuestionState.Wrong;
PaperQuestionState qState = PaperQuestionState.Wrong;
if(qAn.equals(sAn)){
qState = PaperQuestionState.Right;
}
TrainAnswerVO vo = new TrainAnswerVO(qState,sAn);
return vo;
}
private String getAnswerFromQuestion(PaperQuestion pq) {
String dan = pq.getQuestionAnswer().trim();
String[] ans = dan.split(",");
TreeSet<String> set = new TreeSet<>();
for (String an : ans) {
set.add(an.trim());
}
return Joiner.on(",").join(set);
/*StringBuilder sb = new StringBuilder();
set.forEach(an -> {
if (sb.length() <= 0) {
sb.append(an);
} else {
sb.append(",").append(an);
}
});*/
// return sb.toString();
return Splitter.on(",").trimResults().omitEmptyStrings().splitToList(dan).stream().sorted().collect(Collectors.joining(","));
}
private String getAnswerFromSubmit(PaperSubmitAnswerReqVo req) {
TreeSet<String> set = new TreeSet<>();
for (String an : req.getAnswer()) {
set.add(an.trim());
}
return Joiner.on(",").join(set);
/*StringBuilder sb = new StringBuilder();
set.forEach(an -> {
if (sb.length() <= 0) {
sb.append(an);
} else {
sb.append(",").append(an);
}
});
return sb.toString();*/
}
return req.getAnswer().stream().filter(StringUtils::hasText).peek(String::trim).sorted().collect(Collectors.joining(","));
}
}

View File

@ -7,7 +7,7 @@ import club.joylink.rtss.manage.entity.permission.*;
import club.joylink.rtss.manage.services.IPermissionService;
import club.joylink.rtss.manage.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionGenerateParamVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionGenerateParamVO;
import club.joylink.rtss.manage.vo.client.permission.PermissionQueryVO;
import club.joylink.rtss.manage.vo.client.permission.PermissionVO;
import club.joylink.rtss.manage.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;
@ -101,7 +97,7 @@ public class OldPermissionDataSyncService {
for (MapInfo mapInfo : mapInfoList) {
this.generate(mapInfo);
}*/
this.abilityService.autoSynchMapSystemData(1L);
abilityService.autoSynchMapSystemData(1L);
}catch (Exception e){
log.error("用户权限初始化失败 msg:" + e.getMessage(),e);
ISRUN.compareAndSet(true,false);
@ -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

@ -142,33 +142,31 @@ public class PermissionSubjectService {
//根据当前用户的项目code 获取所有的mapId
List<Long> projectMapIdList = this.findMapIdByProjectCode(projectCode);
List<SystemAbility> voList = this.systemAbilityService.findSystemAbilityByMapId(List.of(mapId));
List<PermissionSubjectVO> resultList = Lists.newArrayList();
//过滤当前项目的权限
//从当前用户所有权限获取所有权限类型为PROJECT && 数据== 用户项目code && 项目code对应的所有mapId == mapId入参
List<PermissionSubjectVO> projectVOList = subjectVOList.stream()
List<PermissionSubjectVO> projectMapVOList = subjectVOList.stream()
.filter(d->(Objects.equals(d.getPermissionType(), PermissionTypeEnum.PROJECT.getValue()))
&& Objects.equals(d.getPermissionProjectCode(),projectCode.toLowerCase()) && projectMapIdList.contains(mapId))
// && Objects.equals(d.getProjectCode(),projectCode.toLowerCase()) && projectMapIdList.contains(mapId))
.collect(Collectors.toList());
if(!CollectionUtils.isEmpty(projectVOList)){
this.createSystemAbilityVOForProejctOrMap(projectVOList,voList);
return projectVOList;
if(!CollectionUtils.isEmpty(projectMapVOList)){
this.createSystemAbilityVOForProejctOrMap(projectMapVOList,voList);
resultList.addAll(projectMapVOList);
}
//过滤当前线路权限
//当前是否是线路权限
List<PermissionSubjectVO> mapVOList = subjectVOList.stream()
List<PermissionSubjectVO> orgMapVOList = subjectVOList.stream()
.filter(d->(Objects.equals(d.getPermissionType(), PermissionTypeEnum.MAP_ID.getValue()))
&& Objects.equals(d.getMapId(), mapId)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(mapVOList)){
this.createSystemAbilityVOForProejctOrMap(mapVOList,voList);
return mapVOList;
}else {
//过滤当前线路功能权限
//过滤该用户拥有所有的权限并且mapId = 参数mapId
subjectVOList = subjectVOList.stream().filter(d-> Objects.equals(d.getMapId(), mapId)).collect(Collectors.toList());
this.createSystemAbilityVOForFunction(subjectVOList);
return subjectVOList;
if(!CollectionUtils.isEmpty(orgMapVOList)){
this.createSystemAbilityVOForProejctOrMap(orgMapVOList,voList);
resultList.addAll(orgMapVOList);
}
List<PermissionSubjectVO> abilityMapVOList = subjectVOList.stream().filter(d-> (Objects.equals(d.getPermissionType(), PermissionTypeEnum.MAP_ABILITY.getValue()))
&& Objects.equals(d.getMapId(), mapId)).collect(Collectors.toList());
this.createSystemAbilityVOForFunction(abilityMapVOList);
resultList.addAll(abilityMapVOList);
return resultList;
}
/**

View File

@ -2,16 +2,14 @@ package club.joylink.rtss.manage.services.permission;
import club.joylink.rtss.manage.dao.permission.PermissionSystemAbilityDAO;
import club.joylink.rtss.manage.dao.permission.SystemAbilityDAO;
import club.joylink.rtss.manage.entity.permission.PermissionSystemAbility;
import club.joylink.rtss.manage.entity.permission.PermissionSystemAbilityExample;
import club.joylink.rtss.manage.entity.permission.SystemAbility;
import club.joylink.rtss.manage.entity.permission.SystemAbilityExample;
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.manage.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import club.joylink.rtss.manage.vo.client.PageVO;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionQueryVO;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionQueryVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.manage.vo.permission.*;
import club.joylink.rtss.manage.vo.permission.convertor.SystemAbilityConvertor;
import com.github.pagehelper.Page;
@ -34,9 +32,6 @@ import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import static club.joylink.rtss.manage.vo.permission.SystemAbilityStatus.Editing;
import static club.joylink.rtss.manage.vo.permission.SystemAbilityStatus.Enable;
@Slf4j
@Service
public class SystemAbilityService {
@ -112,10 +107,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 +120,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 +140,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 +178,7 @@ public class SystemAbilityService {
@Data
@AllArgsConstructor
public static class SynUpdateVO{
private RtsMapFunctionVO vo;
private MapFunctionVO vo;
private Long abilityId;
}
}

View File

@ -342,9 +342,8 @@ public class DeviceServiceImpl implements DeviceService {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo("XTY")
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andProjectCodeEqualTo(Project.XTY.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildXtyProjectDevices(accountVO);
@ -358,7 +357,7 @@ public class DeviceServiceImpl implements DeviceService {
List<ProjectDevice> list = new ArrayList<>();
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode("XTY");
plcGateway.setProjectCode(Project.XTY.name());
plcGateway.setCode("xty-gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
@ -368,7 +367,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(plcGateway);
// 屏蔽门
ProjectDevice psd = new ProjectDevice();
psd.setProjectCode("XTY");
psd.setProjectCode(Project.XTY.name());
psd.setCode("xty-psd");
psd.setType(ProjectDeviceType.PSD.name());
psd.setCreator(accountVO.getId());
@ -384,9 +383,8 @@ public class DeviceServiceImpl implements DeviceService {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo("GZB")
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andProjectCodeEqualTo(Project.GZB.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildGzbProjectDevices(accountVO);
@ -400,9 +398,8 @@ public class DeviceServiceImpl implements DeviceService {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo("SDY")
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andProjectCodeEqualTo(Project.SDY.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildSdyProjectDevices(accountVO);
@ -416,9 +413,8 @@ public class DeviceServiceImpl implements DeviceService {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo("RICHOR_JOINT")
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andProjectCodeEqualTo(Project.RICHOR_JOINT.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildZjdProjectDevices(accountVO);
@ -432,9 +428,8 @@ public class DeviceServiceImpl implements DeviceService {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo("SR_SANDBOX")
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andProjectCodeEqualTo(Project.SR_SANDBOX.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildSrProjectDevices(accountVO, mapId);
@ -448,9 +443,8 @@ public class DeviceServiceImpl implements DeviceService {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo("RICHOR_HHCJ")
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andProjectCodeEqualTo(Project.RICHOR_HHCJ.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildHhcjProjectDevices(accountVO);
@ -465,8 +459,7 @@ public class DeviceServiceImpl implements DeviceService {
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo(Project.SAY.name())
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
.map(Enum::name).collect(Collectors.toList()));
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildSayProjectDevices(accountVO);
@ -537,7 +530,7 @@ public class DeviceServiceImpl implements DeviceService {
List<ProjectDevice> list = new ArrayList<>();
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode("RICHOR_HHCJ");
plcGateway.setProjectCode(Project.RICHOR_HHCJ.name());
plcGateway.setCode("hhcj-gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
@ -547,7 +540,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(plcGateway);
// IBP盘
ProjectDevice ibp = new ProjectDevice();
ibp.setProjectCode("RICHOR_HHCJ");
ibp.setProjectCode(Project.RICHOR_HHCJ.name());
ibp.setCode("hhcj-ibp");
ibp.setType(ProjectDeviceType.IBP.name());
ibp.setCreator(accountVO.getId());
@ -557,7 +550,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(ibp);
// PSD
ProjectDevice psd = new ProjectDevice();
psd.setProjectCode("RICHOR_HHCJ");
psd.setProjectCode(Project.RICHOR_HHCJ.name());
psd.setCode("hhcj-psd");
psd.setType(ProjectDeviceType.PSD.name());
psd.setCreator(accountVO.getId());
@ -574,7 +567,7 @@ public class DeviceServiceImpl implements DeviceService {
List<ProjectDevice> list = new ArrayList<>();
//UDP下位机
ProjectDevice udp = new ProjectDevice();
udp.setProjectCode("SR_SANDBOX");
udp.setProjectCode(Project.SR_SANDBOX.name());
udp.setCode("sr-udp");
udp.setType(ProjectDeviceType.UDP_LOW.name());
udp.setCreator(accountVO.getId());
@ -584,7 +577,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(udp);
//UDP客户端
ProjectDevice udpClient = new ProjectDevice();
udpClient.setProjectCode("SR_SANDBOX");
udpClient.setProjectCode(Project.SR_SANDBOX.name());
udpClient.setCode("sr-udp-client");
udpClient.setType(ProjectDeviceType.UDP_CLIENT.name());
udpClient.setCreator(accountVO.getId());
@ -599,7 +592,7 @@ public class DeviceServiceImpl implements DeviceService {
for (MapSignalNewVO mapSignalNewVO : graphDataNew.getSignalList()) {
if (StringUtils.hasText(mapSignalNewVO.getSrCode())) {
ProjectDevice signal = new ProjectDevice();
signal.setProjectCode("SR_SANDBOX");
signal.setProjectCode(Project.SR_SANDBOX.name());
signal.setCode("sr-signal-" + mapSignalNewVO.getCode());
signal.setType(ProjectDeviceType.SIGNAL.name());
signal.setCreator(accountVO.getId());
@ -613,7 +606,7 @@ public class DeviceServiceImpl implements DeviceService {
for (MapSwitchVO mapSwitchVO : graphDataNew.getSwitchList()) {
if (StringUtils.hasText(mapSwitchVO.getSrCode())) {
ProjectDevice aSwitch = new ProjectDevice();
aSwitch.setProjectCode("SR_SANDBOX");
aSwitch.setProjectCode(Project.SR_SANDBOX.name());
aSwitch.setCode("sr-switch-" + mapSwitchVO.getCode());
aSwitch.setType(ProjectDeviceType.SWITCH.name());
aSwitch.setCreator(accountVO.getId());
@ -627,7 +620,7 @@ public class DeviceServiceImpl implements DeviceService {
for (MapSectionNewVO mapSectionNewVO : graphDataNew.getSectionList()) {
if (StringUtils.hasText(mapSectionNewVO.getSrCode())) {
ProjectDevice section = new ProjectDevice();
section.setProjectCode("SR_SANDBOX");
section.setProjectCode(Project.SR_SANDBOX.name());
section.setCode("sr-section-" + mapSectionNewVO.getCode());
section.setType(ProjectDeviceType.SECTION.name());
section.setCreator(accountVO.getId());
@ -642,7 +635,7 @@ public class DeviceServiceImpl implements DeviceService {
List<MapTrainVO> trainList = graphDataNew.getTrainList();
for (MapTrainVO mapTrainVO : trainList) {
ProjectDevice train = new ProjectDevice();
train.setProjectCode("SR_SANDBOX");
train.setProjectCode(Project.SR_SANDBOX.name());
train.setCode("sr-train-" + mapTrainVO.getGroupNumber());
train.setType(ProjectDeviceType.TRAIN.name());
train.setCreator(accountVO.getId());
@ -714,7 +707,7 @@ public class DeviceServiceImpl implements DeviceService {
List<ProjectDevice> list = new ArrayList<>();
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode("RICHOR_JOINT");
plcGateway.setProjectCode(Project.RICHOR_JOINT.name());
plcGateway.setCode("zjd-gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
@ -724,7 +717,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(plcGateway);
// 屏蔽门
ProjectDevice psd = new ProjectDevice();
psd.setProjectCode("RICHOR_JOINT");
psd.setProjectCode(Project.RICHOR_JOINT.name());
psd.setCode("zjd-psd");
psd.setType(ProjectDeviceType.PSD.name());
psd.setCreator(accountVO.getId());
@ -734,7 +727,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(psd);
// IBP盘
ProjectDevice ibp = new ProjectDevice();
ibp.setProjectCode("RICHOR_JOINT");
ibp.setProjectCode(Project.RICHOR_JOINT.name());
ibp.setCode("zjd-ibp");
ibp.setType(ProjectDeviceType.IBP.name());
ibp.setCreator(accountVO.getId());
@ -744,7 +737,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(ibp);
// PSL
ProjectDevice psl = new ProjectDevice();
psl.setProjectCode("RICHOR_JOINT");
psl.setProjectCode(Project.RICHOR_JOINT.name());
psl.setCode("zjd-psl");
psl.setType(ProjectDeviceType.PSL.name());
psl.setCreator(accountVO.getId());
@ -762,7 +755,7 @@ public class DeviceServiceImpl implements DeviceService {
// list.add(buildIm(Project.SDY, userVO.getId()));
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode("SDY");
plcGateway.setProjectCode(Project.SDY.name());
plcGateway.setCode("sdy-gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
@ -772,7 +765,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(plcGateway);
// 屏蔽门
ProjectDevice psd = new ProjectDevice();
psd.setProjectCode("SDY");
psd.setProjectCode(Project.SDY.name());
psd.setCode("sdy-psd");
psd.setType(ProjectDeviceType.PSD.name());
psd.setCreator(accountVO.getId());
@ -782,7 +775,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(psd);
// PSL盘
ProjectDevice psl = new ProjectDevice();
psl.setProjectCode("SDY");
psl.setProjectCode(Project.SDY.name());
psl.setCode("sdy-psl");
psl.setType(ProjectDeviceType.PSL.name());
psl.setCreator(accountVO.getId());
@ -808,7 +801,7 @@ public class DeviceServiceImpl implements DeviceService {
List<ProjectDevice> list = new ArrayList<>();
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode("GZB");
plcGateway.setProjectCode(Project.GZB.name());
plcGateway.setCode("gzb-gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
@ -818,7 +811,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(plcGateway);
// 道岔
ProjectDevice switchA = new ProjectDevice();
switchA.setProjectCode("GZB");
switchA.setProjectCode(Project.GZB.name());
switchA.setCode("gzb-switch");
switchA.setType(ProjectDeviceType.SWITCH.name());
switchA.setCreator(accountVO.getId());
@ -828,7 +821,7 @@ public class DeviceServiceImpl implements DeviceService {
list.add(switchA);
// 信号机
ProjectDevice signal = new ProjectDevice();
signal.setProjectCode("GZB");
signal.setProjectCode(Project.GZB.name());
signal.setCode("gzb-signal");
signal.setType(ProjectDeviceType.SIGNAL.name());
signal.setCreator(accountVO.getId());

View File

@ -383,7 +383,7 @@ public class Training2DraftService {
* 修改实训所有步骤
*/
@Transactional(rollbackFor = Exception.class)
public void updateSteps(String group, Long trainingId, List<Step2VO> step2VOList) {
public void updateSteps(String group, Long trainingId, UpdateStepReqVo reqParam) {
DraftTraining2WithBLOBs draftTraining2 = trainingDao.selectByPrimaryKey(trainingId);
if (draftTraining2 == null) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
@ -392,6 +392,7 @@ public class Training2DraftService {
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
DraftTraining2WithBLOBs updateObj = new DraftTraining2WithBLOBs();
updateObj.setId(trainingId);
List<Step2VO> step2VOList = reqParam.getStep2VOList();
if (CollectionUtils.isEmpty(step2VOList)) {
updateObj.setStepJson(StringUtil.EMPTY_STRING);
updateObj.setScoringRuleJson(StringUtil.EMPTY_STRING);
@ -404,13 +405,10 @@ public class Training2DraftService {
handleStepId(draftTraining2, step2VOList);
updateObj.setStepJson(JsonUtils.writeValueAsString(step2VOList));
// 扮演者集合
List<String> playerList = step2VOList.stream().
filter(s -> !StringUtils.isEmpty(s.getMemberId())).map(s -> s.getMemberId())
.distinct().sorted().collect(Collectors.toList());
if (CollectionUtils.isEmpty(playerList)) {
if (CollectionUtils.isEmpty(reqParam.getPlayerIdList())) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据:无扮演者");
}
updateObj.setPlayerIdJson(JsonUtils.writeValueAsString(playerList));
updateObj.setPlayerIdJson(JsonUtils.writeValueAsString(reqParam.getPlayerIdList()));
// 背景
StorageSimulation scenesSaving = new StorageSimulation(simulation, true);
updateObj.setFinalScenesJson(JsonUtils.writeValueAsString(scenesSaving));

View File

@ -234,6 +234,9 @@ public class Training2PublishService {
criteria.andLabelJsonLike(String.format("%%%s%%", label));
}
}
if (reqVO.getOrgId() != null) {
criteria.andOrgIdEqualTo(reqVO.getOrgId());
}
/*if(!CollectionUtils.isEmpty(reqVO.getLabels())){
StringBuilder sqlBuilder = new StringBuilder("(");
List<String> labels = reqVO.getLabels().stream().filter(StringUtils::hasText).distinct().collect(Collectors.toList());

View File

@ -642,20 +642,22 @@ public class Training2Service {
*/
private boolean tryDoOperation(Simulation simulation, Step2 step, Operation2.SimCommand2 operation2) {
boolean isRobot = step.getSimulationMember().isRobot(); // 角色是否是机器人
long simCurTime = simulation.getCorrectSystemTimeStamp();
// 未操作过
if (Step2.StepStatus.isUndo(operation2.getStatus())) {
if (isRobot) {
atsOperationDispatcher.execute(simulation, step.getSimulationMember(), operation2.getOperationType().name()
, operation2.getParams());
return true;
} else { // 非机器人暂停仿真等待用户操作
if (operation2.getSimTime() != null) {
long simCurTime = simulation.getCorrectSystemTimeStamp();
// 如果时间到达操作时间或者在1s内则暂停仿真
if (simCurTime == operation2.getSimTime() || operation2.getSimTime() < simCurTime) {
simulation.onlyPause();
}
boolean isExec = true; // 是否要执行
if (operation2.getSimTime() != null && simulation.getTraining2().isScene()) {
isExec = (simCurTime == operation2.getSimTime() || operation2.getSimTime() < simCurTime);
}
if (isExec) {
if (isRobot || operation2.isSpecial()) { // 特殊操作直接执行
atsOperationDispatcher.execute(simulation, step.getSimulationMember(), operation2.getOperationType().name()
, operation2.getParams());
return true;
} else { // 非机器人暂停仿真等待用户操作
simulation.onlyPause();
}
} else {
return false;
}
}

View File

@ -101,7 +101,8 @@ public class ATSMessageCollectAndDispatcher {
trainList.forEach(train -> {
TrainStatus trainStatus = repository.findStatusByCode(train.getGroupNumber(), TrainStatus.class);
if (Objects.isNull(trainStatus)) {
if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){
// if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){
if(Objects.equals(simulation.getProject(),MapPrdTypeEnum.YJDDZH.name())){
trainStatus = new YJDDZHTrainStatus(train);
}else{
trainStatus = new TrainStatus(train);
@ -110,7 +111,8 @@ public class ATSMessageCollectAndDispatcher {
totalList.add(trainStatus.convert2VO(train));
} else {
DeviceStatusVO statusVO;
if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){
// if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){
if(Objects.equals(simulation.getProject(),MapPrdTypeEnum.YJDDZH.name())){
statusVO = new YJDDZHTrainStatusVO(train);
}else{
statusVO = new TrainStatusVO(train);

View File

@ -628,9 +628,9 @@ public class Operation {
Station_Switch_Control_Operation_Mode(new Label[]{Label.CLIENT},true),
/**
* 分散自律同意转换
* 分散自律同意不同意转换
*/
Station_Agree_Operation_Mode(new Label[]{Label.CLIENT},true),
Station_Handle_Operation_Mode_Apply(new Label[]{Label.CLIENT},true),
//--------------------------- 列车 ---------------------------
/**
* 在指定区段加载一辆计划列车本地开发使用
@ -923,6 +923,10 @@ public class Operation {
* 转NRM模式
*/
Apply_NRM(new Label[]{Label.OTHER},true),
/**
* 切换ATO操作
*/
Try_Open_Ato(new Label[]{Label.OTHER}, true),
//--------------------------- 方向杆 ---------------------------
/**
* 方向转换

View File

@ -217,4 +217,12 @@ public class DriverOperateHandler {
public void applyNRM(Simulation simulation, String groupNumber) {
ATPService.applyNRM(simulation, groupNumber);
}
/**
* 操作打开 ATO
*/
@OperateHandlerMapping(type = Operation.Type.Try_Open_Ato)
public void tryOpenAto(Simulation simulation, String groupNumber) {
ATPService.openAto(simulation, groupNumber);
}
}

View File

@ -4,6 +4,8 @@ import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.annotation.OperateHandler;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.vo.OperationModeParam;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.vo.RouteModelParam;
import club.joylink.rtss.manage.simulation.cbtc.ATS.service.AtsStationService;
import club.joylink.rtss.manage.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
@ -321,29 +323,25 @@ public class StationOperateHandler {
/**
* 车站状态选择切换
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param routeSetMode 排路方式
* @param planControl 计划控制
*/
@OperateHandlerMapping(type = Operation.Type.Station_Switch_Route_Set_Model)
public void switchRouteSetModel(Simulation simulation, String stationCode, Station.RouteSetMode routeSetMode, boolean planControl) {
atsStationService.switchRouteSetModel(simulation, stationCode, routeSetMode, planControl);
public void switchRouteSetModel(Simulation simulation, List<RouteModelParam> routeSetModeParams) {
atsStationService.switchRouteSetModel(simulation, routeSetModeParams);
}
/**
* 车站在分散自律时操作模式转换
*/
@OperateHandlerMapping(type = Operation.Type.Station_Switch_Control_Operation_Mode)
public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, String stationCode, Station.OperationMode target) {
atsStationService.controlOperationModeSwitch(simulation, fromMember, stationCode, target);
public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, List<OperationModeParam> params) {
atsStationService.controlOperationModeSwitch(simulation, fromMember, params);
}
/**
* 分散自律同意转换模式操作
* 分散自律同意不同意转换模式操作
*/
@OperateHandlerMapping(type = Operation.Type.Station_Agree_Operation_Mode)
public void agreeOperationModel(Simulation simulation, String stationCode) {
atsStationService.agreeOperationMode(simulation, stationCode);
@OperateHandlerMapping(type = Operation.Type.Station_Handle_Operation_Mode_Apply)
public void handleOperationModelApply(Simulation simulation, List<String> agreeStationCodes, List<String> noAgreeStationCodes) {
atsStationService.handleOperationModelApply(simulation, agreeStationCodes, noAgreeStationCodes);
}
}

View File

@ -0,0 +1,13 @@
package club.joylink.rtss.manage.simulation.cbtc.ATS.operation.vo;
import club.joylink.rtss.manage.simulation.cbtc.data.map.Station;
import lombok.Data;
@Data
public class OperationModeParam {
private String stationCode;
private Station.OperationMode target;
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.manage.simulation.cbtc.ATS.operation.vo;
import club.joylink.rtss.manage.simulation.cbtc.data.map.Station;
import lombok.Data;
@Data
public class RouteModelParam {
private String stationCode;
private Station.RouteSetMode routeSetMode;
private Boolean planControl;
}

View File

@ -3,6 +3,8 @@ package club.joylink.rtss.manage.simulation.cbtc.ATS.service;
import club.joylink.rtss.manage.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.manage.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.vo.OperationModeParam;
import club.joylink.rtss.manage.simulation.cbtc.ATS.operation.vo.RouteModelParam;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.simulation.cbtc.command.OperationMessage;
import club.joylink.rtss.manage.simulation.cbtc.constant.SimulationConstants;
@ -14,7 +16,6 @@ import club.joylink.rtss.manage.simulation.cbtc.data.vo.ControlTransferReplyVO;
import club.joylink.rtss.manage.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.manage.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.manage.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.manage.vo.client.SocketMessageVO;
import club.joylink.rtss.manage.vo.client.WebSocketMessageType;
import club.joylink.rtss.manage.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.manage.websocket.StompMessageService;
@ -571,93 +572,149 @@ public class AtsStationService {
/**
* 车站状态选择切换
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param routeSetMode 排路方式
* @param planControl 计划控制
* @param routeSetModeParams 转换参数
*/
public void switchRouteSetModel(Simulation simulation, String stationCode, Station.RouteSetMode routeSetMode, boolean planControl) {
if (StringUtils.isEmpty(stationCode)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "非常站控的车站不能为空");
public void switchRouteSetModel(Simulation simulation, List<RouteModelParam> routeSetModeParams) {
List<String> logList = new ArrayList<>(routeSetModeParams.size());
for (RouteModelParam params : routeSetModeParams) {
if (StringUtils.isEmpty(params.getStationCode())) {
logList.add("车站不能为空");
continue;
}
Station station = getStation(simulation, params.getStationCode());
if (station.isLocalControl() && Objects.equals(Station.OperationMode.Station, station.getOperationMode())) {
if (params.getPlanControl() != null) {
station.setPlanControl(params.getPlanControl()); // 计划控制
}
station.setRouteSetMode(params.getRouteSetMode()); // 进路排列方式
} else {
logList.add(String.format("车站【%s%s】不可操作", station.getName(), station.getCode()));
}
}
if (!CollectionUtils.isEmpty(logList)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, String.join(";", logList));
}
Station station = getStation(simulation, stationCode);
station.setPlanControl(planControl); // 计划控制
station.setRouteSetMode(routeSetMode); // 进路排列方式
}
/**
* 车站在分散自律时操作模式转换
* @param simulation 仿真
* @param fromMember 操作角色
* @param stationCode 车站
* @param target 目的操作模式
* @param params 转换参数
*/
public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, String stationCode, Station.OperationMode target) {
Station station = getStation(simulation, stationCode);
if (Station.ControlMode.Local.equals(station.getControlMode())) {
Station.OperationModeApplication applyOperation = new Station.OperationModeApplication(fromMember, station.getOperationMode(), target);
if (applyOperation.isNoHandle()) { // 车站操作方式与目的方式相同直接返回
return;
} else if (applyOperation.isDirectConversion()) { // 如果可以直接转换
doOperationModeSwitch(station);
return;
} else if (applyOperation.isProhibitConversion()) { // 禁止转换
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed);
} else {
station.setOperationModeApplication(applyOperation);
public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, List<OperationModeParam> params) {
List<String> logList = new ArrayList<>(params.size());
for (OperationModeParam param : params) {
Station station = getStation(simulation, param.getStationCode());
if (Station.ControlMode.Local.equals(station.getControlMode())) {
Station.OperationModeApplication applyOperation = new Station.OperationModeApplication(fromMember, station.getOperationMode(), param.getTarget());
if (applyOperation.isNoHandle()) {
log.info(String.format("车站【%s(%s)】 操作方式与目的方式相同不做操作", station.getName(), station.getCode()));
} else if (applyOperation.isDirectConversion()) { // 如果可以直接转换
station.setOperationMode(param.getTarget());
log.info(String.format("车站【%s(%s)】 直接转换", station.getName(), station.getCode()));
} else if (applyOperation.isProhibitConversion()) { // 禁止转换
logList.add(String.format("车站【%s(%s)】 禁止转换", station.getName(), station.getCode()));
} else {
applyOperation.setApplyDateTime(simulation.getCorrectSystemTime());
if (applyOperation.isCenterApplication()) { // 如果中心请求,需要车站同意
SimulationMember member = simulation.getSimulationMember(SimulationMember.Type.STATION_SUPERVISOR, station.getCode());
applyOperation.setApprovalMember(Arrays.asList(member));
} else { // 车站同意需要中心同意
applyOperation.setApprovalMember(
simulation.getSimulationMembers().stream()
.filter(s -> Objects.equals(s.getType(), SimulationMember.Type.DISPATCHER))
.collect(Collectors.toList())
);
}
station.setOperationModeApplication(applyOperation);
}
} else { // 非分散自律抛出异常
logList.add(String.format("车站【%s(%s)】 非分散自律,不可操作", station.getName(), station.getCode()));
}
} else { // 非分散自律抛出异常
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "车站控制模式不匹配");
}
if (!CollectionUtils.isEmpty(logList)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, String.join(";", logList));
}
}
/**
* 同意分散自律操作模式转换
* 分散自律同意不同意转换模式操作
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param agreeStationCodes 同意车站编码
* @param noAgreeStationCodes 不同意车站编码
*/
public void agreeOperationMode(Simulation simulation, String stationCode) {
Station station = getStation(simulation, stationCode);
if (station.getOperationModeApplication() != null) {
doOperationModeSwitch(station);
}
public void handleOperationModelApply(Simulation simulation, List<String> agreeStationCodes, List<String> noAgreeStationCodes) {
agreeStationCodes.forEach(stationCode -> {
Station station = getStation(simulation, stationCode);
if (station.getOperationModeApplication() != null) {
doOperationModeSwitch(station);
}
});
// 不同意分散自律操作模式转换
noAgreeStationCodes.forEach(stationCode -> {
Station station = getStation(simulation, stationCode);
station.setOperationModeApplication(null);
});
}
/**
*
* 发送申请转换操作模式申请
* @param simulation
* @param station
*/
public void replyOperationMode(Simulation simulation, Station station) {
Station.OperationModeApplication modeApplication = station.getOperationModeApplication();
if (modeApplication == null) {
return;
}
SimulationMember simulationMember = null;
if (modeApplication.isCenterApplication()) { // 如果中心请求
simulationMember = station.getController();
} else {
simulationMember = simulation.getSimulationMembers().stream()
.filter(s -> Objects.equals(s.getType(), SimulationMember.Type.DISPATCHER))
.findFirst().orElse(null);
}
if (simulationMember == null) {
return;
} else if (simulationMember.isRobot()) {
doOperationModeSwitch(station);
} else {
SocketMessageVO<Station.OperationModeApplication> socketMessageVO =
SocketMessageFactory.build(WebSocketMessageType.Simulation_Operation_Mode_Apply, simulation.getId(), modeApplication);
stompMessageService.sendToUser(Set.of(simulationMember.getUserId()), socketMessageVO);
public void replyOperationMode(Simulation simulation) {
List<Station> stationList = simulation.getRepository().getStationList();
// 需要给用户发送的申请列表
Map<String, List<Map<String,Object>>> userMessageMap = new HashMap<>(stationList.size());
stationList.stream().filter(station -> {
Station.OperationModeApplication modeApplication = station.getOperationModeApplication();
if (modeApplication== null) {
return false;
}
if (CollectionUtils.isEmpty(modeApplication.getApprovalMember())) {
return false;
}
// 申请超过两分钟
if (simulation.getCorrectSystemTime().isAfter(modeApplication.getApplyDateTime().plusMinutes(2))) {
station.setOperationModeApplication(null);
return false;
}
return true;
}).forEach(station -> {
Station.OperationModeApplication modeApplication = station.getOperationModeApplication();
Set<String> userSet = modeApplication.getApprovalMember().stream().filter(m -> !m.isRobot())
.map(SimulationMember::getUserId).collect(Collectors.toSet());
if (!CollectionUtils.isEmpty(userSet)) {
Map<String, Object> messageMap = new HashMap<>();
messageMap.put("code", station.getCode());
messageMap.put("source", modeApplication.getSource());
messageMap.put("target", modeApplication.getTarget());
messageMap.put("applyMember", modeApplication.getApplicationMember().getId());
messageMap.put("applyDateTime", modeApplication.getApplyDateTime());
for (String userId : userSet) {
if (!userMessageMap.containsKey(userId)) {
userMessageMap.put(userId, new ArrayList<>());
}
userMessageMap.get(userId).add(messageMap);
}
}
});
if (!CollectionUtils.isEmpty(userMessageMap)) {
userMessageMap.forEach((k, v) ->
stompMessageService.sendToUser(k,
SocketMessageFactory.build(WebSocketMessageType.Simulation_Operation_Mode_Apply, simulation.getId(), v)));
}
}
/**
* 操作模式直接转换
*/
private void doOperationModeSwitch(Station station) {
public void doOperationModeSwitch(Station station) {
Station.OperationModeApplication applyOperation = station.getOperationModeApplication();
station.setOperationMode(applyOperation.getTarget());
station.setOperationModeApplication(null);
if (applyOperation != null) {
station.setOperationMode(applyOperation.getTarget());
station.setOperationModeApplication(null);
}
}
}

View File

@ -481,22 +481,23 @@ public class AtsTrainService {
param.setThroughSignal(signal);
param.setThroughSignalAspect(signal.getGuideAspect());
} else if (param.isDriverNextStand()){ // 行驶至前方车站
// 列车车头所在区段
Section headSection = train.getHeadPosition().getSection();
// 停车目的区段
if (section.isStandTrack()) {
targetPosition = new SectionPosition(headSection, headSection.getStopPointByDirection(train.isRight()));
targetPosition = new SectionPosition(section, section.getStopPointByDirection(train.isRight()));
} else {
targetPosition = train.calculateNextStandStopPosition();
if (targetPosition == null && train.getTarget() != null) {
targetPosition = new SectionPosition(train.getTarget(), train.getTarget().getStopPointByDirection(train.isRight()));
}
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(targetPosition, train.debugStr() + "找不到下一个停车点");
param.setThroughSignal(section.getSignalOf(right));
}
atpService.changePreselectionMode(train, VirtualRealityTrain.PreselectionMode.RM);
} else if (param.isRouteBlockDriver()) { // 进路闭塞行车
if (!train.isAMMode()) {
atpService.changePreselectionMode(train, VirtualRealityTrain.PreselectionMode.AM_C);
Signal signal = section.getSignalOf(right);
Route route = (signal != null) ? signal.getLockedRoute() : section.getRoute();
if (route != null) {
targetPosition = new SectionPosition(route.getLastRouteSection(), route.getLastRouteSection().getStopPointByDirection(train.isRight()));
param.setThroughSignal(signal);
}
}else {
param.setThroughSignal(null);

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.manage.simulation.cbtc.CI;
import club.joylink.rtss.manage.simulation.cbtc.ATS.service.AtsStationService;
import club.joylink.rtss.manage.simulation.cbtc.CI.device.CiDeviceStatusCollector;
import club.joylink.rtss.manage.simulation.cbtc.CI.device.CiRouteService;
import club.joylink.rtss.manage.simulation.cbtc.CI.device.CiService;
@ -36,6 +37,9 @@ public class CiLogic {
@Autowired
private StationDirectionService stationDirectionService;
@Autowired
private AtsStationService atsStationService;
public void runForTrainPosition(Simulation simulation){
// 采集真实设备状态
deviceStatusCollector.collect(simulation);
@ -60,6 +64,8 @@ public class CiLogic {
// 区间灯点灯逻辑
if (simulation.getRepository().getConfig().isRailway()) {
// 车站站控操作模式转换
atsStationService.replyOperationMode(simulation);
// 车站
simulation.getRepository().getStationList().stream().forEach(station -> {
// 允许自律状态刷新

View File

@ -480,7 +480,7 @@ public class CiRouteService {
* 区故解
*/
public void sectionFaultUnlock(Simulation simulation, Section section, Route route) {
if (route != null) {
if (route != null && route.isLock()) {
if (route.getStart().isApproachLock()
|| section.isOverlapLock()
|| route.getSectionList().stream().anyMatch(Section::isOccupied)) {

View File

@ -42,25 +42,25 @@ public class CiStandService {
switch (source) {
case SIG: {
VirtualRealityPsl vrPsl = stand.getVrPsl();
if (vrPsl != null && vrPsl.isAllowOperation()) {
if (vrPsl != null && vrPsl.isAllowOperate()) {
return false;
}
VirtualRealityIbp vrIbp = stand.getStation().getVrIbp();
if (vrIbp != null && vrIbp.isAllowOperation(true, config.isUp(stand.isRight()))) {
if (vrIbp != null && !vrIbp.isAllowOperate(true, config.isUp(stand.isRight()))) {
return false;
}
break;
}
case PSL: {
VirtualRealityPsl vrPsl = stand.getVrPsl();
if (vrPsl == null || !vrPsl.isAllowOperation()) {
if (vrPsl == null || !vrPsl.isAllowOperate()) {
return false;
}
break;
}
case IBP: {
VirtualRealityIbp vrIbp = stand.getStation().getVrIbp();
if (vrIbp == null || !vrIbp.isAllowOperation(false, config.isUp(stand.isRight()))) {
if (vrIbp == null || !vrIbp.isAllowOperate(false, config.isUp(stand.isRight()))) {
return false;
}
break;

View File

@ -18,12 +18,11 @@ import club.joylink.rtss.manage.vo.AccountVO;
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import club.joylink.rtss.manage.vo.client.SocketMessageVO;
import club.joylink.rtss.manage.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.manage.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.manage.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.manage.vo.permission.PermissionSubjectTypeEnum;
import club.joylink.rtss.manage.vo.permission.PermissionSystemAbilityVO;
import club.joylink.rtss.manage.vo.permission.PermissionTypeEnum;
import club.joylink.rtss.manage.vo.permission.subject.PermissionSubjectVO;
import club.joylink.rtss.manage.websocket.StompMessageService;
import com.google.common.collect.Lists;
@ -73,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())){
@ -111,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();
}
@ -139,7 +138,7 @@ public class SimulationServiceImpl implements SimulationService {
if(CollectionUtils.isEmpty(tmpSubjectVOList)){
continue;
}
List<PermissionSubjectVO> canUseSubjectList = this.checkUserPermissionDetail2(tmpSubjectVOList,functionVO,loginInfo);
List<PermissionSubjectVO> canUseSubjectList = this.findCanUsedPermission(tmpSubjectVOList,functionVO,loginInfo);
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(CollectionUtils.isEmpty(canUseSubjectList),"该权限过期");
for (PermissionSubjectVO subjectVO : canUseSubjectList) {
String key = String.format("%s-%s",st.name(),subjectVO.getId());
@ -158,21 +157,21 @@ public class SimulationServiceImpl implements SimulationService {
return resultMap2;
}
private List<PermissionSubjectVO> checkUserPermissionDetail2(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().isBefore(LocalDateTime.now()))
List<Long> timeOverIdList = newVOLIst.stream().filter(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isAfter(LocalDateTime.now()))
.map(d->d.getId())
.collect(Collectors.toList());
canUseSubjectList = newVOLIst.stream().filter(d->!timeOverIdList.contains(d)).collect(Collectors.toList());
if(CollectionUtils.isEmpty(timeOverIdList)){
log.error("mapId[{}],functionId[{}] userId[{}] 权限过期",functionVO.getMapId(),functionVO.getId(),loginInfo.getAccountVO().getId());
return Collections.emptyList();
}
canUseSubjectList = newVOLIst.stream().filter(d->timeOverIdList.contains(d.getId())).collect(Collectors.toList());
}
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()));
@ -188,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()) {
//有实体设备加载项的地图功能实训室同时只能存在一个
@ -321,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

@ -1125,14 +1125,6 @@ public class Section extends DelayUnlockDevice {
}
}
public Signal querySignalOnDirectionConsiderSectionType(boolean right) {
if (this.isSwitchTrack()) {
return this.querySwitchSectionRelatedSignalByDirection(right);
} else {
return this.getSignalOf(right);
}
}
public String debugStr() {
return String.format("%s(%s)", this.getName(), this.getCode());
}

View File

@ -17,6 +17,7 @@ import club.joylink.rtss.manage.simulation.cbtc.training2.ecm.vo.ExpTypeCategory
import lombok.*;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@ -594,9 +595,22 @@ public class Station extends MayOutOfOrderDevice {
*/
private OperationMode target;
/**
* 申请人
*/
private SimulationMember applicationMember;
/**
* 审批人
*/
private List<SimulationMember> approvalMember;
private LocalDateTime applyDateTime;
public OperationModeApplication(SimulationMember applicantMember, OperationMode source, OperationMode target) {
this.centerApplication = Objects.equals(applicantMember.getType(), SimulationMember.Type.DISPATCHER);
this.stationApplication = Objects.equals(applicantMember.getType(), SimulationMember.Type.STATION_SUPERVISOR);
this.applicationMember = applicantMember;
this.source = source;
this.target = target;
}
@ -636,6 +650,16 @@ public class Station extends MayOutOfOrderDevice {
return stationApplication && centerToShunt();
}
/**
* 审批人全部是机器人
*/
public boolean isRobotApproval() {
if (CollectionUtils.isEmpty(approvalMember)) {
return false;
}
return approvalMember.stream().allMatch(SimulationMember::isRobot);
}
/**
* 中心与调车相互转换
*/

View File

@ -107,6 +107,11 @@ public class StationStatus extends DeviceStatus {
*/
private Station.RouteSetMode routeSetMode;
/**
* 当前操作模式
*/
private Station.OperationMode operationMode;
public StationStatus(Station station) {
super(station.getCode(), station.getDeviceType());
controlMode = station.getControlMode();
@ -129,6 +134,7 @@ public class StationStatus extends DeviceStatus {
}
planControl = station.isPlanControl();
routeSetMode = station.getRouteSetMode();
operationMode = station.getOperationMode();
}
@Override
@ -231,6 +237,11 @@ public class StationStatus extends DeviceStatus {
this.routeSetMode = station.getRouteSetMode();
status.setRouteSetMode(station.getRouteSetMode());
}
if (!Objects.equals(operationMode, station.getOperationMode())) {
change = true;
this.operationMode = station.getOperationMode();
status.setOperationMode(station.getOperationMode());
}
return change;
}
@ -254,6 +265,7 @@ public class StationStatus extends DeviceStatus {
statusVO.setAllowAutonomy(allowAutonomy);
statusVO.setPlanControl(planControl);
statusVO.setRouteSetMode(routeSetMode);
statusVO.setOperationMode(operationMode);
return statusVO;
}
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.manage.simulation.cbtc.data.storage.device;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.manage.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.manage.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.manage.simulation.cbtc.data.map.Station;
@ -12,10 +13,13 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Getter
@Setter
@ -75,6 +79,13 @@ public class StorageStation extends StorageStatusDevice {
*/
private Station.RouteSetMode routeSetMode;
/**
* 当前操作模式
*/
private Station.OperationMode operationMode;
private OperationModeApplicationStorage operationModeApplication;
public StorageStation(Station station) {
super(station);
}
@ -128,6 +139,10 @@ public class StorageStation extends StorageStatusDevice {
if (station.getRouteSetMode() != null) {
this.routeSetMode = station.getRouteSetMode();
}
if (station.getOperationMode() != null) {
this.operationMode = station.getOperationMode();
}
this.operationModeApplication = OperationModeApplicationStorage.convert2Storage(station.getOperationModeApplication());
return true;
}
@ -152,6 +167,64 @@ public class StorageStation extends StorageStatusDevice {
station.setPreResetValidDuration(new AtomicInteger(Objects.requireNonNullElse(preResetValidDuration, 0)));
station.setCounter(counter);
station.setPlanControl(planControl != null && planControl);
station.setRouteSetMode(routeSetMode);
if (routeSetMode != null) {
station.setRouteSetMode(routeSetMode);
}
if (operationMode != null) {
station.setOperationMode(operationMode);
}
if (operationModeApplication != null) {
station.setOperationModeApplication(operationModeApplication.recover2Simulation(simulation));
}
}
@Setter
@Getter
@NoArgsConstructor
public static class OperationModeApplicationStorage {
/**
* 源操作方式
*/
private Station.OperationMode source;
/**
* 目的操作方式
*/
private Station.OperationMode target;
/**
* 申请者ID
*/
private String applicationMemberId;
/**
* 审批者ID
*/
private List<String> approvalMemberIds;
private LocalDateTime applyDateTime;
public static OperationModeApplicationStorage convert2Storage(Station.OperationModeApplication application) {
if (application == null) {
return null;
}
OperationModeApplicationStorage storage = new OperationModeApplicationStorage();
storage.setApplicationMemberId(application.getApplicationMember().getId());
storage.setSource(application.getSource());
storage.setTarget(application.getTarget());
storage.setApplyDateTime(application.getApplyDateTime());
storage.setApprovalMemberIds(application.getApprovalMember().stream().map(SimulationMember::getId).collect(Collectors.toList()));
return storage;
}
public Station.OperationModeApplication recover2Simulation(Simulation simulation){
SimulationMember simulationMember = simulation.getSimulationMemberById(applicationMemberId);
List<SimulationMember> approvalMember = approvalMemberIds.stream().map(simulation::getSimulationMemberById).collect(Collectors.toList());
Station.OperationModeApplication application =new Station.OperationModeApplication(simulationMember, source, target);
application.setApplyDateTime(applyDateTime);
application.setApprovalMember(approvalMember);
return application;
}
}
}

View File

@ -94,6 +94,8 @@ public class StationStatusVO extends DeviceStatusVO {
private Station.RouteSetMode routeSetMode;
private Station.OperationMode operationMode;
public StationStatusVO(Station station) {
super(station.getCode(), station.getDeviceType());
}

View File

@ -125,7 +125,7 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
* @param up 是否是上行
* @return
*/
public boolean isAllowOperation(boolean signal, boolean up) {
public boolean isAllowOperate(boolean signal, boolean up) {
List<IbpElement> elements = up ? queryByMean(Mean.SXYS) : queryByMean(Mean.XXYS);
if (CollectionUtils.isEmpty(elements)) {
return true;

View File

@ -1,6 +1,5 @@
package club.joylink.rtss.manage.simulation.cbtc.data.vr;
import club.joylink.rtss.manage.simulation.cbtc.data.map.MapNamedElement;
import club.joylink.rtss.manage.simulation.cbtc.data.map.Stand;
import lombok.Getter;
import lombok.Setter;
@ -52,7 +51,7 @@ public class VirtualRealityPsl extends VirtualRealityDevice {
this.sdButton = false;
}
public boolean isAllowOperation() {
public boolean isAllowOperate() {
return this.isYxjzKey();
}

View File

@ -1336,7 +1336,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
AA,
;
public boolean isAuto(boolean open) {
public boolean isManual(boolean open) {
return (open && this.equals(MM)) || (!open && !this.equals(AA));
}
}

View File

@ -63,33 +63,7 @@ public class ATPLogicLoop {
// System.out.println(String.format("------------ATP防护、检查、消息构建发送逻辑耗时: %s ms", (end-start)));
}
/**
* 更新列车运行级别
*/
private void updateRunLevel(Simulation simulation, VirtualRealityTrain train, VirtualRealityTrain.PreselectionMode preselectionMode) {
//如果当前级别高于预选降至IL
if (!preselectionMode.isMatchTheRunLevel(train.getRunLevel())) {
atpService.updateRunLevel(train, RunLevel.IL, preselectionMode);
}
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
//更新移动授权丢失时长
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
//判断并控制运行级别
if (!train.isPositioned()) { //列车定位丢失降级
if (train.isITC() || train.isCBTC()) { //并且是ITC/CBTC级别
atpService.updateRunLevel(train, RunLevel.IL, preselectionMode);
atpService.triggerSignalEB(train);
}
} else { //列车有定位
if (train.isCBTC() && train.isCbtcMaMiss()) { //CBTC列车的移动授权丢失
atpService.updateRunLevel(train, RunLevel.IL, preselectionMode);
atpService.triggerSignalEB(train);
} else if (!train.isCBTC() && !train.isCbtcMaMiss() && defaultRunLevel.equals(RunLevel.CBTC)) {
atpService.updateRunLevel(train, RunLevel.CBTC, preselectionMode);
}
}
}
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
// MaService.Ma ma2 = train.getMa2();
@ -124,7 +98,7 @@ public class ATPLogicLoop {
}
private void onboardLogicRun2(Simulation simulation, VirtualRealityTrain train) {
this.handlePreselectionMode(simulation, train);
atpService.handlePreselectionMode(simulation, train);
this.calculateSpeedCurve(simulation, train);
this.closeATOIfStatusIsIncorrect(train);
train.setAtoCanOpen(atpService.canOpenATO(train));
@ -271,31 +245,6 @@ public class ATPLogicLoop {
}
private void handlePreselectionMode(Simulation simulation, VirtualRealityTrain train) {
VirtualRealityTrain.PreselectionMode preselectionMode = train.getPreselectionMode();
MapConfig config = simulation.getRepository().getConfig();
switch (preselectionMode) {
case AM_C:
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
train.setCommunication(true);
break;
case SM_C:
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
train.setCommunication(true);
atpService.closeATO(train);
break;
case AM_I:
train.setCommunication(false);
break;
case SM_I:
case RM:
train.setCommunication(false);
atpService.closeATO(train);
break;
}
updateRunLevel(simulation, train, preselectionMode);
}
private void updateRunningTime(VirtualRealityTrain train) {
if (train.isParkingAt()) {
train.setRunningTime(0);

View File

@ -11,6 +11,7 @@ import club.joylink.rtss.manage.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.manage.simulation.cbtc.constant.SimulationModule;
import club.joylink.rtss.manage.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.manage.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.manage.simulation.cbtc.data.map.MapConfig;
import club.joylink.rtss.manage.simulation.cbtc.data.map.Section;
import club.joylink.rtss.manage.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.manage.simulation.cbtc.data.support.MovementAuthority;
@ -24,6 +25,7 @@ import club.joylink.rtss.manage.simulation.cbtc.exception.SimulationExceptionTyp
import club.joylink.rtss.manage.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.manage.simulation.cbtc.onboard.ATO.SpeedCurve;
import club.joylink.rtss.manage.simulation.cbtc.onboard.ATO.service.ATOService;
import club.joylink.rtss.manage.simulation.cbtc.robot.SimulationRobotService;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -45,6 +47,8 @@ public class ATPService {
@Autowired
private CiApiService ciApiService;
@Autowired
private SimulationRobotService simulationRobotService;
/**
* 更新列车移动授权
@ -302,7 +306,7 @@ public class ATPService {
public void openOrCloseDoor(Simulation simulation, VirtualRealityTrain train, boolean right, boolean open) {
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getSpeed() == 0, String.format("列车[%s]未停止,不能操作车门", train.getGroupNumber()));
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorMode().isAuto(open), String.format("列车[%s]门模式自动,不能操作车门", train.getGroupNumber()));
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorMode().isManual(open), String.format("列车[%s]门模式自动,不能操作车门", train.getGroupNumber()));
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorSelection().match(right),String.format("列车[%s]门选择与操作不匹配", train.getGroupNumber()));
List<Stand> standList = train.getHeadPosition().getSection().getStandList();
VirtualRealityTrain.Door door = train.getDoorByDirection(right);
@ -522,7 +526,23 @@ public class ATPService {
}
VirtualRealityTrain.Door door = train.getDoorByDirection(doorIsRight);
if (!Objects.equals(door.isOpen(), open)) {
openOrCloseDoor(simulation, train, doorIsRight, open);
// 使用更简单粗暴的方式保证门可以打开如果不合适再改
if (open) {
ATOService.openTrainDoor(simulation, train, door);
} else {
ATOService.closeTrainDoor(simulation, train, door);
}
simulationRobotService.usePsl2ControlPsd(simulation, train, open);
// //修改门模式和门选以保证操作成功
// VirtualRealityTrain.DoorMode doorMode = train.getDoorMode();
// train.setDoorMode(VirtualRealityTrain.DoorMode.MM);
// VirtualRealityTrain.DoorSelection doorSelection = train.getDoorSelection();
// train.setDoorSelection(doorIsRight ? VirtualRealityTrain.DoorSelection.R : VirtualRealityTrain.DoorSelection.L);
// //操作
// openOrCloseDoor(simulation, train, doorIsRight, open);
// //操作后将门模式和门选还原
// train.setDoorMode(doorMode);
// train.setDoorSelection(doorSelection);
}
}
@ -547,15 +567,36 @@ public class ATPService {
*/
public void changePreselectionMode(Simulation simulation, String groupNumber, VirtualRealityTrain.PreselectionMode preselectionMode) {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
// 检验条件
// operationVail(simulation,train);
if (preselectionMode == train.getPreselectionMode()) {
return;
}
if (!train.isAtpOn()) {
this.openAtp(train);
}
if (train.isSignalEB()) {
this.releaseEB(train);
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) {
changeGear(train, VirtualRealityTrain.Handwheel.MANUAL);
}
if (!train.isStop() || !train.isLeverNotInTractionGear()) {
changeTrainForce(train, -2F); // 改变列车的牵引/
}
if (!train.isRMMode()) {
train.setTempPreselectionMode(PreselectionMode.RM);
train.setPreselectionMode(PreselectionMode.RM);
}
}
changePreselectionMode(train, preselectionMode);
// 对预选模式条件卡控
if (preselectionMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
changeGear(train, VirtualRealityTrain.Handwheel.ATO);
}
if (!train.isLeverInCoastingGear()) {
changeTrainForce(train, 0f); // 改变列车的牵引/
}
}
train.setTempPreselectionMode(preselectionMode);
train.setPreselectionMode(preselectionMode);
handlePreselectionMode(simulation, train);
}
/**
@ -603,54 +644,25 @@ public class ATPService {
}
/**
* 修改预选模式
*
* @param train 列车
* @param preselectionMode 预选模式
* 打开ato
*/
public void changePreselectionMode(VirtualRealityTrain train, PreselectionMode preselectionMode) {
boolean loop = true;
PreselectionMode trainMode = null;
while (loop) {
trainMode = train.getPreselectionMode();
if (trainMode != preselectionMode) { //预选级别不对
if (train.getPreselectionMode() != preselectionMode) {
if (train.getTempPreselectionMode() != preselectionMode) {
if (preselectionMode.isHigherThan(train.getTempPreselectionMode())) {
this.preselectionModeUp(train);
} else {
this.preselectionModeDown(train);
}
} else {
this.confirmMessage(train);
}
}
} else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
train.getRobotDriveParam().setRun(false); // 关闭机器人自动驾驶
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
this.changeGear(train, VirtualRealityTrain.Handwheel.ATO);
}
if (!train.isLeverInCoastingGear()) {
this.changeTrainForce(train, 0F); // 改变列车的牵引
}
if (!train.isAtoOn()) {
this.openATO(train);
}
} else {
loop = false;
}
public void openAto(Simulation simulation, String groupNumber) {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
if (train.isAtoOn()) { //ATO已经开启
return;
}
}
private void releaseEB(VirtualRealityTrain train) {
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) {
changeGear(train, VirtualRealityTrain.Handwheel.MANUAL);
if (!train.isAtpOn()) { // 列车ATP未启用
this.openAtp(train);
}
if (!train.isStop() || !train.isLeverNotInTractionGear()) {
changeTrainForce(train, -2F); // 改变列车的牵引/
if (!VirtualRealityTrain.Handwheel.ATO.equals(train.getGear())) { //工况手轮不在ATO位
changeGear(train, VirtualRealityTrain.Handwheel.ATO);
}
if (!train.isRMMode()) {
changePreselectionMode(train, PreselectionMode.RM);
if (!train.isInAMPreselectionMode()) { //不在AM-预选模式
changePreselectionMode(simulation, groupNumber, PreselectionMode.AM_C);
}
if (!train.isAtoOn()) {
train.setAtoOn(true);
train.setDriveMode(DriveMode.AM);
}
}
@ -661,4 +673,62 @@ public class ATPService {
.anyMatch(SimulationMember::isRobot);
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotTrue(!driverRobot,"成员由用户扮演,操作不执行");
}
/**
* 处理预处理模式
* @param simulation 仿真
* @param train 列车
*/
public void handlePreselectionMode(Simulation simulation, VirtualRealityTrain train) {
VirtualRealityTrain.PreselectionMode preselectionMode = train.getPreselectionMode();
MapConfig config = simulation.getRepository().getConfig();
switch (preselectionMode) {
case AM_C:
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
train.setCommunication(true);
break;
case SM_C:
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
train.setCommunication(true);
closeATO(train);
break;
case AM_I:
train.setCommunication(false);
break;
case SM_I:
case RM:
train.setCommunication(false);
closeATO(train);
break;
}
updateRunLevel(simulation, train, preselectionMode);
}
/**
* 更新列车运行级别
*/
private void updateRunLevel(Simulation simulation, VirtualRealityTrain train, VirtualRealityTrain.PreselectionMode preselectionMode) {
//如果当前级别高于预选降至IL
if (!preselectionMode.isMatchTheRunLevel(train.getRunLevel())) {
updateRunLevel(train, RunLevel.IL, preselectionMode);
}
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
//更新移动授权丢失时长
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
//判断并控制运行级别
if (!train.isPositioned()) { //列车定位丢失降级
if (train.isITC() || train.isCBTC()) { //并且是ITC/CBTC级别
updateRunLevel(train, RunLevel.IL, preselectionMode);
triggerSignalEB(train);
}
} else { //列车有定位
if (train.isCBTC() && train.isCbtcMaMiss()) { //CBTC列车的移动授权丢失
updateRunLevel(train, RunLevel.IL, preselectionMode);
triggerSignalEB(train);
} else if (!train.isCBTC() && !train.isCbtcMaMiss() && defaultRunLevel.equals(RunLevel.CBTC)) {
updateRunLevel(train, RunLevel.CBTC, preselectionMode);
}
}
}
}

View File

@ -110,7 +110,7 @@ public class SimulationRobotService {
/**
* 使用psl控制屏蔽门
*/
private void usePsl2ControlPsd(Simulation simulation, VirtualRealityTrain train, boolean open) {
public void usePsl2ControlPsd(Simulation simulation, VirtualRealityTrain train, boolean open) {
SectionPosition headPosition = train.getHeadPosition();
Section section = headPosition.getSection();
List<Stand> standList = section.getStandList();
@ -130,7 +130,7 @@ public class SimulationRobotService {
}
}
VirtualRealityPsl vrPsl = stand.getVrPsl();
if (!vrPsl.isAllowOperation()) { //确保此时允许操作
if (!vrPsl.isAllowOperate()) { //确保此时允许操作
iVirtualRealityPslService.pressTheButton(simulation,
stand.getCode(), VirtualRealityPsl.Button.YXJZ);
}
@ -141,7 +141,7 @@ public class SimulationRobotService {
iVirtualRealityPslService.pressTheButton(simulation,
stand.getCode(), VirtualRealityPsl.Button.GM);
}
if (vrPsl.isAllowOperation()) { //将允许禁止钥匙打到禁止位
if (vrPsl.isAllowOperate()) { //将允许禁止钥匙打到禁止位
iVirtualRealityPslService.pressTheButton(simulation,
stand.getCode(), VirtualRealityPsl.Button.YXJZ);
}
@ -176,36 +176,30 @@ public class SimulationRobotService {
doBreakMax(simulation, train);
}
} else if (train.isRobotNeedRun() && (train.isRMMode() || train.isNRMMode())) { //CM应当根据推荐速度驾驶待实现
newRobotDrive(simulation, driver, train);
Optional<SectionPosition> targetPositionOptional = calculateTargetPosition(simulation, train);
targetPositionOptional.ifPresent(tp -> robotDrive(simulation, driver, train, tp));
}
}
}
private void newRobotDrive(Simulation simulation, SimulationMember driver, VirtualRealityTrain train) {
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) { //确保当前在手动档位
CommandBO.Step step = CommandBO.buildGearChangeStep(train.getGroupNumber(), VirtualRealityTrain.Handwheel.MANUAL);
atsOperationDispatcher.execute(simulation, driver, step.getOperationType().name(), step.getOperationParams());
}
/**
* 计算目标位置
*/
private Optional<SectionPosition> calculateTargetPosition(Simulation simulation, VirtualRealityTrain train) {
DriveParamVO robotDriveParam = train.getRobotDriveParam();
if (train.isEB()) {
if (robotDriveParam.isReleaseEB()) {
releaseEB(simulation, driver, train);
if (!robotDriveParam.isReleaseEB()) { //列车EB了且没有要求解除EB
return Optional.empty();
}
} else {
robotDriveParam.setReleaseEB(false);
}
SectionPosition robotTargetPosition = robotDriveParam.getTargetPosition(); //目标位置
Section robotTargetSection = null; //目标区段
if (robotTargetPosition != null) {
robotTargetSection = robotTargetPosition.getSection();
}
Set<Section> stopSections = new HashSet<>(); //需要停车的区段
Set<Section> plannedParkingSections = new HashSet<>(); //计划中的停车位置当此字段不为空时则计划外的站台轨不停车
SimulationDataRepository repository = simulation.getRepository();
SectionPosition headPosition = train.getHeadPosition();
Section headSection = headPosition.getSection();
if (repository.getConfig().isRailway()) {
boolean right = train.isRight();
if (repository.getConfig().isRailway()) { //如果是大铁线路计划根据运行日志确定要停车的区段
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
CtcRepository ctcRepository = simulation.getCtcRepository();
Collection<CtcStationRunPlanLog> runPlans = ctcRepository.findRunPlans(trainInfo.getTripNumber());
@ -215,84 +209,84 @@ public class SimulationRobotService {
if (arriveRunPlan != null) {
Section trackSection = arriveRunPlan.getTrackSection();
if (!Objects.equals(trackSection, train.getParkSection())) {
stopSections.add(trackSection);
plannedParkingSections.add(trackSection);
}
}
CtcStationRunPlanLog.RunPlanItem departRunPlan = runPlan.getDepartRunPlan();
if (departRunPlan != null) {
Section trackSection = departRunPlan.getTrackSection();
if (!Objects.equals(trackSection, train.getParkSection())) {
stopSections.add(trackSection);
plannedParkingSections.add(trackSection);
}
}
}
} else { //无计划车在所有站台轨都停车
//本来是想将所有站台轨都加进来但为了效率考虑只加入列车车头区段如果符合条件的话
if (headSection.isNormalStandTrack() && !Objects.equals(train.getParkSection(), headSection)) {
stopSections.add(headSection);
}
}
}
Signal throughSignal = robotDriveParam.getThroughSignal();
SignalAspect throughAspect = robotDriveParam.getThroughSignalAspect();
/* 自动驾驶逻辑就是在[目标位置][需要停车区段的停车位置][信号禁止位置要越过的信号不算]中找到最近的一个位置作为
自动驾驶的目标位置 */
boolean right = train.isRight();
Section section = headSection;
Section section = headPosition.getSection();
if (throughSignal != null && !Objects.equals(section, throughSignal.getSection())) { //当车头与要越过的信号机不在同一区段
throughSignal = null;
throughAspect = null;
robotDriveParam.setThrough(DriveParamVO.NO);
}
SectionPosition selectedPosition = robotDriveParam.getTargetPosition(); //用户选择的位置
SectionPosition targetPosition = null;
for (int i = 0; i < 10; i++) {
Signal signal = section.getSignalOf(right);
if (signal != null && !signal.isShunting()) {
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
SectionPosition signalPosition = signal.getPosition();
if (vrSignal != null
&& (i != 0 || signalPosition.isAheadOf(headPosition, right))) { //有实体信号机且列车未越过信号机
if (Objects.equals(vrSignal.getAspect(), signal.getDefaultAspect()) //禁止信号
|| Objects.equals(vrSignal.getAspect(), signal.getGuideAspect())) { //引导信号
if (!Objects.equals(signal, throughSignal) || !Objects.equals(vrSignal.getAspect(), throughAspect)) {
targetPosition = CalculateService
.calculateNextPositionByStartAndLen(signalPosition, !right, 2, true);
if (section.isNormalStandTrack() && !section.equals(train.getParkSection())) { //正常站台轨且未在此处停过车
if (CollectionUtils.isEmpty(plannedParkingSections) || plannedParkingSections.contains(section)) {
SectionPosition stopPosition = section.buildStopPointPosition(right);
if (targetPosition == null || stopPosition.isAheadOf(targetPosition, right)) {
if (headPosition.getOffset() < (section.getStopPointByDirection(right) + SimulationConstants.PARK_POINT_MAX_OFFSET)) { //防止意外开过站后无法发车
targetPosition = stopPosition;
}
}
}
}
//此时拿到了禁止信号的停车位置取其与目标位置间更近的一个
if (Objects.equals(section, robotTargetSection)) { //到目标区段
if (targetPosition == null || targetPosition.isAheadOf(robotTargetPosition, right)) {
targetPosition = robotTargetPosition;
// 取禁止信号前停车位置与当前目标停车位置中更近的一个
Signal signal = section.getSignalOf(right);
if (signal != null && !signal.isShunting()) {
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
SectionPosition signalPosition = signal.getPosition();
if (vrSignal != null && (i != 0 || signalPosition.isAheadOf(headPosition, right))) { //有实体信号机且列车未越过信号机
if (Objects.equals(vrSignal.getAspect(), signal.getDefaultAspect()) //禁止信号
|| Objects.equals(vrSignal.getAspect(), signal.getGuideAspect())) { //引导信号
if (!Objects.equals(signal, throughSignal) || !Objects.equals(vrSignal.getAspect(), throughAspect)) {
SectionPosition noPassPosition = CalculateService
.calculateNextPositionByStartAndLen(signalPosition, !right, 2, true);
if (targetPosition == null || noPassPosition.isAheadOf(targetPosition, right)) {
targetPosition = noPassPosition;
}
}
}
}
}
//再将最近的位置与需要停车的区段的停车点做比较取更近的一个
if (stopSections.contains(section)) {
SectionPosition stopPosition = section.buildStopPointPosition(right);
if (targetPosition == null || targetPosition.isAheadOf(stopPosition, right)) {
targetPosition = stopPosition;
}
}
//如果到轨道尽头目标位置选择尽头向内10m否则继续向后寻找
if (targetPosition == null) {
Section tempSection = section.findNextRunningSectionBaseRealSwitch(right);
if (tempSection == null) {
targetPosition = new SectionPosition(section, right ? section.getLen() - 10 : 10);
if (selectedPosition != null && section.equals(selectedPosition.getSection())) { //不会有比选定位置更靠前的停车点了
targetPosition = selectedPosition;
} else {
section = tempSection;
Section tempSection = section.findNextRunningSectionBaseRealSwitch(right);
if (tempSection == null) { //到了轨道尽头目标位置为尽头向内10m
targetPosition = new SectionPosition(section, right ? section.getLen() - 10 : 10);
} else {
section = tempSection;
}
}
} else {
if (selectedPosition != null && selectedPosition.isAheadOf(targetPosition, right)) {
targetPosition = selectedPosition;
}
}
if (targetPosition != null) {
break;
}
}
if (targetPosition == null) {
if (targetPosition == null) { //上方的区段遍历完后即没有找到目标区段也没有找到轨道尽头
targetPosition = new SectionPosition(section, right ? 0 : section.getMaxOffset());
}
robotDrive(simulation, train, targetPosition);
return Optional.ofNullable(targetPosition);
}
private void releaseEB(Simulation simulation, SimulationMember driver, VirtualRealityTrain train) {
@ -315,122 +309,22 @@ public class SimulationRobotService {
}
}
/**
* 大铁机器人自动驾驶目前的驾驶逻辑是针对RM/NRM模式驾驶
* 在确认列车自身状态正确的情况下车门是关闭状态等如果是没有计划的车次则只看信号如果是有计划的车次还需要看计划
*/
private void railRobotDrive(Simulation simulation, VirtualRealityTrain train) {
if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock())
return;
SimulationDataRepository repository = simulation.getRepository();
boolean right = train.isRight();
SectionPosition headPosition = train.getHeadPosition();
Section nextSection = headPosition.getSection();
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
CtcRepository ctcRepository = simulation.getCtcRepository();
Collection<CtcStationRunPlanLog> runPlans = ctcRepository.findRunPlans(trainInfo.getTripNumber());
Set<Section> tracks = new HashSet<>();
for (CtcStationRunPlanLog runPlan : runPlans) {
CtcStationRunPlanLog.RunPlanItem arriveRunPlan = runPlan.getArriveRunPlan();
if (arriveRunPlan != null)
tracks.add(arriveRunPlan.getTrackSection());
CtcStationRunPlanLog.RunPlanItem departRunPlan = runPlan.getDepartRunPlan();
if (departRunPlan != null)
tracks.add(departRunPlan.getTrackSection());
}
SectionPosition targetPosition = null;
for (int i = 0; i < 10; i++) {
if (tracks.contains(nextSection) && !nextSection.equals(train.getParkSection())) { //这个判断感觉迟早要出问题
targetPosition = nextSection.buildStopPointPosition(right); //站台轨停车点
break;
}
Signal signal = nextSection.getSignalOf(right);
if (signal != null && !signal.isShunting()) { //有同向非通过信号机
SectionPosition signalPosition = signal.getPosition();
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
if (vrSignal != null && !headPosition.isAheadOf(signalPosition, right)) { //有物理信号机并且车头没有越过信号机
if (!SignalAspect.G.equals(vrSignal.getAspect())
&& !SignalAspect.Y.equals(vrSignal.getAspect())
&& !SignalAspect.YY.equals(vrSignal.getAspect())) { //大铁线路暂时默认绿灯和黄/双黄灯是正常通行信号
targetPosition = CalculateService.calculateNextPositionByStartAndLen(signalPosition, !right, 5, true); //信号机前5m处
break;
}
}
}
Section next = nextSection.findNextRunningSectionBaseRealSwitch(right);
if (next == null) {
targetPosition = new SectionPosition(nextSection, right ? nextSection.getLen() - 10 : 10); //轨道尽头10m处
break;
}
nextSection = next;
}
if (targetPosition == null && nextSection != null) {
targetPosition = new SectionPosition(nextSection, right ? 0 : nextSection.getMaxOffset());
}
if (targetPosition != null)
robotDrive(simulation, train, targetPosition);
}
/**
* 机器人根据指令驾驶列车
*/
private void robotDriveByCommand(Simulation simulation, SimulationMember driver, VirtualRealityTrain train) {
SectionPosition targetPosition = train.getRobotTargetPosition();
if (targetPosition == null)
return;
SectionPosition headPosition = train.getHeadPosition();
boolean right = train.isRight();
//检查是否已到达/越过目的地
Float distance = CalculateService.calculateDistanceDoubleDirection(headPosition, targetPosition, right);
if (distance != null && distance < SimulationConstants.PARK_POINT_MAX_OFFSET) {
atoService.doBreakMax(train);
train.setRobotTargetPosition(null);
return;
}
CommandBO command = driver.getCommand();
CommandBO.CommandType commandType = null;
if (command != null) {
commandType = command.getCommandType();
}
if (!CommandBO.CommandType.Drive_Through_The_Guide_Signal.equals(commandType)
&& !CommandBO.CommandType.Drive_Through_The_Red_Light.equals(commandType)) { //非越红灯越引导指令时考虑信号机状态
//判断前方信号机正常开放以控制目标位置
Section nextSection = headPosition.getSection();
for (int i = 0; i < 3; i++) {
if (nextSection.equals(targetPosition.getSection())) //当前区段就是目标区段则不需要考虑区段末端的信号机了
break;
Signal signal = nextSection.getSignalOf(right);
if (signal != null && !Signal.SignalType.SHUNTING.equals(signal.getType())) {
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
if (vrSignal != null &&
(Objects.equals(signal.getGuideAspect(), vrSignal.getAspect())
|| Objects.equals(signal.getDefaultAspect(), vrSignal.getAspect())
|| SignalAspect.No.equals(vrSignal.getAspect()))) { //真实信号机不为null且信号机显示是引导/默认/灭灯
//目标位置修改为信号机前5米
SectionPosition signalPosition = signal.getPosition();
targetPosition = CalculateService.calculateNextPositionByStartAndLen(signalPosition, !right, 5, true);
break;
}
}
nextSection = nextSection.findNextRunningSectionBaseRealSwitch(right);
if (nextSection == null)
break;
}
}
robotDrive(simulation, train, targetPosition);
}
/**
* 机器人驾驶
*
* @param simulation
* @param train
* @param targetPosition
*/
private void robotDrive(Simulation simulation, VirtualRealityTrain train, SectionPosition targetPosition) {
private void robotDrive(Simulation simulation, SimulationMember driver, VirtualRealityTrain train, SectionPosition targetPosition) {
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) { //确保当前在手动档位
CommandBO.Step step = CommandBO.buildGearChangeStep(train.getGroupNumber(), VirtualRealityTrain.Handwheel.MANUAL);
atsOperationDispatcher.execute(simulation, driver, step.getOperationType().name(), step.getOperationParams());
}
if (train.isEB()) {
if (train.getRobotDriveParam().isReleaseEB()) {
releaseEB(simulation, driver, train);
} else {
return;
}
}
SimulationDataRepository repository = simulation.getRepository();
SectionPosition headPosition = train.getHeadPosition();
boolean right = train.isRight();
@ -438,8 +332,8 @@ public class SimulationRobotService {
if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关
return;
}
/**
* 添加车辆停靠车站时车门关闭后向前行驶一点的问题因为车头偏移与目标偏移大于 @seeSimulationConstants.PARK_POINT_MAX_OFFSET位置故修正逻辑如下
/*
* 添加车辆停靠车站时车门关闭后向前行驶一点的问题因为车头偏移与目标偏移大于 @see SimulationConstants.PARK_POINT_MAX_OFFSET位置故修正逻辑如下
* 判断车辆是否停靠车站没有开发的信号没有新车命令如果有其中一项的条件那么车辆可以启动
* begin 2022-08-15
*/
@ -454,7 +348,7 @@ public class SimulationRobotService {
if(trainPackingForStand && closeSignal && noCommond){
return;
}
/**
/*
* end 2022-08-15
*/
Float distance = CalculateService.calculateDistance(headPosition, targetPosition, right, true);
@ -540,7 +434,8 @@ public class SimulationRobotService {
return;
}
Map<SimulationMember, List<Station>> robotControlStations = simulation.getRepository().getStationList().stream()
.filter(station -> Objects.nonNull(station.getController()) && station.getController().isRobot() && Objects.nonNull(station.getControlApplicant())).collect(Collectors.groupingBy(Station::getController));
.filter(station -> Objects.nonNull(station.getController()) && station.getController().isRobot() && Objects.nonNull(station.getControlApplicant()))
.collect(Collectors.groupingBy(Station::getController));
robotControlStations.forEach((controler, stations) -> {
atsStationService.transferControl(simulation, stations.stream().map(Station::getCode).collect(Collectors.toList()), true, controler);
});
@ -570,9 +465,21 @@ public class SimulationRobotService {
if (simulation.getScript() != null && simulation.getScript().isBgSet()) {
return;
}
simulation.getRepository().getStationList().stream().filter(station -> station.getOperationModeApplication() != null)
.forEach(station -> atsStationService.replyOperationMode(simulation, station));
// 实训场景模式已设置背景处于编制状态的实训不做自动转换处理
Training2 training2 = simulation.getTraining2();
if (training2 != null && training2.isScene() && StringUtils.hasText(training2.getBgSceneJson()) && !training2.isRunning()) {
return;
}
// 非单岗位一直等待角色同意
if (!simulation.getBuildParams().getWorkParamVO().getDomConfig().isSingleMember()) {
return;
}
simulation.getRepository().getStationList().stream()
// 申请不为空审批人全部为机器人
.filter(station -> station.getOperationModeApplication() != null && station.getOperationModeApplication().isRobotApproval())
.forEach(station -> atsStationService.doOperationModeSwitch(station));
}
private void doControlBySpeedCurve(Simulation simulation, VirtualRealityTrain train, SpeedCurve speedCurve, float remainDistance) {
if (speedCurve.equals(SpeedCurve.ZERO)) {
this.doBreakMax(simulation, train);

View File

@ -24,6 +24,9 @@ public abstract class Operation2 {
@Setter
private Expression failureCondition;
@Setter
boolean special;
/**
* 开始时间
*/
@ -151,6 +154,9 @@ public abstract class Operation2 {
if (vo.getFailureCondition() != null) {
this.setFailureCondition(vo.getFailureCondition().convert2BO(simulation.getRepository()));
}
if (vo.getSpecial() != null) {
this.setSpecial(vo.getSpecial());
}
}
}
@ -188,6 +194,9 @@ public abstract class Operation2 {
if (vo.getCompletionCondition() != null) {
this.setCompletionCondition(vo.getCompletionCondition().convert2BO(simulation.getRepository()));
}
if (vo.getSpecial() != null) {
this.setSpecial(vo.getSpecial());
}
}
}
}

View File

@ -4,10 +4,12 @@ import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.simulation.cbtc.training2.Training2;
import lombok.*;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
@ -57,6 +59,22 @@ public class SimulationWorkParamVO {
return itemMap.containsKey(Item.REAL_DEVICE);
}
/**
* 纠正参数
*/
public void correctParam() {
if (!CollectionUtils.isEmpty(itemMap)) {
Iterator<Map.Entry<Item, String>> iterator = itemMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<SimulationWorkParamVO.Item, String> entry = iterator.next();
String value = entry.getValue();
if (!StringUtils.hasText(value)) {
iterator.remove();
}
}
}
}
/**
* 可加载项
*/
@ -101,7 +119,9 @@ public class SimulationWorkParamVO {
private boolean singleClient;
private String client;
/** 应急调度客户端 */
/**
* 应急调度客户端
*/
public static final String EMERGENCY = "emergency";
private boolean hasTraining;

View File

@ -17,6 +17,7 @@ import java.time.LocalDateTime;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -241,6 +242,7 @@ public class MinioClientUtil {
String uploadPath = config.getMinioClient().getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder().method(method)
.bucket(config.getBucket()).object(getSavePath(fileName))
.versionId(UUID.randomUUID().toString())
.expiry(60 * 60 * 24)
.extraQueryParams(reqParams)
.build()

View File

@ -325,7 +325,7 @@ public class AccountVO implements Serializable {
this.companyAdmin = orgAdmin;
this.projectCodes = orgVO.getProjectCodes();
} else {
this.companyId = 0L;
this.companyId = null;
this.companyName = null;
this.companyAdmin = false;
this.projectCodes = List.of();

View File

@ -98,7 +98,8 @@ public class SocketMessageFactory {
case Simulation_Scenes_Reload:
case Competition_Practical:
case SIMULATION_RAIL_TICKET:
case Simulation_Alarm: {
case Simulation_Alarm:
case Simulation_Operation_Mode_Apply: {
topicList.add(SimulationSubscribeTopic.Main.buildDestination(group));
break;
}

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.manage.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;
@ -22,16 +22,22 @@ public class RtsMapFunctionCreateVO {
private String desc;
private String bgUrl;
private String subset;
@NotNull(message = "参数不能为空")
private SimulationWorkParamVO paramVO;
public RtsMapFunction convert2DB() {
if (paramVO != null) {
paramVO.correctParam();
}
RtsMapFunction rtsMapFunction = new RtsMapFunction();
rtsMapFunction.setMapId(mapId);
rtsMapFunction.setName(name);
rtsMapFunction.setDesc(desc);
rtsMapFunction.setBgUrl(bgUrl);
rtsMapFunction.setType(paramVO.getType().name());
rtsMapFunction.setGroup(subset);
rtsMapFunction.setParam(JsonUtils.writeValueAsString(paramVO));

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.manage.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,15 @@ 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;
/**
* 是否需要详细信息
*/
private boolean detail;
}

View File

@ -13,19 +13,38 @@ import javax.validation.constraints.NotNull;
@Getter
@Setter
@NoArgsConstructor
public class RtsMapFunctionUpdateVO {
public class MapFunctionUpdateVO {
@NotBlank(message = "名称不能为空")
private String name;
private String desc;
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));
if (paramVO != null) {
paramVO.correctParam();
entity.setParam(JsonUtils.writeValueAsString(paramVO));
}
}
}

View File

@ -7,13 +7,14 @@ import club.joylink.rtss.manage.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;
@ -22,6 +23,8 @@ public class RtsMapFunctionVO {
private String desc;
private String bgUrl;
private Simulation.Type simType;
private String subset;
@ -36,15 +39,17 @@ public class RtsMapFunctionVO {
private LocalDateTime updateTime;
public RtsMapFunctionVO(RtsMapFunction entity) {
public MapFunctionVO(RtsMapFunction entity) {
id = entity.getId();
mapId = entity.getMapId();
name = entity.getName();
desc = entity.getDesc();
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

@ -0,0 +1,18 @@
package club.joylink.rtss.manage.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.manage.vo.client.mapFunctionTemplate;
import club.joylink.rtss.manage.entity.MapFunctionTemplate;
import club.joylink.rtss.manage.util.JsonUtils;
import club.joylink.rtss.manage.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,11 @@
package club.joylink.rtss.manage.vo.client.mapFunctionTemplate;
import club.joylink.rtss.manage.vo.client.PageQueryVO;
public class MapFunctionTemplateQueryVO extends PageQueryVO {
/**
* 需要详细信息
*/
private boolean detail;
}

View File

@ -0,0 +1,54 @@
package club.joylink.rtss.manage.vo.client.mapFunctionTemplate;
import club.joylink.rtss.manage.entity.MapFunctionTemplate;
import club.joylink.rtss.manage.util.JsonUtils;
import club.joylink.rtss.manage.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

@ -34,7 +34,7 @@ public class OrgUserVO {
if (account != null) {
this.userId = account.getId();
this.account = account.getAccount();
this.name = account.getName();
this.name = String.format("%s(%s)", account.getNickname(), account.getName());
}
if (org != null) {
this.companyId = org.getRootId();

View File

@ -34,6 +34,11 @@ public abstract class Operation2VO {
*/
ExpressionVO failureCondition;
/**
* 特殊操作直接执行
*/
Boolean special;
public abstract Operation2 convert2BO(Simulation simulation);
/**

View File

@ -51,6 +51,10 @@ public class PaperSubmitAnswerReqVo {
@Data
public static class AnswerDetail{
private String cosplayMemberId;
/**
* 实训总分
*/
private int sumScore;
private List<PaperTrainAnswerDetail> trainDetail;
}
}

View File

@ -19,6 +19,9 @@ public class PaperTrainAnswerDetail {
*/
private boolean success;
/**
* 获得的分数
*/
private Float score;

View File

@ -1,15 +1,26 @@
package club.joylink.rtss.manage.vo.paper;
import club.joylink.rtss.manage.util.JsonUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Objects;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TrainAnswerVO {
public class TrainAnswerVO<V> {
private PaperQuestionState state;
private PaperSubmitAnswerReqVo.AnswerDetail detail;
private V detail;
public String getDetailStr(){
if(Objects.isNull(detail)){
return null;
}
if(this.detail instanceof String){
return this.detail.toString();
}
return JsonUtils.writeValueAsString(this.detail);
}
}

View File

@ -2,10 +2,9 @@ package club.joylink.rtss.manage.vo.permission.convertor;
import club.joylink.rtss.manage.entity.permission.SystemAbility;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.manage.vo.permission.PermissionAbilityRspVo;
import club.joylink.rtss.manage.vo.permission.PermissionSystemAbilityVO;
import club.joylink.rtss.manage.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,14 @@
package club.joylink.rtss.manage.vo.training2.draft;
import club.joylink.rtss.manage.vo.client.training2.Step2VO;
import lombok.Data;
import java.util.List;
@Data
public class UpdateStepReqVo {
private List<Step2VO> step2VOList;
private List<String> playerIdList;
}

View File

@ -21,4 +21,6 @@ public class PublishedTrainingListRspVo extends PageQueryVO {
private String name;
private List<String> labels;
private Integer state;
private Long orgId;
}

View File

@ -2,11 +2,12 @@ package club.joylink.rtss.manage.websocket;
import club.joylink.rtss.manage.services.ISysUserService;
import club.joylink.rtss.manage.services.LoginSessionManager;
import club.joylink.rtss.manage.vo.AccountVO;
import club.joylink.rtss.manage.services.project.ProjectService;
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import club.joylink.rtss.manage.websocket.interceptor.PresenceChannelInterceptor;
import club.joylink.rtss.manage.websocket.interceptor.SessionAuthHandshakeInterceptor;
import club.joylink.rtss.manage.websocket.interceptor.VSimpleInterceptor;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@ -38,6 +39,9 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
private ISysUserService sysUserService;
@Resource
private PresenceChannelInterceptor presenceChannelInterceptor;
@Autowired
@Lazy
private ProjectService projectService;
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
@ -75,13 +79,14 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
})
.setAllowedOrigins("*");
registry.addEndpoint("/joylink-tbi-websocket")
.addInterceptors(new VSimpleInterceptor(this.sysUserService))
.addInterceptors(new VSimpleInterceptor(this.sysUserService, projectService))
.setHandshakeHandler(new DefaultHandshakeHandler() {
@Override
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
Map<String, Object> attributes) {
return new TrainPositionPrincipal((AccountVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY));
return new MyPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY),true);
// return new TrainPositionPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY));
}
})
@ -116,11 +121,16 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
public class MyPrincipal implements Principal {
private LoginUserInfoVO user;
private boolean yjddzh;
public MyPrincipal(LoginUserInfoVO user) {
Objects.requireNonNull(user, "用户不能为null");
this.user = user;
}
public MyPrincipal(LoginUserInfoVO user,boolean yjddzh) {
this(user);
this.yjddzh = yjddzh;
}
@Override
public String getName() {
@ -139,9 +149,9 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
@Getter
public class TrainPositionPrincipal implements Principal {
private AccountVO user;
private LoginUserInfoVO user;
public TrainPositionPrincipal(AccountVO user) {
public TrainPositionPrincipal(LoginUserInfoVO user) {
Objects.requireNonNull(user, "用户不能为null");
this.user = user;
}
@ -149,7 +159,7 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public String getName() {
return this.user.getMobile();
return this.user.getAccountVO().getMobile();
}
}
}

View File

@ -41,17 +41,21 @@ public class PresenceChannelInterceptor implements ChannelInterceptor {
}
private void register(String wsSessionId, String destination, Principal principal) {
if(Objects.equals(false,principal instanceof WebsocketConfig.TrainPositionPrincipal)){
return;
if(principal instanceof WebsocketConfig.MyPrincipal){
WebsocketConfig.MyPrincipal myPrincipal = (WebsocketConfig.MyPrincipal) principal;
if(myPrincipal.isYjddzh()){
log.info("武汉8号线 创建stmop链接name:{}",principal.getName());
}
}
log.info("武汉8号线 创建stmop链接name:{}",principal.getName());
}
private void unregister(String wsSessionId, String destination, Principal principal) {
if(Objects.equals(false,principal instanceof WebsocketConfig.TrainPositionPrincipal)){
return;
if(principal instanceof WebsocketConfig.MyPrincipal){
WebsocketConfig.MyPrincipal myPrincipal = (WebsocketConfig.MyPrincipal) principal;
if(myPrincipal.isYjddzh()){
log.info("武汉8号线 关闭stmop链接name:{}",principal.getName());
}
}
log.info("武汉8号线 关闭stmop链接name:{}",principal.getName());
}
}

View File

@ -5,7 +5,9 @@ package club.joylink.rtss.manage.websocket.interceptor;
import club.joylink.rtss.manage.entity.project.Project;
import club.joylink.rtss.manage.services.ISysUserService;
import club.joylink.rtss.manage.services.project.ProjectService;
import club.joylink.rtss.manage.vo.AccountVO;
import club.joylink.rtss.manage.vo.LoginUserInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
@ -17,33 +19,51 @@ import java.util.Objects;
@Slf4j
public class VSimpleInterceptor extends BaseInterceptor {
private ISysUserService sysUserService;
public VSimpleInterceptor(ISysUserService sysUserService) {
private ProjectService projectService;
public VSimpleInterceptor(ISysUserService sysUserService, ProjectService projectService) {
this.sysUserService = sysUserService;
this.projectService = projectService;
}
public final static String ATT_USER_KEY = "userVo";
private final static String USER_ACCOUNT = "user_account";
private final static String ACCOUNT_PWD = "account_pwd";
private final static String PROJECT_CODE = "project_code";
@Override
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> attributes) throws Exception {
Map<String, String> map = this.findQueryParams(request);
log.info(String.format("webSocket handshake query: [%s]", map));
log.error(String.format("webSocket handshake query: [%s] uri:[%s]", map,request.getRemoteAddress()));
String account = map.get(USER_ACCOUNT);
String accountPwd = map.get(ACCOUNT_PWD);
/*String projectCode = map.get(PROJECT_CODE);
if(Strings.isNullOrEmpty(projectCode)){
return false;
}*/
try{
AccountVO vo = this.checkUserInfo(map);
// ProjectVO projectVO = projectService.queryLoginProjectByCode(projectCode);
AccountVO vo = this.checkUserInfo(account,accountPwd);
if(Objects.isNull(vo)){
log.error("未找到对应的用户 account[{}] pwd[{}]",account,accountPwd);
return false;
}
attributes.put(ATT_USER_KEY,vo);
LoginUserInfoVO infoVO = new LoginUserInfoVO();
infoVO.setAccountVO(vo);
// infoVO.setProjectInfo(projectVO);
attributes.put(ATT_USER_KEY,infoVO);
return true;
}catch (Exception e){
log.error("ws 登录失败 msg:" + e.getMessage(),e);
return false;
}
}
private final static String USER_ACCOUNT = "user_account";
private final static String ACCOUNT_PWD = "account_pwd";
private AccountVO checkUserInfo(Map<String,String> dataMap){
AccountVO vo = this.sysUserService.findUserByAccountAndPassword(dataMap.get(USER_ACCOUNT),dataMap.get(ACCOUNT_PWD), Project.DEFAULT_PROJECT_CODE);
private AccountVO checkUserInfo(String account,String accountPwd){
AccountVO vo = this.sysUserService.findUserByAccountAndPassword(account,accountPwd, Project.DEFAULT_PROJECT_CODE);
return vo;
}
}

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.manage.dao.MapFunctionTemplateDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.manage.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.manage.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.manage.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.manage.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.manage.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.manage.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.manage.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.manage.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.manage.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.manage.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.manage.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

@ -6,6 +6,7 @@
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="desc" jdbcType="VARCHAR" property="desc" />
<result column="bg_url" jdbcType="VARCHAR" property="bgUrl" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="group" jdbcType="VARCHAR" property="group" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
@ -75,7 +76,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, `name`, `desc`, `type`, `group`, creator_id, create_time, updater_id,
id, map_id, `name`, `desc`, bg_url, `type`, `group`, creator_id, create_time, updater_id,
update_time
</sql>
<sql id="Blob_Column_List">
@ -147,13 +148,13 @@
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.manage.entity.RtsMapFunction" useGeneratedKeys="true">
insert into rts_map_function (map_id, `name`, `desc`,
`type`, `group`, creator_id,
create_time, updater_id, update_time,
param)
bg_url, `type`, `group`,
creator_id, create_time, updater_id,
update_time, param)
values (#{mapId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{param,jdbcType=LONGVARCHAR})
#{bgUrl,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR},
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT},
#{updateTime,jdbcType=TIMESTAMP}, #{param,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.manage.entity.RtsMapFunction" useGeneratedKeys="true">
insert into rts_map_function
@ -167,6 +168,9 @@
<if test="desc != null">
`desc`,
</if>
<if test="bgUrl != null">
bg_url,
</if>
<if test="type != null">
`type`,
</if>
@ -199,6 +203,9 @@
<if test="desc != null">
#{desc,jdbcType=VARCHAR},
</if>
<if test="bgUrl != null">
#{bgUrl,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
@ -243,6 +250,9 @@
<if test="record.desc != null">
`desc` = #{record.desc,jdbcType=VARCHAR},
</if>
<if test="record.bgUrl != null">
bg_url = #{record.bgUrl,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
@ -275,6 +285,7 @@
map_id = #{record.mapId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
`desc` = #{record.desc,jdbcType=VARCHAR},
bg_url = #{record.bgUrl,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
@ -292,6 +303,7 @@
map_id = #{record.mapId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
`desc` = #{record.desc,jdbcType=VARCHAR},
bg_url = #{record.bgUrl,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
@ -314,6 +326,9 @@
<if test="desc != null">
`desc` = #{desc,jdbcType=VARCHAR},
</if>
<if test="bgUrl != null">
bg_url = #{bgUrl,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
@ -343,6 +358,7 @@
set map_id = #{mapId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
bg_url = #{bgUrl,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
`group` = #{group,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
@ -357,6 +373,7 @@
set map_id = #{mapId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
bg_url = #{bgUrl,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
`group` = #{group,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},

View File

@ -5,9 +5,9 @@ import club.joylink.rtss.manage.services.mapFunction.RtsMapFunctionServiceImpl;
import club.joylink.rtss.manage.simulation.cbtc.Simulation;
import club.joylink.rtss.manage.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.manage.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionCreateVO;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionQueryVO;
import club.joylink.rtss.manage.vo.client.mapFunction.RtsMapFunctionVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionCreateVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionQueryVO;
import club.joylink.rtss.manage.vo.client.mapFunction.MapFunctionVO;
import club.joylink.rtss.manage.vo.map.MapVO;
import club.joylink.rtss.manage.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
}

View File

@ -44,17 +44,22 @@ public class EnvLoggerFileTest {
}
});
}
public List<TrainPosition> query(List<TrainPosition> list, List<String> groups){
List<TrainPosition> newList = list.stream().filter(d->groups.contains(d.getGroupNum()) ).collect(Collectors.toList());
return newList;
}
public List<TrainPosition> query(List<TrainPosition> list, List<String> groups, Section.SectionRoadType roadType){
List<TrainPosition> newList = list.stream().filter(d->groups.contains(d.getGroupNum()) && d.getRoadType() == roadType ).sorted(Comparator.comparing(TrainPosition::getReceiveTime)).collect(Collectors.toList());
return newList;
}
public List<TrainPosition> query(List<TrainPosition> list, String groupNum, Section.SectionRoadType roadType){
List<TrainPosition> newList = list.stream().filter(d-> Objects.equals(d.getGroupNum(),groupNum) && d.getRoadType() == roadType ).sorted(Comparator.comparing(TrainPosition::getReceiveTime)).collect(Collectors.toList());
return newList;
}
public List<TrainPosition> query(List<TrainPosition> list,String groupNum){
List<TrainPosition> newList = list.stream().filter(d->Objects.equals(d.getGroupNum(),groupNum)).sorted(Comparator.comparing(TrainPosition::getReceiveTime)).collect(Collectors.toList());
List<TrainPosition> newList = list.stream().filter(d->Objects.equals(d.getGroupNum(),groupNum)).collect(Collectors.toList());
return newList;
}

View File

@ -40,11 +40,12 @@ public class StompTest {
e.printStackTrace();
}
EnvLoggerFileTest lt = new EnvLoggerFileTest();
List<TrainPosition> list = lt.readFile("d:\\spring.log2");
List<TrainPosition> list = lt.readFile("d:\\spring.log");
// List<TrainPosition> list = lt.readSource("d:\\t.txt");
// runToLeft(stompSession,"001");
// runToRight(stompSession,"002");
list = lt.query(list,"004", Section.SectionRoadType.LEFT);
// list = lt.query(list,"031");
// list = lt.query(list,"004", Section.SectionRoadType.LEFT);
// list = lt.query(list, Lists.newArrayList("015","037"), Section.SectionRoadType.RIGHT);
send(stompSession,list);
}
@ -87,7 +88,7 @@ public class StompTest {
}
public static void send(StompSession stompSession,List<TrainPosition> list){
for (int i = 25; i < list.size(); i++) {
for (int i = 0; i < list.size(); i++) {
// for (int i = 22; i < 23; i++) {
TrainPosition tp = list.get(i);
tp.setCloseDoor(false);
@ -95,21 +96,21 @@ public class StompTest {
tp.setSpeed(Float.valueOf(i));
// tp.setLocation(tp.getLocation() - 500);
String val = JsonUtils.writeValueNullableFieldAsString(tp);
Instant instant = Instant.ofEpochMilli(tp.getReceiveTime());
ZoneId zone = ZoneId.systemDefault();
String d = LocalDateTime.ofInstant(instant, zone).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(d + " ->" + i +" ->" + val);
// Instant instant = Instant.ofEpochMilli(tp.getReceiveTime());
// ZoneId zone = ZoneId.systemDefault();
// String d = LocalDateTime.ofInstant(instant, zone).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(i +" ->" + val);
stompSession.send("/app/武汉8号线/trainPosition",val.getBytes(StandardCharsets.UTF_8));
if(i > 0){
TrainPosition old = list.get(i - 1);
try {
long sleepTime = (tp.getReceiveTime() - old.getReceiveTime());
if(sleepTime > 10000){
sleepTime = sleepTime / 1000;
}
System.out.println("index:" + i + "sleep:"+sleepTime);
TimeUnit.MILLISECONDS.sleep(sleepTime);
// long sleepTime = (tp.getReceiveTime() - old.getReceiveTime());
// if(sleepTime > 10000){
// sleepTime = sleepTime / 1000;
// }
// System.out.println("index:" + i + "sleep:"+sleepTime);
TimeUnit.MILLISECONDS.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}

View File

@ -1,19 +0,0 @@
CREATE TABLE `docu_document_draft` (
`id` bigint NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL COMMENT '标题',
`content` longtext NOT NULL COMMENT '内容',
`create_user_id` bigint NOT NULL COMMENT '创建用户',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `docu_document` (
`id` bigint NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL COMMENT '标题',
`content` longtext NOT NULL COMMENT '内容',
`publish_user_id` bigint NOT NULL COMMENT '发布用户',
`publish_time` datetime NOT NULL COMMENT '发布时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,20 +0,0 @@
CREATE TABLE `file` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`file_name` varchar(255) NOT NULL,
`file_path` varchar(255) NOT NULL,
`file_type` varchar(255) NOT NULL,
`create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
`creator` bigint(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
CREATE TABLE `file_binding` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`file_id` bigint(20) NOT NULL,
`map_id` bigint(20) NOT NULL,
`device_types` varchar(255) DEFAULT NULL,
`device_ids` varchar(10000) DEFAULT NULL,
`creator` bigint(20) NOT NULL,
`create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

View File

@ -1,5 +0,0 @@
ALTER TABLE `permission_distribute`
ADD COLUMN `creator_id` bigint NULL AFTER `from_user_permission_id`;
alter table user_permission
add create_time datetime default current_timestamp not null;

View File

@ -1,3 +0,0 @@
ALTER TABLE `draft_map_parking_time`
CHANGE COLUMN `section_parking_time` `section_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '区段code' AFTER `station_code`,
ADD COLUMN `parking_time` int NOT NULL COMMENT '停站时间' AFTER `section_code`;

View File

@ -1,3 +0,0 @@
ALTER TABLE `run_plan_load`
ADD COLUMN `load_rule` varchar(32) NULL DEFAULT 'EVERY_DAY' AFTER `load_time`;

View File

@ -1,19 +0,0 @@
ALTER TABLE `sys_user` RENAME `sys_account`;
ALTER TABLE `sys_user_login` RENAME `sys_account_login`;
ALTER TABLE `sys_account`
ADD COLUMN `type` varchar(2) NOT NULL DEFAULT 1 COMMENT '账号类型1-个人账户2-企业账户' AFTER `account`;
ALTER TABLE `sys_account`
DROP COLUMN `offline`;
ALTER TABLE `sys_account`
MODIFY COLUMN `account` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '账户' AFTER `id`;
ALTER TABLE `sys_account`
MODIFY COLUMN `type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' COMMENT '账号类型1-个人账户2-企业账户3-企业账户下子账户' AFTER `account`;
ALTER TABLE `sys_account`
ADD COLUMN `parent_account` varchar(32) NULL COMMENT '父企业账户account,当为企业子账户时不能为空' AFTER `account`;

View File

@ -1,3 +0,0 @@
ALTER TABLE `user_simulation_stats`
ADD COLUMN `end_time` datetime NOT NULL DEFAULT '1970-01-01 01:01:01' ON UPDATE CURRENT_TIMESTAMP AFTER `fake`;

View File

@ -1,3 +0,0 @@
ALTER TABLE `map_data`
ADD COLUMN `note` varchar(255) NULL COMMENT '备注' AFTER `version`;

View File

@ -1,35 +0,0 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for model_2d_draft
-- ----------------------------
DROP TABLE IF EXISTS `model_2d_draft`;
CREATE TABLE `model_2d_draft` (
`id` bigint(20) NOT NULL,
`code` varchar(32) NOT NULL COMMENT '编号',
`name` varchar(32) NOT NULL COMMENT '模型名称',
`json_data` mediumtext COMMENT '模型数据',
`create_user_id` bigint(20) NOT NULL,
`create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
`update_user_id` bigint(20) DEFAULT NULL,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for model_2d
-- ----------------------------
DROP TABLE IF EXISTS `model_2d`;
CREATE TABLE `model_2d` (
`id` bigint(20) NOT NULL,
`code` varchar(32) NOT NULL COMMENT '编号(唯一)',
`name` varchar(32) NOT NULL COMMENT '模型名称',
`json_data` mediumtext NOT NULL COMMENT '模型数据',
`version` int(11) NOT NULL COMMENT '版本',
`state` varchar(2) NOT NULL COMMENT '状态',
`create_user_id` bigint(20) NOT NULL,
`create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
`update_user_id` bigint(20) DEFAULT NULL,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,21 +0,0 @@
ALTER TABLE `user_simulation_stats`
DROP COLUMN `map_prd_id`,
MODIFY COLUMN `role` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户角色' AFTER `prd_type`,
MODIFY COLUMN `end_time` datetime NOT NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP COMMENT '结束时间' AFTER `role`,
MODIFY COLUMN `duration` int(11) NOT NULL COMMENT '有效时长' AFTER `end_time`,
ADD COLUMN `start_time` datetime NOT NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP COMMENT '开始时间' AFTER `role`;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for sys_third_account_config
-- ----------------------------
DROP TABLE IF EXISTS `sys_third_account_config`;
CREATE TABLE `sys_third_account_config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`account` varchar(32) NOT NULL COMMENT '第三方账户账号',
`interface_config` text COMMENT '接口信息配置',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

View File

@ -1,14 +0,0 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for circuitry_draft
-- ----------------------------
DROP TABLE IF EXISTS `circuitry_draft`;
CREATE TABLE `circuitry_draft` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL COMMENT '名称',
`draw_data` mediumtext COMMENT '绘图数据',
`create_user_id` bigint(20) NOT NULL,
`create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

View File

@ -1,10 +0,0 @@
CREATE TABLE `draft_map_route_overrun` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`map_id` bigint(20) NOT NULL,
`code` varchar(255) NOT NULL,
`section_code` varchar(255) NOT NULL,
`ci_switch` varchar(255) DEFAULT NULL,
`switch_code` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

View File

@ -1,2 +0,0 @@
alter table exam_definition
add abnormal tinyint(1) default 0 not null comment '数据异常';

View File

@ -1,7 +0,0 @@
alter table exam_definition
add `system` bit default 0 not null comment '系统生成';
-- 数据处理
UPDATE exam_definition
SET `system` = 1
WHERE
remarks LIKE '%默认试卷'

View File

@ -1,3 +0,0 @@
alter table project_server
add resources_domain_name varchar(255) null comment '资源域名' after domain_name;

View File

@ -4,7 +4,7 @@ ALTER TABLE `rts_paper_user_question`
ALTER TABLE `rts_paper_user_question`
ADD COLUMN `sub_type` bigint not NULL COMMENT '规则类型:理论题(1-单选题2-多选题3-判断题);实训题(4-单操实训5-场景实训)' AFTER `type`;
ADD COLUMN `sub_type` int not NULL COMMENT '规则类型:理论题(1-单选题2-多选题3-判断题);实训题(4-单操实训5-场景实训)' AFTER `type`;
ALTER TABLE `rts_paper_user_question` MODIFY COLUMN tmp_answer longtext;

View File

@ -0,0 +1,2 @@
ALTER TABLE `joylink`.`rts_map_function`
ADD COLUMN `bg_url` varchar(255) NULL COMMENT '背景图片的url' AFTER `desc`;

View File

@ -0,0 +1,11 @@
CREATE TABLE `rts_map_function_template` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
`map_function_param` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '地图功能参数',
`assistant_param` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '辅助参数(如默认角色类型)',
`create_time` datetime NOT NULL,
`creator_id` bigint NOT NULL,
`update_time` datetime DEFAULT NULL,
`updater_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='地图功能模板';