This commit is contained in:
DU 2021-03-17 17:08:13 +08:00
commit 8adda9b160
46 changed files with 1953 additions and 159 deletions

View File

@ -0,0 +1,12 @@
DROP TABLE IF EXISTS `project_server`;
CREATE TABLE `project_server` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`project` varchar(32) NOT NULL COMMENT '项目编码',
`domain_name` varchar(255) 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`),
UNIQUE KEY `project_server_project_1` (`project`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='项目服务器域名表';

View File

@ -58,6 +58,8 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/api/learn/cgy/updateMessageTime");
// 成都工业使用记录
whiteList.add("/api/cgy/**");
//项目域名查询
whiteList.add("/api/projectServer/project/{project}");
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
}

View File

@ -0,0 +1,50 @@
package club.joylink.rtss.controller;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.project.ServerService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/api/projectServer")
public class ProjectServerController {
@Autowired
private ServerService serverService;
@GetMapping("/project/{project}")
public ProjectServerVO getByProject(@PathVariable Project project) {
return this.serverService.getByProject(project);
}
@Role(RoleEnum.SuperAdmin)
@GetMapping("/paging")
public PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO) {
return this.serverService.pagingQuery(queryVO);
}
@Role(RoleEnum.SuperAdmin)
@PostMapping("")
public String create(@RequestBody ProjectServerVO vo,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) UserVO userVO) {
return this.serverService.create(vo, userVO);
}
@Role(RoleEnum.SuperAdmin)
@PutMapping("/{id}")
public void update(@PathVariable Long id,
@RequestBody ProjectServerVO vo,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) UserVO userVO) {
this.serverService.update(id, vo, userVO);
}
}

View File

@ -0,0 +1,14 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.ProjectServer;
import club.joylink.rtss.entity.ProjectServerExample;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* ProjectServerDAO继承基类
*/
@Mapper
@Repository
public interface ProjectServerDAO extends MyBatisBaseDao<ProjectServer, Long, ProjectServerExample> {
}

View File

@ -0,0 +1,35 @@
package club.joylink.rtss.entity;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
* 项目服务器域名表
*/
@Data
public class ProjectServer implements Serializable {
private Long id;
/**
* 项目编码
*/
private String project;
/**
* 域名
*/
private String domainName;
private Long createUserId;
private LocalDateTime createTime;
private Long updateUserId;
private LocalDateTime updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,663 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class ProjectServerExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public ProjectServerExample() {
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 andProjectIsNull() {
addCriterion("project is null");
return (Criteria) this;
}
public Criteria andProjectIsNotNull() {
addCriterion("project is not null");
return (Criteria) this;
}
public Criteria andProjectEqualTo(String value) {
addCriterion("project =", value, "project");
return (Criteria) this;
}
public Criteria andProjectNotEqualTo(String value) {
addCriterion("project <>", value, "project");
return (Criteria) this;
}
public Criteria andProjectGreaterThan(String value) {
addCriterion("project >", value, "project");
return (Criteria) this;
}
public Criteria andProjectGreaterThanOrEqualTo(String value) {
addCriterion("project >=", value, "project");
return (Criteria) this;
}
public Criteria andProjectLessThan(String value) {
addCriterion("project <", value, "project");
return (Criteria) this;
}
public Criteria andProjectLessThanOrEqualTo(String value) {
addCriterion("project <=", value, "project");
return (Criteria) this;
}
public Criteria andProjectLike(String value) {
addCriterion("project like", value, "project");
return (Criteria) this;
}
public Criteria andProjectNotLike(String value) {
addCriterion("project not like", value, "project");
return (Criteria) this;
}
public Criteria andProjectIn(List<String> values) {
addCriterion("project in", values, "project");
return (Criteria) this;
}
public Criteria andProjectNotIn(List<String> values) {
addCriterion("project not in", values, "project");
return (Criteria) this;
}
public Criteria andProjectBetween(String value1, String value2) {
addCriterion("project between", value1, value2, "project");
return (Criteria) this;
}
public Criteria andProjectNotBetween(String value1, String value2) {
addCriterion("project not between", value1, value2, "project");
return (Criteria) this;
}
public Criteria andDomainNameIsNull() {
addCriterion("domain_name is null");
return (Criteria) this;
}
public Criteria andDomainNameIsNotNull() {
addCriterion("domain_name is not null");
return (Criteria) this;
}
public Criteria andDomainNameEqualTo(String value) {
addCriterion("domain_name =", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotEqualTo(String value) {
addCriterion("domain_name <>", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameGreaterThan(String value) {
addCriterion("domain_name >", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameGreaterThanOrEqualTo(String value) {
addCriterion("domain_name >=", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameLessThan(String value) {
addCriterion("domain_name <", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameLessThanOrEqualTo(String value) {
addCriterion("domain_name <=", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameLike(String value) {
addCriterion("domain_name like", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotLike(String value) {
addCriterion("domain_name not like", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameIn(List<String> values) {
addCriterion("domain_name in", values, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotIn(List<String> values) {
addCriterion("domain_name not in", values, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameBetween(String value1, String value2) {
addCriterion("domain_name between", value1, value2, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotBetween(String value1, String value2) {
addCriterion("domain_name not between", value1, value2, "domainName");
return (Criteria) this;
}
public Criteria andCreateUserIdIsNull() {
addCriterion("create_user_id is null");
return (Criteria) this;
}
public Criteria andCreateUserIdIsNotNull() {
addCriterion("create_user_id is not null");
return (Criteria) this;
}
public Criteria andCreateUserIdEqualTo(Long value) {
addCriterion("create_user_id =", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotEqualTo(Long value) {
addCriterion("create_user_id <>", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdGreaterThan(Long value) {
addCriterion("create_user_id >", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("create_user_id >=", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLessThan(Long value) {
addCriterion("create_user_id <", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLessThanOrEqualTo(Long value) {
addCriterion("create_user_id <=", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdIn(List<Long> values) {
addCriterion("create_user_id in", values, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotIn(List<Long> values) {
addCriterion("create_user_id not in", values, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdBetween(Long value1, Long value2) {
addCriterion("create_user_id between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotBetween(Long value1, Long value2) {
addCriterion("create_user_id not between", value1, value2, "createUserId");
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 andUpdateUserIdIsNull() {
addCriterion("update_user_id is null");
return (Criteria) this;
}
public Criteria andUpdateUserIdIsNotNull() {
addCriterion("update_user_id is not null");
return (Criteria) this;
}
public Criteria andUpdateUserIdEqualTo(Long value) {
addCriterion("update_user_id =", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdNotEqualTo(Long value) {
addCriterion("update_user_id <>", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdGreaterThan(Long value) {
addCriterion("update_user_id >", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("update_user_id >=", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdLessThan(Long value) {
addCriterion("update_user_id <", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdLessThanOrEqualTo(Long value) {
addCriterion("update_user_id <=", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdIn(List<Long> values) {
addCriterion("update_user_id in", values, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdNotIn(List<Long> values) {
addCriterion("update_user_id not in", values, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdBetween(Long value1, Long value2) {
addCriterion("update_user_id between", value1, value2, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdNotBetween(Long value1, Long value2) {
addCriterion("update_user_id not between", value1, value2, "updateUserId");
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 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

@ -873,7 +873,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
// 找指定方向的站台轨
Signal signal = lastSection.getSignalOf(right);
this.queryNormalStandTracksOnDirectionFromSignal(signal, right, nstdList);
if (signal == null) {
this.queryNormalStandTracksOnDirectionFromSection(lastSection, right, nstdList);
} else {
this.queryNormalStandTracksOnDirectionFromSignal(signal, right, nstdList);
}
// 站前折返情况处理
if (!CollectionUtils.isEmpty(nstdList) &&
end.isNormalStandTrack() &&
@ -903,6 +907,21 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
private void queryNormalStandTracksOnDirectionFromSection(Section lastSection, boolean right, List<Section> nstdList) {
Signal signal = lastSection.getSignalOf(right);
if (signal != null) {
this.queryNormalStandTracksOnDirectionFromSignal(signal, right, nstdList);
} else {
Section nextSection = lastSection.getSectionOf(right);
if (nextSection.isNormalStandTrack() && nextSection.getStandList().get(0).isRight() == right) {
nstdList.add(nextSection);
return;
} else {
this.queryNormalStandTracksOnDirectionFromSection(nextSection, right, nstdList);
}
}
}
private boolean canArriveOppositeStandTrack(Section start, Section end, boolean right) {
Signal signal = start.getSignalOf(right);
List<Section> nstdList = new ArrayList<>();
@ -1137,27 +1156,37 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Set<Signal> signals = new HashSet<>();
for (Route route : routeList) {
boolean containOppositeStandTrack = false;
boolean contains = false;
for (Section section : route.getSectionList()) {
if (section.isNormalStandTrack() &&
!Objects.equals(section.getStandList().get(0).isRight(), standRight)) {
containOppositeStandTrack = true;
if (section.isNormalStandTrack()) {
if (!Objects.equals(section.getStandList().get(0).isRight(), standRight)) {
containOppositeStandTrack = true;
} else {
contains = true;
nstdList.add(section);
}
break;
}
}
if (containOppositeStandTrack) {
continue;
}
Section lastRouteSection = route.getLastRouteSection();
if (lastRouteSection.isNormalStandTrack()) {
if (Objects.equals(lastRouteSection.getStandList().get(0).isRight(), standRight)) {
if (!nstdList.contains(lastRouteSection)) {
nstdList.add(lastRouteSection);
}
}
if (contains) {
continue;
} else {
signals.add(route.getDestination());
}
// Section lastRouteSection = route.getLastRouteSection();
// if (lastRouteSection.isNormalStandTrack()) {
// if (Objects.equals(lastRouteSection.getStandList().get(0).isRight(), standRight)) {
// if (!nstdList.contains(lastRouteSection)) {
// nstdList.add(lastRouteSection);
// }
// }
// continue;
// } else {
// signals.add(route.getDestination());
// }
}
if (!CollectionUtils.isEmpty(signals)) {
for (Signal end : signals) {

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.services.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
public interface ServerService {
public ProjectServerVO getByProject(Project project);
PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO);
String create(ProjectServerVO vo, UserVO userVO);
void update(Long id, ProjectServerVO vo, UserVO userVO);
}

View File

@ -0,0 +1,81 @@
package club.joylink.rtss.services.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.ProjectServerDAO;
import club.joylink.rtss.entity.ProjectServer;
import club.joylink.rtss.entity.ProjectServerExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
public class ServerServiceImpl implements ServerService {
@Autowired
private ProjectServerDAO projectServerDAO;
@Override
public ProjectServerVO getByProject(Project project) {
ProjectServerExample example = new ProjectServerExample();
example.createCriteria()
.andProjectEqualTo(project.name());
List<ProjectServer> projectServerList = this.projectServerDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(projectServerList);
return new ProjectServerVO(projectServerList.get(0));
}
@Override
public PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO) {
ProjectServerExample example = new ProjectServerExample();
if (queryVO.getProject() != null) {
example.createCriteria()
.andProjectEqualTo(queryVO.getProject().name());
}
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<ProjectServer> projectServerList = (Page<ProjectServer>) this.projectServerDAO.selectByExample(example);
List<ProjectServerVO> voList = ProjectServerVO.convert2VOList(projectServerList.getResult());
return PageVO.convert(projectServerList, voList);
}
@Override
public String create(ProjectServerVO vo, UserVO userVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(vo.getProject(),"项目不能为null");
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(this.isProjectDataExist(vo.getProject()),
String.format("项目[%s]的域名数据已经存在", vo.getProject()));
ProjectServer db = vo.toDB();
db.setCreateUserId(userVO.getId());
db.setCreateTime(LocalDateTime.now());
this.projectServerDAO.insert(db);
return db.getId().toString();
}
private boolean isProjectDataExist(Project project) {
ProjectServerExample example = new ProjectServerExample();
example.createCriteria()
.andProjectEqualTo(project.name());
return this.projectServerDAO.countByExample(example) > 0;
}
@Override
public void update(Long id, ProjectServerVO vo, UserVO userVO) {
ProjectServer projectServer = this.projectServerDAO.selectByPrimaryKey(id);
if (!Objects.equals(vo.getDomainName(), projectServer.getDomainName())) {
projectServer.setDomainName(vo.getDomainName());
projectServer.setUpdateUserId(userVO.getId());
projectServer.setUpdateTime(LocalDateTime.now());
this.projectServerDAO.updateByPrimaryKey(projectServer);
}
}
}

View File

@ -42,7 +42,7 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
* 仿真状态
*/
private final AtomicInteger state = new AtomicInteger(PAUSE);
private static final int RUNNING = 1;
private static final int START = 1;
private static final int PAUSE = 0;
private static final int ERROR = -1;
/**
@ -58,9 +58,9 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
*/
private Map<String, SimulationDelayJob> delayJobMap = new ConcurrentHashMap<>();
/**
* 执行线程池核心线程数量默认4(改为配置)所有仿真共享
* 执行线程池核心线程数量默认4(改为配置)所有仿真共享
*/
public static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);
private static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);
public static final String MESSAGE_SUB_PREFIX = "/queue/simulation/{id}";
public static final String PATH_SEPARATOR = "/";
@ -68,6 +68,10 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
private static final PropertyPlaceholderHelper placeholderHelper = new PropertyPlaceholderHelper("{", "}");
private List<SimulationSubscribeMessageService> subscribeMessageServiceList;
private SimulationMessagePublisher publisher;
/**
* 消息推送线程池
*/
private static final ExecutorService Message_Executor = Executors.newSingleThreadExecutor();
private Map<String, SimulationRepository> repositoryMap = new ConcurrentHashMap<>();
private Map<String, M> simulationMemberMap = new ConcurrentHashMap<>();
@ -84,31 +88,13 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
this.id = id;
this.speed = speed;
this.systemTime = LocalDateTime.now();
this.runAsSpeed();
}
public static void main(String[] args) {
Simulation simulation = new Simulation("1") {
@Override
public String debugStr() {
return null;
}
};
simulation.addJob("b", () -> {
log.info("logic");
}, 500);
simulation.addFixedRateJob("c", () -> {
log.warn("fixed");
}, 1000);
simulation.updateSpeed(5);
simulation.start();
}
private void runAsSpeed() {
if (this.future == null) {
// if (!this.future.cancel(false)) {
// log.error(String.format("仿真旧主线程无法取消"));
// }
ScheduledFuture<?> scheduledFuture = EXECUTOR.scheduleAtFixedRate(()->this.logic(),
this.SYSTEM_TIME_RATE, this.SYSTEM_TIME_RATE, TimeUnit.MILLISECONDS);
SYSTEM_TIME_RATE, SYSTEM_TIME_RATE, TimeUnit.MILLISECONDS);
this.future = scheduledFuture;
}
this.updateTimeUpdateSpeed(this.speed);
@ -119,9 +105,10 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
}
private void logic() {
if (!this.isRunning()) {
if (!this.isStart() || this.isRunning()) { // 仿真未开始或者之前逻辑运行未结束,确保仿真不同步执行
return;
}
long start = System.nanoTime();
try {
this.mainLogicRunning.set(true);
this.systemTime = this.systemTime.plusNanos(timeAdd);
@ -142,9 +129,15 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
log.error(String.format("仿真[%s]主线程逻辑执行异常,仿真停止运行", this.id), e);
} finally {
this.mainLogicRunning.set(false);
long take = System.nanoTime() - start;
log.debug(String.format("仿真[%s]执行时长: %sms", TimeUnit.NANOSECONDS.toMillis(take)));
}
}
private boolean isRunning() {
return this.mainLogicRunning.get();
}
public String getId() {
return id;
}
@ -235,8 +228,7 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
* 控制-开始
*/
public void start() {
this.state.set(RUNNING);
this.runAsSpeed();
this.state.set(START);
}
/**
@ -260,8 +252,8 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
return this.state.get();
}
public boolean isRunning() {
return this.state.get() == RUNNING;
public boolean isStart() {
return this.state.get() == START;
}
/**
@ -279,7 +271,7 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
this.speed = speed;
int state = this.state.get();
this.pause();
this.runAsSpeed();
this.updateTimeUpdateSpeed(this.speed);
for (SimulationScheduledJob job : this.scheduledJobMap.values()) {
job.updateRunPeriod(speed);
}
@ -385,7 +377,7 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
destination = this.handleDestination(destination);
for (U simulationUser : this.simulationUserMap.values()) {
if (simulationUser.isSubscribe(destination)) {
this.publisher.publishToUser(simulationUser.getId(), destination, message);
this.publishMessageToUser0(simulationUser.getId(), destination, message);
}
}
}
@ -394,8 +386,12 @@ public abstract class Simulation<U extends SimulationUser, M extends Simulation
this.checkPublisherExist();
Objects.requireNonNull(destination);
destination = this.handleDestination(destination);
this.publishMessageToUser0(userId, destination, message);
}
public void publishMessageToUser0(String userId, String destination, Object message) {
if (userId != null && message != null) {
this.publisher.publishToUser(userId, destination, message);
Message_Executor.execute(() -> this.publisher.publishToUser(userId, destination, message));
}
}

View File

@ -748,7 +748,7 @@ public class AtsRouteSettingService {
continue;
}
// 信号机存在,判定信号关闭接近区段
if (signal.isApproachSection(train.getSection())) {
if (signal.isApproachSection(train.getPhysicalSection())) {
target = signal;
}
break;

View File

@ -0,0 +1,10 @@
package club.joylink.rtss.simulation.rt.CIL;
import org.springframework.stereotype.Component;
/**
* 计算机连锁逻辑
*/
@Component
public class CilLogicService {
}

View File

@ -0,0 +1,8 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilAutoSignal extends CilDevice {
public CilAutoSignal(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,22 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilDevice {
public static final int OFF = 0;
public static final int ON = 1;
String id;
String name;
public CilDevice(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,8 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilEsp extends CilDevice {
public CilEsp(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,24 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import java.util.List;
/**
* 侧防
*/
public class CilFls {
String id;
String name;
CilSwitchPosition target;
List<FlsElement> firstLevelList;
List<FlsElement> secondLevelList;
public static class FlsElement {
CilSwitchPosition pp; // 防护道岔
CilSignal ps; // 防护信号
CilSwitchPosition pae; // 侧防区域元件
}
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import java.util.List;
public class CilPath {
boolean right;
List<CilSection> sectionList;
List<CilSection> logicSectionList;
List<CilSwitchPosition> switchPositionList;
}

View File

@ -0,0 +1,8 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilPsd extends CilDevice {
public CilPsd(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,26 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import club.joylink.rtss.simulation.SimulationRepository;
import java.util.HashMap;
import java.util.Map;
public class CilRepository extends SimulationRepository {
public static final String NAME = "CIL";
Map<String, CilSection> sectionMap;
Map<String, CilSwitch> switchMap;
Map<String, CilSignal> signalMap;
public CilRepository() {
super(NAME);
this.sectionMap = new HashMap<>();
this.switchMap = new HashMap<>();
this.signalMap = new HashMap<>();
}
@Override
public void initState() {
}
}

View File

@ -0,0 +1,28 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapGraphDataNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
import java.util.List;
import java.util.Map;
public class CilRepositoryBuilder {
public static CilRepository buildFrom(MapVO mapVO) {
CilRepository cilRepository = new CilRepository();
MapGraphDataNewVO graphDataNew = mapVO.getGraphDataNew();
buildSections(graphDataNew.getSectionList(), cilRepository.sectionMap);
return cilRepository;
}
private static void buildSections(List<MapSectionNewVO> sectionList, Map<String, CilSection> sectionMap) {
for (MapSectionNewVO sectionNewVO : sectionList) {
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(sectionMap.containsKey(sectionNewVO.getCode()),
String.format("存在重复的区段id:[%s]", sectionNewVO.getCode()));
CilSection cilSection = new CilSection(sectionNewVO.getCode(), sectionNewVO.getName());
sectionMap.put(cilSection.getId(), cilSection);
}
}
}

View File

@ -0,0 +1,14 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilRoute extends CilDevice {
CilSignal start;
CilSignal end;
CilPath path;
public CilRoute(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import java.util.List;
public class CilSection extends CilDevice {
CilSection parent;
List<CilSection> logicList;
CilSwitch belongSwitch;
int axcOccupy;
public CilSection(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,10 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilServer extends CilDevice {
int state;
public CilServer(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilSignal extends CilDevice {
int state;
int logic;
int blockade;
int forceLight;
int level;
public static final int LEVEL_1 = 1; //关闭/非监控级
public static final int LEVEL_2 = 2; //引导级
public static final int LEVEL_3 = 3; //主信号级
public CilSignal(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,8 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilStand extends CilDevice {
public CilStand(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,19 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilSwitch extends CilDevice {
int position;
public static final int LOST = 0; // 失表
public static final int NORMAL = 1; // 定位
public static final int REVERSE = 2; // 反位
int singleLock;
int blockade;
int routeLock;
int overlapLock;
int fpLock;
public CilSwitch(String id, String name) {
super(id, name);
}
}

View File

@ -0,0 +1,8 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilSwitchPosition {
CilSwitch cilSwitch;
int position;
}

View File

@ -2,7 +2,7 @@ package club.joylink.rtss.simulation.rt;
import club.joylink.rtss.services.MapService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.rt.srd.SrdService;
import club.joylink.rtss.simulation.rt.srd.SrdLogicService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.map.MapVO;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,14 +19,14 @@ public class RtSimulationService {
private SimulationManager simulationManager;
@Autowired
private SrdService srdService;
private SrdLogicService srdLogicService;
public RtSimulation create(UserVO userVO, Long mapId) {
Objects.requireNonNull(mapId);
MapVO mapVO = this.mapService.getMapDetail(mapId);
RtSimulation rtSimulation = new RtSimulation(SimulationIdGenerator.buildId());
this.loadData(rtSimulation, mapVO);
this.srdService.addJobs(rtSimulation);
this.srdLogicService.addJobs(rtSimulation);
this.simulationManager.save(rtSimulation);
return rtSimulation;
}
@ -37,6 +37,6 @@ public class RtSimulationService {
* @param mapVO
*/
private void loadData(RtSimulation rtSimulation, MapVO mapVO) {
this.srdService.buildRepository(rtSimulation, mapVO);
this.srdLogicService.buildRepository(rtSimulation, mapVO);
}
}

View File

@ -7,12 +7,19 @@ import club.joylink.rtss.vo.client.map.MapVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 虚拟真实设备运行逻辑
*/
@Slf4j
@Component
public class SrdService {
public static final int TRAIN_RUN_RATE = 20;
public class SrdLogicService {
public static final int TRAIN_RUN_RATE = 20; // 列车运行逻辑频率
public static final int DEVICE_RUN_RATE = 500; // 其他设备逻辑频率
public void buildRepository(RtSimulation rtSimulation, MapVO mapVO) {
SrdRepository srdRepository = SrdRepositoryBuilder.buildFrom(mapVO);
@ -23,6 +30,42 @@ public class SrdService {
rtSimulation.addJob("srTrainRun",
() -> this.srTrainRun(rtSimulation.getRepository(SrdRepository.NAME, SrdRepository.class)),
TRAIN_RUN_RATE);
rtSimulation.addJob("srDeviceLogic",
() -> this.srDeviceLogic(rtSimulation.getRepository(SrdRepository.NAME, SrdRepository.class), rtSimulation.getSystemTime()),
DEVICE_RUN_RATE);
}
private void srDeviceLogic(SrdRepository repository, LocalDateTime systemTime) {
// 道岔转动
List<SrSwitch> turnoutList = repository.getTurnoutList();
for (SrSwitch turnout : turnoutList) {
if (turnout.isControlByReal()) {
continue;
}
if (turnout.isTurning()) {
turnout.tryFinishTurning(systemTime);
}
}
// 屏蔽门开/
List<SrPSD> psdList = repository.getPsdList();
for (SrPSD psd : psdList) {
if (psd.isControlByReal()) {
continue;
}
if (psd.isTurning()) {
psd.tryFinishTurning(systemTime);
}
}
// 信号机控制
List<SrSignal> signalList = repository.getSignalList();
for (SrSignal signal : signalList) {
if (signal.isControlByReal()) {
continue;
}
if (signal.isTurning()) {
signal.tryFinishTurning(systemTime);
}
}
}
public void srTrainRun(SrdRepository repository) {
@ -31,20 +74,35 @@ public class SrdService {
if (!srTrain.isUsing()) {
continue;
}
TrackPosition position = srTrain.getHeadPosition();
// 计算列车加速度更新列车速度计算列车运行距离更新列车位置
boolean right = srTrain.isRight();
TrackPosition position = srTrain.getHeadPosition();
int cv = this.calculateSpeed(srTrain);
int s = this.calculateLen(cv, TRAIN_RUN_RATE);
TrackPosition np = calculatePosition(position, s, right);
int s = this.calculateLen(srTrain, cv, TRAIN_RUN_RATE);
TrackPosition np = calculatePosition(position, s, right, new HashSet<>());
if (np.equals(position) && cv != 0) {
cv = 0;
}
srTrain.updatePositionAndSpeed(np, cv);
Set<SrTrack> occupiedTrackSet = new HashSet<>();
TrackPosition tailPosition = this.calculatePosition(np, srTrain.getLen(), !right, occupiedTrackSet);
srTrain.updatePositionAndSpeed(np, tailPosition, cv);
// 更新计轴占用
Set<SrTrack> oldOccupiedTrackSet = new HashSet<>();
this.calculatePosition(position, srTrain.getLen(), !right, oldOccupiedTrackSet);
Set<SrTrack> clearList = new HashSet<>(oldOccupiedTrackSet);
clearList.removeAll(occupiedTrackSet);
for (SrTrack srTrack : clearList) {
srTrack.getAxc().clear();
}
for (SrTrack srTrack : occupiedTrackSet) {
srTrack.getAxc().occupy();
}
}
}
private int calculateLen(int cv, int time) {
return cv * time;
private int calculateLen(SrTrain srTrain, int cv, int time) {
int s = cv * time;
return s * srTrain.getGear();
}
private int calculateSpeed(SrTrain srTrain) {
@ -61,10 +119,21 @@ public class SrdService {
if (cv < 0) {
cv = 0;
}
if (srTrain.isNeutralGear() && cv > 0) { // 空档位
cv = 0;
}
return cv;
}
private TrackPosition calculatePosition(TrackPosition position, int s, boolean right) {
/**
*
* @param position 起始位置
* @param s 距离
* @param right 方向
* @param trackSet 从position往方向[right]经过距离[s]所经过的轨道列表
* @return
*/
private TrackPosition calculatePosition(TrackPosition position, int s, boolean right, Set<SrTrack> trackSet) {
if (s == 0) {
return position;
}
@ -76,7 +145,11 @@ public class SrdService {
offset -= s;
}
SrTrack base = track;
trackSet.add(base);
int iter = 0;
while (offset < 0 || offset > base.getLen()) {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(iter < 10);
++iter;
SrTrack nextTrack = base.queryNextTrack(right);
if (nextTrack == null) { // 下一区段为空到达尽头或道岔失表处
log.debug(String.format("区段[%s][%s]区段不存在",base.debugStr(), right?"右向":"左向"));
@ -95,6 +168,7 @@ public class SrdService {
offset += nextTrack.getLen();
}
base = nextTrack;
trackSet.add(nextTrack);
}
}
return new TrackPosition(base, offset);

View File

@ -1,17 +1,30 @@
package club.joylink.rtss.simulation.rt.srd.bo;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* 虚拟真实计轴器Axle counter
*/
public class SrAXC extends SrDevice {
AtomicBoolean state = new AtomicBoolean(OFF);
public static final boolean OFF = false;//出清
public static final boolean ON = true;//占用
int state = OFF;
public static final int OFF = 0;//出清
public static final int ON = 1;//占用
public SrAXC(String id) {
super(id, DeviceType.AXC);
}
public void clear() {
this.state = OFF;
}
public void occupy() {
if (this.state != ON) {
this.state=ON;
}
}
@Override
public void applyState(int state) {
}
}

View File

@ -3,6 +3,8 @@ package club.joylink.rtss.simulation.rt.srd.bo;
import club.joylink.rtss.simulation.Debug;
import lombok.Getter;
import java.util.Objects;
/**
* 虚拟真实设备抽象父类
*/
@ -10,6 +12,10 @@ import lombok.Getter;
public abstract class SrDevice implements Debug {
String id;
DeviceType deviceType;
/**
* 是否由真实设备控制
*/
boolean controlByReal;
public SrDevice() {}
@ -18,8 +24,23 @@ public abstract class SrDevice implements Debug {
this.deviceType = deviceType;
}
public abstract void applyState(int state);
@Override
public String debugStr() {
return String.format("%s:%s", this.deviceType, this.id);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SrDevice srDevice = (SrDevice) o;
return Objects.equals(id, srDevice.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.rt.srd.bo;
import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -8,22 +10,59 @@ import java.util.concurrent.atomic.AtomicInteger;
public class SrPSD extends SrDevice {
public static final int turnTime = 3000; // 默认开关门时间单位ms
AtomicInteger state = new AtomicInteger(CLOSE_LOCK);
int state = CLOSE_LOCK;
public static final int CLOSE_LOCK = 1;//关闭且锁闭
public static final int CLOSED = 2;//关闭未锁闭
public static final int OPEN = 3;//打开未到位
public static final int TURNING = 3;//转换中
public static final int OPEN_FINISH = 4;//打开到位
AtomicInteger command = new AtomicInteger(NONE);
public static final int NONE = 0;//无动作
public static final int C_OPEN = 1;//控制开门
public static final int C_CLOSE = 2;//控制关门
/**
* 剩余动作时间
* 转换完成时间
*/
int remain;
LocalDateTime finishTime;
public SrPSD(String id) {
super(id, DeviceType.PSD);
}
public boolean isTurning() {
return NONE != this.command.get();
}
public void open(LocalDateTime systemTime) {
this.startTurn(systemTime, OPEN_FINISH);
}
public void close(LocalDateTime systemTime) {
this.startTurn(systemTime, CLOSE_LOCK);
}
private void startTurn(LocalDateTime systemTime, int command) {
this.finishTime = systemTime.plusNanos(TimeUnit.MILLISECONDS.toNanos(turnTime));
this.command.set(command);
this.state = TURNING;
}
public void tryFinishTurning(LocalDateTime systemTime) {
if (this.finishTime != null && systemTime.compareTo(this.finishTime) >= 0) {
this.turnFinish();
}
}
public void turnFinish() {
this.state = this.command.get();
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void applyState(int state) {
if (CLOSE_LOCK == state || CLOSED == state || TURNING == state || OPEN_FINISH == state) {
this.state = state;
} else {
throw new IllegalArgumentException(String.format("无效的屏蔽门状态:[%s]", state));
}
}
}

View File

@ -2,6 +2,8 @@ package club.joylink.rtss.simulation.rt.srd.bo;
import lombok.Getter;
import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -9,6 +11,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
@Getter
public class SrSignal extends SrDevice {
public static final int turnTime = 500; // 默认转换时间单位ms
/**
* 所在区段
@ -19,20 +22,19 @@ public class SrSignal extends SrDevice {
*/
int offset;
AtomicInteger state = new AtomicInteger(CLOSE);
public static final int CLOSE = 1;
public static final int RED = 2;
public static final int GREEN = 3;
public static final int YELLOW = 4;
public static final int RED_YELLOW = 5;
int state = CLOSE;
public static final int CLOSE = 1; // 关闭
public static final int RED = 2; // 红灯信号(禁止信号)
public static final int GREEN = 3; // 绿灯信号(直向通行)
public static final int YELLOW = 4; // 黄灯信号(侧向通行)
public static final int GUIDE = 5; // 引导信号(正线为黄红)
AtomicInteger command = new AtomicInteger(C_NONE);
public static final int C_NONE = 0;
public static final int C_CLOSE = 1;
public static final int C_RED = 2;
public static final int C_GREEN = 3;
public static final int C_YELLOW = 4;
public static final int C_RED_YELLOW = 5;
AtomicInteger command = new AtomicInteger(NONE);
public static final int NONE = 0;
/**
* 转换完成时间
*/
LocalDateTime finishTime;
public SrSignal(String id) {
super(id, DeviceType.SIGNAL);
@ -42,4 +44,53 @@ public class SrSignal extends SrDevice {
this.track = srTrack;
this.offset = offset;
}
public boolean isTurning() {
return NONE != this.command.get();
}
public void close(LocalDateTime systemTime) {
this.startTurn(systemTime, CLOSE);
}
public void openRed(LocalDateTime systemTime) {
this.startTurn(systemTime, RED);
}
public void openGreen(LocalDateTime systemTime) {
this.startTurn(systemTime, GREEN);
}
public void openYellow(LocalDateTime systemTime) {
this.startTurn(systemTime, YELLOW);
}
public void openGuide(LocalDateTime systemTime) {
this.startTurn(systemTime, GUIDE);
}
private void startTurn(LocalDateTime systemTime, int command) {
this.finishTime = systemTime.plusNanos(TimeUnit.MILLISECONDS.toNanos(turnTime));
this.command.set(command);
}
public void tryFinishTurning(LocalDateTime systemTime) {
if (this.finishTime != null && systemTime.compareTo(this.finishTime) >= 0) {
this.turnFinish();
}
}
public void turnFinish() {
this.state = this.command.get();
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void applyState(int state) {
if (CLOSE == state || RED == state || GREEN == state || YELLOW == state || GUIDE == state) {
this.state = state;
} else {
throw new IllegalArgumentException(String.format("无效的道岔状态:[%s]", state));
}
}
}

View File

@ -0,0 +1,98 @@
package club.joylink.rtss.simulation.rt.srd.bo;
import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 虚拟真实道岔
*/
public class SrSwitch extends SrDevice {
public static final int turnTime = 3000; // 默认转换时间
SrTrack a;
SrTrack b;
SrTrack c;
int state = NORMAL;
public static final int NORMAL = 1; // 定位
public static final int REVERSE = 2; // 反位
public static final int TURNING = 0; // 失表
AtomicInteger command = new AtomicInteger(NONE);
public static final int NONE = 0;
/**
* 转换完成时间
*/
LocalDateTime finishTime;
public SrSwitch(String id) {
super(id, DeviceType.TURNOUT);
}
void setTracks(SrTrack a, SrTrack b, SrTrack c) {
this.a = a;
this.b = b;
this.c = c;
a.setSrSwitch(this);
b.setSrSwitch(this);
c.setSrSwitch(this);
if (this.a.leftTrack == null && this.a.rightTrack == null) {
throw new IllegalStateException("道岔a区段两端都没有关联的区段");
}
if (this.a.leftTrack != null) { // a左侧存在
this.a.setRightTrack(this.b);
this.a.setRightFlankTrack(this.c);
} else { // a右侧存在
this.a.setLeftTrack(this.b);
this.a.setLeftFlankTrack(this.c);
}
}
public boolean isNormalPosition() {
return NORMAL == this.state;
}
public boolean isReversePosition() {
return REVERSE == this.state;
}
public boolean isTurning() {
return NONE != this.command.get();
}
public void turnToNormal(LocalDateTime systemTime) {
this.startTurn(systemTime, NORMAL);
}
public void turnToReverse(LocalDateTime systemTime) {
this.startTurn(systemTime, REVERSE);
}
private void startTurn(LocalDateTime systemTime, int command) {
this.finishTime = systemTime.plusNanos(TimeUnit.MILLISECONDS.toNanos(turnTime));
this.command.set(command);
this.state = TURNING;
}
public void tryFinishTurning(LocalDateTime systemTime) {
if (this.finishTime != null && systemTime.compareTo(this.finishTime) >= 0) {
this.turnFinish();
}
}
public void turnFinish() {
this.state = this.command.get();
this.command.set(NONE);
this.finishTime = null;
}
@Override
public void applyState(int state) {
if (NORMAL == state || REVERSE == state || TURNING == state) {
this.state = state;
} else {
throw new IllegalArgumentException(String.format("无效的道岔状态:[%s]", state));
}
}
}

View File

@ -14,14 +14,6 @@ public class SrTrack extends SrDevice implements Debug {
* 轨道长度单位mm
*/
int len;
/**
* 左停车点单位mm
*/
int leftPs;
/**
* 右停车点单位mm
*/
int rightPs;
/**
* 计轴器
*/
@ -45,7 +37,7 @@ public class SrTrack extends SrDevice implements Debug {
/**
* 关联的道岔是道岔区段才会关联否则为null
*/
SrTurnout turnout;
SrSwitch srSwitch;
public SrTrack(String id) {
super(id, DeviceType.TRACK);
@ -75,15 +67,15 @@ public class SrTrack extends SrDevice implements Debug {
rightFlank.setLeftTrack(this);
}
public void setTurnout(SrTurnout turnout) {
this.turnout = turnout;
public void setSrSwitch(SrSwitch srSwitch) {
this.srSwitch = srSwitch;
}
public SrTrack queryNextTrack(boolean right) {
if (this.turnout != null) {
if (this.turnout.isNormalPosition()) {
if (this.srSwitch != null) {
if (this.srSwitch.isNormalPosition()) {
return right ? this.rightTrack : this.leftTrack;
} else if (this.turnout.isReversePosition()) {
} else if (this.srSwitch.isReversePosition()) {
if (right) {
if (this.rightFlankTrack != null) {
return this.rightFlankTrack;
@ -104,8 +96,14 @@ public class SrTrack extends SrDevice implements Debug {
return null;
}
@Override
public void applyState(int state) {
}
@Override
public String debugStr() {
return String.format("%s(%s)", this.name, this.id);
}
}

View File

@ -51,7 +51,7 @@ public class SrTrain extends SrDevice {
/**
* 档位
*/
int gear = NEUTRAL;
int gear;
public static final int NEUTRAL = 0; //空挡
public static final int FORWARD = 1; //前进挡
public static final int REVERSE = -1; //后退档
@ -72,8 +72,14 @@ public class SrTrain extends SrDevice {
return NEUTRAL == this.gear;
}
public void updatePositionAndSpeed(TrackPosition position, int v) {
this.headPosition = position;
public void updatePositionAndSpeed(TrackPosition headPosition, TrackPosition tailPosition, int v) {
this.headPosition = headPosition;
this.tailPosition = tailPosition;
this.speed = v;
}
@Override
public void applyState(int state) {
}
}

View File

@ -1,56 +0,0 @@
package club.joylink.rtss.simulation.rt.srd.bo;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 虚拟真实道岔
*/
public class SrTurnout extends SrDevice {
public static final int turnTime = 3000; // 默认转换时间
SrTrack a;
SrTrack b;
SrTrack c;
AtomicInteger state = new AtomicInteger(NORMAL);
public static final int NORMAL = 1; // 定位
public static final int REVERSE = 2; // 反位
public static final int TURNING = 0; // 失表
AtomicInteger command = new AtomicInteger(NONE);
public static final int NONE = 0;
public static final int TN = 1; // 定操/转动到定位
public static final int TR = 2; // 反操/转动到反位
/**
* 转换剩余时间,单位ms
*/
int remain;
public SrTurnout(String id) {
super(id, DeviceType.TURNOUT);
}
public void setTracks(SrTrack a, SrTrack b, SrTrack c) {
this.a = a;
this.b = b;
this.c = c;
if (this.a.leftTrack == null && this.a.rightTrack == null) {
throw new IllegalStateException("道岔a区段两端都没有关联的区段");
}
if (this.a.leftTrack != null) { // a左侧存在
this.a.setRightTrack(this.b);
this.a.setRightFlankTrack(this.c);
} else { // a右侧存在
this.a.setLeftTrack(this.b);
this.a.setLeftFlankTrack(this.c);
}
}
public boolean isNormalPosition() {
return NORMAL == this.state.get();
}
public boolean isReversePosition() {
return REVERSE == this.state.get();
}
}

View File

@ -12,7 +12,7 @@ public class SrdRepository extends SimulationRepository {
Map<String, SrTrack> trackMap;
Map<String, SrAXC> axcMap;
Map<String, SrTurnout> turnoutMap;
Map<String, SrSwitch> turnoutMap;
Map<String, SrSignal> signalMap;
Map<String, SrPSD> psdMap;
Map<String, SrTrain> trainMap;
@ -31,6 +31,18 @@ public class SrdRepository extends SimulationRepository {
return new ArrayList<>(this.trainMap.values());
}
public List<SrSwitch> getTurnoutList() {
return new ArrayList<>(this.turnoutMap.values());
}
public List<SrPSD> getPsdList() {
return new ArrayList<>(this.psdMap.values());
}
public List<SrSignal> getSignalList() {
return new ArrayList<>(this.signalMap.values());
}
@Override
public void initState() {

View File

@ -78,7 +78,7 @@ public class SrdRepositoryBuilder {
}
private static void buildRelationOfTurnoutAndTrack(List<MapSwitchVO> switchList,
Map<String, SrTurnout> turnoutMap,
Map<String, SrSwitch> turnoutMap,
Map<String, SrTrack> trackMap) {
for (MapSwitchVO switchVO : switchList) {
SrTrack a = trackMap.get(switchVO.getSectionACode());
@ -90,7 +90,7 @@ public class SrdRepositoryBuilder {
String.format("道岔[%s]关联区段B[%s]不存在", switchVO.getCode(), switchVO.getSectionBCode()));
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(c,
String.format("道岔[%s]关联区段C[%s]不存在", switchVO.getCode(), switchVO.getSectionCCode()));
SrTurnout turnout = turnoutMap.get(switchVO.getCode());
SrSwitch turnout = turnoutMap.get(switchVO.getCode());
turnout.setTracks(a, b, c);
}
}
@ -121,10 +121,10 @@ public class SrdRepositoryBuilder {
}
}
private static void buildTurnout(List<MapSwitchVO> switchList, Map<String, SrTurnout> turnoutMap) {
private static void buildTurnout(List<MapSwitchVO> switchList, Map<String, SrSwitch> turnoutMap) {
for (MapSwitchVO switchVO : switchList) {
SrTurnout srTurnout = new SrTurnout(switchVO.getCode());
turnoutMap.put(srTurnout.getId(), srTurnout);
SrSwitch srSwitch = new SrSwitch(switchVO.getCode());
turnoutMap.put(srSwitch.getId(), srSwitch);
}
}

View File

@ -2,6 +2,9 @@ package club.joylink.rtss.simulation.rt.srd.bo;
public class TrackPosition {
SrTrack track;
/**
* 轨道偏移量单位mm
*/
int offset;
public TrackPosition(SrTrack track, int offset) {

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.vo.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ProjectServerQueryVO extends PageQueryVO {
private Project project;
}

View File

@ -0,0 +1,66 @@
package club.joylink.rtss.vo.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.entity.ProjectServer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class ProjectServerVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private Project project;
/**
* 域名
*/
private String domainName;
@JsonSerialize(using = ToStringSerializer.class)
private Long createUserId;
private LocalDateTime createTime;
@JsonSerialize(using = ToStringSerializer.class)
private Long updateUserId;
private LocalDateTime updateTime;
public ProjectServerVO(ProjectServer projectServer) {
this.id = projectServer.getId();
this.project = Project.valueOf(projectServer.getProject());
this.domainName = projectServer.getDomainName();
this.createUserId = projectServer.getCreateUserId();
this.createTime = projectServer.getCreateTime();
this.updateUserId = projectServer.getUpdateUserId();
this.updateTime = projectServer.getUpdateTime();
}
public static List<ProjectServerVO> convert2VOList(List<ProjectServer> projectServerList) {
List<ProjectServerVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(projectServerList)) {
for (ProjectServer projectServer : projectServerList) {
voList.add(new ProjectServerVO(projectServer));
}
}
return voList;
}
public ProjectServer toDB() {
ProjectServer db = new ProjectServer();
db.setProject(this.project.name());
db.setDomainName(this.domainName);
return db;
}
}

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.services.LoginSessionManager;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.StringUtils;
@ -34,6 +35,7 @@ public class SessionAuthHandshakeInterceptor implements HandshakeInterceptor {
} catch (Throwable e) {
log.error("未登录或登陆已过期", e);
}
response.setStatusCode(HttpStatus.UNAUTHORIZED);
return false;
}
@ -71,5 +73,6 @@ public class SessionAuthHandshakeInterceptor implements HandshakeInterceptor {
@Override
public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
Exception exception) {
}
}

View File

@ -0,0 +1,38 @@
package club.joylink.rtss.websocket.client;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandler;
import java.lang.reflect.Type;
@Slf4j
public class SimulationSessionHandler implements StompSessionHandler {
@Override
public void afterConnected(StompSession session, StompHeaders connectedHeaders) {
log.debug(String.format("stomp websocket connected"));
}
@Override
public void handleException(StompSession session, StompCommand command, StompHeaders headers, byte[] payload, Throwable exception) {
log.error("stomp handle exception", exception);
}
@Override
public void handleTransportError(StompSession session, Throwable exception) {
log.error("stomp handle transport error", exception);
}
@Override
public Type getPayloadType(StompHeaders headers) {
return String.class;
}
@Override
public void handleFrame(StompHeaders headers, Object payload) {
String json = (String) payload;
log.debug(String.format("receive frame:%s", json));
}
}

View File

@ -0,0 +1,27 @@
package club.joylink.rtss.websocket.client;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.messaging.WebSocketStompClient;
import java.util.concurrent.ExecutionException;
@Slf4j
public class StompClientManager {
// private static final Map<String, StompClientSupport> stompClientMap = new ConcurrentHashMap<>();
public static void main(String[] args) throws ExecutionException, InterruptedException {
StandardWebSocketClient socketClient = new StandardWebSocketClient();
WebSocketStompClient stompClient = new WebSocketStompClient(socketClient);
SimulationSessionHandler handler = new SimulationSessionHandler();
ListenableFuture<StompSession> future = stompClient
.connect("ws://192.168.8.129:9000/joylink-websocket?token=aaa",
handler, "null");
StompSession stompSession = future.get();
stompSession.subscribe("/user/queue/simulation/1/", handler);
}
}

View File

@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.ProjectServerDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.ProjectServer">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="domain_name" jdbcType="VARCHAR" property="domainName" />
<result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</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, project, domain_name, create_user_id, create_time, update_user_id, update_time
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.ProjectServerExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from project_server
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from project_server
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from project_server
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.ProjectServerExample">
delete from project_server
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ProjectServer" useGeneratedKeys="true">
insert into project_server (project, domain_name, create_user_id,
create_time, update_user_id, update_time
)
values (#{project,jdbcType=VARCHAR}, #{domainName,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ProjectServer" useGeneratedKeys="true">
insert into project_server
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="project != null">
project,
</if>
<if test="domainName != null">
domain_name,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="project != null">
#{project,jdbcType=VARCHAR},
</if>
<if test="domainName != null">
#{domainName,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null">
#{updateUserId,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.ProjectServerExample" resultType="java.lang.Long">
select count(*) from project_server
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update project_server
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.project != null">
project = #{record.project,jdbcType=VARCHAR},
</if>
<if test="record.domainName != null">
domain_name = #{record.domainName,jdbcType=VARCHAR},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update project_server
set id = #{record.id,jdbcType=BIGINT},
project = #{record.project,jdbcType=VARCHAR},
domain_name = #{record.domainName,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_user_id = #{record.updateUserId,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.ProjectServer">
update project_server
<set>
<if test="project != null">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="domainName != null">
domain_name = #{domainName,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.ProjectServer">
update project_server
set project = #{project,jdbcType=VARCHAR},
domain_name = #{domainName,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user_id = #{updateUserId,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>