package com.njcn.system.timer.tasks;

import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.MonitorSendClient;
import com.njcn.device.pms.pojo.param.MonitorParam;
import com.njcn.system.service.SysDicTreePOService;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;


/**
 *
 */
@Component
@RequiredArgsConstructor
public class MonitorSendTaskRunner implements TimerTaskRunner {

    private final MonitorSendClient monitorSendClient;
    private final SysDicTreePOService sysDicTreePOService;


    @Override
    public void action(String date) {
        //风电场
        MonitorParam.Info param = new MonitorParam.Info();
        param.setObjType(sysDicTreePOService.queryByCode("1401").getId());
        param.setFiy(true);
        String code = monitorSendClient.windSend(param).getCode();
        if(code.equals("A0002")){
            throw new BusinessException("失败");
        }
    }
}
