package com.njcn.csdevice.init;

import com.njcn.csdevice.service.CsDevModelService;
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 项目初始化缓存设备池，后续从缓存中获取设备数据
 * @author xy
 */
@Slf4j
@Component
@AllArgsConstructor
public class InitData implements CommandLineRunner {

    private final CsEquipmentDeliveryService csEquipmentDeliveryService;
    private final CsDevModelService csDevModelService;

    @Override
    public void run(String... args) {
        csEquipmentDeliveryService.refreshDeviceDataCache();
        csDevModelService.refreshDevModelCache();
    }

}
