拆分模块

This commit is contained in:
2025-09-03 20:56:44 +08:00
parent 08cc2c29a5
commit a2f5e4864b
939 changed files with 14227 additions and 9607 deletions

View File

@@ -0,0 +1,28 @@
package com.ecep.contract.controller.company;
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.model.Company;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.vm.CompanyViewModel;
import javafx.concurrent.Task;
public abstract class AbstCompanyBasedTabSkin
extends AbstEntityBasedTabSkin<CompanyWindowController, Company, CompanyViewModel>
implements TabSkin {
public AbstCompanyBasedTabSkin(CompanyWindowController controller) {
super(controller);
}
protected CompanyService getCompanyService() {
Task<CompanyService> task = new Task<>() {
@Override
protected CompanyService call() throws Exception {
return controller.getViewModelService();
}
};
return controller.getViewModelService();
}
}

View File

@@ -0,0 +1,56 @@
package com.ecep.contract.controller.company;
import java.util.Map;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
import com.ecep.contract.controller.table.TableOfTabSkin;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.vm.CompanyBasedViewModel;
import com.ecep.contract.vm.CompanyViewModel;
import com.ecep.contract.vm.IdentityViewModel;
import lombok.Setter;
public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
extends AbstEntityTableTabSkin<CompanyWindowController, Company, CompanyViewModel, T, TV>
implements TabSkin, TableOfTabSkin<Company, T, TV> {
@Setter
private CompanyService companyService;
public AbstCompanyTableTabSkin(CompanyWindowController controller) {
super(controller);
viewModel = controller.getViewModel();
}
@Override
protected TV createNewViewModel() {
TV model = super.createNewViewModel();
if (model instanceof CompanyBasedViewModel m) {
m.getCompany().set(getEntity());
}
return model;
}
protected CompanyService getCompanyService() {
return getParentService();
}
protected CompanyService getParentService() {
if (companyService == null) {
companyService = getBean(CompanyService.class);
}
return companyService;
}
@Override
public Map<String, Object> getSpecification(Company parent) {
Map<String, Object> params = getSpecification();
params.put("company", parent.getId());
return params;
}
}

View File

