//package com.tofly.common.websocket;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Timer;
//import java.util.TimerTask;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.alibaba.fastjson.JSON;
//import com.ncse.zhhygis.service.CarAirInterfaceService;
//import com.ncse.zhhygis.utils.MessageUtils;
//
//
//@Configuration
//public class RunWebsocketSendService implements ApplicationRunner{
//	protected  final Logger log = LoggerFactory.getLogger(this.getClass());
//
//
//	Timer timer = new Timer();
//	@Override
//	public void run(ApplicationArguments args) throws Exception {
//		timer.scheduleAtFixedRate(new TimerTask() {
//            public void run() {
//            	try {
//            		log.info("开始推送..");
//            		tjWebSendInfo();
//					log.info("推送结束..");
//				} catch (IOException e) {
//					// TODO Auto-generated catch block
//					e.printStackTrace();
//				}
//			}
//        }, 10000 , 5000);
//
//	}
//
//	public void tjWebSendInfo() throws IOException {
//		List<String> sids=userLoginService.getAirCodes();
//		Map map;
//		String msg;
//		for(String sid:sids) {
//			map = new HashMap();
//			map.put(MessageUtils.INTERFACE_TJ_AIRCOUNT_NAME, JSON.parseObject(carAirInterfaceService.tjAirCount(sid)));
//			map.put(MessageUtils.INTERFACE_TJ_TASKAMCOUNT_NAME, JSON.parseObject(carAirInterfaceService.tjTaskamCount(sid)));
//			map.put(MessageUtils.INTERFACE_TJ_SOULCOUNT_NAME, JSON.parseObject(carAirInterfaceService.tjSoulCount(sid)));
//			map.put(MessageUtils.INTERFACE_TJ_ALOIL_NAME, JSON.parseObject(carAirInterfaceService.tjAlOil(sid)));
//			map.put(MessageUtils.INTERFACE_TJ_VEHISUM_NAME, JSON.parseObject(carAirInterfaceService.tjVehiSum(sid)));
//			msg=JSON.toJSONString(map);
//			WebSocketServer.sendInfo(msg, sid);
//			log.info("推送消息到："+",推送信息为.."+msg);
//		}
//
//	}
//
//	public void carGisDataSend() {
//		List<String> sids=userLoginService.getAirCodes();
//		for(String sid:sids) {
//			//模拟数据
//			String data="{\"airport\":\"KMG\",\"bool_data\":\"\",\"wd\":\"\",\"timeStamp\":\"2018-11-14 15:01:07\",\"termVer\":\"1.0\",\"gd\":\"\",\"hp\":\"001\",\"jd\":\"\",\"num_data\":\"0.0,0.0\",\"stars\":0,\"flag\":0,\"code_param\":0,\"code\":-1}\r\n" +
//					"{\"airport\":\"KMG\",\"bool_data\":\"\",\"wd\":\"\",\"timeStamp\":\"2018-11-14 15:01:10\",\"termVer\":\"1.0\",\"gd\":\"\",\"hp\":\"001\",\"jd\":\"\",\"num_data\":\"0.0,0.0\",\"stars\":0,\"flag\":0,\"code_param\":0,\"code\":-1}";
//		}
//	}
//
//}
