|
|
@@ -0,0 +1,35 @@
|
|
|
+package com.zswl.dataservice.init;
|
|
|
+
|
|
|
+import com.zswl.dataservice.service.user.impl.UserServiceImpl;
|
|
|
+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/21
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class UserInit implements CommandLineRunner {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ UserServiceImpl userService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run(String... args) throws Exception {
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ try {
|
|
|
+ TimeUnit.SECONDS.sleep(10);
|
|
|
+ log.info("---------开始初始平台管理员信息-----------");
|
|
|
+ userService.initAdmin();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|