@@ -0,0 +1,187 @@
package com.ecep.contract.controller.company;
import java.lang.reflect.InvocationTargetException;
import java.time.format.DateTimeFormatter;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.UITools;
import com.ecep.contract.controller.BaseController;
import com.ecep.contract.util.FxmlUtils;
import com.ecep.contract.ds.company.repository.CompanyContactRepository;
import com.ecep.contract.model.CompanyContact;
import com.ecep.contract.vm.CompanyContactViewModel;
import javafx.application.Platform;
import javafx.scene.control.Button;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.stage.WindowEvent;
import javafx.util.converter.LocalDateStringConverter;
import lombok.Getter;
import lombok.Setter;
@Lazy
@Scope("prototype")
@Component
public class CompanyContactWindowController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(CompanyContactWindowController.class);
/**
* 显示界面
*/
public static void show(CompanyContactViewModel viewModel, Window window) {
String key = toKey(viewModel);
// 一个合同一个界面
if (toFront(key)) {
return;
}
FxmlUtils.newLoaderAsyncWithRunLater("/ui/contact.fxml", null, loader -> {
CompanyContactWindowController controller = loader.getController();
controller.setViewModel(viewModel);
controller.show(loader, window, Modality.NONE, key);
});
}
private static String toKey(CompanyContactViewModel viewModel) {
return viewModel.getClass().getName() + "-" + viewModel.getId().get();
}
public Tab baseInfoTab;
public BorderPane root;
public TabPane tabPane;
@Getter
@Setter
private CompanyContactViewModel viewModel;
@Autowired
private CompanyContactRepository companyContactRepository;
public TextField nameField;
public TextField positionField;
public TextField phoneField;
public DatePicker createdField;
public TextField u8CodeField;
public TextField emailField;
public TextField addressField;
public TextArea descriptionField;
public Label versionLabel;
public Button saveBtn;
private CompletableFuture<CompanyContact> companyContactLoadedFuture;
@Override
public void show(Stage stage) {
super.show(stage);
getTitle().bind(viewModel.getName().map(v -> "[" + viewModel.getId().get() + "] " + viewModel.getName().getValue() + " 曾用名详情"));
}
@Override
public void onShown(WindowEvent windowEvent) {
super.onShown(windowEvent);
if (logger.isDebugEnabled()) {
logger.debug("onShown");
}
initializeBaseTab();
companyContactLoadedFuture = CompletableFuture.supplyAsync(() -> {
Optional<CompanyContact> optional = companyContactRepository.findById(viewModel.getId().get());
if (optional.isPresent()) {
CompanyContact oldName = optional.get();
Platform.runLater(() -> {
viewModel.update(oldName);
viewModel.bindListener();
if (logger.isDebugEnabled()) {
logger.debug("bind ViewModel({}) Listener", viewModel.getName().get());
}
tabPane.getSelectionModel().getSelectedItem().getOnSelectionChanged().handle(null);
});
return oldName;
}
return null;
});
}
private void initializeBaseTab() {
baseInfoTab.setOnSelectionChanged(event -> {
if (logger.isDebugEnabled()) {
logger.debug("baseInfoTab OnSelectionChanged");
}
if (baseInfoTab.isSelected()) {
onBaseTabShown();
}
});
saveBtn.disableProperty().bind(viewModel.getChanged().not());
saveBtn.setOnAction(event -> {
try {
CompanyContact contact = companyContactLoadedFuture.join();
viewModel.copyTo(contact);
CompanyContact saved = companyContactRepository.save(contact);
viewModel.update(saved);
companyContactLoadedFuture = CompletableFuture.completedFuture(saved);
} catch (Exception e) {
UITools.showExceptionAndWait("保存失败,请检查", e);
}
});
nameField.textProperty().bindBidirectional(viewModel.getName());
positionField.textProperty().bindBidirectional(viewModel.getPosition());
phoneField.textProperty().bindBidirectional(viewModel.getPhone());
emailField.textProperty().bindBidirectional(viewModel.getEmail());
addressField.textProperty().bindBidirectional(viewModel.getAddress());
LocalDateStringConverter converter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
createdField.setConverter(converter);
createdField.valueProperty().bindBidirectional(viewModel.getCreated());
u8CodeField.textProperty().bind(viewModel.getU8Code());
descriptionField.textProperty().bindBidirectional(viewModel.getMemo());
versionLabel.textProperty().bind(viewModel.getVersion().asString());
}
/**
* 基础页显示时回调函数
*/
private void onBaseTabShown() {
if (logger.isDebugEnabled()) {
logger.debug("onBaseTabShown");
}
companyContactLoadedFuture.thenAcceptAsync(contact -> {
if (logger.isDebugEnabled()) {
logger.debug("onBaseTabShown company contact {}", contact.getName());
}
// viewModel.update(contact);
}).exceptionally(ex -> {
UITools.showExceptionAndWait(ex.getMessage(), ex);
return null;
});
}
public void onHidden(WindowEvent windowEvent) {
if (viewModel != null) {
try {
viewModel.unBindListener();
if (logger.isDebugEnabled()) {
logger.debug("unbind ViewModel({}) Listener", viewModel.getName().get());
}
} catch (InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
super.onHidden(windowEvent);
}
}

View File

@@ -0,0 +1,83 @@
package com.ecep.contract.controller.company;
import java.util.List;
import java.util.Optional;
import com.ecep.contract.ds.company.controller.CompanyWindowController;
import com.ecep.contract.ds.company.service.CompanyOldNameService;
import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.model.Company;
import com.ecep.contract.ui.AbstEntityManagerSkin;
import com.ecep.contract.vm.CompanyViewModel;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.scene.control.Alert;
import javafx.scene.control.TextInputDialog;
import lombok.Setter;
public class CompanyManagerSkin
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
@Setter
private CompanyOldNameService companyOldNameService;
public CompanyManagerSkin(CompanyManagerWindowController controller) {
super(controller);
}
public CompanyService getCompanyService() {
return controller.getViewModelService();
}
public CompanyOldNameService getCompanyOldNameService() {
if (companyOldNameService == null) {
companyOldNameService = getBean(CompanyOldNameService.class);
}
return companyOldNameService;
}
@Override
public void initializeTable() {
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
controller.uniscidColumn.setCellValueFactory(param -> param.getValue().getUid());
controller.entStatusColumn.setCellValueFactory(param -> param.getValue().getEntStatus());
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
controller.memoColumn.setCellValueFactory(param -> param.getValue().getMemo());
Platform.runLater(() -> {
getTableView().getSortOrder().add(controller.createdColumn);
});
}
@Override
protected void onTableRowDoubleClickedAction(CompanyViewModel item) {
showInOwner(CompanyWindowController.class, item);
}
@Override
protected void onTableCreateNewAction(ActionEvent event) {
Platform.runLater(() -> {
TextInputDialog dialog = new TextInputDialog();
dialog.setTitle("新建公司");
dialog.setHeaderText("请输入新建的公司名称,请输入公司名字全称");
Optional<String> optional = dialog.showAndWait();
if (optional.isPresent()) {
CompanyService companyService = getCompanyService();
String newCompanyName = optional.get();
List<Company> list = companyService.findAllByName(newCompanyName);
if (list == null || list.isEmpty()) {
// 未登记过
Company company = companyService.createNewCompany(newCompanyName);
Company saved = companyService.save(company);
CompanyWindowController.show(saved, getTableView().getScene().getWindow());
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("新建公司");
alert.setHeaderText("公司名称 " + newCompanyName + " 已经存在,是否打开公司页面");
}
}
});
}
}

