Commit 0493c149 authored by AfirSraftGarrier's avatar AfirSraftGarrier

修改

parent 239c324e
package iot.sixiang.license.consts; package iot.sixiang.license.consts;
public class Consts { public class Constant {
public static final int CMD_LICENSE = 1;// 授权消息的cmd,十进制 public static final int CMD_LICENSE = 1;// 授权消息的cmd,十进制
public static final int CMD_UPLOAD_ERROR = 2;// 错误消息上报
public static final int EXECUTOR_THREAD_NUM = 30; public static final int EXECUTOR_THREAD_NUM = 30;
public static final int FORWARD_THREAD_NUM = 30; public static final int FORWARD_THREAD_NUM = 30;
public static final int OPERATE_THREAD_NUM = 5; public static final int OPERATE_THREAD_NUM = 5;
......
...@@ -4,7 +4,7 @@ import io.netty.channel.socket.SocketChannel; ...@@ -4,7 +4,7 @@ import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler; import io.netty.handler.timeout.IdleStateHandler;
import io.netty.util.concurrent.DefaultEventExecutorGroup; import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup; import io.netty.util.concurrent.EventExecutorGroup;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import iot.sixiang.license.net.BaseChannelInitializer; import iot.sixiang.license.net.BaseChannelInitializer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit; ...@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
public class DeviceChannelInitializer extends BaseChannelInitializer { public class DeviceChannelInitializer extends BaseChannelInitializer {
private DeviceServerHandler handler; private DeviceServerHandler handler;
static final EventExecutorGroup workGroup = new DefaultEventExecutorGroup(Consts.EXECUTOR_THREAD_NUM); static final EventExecutorGroup workGroup = new DefaultEventExecutorGroup(Constant.EXECUTOR_THREAD_NUM);
public DeviceChannelInitializer(DeviceServerHandler handler) { public DeviceChannelInitializer(DeviceServerHandler handler) {
this.handler = handler; this.handler = handler;
......
package iot.sixiang.license.device; package iot.sixiang.license.device;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
import iot.sixiang.license.model.SessionContext; import iot.sixiang.license.model.SessionContext;
import iot.sixiang.license.model.vo.DeviceDetailVo; import iot.sixiang.license.model.vo.DeviceDetailVo;
...@@ -142,7 +142,7 @@ public class DeviceManager { ...@@ -142,7 +142,7 @@ public class DeviceManager {
if (targetSession.getChannelId().equals(channelId)) { if (targetSession.getChannelId().equals(channelId)) {
targetSession.setAuthStatus(false); targetSession.setAuthStatus(false);
targetSession.setStatus(Consts.DEVICE_STATE_OFFLINE); targetSession.setStatus(Constant.DEVICE_STATE_OFFLINE);
targetSession.setOffline(CommonUtil.getSystemTime()); targetSession.setOffline(CommonUtil.getSystemTime());
return true; return true;
} }
......
...@@ -7,7 +7,7 @@ import io.netty.channel.ChannelHandlerContext; ...@@ -7,7 +7,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import iot.sixiang.license.auth.AuthManager; import iot.sixiang.license.auth.AuthManager;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import iot.sixiang.license.event.CreateForwardClientEvent; import iot.sixiang.license.event.CreateForwardClientEvent;
import iot.sixiang.license.event.DeviceClientInactiveEvent; import iot.sixiang.license.event.DeviceClientInactiveEvent;
import iot.sixiang.license.event.EventPublisher; import iot.sixiang.license.event.EventPublisher;
...@@ -55,7 +55,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> { ...@@ -55,7 +55,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
int cmdInt = cmd & 0xFF; int cmdInt = cmd & 0xFF;
boolean auth = false; boolean auth = false;
if (cmdInt == Consts.CMD_LICENSE) { if (cmdInt == Constant.CMD_LICENSE) {
auth = handlerCheckAuth(channel, remoteIp, remotePort, protocol); auth = handlerCheckAuth(channel, remoteIp, remotePort, protocol);
} else { } else {
auth = handlerCheckAuthStatus(channel, remoteIp, remotePort, protocol); auth = handlerCheckAuthStatus(channel, remoteIp, remotePort, protocol);
...@@ -147,7 +147,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> { ...@@ -147,7 +147,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
session.setChannelId(channelId); session.setChannelId(channelId);
session.setClientChannel(channel); session.setClientChannel(channel);
session.setAuthStatus(true); session.setAuthStatus(true);
session.setStatus(Consts.DEVICE_STATE_ONLINE); session.setStatus(Constant.DEVICE_STATE_ONLINE);
session.setOnline(CommonUtil.getSystemTime()); session.setOnline(CommonUtil.getSystemTime());
DeviceManager deviceManager = SpringUtil.getBean(DeviceManager.class); DeviceManager deviceManager = SpringUtil.getBean(DeviceManager.class);
......
...@@ -3,13 +3,13 @@ package iot.sixiang.license.forward; ...@@ -3,13 +3,13 @@ package iot.sixiang.license.forward;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import io.netty.util.concurrent.DefaultEventExecutorGroup; import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup; import io.netty.util.concurrent.EventExecutorGroup;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import iot.sixiang.license.net.BaseChannelInitializer; import iot.sixiang.license.net.BaseChannelInitializer;
public class ForwardChannelInitializer extends BaseChannelInitializer { public class ForwardChannelInitializer extends BaseChannelInitializer {
private ForwardClientHandler handler; private ForwardClientHandler handler;
static final EventExecutorGroup workGroup = new DefaultEventExecutorGroup(Consts.FORWARD_THREAD_NUM); static final EventExecutorGroup workGroup = new DefaultEventExecutorGroup(Constant.FORWARD_THREAD_NUM);
public ForwardChannelInitializer(ForwardClientHandler handler) { public ForwardChannelInitializer(ForwardClientHandler handler) {
this.handler = handler; this.handler = handler;
......
package iot.sixiang.license.forward; package iot.sixiang.license.forward;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import iot.sixiang.license.model.SessionContext; import iot.sixiang.license.model.SessionContext;
import iot.sixiang.license.model.vo.ServerStatusVo; import iot.sixiang.license.model.vo.ServerStatusVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -67,11 +67,11 @@ public class ForwardManager { ...@@ -67,11 +67,11 @@ public class ForwardManager {
public ServerStatusVo getServerStatus() { public ServerStatusVo getServerStatus() {
ServerStatusVo vo = new ServerStatusVo(); ServerStatusVo vo = new ServerStatusVo();
int size = sessionContexts.size(); int size = sessionContexts.size();
int statue = Consts.SERVICE_DX_STATUS_FLUENT; int statue = Constant.SERVICE_DX_STATUS_FLUENT;
if (size >= Consts.SERVICE_DX_THRESHOLD_NORMAL) { if (size >= Constant.SERVICE_DX_THRESHOLD_NORMAL) {
statue = Consts.SERVICE_DX_STATUS_NORMAL; statue = Constant.SERVICE_DX_STATUS_NORMAL;
} else if (size > Consts.SERVICE_DX_THRESHOLD_BUSY) { } else if (size > Constant.SERVICE_DX_THRESHOLD_BUSY) {
statue = Consts.SERVICE_DX_STATUS_BUSY; statue = Constant.SERVICE_DX_STATUS_BUSY;
} }
vo.setCount(size); vo.setCount(size);
vo.setStatus(statue); vo.setStatus(statue);
......
...@@ -3,14 +3,14 @@ package iot.sixiang.license.operate; ...@@ -3,14 +3,14 @@ package iot.sixiang.license.operate;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import io.netty.util.concurrent.DefaultEventExecutorGroup; import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup; import io.netty.util.concurrent.EventExecutorGroup;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import iot.sixiang.license.net.BaseChannelInitializer; import iot.sixiang.license.net.BaseChannelInitializer;
public class OperateChannelInitializer extends BaseChannelInitializer { public class OperateChannelInitializer extends BaseChannelInitializer {
private OperateClientHandler handler; private OperateClientHandler handler;
static final EventExecutorGroup workGroup = new DefaultEventExecutorGroup(Consts.OPERATE_THREAD_NUM); static final EventExecutorGroup workGroup = new DefaultEventExecutorGroup(Constant.OPERATE_THREAD_NUM);
public OperateChannelInitializer(OperateClientHandler handler) { public OperateChannelInitializer(OperateClientHandler handler) {
this.handler = handler; this.handler = handler;
......
package iot.sixiang.license.util; package iot.sixiang.license.util;
import iot.sixiang.license.consts.Consts; import iot.sixiang.license.consts.Constant;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.system.ApplicationHome; import org.springframework.boot.system.ApplicationHome;
...@@ -79,7 +79,7 @@ public class CommonUtil { ...@@ -79,7 +79,7 @@ public class CommonUtil {
} }
public static String getServerParentDirectory() { public static String getServerParentDirectory() {
return new File(new ApplicationHome(Consts.class).getSource().getParentFile().getPath()).getParent(); return new File(new ApplicationHome(Constant.class).getSource().getParentFile().getPath()).getParent();
} }
public static String getLibFilePathByFileName(String fileName) { public static String getLibFilePathByFileName(String fileName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment