Bladeren bron

初始化

lgy 4 jaren geleden
bovenliggende
commit
923afafdf9

+ 11 - 0
pom.xml

@@ -47,6 +47,17 @@
             <version>1.0-SNAPSHOT</version>
         </dependency>
         <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!-- 数学逻辑运算解析库-->
+        <dependency>
+            <groupId>org.mariuszgromada.math</groupId>
+            <artifactId>MathParser.org-mXparser</artifactId>
+            <version>4.4.0</version>
+        </dependency>
+        <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>

+ 1 - 1
src/main/java/com/persagy/ZktProjectAlarmApplication.java

@@ -1,4 +1,4 @@
-package com.persagy.zktprojectalarm;
+package com.persagy;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;

+ 0 - 149
src/main/java/com/persagy/client/GroupNettyClient.java

@@ -1,149 +0,0 @@
-package com.persagy.commons.netty.client;
-
-import com.persagy.service.CommandService;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelFutureListener;
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
-import io.netty.handler.codec.LengthFieldPrepender;
-import io.netty.handler.codec.string.StringDecoder;
-import io.netty.handler.codec.string.StringEncoder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author lqshi
- * @ClassName: NettyClient
- * @Description: netty启动、发送消息等
- * @date 2020年8月31日 上午10:34:45
- */
-@Service
-public class GroupNettyClient {
-    @Autowired
-    CommandService commandService;
-
-    static Bootstrap groupBootstrap = new Bootstrap();
-    static Channel channelGroup;
-//    static Bootstrap terminalBootstrap = new Bootstrap();
-//    static final String HOST = System.getProperty("host", "127.0.0.1");
-    static final String HOST = System.getProperty("host", "192.168.3.4");
-    static final int PORT = Integer.parseInt(System.getProperty("port", "8081"));
-
-//    static final String TERMINAL_HOST = System.getProperty("host", "192.168.3.6");
-//    static final String TERMINAL_HOST = System.getProperty("host", "192.168.3.33");
-//    static final int TERMINAL_PORT = Integer.parseInt(System.getProperty("port", "8082"));
-//
-    //会话对象组
-    public static Map<String, Channel> channelsMap = new ConcurrentHashMap<>();
-
-    /**
-     * @Title: start
-     * @Description: 启动netty服务端
-     */
-    public void start() {
-        try {
-            // 启动辅助对象类
-            groupBootstrap.group(new NioEventLoopGroup())
-                    // 建立通道
-                    .channel(NioSocketChannel.class)
-                    // 初始化通道及进行配置
-                    .handler(new ChannelInitializer<SocketChannel>() {
-                        @Override
-                        protected void initChannel(SocketChannel ch) throws Exception {
-                            ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
-                            ch.pipeline().addLast(new LengthFieldPrepender(4));
-                            // 将分隔之后的字节数据转换为字符串
-                            ch.pipeline().addLast(new StringDecoder());
-                            ch.pipeline().addLast(new StringEncoder());
-                            // pipeline可以理解为所有handler的初始化容器
-                            ch.pipeline().addLast(new GroupNettyClientHandler(commandService));// 添加自定义handler
-                        }
-                    });
-
-//            terminalBootstrap.group(new NioEventLoopGroup())
-//                    // 建立通道
-//                    .channel(NioSocketChannel.class)
-//                    // 初始化通道及进行配置
-//                    .handler(new ChannelInitializer<SocketChannel>() {
-//                        @Override
-//                        protected void initChannel(SocketChannel ch) throws Exception {
-//                            // 将分隔之后的字节数据转换为字符串
-////                            ch.pipeline().addLast(new StringDecoder());
-////                            ch.pipeline().addLast(new StringEncoder());
-//                            // pipeline可以理解为所有handler的初始化容器
-//                            ch.pipeline().addLast(new NettyClientHandler(commandService));// 添加自定义handler
-//                        }
-//                    });
-            // 代表I/O操作的异步结果
-            // 连接远程节点,等待连接完成
-            // channel = b.connect().sync();//
-            // sync()代表同步等待连接,然后在f.channel().closeFuture().sync();,如果不加就不会等待,直接关闭
-
-                channelGroup = groupBootstrap.connect(HOST, PORT).channel();
-                channelsMap.put("group",channelGroup);
-
-//                Channel channelterminal = terminalBootstrap.connect(TERMINAL_HOST, TERMINAL_PORT).channel();
-//                channelsMap.put("terminal",channelterminal);
-
-
-          /*  System.out.println("-----客户端closeFuture前----");
-            channelFuture.channel().closeFuture().sync();
-            System.out.println("-----客户端closeFuture后----");*/
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            // 关闭主线程组
-            //回收group后下面的自动重连connect()无法直接使用
-            //group.shutdownGracefully();
-
-        }
-    }
-
-    static void connect(Channel channel) {
-        // 加入断线后自动重连监听器
-        System.out.println("try connect!");
-        for (Map.Entry<String, Channel> entry:channelsMap.entrySet()) {
-            if(entry.getValue() == channel && !channel.isActive()){
-                channelGroup = groupBootstrap.connect(HOST, PORT).addListener(new ChannelFutureListener() {
-                    @Override
-                    public void operationComplete(ChannelFuture future) throws Exception {
-                        if (future.cause() != null) {
-                            System.out.println("Failed to connect: " + future.cause());
-                        }
-                    }
-                }).channel();
-                channelsMap.put(entry.getKey(),channelGroup);
-            }
-        }
-    }
-
-    /**
-     * @param msg
-     * @Title: sendMessage
-     * @Description: 发送消息
-     */
-/*    public void sendMessage(Object msg,String type) {
-        for (Map.Entry<String, Channel> ch:channelsMap.entrySet() ) {
-            if(type.equals(ch.getKey())) {
-                System.out.println(msg);
-                System.out.println(ch.getKey());
-                ch.getValue().writeAndFlush(msg);
-            }else {
-                System.out.println("----to group --");
-                ch.getValue().writeAndFlush(msg);
-            }
-        }
-    }*/
-    public void sendMessage(Object msg) {
-        channelGroup.writeAndFlush(msg);
-    }
-
-}

