package org.nl.quartz.task;

import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.run.AutoRunService;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * NDC自动重连
 */
@Slf4j
@Component
public class NdcAutoReconnection {

    @Autowired
    ISysParamService paramService;

    @Autowired
    AutoRunService autoRunService;

    public void run(String threadCode) throws Exception {
        String[] threadCodes = threadCode.split(",");
        for (String code : threadCodes) {
            if (!autoRunService.getThreadByCode(code).isAlive()) {
                autoRunService.startThread(code);
            }
        }
    }
}
