/**
 * Copyright
 * All right reserved.
 * 项目名称:
 * 创建日期:2022/5/22
 */
package org.springblade.modules.business.home;


import lombok.extern.slf4j.Slf4j;
import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
import org.springblade.modules.baseinfo.rtu.service.IRtuBaseInfoService;
import org.springblade.modules.business.check.order.service.IRtuCheckOrderService;
import org.springblade.modules.business.warning.service.IRtuWarningService;
import org.springblade.modules.system.service.IDeptService;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.messaging.simp.SimpMessagingTemplate;


import java.util.Date;
import java.util.concurrent.Callable;

/***
 * Date:2022/5/22
 * Title: 环境辐射与气象监测系统(KRS) 模块
 * Description：MODBUS TCP 协议传输 ,读取任务
 * @author swp
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@Slf4j
public class HomeInfoCountTask implements Callable<Integer> {

	private RedisTemplate redisTemplate;
	private IRtuBaseInfoService rtuBaseInfoService;
	private IRtuWarningService rtuWarningService;
	private SimpMessagingTemplate messagingTemplate;
	private IRtuCheckOrderService checkOrderService;
	private IDeptService deptService;
	private IDeptRegionService deptRegionService;

	public HomeInfoCountTask(RedisTemplate redisTemplate, SimpMessagingTemplate messagingTemplate, IRtuBaseInfoService rtuBaseInfoService, IRtuWarningService rtuWarningService,
							 IRtuCheckOrderService checkOrderService,
							 IDeptService deptService,
							 IDeptRegionService deptRegionService) {
		this.redisTemplate = redisTemplate;
		this.rtuBaseInfoService = rtuBaseInfoService;
		this.rtuWarningService = rtuWarningService;
		this.messagingTemplate = messagingTemplate;
		this.checkOrderService = checkOrderService;
		this.deptService = deptService;
		this.deptRegionService = deptRegionService;
	}

	@Override
	public Integer call() throws Exception {
		try {
			Date startTm = new Date();
			//messagingTemplate.convertAndSend("real_data_info", info.toJSONString());
			Date endTime = new Date();
			log.info("实时数据统计任务结束 用时：{} 毫秒", (endTime.getTime() - startTm.getTime()));
		} catch (
			Exception e) {
			log.error("实时数据统计任务异常 {}", e.getMessage());
		}
		return 0;
	}
}