+ 0 - 174
src/main/java/com/persagy/client/GroupNettyClientHandler.java

@@ -1,174 +0,0 @@
-package com.persagy.commons.netty.client;
-
-import cn.hutool.core.date.DateField;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import com.persagy.entity.CommandResult;
-import com.persagy.entity.NettyMessage;
-import com.persagy.service.CommandService;
-import com.persagy.utils.DateUtils;
-import com.persagy.utils.StringUtil;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelInboundHandlerAdapter;
-import io.netty.handler.timeout.IdleState;
-import io.netty.handler.timeout.IdleStateEvent;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.quartz.JobDataMap;
-import org.quartz.SchedulerException;
-import org.springframework.util.CollectionUtils;
-
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @ClassName: EchoClientHandler
- * @Description: 客户端处理类
- * @author lqshi
- * @date 2020年8月29日 下午8:31:59
- */
-// 注意:SimpleChannelInboundHandler<ByteBuf>的<>中是什么,channelRead0第二参数是什么
-@Slf4j
-public class GroupNettyClientHandler extends ChannelInboundHandlerAdapter {
-    // Sleep 5 seconds before a reconnection attempt.
-    static final int RECONNECT_DELAY = Integer.parseInt(System.getProperty("reconnectDelay", "5"));
-    // Reconnect when the server sends nothing for 10 seconds.
-    private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("readTimeout", "10"));
-
-   private CommandService commandService;
-
-    public GroupNettyClientHandler(CommandService commandService) {
-        this.commandService = commandService;
-    }
-
-    public GroupNettyClientHandler() {
-    }
-
-    @Override
-    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
-
-        if (!(evt instanceof IdleStateEvent)) {
-            return;
-        }
-        IdleStateEvent e = (IdleStateEvent) evt;
-        if (e.state() == IdleState.READER_IDLE) {
-            System.out.println("no inbound traffic");
-            // The connection was OK but there was no traffic for last period.
-            // 长时间不操作的时候自动关闭连接; ctx.close();
-        }
-    }
-	 /**
-     * 在到服务器的连接已经建立之后将被调用
-     * @param ctx
-     * @throws Exception
-     */
-    @Override
-    public void channelActive(ChannelHandlerContext ctx) throws Exception {
-        System.out.println("Connected to: " + ctx.channel().remoteAddress());
-        //启动的时候发送消息
-       NettyMessage msg = new NettyMessage();
-        msg.setOpCode(3);
-        ctx.channel().writeAndFlush(msg.toString());
-    }
-    /**
-     * 当从服务器接收到一个消息时被调用
-     * @param ctx
-     * @param msg
-     * @throws Exception
-     */
-    @Override
-    public  void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
-        System.out.println("Client received: "+ msg);
-        try {
-            handlerMsg(ctx, msg);
-        } catch (Exception e) {
-            log.error("channelRead",e);
-        }
-    }
-
-    private void handlerMsg(ChannelHandlerContext channelHandlerContext, Object msg) throws Exception {
-        if(StringUtil.isJSONObject((String) msg)) {
-            NettyMessage message = StringUtil.tranferItemToDTO((String) msg, NettyMessage.class);
-            NettyMessage response = new NettyMessage();
-            response.setStreamId(message.getStreamId());
-            response.setSuccess(true);
-            response.setOpCode(2);
-            List<CommandResult> responseContent = new ArrayList<>();
-            List<CommandResult> content = message.getContent();
-            //删除这个时间点之后的所有工作内容
-            String timeFlag = message.getClearBeforeTimeFlag();
-            if(! CollectionUtils.isEmpty(content)){
-                if(StringUtils.isNotBlank(timeFlag)) {
-                    LocalDateTime timeFlagDateTime = DateUtils.parse(timeFlag);
-                    Date endDate = DateUtils.localDateTime2Date(LocalDateTime.now().minusHours(48));
-                    List<DateTime> dateTimes = DateUtil.rangeToList(new Date(), endDate, DateField.HOUR);
-                    for (DateTime dateTime : dateTimes) {
-                        System.out.println(dateTime);
-                    }
-                }
-                for (CommandResult command:content){
-                    CommandResult tmpNewcommand = new CommandResult();
-                    tmpNewcommand.setId(command.getId());
-                    tmpNewcommand.setCommandResult(0);
-                    responseContent.add(tmpNewcommand);
-                    LocalDateTime commandTime = DateUtils.parse(command.getCommandTime(), DateUtils.date_format_show_minute);
-                    Date startTime = DateUtils.localDateTime2Date(commandTime);
-                    String hour = DateUtils.format(commandTime, DateUtils.sdfHour);
-                    String jobName = command.getFuncId()+"_"+command.getMeterId()+DateUtils.format(commandTime);
-                    JobDataMap jobDataMap = new JobDataMap();
-                    jobDataMap.put("commandResult",command.toString());
-                    try {
-                        commandService.addCommand(startTime,jobName,hour,jobDataMap);
-                    } catch (SchedulerException e) {
-                        log.error("addCommand error: ",e);
-                    }
-
-                }
-            }
-            response.setContent(responseContent);
-            System.out.println(message.toString());
-            channelHandlerContext.write(response.toString());
-        }
-    }
-
-    @Override
-    public void channelReadComplete(ChannelHandlerContext ctx) {
-        ctx.flush();
-    }
-
-    /**
-     * 在处理过程中引发异常时被调用
-     * @param ctx
-     * @param cause
-     * @throws Exception
-     */
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
-        cause.printStackTrace();
-        ctx.close();
-    }
-    
-    /**
-     * 通道处于非活跃状态动作,该方法只会在失效时调用一次
-     */
-    @Override
-    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
-    	//客户端自己不正常情况下自己在重连一次
-        System.out.println("Disconnected from: " + ctx.channel().remoteAddress());
-
-    }
-    @Override
-    public void channelUnregistered(final ChannelHandlerContext ctx) throws Exception {
-        System.out.println("Sleeping for: " + RECONNECT_DELAY + "s,Reconnecting to: " + GroupNettyClient.HOST + ':' + GroupNettyClient.PORT);
-        ctx.channel().eventLoop().schedule(new Runnable() {
-            @Override
-            public void run() {
-                System.out.println("Reconnecting to: " + GroupNettyClient.HOST + ':' + GroupNettyClient.PORT);
-                GroupNettyClient.connect(ctx.channel());
-            }
-        }, RECONNECT_DELAY, TimeUnit.SECONDS);
-    }
-}

