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

    private final MonitorSendClient monitorSendClient;
    private final SysDicTreePOService sysDicTreePOService;


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