feat: 添加功能模块相关字段和界面优化
- 在FUNC表中添加CONTROLLER、ICON和DESCRIPTION字段 - 重构角色管理相关类名和路径 - 优化公司表格单元格显示逻辑 - 添加功能权限管理界面 - 优化日志配置和FXML文件引用 - 移除冗余代码和注释
This commit is contained in:
@@ -16,8 +16,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CompanyManagerSkin
|
||||
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyOldNameService companyOldNameService;
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -27,11 +28,17 @@ public class CompanyManagerWindowController
|
||||
extends AbstManagerWindowController<Company, CompanyViewModel, CompanyManagerSkin> {
|
||||
|
||||
// columns
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> uniscidColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> entStatusColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, LocalDate> createdColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> memoColumn;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.ecep.contract.manager.ds.company.controller;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import static com.ecep.contract.manager.SpringApp.getBean;
|
||||
|
||||
public class CompanyTableCell<V> extends javafx.scene.control.TableCell<V, com.ecep.contract.manager.ds.company.model.Company> {
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.manager.Desktop;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
public class CompanyTableCell<V>
|
||||
extends javafx.scene.control.TableCell<V, com.ecep.contract.manager.ds.company.model.Company> {
|
||||
|
||||
private CompanyService companyService;
|
||||
|
||||
|
||||
public CompanyTableCell() {
|
||||
}
|
||||
|
||||
@@ -33,9 +38,27 @@ public class CompanyTableCell<V> extends javafx.scene.control.TableCell<V, com.e
|
||||
setText(null);
|
||||
return;
|
||||
}
|
||||
if (!Hibernate.isInitialized(item)) {
|
||||
item = getCompanyService().findById(item.getId());
|
||||
if (Hibernate.isInitialized(item)) {
|
||||
setText(formart(item));
|
||||
return;
|
||||
}
|
||||
setText(item.getName());
|
||||
setText("# " + item.getId());
|
||||
submit(this::asyncLoadAndUpdate);
|
||||
}
|
||||
|
||||
Future<?> submit(Runnable var1){
|
||||
return Desktop.instance.getExecutorService().submit(var1);
|
||||
}
|
||||
|
||||
private String formart(Company company) {
|
||||
return company.getName();
|
||||
}
|
||||
|
||||
private void asyncLoadAndUpdate() {
|
||||
Company company = getCompanyService().findById(getItem().getId());
|
||||
Platform.runLater(() -> {
|
||||
setText(formart(company));
|
||||
setItem(company);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
package com.ecep.contract.manager.ds.company.model;
|
||||
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.model.NamedEntity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.model.NamedEntity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Version;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 公司信息类,保存企业信息
|
||||
*/
|
||||
@@ -21,7 +28,7 @@ import java.util.Objects;
|
||||
@Entity
|
||||
@Table(name = "COMPANY")
|
||||
@ToString
|
||||
public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.manager.ds.other.model.Entity {
|
||||
public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.manager.ds.other.model.Entity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -32,21 +39,22 @@ public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
* <p>
|
||||
* 编码结构
|
||||
*
|
||||
* <pre>
|
||||
* 1 | 1 | 6 | 9 | 1 <br>
|
||||
* 登记管理部门代码|机构类别代码|登记管理机关行政区划码|主体标识码|校验码
|
||||
* 1 | 1 | 6 | 9 | 1 < br > 登记管理部门代码 | 机构类别代码 | 登记管理机关行政区划码 | 主体标识码 | 校验码
|
||||
* </pre>
|
||||
* <ul>
|
||||
* <li>登记管理部门代码(第 1 位):<br>
|
||||
* 例如,9 代表工商部门登记的企业等。</li>
|
||||
* <li>机构类别代码(第 2 位):不同的数字表示不同类型的机构。如 1 表示企业,2 表示个体工商户等。</li>
|
||||
* <li>登记管理机关行政区划码(第 3 - 8 位):这 6 位数字代表了登记管理机关所在的行政区划,与身份证号码的前 6 位类似,可对应到具体的地区。</li>
|
||||
* <li>主体标识码(组织机构代码,第 9 - 17 位):它是对中华人民共和国境内依法注册、依法登记的机关、企事业单位、社会团体和民办非企业单位等机构颁发的一个在全国范围内唯一的、始终不变的代码。</li>
|
||||
* <li>登记管理机关行政区划码(第 3 - 8 位):这 6 位数字代表了登记管理机关所在的行政区划,与身份证号码的前 6
|
||||
* 位类似,可对应到具体的地区。</li>
|
||||
* <li>主体标识码(组织机构代码,第 9 - 17
|
||||
* 位):它是对中华人民共和国境内依法注册、依法登记的机关、企事业单位、社会团体和民办非企业单位等机构颁发的一个在全国范围内唯一的、始终不变的代码。</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*/
|
||||
@@ -176,19 +184,27 @@ public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object object) {
|
||||
if (this == object) return true;
|
||||
if (object == null) return false;
|
||||
Class<?> oEffectiveClass = object instanceof HibernateProxy ? ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass() : object.getClass();
|
||||
Class<?> thisEffectiveClass = this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass() : this.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass) return false;
|
||||
if (this == object)
|
||||
return true;
|
||||
if (object == null)
|
||||
return false;
|
||||
Class<?> oEffectiveClass = object instanceof HibernateProxy
|
||||
? ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass()
|
||||
: object.getClass();
|
||||
Class<?> thisEffectiveClass = this instanceof HibernateProxy
|
||||
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass()
|
||||
: this.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass)
|
||||
return false;
|
||||
Company company = (Company) object;
|
||||
return getId() != null && Objects.equals(getId(), company.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
|
||||
return this instanceof HibernateProxy
|
||||
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode()
|
||||
: getClass().hashCode();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.ecep.contract.manager.ds.contract.controller;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.contract.ContractPayWay;
|
||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
||||
import com.ecep.contract.manager.ds.contract.model.ContractGroup;
|
||||
@@ -12,31 +17,33 @@ import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.util.converter.CurrencyStringConverter;
|
||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class ContractManagerSkin
|
||||
extends AbstEntityManagerSkin<Contract, ContractViewModel, ContractManagerSkin, ContractManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
@Setter
|
||||
private ContractService contractService;
|
||||
private CompanyService companyService;
|
||||
|
||||
public ContractManagerSkin(ContractManagerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
public ContractService getContractService() {
|
||||
if (contractService == null) {
|
||||
contractService = getBean(ContractService.class);
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
public CompanyService getCompanyService() {
|
||||
if (companyService == null) {
|
||||
companyService = getBean(CompanyService.class);
|
||||
}
|
||||
return contractService;
|
||||
return companyService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,10 +59,7 @@ public class ContractManagerSkin
|
||||
builder.equal(payWay, ContractPayWay.PAY),
|
||||
builder.or(
|
||||
builder.equal(parentCode, ""),
|
||||
parentCode.isNull()
|
||||
)
|
||||
)
|
||||
);
|
||||
parentCode.isNull())));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +75,7 @@ public class ContractManagerSkin
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
ComboBoxUtils.initialComboBox(controller.groupSelector, contractService.findAllGroups(), true);
|
||||
ComboBoxUtils.initialComboBox(controller.groupSelector, getContractService().findAllGroups(), true);
|
||||
controller.groupSelector.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
loadTableDataSet(false);
|
||||
});
|
||||
@@ -80,32 +84,33 @@ public class ContractManagerSkin
|
||||
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
controller.codeColumn.setCellValueFactory(param -> param.getValue().getCode());
|
||||
controller.groupColumn.setCellValueFactory(param -> param.getValue().getGroup());
|
||||
controller.groupColumn.setCellFactory(param -> new ContractGroupTableCell(contractService));
|
||||
controller.groupColumn.setCellFactory(param -> new ContractGroupTableCell(getContractService()));
|
||||
controller.typeColumn.setCellValueFactory(param -> param.getValue().getType());
|
||||
controller.typeColumn.setCellFactory(param -> new ContractTypeTableCell(contractService));
|
||||
controller.typeColumn.setCellFactory(param -> new ContractTypeTableCell(getContractService()));
|
||||
controller.kindColumn.setCellValueFactory(param -> param.getValue().getKind());
|
||||
controller.kindColumn.setCellFactory(param -> new ContractKindTableCell(contractService));
|
||||
controller.kindColumn.setCellFactory(param -> new ContractKindTableCell(getContractService()));
|
||||
|
||||
controller.parentCodeColumn.setCellValueFactory(param -> param.getValue().getParentCode());
|
||||
|
||||
|
||||
controller.setupDateColumn.setCellValueFactory(param -> param.getValue().getSetupDate());
|
||||
controller.orderDateColumn.setCellValueFactory(param -> param.getValue().getOrderDate());
|
||||
controller.startDateColumn.setCellValueFactory(param -> param.getValue().getStartDate());
|
||||
|
||||
|
||||
controller.employeeColumn.setCellValueFactory(param -> param.getValue().getEmployee());
|
||||
controller.employeeColumn.setCellFactory(TextFieldTableCell.forTableColumn(getBean(EmployeeStringConverter.class)));
|
||||
controller.employeeColumn
|
||||
.setCellFactory(TextFieldTableCell.forTableColumn(getBean(EmployeeStringConverter.class)));
|
||||
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATETIME_FORMAT_PATTERN);
|
||||
controller.createdColumn.setCellFactory(TextFieldTableCell.forTableColumn(new LocalDateTimeStringConverter(formatter, null)));
|
||||
controller.createdColumn
|
||||
.setCellFactory(TextFieldTableCell.forTableColumn(new LocalDateTimeStringConverter(formatter, null)));
|
||||
|
||||
controller.amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
|
||||
controller.amountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale(), "#,##0")));
|
||||
controller.amountColumn
|
||||
.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale(), "#,##0")));
|
||||
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>());
|
||||
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
||||
|
||||
Platform.runLater(() -> {
|
||||
controller.composeViewBtn.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
|
||||
@@ -66,7 +66,6 @@ public class ContractManagerWindowController
|
||||
@Override
|
||||
protected ContractManagerSkin createDefaultSkin() {
|
||||
ContractManagerSkin skin = new ContractManagerSkin(this);
|
||||
skin.setContractService(contractService);
|
||||
return skin;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.ecep.contract.manager.ds.contract.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.manager.SpringApp;
|
||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
||||
import com.ecep.contract.manager.ds.contract.model.ExtendVendorInfo;
|
||||
@@ -9,34 +14,38 @@ import com.ecep.contract.manager.ds.vendor.model.VendorGroup;
|
||||
import com.ecep.contract.manager.ds.vendor.service.VendorGroupService;
|
||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.TabSkin;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.util.converter.NumberStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@FxmlPath("/ui/contract/contract-tab-ext-vendor-info.fxml")
|
||||
public class ContractTabSkinExtendVendorInfo
|
||||
extends AbstContractBasedTabSkin
|
||||
implements TabSkin {
|
||||
|
||||
extends AbstContractBasedTabSkin {
|
||||
|
||||
@Setter
|
||||
private ExtendVendorInfoService extendVendorInfoService;
|
||||
@Setter
|
||||
private VendorGroupService vendorGroupService;
|
||||
|
||||
@FXML
|
||||
public ComboBox<VendorGroup> vendorGroupField;
|
||||
@FXML
|
||||
public Label vendorGroupLabel;
|
||||
@FXML
|
||||
public TextField sequenceNumberField;
|
||||
@FXML
|
||||
public CheckBox assignedProviderField;
|
||||
@FXML
|
||||
public CheckBox prePurchaseField;
|
||||
|
||||
CompletableFuture<ExtendVendorInfo> loadedFuture;
|
||||
@@ -114,8 +123,8 @@ public class ContractTabSkinExtendVendorInfo
|
||||
return v.getDescription();
|
||||
}));
|
||||
|
||||
|
||||
sequenceNumberField.textProperty().bindBidirectional(viewModel.getCodeSequenceNumber(), new NumberStringConverter());
|
||||
sequenceNumberField.textProperty().bindBidirectional(viewModel.getCodeSequenceNumber(),
|
||||
new NumberStringConverter());
|
||||
assignedProviderField.selectedProperty().bindBidirectional(viewModel.getAssignedProvider());
|
||||
assignedProviderField.disableProperty().bind(Bindings.createBooleanBinding(() -> {
|
||||
VendorGroup group = viewModel.getGroup().get();
|
||||
@@ -128,7 +137,6 @@ public class ContractTabSkinExtendVendorInfo
|
||||
prePurchaseField.selectedProperty().bindBidirectional(viewModel.getPrePurchase());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (loadedFuture != null) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.*;
|
||||
@@ -177,29 +178,46 @@ public class ContractVerifyWindowController extends BaseController {
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
@FXML
|
||||
public DatePicker setupDateBeginSelector;
|
||||
@FXML
|
||||
public DatePicker setupDateEndSelector;
|
||||
// 企业验证开关
|
||||
@FXML
|
||||
public CheckMenuItem verifyCompanyStatusChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCompanyPathChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCompanyCreditChecker;
|
||||
// 供应商验证开关
|
||||
@FXML
|
||||
public CheckMenuItem verifyVendorChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyVendorFileChecker;
|
||||
// 客户验证开关
|
||||
@FXML
|
||||
public CheckMenuItem verifyCustomerChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCustomerFileChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCustomerSubContractDateChecker;
|
||||
|
||||
@FXML
|
||||
public CheckMenuItem onlyShowVerifiedChecker;
|
||||
|
||||
|
||||
@FXML
|
||||
public TableView<Model> viewTable;
|
||||
private final ObservableList<Model> viewTableDataSet = FXCollections.observableArrayList();
|
||||
@FXML
|
||||
public TableColumn<Model, String> viewTable_codeColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, String> viewTable_nameColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, Employee> viewTable_employeeColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, LocalDate> viewTable_setupDateColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, ObservableList<MessageExt>> viewTable_stateColumn;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ecep.contract.manager.ds.customer.controller;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
||||
@@ -8,22 +11,14 @@ import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.MyStringUtils;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CompanyCustomerManagerSkin
|
||||
extends AbstEntityManagerSkin<CompanyCustomer, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends
|
||||
AbstEntityManagerSkin<CompanyCustomer, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@@ -46,18 +41,14 @@ public class CompanyCustomerManagerSkin
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
controller.companyColumn.setCellValueFactory(param -> Bindings.createStringBinding(() -> {
|
||||
Company company = param.getValue().getCompany().get();
|
||||
if (company != null && !Hibernate.isInitialized(company)) {
|
||||
company = companyService.findById(company.getId());
|
||||
}
|
||||
return company == null ? "-" : company.getName();
|
||||
}, param.getValue().getCompany()));
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||
controller.companyColumn.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
||||
|
||||
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
||||
controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath());
|
||||
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
controller.createdColumn
|
||||
.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
Platform.runLater(() -> {
|
||||
getTableView().getSortOrder().add(controller.idColumn);
|
||||
});
|
||||
|
||||
@@ -1,25 +1,10 @@
|
||||
package com.ecep.contract.manager.ds.customer.controller;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@@ -29,10 +14,31 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@@ -43,7 +49,7 @@ public class CompanyCustomerManagerWindowController
|
||||
|
||||
// columns
|
||||
public TableColumn<CompanyCustomerViewModel, Number> idColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, String> companyColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, Company> companyColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, String> catalogColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, LocalDate> developDateColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, String> pathColumn;
|
||||
@@ -72,7 +78,6 @@ public class CompanyCustomerManagerWindowController
|
||||
return skin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对所有客户的文件进行重置
|
||||
* <p>
|
||||
@@ -108,7 +113,6 @@ public class CompanyCustomerManagerWindowController
|
||||
dialog.initOwner(table.getScene().getWindow());
|
||||
dialog.show();
|
||||
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
Pageable pageRequest = PageRequest.ofSize(50);
|
||||
while (!canceled.get()) {
|
||||
@@ -166,5 +170,4 @@ public class CompanyCustomerManagerWindowController
|
||||
UITools.showTaskDialogAndWait("导出Excel", tasker, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.ecep.contract.manager.ds.other.controller.department.DepartmentManage
|
||||
import com.ecep.contract.manager.ds.other.controller.employee.EmployeeManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.inventory.InventoryManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeFunctionsManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeRolesManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeRoleManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.project.controller.ProjectManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.vendor.controller.CompanyVendorManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.BaseController;
|
||||
@@ -198,7 +198,7 @@ public class HomeWindowController extends BaseController {
|
||||
}
|
||||
|
||||
public void onShowRolesManagerWindowAction(ActionEvent event) {
|
||||
showInOwner(EmployeeRolesManagerWindowController.class);
|
||||
showInOwner(EmployeeRoleManagerWindowController.class);
|
||||
}
|
||||
|
||||
public void onShowFunctionManagerWindowAction(ActionEvent event) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
@@ -27,17 +28,29 @@ import java.time.LocalDate;
|
||||
public class EmployeeManagerWindowController
|
||||
extends AbstManagerWindowController<Employee, EmployeeViewModel, EmployeeManagerSkin> {
|
||||
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> accountColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, Department> departmentColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> aliasColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> codeColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> emailColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, LocalDate> createdColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, LocalDate> entryDateColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, LocalDate> leaveDateColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, Boolean> activeColumn;
|
||||
@FXML
|
||||
public CheckBox activeCheckBox;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,7 @@ import java.util.List;
|
||||
|
||||
@FxmlPath("/ui/employee/employee-auth-bind.fxml")
|
||||
public class EmployeeTabSkinAuthBind
|
||||
extends AbstEmployeeTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel>
|
||||
implements EditableEntityTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel> {
|
||||
extends AbstEmployeeTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel> {
|
||||
public TableColumn<EmployeeAuthBindViewModel, Number> idColumn;
|
||||
public TableColumn<EmployeeAuthBindViewModel, String> ipColumn;
|
||||
public TableColumn<EmployeeAuthBindViewModel, String> macColumn;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -27,18 +28,31 @@ import javafx.stage.Stage;
|
||||
public class InventoryManagerWindowController
|
||||
extends AbstManagerWindowController<Inventory, InventoryViewModel, InventoryManagerSkin> {
|
||||
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> codeColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, InventoryCatalog> catalogColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> specificationColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> unitColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> purchaseTaxRateColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> purchasePriceColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> saleTaxRateColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> salePriceColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, LocalDate> createTimeColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, LocalDateTime> updateDateColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> descriptionColumn;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.stage.WindowEvent;
|
||||
@@ -19,44 +20,81 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@FxmlPath("/ui/inventory/inventory.fxml")
|
||||
public class InventoryWindowController extends AbstEntityController<Inventory, InventoryViewModel> {
|
||||
@FXML
|
||||
public BorderPane root;
|
||||
@FXML
|
||||
public TabPane tabPane;
|
||||
@FXML
|
||||
public Tab baseInfoTab;
|
||||
@FXML
|
||||
public Tab historyPriceTab;
|
||||
@FXML
|
||||
public Tab contractsTab;
|
||||
|
||||
|
||||
@FXML
|
||||
public TextField nameField;
|
||||
@FXML
|
||||
public CheckBox nameLockField;
|
||||
@FXML
|
||||
public TextField catalogField;
|
||||
@FXML
|
||||
public TextField unitField;
|
||||
@FXML
|
||||
public TextField codeField;
|
||||
@FXML
|
||||
public TextField specificationField;
|
||||
@FXML
|
||||
public CheckBox specificationLockField;
|
||||
@FXML
|
||||
public TextField purchasePriceField;
|
||||
@FXML
|
||||
public TextField purchaseTaxRateField;
|
||||
@FXML
|
||||
public TextField purchaseTaxPriceField;
|
||||
@FXML
|
||||
public TextField creatorField;
|
||||
@FXML
|
||||
public TextField createTimeField;
|
||||
@FXML
|
||||
public TextField updaterField;
|
||||
@FXML
|
||||
public TextField updateDateField;
|
||||
@FXML
|
||||
public TextField saleTaxRateField;
|
||||
@FXML
|
||||
public TextField salePriceField;
|
||||
@FXML
|
||||
public TextField saleTaxPriceField;
|
||||
@FXML
|
||||
public TextArea descriptionField;
|
||||
@FXML
|
||||
public Button syncBtn;
|
||||
@FXML
|
||||
public TextField weightUnitField;
|
||||
@FXML
|
||||
public TextField sizeUnitField;
|
||||
@FXML
|
||||
public TextField volumeUnitField;
|
||||
@FXML
|
||||
public TextField weightField;
|
||||
@FXML
|
||||
public TextField packagedWeightField;
|
||||
@FXML
|
||||
public TextField sizeLengthField;
|
||||
@FXML
|
||||
public TextField sizeWidthField;
|
||||
@FXML
|
||||
public TextField sizeHeightField;
|
||||
@FXML
|
||||
public TextField volumeField;
|
||||
@FXML
|
||||
public TextField packagedSizeLengthField;
|
||||
@FXML
|
||||
public TextField packagedSizeWidthField;
|
||||
@FXML
|
||||
public TextField packagedSizeHeightField;
|
||||
@FXML
|
||||
public TextField packagedVolumeField;
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@ import com.ecep.contract.manager.ds.other.service.FunctionService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.manager.ui.TabSkin;
|
||||
|
||||
public abstract class AbstEmployeeRoleBasedTabSkin
|
||||
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRole, EmployeeRoleViewModel>
|
||||
implements TabSkin {
|
||||
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRole, EmployeeRoleViewModel> {
|
||||
|
||||
private EmployeeRoleService roleService;
|
||||
private FunctionService functionService;
|
||||
@@ -38,5 +36,4 @@ public abstract class AbstEmployeeRoleBasedTabSkin
|
||||
return controller.permissionService;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.stage.Stage;
|
||||
@@ -32,16 +33,18 @@ public class EmployeeFunctionsManagerWindowController
|
||||
@Autowired
|
||||
FunctionService functionService;
|
||||
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> keyColumn;
|
||||
|
||||
|
||||
public TableView<PermissionViewModel> permissionTable;
|
||||
public TableColumn<PermissionViewModel, Number> permissionTable_idColumn;
|
||||
public TableColumn<PermissionViewModel, String> permissionTable_nameColumn;
|
||||
public TableColumn<PermissionViewModel, String> permissionTable_keyColumn;
|
||||
public TableColumn<PermissionViewModel, String> permissionTable_descriptionColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> controllerColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> iconColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> descriptionColumn;
|
||||
|
||||
@Override
|
||||
public void show(Stage stage) {
|
||||
|
||||
@@ -11,13 +11,13 @@ import lombok.Setter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
public class EmployeeRoleManagerSkin
|
||||
extends AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRolesManagerWindowController>
|
||||
extends AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRoleManagerWindowController>
|
||||
implements ManagerSkin, EditableEntityTableTabSkin<EmployeeRole, EmployeeRoleViewModel> {
|
||||
|
||||
@Setter
|
||||
private PermissionService permissionService;
|
||||
|
||||
public EmployeeRoleManagerSkin(EmployeeRolesManagerWindowController controller) {
|
||||
public EmployeeRoleManagerSkin(EmployeeRoleManagerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityBasedController;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,21 +7,30 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/employee/roles-manager.fxml")
|
||||
public class EmployeeRolesManagerWindowController
|
||||
public class EmployeeRoleManagerWindowController
|
||||
extends AbstManagerWindowController<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeRolesManagerWindowController.class);
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeRoleManagerWindowController.class);
|
||||
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
@Autowired
|
||||
EmployeeRoleService employeeRoleService;
|
||||
|
||||
|
||||
public TableColumn<EmployeeRoleViewModel, Number> idColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, String> codeColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, String> nameColumn;
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.controlsfx.control.ListSelectionView;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ui.TabSkin;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -10,18 +16,13 @@ import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.Tab;
|
||||
import org.controlsfx.control.ListSelectionView;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EmployeeRoleFunctionsTabSkin extends AbstEmployeeRoleBasedTabSkin implements TabSkin {
|
||||
public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
||||
|
||||
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||
private ListSelectionView<Function> functionsField;
|
||||
|
||||
public EmployeeRoleFunctionsTabSkin(EmployeeRoleWindowController controller) {
|
||||
public EmployeeRoleTabSkinFunctions(EmployeeRoleWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class EmployeeRoleWindowController extends AbstEntityController<EmployeeR
|
||||
@Override
|
||||
protected void registerTabSkins() {
|
||||
registerTabSkin(baseInfoTab, tab -> new EmployeeRoleTabSkinBase(this));
|
||||
registerTabSkin(functionsTab, tab -> new EmployeeRoleFunctionsTabSkin(this));
|
||||
registerTabSkin(functionsTab, tab -> new EmployeeRoleTabSkinFunctions(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,26 +3,15 @@ package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.BaseViewModel;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.EditableEntityTableTabSkin;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FunctionManagerSkin
|
||||
extends AbstEntityManagerSkin<Function, FunctionViewModel, FunctionManagerSkin, EmployeeFunctionsManagerWindowController>
|
||||
implements ManagerSkin, EditableEntityTableTabSkin<Function, FunctionViewModel> {
|
||||
|
||||
private PermissionManagerSkin permissionManagerSkin;
|
||||
extends
|
||||
AbstEntityManagerSkin<Function, FunctionViewModel, FunctionManagerSkin, EmployeeFunctionsManagerWindowController> {
|
||||
|
||||
public FunctionManagerSkin(EmployeeFunctionsManagerWindowController controller) {
|
||||
super(controller);
|
||||
@@ -30,16 +19,6 @@ public class FunctionManagerSkin
|
||||
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
initializeFunctionTable();
|
||||
if (permissionManagerSkin == null) {
|
||||
permissionManagerSkin = new PermissionManagerSkin(controller);
|
||||
}
|
||||
permissionManagerSkin.install();
|
||||
|
||||
}
|
||||
|
||||
private void initializeFunctionTable() {
|
||||
getTableView().setEditable(true);
|
||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
|
||||
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
@@ -50,10 +29,17 @@ public class FunctionManagerSkin
|
||||
controller.keyColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.keyColumn.setOnEditCommit(this::onKeyColumnEditCommit);
|
||||
|
||||
getTableView().getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||
permissionManagerSkin.setViewModel(newValue);
|
||||
permissionManagerSkin.loadTableDataSet();
|
||||
});
|
||||
controller.controllerColumn.setCellValueFactory(param -> param.getValue().getController());
|
||||
controller.controllerColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.controllerColumn.setOnEditCommit(this::onControllerColumnEditCommit);
|
||||
|
||||
controller.iconColumn.setCellValueFactory(param -> param.getValue().getIcon());
|
||||
controller.iconColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.iconColumn.setOnEditCommit(this::onIconColumnEditCommit);
|
||||
|
||||
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
controller.descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.descriptionColumn.setOnEditCommit(this::onDescriptionColumnEditCommit);
|
||||
}
|
||||
|
||||
private void onNameColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
@@ -64,12 +50,21 @@ public class FunctionManagerSkin
|
||||
acceptCellEditEvent(event, FunctionViewModel::getKey);
|
||||
}
|
||||
|
||||
private void onControllerColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
acceptCellEditEvent(event, FunctionViewModel::getController);
|
||||
}
|
||||
|
||||
private void onIconColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
acceptCellEditEvent(event, FunctionViewModel::getIcon);
|
||||
}
|
||||
|
||||
private void onDescriptionColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
acceptCellEditEvent(event, FunctionViewModel::getDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (permissionManagerSkin != null) {
|
||||
permissionManagerSkin.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
protected void onTableRowDoubleClickedAction(FunctionViewModel item) {
|
||||
showInOwner(FunctionWindowController.class, item);
|
||||
}
|
||||
|
||||
protected PermissionService getPermissionService() {
|
||||
@@ -80,5 +75,4 @@ public class FunctionManagerSkin
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityBasedTabSkin;
|
||||
|
||||
import javafx.scene.control.Tab;
|
||||
|
||||
public class FunctionTabSkinBase
|
||||
extends AbstEntityBasedTabSkin<FunctionWindowController, Function, FunctionViewModel> {
|
||||
|
||||
public FunctionTabSkinBase(FunctionWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tab getTab() {
|
||||
return controller.baseInfoTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeTab() {
|
||||
// 绑定UI元素与viewModel的属性
|
||||
controller.nameField.textProperty().bindBidirectional(viewModel.getName());
|
||||
controller.keyField.textProperty().bindBidirectional(viewModel.getKey());
|
||||
controller.controllerField.textProperty().bindBidirectional(viewModel.getController());
|
||||
controller.iconField.textProperty().bindBidirectional(viewModel.getIcon());
|
||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.model.Permission;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ds.other.vo.PermissionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityTableTabSkin;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
|
||||
@FxmlPath("/ui/employee/function-tab-permission.fxml")
|
||||
public class FunctionTabSkinPermission
|
||||
extends
|
||||
AbstEntityTableTabSkin<FunctionWindowController, Function, FunctionViewModel, Permission, PermissionViewModel> {
|
||||
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, String> keyColumn;
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, String> descriptionColumn;
|
||||
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
public FunctionTabSkinPermission(FunctionWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tab getTab() {
|
||||
return controller.permissionTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionService getViewModelService() {
|
||||
return permissionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
super.initializeTable();
|
||||
idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
keyColumn.setCellValueFactory(param -> param.getValue().getKey());
|
||||
// descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<Permission> getSpecification(Function parent) {
|
||||
return SpecificationUtils.and(getSpecification(), (root, query, criteriaBuilder) -> {
|
||||
return criteriaBuilder.equal(root.get("function"), parent);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
import lombok.Getter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/employee/function.fxml")
|
||||
public class FunctionWindowController extends AbstEntityController<Function, FunctionViewModel> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(FunctionWindowController.class);
|
||||
|
||||
/**
|
||||
* 显示界面
|
||||
*/
|
||||
public static void show(FunctionViewModel viewModel, Window window) {
|
||||
show(FunctionWindowController.class, viewModel, window);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public BorderPane root;
|
||||
@FXML
|
||||
public TabPane tabPane;
|
||||
@FXML
|
||||
public Tab baseInfoTab;
|
||||
@FXML
|
||||
public Tab permissionTab;
|
||||
@FXML
|
||||
public TextField nameField;
|
||||
@FXML
|
||||
public TextField keyField;
|
||||
@FXML
|
||||
public TextField controllerField;
|
||||
@FXML
|
||||
public TextField iconField;
|
||||
@FXML
|
||||
public TextField descriptionField;
|
||||
@FXML
|
||||
public Label versionLabel;
|
||||
|
||||
public static void show(Function function, Window owner) {
|
||||
FunctionViewModel model = FunctionViewModel.from(function);
|
||||
show(model, owner);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
FunctionService functionService;
|
||||
|
||||
@Override
|
||||
public void onShown(WindowEvent windowEvent) {
|
||||
super.onShown(windowEvent);
|
||||
getTitle().bind(viewModel.getName().map(name -> "[" + viewModel.getId().get() + "] " + name + " 功能详情"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTabSkins() {
|
||||
registerTabSkin(baseInfoTab, tab -> new FunctionTabSkinBase(this));
|
||||
registerTabSkin(permissionTab, tab -> new FunctionTabSkinPermission(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionService getViewModelService() {
|
||||
return functionService;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
||||
|
||||
@Override
|
||||
public void install() {
|
||||
table = controller.permissionTable;
|
||||
initializeTable();
|
||||
table.setItems(dataSet);
|
||||
loadTableDataSet();
|
||||
@@ -71,17 +70,6 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
||||
public void initializeTable() {
|
||||
table.setEditable(true);
|
||||
|
||||
controller.permissionTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
controller.permissionTable_idColumn.setEditable(false);
|
||||
|
||||
controller.permissionTable_nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
controller.permissionTable_nameColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.permissionTable_nameColumn.setOnEditCommit(this::onNameColumnEditCommitAction);
|
||||
|
||||
controller.permissionTable_keyColumn.setCellValueFactory(param -> param.getValue().getKey());
|
||||
controller.permissionTable_keyColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.permissionTable_keyColumn.setOnEditCommit(this::onKeyColumnEditCommitAction);
|
||||
|
||||
// controller.permissionTable_descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
// controller.permissionTable_descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
// controller.permissionTable_descriptionColumn.setOnEditCommit(this::onSignMethodTableDescriptionColumnEditCommitAction);
|
||||
|
||||
@@ -22,4 +22,13 @@ public class Function implements IdentityEntity, NamedEntity {
|
||||
|
||||
@Column(name = "IS_ACTIVE")
|
||||
private boolean active;
|
||||
|
||||
@Column(name = "CONTROLLER", columnDefinition = "VARCHAR(255)")
|
||||
private String controller;
|
||||
|
||||
@Column(name = "ICON", columnDefinition = "VARCHAR(255)")
|
||||
private String icon;
|
||||
|
||||
@Column(name = "DESCRIPTION", columnDefinition = "VARCHAR(255)")
|
||||
private String description;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.ecep.contract.manager.ds.other.service;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.repository.FunctionRepository;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -16,6 +12,11 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.repository.FunctionRepository;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "function")
|
||||
@@ -24,29 +25,26 @@ public class FunctionService implements ViewModelService<Function, FunctionViewM
|
||||
@Autowired
|
||||
private FunctionRepository functionRepository;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@Cacheable(key = "'func-'+#p0")
|
||||
@Cacheable(key = "#p0")
|
||||
public Function findById(Integer id) {
|
||||
return functionRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Cacheable(key = "'func-code-'+#p0")
|
||||
@Cacheable(key = "'code-'+#p0")
|
||||
public Function findByCode(String code) {
|
||||
// return functionRepository.findByCode(code).orElse(null);
|
||||
// return functionRepository.findByCode(code).orElse(null);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "'func-'+#p0.id"),
|
||||
// @CacheEvict(key = "'func-code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public Function save(Function role) {
|
||||
return functionRepository.save(role);
|
||||
}
|
||||
@@ -56,12 +54,10 @@ public class FunctionService implements ViewModelService<Function, FunctionViewM
|
||||
return FunctionViewModel.from(entity);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "'func-'+#p0.id"),
|
||||
// @CacheEvict(key = "'func-code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public void delete(Function entity) {
|
||||
functionRepository.delete(entity);
|
||||
}
|
||||
@@ -78,7 +74,9 @@ public class FunctionService implements ViewModelService<Function, FunctionViewM
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("key"), "%" + searchText + "%"),
|
||||
builder.like(root.get("name"), "%" + searchText + "%")
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("controller"), "%" + searchText + "%"),
|
||||
builder.like(root.get("icon"), "%" + searchText + "%")
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package com.ecep.contract.manager.ds.other.vo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
private SimpleStringProperty name = new SimpleStringProperty();
|
||||
private SimpleStringProperty key = new SimpleStringProperty();
|
||||
private SimpleStringProperty controller = new SimpleStringProperty();
|
||||
private SimpleStringProperty icon = new SimpleStringProperty();
|
||||
private SimpleStringProperty description = new SimpleStringProperty();
|
||||
|
||||
public static FunctionViewModel from(Function v) {
|
||||
FunctionViewModel model = new FunctionViewModel();
|
||||
@@ -26,6 +29,9 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
super.updateFrom(v);
|
||||
getName().set(v.getName());
|
||||
getKey().set(v.getKey());
|
||||
getController().set(v.getController());
|
||||
getIcon().set(v.getIcon());
|
||||
getDescription().set(v.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,6 +45,18 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
v.setKey(key.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(controller.get(), v.getController())) {
|
||||
v.setController(controller.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(icon.get(), v.getIcon())) {
|
||||
v.setIcon(icon.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(description.get(), v.getDescription())) {
|
||||
v.setDescription(description.get());
|
||||
modified = true;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.ecep.contract.manager.ds.other.vo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.model.Permission;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PermissionViewModel extends IdentityViewModel<Permission> {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ecep.contract.manager.ds.project.controller;
|
||||
|
||||
import com.ecep.contract.manager.SpringApp;
|
||||
import com.ecep.contract.manager.ds.company.CompanyStringConverter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
||||
import com.ecep.contract.manager.ds.project.model.ProductType;
|
||||
import com.ecep.contract.manager.ds.project.model.Project;
|
||||
@@ -17,6 +20,7 @@ import com.ecep.contract.manager.ui.BaseController;
|
||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
@@ -24,13 +28,12 @@ import javafx.scene.control.cell.CheckBoxTableCell;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.util.converter.CurrencyStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
public class ProjectManagerSkin
|
||||
extends AbstEntityManagerSkin<Project, ProjectViewModel, ProjectManagerSkin, ProjectManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
@Setter
|
||||
private ProjectService projectService;
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private ProjectTypeService projectTypeService;
|
||||
@Setter
|
||||
@@ -44,10 +47,14 @@ public class ProjectManagerSkin
|
||||
}
|
||||
|
||||
public ProjectService getProjectService() {
|
||||
if (projectService == null) {
|
||||
projectService = getBean(ProjectService.class);
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
public CompanyService getCompanyService(){
|
||||
if (companyService == null) {
|
||||
companyService = getBean(CompanyService.class);
|
||||
}
|
||||
return projectService;
|
||||
return companyService;
|
||||
}
|
||||
|
||||
public SaleTypeService getSaleTypeService() {
|
||||
@@ -116,9 +123,9 @@ public class ProjectManagerSkin
|
||||
}
|
||||
|
||||
|
||||
private void initializeCustomerColumn(TableColumn<ProjectViewModel, String> column) {
|
||||
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
|
||||
column.setCellValueFactory(param -> param.getValue().getCustomer().map(converter::toString));
|
||||
private void initializeCustomerColumn(TableColumn<ProjectViewModel, Company> column) {
|
||||
column.setCellValueFactory(param -> param.getValue().getCustomer());
|
||||
column.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
||||
}
|
||||
|
||||
private void initializeProductTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ecep.contract.manager.ds.project.controller;
|
||||
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.project.controller.industry.ProjectIndustryManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.project.controller.product_type.ProductTypeManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.project.controller.project_type.ProjectTypeManagerWindowController;
|
||||
@@ -45,7 +46,7 @@ public class ProjectManagerWindowController
|
||||
public TableColumn<ProjectViewModel, String> projectTypeColumn;
|
||||
public TableColumn<ProjectViewModel, String> productTypeColumn;
|
||||
public TableColumn<ProjectViewModel, LocalDate> createdColumn;
|
||||
public TableColumn<ProjectViewModel, String> customerColumn;
|
||||
public TableColumn<ProjectViewModel, Company> customerColumn;
|
||||
public TableColumn<ProjectViewModel, Boolean> useBidColumn;
|
||||
public TableColumn<ProjectViewModel, Boolean> useOfferColumn;
|
||||
public TableColumn<ProjectViewModel, Number> amountColumn;
|
||||
@@ -67,9 +68,7 @@ public class ProjectManagerWindowController
|
||||
|
||||
@Override
|
||||
protected ProjectManagerSkin createDefaultSkin() {
|
||||
ProjectManagerSkin skin = new ProjectManagerSkin(this);
|
||||
skin.setProjectService(projectService);
|
||||
return skin;
|
||||
return new ProjectManagerSkin(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
|
||||
|
||||
public ProjectTabSkinCustomerSatisfactionSurvey(ProjectWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
@@ -79,12 +78,11 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
public CompletableFuture<?> refresh() {
|
||||
CompletableFuture<?> future = new CompletableFuture<>();
|
||||
runAsync(() -> {
|
||||
try {
|
||||
loadTableDataSet();
|
||||
future.complete(null);
|
||||
} catch (Exception e) {
|
||||
future.completeExceptionally(e);
|
||||
}
|
||||
loadTableDataSet();
|
||||
future.complete(null);
|
||||
}).exceptionally(ex -> {
|
||||
future.completeExceptionally(ex);
|
||||
return null;
|
||||
});
|
||||
return future;
|
||||
}
|
||||
@@ -125,7 +123,6 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
showInOwner(CustomerSatisfactionSurveyWindowController.class, item);
|
||||
}
|
||||
|
||||
|
||||
private CustomerSatisfactionSurveyService getCustomerSatisfactionSurveyService() {
|
||||
if (satisfactionSurveyService == null) {
|
||||
satisfactionSurveyService = getBean(CustomerSatisfactionSurveyService.class);
|
||||
@@ -175,7 +172,8 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
return customerFileService;
|
||||
}
|
||||
|
||||
private static class EvaluationFileTableCell extends TableCell<ProjectBidViewModel, CompanyCustomerEvaluationFormFile> {
|
||||
private static class EvaluationFileTableCell
|
||||
extends TableCell<ProjectBidViewModel, CompanyCustomerEvaluationFormFile> {
|
||||
private CompanyCustomerFileService fileService;
|
||||
|
||||
public CompanyCustomerFileService getFileService() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
@@ -25,29 +26,50 @@ import org.springframework.stereotype.Component;
|
||||
@FxmlPath("/ui/project/project-quotation.fxml")
|
||||
public class ProjectQuotationWindowController
|
||||
extends AbstEntityController<ProjectQuotation, ProjectQuotationViewModel> {
|
||||
@FXML
|
||||
public BorderPane root;
|
||||
@FXML
|
||||
public Tab baseInfoTab;
|
||||
|
||||
@FXML
|
||||
public Button importExcelBtn;
|
||||
@FXML
|
||||
public Button exportExcelBtn;
|
||||
|
||||
@FXML
|
||||
public TextField applicantField;
|
||||
@FXML
|
||||
public TextField applyTimeField;
|
||||
@FXML
|
||||
public TextField authorizerField;
|
||||
@FXML
|
||||
public TextField authorizationTimeField;
|
||||
@FXML
|
||||
public HBox levelGroup;
|
||||
@FXML
|
||||
public RadioButton good_radio_btn;
|
||||
@FXML
|
||||
public RadioButton bad_radio_btn;
|
||||
@FXML
|
||||
public RadioButton poor_radio_btn;
|
||||
@FXML
|
||||
public CheckBox standardPayWayField;
|
||||
@FXML
|
||||
public TextField noStandardPayWayTextField;
|
||||
@FXML
|
||||
public TextField amountField;
|
||||
@FXML
|
||||
public TextField evaluationFileField;
|
||||
@FXML
|
||||
public Button evaluationFileBtn;
|
||||
|
||||
@FXML
|
||||
public TextField authorizationFileField;
|
||||
@FXML
|
||||
public Button openFileBtn;
|
||||
@FXML
|
||||
public Button changeFileBtn;
|
||||
@FXML
|
||||
public TextArea descriptionField;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
package com.ecep.contract.manager.ds.vendor.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.vendor.model.CompanyVendor;
|
||||
import com.ecep.contract.manager.ds.vendor.model.VendorCatalog;
|
||||
@@ -10,24 +19,17 @@ import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.MyStringUtils;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CompanyVendorManagerSkin
|
||||
extends AbstEntityManagerSkin<CompanyVendor, CompanyVendorViewModel, CompanyVendorManagerSkin, CompanyVendorManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends
|
||||
AbstEntityManagerSkin<CompanyVendor, CompanyVendorViewModel, CompanyVendorManagerSkin, CompanyVendorManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@@ -66,7 +68,8 @@ public class CompanyVendorManagerSkin
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
|
||||
List<VendorTypeLocal> vendorTypeLocals = getCompanyVendorService().findAllTypes(controller.getLocale().toLanguageTag());
|
||||
List<VendorTypeLocal> vendorTypeLocals = getCompanyVendorService()
|
||||
.findAllTypes(controller.getLocale().toLanguageTag());
|
||||
ComboBoxUtils.initialComboBox(controller.typeSelector, vendorTypeLocals, true);
|
||||
controller.typeSelector.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
loadTableDataSet(true);
|
||||
@@ -75,8 +78,9 @@ public class CompanyVendorManagerSkin
|
||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
controller.codeColumn.setCellValueFactory(param -> param.getValue().getCode());
|
||||
|
||||
Map<Integer, VendorCatalog> vendorClassMap = getCompanyVendorService().findAllCatalogs().stream()
|
||||
.collect(Collectors.toMap(VendorCatalog::getId, v -> v));
|
||||
|
||||
Map<Integer, VendorCatalog> vendorClassMap = getCompanyVendorService().findAllCatalogs().stream().collect(Collectors.toMap(VendorCatalog::getId, v -> v));
|
||||
controller.catalogColumn.setCellValueFactory(param -> Bindings.createStringBinding(() -> {
|
||||
SimpleObjectProperty<VendorCatalog> catalog = param.getValue().getCatalog();
|
||||
VendorCatalog vendorCatalog = catalog.get();
|
||||
@@ -98,8 +102,7 @@ public class CompanyVendorManagerSkin
|
||||
return vendorCatalog.getName();
|
||||
}
|
||||
}, param.getValue().getCatalog()));
|
||||
|
||||
|
||||
|
||||
controller.typeColumn.setCellValueFactory(param -> param.getValue().getType().map(type -> {
|
||||
VendorTypeLocal local = vendorTypeLocals.stream().filter(v -> v.getType() == type).findFirst().orElse(null);
|
||||
if (local == null) {
|
||||
@@ -110,21 +113,13 @@ public class CompanyVendorManagerSkin
|
||||
}));
|
||||
|
||||
controller.purchaseColumn.setCellValueFactory(param -> param.getValue().getPurchase());
|
||||
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany().map(v -> {
|
||||
if (v == null) {
|
||||
return "-";
|
||||
}
|
||||
if (!Hibernate.isInitialized(v)) {
|
||||
v = companyService.findById(v.getId());
|
||||
param.getValue().getCompany().set(v);
|
||||
}
|
||||
return v.getName();
|
||||
}));
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||
controller.companyColumn.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
||||
|
||||
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
||||
controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath());
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
controller.createdColumn
|
||||
.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
|
||||
Platform.runLater(() -> {
|
||||
getTableView().getSortOrder().add(controller.idColumn);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ecep.contract.manager.ds.vendor.controller;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.vendor.controller.approved_list.CompanyVendorApprovedListManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.vendor.controller.group.VendorGroupManagerWindowController;
|
||||
@@ -40,7 +41,7 @@ public class CompanyVendorManagerWindowController
|
||||
|
||||
// columns
|
||||
public TableColumn<CompanyVendorViewModel, Number> idColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> companyColumn;
|
||||
public TableColumn<CompanyVendorViewModel, Company> companyColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> codeColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> catalogColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> typeColumn;
|
||||
|
||||
Reference in New Issue
Block a user