|
|
|
|
@@ -1,5 +1,21 @@
|
|
|
|
|
package com.ecep.contract.manager.ds.other.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import org.controlsfx.control.TaskProgressView;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import com.ecep.contract.manager.CurrentEmployee;
|
|
|
|
|
import com.ecep.contract.manager.CurrentEmployeeInitialedEvent;
|
|
|
|
|
import com.ecep.contract.manager.Desktop;
|
|
|
|
|
import com.ecep.contract.manager.cloud.old.OldVersionService;
|
|
|
|
|
import com.ecep.contract.manager.cloud.rk.CloudRkManagerWindowController;
|
|
|
|
|
@@ -23,7 +39,7 @@ import com.ecep.contract.manager.ui.BaseController;
|
|
|
|
|
import com.ecep.contract.manager.ui.FxmlPath;
|
|
|
|
|
import com.ecep.contract.manager.ui.task.TaskMonitorViewController;
|
|
|
|
|
import com.ecep.contract.manager.util.FxmlUtils;
|
|
|
|
|
import javafx.application.Platform;
|
|
|
|
|
|
|
|
|
|
import javafx.concurrent.Task;
|
|
|
|
|
import javafx.event.ActionEvent;
|
|
|
|
|
import javafx.scene.Node;
|
|
|
|
|
@@ -36,18 +52,6 @@ import javafx.scene.layout.VBox;
|
|
|
|
|
import javafx.stage.Modality;
|
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
import javafx.stage.WindowEvent;
|
|
|
|
|
import org.controlsfx.control.TaskProgressView;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
@Lazy
|
|
|
|
|
@Scope("prototype")
|
|
|
|
|
@@ -95,27 +99,31 @@ public class HomeWindowController extends BaseController {
|
|
|
|
|
|
|
|
|
|
employeeStatusLabel.textProperty().bind(Desktop.instance.getActiveEmployee().getName());
|
|
|
|
|
|
|
|
|
|
Desktop.instance.getActiveEmployee().initialize().thenRun(() -> {
|
|
|
|
|
if (Desktop.instance.getActiveEmployee().isSystemAdministrator()) {
|
|
|
|
|
if (logger.isInfoEnabled()) {
|
|
|
|
|
logger.info("You are administrator, try schedule sync tasks.");
|
|
|
|
|
}
|
|
|
|
|
Desktop.instance.getExecutorService().schedule(() -> {
|
|
|
|
|
try {
|
|
|
|
|
getBean(OldVersionService.class).scheduledTasks(taskProgressView);
|
|
|
|
|
} catch (BeansException ignored) {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
getBean(YongYouU8Service.class).scheduledTasks(taskProgressView);
|
|
|
|
|
} catch (BeansException ignored) {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
getBean(CloudRkService.class).scheduledTasks(taskProgressView);
|
|
|
|
|
} catch (BeansException ignored) {
|
|
|
|
|
}
|
|
|
|
|
}, 15, TimeUnit.SECONDS);
|
|
|
|
|
Desktop.instance.getActiveEmployee().initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventListener
|
|
|
|
|
public void onCurrentEmployeeInitialed(CurrentEmployeeInitialedEvent event) {
|
|
|
|
|
CurrentEmployee currentEmployee = event.getEmployee();
|
|
|
|
|
if (currentEmployee.isSystemAdministrator()) {
|
|
|
|
|
if (logger.isInfoEnabled()) {
|
|
|
|
|
logger.info("You are administrator, try schedule sync tasks.");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Desktop.instance.getExecutorService().schedule(() -> {
|
|
|
|
|
try {
|
|
|
|
|
getBean(OldVersionService.class).scheduledTasks(taskProgressView);
|
|
|
|
|
} catch (BeansException ignored) {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
getBean(YongYouU8Service.class).scheduledTasks(taskProgressView);
|
|
|
|
|
} catch (BeansException ignored) {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
getBean(CloudRkService.class).scheduledTasks(taskProgressView);
|
|
|
|
|
} catch (BeansException ignored) {
|
|
|
|
|
}
|
|
|
|
|
}, 15, TimeUnit.SECONDS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|