View File

@@ -0,0 +1,84 @@
package com.ecep.contract.controller.company;
import java.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.ds.company.controller.CompanyManagerSkin;
import com.ecep.contract.ds.company.controller.CompanyVerifyWindowController;
import com.ecep.contract.ds.company.tasker.CompanyFilesRebuildTasker;
import com.ecep.contract.model.Company;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.ui.AbstManagerWindowController;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CompanyViewModel;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.stage.Stage;
@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/company/company-manager.fxml")
public class CompanyManagerWindowController
extends AbstManagerWindowController<Company, CompanyViewModel, CompanyManagerSkin> {
// columns
@FXML
public TableColumn<CompanyViewModel, Number> idColumn;
@FXML
public TableColumn<CompanyViewModel, String> nameColumn;
@FXML
public TableColumn<CompanyViewModel, String> uniscidColumn;
@FXML
public TableColumn<CompanyViewModel, String> entStatusColumn;
@FXML
public TableColumn<CompanyViewModel, LocalDate> createdColumn;
@FXML
public TableColumn<CompanyViewModel, String> memoColumn;
@Autowired
private CompanyService companyService;
@Override
public CompanyService getViewModelService() {
return companyService;
}
@Override
public void show(Stage stage) {
super.show(stage);
getTitle().set("公司管理");
}
@Override
protected CompanyManagerSkin createDefaultSkin() {
return new CompanyManagerSkin(this);
}
public void onCompanyCreateNewAction(ActionEvent event) {
getSkin().onTableCreateNewAction(event);
}
/**
* 对所有公司的文件进行重置
* <p>
* 弹出对话框模式,对话框中有进度条和重置的消息
*
* @param event 事件
*/
public void onReBuildFilesAction(ActionEvent event) {
CompanyFilesRebuildTasker task = new CompanyFilesRebuildTasker();
UITools.showTaskDialogAndWait("公司文件重置", task, null);
}
public void onVerifyAction(ActionEvent event) {
show(CompanyVerifyWindowController.class, null);
}
}

View File

@@ -0,0 +1,16 @@
package com.ecep.contract.controller.company;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.controller.BaseController;
import com.ecep.contract.util.FxmlPath;
@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/company/company-verify.fxml")
public class CompanyVerifyWindowController extends BaseController {
}

View File

