微调
This commit is contained in:
@@ -41,39 +41,39 @@ public class WebSocketService {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void start() {
|
public void start() {
|
||||||
new Thread(() -> {
|
// new Thread(() -> {
|
||||||
//可以自定义线程的数量
|
// //可以自定义线程的数量
|
||||||
bossGroup = new NioEventLoopGroup();
|
// bossGroup = new NioEventLoopGroup();
|
||||||
// 默认创建的线程数量 = CPU 处理器数量 *2
|
// // 默认创建的线程数量 = CPU 处理器数量 *2
|
||||||
workerGroup = new NioEventLoopGroup();
|
// workerGroup = new NioEventLoopGroup();
|
||||||
try {
|
// try {
|
||||||
ServerBootstrap serverBootstrap = new ServerBootstrap();
|
// ServerBootstrap serverBootstrap = new ServerBootstrap();
|
||||||
serverBootstrap.group(bossGroup, workerGroup)
|
// serverBootstrap.group(bossGroup, workerGroup)
|
||||||
.channel(NioServerSocketChannel.class)
|
// .channel(NioServerSocketChannel.class)
|
||||||
.handler(new LoggingHandler())
|
// .handler(new LoggingHandler())
|
||||||
//当前连接被阻塞的时候,BACKLOG代表的事 阻塞队列的长度
|
// //当前连接被阻塞的时候,BACKLOG代表的事 阻塞队列的长度
|
||||||
.option(ChannelOption.SO_BACKLOG, 128)
|
// .option(ChannelOption.SO_BACKLOG, 128)
|
||||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000)
|
// .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000)
|
||||||
|
//
|
||||||
//设置连接保持为活动状态
|
// //设置连接保持为活动状态
|
||||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
// .childOption(ChannelOption.SO_KEEPALIVE, true)
|
||||||
.childHandler(webSocketInitializer);
|
// .childHandler(webSocketInitializer);
|
||||||
ChannelFuture future = serverBootstrap.bind(port).sync();
|
// ChannelFuture future = serverBootstrap.bind(port).sync();
|
||||||
future.addListener(f -> {
|
// future.addListener(f -> {
|
||||||
if (future.isSuccess()) {
|
// if (future.isSuccess()) {
|
||||||
System.out.println("webSocket服务启动成功");
|
// System.out.println("webSocket服务启动成功");
|
||||||
} else {
|
// } else {
|
||||||
System.out.println("webSocket服务启动失败");
|
// System.out.println("webSocket服务启动失败");
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
future.channel().closeFuture().sync();
|
// future.channel().closeFuture().sync();
|
||||||
} catch (InterruptedException e) {
|
// } catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} finally {
|
// } finally {
|
||||||
bossGroup.shutdownGracefully();
|
// bossGroup.shutdownGracefully();
|
||||||
workerGroup.shutdownGracefully();
|
// workerGroup.shutdownGracefully();
|
||||||
}
|
// }
|
||||||
}).start();
|
// }).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,19 +22,15 @@ public class PqErrSysDtlsParam {
|
|||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差判断起始值", required = true)
|
@ApiModelProperty(value = "误差判断起始值", required = true)
|
||||||
@NotNull(message = DevValidMessage.START_VALUE_NOT_NULL)
|
|
||||||
private Float startValue;
|
private Float startValue;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否包含起始值", required = true)
|
@ApiModelProperty(value = "是否包含起始值", required = true)
|
||||||
@NotNull(message = DevValidMessage.START_FLAG_NOT_NULL)
|
|
||||||
private Integer startFlag;
|
private Integer startFlag;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差判断结束值", required = true)
|
@ApiModelProperty(value = "误差判断结束值", required = true)
|
||||||
@NotNull(message = DevValidMessage.END_VALUE_NOT_NULL)
|
|
||||||
private Float endValue;
|
private Float endValue;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否包含结束值", required = true)
|
@ApiModelProperty(value = "是否包含结束值", required = true)
|
||||||
@NotNull(message = DevValidMessage.END_FLAG_NOT_NULL)
|
|
||||||
private Integer endFlag;
|
private Integer endFlag;
|
||||||
|
|
||||||
// @ApiModelProperty(value = "单位", required = true)
|
// @ApiModelProperty(value = "单位", required = true)
|
||||||
@@ -43,17 +39,14 @@ public class PqErrSysDtlsParam {
|
|||||||
// private String unit;
|
// private String unit;
|
||||||
|
|
||||||
@ApiModelProperty(value = "判断条件值类型", required = true)
|
@ApiModelProperty(value = "判断条件值类型", required = true)
|
||||||
@NotBlank(message = DevValidMessage.CONDITION_TYPE_NOT_BLANK)
|
private Integer conditionType;
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERROR_VALUE_FORMAT_ERROR)
|
|
||||||
private String conditionType;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "最大值误差", required = true)
|
@ApiModelProperty(value = "最大值误差", required = true)
|
||||||
@NotNull(message = DevValidMessage.MAX_ERROR_VALUE_NOT_NULL)
|
@NotNull(message = DevValidMessage.MAX_ERROR_VALUE_NOT_NULL)
|
||||||
private Float maxErrorValue;
|
private Float maxErrorValue;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差值类型", required = true)
|
@ApiModelProperty(value = "误差值类型", required = true)
|
||||||
@NotBlank(message = DevValidMessage.ERROR_VALUE_TYPE_NOT_BLANK)
|
@NotNull(message = DevValidMessage.ERROR_VALUE_TYPE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERROR_VALUE_FORMAT_ERROR)
|
private Integer errorValueType;
|
||||||
private String errorValueType;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class PqErrSysDtls implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 判断条件值类型(包括值类型,绝对值、相对值)
|
* 判断条件值类型(包括值类型,绝对值、相对值)
|
||||||
*/
|
*/
|
||||||
private String conditionType;
|
private Integer conditionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 误差最大值
|
* 误差最大值
|
||||||
@@ -66,7 +66,7 @@ public class PqErrSysDtls implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 误差值类型
|
* 误差值类型
|
||||||
*/
|
*/
|
||||||
private String errorValueType;
|
private Integer errorValueType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,4 +199,6 @@ public interface DevValidMessage {
|
|||||||
String TIMECHECK_NOT_BLANK = "是否做守时检测不能为空";
|
String TIMECHECK_NOT_BLANK = "是否做守时检测不能为空";
|
||||||
|
|
||||||
String FACTOR_FLAG_NOT_BLANK = "是否支持系数校准不能为空";
|
String FACTOR_FLAG_NOT_BLANK = "是否支持系数校准不能为空";
|
||||||
|
|
||||||
|
String CONDITION_TYPE_FORMAT_ERROR = "判断条件类型格式错误,请检查conditionType参数";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user