package com.zhongshu.card.server.core.init;

import com.zhongshu.card.client.service.org.OrganizationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

/**
 * 平台用户的初始化
 *
 * @author TRX
 * @date 2024/6/3
 */
@Component
@Slf4j
public class SuperCountInit implements CommandLineRunner {

    @Autowired
    OrganizationService organizationService;

    @Override
    public void run(String... args) throws Exception {
        // 平台 平台用户的初始化
        log.info("SuperCountInit");
        CompletableFuture.runAsync(()->{
            try {
                TimeUnit.SECONDS.sleep(10);
                log.info("---------开始初始平台管理员信息-----------");
                organizationService.initSuperOrganization();
            }catch (Exception e){
                e.printStackTrace();
            }
        });
    }
}