+ 0 - 101
src/main/java/com/persagy/client/TerminalClient.java

@@ -1,101 +0,0 @@
-/*
- * Copyright 2012 The Netty Project
- *
- * The Netty Project licenses this file to you under the Apache License,
- * version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at:
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-package com.persagy.commons.netty.client;
-
-import com.persagy.commons.netty.client.dispatcher.OperationResultFuture;
-import com.persagy.commons.netty.client.dispatcher.RequestPendingCenter;
-import com.persagy.commons.netty.client.dispatcher.ResponseDispatcherHandler;
-import com.persagy.qotm.TerminalServer;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.buffer.Unpooled;
-import io.netty.channel.*;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.DatagramPacket;
-import io.netty.channel.socket.nio.NioDatagramChannel;
-import io.netty.util.CharsetUtil;
-import io.netty.util.internal.SocketUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * A UDP broadcast client that asks for a quote of the moment (QOTM) to {@link TerminalServer}.
- *
- * Inspired by <a href="http://docs.oracle.com/javase/tutorial/networking/datagrams/clientServer.html">the official
- * Java tutorial</a>.
- */
-@Service
-public final class TerminalClient {
-
-    @Autowired
-    GroupNettyClient groupNettyClient;
-    static final String TERMINAL_HOST = System.getProperty("host", "192.168.3.6");
-//    static final String TERMINAL_HOST = System.getProperty("host", "192.168.3.33");
-    static final int TERMINAL_PORT = Integer.parseInt(System.getProperty("port", "8082"));
-    Channel ch;
-    RequestPendingCenter requestPendingCenter;
-    public void start() throws Exception {
-
-        EventLoopGroup group = new NioEventLoopGroup();
-        try {
-            Bootstrap b = new Bootstrap();
-            requestPendingCenter = new RequestPendingCenter();
-            b.group(group)
-             .channel(NioDatagramChannel.class)
-             .option(ChannelOption.SO_BROADCAST, true)
-             .handler(new ChannelInitializer<NioDatagramChannel>() {
-                 @Override
-                protected void initChannel(NioDatagramChannel ch)throws Exception {
-                    ChannelPipeline pipeline = ch.pipeline();
-                     //	    pipeline.addLast(new StringDecoder(ASCII))
-                     //      .addLast(new StringEncoder(ASCII))
-                     pipeline.addLast(new ResponseDispatcherHandler(requestPendingCenter));
-                     pipeline.addLast(new TerminalClientHandler(groupNettyClient));
-                 }});
-
-                ch = b.bind(0).sync().channel();
-            sendMessage("echo !");
-            ch.closeFuture().await();
-        } finally {
-//            group.shutdownGracefully();
-        }
-    }
-    /**
-     * @description:TODO
-     * @exception:
-     * @author: LuoGuangyi
-     * @company: Persagy Technology Co.,Ltd
-     * @param msg: 例如:"1101050029;1;pointset;20200919180200;706;ACATAH_1_EquipSwitchSet;903;1"
-     * @return: void
-     * @since: 2020/09/20 15:30
-     * @version: V1.0
-     */
-    public void sendMessage(String msg) throws Exception {
-        //1101050029;1;pointset;20200919180200;706;ACATAH_1_EquipSwitchSet;903;1
-        String[] split = msg.split(";");
-        if(split.length>=8) {
-            OperationResultFuture operationResultFuture = new OperationResultFuture();
-            requestPendingCenter.add(split[4], operationResultFuture);
-            ch.writeAndFlush(new DatagramPacket(
-                    Unpooled.copiedBuffer(msg, CharsetUtil.UTF_8),
-                    SocketUtils.socketAddress(TERMINAL_HOST, TERMINAL_PORT))).sync();
-//            String operationResult = operationResultFuture.get(3, TimeUnit.SECONDS);
-//            System.out.println("结果为:"+operationResult);
-        }
-
-        }
-    
-
-}

