添加发布图形数据库相关
This commit is contained in:
parent
6582255309
commit
0031c952ba
@ -42,7 +42,7 @@ public class OccTcpClientConnection {
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.group = new NioEventLoopGroup();
|
this.group = new NioEventLoopGroup(1);
|
||||||
this.bootstrap = new Bootstrap();
|
this.bootstrap = new Bootstrap();
|
||||||
OccTcpClientConnection self = this;
|
OccTcpClientConnection self = this;
|
||||||
bootstrap.group(group)
|
bootstrap.group(group)
|
||||||
@ -70,7 +70,7 @@ public class OccTcpClientConnection {
|
|||||||
ChannelFuture channelFuture = bootstrap.connect(this.host, this.port);
|
ChannelFuture channelFuture = bootstrap.connect(this.host, this.port);
|
||||||
channelFuture.addListener(future1 -> {
|
channelFuture.addListener(future1 -> {
|
||||||
if (future1.isSuccess()) {
|
if (future1.isSuccess()) {
|
||||||
log.info("连接到OCC服务: host={}, port={}", this.host, this.port);
|
log.info("连接到OCC服务: {}", this.hostPortInfo());
|
||||||
this.lastReceiveMessageTime = System.currentTimeMillis();
|
this.lastReceiveMessageTime = System.currentTimeMillis();
|
||||||
this.channel = channelFuture.channel();
|
this.channel = channelFuture.channel();
|
||||||
this.connected = true;
|
this.connected = true;
|
||||||
@ -78,7 +78,7 @@ public class OccTcpClientConnection {
|
|||||||
});
|
});
|
||||||
channelFuture.channel().closeFuture().addListener(listener -> {
|
channelFuture.channel().closeFuture().addListener(listener -> {
|
||||||
if (listener.isSuccess()) {
|
if (listener.isSuccess()) {
|
||||||
log.info("与服务断连,尝试重连");
|
log.info("与服务断连,尝试重连: {}", this.hostPortInfo());
|
||||||
this.connected = false;
|
this.connected = false;
|
||||||
this.channel = null;
|
this.channel = null;
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
@ -87,6 +87,10 @@ public class OccTcpClientConnection {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String hostPortInfo() {
|
||||||
|
return String.format("host=%s, port=%s", this.host, this.port);
|
||||||
|
}
|
||||||
|
|
||||||
static class HeartBeatTimeoutHandler {
|
static class HeartBeatTimeoutHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,8 +108,7 @@ public class OccTcpClientConnection {
|
|||||||
if (connection.connected) {
|
if (connection.connected) {
|
||||||
long ctm = System.currentTimeMillis();
|
long ctm = System.currentTimeMillis();
|
||||||
if (connection.lastReceiveMessageTime + HeartBeatTimeout < ctm) {
|
if (connection.lastReceiveMessageTime + HeartBeatTimeout < ctm) {
|
||||||
log.info("超时未收到OCC消息,尝试重连: host={}, port={}", connection.host,
|
log.info("超时未收到OCC消息,尝试断开重连");
|
||||||
connection.port);
|
|
||||||
connection.reconnect();
|
connection.reconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,14 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 前端控制器
|
* 线路信息 前端控制器
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author walker-sheng
|
* @author walker-sheng
|
||||||
* @since 2023-06-06
|
* @since 2023-06-06
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/lineInfo")
|
@RequestMapping("/api/lineInfo")
|
||||||
public class LineInfoController {
|
public class LineInfoController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package club.joylink.xiannccda.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 发布图形界面 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker-sheng
|
||||||
|
* @since 2023-06-08
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/publishedGi")
|
||||||
|
public class PublishedGiController {
|
||||||
|
|
||||||
|
}
|
@ -21,7 +21,7 @@ import lombok.experimental.Accessors;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(name = "Drafting", description = "$!{table.comment}")
|
@Schema(name = "Drafting", description = "图形界面草稿数据")
|
||||||
public class Drafting {
|
public class Drafting {
|
||||||
|
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
@ -32,6 +32,10 @@ public class Drafting {
|
|||||||
@NotBlank(message = "草稿图名称不能为空", groups = {Creation.class, SaveAs.class})
|
@NotBlank(message = "草稿图名称不能为空", groups = {Creation.class, SaveAs.class})
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "草稿图类型", example = "Line/LineNetwork")
|
||||||
|
@NotBlank(message = "草稿图类型不能为空", groups = {Creation.class})
|
||||||
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "绘图数据")
|
@Schema(description = "绘图数据")
|
||||||
@NotNull(message = "数据不能为空", groups = {SaveData.class, SaveAs.class})
|
@NotNull(message = "数据不能为空", groups = {SaveData.class, SaveAs.class})
|
||||||
private byte[] proto;
|
private byte[] proto;
|
||||||
|
@ -11,7 +11,7 @@ import lombok.experimental.Accessors;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author walker-sheng
|
* @author walker-sheng
|
||||||
@ -21,37 +21,37 @@ import lombok.experimental.Accessors;
|
|||||||
@Setter
|
@Setter
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("line_info")
|
@TableName("line_info")
|
||||||
@Schema(name = "LineInfo", description = "$!{table.comment}")
|
@Schema(name = "LineInfo", description = "线路信息数据")
|
||||||
public class LineInfo {
|
public class LineInfo {
|
||||||
|
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Schema(description = "线路名")
|
@Schema(description = "线路名")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "线路号")
|
@Schema(description = "线路号")
|
||||||
private Integer lineId;
|
private Integer lineId;
|
||||||
|
|
||||||
@Schema(description = "线路配置")
|
@Schema(description = "线路配置")
|
||||||
private String config;
|
private String config;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
@Schema(description = "修改时间")
|
@Schema(description = "修改时间")
|
||||||
private LocalDateTime updateAt;
|
private LocalDateTime updateAt;
|
||||||
|
|
||||||
public static final String ID = "id";
|
public static final String ID = "id";
|
||||||
|
|
||||||
public static final String NAME = "name";
|
public static final String NAME = "name";
|
||||||
|
|
||||||
public static final String LINE_ID = "line_id";
|
public static final String LINE_ID = "line_id";
|
||||||
|
|
||||||
public static final String CONFIG = "config";
|
public static final String CONFIG = "config";
|
||||||
|
|
||||||
public static final String CREATED_AT = "created_at";
|
public static final String CREATED_AT = "created_at";
|
||||||
|
|
||||||
public static final String UPDATE_AT = "update_at";
|
public static final String UPDATE_AT = "update_at";
|
||||||
}
|
}
|
||||||
|
59
src/main/java/club/joylink/xiannccda/entity/PublishedGi.java
Normal file
59
src/main/java/club/joylink/xiannccda/entity/PublishedGi.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package club.joylink.xiannccda.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker-sheng
|
||||||
|
* @since 2023-06-08
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("published_gi")
|
||||||
|
@Schema(name = "PublishedGi", description = "发布的图形界面数据")
|
||||||
|
public class PublishedGi {
|
||||||
|
|
||||||
|
@Schema(description = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "发布图形界面名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "图形界面类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "关联的线路号(line_info表中line_id字段)")
|
||||||
|
private Integer lineId;
|
||||||
|
|
||||||
|
@Schema(description = "图形界面数据")
|
||||||
|
private byte[] proto;
|
||||||
|
|
||||||
|
@Schema(description = "发布用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
private LocalDateTime publishAt;
|
||||||
|
|
||||||
|
public static final String ID = "id";
|
||||||
|
|
||||||
|
public static final String NAME = "name";
|
||||||
|
|
||||||
|
public static final String TYPE = "type";
|
||||||
|
|
||||||
|
public static final String LINE_ID = "line_id";
|
||||||
|
|
||||||
|
public static final String PROTO = "proto";
|
||||||
|
|
||||||
|
public static final String USER_ID = "user_id";
|
||||||
|
|
||||||
|
public static final String PUBLISH_AT = "publish_at";
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package club.joylink.xiannccda.mapper;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.entity.PublishedGi;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker-sheng
|
||||||
|
* @since 2023-06-08
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface PublishedGiMapper extends BaseMapper<PublishedGi> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.xiannccda.mapper.PublishedGiMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="club.joylink.xiannccda.entity.PublishedGi">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="name" property="name" />
|
||||||
|
<result column="type" property="type" />
|
||||||
|
<result column="line_id" property="lineId" />
|
||||||
|
<result column="proto" property="proto" />
|
||||||
|
<result column="user_id" property="userId" />
|
||||||
|
<result column="publish_at" property="publishAt" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, name, type, line_id, proto, user_id, publish_at
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,16 @@
|
|||||||
|
package club.joylink.xiannccda.repository;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.entity.PublishedGi;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker-sheng
|
||||||
|
* @since 2023-06-08
|
||||||
|
*/
|
||||||
|
public interface IPublishedGiRepository extends IService<PublishedGi> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package club.joylink.xiannccda.repository.impl;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.entity.PublishedGi;
|
||||||
|
import club.joylink.xiannccda.mapper.PublishedGiMapper;
|
||||||
|
import club.joylink.xiannccda.repository.IPublishedGiRepository;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author walker-sheng
|
||||||
|
* @since 2023-06-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PublishedGiRepository extends ServiceImpl<PublishedGiMapper, PublishedGi> implements IPublishedGiRepository {
|
||||||
|
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
Subproject commit 86de0cff9ee560f0c7e670184d5baccfdb28ee44
|
Subproject commit 2e001eddeeeaea3aa9c607df72d2196572a717da
|
Loading…
Reference in New Issue
Block a user