@@ -0,0 +1,313 @@
package com.ecep.contract.controller.company;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import org.hibernate.Hibernate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import com.ecep.contract.DesktopUtils;
import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.AbstEntityController;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.controller.customer.CompanyCustomerWindowController;
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.controller.tab.CompanyTabSkinBankAccount;
import com.ecep.contract.controller.tab.CompanyTabSkinBase;
import com.ecep.contract.controller.tab.CompanyTabSkinBlackReason;
import com.ecep.contract.controller.tab.CompanyTabSkinContact;
import com.ecep.contract.controller.tab.CompanyTabSkinContract;
import com.ecep.contract.controller.tab.CompanyTabSkinFile;
import com.ecep.contract.controller.tab.CompanyTabSkinInvoice;
import com.ecep.contract.controller.tab.CompanyTabSkinOldName;
import com.ecep.contract.controller.tab.CompanyTabSkinOther;
import com.ecep.contract.controller.tab.CompanyTabSkinPurchaseBillVoucher;
import com.ecep.contract.controller.vendor.CompanyVendorWindowController;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyFileService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CompanyVendorService;
import com.ecep.contract.service.ContractService;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CompanyViewModel;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.CheckBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.stage.Window;
@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/company/company.fxml")
public class CompanyWindowController
extends AbstEntityController<Company, CompanyViewModel> {
private static final Logger logger = LoggerFactory.getLogger(CompanyWindowController.class);
public static void show(Company company, Window window) {
CompanyViewModel viewModel = new CompanyViewModel();
if (!Hibernate.isInitialized(company)) {
company = SpringApp.getBean(CompanyService.class).findById(company.getId());
}
viewModel.update(company);
show(viewModel, window);
}
/**
* 显示界面
*/
public static void show(CompanyViewModel viewModel, Window window) {
show(CompanyWindowController.class, viewModel, window);
}
@Autowired
private CompanyService companyService;
@Autowired
private CompanyFileService companyFileService;
@Autowired
private ContractService contractService;
@Autowired
private CompanyCustomerService companyCustomerService;
@Autowired
private CompanyVendorService companyVendorService;
public BorderPane root;
public TabPane tabPane;
public Tab baseInfoTab;
public Tab oldNameTab;
public Tab contactTab;
public Tab blackReasonTab;
public Tab customerTab;
public Tab vendorTab;
public Tab bankAccountTab;
public Tab contractTab;
public Tab fileTab;
public Tab invoiceTab;
public Tab purchaseBillVoucherTab;
public Tab otherTab;
/*
*/
public TextField nameField;
public TextField shortNameField;
public TextField uidField;
public TextField entStatusField;
public DatePicker setupDateField;
public TextField entTypeField;
public TextField industryField;
public TextField districtField;
public CheckBox pathExistField;
public TextField pathField;
public DatePicker createdDateField;
public TextField telephoneField;
public TextField regAddressField;
public TextField addressField;
public TextField registeredCapitalField;
public TextField registeredCapitalCurrencyField;
public TextField legalRepresentativeField;
public DatePicker operationPeriodBeginField;
public DatePicker operationPeriodEndField;
public TextArea memoField;
public Label versionLabel;
public Button companyRenameBtn;
public Button companyPathCreateBtn;
public Button companyPathChangeBtn;
public Button companyPathSameAsNameBtn;
// private final CompanyCustomerViewModel companyCustomerViewModel = new
// CompanyCustomerViewModel();
// private final CompanyVendorViewModel companyVendorViewModel = new
// CompanyVendorViewModel();
private final SimpleObjectProperty<CompanyCustomer> companyCustomerProperty = new SimpleObjectProperty<>();
private final SimpleObjectProperty<CompanyVendor> companyVendorProperty = new SimpleObjectProperty<>();
public Pane customerTab_pane1;
public Button customerTab_openBtn;
public Pane customerTab_pane2;
public Button customerTab_createBtn;
public Pane vendorTab_pane1;
public Button vendorTab_openBtn;
public Pane vendorTab_pane2;
public Button vendorTab_createBtn;
@Override
public void show(Stage stage) {
super.show(stage);
stage.minWidthProperty().set(600);
stage.minHeightProperty().set(450);
getTitle().set("[" + viewModel.getId().get() + "] " + viewModel.getName().getValue() + " 公司详情");
}
@Override
protected Company loadEntity() {
return companyService.findById(viewModel.getId().get());
}
@Override
protected Company saveEntity(Company entity) {
return companyService.save(entity);
}
@Override
protected void registerTabSkins() {
registerTabSkin(baseInfoTab, tab1 -> new CompanyTabSkinBase(this));
registerTabSkin(oldNameTab, tab1 -> new CompanyTabSkinOldName(this));
registerTabSkin(contactTab, tab1 -> new CompanyTabSkinContact(this));
registerTabSkin(blackReasonTab, tab1 -> new CompanyTabSkinBlackReason(this));
registerTabSkin(bankAccountTab, tab1 -> new CompanyTabSkinBankAccount(this));
registerTabSkin(contractTab, tab -> new CompanyTabSkinContract(this));
registerTabSkin(fileTab, tab -> new CompanyTabSkinFile(this));
registerTabSkin(invoiceTab, tab -> new CompanyTabSkinInvoice(this));
registerTabSkin(purchaseBillVoucherTab, tab -> new CompanyTabSkinPurchaseBillVoucher(this));
registerTabSkin(otherTab, tab -> new CompanyTabSkinOther(this));
initializeVendorTab();
initializeCustomerTab();
}
@Override
protected <K extends AbstEntityBasedTabSkin<?, ?, ?>> K registerTabSkin(Tab tab, Function<Tab, K> func) {
K skin = super.registerTabSkin(tab, func);
if (skin instanceof AbstCompanyBasedTabSkin b) {
b.setViewModel(viewModel);
}
return skin;
}
@Override
public CompanyService getViewModelService() {
return companyService;
}
private void initializeCustomerTab() {
customerTab.setOnSelectionChanged(event -> {
if (logger.isDebugEnabled()) {
logger.debug("customerTab OnSelectionChanged");
}
if (customerTab.isSelected()) {
onCustomerTabShown();
}
});
customerTab_pane1.visibleProperty().bind(customerTab_pane2.visibleProperty().not());
customerTab_pane2.visibleProperty().bind(companyCustomerProperty.isNull());
customerTab_createBtn.setOnAction(event -> {
// TODO 创建
});
customerTab_openBtn.setOnAction(event -> {
CompanyCustomerWindowController.show(companyCustomerProperty.get(), root.getScene().getWindow());
});
}
private void onCustomerTabShown() {
if (logger.isDebugEnabled()) {
logger.debug("onCustomerTabShown");
}
getLoadedFuture().thenAcceptAsync(company -> {
companyCustomerProperty.set(companyCustomerService.findByCompany(company));
}).exceptionally(ex -> {
UITools.showExceptionAndWait(ex.getMessage(), ex);
return null;
});
}
private void initializeVendorTab() {
vendorTab.setOnSelectionChanged(event -> {
if (logger.isDebugEnabled()) {
logger.debug("vendorTab OnSelectionChanged");
}
if (vendorTab.isSelected()) {
onVendorTabShown();
}
});
vendorTab_pane1.visibleProperty().bind(vendorTab_pane2.visibleProperty().not());
vendorTab_pane2.visibleProperty().bind(companyVendorProperty.isNull());
vendorTab_createBtn.setOnAction(event -> {
// TODO 创建
});
vendorTab_openBtn.setOnAction(event -> {
CompanyVendorWindowController.show(companyVendorProperty.get(), root.getScene().getWindow());
});
}
private void onVendorTabShown() {
if (logger.isDebugEnabled()) {
logger.debug("onVendorTabShown");
}
getLoadedFuture().thenAcceptAsync(company -> {
if (logger.isDebugEnabled()) {
logger.debug("onVendorTabShown company {}", company.getName());
}
companyVendorProperty.set(companyVendorService.findByCompany(company));
}).exceptionally(ex -> {
UITools.showExceptionAndWait(ex.getMessage(), ex);
return null;
});
}
/**
* 合并更新企业信息
*/
public void onCompanyCompositeUpdateAction(ActionEvent event) {
CompanyCompositeUpdateTasker task = new CompanyCompositeUpdateTasker();
task.setCompany(getEntity());
UITools.showTaskDialogAndWait("更新企业信息", task, null);
}
/**
* 企业合规检查
*/
public void onCompanyVerifyAction(ActionEvent event) {
Company company = getEntity();
CompanyVerifyTasker task = new CompanyVerifyTasker();
task.setCompanyService(companyService);
task.setCompany(company);
UITools.showTaskDialogAndWait("企业合规性验证", task, null);
}
public void onCompanyOpenInExplorerAction(ActionEvent event) {
Company company = getEntity();
String path = company.getPath();
CompletableFuture.runAsync(() -> {
if (!StringUtils.hasText(path)) {
ButtonType buttonType = UITools.showConfirmation("目录未设置", "是否创建目录").join();
if (buttonType == ButtonType.OK) {
if (companyService.makePathAbsent(company)) {
save(company);
}
} else {
setStatus("未设置目录");
return;
}
}
DesktopUtils.checkAndShowInExplorer(company.getPath(), this::setStatus);
});
}
}