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 MonitorSendPhotovoltaicTaskRunner implements TimerTaskRunner {

    private final MonitorSendClient monitorSendClient;
    private final SysDicTreePOService sysDicTreePOService;


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