Compare commits
2 Commits
515b255567
...
543311c676
| Author | SHA1 | Date | |
|---|---|---|---|
| 543311c676 | |||
| 73cbb4e19e |
@@ -125,6 +125,7 @@ public class ComboBoxUtils {
|
|||||||
list.addAll(queryService.findAll());
|
list.addAll(queryService.findAll());
|
||||||
comboBox.setItems(list);
|
comboBox.setItems(list);
|
||||||
|
|
||||||
|
|
||||||
EntityStringConverter<T> converter = new EntityStringConverter<>(list);
|
EntityStringConverter<T> converter = new EntityStringConverter<>(list);
|
||||||
comboBox.setConverter(converter);
|
comboBox.setConverter(converter);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ecep.contract.controller.list.cell;
|
||||||
|
|
||||||
|
import com.ecep.contract.ContractFileType;
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.service.ContractFileTypeService;
|
||||||
|
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||||
|
import javafx.scene.control.ListCell;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
import javafx.util.Callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public class ContractFileTypeListCell<T> extends ListCell<ContractFileType> {
|
||||||
|
public static Callback<ListView<ContractFileType>, ListCell<ContractFileType>> forListView(ContractFileTypeService typeService) {
|
||||||
|
return listView -> new ContractFileTypeListCell<>(typeService);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ContractFileTypeService service;
|
||||||
|
|
||||||
|
public ContractFileTypeListCell(ContractFileTypeService service) {
|
||||||
|
this.service = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateItem(ContractFileType item, boolean empty) {
|
||||||
|
super.updateItem(item, empty);
|
||||||
|
if (item == null || empty) {
|
||||||
|
setText(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ContractFileTypeLocalVo local = service.findByType(Desktop.instance.getActiveEmployee().localeProperty().get(), item);
|
||||||
|
if (local == null) {
|
||||||
|
setText(item.name());
|
||||||
|
} else {
|
||||||
|
setText(local.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.ecep.contract.controller.project.sale_type;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.list.cell.ContractFileTypeListCell;
|
||||||
import org.controlsfx.control.ListSelectionView;
|
import org.controlsfx.control.ListSelectionView;
|
||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
@@ -36,8 +37,6 @@ public class ProjectSaleTypeRequireFilesTabSkin extends AbstProjectSaleTypeBased
|
|||||||
|
|
||||||
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||||
private ListSelectionView<ContractFileType> fileTypesField;
|
private ListSelectionView<ContractFileType> fileTypesField;
|
||||||
private final ObservableMap<ContractFileType, ContractFileTypeLocal> fileTypeLocalMap = FXCollections
|
|
||||||
.observableHashMap();
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectSaleTypeRequireFileTypeService requireFileTypeService;
|
private ProjectSaleTypeRequireFileTypeService requireFileTypeService;
|
||||||
@@ -63,7 +62,6 @@ public class ProjectSaleTypeRequireFilesTabSkin extends AbstProjectSaleTypeBased
|
|||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
initializeListView();
|
initializeListView();
|
||||||
loadSelectedRoles();
|
loadSelectedRoles();
|
||||||
fileTypeLocalMap.putAll(getCachedBean(ContractFileTypeService.class).findAll(getLocale()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSelectedRoles() {
|
private void loadSelectedRoles() {
|
||||||
@@ -79,22 +77,7 @@ public class ProjectSaleTypeRequireFilesTabSkin extends AbstProjectSaleTypeBased
|
|||||||
List<ContractFileType> types = Arrays.stream(ContractFileType.values())
|
List<ContractFileType> types = Arrays.stream(ContractFileType.values())
|
||||||
.filter(ContractFileType::isSupportCustomer).toList();
|
.filter(ContractFileType::isSupportCustomer).toList();
|
||||||
fileTypesField.getSourceItems().setAll(types);
|
fileTypesField.getSourceItems().setAll(types);
|
||||||
fileTypesField.setCellFactory(param -> new ListCell<>() {
|
fileTypesField.setCellFactory(ContractFileTypeListCell.forListView(getCachedBean(ContractFileTypeService.class)));
|
||||||
@Override
|
|
||||||
protected void updateItem(ContractFileType item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
if (item == null || empty) {
|
|
||||||
setText(null);
|
|
||||||
} else {
|
|
||||||
ContractFileTypeLocal local = fileTypeLocalMap.get(item);
|
|
||||||
if (local == null) {
|
|
||||||
setText(item.name());
|
|
||||||
} else {
|
|
||||||
setText(local.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fileTypesField.getTargetItems().addListener((ListChangeListener<ContractFileType>) change -> {
|
fileTypesField.getTargetItems().addListener((ListChangeListener<ContractFileType>) change -> {
|
||||||
while (change.next()) {
|
while (change.next()) {
|
||||||
|
|||||||
@@ -1,16 +1,28 @@
|
|||||||
package com.ecep.contract.controller.tab;
|
package com.ecep.contract.controller.tab;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import com.ecep.contract.*;
|
||||||
import java.io.File;
|
import com.ecep.contract.constant.ContractConstant;
|
||||||
import java.io.FileNotFoundException;
|
import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
|
||||||
import java.io.IOException;
|
import com.ecep.contract.controller.contract.ContractWindowController;
|
||||||
import java.time.LocalDate;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import java.util.ArrayList;
|
import com.ecep.contract.controller.table.cell.ContractFileTypeTableCell;
|
||||||
import java.util.List;
|
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
||||||
import java.util.Objects;
|
import com.ecep.contract.model.ContractFileTypeLocal;
|
||||||
|
import com.ecep.contract.service.ContractFileService;
|
||||||
import javax.imageio.ImageIO;
|
import com.ecep.contract.service.ContractFileTypeService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.ContractFileViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||||
|
import com.ecep.contract.vo.ContractFileVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
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.Loader;
|
||||||
import org.apache.pdfbox.io.IOUtils;
|
import org.apache.pdfbox.io.IOUtils;
|
||||||
import org.apache.pdfbox.io.MemoryUsageSetting;
|
import org.apache.pdfbox.io.MemoryUsageSetting;
|
||||||
@@ -25,46 +37,15 @@ import org.apache.pdfbox.pdmodel.graphics.image.LosslessFactory;
|
|||||||
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
|
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import javax.imageio.ImageIO;
|
||||||
import com.ecep.contract.ContractPayWay;
|
import java.awt.image.BufferedImage;
|
||||||
import com.ecep.contract.DesktopUtils;
|
import java.io.File;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import java.io.FileNotFoundException;
|
||||||
import com.ecep.contract.SpringApp;
|
import java.io.IOException;
|
||||||
import com.ecep.contract.constant.ContractConstant;
|
import java.time.LocalDate;
|
||||||
import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
|
import java.util.ArrayList;
|
||||||
import com.ecep.contract.controller.contract.ContractWindowController;
|
import java.util.List;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import java.util.Objects;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ContractFile;
|
|
||||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
|
||||||
import com.ecep.contract.service.ContractFileService;
|
|
||||||
import com.ecep.contract.service.ContractFileTypeService;
|
|
||||||
import com.ecep.contract.util.FxmlPath;
|
|
||||||
import com.ecep.contract.util.UITools;
|
|
||||||
import com.ecep.contract.vm.ContractFileViewModel;
|
|
||||||
import com.ecep.contract.vo.ContractFileVo;
|
|
||||||
import com.ecep.contract.vo.ContractVo;
|
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.MapChangeListener;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.collections.ObservableMap;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ButtonType;
|
|
||||||
import javafx.scene.control.ContextMenu;
|
|
||||||
import javafx.scene.control.Menu;
|
|
||||||
import javafx.scene.control.MenuItem;
|
|
||||||
import javafx.scene.control.SelectionMode;
|
|
||||||
import javafx.scene.control.Tab;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import javafx.util.StringConverter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同文件
|
* 合同文件
|
||||||
@@ -82,15 +63,13 @@ public class ContractTabSkinFiles
|
|||||||
public Menu fileTable_menu_change_type;
|
public Menu fileTable_menu_change_type;
|
||||||
public Menu fileTable_menu_change_type_and_name;
|
public Menu fileTable_menu_change_type_and_name;
|
||||||
public TableColumn<ContractFileViewModel, Number> fileTable_idColumn;
|
public TableColumn<ContractFileViewModel, Number> fileTable_idColumn;
|
||||||
public TableColumn<ContractFileViewModel, ContractFileTypeLocal> fileTable_typeColumn;
|
public TableColumn<ContractFileViewModel, ContractFileType> fileTable_typeColumn;
|
||||||
public TableColumn<ContractFileViewModel, String> fileTable_filePathColumn;
|
public TableColumn<ContractFileViewModel, String> fileTable_filePathColumn;
|
||||||
public TableColumn<ContractFileViewModel, LocalDate> fileTable_applyDateColumn;
|
public TableColumn<ContractFileViewModel, LocalDate> fileTable_applyDateColumn;
|
||||||
public TableColumn<ContractFileViewModel, String> fileTable_descriptionColumn;
|
public TableColumn<ContractFileViewModel, String> fileTable_descriptionColumn;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private ContractFileService contractFileService;
|
private ContractFileService contractFileService;
|
||||||
private final ObservableMap<ContractFileType, ContractFileTypeLocal> fileTypeLocalMap = FXCollections
|
|
||||||
.observableHashMap();
|
|
||||||
|
|
||||||
public ContractTabSkinFiles(ContractWindowController controller) {
|
public ContractTabSkinFiles(ContractWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -150,44 +129,9 @@ public class ContractTabSkinFiles
|
|||||||
fileTable_idColumn.setReorderable(false);
|
fileTable_idColumn.setReorderable(false);
|
||||||
|
|
||||||
fileTable_typeColumn
|
fileTable_typeColumn
|
||||||
.setCellValueFactory(param -> Bindings.valueAt(fileTypeLocalMap, param.getValue().getType()));
|
.setCellValueFactory(param -> param.getValue().getType());
|
||||||
fileTable_typeColumn
|
fileTable_typeColumn
|
||||||
.setCellFactory(param -> new TextFieldTableCell<>(new ContractFileTypeLocalStringConverter()));
|
.setCellFactory(ContractFileTypeTableCell.forTableColumn(getCachedBean(ContractFileTypeService.class)));
|
||||||
// 监听 type map 变化
|
|
||||||
fileTypeLocalMap
|
|
||||||
.addListener((MapChangeListener<? super ContractFileType, ? super ContractFileTypeLocal>) change -> {
|
|
||||||
List<ContractFileTypeLocal> types = fileTypeLocalMap.values().stream().filter(typeLocal -> {
|
|
||||||
ContractFileType type = typeLocal.getType();
|
|
||||||
if (type == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (isCustomer && !type.isSupportCustomer()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !isVendor || type.isSupportVendor();
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
fileTable_menu_change_type.getItems().setAll(types.stream()
|
|
||||||
.map(typeLocal -> {
|
|
||||||
MenuItem item = new MenuItem();
|
|
||||||
item.setText(typeLocal.getValue());
|
|
||||||
item.getProperties().put("typeLocal", typeLocal);
|
|
||||||
item.setOnAction(this::onFileTableContextMenuChangeTypeAndNameAction);
|
|
||||||
return item;
|
|
||||||
}).toList());
|
|
||||||
|
|
||||||
fileTable_menu_change_type_and_name.getItems().setAll(types.stream()
|
|
||||||
.filter(typeLocal -> StringUtils.hasText(typeLocal.getSuggestFileName()))
|
|
||||||
.map(typeLocal -> {
|
|
||||||
MenuItem item = new MenuItem();
|
|
||||||
item.setText(typeLocal.getValue());
|
|
||||||
item.getProperties().put("typeLocal", typeLocal);
|
|
||||||
item.getProperties().put("rename", true);
|
|
||||||
item.setOnAction(this::onFileTableContextMenuChangeTypeAndNameAction);
|
|
||||||
return item;
|
|
||||||
}).toList());
|
|
||||||
});
|
|
||||||
|
|
||||||
fileTable_typeColumn.setEditable(false);
|
fileTable_typeColumn.setEditable(false);
|
||||||
|
|
||||||
/* 文件名编辑器 */
|
/* 文件名编辑器 */
|
||||||
@@ -249,7 +193,6 @@ public class ContractTabSkinFiles
|
|||||||
createVendorContractRequestByTemplateUpdateMenuItem(),
|
createVendorContractRequestByTemplateUpdateMenuItem(),
|
||||||
createVendorContractApplyByTemplateUpdateMenuItem());
|
createVendorContractApplyByTemplateUpdateMenuItem());
|
||||||
|
|
||||||
fileTypeLocalMap.putAll(getCachedBean(ContractFileTypeService.class).findAll(getLocale()));
|
|
||||||
super.initializeTab();
|
super.initializeTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,7 +451,7 @@ public class ContractTabSkinFiles
|
|||||||
file.setApplyDate(LocalDate.now());
|
file.setApplyDate(LocalDate.now());
|
||||||
|
|
||||||
String fileName = item.getText();
|
String fileName = item.getText();
|
||||||
ContractFileTypeLocal local = fileTypeLocalMap.get(ContractFileType.CostForm);
|
ContractFileTypeLocalVo local = getCachedBean(ContractFileTypeService.class).findByType(getLocale(), ContractFileType.CostForm);
|
||||||
if (local != null) {
|
if (local != null) {
|
||||||
if (StringUtils.hasText(local.getSuggestFileName())) {
|
if (StringUtils.hasText(local.getSuggestFileName())) {
|
||||||
fileName = local.getSuggestFileName();
|
fileName = local.getSuggestFileName();
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.ecep.contract.controller.table.cell;
|
||||||
|
|
||||||
|
import com.ecep.contract.ContractFileType;
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.service.ContractFileTypeService;
|
||||||
|
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||||
|
import javafx.scene.control.TableCell;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.util.Callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同文件类型单元格,用于在表格中显示合同文件类型信息
|
||||||
|
*/
|
||||||
|
public class ContractFileTypeTableCell<T> extends AsyncUpdateTableCell<T, ContractFileType, ContractFileTypeLocalVo> {
|
||||||
|
private ContractFileTypeService contractFileTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个用于表格列的单元格工厂
|
||||||
|
*/
|
||||||
|
public static <T> Callback<TableColumn<T, ContractFileType>, TableCell<T, ContractFileType>> forTableColumn(
|
||||||
|
ContractFileTypeService service) {
|
||||||
|
return param -> new ContractFileTypeTableCell<>(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContractFileTypeTableCell() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContractFileTypeTableCell(ContractFileTypeService service) {
|
||||||
|
setService(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContractFileTypeService getServiceBean() {
|
||||||
|
if (contractFileTypeService == null) {
|
||||||
|
contractFileTypeService = SpringApp.getBean(ContractFileTypeService.class);
|
||||||
|
}
|
||||||
|
return contractFileTypeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContractFileTypeLocalVo initialize() {
|
||||||
|
ContractFileType item = getItem();
|
||||||
|
ContractFileTypeLocalVo localVo = getServiceBean().findByType(com.ecep.contract.Desktop.instance.getActiveEmployee().localeProperty().get(), item);
|
||||||
|
return localVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String format(ContractFileTypeLocalVo entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return entity.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,12 +5,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.VendorType;
|
||||||
import com.ecep.contract.controller.ComboBoxUtils;
|
import com.ecep.contract.controller.ComboBoxUtils;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.model.VendorTypeLocal;
|
import com.ecep.contract.model.VendorTypeLocal;
|
||||||
import com.ecep.contract.service.CompanyContactService;
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
import com.ecep.contract.service.CompanyVendorService;
|
import com.ecep.contract.service.CompanyVendorService;
|
||||||
|
import com.ecep.contract.service.VendorCatalogService;
|
||||||
import com.ecep.contract.service.VendorTypeService;
|
import com.ecep.contract.service.VendorTypeService;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||||
@@ -18,7 +20,11 @@ import com.ecep.contract.vm.CompanyViewModel;
|
|||||||
import com.ecep.contract.vo.CompanyVendorVo;
|
import com.ecep.contract.vo.CompanyVendorVo;
|
||||||
import com.ecep.contract.vo.CompanyVo;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||||
@@ -52,7 +58,9 @@ public class CompanyVendorTabSkinBase
|
|||||||
controller.developDateField.setConverter(converter);
|
controller.developDateField.setConverter(converter);
|
||||||
controller.developDateField.valueProperty().bindBidirectional(viewModel.getDevelopDate());
|
controller.developDateField.valueProperty().bindBidirectional(viewModel.getDevelopDate());
|
||||||
|
|
||||||
ComboBoxUtils.initialComboBox(controller.catalogField, viewModel.getCatalog(), getCachedBean(VendorTypeService.class), true);
|
ComboBoxUtils.initialComboBox(controller.catalogField, viewModel.getCatalog(), getCachedBean(VendorCatalogService.class), true);
|
||||||
|
|
||||||
|
initialTypeComboBox();
|
||||||
|
|
||||||
controller.protocolProviderField.selectedProperty().bindBidirectional(viewModel.getProtocolProvider());
|
controller.protocolProviderField.selectedProperty().bindBidirectional(viewModel.getProtocolProvider());
|
||||||
UITools.autoCompletion(controller.contactField, viewModel.getContact(), getCompanyContactService());
|
UITools.autoCompletion(controller.contactField, viewModel.getContact(), getCompanyContactService());
|
||||||
@@ -81,6 +89,17 @@ public class CompanyVendorTabSkinBase
|
|||||||
controller.pathAsNameBtn.setOnAction(this::onPathSameAsNameAction);
|
controller.pathAsNameBtn.setOnAction(this::onPathSameAsNameAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initialTypeComboBox() {
|
||||||
|
VendorTypeService typeService = getCachedBean(VendorTypeService.class);
|
||||||
|
ObservableList<VendorType> list = FXCollections.observableArrayList();
|
||||||
|
ComboBox<VendorType> comboBox = controller.typeField;
|
||||||
|
list.add(null);
|
||||||
|
list.addAll(VendorType.values());
|
||||||
|
comboBox.setItems(list);
|
||||||
|
comboBox.setConverter(typeService.getTypeStringConverter());
|
||||||
|
comboBox.valueProperty().bindBidirectional(viewModel.getType());
|
||||||
|
}
|
||||||
|
|
||||||
public void onCreatePathAction(ActionEvent event) {
|
public void onCreatePathAction(ActionEvent event) {
|
||||||
CompanyVendorVo companyVendor = getEntity();
|
CompanyVendorVo companyVendor = getEntity();
|
||||||
if (getCompanyVendorService().makePathAbsent(companyVendor)) {
|
if (getCompanyVendorService().makePathAbsent(companyVendor)) {
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.ecep.contract.controller.vendor;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import com.ecep.contract.VendorType;
|
||||||
|
import com.ecep.contract.model.VendorCatalog;
|
||||||
|
import com.ecep.contract.vo.VendorCatalogVo;
|
||||||
import com.ecep.contract.vo.VendorTypeLocalVo;
|
import com.ecep.contract.vo.VendorTypeLocalVo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -56,7 +59,8 @@ public class CompanyVendorWindowController extends AbstEntityController<CompanyV
|
|||||||
public Tab fileTab;
|
public Tab fileTab;
|
||||||
public Tab entityTab;
|
public Tab entityTab;
|
||||||
|
|
||||||
public ComboBox<VendorTypeLocalVo> catalogField;
|
public ComboBox<VendorCatalogVo> catalogField;
|
||||||
|
public ComboBox<VendorType> typeField;
|
||||||
public CheckBox protocolProviderField;
|
public CheckBox protocolProviderField;
|
||||||
public TextField pathField;
|
public TextField pathField;
|
||||||
public TextArea descriptionField;
|
public TextArea descriptionField;
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import com.ecep.contract.service.VendorFileTypeService;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.vo.CompanyVendorFileVo;
|
import com.ecep.contract.vo.CompanyVendorFileVo;
|
||||||
import com.ecep.contract.vo.CompanyVendorVo;
|
import com.ecep.contract.vo.CompanyVendorVo;
|
||||||
import com.ecep.contract.vo.CompanyVo;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.VendorFileTypeLocalVo;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.VendorFileType;
|
import com.ecep.contract.VendorFileType;
|
||||||
@@ -94,8 +96,9 @@ public class VendorTabSkinFile
|
|||||||
table.disableProperty().bind(viewModel.getPath().isEmpty());
|
table.disableProperty().bind(viewModel.getPath().isEmpty());
|
||||||
fileTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
fileTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||||
|
|
||||||
ObservableMap<VendorFileType, VendorFileTypeLocal> observableMapByLocal = FXCollections
|
ObservableMap<VendorFileType, VendorFileTypeLocalVo> observableMapByLocal = FXCollections
|
||||||
.observableMap(companyVendorFileService.getFileTypeLocalMap(getLocale()));
|
.observableMap(getCachedBean(VendorFileTypeService.class).findAll(getLocale()));
|
||||||
|
|
||||||
fileTable_typeColumn.setCellValueFactory(param -> Bindings.valueAt(observableMapByLocal,
|
fileTable_typeColumn.setCellValueFactory(param -> Bindings.valueAt(observableMapByLocal,
|
||||||
param.getValue().getType()).map(BaseEnumEntity::getValue));
|
param.getValue().getType()).map(BaseEnumEntity::getValue));
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.ecep.contract.controller.vendor.group;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.list.cell.ContractFileTypeListCell;
|
||||||
|
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||||
import org.controlsfx.control.ListSelectionView;
|
import org.controlsfx.control.ListSelectionView;
|
||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
@@ -32,8 +34,6 @@ public class VendorGroupRequireFilesTabSkin extends AbstVendorGroupBasedTabSkin
|
|||||||
|
|
||||||
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||||
private ListSelectionView<ContractFileType> fileTypesField;
|
private ListSelectionView<ContractFileType> fileTypesField;
|
||||||
private final ObservableMap<ContractFileType, ContractFileTypeLocal> fileTypeLocalMap = FXCollections
|
|
||||||
.observableHashMap();
|
|
||||||
|
|
||||||
public VendorGroupRequireFilesTabSkin(VendorGroupWindowController controller) {
|
public VendorGroupRequireFilesTabSkin(VendorGroupWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -54,7 +54,6 @@ public class VendorGroupRequireFilesTabSkin extends AbstVendorGroupBasedTabSkin
|
|||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
initializeListView();
|
initializeListView();
|
||||||
loadSelectedRoles();
|
loadSelectedRoles();
|
||||||
fileTypeLocalMap.putAll(getContractFileTypeService().findAll(getLocale()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSelectedRoles() {
|
private void loadSelectedRoles() {
|
||||||
@@ -68,23 +67,9 @@ public class VendorGroupRequireFilesTabSkin extends AbstVendorGroupBasedTabSkin
|
|||||||
|
|
||||||
List<ContractFileType> types = Arrays.stream(ContractFileType.values())
|
List<ContractFileType> types = Arrays.stream(ContractFileType.values())
|
||||||
.filter(ContractFileType::isSupportVendor).toList();
|
.filter(ContractFileType::isSupportVendor).toList();
|
||||||
|
|
||||||
fileTypesField.getSourceItems().setAll(types);
|
fileTypesField.getSourceItems().setAll(types);
|
||||||
fileTypesField.setCellFactory(param -> new ListCell<>() {
|
fileTypesField.setCellFactory(ContractFileTypeListCell.forListView(getCachedBean(ContractFileTypeService.class)));
|
||||||
@Override
|
|
||||||
protected void updateItem(ContractFileType item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
if (item == null || empty) {
|
|
||||||
setText(null);
|
|
||||||
} else {
|
|
||||||
ContractFileTypeLocal local = fileTypeLocalMap.get(item);
|
|
||||||
if (local == null) {
|
|
||||||
setText(item.name());
|
|
||||||
} else {
|
|
||||||
setText(local.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fileTypesField.getTargetItems().addListener((ListChangeListener<ContractFileType>) change -> {
|
fileTypesField.getTargetItems().addListener((ListChangeListener<ContractFileType>) change -> {
|
||||||
while (change.next()) {
|
while (change.next()) {
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ecep.contract.converter;
|
||||||
|
|
||||||
|
import com.ecep.contract.service.VendorCatalogService;
|
||||||
|
import com.ecep.contract.vo.VendorCatalogVo;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
|
public class VendorCatalogStringConverter extends StringConverter<VendorCatalogVo> {
|
||||||
|
private final VendorCatalogService service;
|
||||||
|
|
||||||
|
public VendorCatalogStringConverter(VendorCatalogService service) {
|
||||||
|
this.service = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(VendorCatalogVo object) {
|
||||||
|
return object.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VendorCatalogVo fromString(String string) {
|
||||||
|
return service.findByName(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import java.util.Map;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -17,14 +19,16 @@ import com.ecep.contract.vm.ContractFileTypeLocalViewModel;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-file-type")
|
@CacheConfig(cacheNames = "contract-file-type")
|
||||||
public class ContractFileTypeService extends QueryService<ContractFileTypeLocal, ContractFileTypeLocalViewModel> {
|
public class ContractFileTypeService extends QueryService<ContractFileTypeLocalVo, ContractFileTypeLocalViewModel> {
|
||||||
|
|
||||||
@Cacheable
|
@Cacheable
|
||||||
public Map<ContractFileType, ContractFileTypeLocal> findAll(Locale locale) {
|
public Map<ContractFileType, ContractFileTypeLocalVo> findAll(Locale locale) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).build(), Pageable.unpaged()).stream()
|
||||||
params.put("lang", locale.toLanguageTag());
|
.collect(Collectors.toMap(ContractFileTypeLocalVo::getType, Function.identity()));
|
||||||
return findAll(params, Pageable.unpaged()).stream()
|
|
||||||
.collect(Collectors.toMap(ContractFileTypeLocal::getType, Function.identity()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ecep.contract.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javafx.util.StringConverter;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
@@ -17,4 +18,6 @@ public interface IEntityService<T> {
|
|||||||
|
|
||||||
Page<T> findAll(Map<String, Object> params, Pageable pageable);
|
Page<T> findAll(Map<String, Object> params, Pageable pageable);
|
||||||
|
|
||||||
|
|
||||||
|
StringConverter<T> getStringConverter();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ package com.ecep.contract.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ecep.contract.converter.VendorCatalogStringConverter;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.ecep.contract.vm.VendorCatalogViewModel;
|
import com.ecep.contract.vm.VendorCatalogViewModel;
|
||||||
@@ -14,27 +18,41 @@ import com.ecep.contract.vo.VendorCatalogVo;
|
|||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "vendor-catalog")
|
@CacheConfig(cacheNames = "vendor-catalog")
|
||||||
public class VendorCatalogService extends QueryService<VendorCatalogVo, VendorCatalogViewModel> {
|
public class VendorCatalogService extends QueryService<VendorCatalogVo, VendorCatalogViewModel> {
|
||||||
|
|
||||||
|
private final VendorCatalogStringConverter stringConverter = new VendorCatalogStringConverter(this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#id")
|
@Cacheable(key = "#id")
|
||||||
public VendorCatalogVo findById(Integer id) {
|
public VendorCatalogVo findById(Integer id) {
|
||||||
return super.findById(id);
|
return super.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VendorCatalogVo findByName(String string) {
|
||||||
|
return findAll(ParamUtils.builder().equals("name", string).build(), Pageable.ofSize(1)).stream().findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "all")
|
@Cacheable(key = "'all'")
|
||||||
public List<VendorCatalogVo> findAll() {
|
public List<VendorCatalogVo> findAll() {
|
||||||
return super.findAll();
|
return super.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = { @CacheEvict(key = "all"), @CacheEvict(key = "#entity.id") })
|
@Caching(evict = {@CacheEvict(key = "'all'"), @CacheEvict(key = "#entity.id")})
|
||||||
@Override
|
@Override
|
||||||
public VendorCatalogVo save(VendorCatalogVo entity) {
|
public VendorCatalogVo save(VendorCatalogVo entity) {
|
||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = { @CacheEvict(key = "all"), @CacheEvict(key = "#entity.id") })
|
@Caching(evict = {@CacheEvict(key = "'all'"), @CacheEvict(key = "#entity.id")})
|
||||||
@Override
|
@Override
|
||||||
public void delete(VendorCatalogVo entity) {
|
public void delete(VendorCatalogVo entity) {
|
||||||
super.delete(entity);
|
super.delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StringConverter<VendorCatalogVo> getStringConverter() {
|
||||||
|
return stringConverter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,55 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
|
import com.ecep.contract.CompanyFileType;
|
||||||
|
import com.ecep.contract.VendorFileType;
|
||||||
import com.ecep.contract.model.VendorFileTypeLocal;
|
import com.ecep.contract.model.VendorFileTypeLocal;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.VendorFileTypeLocalViewModel;
|
import com.ecep.contract.vm.VendorFileTypeLocalViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
|
||||||
|
import com.ecep.contract.vo.VendorFileTypeLocalVo;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "vendor-file-type")
|
@CacheConfig(cacheNames = "vendor-file-type")
|
||||||
public class VendorFileTypeService extends QueryService<VendorFileTypeLocal, VendorFileTypeLocalViewModel> {
|
public class VendorFileTypeService extends QueryService<VendorFileTypeLocalVo, VendorFileTypeLocalViewModel> {
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public VendorFileTypeLocal findById(Integer id) {
|
public VendorFileTypeLocalVo findById(Integer id) {
|
||||||
return super.findById(id);
|
return super.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "'all'")
|
@Cacheable(key = "'all'")
|
||||||
@Override
|
@Override
|
||||||
public List<VendorFileTypeLocal> findAll() {
|
public List<VendorFileTypeLocalVo> findAll() {
|
||||||
return super.findAll();
|
return super.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
||||||
@Override
|
@Override
|
||||||
public VendorFileTypeLocal save(VendorFileTypeLocal entity) {
|
public VendorFileTypeLocalVo save(VendorFileTypeLocalVo entity) {
|
||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
||||||
@Override
|
@Override
|
||||||
public void delete(VendorFileTypeLocal entity) {
|
public void delete(VendorFileTypeLocalVo entity) {
|
||||||
super.delete(entity);
|
super.delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Cacheable
|
||||||
|
public Map<VendorFileType, VendorFileTypeLocalVo> findAll(Locale locale) {
|
||||||
|
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).build(), Pageable.unpaged()).stream()
|
||||||
|
.collect(Collectors.toMap(VendorFileTypeLocalVo::getType, Function.identity()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.VendorType;
|
import com.ecep.contract.VendorType;
|
||||||
import com.ecep.contract.converter.VendorTypeStringConverter;
|
import com.ecep.contract.converter.VendorTypeStringConverter;
|
||||||
import com.ecep.contract.util.ParamUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
@@ -24,12 +25,17 @@ public class VendorTypeService extends QueryService<VendorTypeLocalVo, VendorTyp
|
|||||||
return super.findById(id);
|
return super.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "'type-'+#p0.ordinal()")
|
@Cacheable(key = "'type-'+#p0.ordinal()", condition = "#p0 != null")
|
||||||
public VendorTypeLocalVo findByType(VendorType type) {
|
public VendorTypeLocalVo findByType(VendorType type) {
|
||||||
return findAll(ParamUtils.builder().equals("type", type).build(), Pageable.ofSize(1)).stream().findFirst()
|
return findAll(ParamUtils.builder().equals("type", type).build(), Pageable.ofSize(1)).stream().findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VendorTypeLocalVo findByValue(String string) {
|
||||||
|
return findAll(ParamUtils.builder().equals("value", string).build(), Pageable.ofSize(1)).stream().findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable(key = "'all'")
|
@Cacheable(key = "'all'")
|
||||||
@Override
|
@Override
|
||||||
public List<VendorTypeLocalVo> findAll() {
|
public List<VendorTypeLocalVo> findAll() {
|
||||||
@@ -57,4 +63,25 @@ public class VendorTypeService extends QueryService<VendorTypeLocalVo, VendorTyp
|
|||||||
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).equals("value", string).build(), Pageable.ofSize(1))
|
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).equals("value", string).build(), Pageable.ofSize(1))
|
||||||
.stream().findFirst().orElse(null);
|
.stream().findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StringConverter<VendorType> getTypeStringConverter() {
|
||||||
|
return new StringConverter<>() {
|
||||||
|
final VendorTypeService service = SpringApp.getBean(VendorTypeService.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(VendorType object) {
|
||||||
|
if (object == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
VendorTypeLocalVo localVo = service.findByType(object);
|
||||||
|
return localVo.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VendorType fromString(String string) {
|
||||||
|
VendorTypeLocalVo localVo = service.findByValue(string);
|
||||||
|
return localVo.getType();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,16 +502,12 @@ public class ContractVerifyComm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ContractFileTypeLocal getFileTypeLocal(ContractFileType type) {
|
ContractFileTypeLocalVo getFileTypeLocal(ContractFileType type) {
|
||||||
if (fileTypeLocalMap == null) {
|
return getContractFileTypeService().findByType(getLocale(), type);
|
||||||
fileTypeLocalMap = FXCollections
|
|
||||||
.observableMap(getContractFileTypeService().findAll(getLocale()));
|
|
||||||
}
|
|
||||||
return fileTypeLocalMap.get(type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getFileTypeLocalValue(ContractFileType type) {
|
String getFileTypeLocalValue(ContractFileType type) {
|
||||||
ContractFileTypeLocal fileTypeLocal = getFileTypeLocal(type);
|
ContractFileTypeLocalVo fileTypeLocal = getFileTypeLocal(type);
|
||||||
if (fileTypeLocal == null) {
|
if (fileTypeLocal == null) {
|
||||||
return type.name();
|
return type.name();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
|||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
import com.ecep.contract.model.ContractFileTypeLocal;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,17 +13,17 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class ContractFileTypeLocalViewModel extends EnumViewModel<ContractFileType, ContractFileTypeLocal> {
|
public class ContractFileTypeLocalViewModel extends EnumViewModel<ContractFileType, ContractFileTypeLocalVo> {
|
||||||
private SimpleStringProperty suggestFileName = new SimpleStringProperty();
|
private SimpleStringProperty suggestFileName = new SimpleStringProperty();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateFrom(ContractFileTypeLocal v) {
|
protected void updateFrom(ContractFileTypeLocalVo v) {
|
||||||
super.updateFrom(v);
|
super.updateFrom(v);
|
||||||
suggestFileName.set(v.getSuggestFileName());
|
suggestFileName.set(v.getSuggestFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean copyTo(ContractFileTypeLocal v) {
|
public boolean copyTo(ContractFileTypeLocalVo v) {
|
||||||
boolean ret = super.copyTo(v);
|
boolean ret = super.copyTo(v);
|
||||||
if (!Objects.equals(suggestFileName.get(), v.getSuggestFileName())) {
|
if (!Objects.equals(suggestFileName.get(), v.getSuggestFileName())) {
|
||||||
v.setSuggestFileName(suggestFileName.get());
|
v.setSuggestFileName(suggestFileName.get());
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.ecep.contract.vm;
|
package com.ecep.contract.vm;
|
||||||
|
|
||||||
import com.ecep.contract.VendorFileType;
|
import com.ecep.contract.VendorFileType;
|
||||||
import com.ecep.contract.model.VendorFileTypeLocal;
|
import com.ecep.contract.vo.VendorFileTypeLocalVo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class VendorFileTypeLocalViewModel extends EnumViewModel<VendorFileType, VendorFileTypeLocal> {
|
public class VendorFileTypeLocalViewModel extends EnumViewModel<VendorFileType, VendorFileTypeLocalVo> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.control.CheckBox?>
|
||||||
|
<?import javafx.scene.control.ComboBox?>
|
||||||
|
<?import javafx.scene.control.DatePicker?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
|
<?import javafx.scene.control.Tab?>
|
||||||
|
<?import javafx.scene.control.TabPane?>
|
||||||
|
<?import javafx.scene.control.TextArea?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.control.ToolBar?>
|
||||||
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.paint.Color?>
|
<?import javafx.scene.paint.Color?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="600.0"
|
|
||||||
prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.controller.vendor.CompanyVendorWindowController">
|
||||||
fx:controller="com.ecep.contract.controller.vendor.CompanyVendorWindowController">
|
|
||||||
<center>
|
<center>
|
||||||
<TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE" tabMaxWidth="100.0" tabMinWidth="40.0">
|
<TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE" tabMaxWidth="100.0" tabMinWidth="40.0">
|
||||||
<tabs>
|
<tabs>
|
||||||
@@ -17,88 +32,66 @@
|
|||||||
<content>
|
<content>
|
||||||
<VBox>
|
<VBox>
|
||||||
<children>
|
<children>
|
||||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minWidth="150.0" VBox.vgrow="NEVER">
|
||||||
minWidth="150.0" VBox.vgrow="NEVER">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="200.0"
|
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="50.0" prefWidth="180.0" />
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308"
|
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
minWidth="50.0" prefWidth="180.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="50.0" prefWidth="180.0" />
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="200.0"
|
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308"
|
|
||||||
minWidth="50.0" prefWidth="180.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
<RowConstraints fillHeight="false" maxHeight="1.7976931348623157E308" minHeight="30.0" prefHeight="120.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0" vgrow="NEVER" />
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
<RowConstraints fillHeight="false" maxHeight="1.7976931348623157E308" minHeight="30.0" prefHeight="42.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
|
||||||
vgrow="NEVER"/>
|
|
||||||
<RowConstraints fillHeight="false" maxHeight="1.7976931348623157E308"
|
|
||||||
minHeight="30.0" prefHeight="120.0" vgrow="NEVER"/>
|
|
||||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
|
||||||
vgrow="NEVER"/>
|
|
||||||
<RowConstraints fillHeight="false" maxHeight="1.7976931348623157E308"
|
|
||||||
minHeight="30.0" prefHeight="42.0" vgrow="NEVER"/>
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="分组" />
|
<Label text="分组" />
|
||||||
<ComboBox fx:id="catalogField" GridPane.columnIndex="1" />
|
<ComboBox fx:id="catalogField" GridPane.columnIndex="1" />
|
||||||
|
|
||||||
<Label text="联系人" GridPane.rowIndex="3"/>
|
<Label text="分类" GridPane.rowIndex="1" />
|
||||||
<TextField fx:id="contactField" GridPane.columnIndex="1"
|
<ComboBox fx:id="typeField" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
GridPane.rowIndex="3"/>
|
|
||||||
|
|
||||||
<Label text="发展日期" GridPane.rowIndex="2"/>
|
<Label text="联系人" GridPane.rowIndex="4" />
|
||||||
<DatePicker fx:id="developDateField" promptText="yyyy-MM-dd"
|
<TextField fx:id="contactField" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
|
||||||
<Label layoutX="20.0" layoutY="28.0" text="备注" GridPane.rowIndex="7"/>
|
<Label text="发展日期" GridPane.rowIndex="3" />
|
||||||
<Label text="采购的产品" GridPane.rowIndex="4"/>
|
<DatePicker fx:id="developDateField" promptText="yyyy-MM-dd" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||||
<TextField fx:id="purchaseField" GridPane.columnIndex="1"
|
<Label layoutX="20.0" layoutY="28.0" text="备注" GridPane.rowIndex="8" />
|
||||||
GridPane.columnSpan="3" GridPane.rowIndex="4"/>
|
<Label text="采购的产品" GridPane.rowIndex="5" />
|
||||||
<Label text="存储文件夹" GridPane.rowIndex="5"/>
|
<TextField fx:id="purchaseField" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="5" />
|
||||||
<TextField fx:id="pathField" GridPane.columnIndex="1"
|
<Label text="存储文件夹" GridPane.rowIndex="6" />
|
||||||
GridPane.columnSpan="3" GridPane.rowIndex="5">
|
<TextField fx:id="pathField" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="6">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TextField>
|
</TextField>
|
||||||
<TextArea fx:id="descriptionField" GridPane.columnIndex="1"
|
<TextArea fx:id="descriptionField" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="8" />
|
||||||
GridPane.columnSpan="3" GridPane.rowIndex="7"/>
|
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="10">
|
||||||
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1"
|
|
||||||
GridPane.columnSpan="3" GridPane.rowIndex="9">
|
|
||||||
<children>
|
<children>
|
||||||
|
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<Label text="创建日期" GridPane.rowIndex="8"/>
|
<Label text="创建日期" GridPane.rowIndex="9" />
|
||||||
<TextField fx:id="createdField" promptText="yyyy-MM-dd"
|
<TextField fx:id="createdField" promptText="yyyy-MM-dd" GridPane.columnIndex="1" GridPane.rowIndex="9" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
<Label fx:id="versionLabel" text="\@Version" GridPane.rowIndex="10" />
|
||||||
<Label fx:id="versionLabel" text="\@Version" GridPane.rowIndex="9"/>
|
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="7">
|
||||||
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1"
|
|
||||||
GridPane.columnSpan="3" GridPane.rowIndex="6">
|
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="createPathBtn" mnemonicParsing="false"
|
<Button fx:id="createPathBtn" mnemonicParsing="false" text="创建目录" />
|
||||||
text="创建目录"/>
|
<Button fx:id="changePathBtn" mnemonicParsing="false" text="变更目录" />
|
||||||
<Button fx:id="changePathBtn" mnemonicParsing="false"
|
<Button fx:id="pathAsNameBtn" mnemonicParsing="false" text="与合同名称同名" />
|
||||||
text="变更目录"/>
|
|
||||||
<Button fx:id="pathAsNameBtn" mnemonicParsing="false"
|
|
||||||
text="与合同名称同名"/>
|
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<Label text="协议供货商" GridPane.rowIndex="1"/>
|
<Label text="协议供货商" GridPane.rowIndex="2" />
|
||||||
<CheckBox fx:id="protocolProviderField" mnemonicParsing="false"
|
<CheckBox fx:id="protocolProviderField" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
|
||||||
</children>
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
@@ -130,8 +123,7 @@
|
|||||||
<bottom>
|
<bottom>
|
||||||
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0">
|
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0">
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="leftStatusLabel" maxHeight="1.7976931348623157E308" text="Left status"
|
<Label fx:id="leftStatusLabel" maxHeight="1.7976931348623157E308" text="Left status" HBox.hgrow="ALWAYS">
|
||||||
HBox.hgrow="ALWAYS">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="11.0" fx:id="x3" />
|
<Font size="11.0" fx:id="x3" />
|
||||||
</font>
|
</font>
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package com.ecep.contract.vo;
|
|||||||
import com.ecep.contract.VendorType;
|
import com.ecep.contract.VendorType;
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
|
||||||
|
import com.ecep.contract.model.NamedEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class VendorCatalogVo implements IdentityEntity {
|
public class VendorCatalogVo implements IdentityEntity, NamedEntity {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String name;
|
||||||
private String code;
|
private String code;
|
||||||
|
|||||||
46
docs/create_enum.md
Normal file
46
docs/create_enum.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
枚举对象
|
||||||
|
|
||||||
|
# 枚举类型清单
|
||||||
|
|
||||||
|
- common/src/main/java/com/ecep/contract/VendorType.java
|
||||||
|
- common/src/main/java/com/ecep/contract/VendorFileType.java
|
||||||
|
- common/src/main/java/com/ecep/contract/ProjectFileType.java
|
||||||
|
- common/src/main/java/com/ecep/contract/CompanyFileType.java
|
||||||
|
- common/src/main/java/com/ecep/contract/ContractFileType.java
|
||||||
|
- common/src/main/java/com/ecep/contract/CustomerFIleType.java
|
||||||
|
|
||||||
|
# Server 模块
|
||||||
|
|
||||||
|
## Repository
|
||||||
|
|
||||||
|
- server/src/main/java/com/ecep/contract/ds/vendor/repository/VendorTypeLocalRepository.java
|
||||||
|
|
||||||
|
## Service
|
||||||
|
|
||||||
|
- server/src/main/java/com/ecep/contract/ds/vendor/service/VendorTypeService.java
|
||||||
|
|
||||||
|
# Client 模块
|
||||||
|
|
||||||
|
## View Model
|
||||||
|
|
||||||
|
- client/src/main/java/com/ecep/contract/vm/VendorTypeLocalViewModel.java
|
||||||
|
|
||||||
|
## StringConverter
|
||||||
|
|
||||||
|
- client/src/main/java/com/ecep/contract/converter/VendorTypeStringConverter.java
|
||||||
|
|
||||||
|
## VO(View Object)
|
||||||
|
|
||||||
|
- common/src/main/java/com/ecep/contract/vo/VendorTypeLocalVo.java
|
||||||
|
|
||||||
|
## TableCell 表格单元格渲染
|
||||||
|
|
||||||
|
- common/src/main/java/com/ecep/contract/controller/table/cell/VendorTypeTableCell.java
|
||||||
|
|
||||||
|
# Common 模块
|
||||||
|
|
||||||
|
- common/src/main/java/com/ecep/contract/model/VendorTypeLocal.java
|
||||||
|
|
||||||
|
# 其他
|
||||||
|
|
||||||
|
本文中的所有文件在项目路径下
|
||||||
Reference in New Issue
Block a user