# Conflicts:
#	src/main/java/club/joylink/xiannccda/ats/message/MessageId.java
This commit is contained in:
tiger_zhou 2023-06-07 10:05:48 +08:00
commit af876d856d
13 changed files with 52 additions and 33 deletions

View File

@ -54,7 +54,7 @@ public abstract class MessageData {
* @param buf
* @throws Exception
*/
public abstract void decode2(ByteBuf buf) throws Exception;
abstract void decode2(ByteBuf buf) throws Exception;
public void encode(ByteBuf buf) {
final int messageLength = this.length;
@ -70,8 +70,7 @@ public abstract class MessageData {
*
* @param buf
*/
protected void encode2(ByteBuf buf) {
}
abstract void encode2(ByteBuf buf);
public int total() {
return this.length + 2;

View File

@ -1,12 +1,6 @@
package club.joylink.xiannccda.ats.message;
import club.joylink.xiannccda.ats.message.line3.HeartBeatMsg;
import club.joylink.xiannccda.ats.message.rep.DepotPlanResponse;
import club.joylink.xiannccda.ats.message.rep.DeviceStatusBitmapResponse;
import club.joylink.xiannccda.ats.message.rep.DeviceStatusChangeResponse;
import club.joylink.xiannccda.ats.message.rep.NetworkAliveStatusResponse;
import club.joylink.xiannccda.ats.message.rep.SignalRouteStatusResponse;
import club.joylink.xiannccda.ats.message.req.LoadDeviceStatusRequest;
public enum MessageId {
UNKNOWN(0x0000, null),
@ -42,19 +36,19 @@ public enum MessageId {
/**
* 列车报点
*/
TRAIN_RECORD(0x0008, null),
TRAIN_RECORD(0x0008,()->new TrainRecordResponse()),
/**
* 列车信息全体
*/
TRAIN_INDICATION_INIT(0x0009, null),
TRAIN_INDICATION_INIT(0x0009,()->new TrainIndicationInitResponse()),
/**
* 列车信息更新
*/
TRAIN_INDICATION_UPDATE(0x0010, null),
TRAIN_INDICATION_UPDATE(0x0010,()->new TrainIndicationUpdateResponse()),
/**
* 列车信息删除
*/
TRAIN_INDICATION_REMOVE(0x0011, null),
TRAIN_INDICATION_REMOVE(0x0011,()->new TrainIndicationRemoveResponse()),
/**
* 统计信息查询
*/
@ -134,18 +128,21 @@ public enum MessageId {
/**
* 实时报警事件消息
*/
MESSAGE_ALARM(0x0031, null),
MESSAGE_ALARM(0x0031,()->new MessageAlarmResponse()),
/**
* 列车阻塞消息
*/
TRAIN_BLOCK_INFO(0x0032, null),
TRAIN_BLOCK_INFO(0x0032,()->new TrainBlockInfoResponse()),
/**
* 当天计划运行图参数消息
*/
INUSED_SCHEDULE_PARAMETER(0x0033, null),
INUSED_SCHEDULE_PARAMETER(0x0033,()->new InUsedScheduleParameterResponse()),
;
int val;
/**
* 消息对象创建接口
*/
OccMessageCreate omc;
interface OccMessageCreate {

View File

@ -0,0 +1,10 @@
package club.joylink.xiannccda.ats.message;
import io.netty.buffer.ByteBuf;
public abstract class MessageRequest extends MessageData {
@Override
public void decode2(ByteBuf buf) throws Exception {
}
}

View File

@ -0,0 +1,10 @@
package club.joylink.xiannccda.ats.message;
import io.netty.buffer.ByteBuf;
public abstract class MessageResponse extends MessageData {
@Override
void encode2(ByteBuf buf) {
}
}

View File

@ -6,7 +6,7 @@ import io.netty.buffer.ByteBuf;
/**
* 2.7.14 当天计划运行图参数消息
*/
public class InUsedScheduleParameterRsp extends MessageData {
public class InUsedScheduleParameterResponse extends MessageData {
/**
* 线路号(2)

View File

@ -3,7 +3,7 @@ package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageData;
import io.netty.buffer.ByteBuf;
public class MessageAlarmRsp extends MessageData {
public class MessageAlarmResponse extends MessageData {
/**
* 线路号(2)

View File

@ -9,7 +9,7 @@ import java.util.List;
/**
* 2.7.13 列车阻塞消息
*/
public class TrainBlockInfoRsp extends MessageData {
public class TrainBlockInfoResponse extends MessageData {
/**
* 线路号(2)

View File

@ -9,7 +9,7 @@ import java.util.List;
/**
* 2.7.9列车信息全体消息
*/
public class TrainIndicationInitRsp extends MessageData {
public class TrainIndicationInitResponse extends MessageData {
/**
* 线路号(2)

View File

@ -6,7 +6,7 @@ import io.netty.buffer.ByteBuf;
/**
* 2.7.11 列车信息删除消息
*/
public class TrainIndicationRemoveRsp extends MessageData {
public class TrainIndicationRemoveResponse extends MessageData {
/**
* 线路号(2)

View File

@ -6,7 +6,7 @@ import io.netty.buffer.ByteBuf;
/**
* 2.7.10 列车信息更新消息[增加/更新]
*/
public class TrainIndicationUpdateRsp extends MessageData {
public class TrainIndicationUpdateResponse extends MessageData {
/**
* 线路号(2)

View File

@ -6,7 +6,7 @@ import io.netty.buffer.ByteBuf;
/**
* 2.7.8列车报点消息
*/
public class TrainRecordRsp extends MessageData {
public class TrainRecordResponse extends MessageData {
/**
* 线路号(2)

View File

@ -3,6 +3,8 @@ package club.joylink.xiannccda.controller;
import club.joylink.xiannccda.dto.DraftingQueryDto;
import club.joylink.xiannccda.entity.Drafting;
import club.joylink.xiannccda.entity.Drafting.Creation;
import club.joylink.xiannccda.entity.Drafting.SaveAs;
import club.joylink.xiannccda.entity.Drafting.SaveData;
import club.joylink.xiannccda.repository.IDraftingRepository;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -10,7 +12,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.security.Principal;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@ -59,10 +60,10 @@ public class DraftingController {
@PostMapping("/{id}/saveAs")
@SecurityRequirement(name = "jwt")
@Operation(summary = "创建绘图草稿")
@Operation(summary = "另存为绘图草稿")
@ApiResponse(description = "绘图草稿信息")
public Drafting create(Principal user, @PathVariable Integer id,
@RequestBody @Validated(Creation.class) Drafting drafting) {
public Drafting saveAs(Principal user, @PathVariable Integer id,
@RequestBody @Validated(SaveAs.class) Drafting drafting) {
return this.draftingRepository.saveAs(id, drafting, Integer.valueOf(user.getName()));
}
@ -79,7 +80,7 @@ public class DraftingController {
@Operation(summary = "保存绘图草稿数据")
@ApiResponse(description = "保存成功失败标识")
public boolean updateDrawData(@PathVariable Integer id,
@RequestBody @Validated(Creation.class) Drafting drafting) {
@RequestBody @Validated(SaveData.class) Drafting drafting) {
return this.draftingRepository.updateDrawData(id, drafting.getProto());
}

View File

@ -5,7 +5,9 @@ import club.joylink.xiannccda.entity.Drafting;
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
import club.joylink.xiannccda.mapper.DraftingMapper;
import club.joylink.xiannccda.repository.IDraftingRepository;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -49,11 +51,11 @@ public class DraftingRepository extends ServiceImpl<DraftingMapper, Drafting> im
@Override
public boolean updateDrawData(Integer id, byte[] proto) {
Drafting drafting = new Drafting();
drafting.setId(id);
drafting.setProto(proto);
drafting.setUpdateAt(LocalDateTime.now());
return this.updateById(drafting);
Drafting d = this.getById(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(d, "草稿数据不存在");
d.setProto(proto);
d.setUpdateAt(LocalDateTime.now());
return this.updateById(d);
}
@Override