package com.ruoyi.job.task;

import com.usky.cdi.AlarmDataSyncTaskService;
import com.usky.cdi.RemotecdiTaskService;
import com.usky.common.core.utils.StringUtils;
import com.usky.eg.RemoteEgService;
import com.usky.fire.RemotePlanSonService;
import com.usky.meeting.RemoteMeetingService;
import com.usky.ems.RemoteEmsTaskService;
import com.usky.vpp.RemoteVppTaskService;
import com.usky.fire.RemoteFireService;
import com.usky.iot.RemoteIotTaskService;
import com.usky.pm.RemotePmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 *
 * @author ruoyi
 */
@Component("ryTask")
public class RyTask {
    @Autowired
    private RemoteFireService remoteFireService;

    @Autowired
    private RemotePmService remotePmService;

    @Autowired
    private RemoteIotTaskService remoteIotTaskService;

    @Autowired
    private RemoteMeetingService remoteMeetingService;

    @Autowired
    private RemotecdiTaskService remoteCdiTaskService;

    @Autowired
    private AlarmDataSyncTaskService alarmDataSyncTaskService;

    @Autowired
    private RemoteEmsTaskService remoteEmsTaskService;

    @Autowired
    private RemoteEgService remoteEgService;

    @Autowired
    private RemotePlanSonService remotePlanSonService;

    @Autowired
    private RemoteVppTaskService remoteVppTaskService;


    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params) {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams() {
        System.out.println("执行无参方法");
    }

    public void addPatrolInspectionAbnormalData() {
        remoteFireService.addPatrolInspectionAbnormalData();
        System.out.println("addPatrolInspectionAbnormalData");
    }

    // 工作报告定时发送
    public void executeTimedSending() {
        System.out.println("executeTimedSending start........");
        remotePmService.executeTimedSending();
    }

    public void dataOverviewJobData() {
        System.out.println("dataOverviewJobData start......");
        remoteIotTaskService.dataOverviewJobData();
    }

    public void deviceStatus() {
        System.out.println("deviceStatus start......");
        remoteIotTaskService.deviceStatus();
    }

    public void deviceOffLineAlarm() {
        System.out.println("deviceOffLineAlarm start......");
        remoteIotTaskService.deviceOffLineAlarm();
    }

    public void customInfoStatus() {
        System.out.println("customInfoStatus start......");
        remoteIotTaskService.customInfoStatus();
    }

    public void meetingInfoStatus() {
        System.out.println("meetingInfoStatus start......");
        remoteMeetingService.meetingInfoStatus();
    }

    // 报告提交提醒
    public void reportSubmissionReminder() {
        System.out.println("reportSubmissionReminder start......");
        remotePmService.reportSubmissionReminder();
    }

    public void synchronizeDeviceData(Integer tenantId, Long engineeringId, String username, String password) {
        System.out.println("租户： " + tenantId + "的人防监测数据推送定时任务开始执行......");
        remoteCdiTaskService.synchronizeDeviceData(tenantId, engineeringId, username, password);
    }

    public void allData(Long engineeringId, String username, String password) {
        System.out.println("人防监测数据推送定时任务开始执行......");
        remoteCdiTaskService.allData(engineeringId, username, password);
    }

    public void synchronizeAlarmData(Integer tenantId, Long engineeringId, String username, String password, String status) {
        System.out.println("人防告警数据推送定时任务开始执行......");
        alarmDataSyncTaskService.synchronizeAlarmData(tenantId, engineeringId, username, password, status);
    }

    // 推送设备数据到能耗平台
    public void sendEnergyData(){
        System.out.println("sendEnergyData start......");
        remoteEmsTaskService.sendEnergyData();
    }

    // 推送设备心跳到能耗平台
    public void sendEnergyHeartbeat(){
        System.out.println("sendEnergyHeartbeat start......");
        remoteEmsTaskService.sendEnergyHeartbeat();
    }

    // 门禁设备心跳状态
    public void egDeviceStatus() {
        System.out.println("egDeviceStatus start......");
        remoteEgService.egDeviceStatus();
    }

    // 创建巡检子计划
    public void addPlanSon(){
        System.out.println(Thread.currentThread().getName() + "巡检计划分批次创建执行中");
        remotePlanSonService.addPlanSon();
    }

    // 刷新站点平均完成率
    public void refreshSiteAvgCompletionRate() {
        System.out.println("refreshSiteAvgCompletionRate start......");
        remoteVppTaskService.refreshSiteAvgCompletionRate();
	}

    // 运管平台 UN Poll 拉取事件/反馈
    public void pollUn(Integer tenantId) {
        System.out.println("租户：" + tenantId + " 运管平台 UN Poll 定时任务开始执行......");
        remoteVppTaskService.pollUn(tenantId);
    }

    // 运管平台 UN Token 刷新与注册
    public void registerUn(Integer tenantId) {
        System.out.println("租户：" + tenantId + " 运管平台 UN 注册定时任务开始执行......");
        remoteVppTaskService.registerUn(tenantId);
    }

    // 运管平台 UN 曲线数据报告（IntervalDataReport）
    public void intervalDataReportUn(Integer tenantId) {
        System.out.println("租户：" + tenantId + " 运管平台 UN 曲线数据报告定时任务开始执行......");
        remoteVppTaskService.intervalDataReportUn(tenantId);
    }

}