+ 0 - 67
src/main/java/com/persagy/client/TerminalClientHandler.java

@@ -1,67 +0,0 @@
-/*
- * Copyright 2012 The Netty Project
- *
- * The Netty Project licenses this file to you under the Apache License,
- * version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at:
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-package com.persagy.commons.netty.client;
-
-import com.persagy.entity.CommandResult;
-import com.persagy.entity.NettyMessage;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.channel.socket.DatagramPacket;
-import io.netty.util.CharsetUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Collections;
-@Slf4j
-public class TerminalClientHandler extends SimpleChannelInboundHandler<DatagramPacket> {
-
-    private GroupNettyClient groupNettyClient;
-
-    public TerminalClientHandler(GroupNettyClient groupNettyClient) {
-        this.groupNettyClient = groupNettyClient;
-    }
-
-    @Override
-    public void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
-        try {
-            handlerMessage(msg);
-        } catch (Exception e) {
-           log.error("handlerMessage error:",e);
-        }
-    }
-
-    private void handlerMessage(DatagramPacket msg) {
-        String response = msg.content().toString(CharsetUtil.UTF_8);
-        String[] split = response.split(";");
-
-        System.out.println(response);
-        CommandResult command = new CommandResult();
-        if(StringUtils.isNotBlank(split[9]) && split[9].contains("success")){
-            command.setCommandResult(2);
-        }
-        command.setId(split[4]);
-        NettyMessage message = new NettyMessage();
-        message.setContent(Collections.singletonList(command));
-        message.setOpCode(2);
-        groupNettyClient.sendMessage(message.toString());
-    }
-
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-        cause.printStackTrace();
-        ctx.close();
-    }
-}

+ 0 - 6
src/main/java/com/persagy/client/dispatcher/OperationResultFuture.java

@@ -1,6 +0,0 @@
-package com.persagy.commons.netty.client.dispatcher;
-
-import io.netty.util.concurrent.DefaultPromise;
-
-public class OperationResultFuture extends DefaultPromise<String> {
-}

+ 0 - 23
src/main/java/com/persagy/client/dispatcher/RequestPendingCenter.java

@@ -1,23 +0,0 @@
-package com.persagy.commons.netty.client.dispatcher;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class RequestPendingCenter {
-
-    private Map<String, OperationResultFuture> map = new ConcurrentHashMap<>();
-
-    public void add(String streamId, OperationResultFuture future) {
-        this.map.put(streamId, future);
-    }
-
-    public void set(String streamId, String nettyMessage) {
-        OperationResultFuture operationResultFuture = this.map.get(streamId);
-        if (operationResultFuture != null) {
-            operationResultFuture.setSuccess(nettyMessage);
-            //this.map.remove(streamId);
-        }
-    }
-
-
-}

+ 0 - 31
src/main/java/com/persagy/client/dispatcher/ResponseDispatcherHandler.java

@@ -1,31 +0,0 @@
-package com.persagy.commons.netty.client.dispatcher;
-
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelInboundHandlerAdapter;
-import io.netty.channel.SimpleChannelInboundHandler;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class ResponseDispatcherHandler extends ChannelInboundHandlerAdapter {
-
-    private RequestPendingCenter requestPendingCenter;
-
-    public ResponseDispatcherHandler(RequestPendingCenter requestPendingCenter) {
-        this.requestPendingCenter = requestPendingCenter;
-    }
-
-    @Override
-    public void channelRead(ChannelHandlerContext ctx, Object responseMessage) throws Exception {
-        //1101050029;1;pointsetack;20200921112016;780;ACATAH_2_EquipSwitchSet;903;0.0;20200921112020;success
-        String[] split = responseMessage.toString().split(";");
-        if(split.length == 9 && "pointsetack".equals(split[2])) {
-            requestPendingCenter.set(split[4], responseMessage.toString());
-        }
-        ctx.fireChannelRead(responseMessage);
-    }
-
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-       log.error("ResponseDispatcherHandler error!",cause);
-    }
-}

+ 48 - 48
src/main/java/com/persagy/controller/TestController.java

@@ -1,48 +1,48 @@
-package com.persagy.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.commons.netty.client.GroupNettyClient;
-import com.persagy.commons.netty.client.TerminalClient;
-import com.persagy.service.SimpleSchedule;
-import org.quartz.SchedulerException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class TestController {
-
-	
-	@Autowired
-	private GroupNettyClient groupNettyClient;
-	@Autowired
-	SimpleSchedule simpleSchedule;
-	@Autowired
-	private TerminalClient terminalClient;
-
-	@RequestMapping("/test1")
-	public String test1 () throws SchedulerException {
-		for (int i = 0; i < 10; i++) {
-			simpleSchedule.init();
-		}
-		return "su";
-	}
-	
-	@RequestMapping("/test2")
-	public String test2 (@RequestBody JSONObject msg) {
-//		JSONObject a = new JSONObject();
-//		a.put("type","request");
-//		a.put("function","ddd");
-
-		groupNettyClient.sendMessage(msg.getString("msg"));
-		return null;
-	}
-
-	@RequestMapping("/test3")
-	public String test3 (@RequestBody JSONObject msg) throws Exception {
-		terminalClient.sendMessage(msg.getString("msg"));
-		return "success";
-	}
-
-}
+//package com.persagy.controller;
+//
+//import com.alibaba.fastjson.JSONObject;
+//import com.persagy.commons.netty.client.GroupNettyClient;
+//import com.persagy.commons.netty.client.TerminalClient;
+//import com.persagy.service.SimpleSchedule;
+//import org.quartz.SchedulerException;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.RequestBody;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RestController;
+//
+//@RestController
+//public class TestController {
+//
+//
+//	@Autowired
+//	private GroupNettyClient groupNettyClient;
+//	@Autowired
+//	SimpleSchedule simpleSchedule;
+//	@Autowired
+//	private TerminalClient terminalClient;
+//
+//	@RequestMapping("/test1")
+//	public String test1 () throws SchedulerException {
+//		for (int i = 0; i < 10; i++) {
+//			simpleSchedule.init();
+//		}
+//		return "su";
+//	}
+//
+//	@RequestMapping("/test2")
+//	public String test2 (@RequestBody JSONObject msg) {
+////		JSONObject a = new JSONObject();
+////		a.put("type","request");
+////		a.put("function","ddd");
+//
+//		groupNettyClient.sendMessage(msg.getString("msg"));
+//		return null;
+//	}
+//
+//	@RequestMapping("/test3")
+//	public String test3 (@RequestBody JSONObject msg) throws Exception {
+//		terminalClient.sendMessage(msg.getString("msg"));
+//		return "success";
+//	}
+//
+//}

+ 8 - 14
src/main/java/com/persagy/init/InitRunner.java

@@ -1,10 +1,7 @@
 package com.persagy.init;
 
-import com.persagy.commons.netty.client.GroupNettyClient;
-import com.persagy.commons.netty.client.TerminalClient;
+
 import lombok.extern.slf4j.Slf4j;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.CommandLineRunner;
@@ -18,19 +15,16 @@ import org.springframework.stereotype.Service;
 public class InitRunner implements CommandLineRunner {
 
 
-	@Autowired
-	private GroupNettyClient groupNettyClient;
-
-	@Autowired
-	private TerminalClient terminalClient;
-	@Autowired
-	@Qualifier("quartzScheduler")
-	Scheduler quartzScheduler;
+//	@Autowired
+//	private GroupNettyClient groupNettyClient;
+//
+//	@Autowired
+//	private TerminalClient terminalClient;
 
 
 	@Override
 	public void run(String... args) throws Exception {
-		groupNettyClient.start();
-		terminalClient.start();
+//		groupNettyClient.start();
+//		terminalClient.start();
 	}
 }

+ 1 - 1
src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8891
+  port: 9984
 spring:
   # 应用名称
   application: