修改NCC报警信息;增加报警提示信息数据管理接口(暂时不用)

This commit is contained in:
joylink_zhangsai 2023-04-25 10:59:20 +08:00
parent 590bb3181f
commit 70d99faa59
14 changed files with 1249 additions and 28 deletions

View File

@ -0,0 +1,10 @@
CREATE TABLE `rts_alarm_tips` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`alarm_type` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
`alarm_level` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
`tips` varchar(10000) COLLATE utf8mb4_general_ci NOT NULL,
`update_time` datetime NOT NULL,
`updater_id` bigint NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `alarm` (`alarm_type`,`alarm_level`) COMMENT '用以保证提示信息唯一'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='ATS报警信息提示';

View File

@ -0,0 +1,71 @@
package club.joylink.rtss.controller.alarm;
import club.joylink.rtss.entity.AlarmTips;
import club.joylink.rtss.services.alarm.AlarmTipsService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.alarm.AlarmQueryVO;
import club.joylink.rtss.vo.alarm.AlarmTipsCreateVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 报警提示信息配置管理
*/
@RestController
@RequestMapping("/api/alarm")
public class AlarmTipsController {
@Autowired
private AlarmTipsService alarmTipsService;
/**
* 创建提示信息
*/
@PostMapping("")
public void create(@RequestBody AlarmTipsCreateVO alarmTipsCreateVO, @RequestAttribute AccountVO user) {
alarmTipsService.create(alarmTipsCreateVO, user.getId());
}
/**
* 单条查询
*/
@GetMapping("")
public AlarmTips get(AlarmQueryVO queryVO) {
return alarmTipsService.get(queryVO);
}
/**
* 列表查询
*/
@GetMapping("/list")
public List<AlarmTips> list() {
return alarmTipsService.list();
}
/**
* 分页查询
*/
@GetMapping("/page")
public PageVO<AlarmTips> page(PageQueryVO queryVO) {
return alarmTipsService.page(queryVO);
}
/**
* 更新
*/
@PutMapping("/{id}")
public void update(@PathVariable Long id, @RequestBody AlarmTipsCreateVO createVO, @RequestAttribute AccountVO user) {
alarmTipsService.update(id, createVO, user.getId());
}
/**
* 删除
*/
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
alarmTipsService.delete(id);
}
}

View File

@ -0,0 +1,12 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.AlarmTips;
import club.joylink.rtss.entity.AlarmTipsExample;
import org.springframework.stereotype.Repository;
/**
* AlarmTipsDAO继承基类
*/
@Repository
public interface AlarmTipsDAO extends MyBatisBaseDao<AlarmTips, Long, AlarmTipsExample> {
}

View File

