From 72edb07798ef15d244fd5659f4db18c8f715e5a9 Mon Sep 17 00:00:00 2001 From: songqq Date: Sat, 13 Dec 2025 11:11:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=90=88=E5=90=8C?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E5=90=8C=E6=AD=A5=E4=BB=BB=E5=8A=A1=E5=92=8C?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E4=BE=9B=E6=96=B9=E5=90=8D=E5=BD=95=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E7=94=9F=E6=88=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 重构查询服务使用ParamConstant替换ServiceConstant style: 清理无用代码和注释 fix: 修复CompanyCustomerEvaluationFormFileService查询方法 docs: 更新CloudYuVo和CompanyBankAccountVo字段注释 --- .env | 1 + README.md | 5 +- .../controller/AbstEntityController.java | 44 +- .../cloud/u8/YongYouU8ManagerSkin.java | 18 +- .../u8/YongYouU8ManagerWindowController.java | 4 +- .../contract/ContractTabSkinFiles.java | 52 +- ...merEvaluationFormFileWindowController.java | 450 ++++++++++++------ .../customer/CustomerTabSkinFile.java | 9 +- .../tab/CompanyTabSkinBankAccount.java | 5 - .../controller/tab/CompanyTabSkinOther.java | 44 +- .../table/cell/VendorTypeTableCell.java | 1 - .../VendorApprovedListTabSkinVendors.java | 1 + .../VendorApprovedListVendorExportTask.java | 4 +- .../VendorApprovedListVendorImportTask.java | 245 +++++----- .../VendorApprovedListWindowController.java | 17 +- .../VendorCatalogStringConverter.java | 3 + ...panyCustomerEvaluationFormFileService.java | 11 +- .../CompanyCustomerFileTypeService.java | 2 +- .../service/CompanyOldNameService.java | 7 +- .../service/ContractFileTypeService.java | 14 +- .../ecep/contract/service/SysConfService.java | 3 + .../service/VendorApprovedFileService.java | 15 +- .../service/VendorApprovedItemService.java | 9 + .../service/VendorApprovedService.java | 24 +- .../ecep/contract/service/VendorService.java | 9 - .../contract/task/ContractSyncAllTask.java | 36 +- .../task/VendorApprovedListMakePathTask.java | 55 +++ .../com/ecep/contract/util/ParamUtils.java | 54 ++- .../java/com/ecep/contract/util/UITools.java | 15 +- .../contract/vm/CloudYuInfoViewModel.java | 46 +- .../vm/CompanyBankAccountViewModel.java | 29 +- ...nyCustomerEvaluationFormFileViewModel.java | 4 +- .../main/resources/ui/cloud/tyc_manager.fxml | 3 +- .../main/resources/ui/cloud/u8_config.fxml | 72 +-- .../main/resources/ui/cloud/u8_manager.fxml | 7 +- .../ui/company/company-tab-bank-account.fxml | 9 - .../ui/company/company-tab-other.fxml | 260 +++++----- .../customer/customer_evaluation_form.fxml | 17 +- client/src/main/resources/ui/configs.fxml | 184 ++++--- .../ecep/contract/ContractFileTypeGroup.java | 20 + .../ecep/contract/constant/ParamConstant.java | 10 + .../contract/constant/ServiceConstant.java | 1 - .../java/com/ecep/contract/vo/CloudYuVo.java | 10 +- .../contract/vo/CompanyBankAccountVo.java | 24 +- .../contract/vo/VendorApprovedFileVo.java | 7 +- .../ecep/contract/vo/VendorApprovedVo.java | 1 - .../java/com/ecep/contract/EntityService.java | 7 +- .../cloud/u8/ContractSyncAllTask.java | 19 +- .../contract/cloud/u8/YongYouU8Service.java | 8 +- .../ds/company/model/CompanyBankAccount.java | 33 +- .../service/CompanyBankAccountService.java | 15 +- .../service/CompanyExtendInfoService.java | 6 +- .../company/service/CompanyFileService.java | 7 +- .../service/CompanyFileTypeService.java | 6 +- .../service/CompanyOldNameService.java | 13 +- .../service/ContractFileTypeService.java | 6 +- .../service/ContractGroupService.java | 6 +- .../contract/service/ContractItemService.java | 6 +- ...panyCustomerEvaluationFormFileService.java | 7 +- .../service/CompanyCustomerFileService.java | 7 +- .../CompanyCustomerFileTypeService.java | 6 +- .../service/CustomerCatalogService.java | 6 +- .../service/CustomerFileTypeService.java | 7 +- .../ecep/contract/ds/other/model/CloudYu.java | 8 +- .../CustomerSatisfactionSurveyService.java | 6 +- .../ds/project/service/ProjectBidService.java | 6 +- .../service/ProjectCostItemService.java | 6 +- .../project/service/ProjectCostService.java | 6 +- .../service/ProjectFileTypeService.java | 6 +- .../service/ProjectIndustryService.java | 6 +- .../service/ProjectQuotationService.java | 6 +- .../project/service/ProjectTypeService.java | 6 +- .../service/VendorApprovedFileService.java | 63 ++- .../service/VendorApprovedItemService.java | 13 +- .../vendor/service/VendorApprovedService.java | 27 +- .../vendor/service/VendorCatalogService.java | 6 +- .../ds/vendor/service/VendorFileService.java | 6 +- .../vendor/service/VendorFileTypeService.java | 7 +- .../ds/vendor/service/VendorService.java | 6 +- .../ds/vendor/service/VendorTypeService.java | 6 +- .../task/VendorApprovedListMakePathTask.java | 131 +++++ .../ecep/contract/service/SmbFileService.java | 12 +- .../contract/util/SpecificationUtils.java | 6 +- server/src/main/resources/tasker_mapper.json | 4 +- 84 files changed, 1526 insertions(+), 843 deletions(-) create mode 100644 client/src/main/java/com/ecep/contract/task/VendorApprovedListMakePathTask.java create mode 100644 server/src/main/java/com/ecep/contract/ds/vendor/task/VendorApprovedListMakePathTask.java diff --git a/.env b/.env index e69de29..7c6f50b 100644 --- a/.env +++ b/.env @@ -0,0 +1 @@ +PLAYWRIGHT_MCP_EXTENSION_TOKEN=TB7T39NhEbruyS7L-E7RXIGYk39PVK7eu1h-WP8M1Cg \ No newline at end of file diff --git a/README.md b/README.md index d80a645..fbdbabe 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,4 @@ Contract-Manager/ 2. 优化数据库查询性能 3. 增强系统安全机制 4. 改进用户界面体验 -5. 扩展更多云端服务集成 - - - +5. 扩展更多云端服务集成 \ No newline at end of file diff --git a/client/src/main/java/com/ecep/contract/controller/AbstEntityController.java b/client/src/main/java/com/ecep/contract/controller/AbstEntityController.java index 5390d06..84c484b 100644 --- a/client/src/main/java/com/ecep/contract/controller/AbstEntityController.java +++ b/client/src/main/java/com/ecep/contract/controller/AbstEntityController.java @@ -45,15 +45,33 @@ public abstract class AbstEntityController loadedFuture; private final ObservableList tabSkins = FXCollections.observableArrayList(); + @Override public void onShown(WindowEvent windowEvent) { super.onShown(windowEvent); + // 载数据 + initializeData(); + // 注册 skin + registerTabSkins(); + // 初始化保存按钮 + initializeSaveBtn(); + // 安装 skin + installTabSkins(); + } + + protected void initializeSaveBtn() { + if (saveBtn != null) { + saveBtn.disableProperty().bind(createTabSkinChangedBindings().not()); + saveBtn.setOnAction(event -> saveTabSkins()); + } + } + + protected void initializeData() { ViewModelService service = getViewModelService(); if (service instanceof QueryService queryService) { setStatus("读取..."); loadedFuture = queryService.asyncFindById(viewModel.getId().get()); - } else { loadedFuture = CompletableFuture.supplyAsync(() -> { return getViewModelService().findById(viewModel.getId().get()); @@ -72,14 +90,6 @@ public abstract class AbstEntityController saveTabSkins()); - } - - installTabSkins(); } protected void updateViewModel(T entity) { @@ -105,6 +115,19 @@ public abstract class AbstEntityController param.getValue().getId()); - controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany()); - controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService())); - controller.cloudIdColumn.setCellValueFactory(param -> param.getValue().getCloudId()); + controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany()); + controller.companyColumn.setCellFactory( CompanyTableCell.forTableColumn(getCompanyService())); controller.latestUpdateColumn.setCellValueFactory(param -> param.getValue().getLatestUpdate()); controller.latestUpdateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>()); @@ -47,7 +48,14 @@ public class YongYouU8ManagerSkin controller.cloudLatestColumn.setCellValueFactory(param -> param.getValue().getCloudLatest()); controller.cloudLatestColumn.setCellFactory(param -> new LocalDateTimeTableCell<>()); - controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getVendorCode()); + controller.cloudVendorUpdateDateColumn.setCellValueFactory(param -> param.getValue().getVendorUpdateDate()); + + controller.cloudCustomerUpdateDateColumn.setCellValueFactory(param -> param.getValue().getCustomerUpdateDate()); + + controller.activeColumn.setCellValueFactory(param -> param.getValue().getActive()); + controller.activeColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.activeColumn)); + + controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getExceptionMessage()); } @Override @@ -73,7 +81,7 @@ public class YongYouU8ManagerSkin } for (CloudYuInfoViewModel selectedItem : selectedItems) { CloudYuVo yongYouU8Vo = getU8Service().findById(selectedItem.getId().get()); - selectedItem.getCustomerCode().set(""); + selectedItem.getExceptionMessage().set(""); if (selectedItem.copyTo(yongYouU8Vo)) { CloudYuVo saved = getU8Service().save(yongYouU8Vo); selectedItem.update(saved); diff --git a/client/src/main/java/com/ecep/contract/controller/cloud/u8/YongYouU8ManagerWindowController.java b/client/src/main/java/com/ecep/contract/controller/cloud/u8/YongYouU8ManagerWindowController.java index 3c396a4..9bc48f9 100644 --- a/client/src/main/java/com/ecep/contract/controller/cloud/u8/YongYouU8ManagerWindowController.java +++ b/client/src/main/java/com/ecep/contract/controller/cloud/u8/YongYouU8ManagerWindowController.java @@ -37,8 +37,10 @@ public class YongYouU8ManagerWindowController public TableColumn idColumn; public TableColumn latestUpdateColumn; public TableColumn companyColumn; - public TableColumn cloudIdColumn; public TableColumn cloudLatestColumn; + public TableColumn cloudVendorUpdateDateColumn; + public TableColumn cloudCustomerUpdateDateColumn; + public TableColumn activeColumn; public TableColumn descriptionColumn; @Override diff --git a/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinFiles.java b/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinFiles.java index 4e12361..b3e124e 100644 --- a/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinFiles.java +++ b/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinFiles.java @@ -8,7 +8,6 @@ import com.ecep.contract.controller.tab.TabSkin; import com.ecep.contract.controller.table.EditableEntityTableTabSkin; import com.ecep.contract.controller.table.cell.ContractFileTypeTableCell; import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell; -import com.ecep.contract.model.ContractFileTypeLocal; import com.ecep.contract.service.ContractFileService; import com.ecep.contract.service.ContractFileTypeService; import com.ecep.contract.util.FxmlPath; @@ -22,7 +21,6 @@ import javafx.event.ActionEvent; import javafx.scene.control.*; import javafx.scene.control.cell.TextFieldTableCell; import javafx.stage.WindowEvent; -import javafx.util.StringConverter; import lombok.Setter; import org.apache.pdfbox.Loader; import org.apache.pdfbox.io.IOUtils; @@ -95,21 +93,6 @@ public class ContractTabSkinFiles return controller.fileTab; } - static class ContractFileTypeLocalStringConverter extends StringConverter { - @Override - public String toString(ContractFileTypeLocal local) { - if (local == null) { - return "-"; - } - return local.getValue(); - } - - @Override - public ContractFileTypeLocal fromString(String string) { - return null; - } - } - @Override public void initializeTab() { TableView table = getTableView(); @@ -135,6 +118,7 @@ public class ContractTabSkinFiles .setCellFactory(ContractFileTypeTableCell.forTableColumn(getCachedBean(ContractFileTypeService.class))); fileTable_typeColumn.setEditable(false); + /* 文件名编辑器 */ fileTable_filePathColumn.setCellValueFactory(param -> param.getValue().getFileName()); fileTable_filePathColumn.setCellFactory(TextFieldTableCell.forTableColumn()); @@ -194,6 +178,34 @@ public class ContractTabSkinFiles createVendorContractRequestByTemplateUpdateMenuItem(), createVendorContractApplyByTemplateUpdateMenuItem()); + + runAsync(() -> { + getCachedBean(ContractFileTypeService.class).findAll(getLocale()).forEach((k, v) -> { + if (isCustomer && !k.isSupportCustomer()) { + return; + } + if (isVendor && !k.isSupportVendor()) { + return; + } + + { + MenuItem item = new MenuItem(); + item.setText(v.getValue()); + item.getProperties().put("typeLocal", v); + item.setOnAction(this::onFileTableContextMenuChangeTypeAndNameAction); + fileTable_menu_change_type.getItems().add(item); + } + if (StringUtils.hasText(v.getSuggestFileName())) { + MenuItem item = new MenuItem(); + item.setText(v.getValue()); + item.getProperties().put("typeLocal", v); + item.getProperties().put("rename", true); + item.setOnAction(this::onFileTableContextMenuChangeTypeAndNameAction); + fileTable_menu_change_type_and_name.getItems().add(item); + } + }); + }); + super.initializeTab(); } @@ -541,13 +553,13 @@ public class ContractTabSkinFiles // fileTable_menu_change_type.setVisible(true); for (MenuItem item : fileTable_menu_change_type.getItems()) { - ContractFileTypeLocal typeLocal = (ContractFileTypeLocal) item.getProperties().get("typeLocal"); + ContractFileTypeLocalVo typeLocal = (ContractFileTypeLocalVo) item.getProperties().get("typeLocal"); item.setVisible(typeLocal.getType() != selectedItem.getType().get()); } fileTable_menu_change_type_and_name.setVisible(true); for (MenuItem item : fileTable_menu_change_type.getItems()) { - ContractFileTypeLocal typeLocal = (ContractFileTypeLocal) item.getProperties().get("typeLocal"); + ContractFileTypeLocalVo typeLocal = (ContractFileTypeLocalVo) item.getProperties().get("typeLocal"); item.setVisible(typeLocal.getType() != selectedItem.getType().get()); } @@ -560,7 +572,7 @@ public class ContractTabSkinFiles if (selectedItems == null || selectedItems.isEmpty()) { return; } - ContractFileTypeLocal typeLocal = (ContractFileTypeLocal) item.getProperties().get("typeLocal"); + ContractFileTypeLocalVo typeLocal = (ContractFileTypeLocalVo) item.getProperties().get("typeLocal"); if (typeLocal == null) { return; } diff --git a/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerEvaluationFormFileWindowController.java b/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerEvaluationFormFileWindowController.java index d5fc69b..38d093b 100644 --- a/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerEvaluationFormFileWindowController.java +++ b/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerEvaluationFormFileWindowController.java @@ -1,14 +1,26 @@ package com.ecep.contract.controller.customer; import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; import java.io.File; +import java.time.format.DateTimeFormatter; import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.function.BiConsumer; +import java.util.function.Consumer; import com.ecep.contract.controller.AbstEntityController; +import com.ecep.contract.controller.tab.TabSkin; +import com.ecep.contract.service.CompanyCustomerFileTypeService; import com.ecep.contract.service.ViewModelService; import com.ecep.contract.util.FxmlPath; +import com.ecep.contract.vo.CustomerFileTypeLocalVo; +import javafx.beans.binding.BooleanBinding; +import javafx.beans.property.*; +import javafx.scene.input.MouseButton; +import javafx.scene.paint.Color; +import javafx.scene.text.FontWeight; +import javafx.util.converter.LocalDateStringConverter; import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.PDFRenderer; @@ -18,6 +30,7 @@ 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.FileSystemUtils; import org.springframework.util.StringUtils; import com.ecep.contract.controller.BaseController; @@ -32,11 +45,9 @@ import com.ecep.contract.vm.CustomerFileViewModel; import javafx.application.Platform; import javafx.beans.binding.Bindings; -import javafx.beans.property.SimpleIntegerProperty; -import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; import javafx.event.ActionEvent; import javafx.geometry.Bounds; +import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.CheckBox; import javafx.scene.control.DatePicker; import javafx.scene.control.Label; @@ -58,8 +69,16 @@ import javafx.stage.WindowEvent; @Scope("prototype") @Component @FxmlPath("/ui/company/customer/customer_evaluation_form.fxml") -public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntityController { - private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormFileWindowController.class); +public class CompanyCustomerEvaluationFormFileWindowController + extends AbstEntityController { + private static final Logger logger = LoggerFactory + .getLogger(CompanyCustomerEvaluationFormFileWindowController.class); + + public static void show(CustomerFileViewModel item, Window window) { + show(CompanyCustomerEvaluationFormFileWindowController.class, window, controller -> { + controller.fileViewModel = item; + }); + } public static void show(CompanyCustomerEvaluationFormFileVo saved, Window window) { show(CompanyCustomerEvaluationFormFileViewModel.from(saved), window); @@ -69,7 +88,6 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit show(CompanyCustomerEvaluationFormFileWindowController.class, viewModel, window); } - public Label idField; public TextField filePathField; public CheckBox validField; @@ -88,67 +106,66 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit public ScrollPane leftPane; public Label totalCreditScoreLabel; - private final SimpleStringProperty catalogProperty = new SimpleStringProperty(""); - private final SimpleStringProperty levelProperty = new SimpleStringProperty(""); - private final SimpleIntegerProperty score1Property = new SimpleIntegerProperty(-1); - private final SimpleIntegerProperty score2Property = new SimpleIntegerProperty(-1); - private final SimpleIntegerProperty score3Property = new SimpleIntegerProperty(-1); - private final SimpleIntegerProperty score4Property = new SimpleIntegerProperty(-1); - private final SimpleIntegerProperty score5Property = new SimpleIntegerProperty(-1); - private final SimpleIntegerProperty creditLevelProperty = new SimpleIntegerProperty(-1); private final SimpleIntegerProperty totalCreditScoreProperty = new SimpleIntegerProperty(-1); - private SimpleObjectProperty imageProperty = new SimpleObjectProperty<>(); + private CustomerFileViewModel fileViewModel; - private SimpleStringProperty filePathProperty = new SimpleStringProperty(); - private SimpleStringProperty editFilePathProperty = new SimpleStringProperty(); - - @Lazy - @Autowired - private CompanyCustomerFileService companyCustomerFileService; + private SimpleBooleanProperty changed = new SimpleBooleanProperty(false); @Lazy @Autowired private CompanyCustomerEvaluationFormFileService evaluationFormFileService; - @Override public void show(Stage stage) { super.show(stage); stage.setFullScreen(false); -// Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); -// -// stage.setX(screenBounds.getMinX()); -// stage.setY(screenBounds.getMinY()); -// stage.setWidth(screenBounds.getWidth()); -// stage.setHeight(screenBounds.getHeight()); -// -// stage.isMaximized(); stage.setMaximized(true); + } + + @Override + public void onShown(WindowEvent windowEvent) { + super.onShown(windowEvent); getTitle().set("客户评估表单"); } - - @Override - protected void registerTabSkins() { - initializePane(); - } - - @Override - protected void updateViewModel(CompanyCustomerEvaluationFormFileVo entity) { - super.updateViewModel(entity); - CustomerFileVo file = companyCustomerFileService.findById(entity.getCustomerFile()); - Platform.runLater(() -> { - filePathProperty.set(file.getFilePath()); - editFilePathProperty.set(file.getEditFilePath()); - }); - } - @Override public ViewModelService getViewModelService() { return evaluationFormFileService; } + @Override + protected void initializeData() { + CompanyCustomerEvaluationFormFileViewModel viewModel = new CompanyCustomerEvaluationFormFileViewModel(); + setViewModel(viewModel); + runAsync(() -> { + CompanyCustomerEvaluationFormFileVo item = getCachedBean(CompanyCustomerEvaluationFormFileService.class) + .findByCustomerFile(fileViewModel.getId().get()); + viewModel.getId().set(item.getId()); + updateViewModel(item); + super.initializeData(); + Platform.runLater(this::initializePane); + }); + } + + @Override + protected void updateViewModel(CompanyCustomerEvaluationFormFileVo entity) { + super.updateViewModel(entity); + changed.set(false); + } + + + @Override + public BooleanBinding createTabSkinChangedBindings() { + return viewModel.getChanged().or(fileViewModel.getChanged()).or(changed); + } + + @Override + public void saveTabSkins() { + save(); + changed.setValue(false); + } + BiConsumer stringRadioGroupUpdater = (group, newValue) -> { if (newValue != null) { for (Toggle toggle : group.getToggles()) { @@ -164,14 +181,15 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit return; } } + changed.set(true); } Platform.runLater(() -> { group.selectToggle(null); -// Toggle first = group.getToggles().getFirst(); -// first.setSelected(true); -// first.setSelected(false); -// RadioButton btn = (RadioButton) first; -// btn.setText(newValue); + // Toggle first = group.getToggles().getFirst(); + // first.setSelected(true); + // first.setSelected(false); + // RadioButton btn = (RadioButton) first; + // btn.setText(newValue); }); }; @@ -182,9 +200,11 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit } String data = (String) toggle.getUserData(); property.set(data); + changed.set(true); }; BiConsumer numberRadioGroupUpdater = (group, newValue) -> { + System.out.println("group = " + group + ", newValue = " + newValue); String value = String.valueOf(newValue); for (Toggle toggle : group.getToggles()) { String data = (String) toggle.getUserData(); @@ -195,12 +215,13 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit } Platform.runLater(() -> { group.selectToggle(null); -// Toggle first = group.getToggles().getFirst(); -// first.setSelected(true); -// first.setSelected(false); -// RadioButton btn = (RadioButton) first; -// btn.setText(String.valueOf(newValue)); + // Toggle first = group.getToggles().getFirst(); + // first.setSelected(true); + // first.setSelected(false); + // RadioButton btn = (RadioButton) first; + // btn.setText(String.valueOf(newValue)); }); + changed.set(true); }; BiConsumer numberPropertyUpdater = (property, toggle) -> { @@ -210,9 +231,9 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit } String data = (String) toggle.getUserData(); property.set(Integer.parseInt(data)); + changed.set(true); }; - int totalScoreToLevel(int score) { if (score >= 200) { return 4; @@ -227,63 +248,73 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit } boolean calcValid() { - if (creditLevelProperty.get() <= 0) { + if (viewModel.getCreditLevel().get() <= 0) { return false; } - if (!StringUtils.hasText(catalogProperty.get())) { + if (!StringUtils.hasText(viewModel.getCatalog().get())) { return false; } - if (!StringUtils.hasText(levelProperty.get())) { + if (!StringUtils.hasText(viewModel.getLevel().get())) { return false; } - if (score1Property.get() <= 0) { + + if (viewModel.getScore1().get() <= 0) { return false; } - if (score2Property.get() <= 0) { + if (viewModel.getScore2().get() <= 0) { return false; } - if (score3Property.get() <= 0) { + if (viewModel.getScore3().get() <= 0) { return false; } - if (score4Property.get() <= 0) { + if (viewModel.getScore4().get() <= 0) { return false; } - if (score5Property.get() <= 0) { + if (viewModel.getScore5().get() <= 0) { return false; } - if (creditLevelProperty.get() <= 0) { + if (viewModel.getCreditLevel().get() <= 0) { return false; } return true; } private void initializePane() { + setStatus(""); idField.textProperty().bind(viewModel.getId().asString()); - filePathField.textProperty().bind(filePathProperty); - editFilePathField.textProperty().bind(editFilePathProperty); - // signDateField.valueProperty().bindBidirectional(viewModel.getSignDate()); - // validField.selectedProperty().bindBidirectional(viewModel.getValid()); - - initializeRadioGroup(catalog, catalogProperty); - initializeRadioGroup(level, levelProperty); - - initializeRadioGroup(score1, score1Property); - initializeRadioGroup(score2, score2Property); - initializeRadioGroup(score3, score3Property); - initializeRadioGroup(score4, score4Property); - initializeRadioGroup(score5, score5Property); - - creditLevelProperty.addListener((observable, oldValue, newValue) -> { - numberRadioGroupUpdater.accept(creditLevel, newValue); + filePathField.textProperty().bind(fileViewModel.getFilePath()); + editFilePathField.textProperty().bind(fileViewModel.getEditFilePath()); + String pattern = "yyyy-MM-dd"; + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); + signDateField.setConverter(new LocalDateStringConverter(formatter, null)); + signDateField.valueProperty().bindBidirectional(fileViewModel.getSignDate()); + signDateField.valueProperty().addListener((observable, oldValue, newValue) -> { + changed.set(true); }); - SimpleIntegerProperty[] scores = new SimpleIntegerProperty[]{score1Property, score2Property, score3Property, score4Property, score5Property}; + initializeRadioGroup(catalog, viewModel.getCatalog()); + initializeRadioGroup(level, viewModel.getLevel()); + + initializeRadioGroup(score1, viewModel.getScore1()); + initializeRadioGroup(score2, viewModel.getScore2()); + initializeRadioGroup(score3, viewModel.getScore3()); + initializeRadioGroup(score4, viewModel.getScore4()); + initializeRadioGroup(score5, viewModel.getScore5()); + + // 信用等级 + viewModel.getCreditLevel().addListener((observable, oldValue, newValue) -> { + numberRadioGroupUpdater.accept(creditLevel, newValue); + }); + numberRadioGroupUpdater.accept(creditLevel, viewModel.getCreditLevel().get()); + + SimpleIntegerProperty[] scores = new SimpleIntegerProperty[]{viewModel.getScore1(), viewModel.getScore2(), + viewModel.getScore3(), viewModel.getScore4(), viewModel.getScore5()}; totalCreditScoreProperty.bind(Bindings.createIntegerBinding(() -> { int total = 0; for (SimpleIntegerProperty score : scores) { total += score.get(); } - creditLevelProperty.set(totalScoreToLevel(total)); + viewModel.getCreditLevel().set(totalScoreToLevel(total)); return total; }, scores)); @@ -291,70 +322,205 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit return "合计总分:" + score; })); - Bindings.createBooleanBinding(() -> { - boolean valid = calcValid(); - // viewModel.getValid().set(valid); - return valid; - }, catalogProperty, levelProperty, score1Property, score2Property, score3Property, score4Property, score5Property, creditLevelProperty).addListener(((observable, oldValue, newValue) -> { - logger.info("valid:{}", newValue); - })); + Bindings.createBooleanBinding(this::calcValid, viewModel.getCatalog(), viewModel.getLevel(), + viewModel.getScore1(), viewModel.getScore2(), viewModel.getScore3(), viewModel.getScore4(), + viewModel.getScore5(), viewModel.getCreditLevel()) + .addListener((observable, oldValue, newValue) -> { + fileViewModel.getValid().set(newValue); + changed.set(true); + }); + validField.selectedProperty().bindBidirectional(fileViewModel.getValid()); + validField.setSelected(fileViewModel.getValid().getValue()); - - imageView.imageProperty().bind(filePathProperty.map(path -> { - if (FileUtils.withExtensions(path, FileUtils.PDF)) { - File pdfFile = new File(path); - try (PDDocument pdDocument = Loader.loadPDF(pdfFile)) { - PDFRenderer pdfRenderer = new PDFRenderer(pdDocument); - BufferedImage bufferedImage = pdfRenderer.renderImageWithDPI(0, 300); - - // 获取 BufferedImage 的宽度和高度 - int width = bufferedImage.getWidth(); - int height = bufferedImage.getHeight(); - WritableImage writableImage = new WritableImage(width, height); - PixelWriter pixelWriter = writableImage.getPixelWriter(); - // 将 BufferedImage 的像素数据复制到 WritableImage - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - int argb = bufferedImage.getRGB(x, y); - pixelWriter.setArgb(x, y, argb); - } - } - return writableImage; - } catch (Exception e) { - setStatus(e.getMessage()); - } - return null; - } else { - File file = new File(path); - Image image = new Image(file.toURI().toString()); - return image; - } - })); + fileViewModel.getFilePath().addListener((observable, oldValue, newValue) -> { + File file = new File(newValue); + loadFile(file); + }); + if (StringUtils.hasText(fileViewModel.getFilePath().get())) { + loadFile(new File(fileViewModel.getFilePath().get())); + } leftPane.widthProperty().addListener((observable, oldValue, newValue) -> { Platform.runLater(() -> { imageView.setFitWidth(leftPane.getWidth()); - imageView.setFitHeight(leftPane.getHeight()); + imageView.setFitHeight(-1); }); }); imageView.setFitWidth(leftPane.getWidth()); - imageView.setFitHeight(leftPane.getHeight()); + imageView.setFitHeight(-1); imageView.setOnScroll(event -> { - System.out.println("event = " + event); - System.out.println("event.getDeltaY() = " + event.getDeltaY()); Bounds bounds = imageView.getBoundsInLocal(); -// Bounds latestBounds = (Bounds) imageView.getProperties().get("latestBounds"); -// if (latestBounds != null) { -// double latestBoundsWidth = latestBounds.getWidth(); -// } -// if (bounds.getWidth() < leftPane.getWidth()) { imageView.setFitWidth(bounds.getWidth() + event.getDeltaY()); -// } else { - imageView.setFitHeight(bounds.getHeight() + event.getDeltaY()); -// } + imageView.setFitHeight(-1); + event.consume(); + }); + + imageView.setOnMouseClicked(event -> { + System.out.println("imageView.getFitWidth() = " + imageView.getFitWidth()); + System.out.println("imageView.getFitHeight() = " + imageView.getFitHeight()); + + System.out.println("leftPane.getWidth() = " + leftPane.getWidth()); + System.out.println("leftPane.getViewportBounds().getWidth() = " + leftPane.getViewportBounds().getWidth()); + + if (event.getClickCount() == 2 && event.getButton() == MouseButton.PRIMARY) { + Image image = imageView.getImage(); + if (image != null) { + System.out.println("image.getWidth() = " + image.getWidth()); + if (image.getWidth() > imageView.getFitWidth()) { + imageView.setFitWidth(image.getWidth()); + } else { + imageView.setFitWidth(leftPane.getWidth()); + } + imageView.setFitHeight(-1); + + } + + } + }); + } + + private void loadFile(File file) { + setStatus("文件" + file.getAbsolutePath() + " 加载中..."); + if (FileUtils.withExtensions(file.getName(), FileUtils.PDF)) { + loadPdf(file); + return; + } + Image image = new Image(file.toURI().toString(), true); + imageView.setImage(image); + } + + private void loadPdf(File pdfFile) { + // 绘制文字, 等待加载 + // 创建画布并绘制备用占位文字 + javafx.scene.canvas.Canvas canvas = new javafx.scene.canvas.Canvas(leftPane.getWidth(), leftPane.getHeight()); + GraphicsContext gc = canvas.getGraphicsContext2D(); + gc.setFill(javafx.scene.paint.Color.RED); + var h1 = javafx.scene.text.Font.font("Microsoft YaHei", FontWeight.BOLD, 24); + var h2 = javafx.scene.text.Font.font("Microsoft YaHei", FontWeight.NORMAL, 18); + gc.setFont(h1); + gc.fillText(fileViewModel.getType().get().name(), 50, 100); + + Runnable updateImage = () -> { + WritableImage writableImage = new WritableImage((int) canvas.getWidth(), (int) canvas.getHeight()); + // 将画布内容转为图像 + Platform.runLater(() -> { + canvas.snapshot(null, writableImage); + imageView.setImage(writableImage); + }); + }; + + runAsync(() -> { + CustomerFileTypeLocalVo localVo = getCachedBean(CompanyCustomerFileTypeService.class).findByLocaleAndType(getLocale(), fileViewModel.getType().get()); + gc.setFill(Color.WHITE); + // 覆盖 fileViewModel.getType() 文字 + gc.fillRect(0, 55, canvas.getWidth(), 55); + + // 绘制 文件类型 + gc.setFill(javafx.scene.paint.Color.RED); + gc.setFont(h1); + gc.fillText(localVo.getValue(), 50, 100); + + updateImage.run(); + }); + + gc.setStroke(javafx.scene.paint.Color.BLACK); + gc.setFont(h2); + gc.strokeText("正在加载文件..." + pdfFile.getName(), 50, 150); + updateImage.run(); + + runAsync(() -> { + + //FileSystemUtils. + long fileSize = pdfFile.length(); + byte[] bytes = new byte[0]; + try (java.io.FileInputStream fis = new java.io.FileInputStream(pdfFile); + java.io.BufferedInputStream bis = new java.io.BufferedInputStream(fis)) { + + bytes = new byte[(int) fileSize]; + int totalBytesRead = 0; + int bytesRead; + byte[] buffer = new byte[8192]; // 8KB buffer + + while ((bytesRead = bis.read(buffer)) != -1) { + System.arraycopy(buffer, 0, bytes, totalBytesRead, bytesRead); + totalBytesRead += bytesRead; + + // 更新进度 + double progress = (double) totalBytesRead / fileSize * 100; + final String status = String.format("正在加载文件... %s (%.1f%%)", + pdfFile.getName(), progress); + + gc.setFill(Color.WHITE); + gc.fillRect(0, 200, canvas.getWidth(), 80); + + + gc.setFill(Color.BLACK); + gc.setFont(h2); + gc.fillText(status, 50, 250); + + + // 绘制进度条背景 + gc.setFill(Color.LIGHTGRAY); + gc.fillRect(50, 270, 400, 20); + + // 绘制进度条 + gc.setFill(Color.GREEN); + gc.fillRect(50, 270, 400 * (totalBytesRead / (double) fileSize), 20); + + // 绘制进度条边框 + gc.setStroke(Color.BLACK); + gc.setLineWidth(1); + gc.strokeRect(50, 270, 400, 20); + + + updateImage.run(); + } + + gc.setFill(Color.BLACK); + gc.setFont(h2); + gc.fillText("Loading file: " + pdfFile.getName() + ", size: " + bytes.length + " bytes", 50, 320); + updateImage.run(); + + } catch (Exception e) { + throw new RuntimeException(e); + } + + try (PDDocument pdDocument = Loader.loadPDF(bytes)) { + gc.setFill(Color.BLACK); + gc.setFont(h2); + gc.fillText("PDF has " + pdDocument.getNumberOfPages() + " pages", 50, 380); + updateImage.run(); + + PDFRenderer pdfRenderer = new PDFRenderer(pdDocument); + + BufferedImage bufferedImage = pdfRenderer.renderImageWithDPI(0, 300); + + // 获取 BufferedImage 的宽度和高度 + int width = bufferedImage.getWidth(); + int height = bufferedImage.getHeight(); + canvas.resize(width, height); + GraphicsContext graphic = canvas.getGraphicsContext2D(); + + WritableImage writableImage1 = new WritableImage(width, height); + + PixelWriter pixelWriter = writableImage1.getPixelWriter(); + // 将 BufferedImage 的像素数据复制到 WritableImage + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int argb = bufferedImage.getRGB(x, y); + pixelWriter.setArgb(x, y, argb); + } + } + setStatus(); + Platform.runLater(() -> { + imageView.setImage(writableImage1); + }); + } catch (Exception e) { + setStatus(e.getMessage()); + } }); } @@ -365,6 +531,7 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> { stringPropertyUpdater.accept(property, newValue); }); + stringRadioGroupUpdater.accept(toggleGroup, property.getValue()); } private void initializeRadioGroup(ToggleGroup toggleGroup, SimpleIntegerProperty property) { @@ -375,21 +542,8 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> { numberPropertyUpdater.accept(property, newValue); }); + numberRadioGroupUpdater.accept(toggleGroup, property.getValue()); } - private void update(CompanyCustomerEvaluationFormFileVo formFile) { - viewModel.update(formFile); - -// formFile.getScoreTemplateVersion(); - - catalogProperty.set(formFile.getCatalog()); - levelProperty.set(formFile.getLevel()); - score1Property.set(formFile.getScore1()); - score2Property.set(formFile.getScore2()); - score3Property.set(formFile.getScore3()); - score4Property.set(formFile.getScore4()); - score5Property.set(formFile.getScore5()); - creditLevelProperty.set(formFile.getCreditLevel()); - } } diff --git a/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java b/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java index 71b374f..e06e34b 100644 --- a/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java +++ b/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java @@ -161,9 +161,7 @@ public class CustomerTabSkinFile // 文件不是 Excel 文件时,打开编辑UI if (!FileUtils.withExtensions(item.getFilePath().get(), FileUtils.XLS, FileUtils.XLSX)) { - CompanyCustomerEvaluationFormFileVo evaluationFormFile = getEvaluationFormFileService() - .findByCustomerFile(item.getId().get()); - CompanyCustomerEvaluationFormFileWindowController.show(evaluationFormFile, + CompanyCustomerEvaluationFormFileWindowController.show(item, controller.root.getScene().getWindow()); return; } @@ -211,10 +209,7 @@ public class CustomerTabSkinFile model.update(saved); dataSet.add(model); - CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCachedBean( - CompanyCustomerEvaluationFormFileService.class).findByCustomerFile(saved); - - CompanyCustomerEvaluationFormFileWindowController.show(evaluationFormFile, + CompanyCustomerEvaluationFormFileWindowController.show(model, getTableView().getScene().getWindow()); }); return; diff --git a/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinBankAccount.java b/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinBankAccount.java index bc56085..19b7b6b 100644 --- a/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinBankAccount.java +++ b/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinBankAccount.java @@ -69,11 +69,6 @@ public class CompanyTabSkinBankAccount bankAccountTable_openingBankColumn.setCellValueFactory(param -> param.getValue().getOpeningBank()); bankAccountTable_accountColumn.setCellValueFactory(param -> param.getValue().getAccount()); - - bankAccountTable_menu_refresh.setOnAction(this::onTableRefreshAction); - bankAccountTable_menu_add.setOnAction(this::onTableAddAction); - bankAccountTable_menu_del.setOnAction(this::onTableDeleteAction); - super.initializeTab(); } diff --git a/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinOther.java b/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinOther.java index 0aaf913..fa847e8 100644 --- a/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinOther.java +++ b/client/src/main/java/com/ecep/contract/controller/tab/CompanyTabSkinOther.java @@ -97,8 +97,10 @@ public class CompanyTabSkinOther // Yu // public TitledPane yuCloudPane; public TextField cloudYuIdField; - public TextField cloudYuCloudIdField; public TextField cloudYuLatestField; + public TextField cloudYuVendorUpdateDateField; + public TextField cloudYuCustomerUpdateDateField; + public CheckBox cloudYuActiveField; public Label cloudYuVersionLabel; public Button yuCloudPaneSaveButton; @@ -417,8 +419,10 @@ public class CompanyTabSkinOther } cloudYuIdField.textProperty().bind(yuCloudInfoViewModel.getId().asString()); - cloudYuCloudIdField.textProperty().bindBidirectional(yuCloudInfoViewModel.getCloudId()); cloudYuLatestField.textProperty().bind(yuCloudInfoViewModel.getLatestUpdate().map(MyDateTimeUtils::format)); + cloudYuVendorUpdateDateField.textProperty().bind(yuCloudInfoViewModel.getVendorUpdateDate().map(MyDateTimeUtils::format)); + cloudYuCustomerUpdateDateField.textProperty().bind(yuCloudInfoViewModel.getCustomerUpdateDate().map(MyDateTimeUtils::format)); + cloudYuActiveField.selectedProperty().bindBidirectional(yuCloudInfoViewModel.getActive()); cloudYuVersionLabel.textProperty().bind(yuCloudInfoViewModel.getVersion().asString("Ver:%s")); Button button = yuCloudPaneSaveButton; @@ -436,6 +440,34 @@ public class CompanyTabSkinOther button.setDisable(false); }); }); + + DelayOnceExecutor saveExecutor = new DelayOnceExecutor(() -> { + save(yuCloudInfoViewModel); + cloudYuActiveField.setBorder(null); + }, 2, TimeUnit.SECONDS).exception(e -> logger.error(e.getMessage(), e)); + cloudYuActiveField.setOnMouseClicked(event -> { + cloudYuActiveField.setBorder(Border.stroke(Color.RED)); + saveExecutor.tick(); + }); + } + + public void save(CloudYuInfoViewModel viewModel) { + int infoId = viewModel.getId().get(); + YongYouU8Service service = getYongYouU8Service(); + CloudYuVo cloudYu = service.findById(infoId); + if (cloudYu == null) { + throw new RuntimeException("CloudTyc not found"); + } + if (viewModel.copyTo(cloudYu)) { + CloudYuVo saved = service.save(cloudYu); + if (Platform.isFxApplicationThread()) { + viewModel.update(saved); + } else { + Platform.runLater(() -> { + viewModel.update(saved); + }); + } + } } private void onCloudYuUpdateButtonClicked(ActionEvent event) { @@ -516,9 +548,11 @@ public class CompanyTabSkinOther CompanyExtendInfoViewModel viewModel = extendInfoViewModel; CompanyExtendInfoService service = getExtendInfoService(); CompanyExtendInfoVo extendInfo = service.findByCompany(company); - Platform.runLater(() -> { - viewModel.update(extendInfo); - }); + if (extendInfo != null) { + Platform.runLater(() -> { + viewModel.update(extendInfo); + }); + } } CloudRkService getCloudRkService() { diff --git a/client/src/main/java/com/ecep/contract/controller/table/cell/VendorTypeTableCell.java b/client/src/main/java/com/ecep/contract/controller/table/cell/VendorTypeTableCell.java index 1221f82..613a4e9 100644 --- a/client/src/main/java/com/ecep/contract/controller/table/cell/VendorTypeTableCell.java +++ b/client/src/main/java/com/ecep/contract/controller/table/cell/VendorTypeTableCell.java @@ -42,7 +42,6 @@ public class VendorTypeTableCell extends AsyncUpdateTableCell { } private File getVendorApprovedListTemplate() { - return getVendorService().getVendorApprovedListTemplate(); + String path = getConfService().getString(CompanyVendorConstant.KEY_APPROVED_LIST_TEMPLATE); + return new File(path); } @Override diff --git a/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListVendorImportTask.java b/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListVendorImportTask.java index 0df9e20..704062b 100644 --- a/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListVendorImportTask.java +++ b/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListVendorImportTask.java @@ -95,6 +95,7 @@ public class VendorApprovedListVendorImportTask extends Tasker { } service = getBean(VendorApprovedService.class); + // 检索供方 VendorService vendorService = getBean(VendorService.class); Page page = vendorService.findAll( ParamUtils.builder() @@ -136,7 +137,17 @@ public class VendorApprovedListVendorImportTask extends Tasker { // 明确 company 实例 CompanyVo company = initializedVendorCompany(vendor); if (company == null) { - // 无效 + // 无效, 删除异常数据 + holder.error("供方(#" + vendor.getId() + ")无对应的公司消息"); + List items = getItemService().findAllByListAndVendor(approvedList, vendor); + if (items != null && !items.isEmpty()) { + // 删除 + MessageHolder subHolder = holder.sub(" - "); + items.forEach(item -> { + getItemService().delete(item); + subHolder.info("删除 #" + item.getId() + ", " + item.getVendorName()); + }); + } return; } @@ -144,15 +155,15 @@ public class VendorApprovedListVendorImportTask extends Tasker { VendorType vendorType = vendor.getType(); if (vendorType == null) { - subHolder.error("供方的分类为空"); - return; + subHolder.debug("供方分类未设置"); } // 确认供方的developDate 是否在供方名录的发布日期之后 LocalDate developDate = vendor.getDevelopDate(); if (developDate == null) { - subHolder.error("供方的开发日期为空"); + subHolder.error("开发日期未设置"); } else if (developDate.isAfter(approvedList.getPublishDate())) { + subHolder.info("开发日期在供方名录发布之后, 跳过..."); return; } @@ -160,108 +171,13 @@ public class VendorApprovedListVendorImportTask extends Tasker { List items = getItemService().findAllByListAndVendor(approvedList, vendor); if (items == null || items.isEmpty()) { // 供方不在供方名录中时,新建一个 - VendorApprovedItemVo item = new VendorApprovedItemVo(); - item.setListId(approvedList.getId()); - item.setVendorId(vendor.getId()); - - // 当前供应商分类是不合格供应商时 - if (vendorType == VendorType.UNQUALIFIED) { - // 检索查看供方的评价表, 看与发布日期期间是否有评价表 - if (!checkAsQualifiedVendorByEvaluationFormFiles(vendor, item, subHolder)) { - // 不合同供方,跳过 - if (logUnqualifiedVendor) { - subHolder.info("供方是不合格供方, 不纳入名录"); - } - // 上一年度的供方目录中是否有此供应商 - return; - } - item.setDescription(""); - } - // 当前供应商分类是合格供方时 - else if (vendorType == VendorType.TYPICALLY) { - // 协议经销商,认定为合格供方 - if (vendor.isProtocolProvider()) { - item.setType(VendorType.QUALIFIED); - item.setDescription("协议经销商"); - } - // 非协议经销商 - else { - // 查看供方的合同,看近3年期间是否有合同 - List contracts = findAllVendorContracts(vendor, approvedList.getPublishDate()); - if (contracts.isEmpty()) { - // 没有合同,应该归入不合格供应商 - // 保持一般供应商分类,后期流程处理是否变更分类 - item.setType(VendorType.TYPICALLY); - if (logTypicallyVendorNoThreeYearContract) { - subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商"); - } - item.setDescription(STR_MEET_UNQUALIFIED); - } else { - // 检查近3年期间是否都有合同 - if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) { - // 每年都有合同,合同数是否符合合格供方标准 - if (checkAllYearMinHasContract(contracts, approvedList.getPublishDate())) { - // 保持一般供应商分类,后期流程处理是否变更分类 - item.setType(VendorType.TYPICALLY); - subHolder.info("供方近" + vendorContractMinusYear + "年每年都有合作, 符合合格供方标准"); - item.setDescription(STR_MEET_QUALIFIED); - } else { - item.setType(VendorType.TYPICALLY); - subHolder.warn("供方近" + vendorContractMinusYear + "年每年都有合作, 但是合同数不足, 应转为一般供应商"); - item.setDescription(STR_MEET_TYPICALLY); - } - } else { - item.setType(VendorType.TYPICALLY); - item.setDescription(""); - } - } - } - } - // 当前供应商分类是合格供方时 - else if (vendorType == VendorType.QUALIFIED) { - // 查看供方的合同,看近3年期间是否有合同 - List contracts = findAllVendorContracts(vendor, approvedList.getPublishDate()); - item.setType(vendorType); - if (contracts.isEmpty()) { - if (logTypicallyVendorNoThreeYearContract) { - subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商"); - } - item.setDescription(STR_MEET_UNQUALIFIED); - } else { - // 检查近3年期间是否都有合同 - if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) { - // 每年都有合同,合同数是否符合合格供方标准 - if (checkAllYearMinHasContract(contracts, approvedList.getPublishDate())) { - item.setDescription(""); - } else { - subHolder.warn("供方近" + vendorContractMinusYear + "年每年都有合作, 但是合同数不足, 应转为一般供应商"); - item.setDescription(STR_MEET_TYPICALLY); - } - } else { - subHolder.warn("供方近" + vendorContractMinusYear + "年非每年都有合作"); - item.setDescription(""); - } - } - } - // 未知分类时 - else { - item.setDescription("未知供方分类"); - } - - // 匹配的历史名称 - updateVendorNameWithOldName(vendor, item); - getItemService().save(item); + syncWhenNoItem(vendor, company, subHolder); return; } - if (items.size() == 1) { - VendorApprovedItemVo first = items.getFirst(); - if (!StringUtils.hasText(first.getVendorName())) { - updateVendorNameWithOldName(vendor, first); - } - updateItem(vendor, first, subHolder); - return; - } + VendorApprovedItemVo first = items.getFirst(); + syncItem(vendor, company, first, subHolder); + for (int i = 1; i < items.size(); i++) { VendorApprovedItemVo item = items.get(i); @@ -270,11 +186,123 @@ public class VendorApprovedListVendorImportTask extends Tasker { } } - private void updateVendorNameWithOldName(VendorVo vendor, VendorApprovedItemVo item) { - CompanyVo company = initializedVendorCompany(vendor); - if (company == null) { + /** + * 当没有匹配的供方名录项时 + * + * @param vendor + * @param company + * @param subHolder + */ + private void syncWhenNoItem(VendorVo vendor, CompanyVo company, MessageHolder subHolder) { + VendorType vendorType = vendor.getType(); + if (vendorType == null) { + subHolder.debug("供方分类未设置"); + } + + VendorApprovedItemVo item = new VendorApprovedItemVo(); + item.setListId(approvedList.getId()); + item.setVendorId(vendor.getId()); + + // 当前供应商分类是不合格供应商时 + if (vendorType == VendorType.UNQUALIFIED) { + // 检索查看供方的评价表, 看与发布日期期间是否有评价表 + if (!checkAsQualifiedVendorByEvaluationFormFiles(vendor, item, subHolder)) { + // 不合同供方,跳过 + if (logUnqualifiedVendor) { + subHolder.info("供方是不合格供方, 不纳入名录"); + } + // 上一年度的供方目录中是否有此供应商 + return; + } + item.setDescription(""); + } + // 当前供应商分类是合格供方时 + else if (vendorType == VendorType.TYPICALLY) { + // 协议经销商,认定为合格供方 + if (vendor.isProtocolProvider()) { + item.setType(VendorType.QUALIFIED); + item.setDescription("协议经销商"); + } + // 非协议经销商 + else { + // 查看供方的合同,看近3年期间是否有合同 + List contracts = findAllVendorContracts(vendor, approvedList.getPublishDate()); + if (contracts.isEmpty()) { + // 没有合同,应该归入不合格供应商 + // 保持一般供应商分类,后期流程处理是否变更分类 + item.setType(VendorType.TYPICALLY); + if (logTypicallyVendorNoThreeYearContract) { + subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商"); + } + item.setDescription(STR_MEET_UNQUALIFIED + "(缺合同1)"); + } else { + // 检查近3年期间是否都有合同 + if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) { + // 每年都有合同,合同数是否符合合格供方标准 + if (checkAllYearMinHasContract(contracts, approvedList.getPublishDate())) { + // 保持一般供应商分类,后期流程处理是否变更分类 + item.setType(VendorType.TYPICALLY); + subHolder.info("供方近" + vendorContractMinusYear + "年每年都有合作, 符合合格供方标准"); + item.setDescription(STR_MEET_QUALIFIED); + } else { + item.setType(VendorType.TYPICALLY); + subHolder.warn("供方近" + vendorContractMinusYear + "年每年都有合作, 但是合同数不足, 应转为一般供应商"); + item.setDescription(STR_MEET_TYPICALLY); + } + } else { + item.setType(VendorType.TYPICALLY); + item.setDescription(""); + } + } + } + } + // 当前供应商分类是合格供方时 + else if (vendorType == VendorType.QUALIFIED) { + // 查看供方的合同,看近3年期间是否有合同 + List contracts = findAllVendorContracts(vendor, approvedList.getPublishDate()); + item.setType(vendorType); + if (contracts.isEmpty()) { + if (logTypicallyVendorNoThreeYearContract) { + subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商"); + } + item.setDescription(STR_MEET_UNQUALIFIED + "(缺合同2)"); + } else { + // 检查近3年期间是否都有合同 + if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) { + // 每年都有合同,合同数是否符合合格供方标准 + if (checkAllYearMinHasContract(contracts, approvedList.getPublishDate())) { + item.setDescription(""); + } else { + subHolder.warn("供方近" + vendorContractMinusYear + "年每年都有合作, 但是合同数不足, 应转为一般供应商"); + item.setDescription(STR_MEET_TYPICALLY); + } + } else { + subHolder.warn("供方近" + vendorContractMinusYear + "年非每年都有合作"); + item.setDescription(""); + } + } + } + // 未知分类时 + else { + item.setDescription("未知供方分类"); + } + + // 匹配的历史名称 + updateVendorNameWithOldName(company, item); + getItemService().save(item); + } + + /** + * 匹配历史名称,当前供方名称为空时 + * @param company + * @param item + */ + private void updateVendorNameWithOldName(CompanyVo company, VendorApprovedItemVo item) { + if (StringUtils.hasText(item.getVendorName())) { + // 已经有供方名称时,不更新 return; } + CompanyOldNameVo companyOldName = getCompanyOldNameService().findMatchByDate(company, approvedList.getPublishDate()); if (companyOldName != null) { @@ -288,11 +316,12 @@ public class VendorApprovedListVendorImportTask extends Tasker { @Setter private boolean logUnqualifiedVendorRemove = true; - private void updateItem( - VendorVo vendor, VendorApprovedItemVo item, MessageHolder holder) { + private void syncItem( + VendorVo vendor, CompanyVo company, VendorApprovedItemVo item, MessageHolder holder) { VendorType t1 = item.getType(); VendorType vendorType = vendor.getType(); VendorApprovedItemService itemService = getItemService(); + updateVendorNameWithOldName(company, item); if (t1 != vendorType) { holder.warn("注意分类不一致, " + t1 + ", " + vendorType + "."); } diff --git a/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListWindowController.java b/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListWindowController.java index 5125dc3..5905512 100644 --- a/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListWindowController.java +++ b/client/src/main/java/com/ecep/contract/controller/vendor/approved_list/VendorApprovedListWindowController.java @@ -2,6 +2,7 @@ package com.ecep.contract.controller.vendor.approved_list; import java.io.File; +import com.ecep.contract.task.VendorApprovedListMakePathTask; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -104,15 +105,13 @@ public class VendorApprovedListWindowController } public void onApprovedListCreatePathAction(ActionEvent event) { + VendorApprovedListMakePathTask task = new VendorApprovedListMakePathTask(); + task.setApprovedList(getEntity()); + UITools.showTaskDialogAndWait("创建目录", task, null); + int id = viewModel.getId().get(); VendorApprovedVo list = service.findById(id); - - if (service.makePathAbsent(list)) { - VendorApprovedVo saved = service.save(list); - viewModel.update(saved); - } else { - setStatus("目录存在或创建失败"); - } + viewModel.update(list); } public void onApprovedListChangePathAction(ActionEvent event) { @@ -123,8 +122,4 @@ public class VendorApprovedListWindowController task.setApprovedList(getEntity()); UITools.showTaskDialogAndWait("导出供方", task, null); } - - private void save(ActionEvent event) { - saveTabSkins(); - } } diff --git a/client/src/main/java/com/ecep/contract/converter/VendorCatalogStringConverter.java b/client/src/main/java/com/ecep/contract/converter/VendorCatalogStringConverter.java index 1206d6e..7147003 100644 --- a/client/src/main/java/com/ecep/contract/converter/VendorCatalogStringConverter.java +++ b/client/src/main/java/com/ecep/contract/converter/VendorCatalogStringConverter.java @@ -13,6 +13,9 @@ public class VendorCatalogStringConverter extends StringConverter page = findAll(ParamUtils.builder() - .equals("customerFile", customerFileId) - .build(), Pageable.ofSize(1)) - .getContent(); - if (page.isEmpty()) { - return null; - } - return page.getFirst(); + return findOneByProperty("customerFile", customerFileId); } public List searchByCompany(Integer companyId, String searchText) { diff --git a/client/src/main/java/com/ecep/contract/service/CompanyCustomerFileTypeService.java b/client/src/main/java/com/ecep/contract/service/CompanyCustomerFileTypeService.java index 109ac52..e586889 100644 --- a/client/src/main/java/com/ecep/contract/service/CompanyCustomerFileTypeService.java +++ b/client/src/main/java/com/ecep/contract/service/CompanyCustomerFileTypeService.java @@ -25,7 +25,7 @@ import javafx.util.StringConverter; @CacheConfig(cacheNames = "company-customer-file-type") public class CompanyCustomerFileTypeService extends QueryService { - private final StringConverter stringConverter = new CustomerFileTypeStringConverter(this); + private final CustomerFileTypeStringConverter stringConverter = new CustomerFileTypeStringConverter(this); @Cacheable(key = "#p0") @Override diff --git a/client/src/main/java/com/ecep/contract/service/CompanyOldNameService.java b/client/src/main/java/com/ecep/contract/service/CompanyOldNameService.java index 65dbffe..cf4ab67 100644 --- a/client/src/main/java/com/ecep/contract/service/CompanyOldNameService.java +++ b/client/src/main/java/com/ecep/contract/service/CompanyOldNameService.java @@ -71,11 +71,16 @@ public class CompanyOldNameService extends QueryService findAllByCompanyAndName(CompanyVo company, String oldName) { - return findAll(ParamUtils.builder().equals("company", company.getId()).equals("oldName", oldName).build(), + return findAll(ParamUtils.builder().equals("company", company.getId()).equals("name", oldName).build(), Pageable.unpaged()).getContent(); } diff --git a/client/src/main/java/com/ecep/contract/service/ContractFileTypeService.java b/client/src/main/java/com/ecep/contract/service/ContractFileTypeService.java index 34f8ff4..8c76d63 100644 --- a/client/src/main/java/com/ecep/contract/service/ContractFileTypeService.java +++ b/client/src/main/java/com/ecep/contract/service/ContractFileTypeService.java @@ -2,6 +2,7 @@ package com.ecep.contract.service; import java.util.Locale; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.function.Function; import java.util.stream.Collectors; @@ -9,6 +10,7 @@ import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Caching; +import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -37,13 +39,13 @@ public class ContractFileTypeService extends QueryService> asyncFindAll(Locale locale) { + return asyncFindAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).build(), Pageable.unpaged()); + } + @Cacheable public ContractFileTypeLocalVo findByType(Locale locale, ContractFileType type) { return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).equals("type", type).build(), Pageable.ofSize(1)).stream().findFirst().orElse(null); @@ -67,7 +73,7 @@ public class ContractFileTypeService extends QueryService { public VendorApprovedFileVo findByName(VendorApprovedVo approvedList, String name) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'findByName'"); + return findOneByProperty(approvedList, "fileName", name); } - public boolean reBuildingFiles(VendorApprovedVo list, MessageHolder holder) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'"); + public VendorApprovedFileVo findOneByProperty(VendorApprovedVo list, String propertyName, Object propertyValue) { + return findAll(ParamUtils.builder() + .equals("list", list.getId()) + .equals(propertyName, propertyValue) + .build(), Pageable.ofSize(1)).stream() + .findFirst().orElse(null); } - } diff --git a/client/src/main/java/com/ecep/contract/service/VendorApprovedItemService.java b/client/src/main/java/com/ecep/contract/service/VendorApprovedItemService.java index 105084d..24ac17e 100644 --- a/client/src/main/java/com/ecep/contract/service/VendorApprovedItemService.java +++ b/client/src/main/java/com/ecep/contract/service/VendorApprovedItemService.java @@ -2,6 +2,7 @@ package com.ecep.contract.service; import java.util.List; +import com.ecep.contract.vo.VendorApprovedFileVo; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -23,4 +24,12 @@ public class VendorApprovedItemService .build(), Pageable.unpaged()).getContent(); } + public VendorApprovedItemVo findOneByProperty(VendorApprovedVo list, String propertyName, Object propertyValue) { + return findAll(ParamUtils.builder() + .equals("list", list.getId()) + .equals(propertyName, propertyValue) + .build(), Pageable.ofSize(1)).stream() + .findFirst().orElse(null); + } + } diff --git a/client/src/main/java/com/ecep/contract/service/VendorApprovedService.java b/client/src/main/java/com/ecep/contract/service/VendorApprovedService.java index bd10dda..7623ed2 100644 --- a/client/src/main/java/com/ecep/contract/service/VendorApprovedService.java +++ b/client/src/main/java/com/ecep/contract/service/VendorApprovedService.java @@ -6,23 +6,23 @@ import com.ecep.contract.MessageHolder; import com.ecep.contract.vm.CompanyVendorApprovedListViewModel; import com.ecep.contract.vo.VendorApprovedVo; +import java.util.concurrent.ExecutionException; + @Service public class VendorApprovedService extends QueryService { - public boolean makePathAbsent(VendorApprovedVo list) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'makePathAbsent'"); - } - - public boolean reBuildingFiles(VendorApprovedVo list, MessageHolder holder) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'"); - } - public boolean existPath(VendorApprovedVo entity) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'existPath'"); + try { + return async("existPath", entity.getId(), Integer.class).handle((response, ex) -> { + if (ex != null) { + throw new RuntimeException("远程方法+existPath+调用失败", ex); + } + return response != null && response.isBoolean() && response.asBoolean(); + }).get(); + } catch (Exception e) { + throw new RuntimeException(e); + } } } diff --git a/client/src/main/java/com/ecep/contract/service/VendorService.java b/client/src/main/java/com/ecep/contract/service/VendorService.java index 1d1f7a0..c3983cc 100644 --- a/client/src/main/java/com/ecep/contract/service/VendorService.java +++ b/client/src/main/java/com/ecep/contract/service/VendorService.java @@ -43,15 +43,6 @@ public class VendorService extends QueryService implements WebSocketClientTasker { + private static final String TASK_NAME = "ContractSyncAllTask"; -public class ContractSyncAllTask extends Tasker { @Override - public Object execute(MessageHolder holder) { - return null; + public String getTaskName() { + return TASK_NAME; } + @Override + public void updateProgress(long current, long total) { + super.updateProgress(current, total); + } + + @Override + public Object execute(MessageHolder holder) { + // 更新任务状态信息 + updateTitle("开始合同全量同步任务"); + holder.info("准备连接服务器进行合同数据同步..."); + + try { + // 调用远程任务 + Object result = callRemoteTask(holder, Locale.getDefault()); + holder.info("合同全量同步任务完成"); + return result; + } catch (Exception e) { + holder.error("同步失败: " + e.getMessage()); + return null; + } + } } diff --git a/client/src/main/java/com/ecep/contract/task/VendorApprovedListMakePathTask.java b/client/src/main/java/com/ecep/contract/task/VendorApprovedListMakePathTask.java new file mode 100644 index 0000000..51b1e5b --- /dev/null +++ b/client/src/main/java/com/ecep/contract/task/VendorApprovedListMakePathTask.java @@ -0,0 +1,55 @@ +package com.ecep.contract.task; + +import com.ecep.contract.MessageHolder; +import com.ecep.contract.WebSocketClientTasker; +import com.ecep.contract.vo.VendorApprovedVo; + +import lombok.Getter; +import lombok.Setter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 合格供方名录生成路径任务器客户端实现 + * 用于通过WebSocket与服务器通信,为合格供方名录生成文件路径 + */ +public class VendorApprovedListMakePathTask extends Tasker implements WebSocketClientTasker { + private static final Logger logger = LoggerFactory.getLogger(VendorApprovedListMakePathTask.class); + + @Getter + @Setter + private VendorApprovedVo approvedList; + + @Getter + protected boolean modified = false; + + @Override + public String getTaskName() { + return "VendorApprovedListMakePathTask"; + } + + @Override + public void updateProgress(long current, long total) { + super.updateProgress(current, total); + } + + @Override + protected Object execute(MessageHolder holder) throws Exception { + updateTitle("生成合格供方名录文件路径"); + if (approvedList == null) { + holder.addMessage(java.util.logging.Level.SEVERE, "合格供方名录信息不能为空"); + return null; + } + return callRemoteTask(holder, getLocale(), approvedList.getId()); + } + + /** + * 处理从服务器返回的修改状态 + * 当服务器端更新此属性时,客户端会接收到更新 + * + * @param modified 文件是否被修改 + */ + public void setModified(boolean modified) { + this.modified = modified; + } +} \ No newline at end of file diff --git a/client/src/main/java/com/ecep/contract/util/ParamUtils.java b/client/src/main/java/com/ecep/contract/util/ParamUtils.java index d7cc7c0..27690e5 100644 --- a/client/src/main/java/com/ecep/contract/util/ParamUtils.java +++ b/client/src/main/java/com/ecep/contract/util/ParamUtils.java @@ -2,10 +2,11 @@ package com.ecep.contract.util; import java.time.LocalDate; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.function.Consumer; -import com.ecep.contract.constant.ServiceConstant; +import com.ecep.contract.constant.ParamConstant; /** * 参数工具类,用于构建查询条件参数 @@ -103,6 +104,7 @@ public class ParamUtils { */ public static class Builder { // 存储构建的查询参数 + private String searchText; private Map params = new HashMap<>(); /** @@ -112,6 +114,18 @@ public class ParamUtils { private Builder() { } + private void addParam(String field, String action, Object value) { + Object map = params.computeIfAbsent(field, k -> new HashMap<>()); + if (map instanceof Map) { + ((Map) map).put(action, value); + return; + } + HashMap m = new HashMap<>(); + m.put(action, value); + m.put(ParamConstant.KEY_equal, map); + params.put(field, m); + } + /** * 添加非空条件到构建器 * @@ -119,7 +133,7 @@ public class ParamUtils { * @return 当前Builder实例,支持链式调用 */ public Builder isNotNull(String key) { - params.put(key, Map.of("isNotNull", true)); + addParam(key, ParamConstant.KEY_isNotNull, true); return this; } @@ -131,7 +145,7 @@ public class ParamUtils { * @return 当前Builder实例,支持链式调用 */ public Builder lessThan(String key, LocalDate value) { - params.put(key, Map.of("lessThan", value)); + addParam(key, ParamConstant.KEY_lessThan, value); return this; } @@ -143,7 +157,7 @@ public class ParamUtils { * @return 当前Builder实例,支持链式调用 */ public Builder greaterThan(String key, LocalDate value) { - params.put(key, Map.of("greaterThan", value)); + addParam(key, ParamConstant.KEY_greaterThan, value); return this; } @@ -155,7 +169,7 @@ public class ParamUtils { * @return 当前Builder实例,支持链式调用 */ public Builder equals(String key, Object value) { - params.put(key, value); + addParam(key, ParamConstant.KEY_equal, value); return this; } @@ -168,10 +182,7 @@ public class ParamUtils { * @return 当前Builder实例,支持链式调用 */ public Builder between(String key, LocalDate begin, LocalDate end) { - Map params = new HashMap<>(); - params.put("begin", begin); - params.put("end", end); - this.params.put(key, params); + addParam(key, ParamConstant.KEY_between, new Object[]{begin, end}); return this; } @@ -183,17 +194,34 @@ public class ParamUtils { * @return 当前Builder实例,支持链式调用 */ public Builder search(String searchText) { - params.put(ServiceConstant.KEY_SEARCH_TEXT, searchText); + this.searchText = searchText; return this; } /** * 构建并返回查询参数Map + *
+         * {
+         *   searchText: "搜索文本",
+         *   and: [
+         *     {field: "字段名", action: "equal", value: "值"},
+         *     {field: "字段名", action: "between", value: [begin, end]}
+         *     {field: "字段名", action: "or", value: [
+         *       {field: "字段名", action: "equal", value: "值"},
+         *     ]}
+         *   ],
+         *   or: [
+         *     {field: "字段名", action: "操作符", value: "值"}
+         *   ]
+         * }
+         * 
* * @return 包含所有添加条件的查询参数Map */ public Map build() { - return params; + Map map = new HashMap<>(); + map.put(ParamConstant.KEY_SEARCH_TEXT, searchText); + return map; } /** @@ -205,7 +233,7 @@ public class ParamUtils { public Builder and(Consumer consumer) { Builder builder = new Builder(); consumer.accept(builder); - params.put("and", builder); + params.put(ParamConstant.KEY_AND, builder); return this; } @@ -218,7 +246,7 @@ public class ParamUtils { public Builder or(Consumer consumer) { Builder builder = new Builder(); consumer.accept(builder); - params.put("or", builder); + params.put(ParamConstant.KEY_OR, builder); return this; } diff --git a/client/src/main/java/com/ecep/contract/util/UITools.java b/client/src/main/java/com/ecep/contract/util/UITools.java index ec8f525..8932b7a 100644 --- a/client/src/main/java/com/ecep/contract/util/UITools.java +++ b/client/src/main/java/com/ecep/contract/util/UITools.java @@ -211,7 +211,6 @@ public class UITools { Platform.runLater(() -> { box.getChildren().add(progressBar); - System.out.println("add progressBar = " + progressBar); }); // progressBar.disabledProperty().bind(task.runningProperty()); @@ -223,19 +222,17 @@ public class UITools { if (task instanceof Tasker tasker) { // 提交任务 - try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) { - executor.submit(tasker); - } + new Thread(tasker).start(); +// try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) { +// executor.submit(tasker); +// System.out.println("executor = " + executor); +// } } if (init != null) { init.accept(consumer::test); } dialog.showAndWait(); - if (task.getProgress() < 1) { - task.cancel(); - } -// if (task.isRunning()) { -// } + task.cancel(); } private static String printStackTrace(Throwable e) { diff --git a/client/src/main/java/com/ecep/contract/vm/CloudYuInfoViewModel.java b/client/src/main/java/com/ecep/contract/vm/CloudYuInfoViewModel.java index 121b136..51b9236 100644 --- a/client/src/main/java/com/ecep/contract/vm/CloudYuInfoViewModel.java +++ b/client/src/main/java/com/ecep/contract/vm/CloudYuInfoViewModel.java @@ -6,6 +6,7 @@ import java.util.Objects; import com.ecep.contract.vo.CloudYuVo; +import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; @@ -15,10 +16,6 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = false) public class CloudYuInfoViewModel extends IdentityViewModel { - /** - * 云端Id - */ - private SimpleStringProperty cloudId = new SimpleStringProperty(); /** * 公司ID */ @@ -28,15 +25,16 @@ public class CloudYuInfoViewModel extends IdentityViewModel { */ private SimpleObjectProperty latestUpdate = new SimpleObjectProperty<>(); - private SimpleStringProperty vendorCode = new SimpleStringProperty(); - private SimpleStringProperty vendorClassCode = new SimpleStringProperty(); - private SimpleObjectProperty vendorDevelopDate = new SimpleObjectProperty<>(); + private SimpleStringProperty exceptionMessage = new SimpleStringProperty(); - private SimpleStringProperty customerCode = new SimpleStringProperty(); - private SimpleStringProperty customerClassCode = new SimpleStringProperty(); - private SimpleObjectProperty customerDevelopDate = new SimpleObjectProperty<>(); + private SimpleObjectProperty vendorUpdateDate = new SimpleObjectProperty<>(); + private SimpleObjectProperty customerUpdateDate = new SimpleObjectProperty<>(); private SimpleObjectProperty cloudLatest = new SimpleObjectProperty<>(); + /** + * 是否激活 + */ + private SimpleBooleanProperty active = new SimpleBooleanProperty(); /** * Version @@ -46,11 +44,13 @@ public class CloudYuInfoViewModel extends IdentityViewModel { @Override protected void updateFrom(CloudYuVo info) { super.updateFrom(info); - vendorCode.set(info.getExceptionMessage()); - vendorDevelopDate.set(info.getVendorUpdateDate()); - customerDevelopDate.set(info.getCustomerUpdateDate()); + company.set(info.getCompanyId()); + exceptionMessage.set(info.getExceptionMessage()); + vendorUpdateDate.set(info.getVendorUpdateDate()); + customerUpdateDate.set(info.getCustomerUpdateDate()); cloudLatest.set(info.getCloudLatest()); latestUpdate.set(info.getLatestUpdate()); + active.set(info.isActive()); version.set(info.getVersion()); } @@ -65,16 +65,20 @@ public class CloudYuInfoViewModel extends IdentityViewModel { private boolean copyTo_(CloudYuVo info) { boolean modified = false; - if (!Objects.equals(info.getExceptionMessage(), vendorCode.get())) { - info.setExceptionMessage(vendorCode.get()); + if (!Objects.equals(info.getCompanyId(), company.get())) { + info.setCompanyId(company.get()); modified = true; } - if (!Objects.equals(info.getVendorUpdateDate(), vendorDevelopDate.get())) { - info.setVendorUpdateDate(vendorDevelopDate.get()); + if (!Objects.equals(info.getExceptionMessage(), exceptionMessage.get())) { + info.setExceptionMessage(exceptionMessage.get()); modified = true; } - if (!Objects.equals(info.getCustomerUpdateDate(), customerDevelopDate.get())) { - info.setCustomerUpdateDate(customerDevelopDate.get()); + if (!Objects.equals(info.getVendorUpdateDate(), vendorUpdateDate.get())) { + info.setVendorUpdateDate(vendorUpdateDate.get()); + modified = true; + } + if (!Objects.equals(info.getCustomerUpdateDate(), customerUpdateDate.get())) { + info.setCustomerUpdateDate(customerUpdateDate.get()); modified = true; } @@ -86,6 +90,10 @@ public class CloudYuInfoViewModel extends IdentityViewModel { info.setLatestUpdate(latestUpdate.get()); modified = true; } + if (!Objects.equals(info.isActive(), active.get())) { + info.setActive(active.get()); + modified = true; + } if (!Objects.equals(info.getVersion(), version.get())) { info.setVersion(version.get()); modified = true; diff --git a/client/src/main/java/com/ecep/contract/vm/CompanyBankAccountViewModel.java b/client/src/main/java/com/ecep/contract/vm/CompanyBankAccountViewModel.java index a78c25a..6ef9657 100644 --- a/client/src/main/java/com/ecep/contract/vm/CompanyBankAccountViewModel.java +++ b/client/src/main/java/com/ecep/contract/vm/CompanyBankAccountViewModel.java @@ -5,6 +5,7 @@ import java.util.Objects; import com.ecep.contract.vo.CompanyBankAccountVo; +import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; @@ -15,8 +16,6 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = false) public class CompanyBankAccountViewModel extends IdentityViewModel implements CompanyBasedViewModel { - private SimpleIntegerProperty id = new SimpleIntegerProperty(); - private SimpleObjectProperty companyId = new SimpleObjectProperty<>(); private SimpleObjectProperty bankId = new SimpleObjectProperty<>(); @@ -24,25 +23,27 @@ public class CompanyBankAccountViewModel extends IdentityViewModel created = new SimpleObjectProperty<>(); - + private SimpleStringProperty description = new SimpleStringProperty(); + private SimpleBooleanProperty active = new SimpleBooleanProperty(); private SimpleIntegerProperty version = new SimpleIntegerProperty(); + @Override protected void updateFrom(CompanyBankAccountVo v) { - getId().set(v.getId()); + super.updateFrom(v); companyId.set(v.getCompanyId()); bankId.set(v.getBankId()); getOpeningBank().set(v.getOpeningBank()); getAccount().set(v.getAccount()); + created.set(v.getCreated()); + description.set(v.getDescription()); + active.set(v.isActive()); + version.set(v.getVersion()); } @Override public boolean copyTo(CompanyBankAccountVo v) { boolean modified = super.copyTo(v); - if (!Objects.equals(id.get(), v.getId())) { - v.setId(id.get()); - modified = true; - } if (!Objects.equals(companyId.get(), v.getCompanyId())) { v.setCompanyId(companyId.get()); modified = true; @@ -59,6 +60,18 @@ public class CompanyBankAccountViewModel extends IdentityViewModel { - private SimpleIntegerProperty customerFile = new SimpleIntegerProperty(); + private SimpleObjectProperty customerFile = new SimpleObjectProperty<>(); private SimpleStringProperty catalog = new SimpleStringProperty(); private SimpleStringProperty level = new SimpleStringProperty(); private SimpleIntegerProperty creditLevel = new SimpleIntegerProperty(0); @@ -65,6 +66,7 @@ public class CompanyCustomerEvaluationFormFileViewModel extends IdentityViewMode if (vo.getScoreTemplateVersion() != null) { scoreTemplateVersion.set(vo.getScoreTemplateVersion()); } + } @Override diff --git a/client/src/main/resources/ui/cloud/tyc_manager.fxml b/client/src/main/resources/ui/cloud/tyc_manager.fxml index 51b7777..dce1f4c 100644 --- a/client/src/main/resources/ui/cloud/tyc_manager.fxml +++ b/client/src/main/resources/ui/cloud/tyc_manager.fxml @@ -3,7 +3,7 @@ + fx:controller="com.ecep.contract.controller.cloud.tyc.CloudTycManagerWindowController"> @@ -39,7 +39,6 @@ - diff --git a/client/src/main/resources/ui/cloud/u8_config.fxml b/client/src/main/resources/ui/cloud/u8_config.fxml index 6dc4f54..a1b940d 100644 --- a/client/src/main/resources/ui/cloud/u8_config.fxml +++ b/client/src/main/resources/ui/cloud/u8_config.fxml @@ -9,38 +9,42 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/src/main/resources/ui/cloud/u8_manager.fxml b/client/src/main/resources/ui/cloud/u8_manager.fxml index 859aedc..919b63a 100644 --- a/client/src/main/resources/ui/cloud/u8_manager.fxml +++ b/client/src/main/resources/ui/cloud/u8_manager.fxml @@ -61,9 +61,10 @@ - - + + + + diff --git a/client/src/main/resources/ui/company/company-tab-bank-account.fxml b/client/src/main/resources/ui/company/company-tab-bank-account.fxml index 9a8e890..377b276 100644 --- a/client/src/main/resources/ui/company/company-tab-bank-account.fxml +++ b/client/src/main/resources/ui/company/company-tab-bank-account.fxml @@ -22,14 +22,5 @@ - - - - - - - - - \ No newline at end of file diff --git a/client/src/main/resources/ui/company/company-tab-other.fxml b/client/src/main/resources/ui/company/company-tab-other.fxml index 8d39021..2e13262 100644 --- a/client/src/main/resources/ui/company/company-tab-other.fxml +++ b/client/src/main/resources/ui/company/company-tab-other.fxml @@ -1,88 +1,75 @@ - - - + + + + + + + + + + + + + + - + - - - - + + + + - - - - - - - - - + + + + + + + + + -