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

    private final MonitorSendClient monitorSendClient;
    private final SysDicTreePOService sysDicTreePOService;


    @Override
    public void action(String date) {
        //重要或敏感用户
        MonitorParam.Info param2 = new MonitorParam.Info();
        param2.setObjType(sysDicTreePOService.queryByCode("2400").getId());
        param2.setFiy(true);
        String code = monitorSendClient.windSend(param2).getCode();
        if(code.equals("A0002")){
            throw new BusinessException("失败");
        }
    }
}