@ -0,0 +1,122 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
* ATS报警信息提示
*/
public class AlarmTips implements Serializable {
private Long id;
private String alarmType;
private String alarmLevel;
private String tips;
private LocalDateTime updateTime;
private Long updaterId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getAlarmLevel() {
return alarmLevel;
}
public void setAlarmLevel(String alarmLevel) {
this.alarmLevel = alarmLevel;
}
public String getTips() {
return tips;
}
public void setTips(String tips) {
this.tips = tips;
}
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;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
AlarmTips other = (AlarmTips) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAlarmType() == null ? other.getAlarmType() == null : this.getAlarmType().equals(other.getAlarmType()))
&& (this.getAlarmLevel() == null ? other.getAlarmLevel() == null : this.getAlarmLevel().equals(other.getAlarmLevel()))
&& (this.getTips() == null ? other.getTips() == null : this.getTips().equals(other.getTips()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getUpdaterId() == null ? other.getUpdaterId() == null : this.getUpdaterId().equals(other.getUpdaterId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getAlarmType() == null) ? 0 : getAlarmType().hashCode());
result = prime * result + ((getAlarmLevel() == null) ? 0 : getAlarmLevel().hashCode());
result = prime * result + ((getTips() == null) ? 0 : getTips().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getUpdaterId() == null) ? 0 : getUpdaterId().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(", alarmType=").append(alarmType);
sb.append(", alarmLevel=").append(alarmLevel);
sb.append(", tips=").append(tips);
sb.append(", updateTime=").append(updateTime);
sb.append(", updaterId=").append(updaterId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,613 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class AlarmTipsExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public AlarmTipsExample() {
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 andAlarmTypeIsNull() {
addCriterion("alarm_type is null");
return (Criteria) this;
}
public Criteria andAlarmTypeIsNotNull() {
addCriterion("alarm_type is not null");
return (Criteria) this;
}
public Criteria andAlarmTypeEqualTo(String value) {
addCriterion("alarm_type =", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeNotEqualTo(String value) {
addCriterion("alarm_type <>", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeGreaterThan(String value) {
addCriterion("alarm_type >", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeGreaterThanOrEqualTo(String value) {
addCriterion("alarm_type >=", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeLessThan(String value) {
addCriterion("alarm_type <", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeLessThanOrEqualTo(String value) {
addCriterion("alarm_type <=", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeLike(String value) {
addCriterion("alarm_type like", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeNotLike(String value) {
addCriterion("alarm_type not like", value, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeIn(List<String> values) {
addCriterion("alarm_type in", values, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeNotIn(List<String> values) {
addCriterion("alarm_type not in", values, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeBetween(String value1, String value2) {
addCriterion("alarm_type between", value1, value2, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmTypeNotBetween(String value1, String value2) {
addCriterion("alarm_type not between", value1, value2, "alarmType");
return (Criteria) this;
}
public Criteria andAlarmLevelIsNull() {
addCriterion("alarm_level is null");
return (Criteria) this;
}
public Criteria andAlarmLevelIsNotNull() {
addCriterion("alarm_level is not null");
return (Criteria) this;
}
public Criteria andAlarmLevelEqualTo(String value) {
addCriterion("alarm_level =", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelNotEqualTo(String value) {
addCriterion("alarm_level <>", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelGreaterThan(String value) {
addCriterion("alarm_level >", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelGreaterThanOrEqualTo(String value) {
addCriterion("alarm_level >=", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelLessThan(String value) {
addCriterion("alarm_level <", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelLessThanOrEqualTo(String value) {
addCriterion("alarm_level <=", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelLike(String value) {
addCriterion("alarm_level like", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelNotLike(String value) {
addCriterion("alarm_level not like", value, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelIn(List<String> values) {
addCriterion("alarm_level in", values, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelNotIn(List<String> values) {
addCriterion("alarm_level not in", values, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelBetween(String value1, String value2) {
addCriterion("alarm_level between", value1, value2, "alarmLevel");
return (Criteria) this;
}
public Criteria andAlarmLevelNotBetween(String value1, String value2) {
addCriterion("alarm_level not between", value1, value2, "alarmLevel");
return (Criteria) this;
}
public Criteria andTipsIsNull() {
addCriterion("tips is null");
return (Criteria) this;
}
public Criteria andTipsIsNotNull() {
addCriterion("tips is not null");
return (Criteria) this;
}
public Criteria andTipsEqualTo(String value) {
addCriterion("tips =", value, "tips");
return (Criteria) this;
}
public Criteria andTipsNotEqualTo(String value) {
addCriterion("tips <>", value, "tips");
return (Criteria) this;
}
public Criteria andTipsGreaterThan(String value) {
addCriterion("tips >", value, "tips");
return (Criteria) this;
}
public Criteria andTipsGreaterThanOrEqualTo(String value) {
addCriterion("tips >=", value, "tips");
return (Criteria) this;
}
public Criteria andTipsLessThan(String value) {
addCriterion("tips <", value, "tips");
return (Criteria) this;
}
public Criteria andTipsLessThanOrEqualTo(String value) {
addCriterion("tips <=", value, "tips");
return (Criteria) this;
}
public Criteria andTipsLike(String value) {
addCriterion("tips like", value, "tips");
return (Criteria) this;
}
public Criteria andTipsNotLike(String value) {
addCriterion("tips not like", value, "tips");
return (Criteria) this;
}
public Criteria andTipsIn(List<String> values) {
addCriterion("tips in", values, "tips");
return (Criteria) this;
}
public Criteria andTipsNotIn(List<String> values) {
addCriterion("tips not in", values, "tips");
return (Criteria) this;
}
public Criteria andTipsBetween(String value1, String value2) {
addCriterion("tips between", value1, value2, "tips");
return (Criteria) this;
}
public Criteria andTipsNotBetween(String value1, String value2) {
addCriterion("tips not between", value1, value2, "tips");
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

@ -0,0 +1,23 @@
package club.joylink.rtss.services.alarm;
import club.joylink.rtss.entity.AlarmTips;
import club.joylink.rtss.vo.alarm.AlarmQueryVO;
import club.joylink.rtss.vo.alarm.AlarmTipsCreateVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import java.util.List;
public interface AlarmTipsService {
void create(AlarmTipsCreateVO createVO, long creatorId);
AlarmTips get(AlarmQueryVO queryVO);
void delete(long id);
List<AlarmTips> list();
PageVO<AlarmTips> page(PageQueryVO queryVO);
void update(long id, AlarmTipsCreateVO createVO, long updaterId);
}

View File

@ -0,0 +1,84 @@
package club.joylink.rtss.services.alarm;
import club.joylink.rtss.dao.AlarmTipsDAO;
import club.joylink.rtss.entity.AlarmTips;
import club.joylink.rtss.entity.AlarmTipsExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.alarm.AlarmQueryVO;
import club.joylink.rtss.vo.alarm.AlarmTipsCreateVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
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 AlarmTipsServiceImpl implements AlarmTipsService {
@Autowired
private AlarmTipsDAO alarmTipsDAO;
@Override
public void create(AlarmTipsCreateVO createVO, long creatorId) {
checkParam(createVO);
AlarmTips alarmTips = createVO.convert2DB();
alarmTips.setUpdateTime(LocalDateTime.now());
alarmTips.setUpdaterId(creatorId);
alarmTipsDAO.insert(alarmTips);
}
@Override
public AlarmTips get(AlarmQueryVO queryVO) {
AlarmTipsExample example = new AlarmTipsExample();
example.createCriteria().andAlarmTypeEqualTo(queryVO.getAlarmType())
.andAlarmLevelEqualTo(queryVO.getAlarmLevel());
List<AlarmTips> list = alarmTipsDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(list);
return list.get(0);
}
@Override
public void delete(long id) {
alarmTipsDAO.deleteByPrimaryKey(id);
}
@Override
public List<AlarmTips> list() {
return alarmTipsDAO.selectByExample(null);
}
@Override
public PageVO<AlarmTips> page(PageQueryVO queryVO) {
Page<AlarmTips> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
list();
return PageVO.convert(page);
}
@Override
public void update(long id, AlarmTipsCreateVO createVO, long updaterId) {
checkParam(createVO);
AlarmTips entity = getEntity(id);
createVO.overwrite(entity);
entity.setUpdaterId(updaterId);
alarmTipsDAO.updateByPrimaryKey(entity);
}
private void checkParam(AlarmTipsCreateVO createVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getAlarmType());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(createVO.getAlarmLevel());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(createVO.getTips());
}
private AlarmTips getEntity(long id) {
AlarmTips entity = findEntity(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity, String.format("[id:%s]的数据不存在", id));
return entity;
}
private AlarmTips findEntity(long id) {
return alarmTipsDAO.selectByPrimaryKey(id);
}
}

View File

@ -29,6 +29,10 @@ public class AtsAlarm {
* 告警级别
*/
private String level;
/**
* 报警颜色
*/
private String color;
/**
* 告警类型
*/
@ -107,4 +111,23 @@ public class AtsAlarm {
/** 列车延误 */
TRAIN_DELAY,
}
/**
* 西安三报警级别
*/
public interface Xian3Level {
String LEVEL_1 = "I";
String LEVEL_2 = "II";
String LEVEL_3 = "III";
String LEVEL_4 = "IV";
}
/**
* 西安三报警颜色
*/
public interface Xian3Color{
String YELLOW = "Y";
String ORANGE = "O";
String RED = "R";
}
}

View File

@ -21,14 +21,12 @@ import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.support.TrainLoadParam2;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vo.VirtualRealityTrainVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.device.virtual.VRDeviceLogicLoop;
import club.joylink.rtss.simulation.cbtc.device.virtual.VRTrainRunningService;
import club.joylink.rtss.simulation.cbtc.event.SimulationRunAsPlanEvent;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
import lombok.extern.slf4j.Slf4j;
@ -496,20 +494,6 @@ public class AtsTrainLoadService {
}
}
// private void updateTrainSpeed(Simulation simulation) {
// for (VirtualRealityTrain train : simulation.getRepository().getOnlineTrainList()) {
// if (train.getMa() == null)
// continue;
// float targetDistance = ATOService.calculateTargetRemainDistance(train, train.getMa());
// float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f);
// SpeedCurve speedCurve = SpeedCurve
// .buildTargetSpeedCurve(train.getHeadPosition(), train.calculateTailPosition(), train.isRight(),
// targetDistance, train.getSpeed(), speedMax);
// float speed = speedCurve.getSpeedOf(speedCurve.getTotalDistance());
// train.setSpeed(speed);
// }
// }
private List<TrainInfo> trainOnlineAndBuildSupervise(Simulation simulation, List<VirtualRealityTrain> loadedList) {
List<TrainInfo> superviseList = new ArrayList<>();
SimulationDataRepository repository = simulation.getRepository();

View File

@ -32,7 +32,7 @@ public class NccAlarmService {
/**
* 列车延误监测
* 列车在站台延误超过2/5/10分钟分别发出蓝//色等级警报
* 列车在站台延误超过2/10分钟分别发出黄/色等级警报
*/
public void delayMonitoring(Simulation simulation) {
SimulationDataRepository repository = simulation.getRepository();
@ -55,28 +55,28 @@ public class NccAlarmService {
continue;
//延误监测
if (systemTime.isAfter(stationPlan.getArriveTime())) {
String level;
String color;
if (systemTime.isAfter(stationPlan.getArriveTime().plusMinutes(delay))) {
switch (delay) {
case 2:
level = "蓝色";
trainDelayMonitoring.put(groupNumber, 5);
break;
case 5:
level = "黄色";
color = AtsAlarm.Xian3Color.YELLOW;
trainDelayMonitoring.put(groupNumber, 10);
break;
case 10:
level = "红色";
color = AtsAlarm.Xian3Color.ORANGE;
trainDelayMonitoring.put(groupNumber, -1);
break;
// case 30:
// level = AtsAlarm.Xian3Level.RED;
// trainDelayMonitoring.put(groupNumber, -1);
// break;
default:
throw new IllegalStateException("Unexpected value: " + delay);
}
} else {
return;
}
String description = String.format("列车[%s]按照计划[%s-%s]应在[%s]抵达[%s],现已晚点%s分钟",
String description = String.format("三号线:列车[%s]按照计划[%s-%s]应在[%s]抵达[%s],现已晚点%s分钟",
groupNumber, trainInfo.getServiceNumber(), trainInfo.getTripNumber(),
stationPlan.getCorrectArriveTime(), stationPlan.getStation().getName(), delay);
//记录并发送报警信息
@ -84,14 +84,15 @@ public class NccAlarmService {
.code(simulation.getIdGenerator().generateAlarmId())
.time(correctSystemDateTime)
.type(AtsAlarm.Type.TRAIN_DELAY)
.level(level)
.level(AtsAlarm.Xian3Level.LEVEL_1)
.color(color)
.deviceCode(groupNumber)
.description(description)
.build();
repository.addAtsAlarm(atsAlarm);
SocketMessageVO<Collection<AtsAlarm>> messageVO =
SocketMessageFactory.buildAtsAlarmMessage(simulation.getId(), Collections.singletonList(atsAlarm));
stompMessageService.send(messageVO);
stompMessageService.sendToUser(simulation.getCreatorId(), messageVO);
}
}
}

View File

@ -0,0 +1,10 @@
package club.joylink.rtss.vo.alarm;
import lombok.Data;
@Data
public class AlarmQueryVO {
private String alarmType;
private String alarmLevel;
}

View File

@ -0,0 +1,40 @@
package club.joylink.rtss.vo.alarm;
import club.joylink.rtss.entity.AlarmTips;
import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
import lombok.Data;
/**
* 报警提示信息创建
*/
@Data
public class AlarmTipsCreateVO {
/**
* 报警类型
*/
private AtsAlarm.Type alarmType;
/**
* 报警级别
*/
private String alarmLevel;
/**
* 提示信息
*/
private String tips;
public AlarmTips convert2DB() {
AlarmTips alarmTips = new AlarmTips();
alarmTips.setAlarmType(alarmType.name());
alarmTips.setAlarmLevel(alarmLevel);
alarmTips.setTips(tips);
return alarmTips;
}
public void overwrite(AlarmTips entity) {
entity.setAlarmType(alarmType.name());
entity.setAlarmLevel(alarmLevel);
entity.setTips(tips);
}
}

View File

@ -479,7 +479,7 @@ public class SocketMessageFactory {
}
/**
* 构建仿真工作参数
* Ats报警
*/
public static SocketMessageVO<Collection<AtsAlarm>> buildAtsAlarmMessage(String sId, Collection<AtsAlarm> alarmList) {
return build(WebSocketMessageType.Simulation_Alarm, sId, alarmList);

View File

@ -0,0 +1,228 @@
<?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.AlarmTipsDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.AlarmTips">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="alarm_type" jdbcType="VARCHAR" property="alarmType" />
<result column="alarm_level" jdbcType="VARCHAR" property="alarmLevel" />
<result column="tips" jdbcType="VARCHAR" property="tips" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="updater_id" jdbcType="BIGINT" property="updaterId" />
</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, alarm_type, alarm_level, tips, update_time, updater_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.AlarmTipsExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from rts_alarm_tips
<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 rts_alarm_tips
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_alarm_tips
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.AlarmTipsExample">
delete from rts_alarm_tips
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.AlarmTips" useGeneratedKeys="true">
insert into rts_alarm_tips (alarm_type, alarm_level, tips,
update_time, updater_id)
values (#{alarmType,jdbcType=VARCHAR}, #{alarmLevel,jdbcType=VARCHAR}, #{tips,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.AlarmTips" useGeneratedKeys="true">
insert into rts_alarm_tips
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="alarmType != null">
alarm_type,
</if>
<if test="alarmLevel != null">
alarm_level,
</if>
<if test="tips != null">
tips,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updaterId != null">
updater_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="alarmType != null">
#{alarmType,jdbcType=VARCHAR},
</if>
<if test="alarmLevel != null">
#{alarmLevel,jdbcType=VARCHAR},
</if>
<if test="tips != null">
#{tips,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updaterId != null">
#{updaterId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.AlarmTipsExample" resultType="java.lang.Long">
select count(*) from rts_alarm_tips
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update rts_alarm_tips
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.alarmType != null">
alarm_type = #{record.alarmType,jdbcType=VARCHAR},
</if>
<if test="record.alarmLevel != null">
alarm_level = #{record.alarmLevel,jdbcType=VARCHAR},
</if>
<if test="record.tips != null">
tips = #{record.tips,jdbcType=VARCHAR},
</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>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_alarm_tips
set id = #{record.id,jdbcType=BIGINT},
alarm_type = #{record.alarmType,jdbcType=VARCHAR},
alarm_level = #{record.alarmLevel,jdbcType=VARCHAR},
tips = #{record.tips,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
updater_id = #{record.updaterId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.AlarmTips">
update rts_alarm_tips
<set>
<if test="alarmType != null">
alarm_type = #{alarmType,jdbcType=VARCHAR},
</if>
<if test="alarmLevel != null">
alarm_level = #{alarmLevel,jdbcType=VARCHAR},
</if>
<if test="tips != null">
tips = #{tips,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updaterId != null">
updater_id = #{updaterId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.AlarmTips">
update rts_alarm_tips
set alarm_type = #{alarmType,jdbcType=VARCHAR},
alarm_level = #{alarmLevel,jdbcType=VARCHAR},
tips = #{tips,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater_id = #{updaterId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>