refactor(vo): 重构VO对象结构,统一字段命名和接口实现
重构所有VO对象,统一字段命名规范,移除冗余字段,优化接口实现 新增Voable接口用于VO对象转换 调整BaseViewModel和ProjectBasedViewModel接口定义 更新相关服务和控制器以适应VO对象变更
This commit is contained in:
@@ -9,6 +9,7 @@ import java.util.concurrent.ScheduledFuture;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
@@ -486,10 +487,10 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected List<TV> loadTableData() {
|
protected List<TV> loadTableData() {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
ViewModelService<T, TV> service = getViewModelService();
|
ViewModelService<T, TV> service = getViewModelService();
|
||||||
long timeMillis = System.currentTimeMillis();
|
long timeMillis = System.currentTimeMillis();
|
||||||
Page<T> page = service.findAll(params, getPageable());
|
Page<T> page = service.findAll(params == null ? null : params.build(), getPageable());
|
||||||
long timeCost = System.currentTimeMillis() - timeMillis;
|
long timeCost = System.currentTimeMillis() - timeMillis;
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("load table data cost: {} ms", timeCost);
|
logger.debug("load table data cost: {} ms", timeCost);
|
||||||
@@ -509,7 +510,8 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
* @param future
|
* @param future
|
||||||
*/
|
*/
|
||||||
private void asyncLoadTableData(QueryService<T, TV> queryService, CompletableFuture<Void> future) {
|
private void asyncLoadTableData(QueryService<T, TV> queryService, CompletableFuture<Void> future) {
|
||||||
queryService.asyncFindAll(getSpecification(), getPageable()).whenComplete((result, ex) -> {
|
ParamUtils.Builder params = getSpecification();
|
||||||
|
queryService.asyncFindAll(params == null ? null : params.build(), getPageable()).whenComplete((result, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
future.completeExceptionally(ex);
|
future.completeExceptionally(ex);
|
||||||
return;
|
return;
|
||||||
@@ -538,7 +540,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getSpecification() {
|
public ParamUtils.Builder getSpecification() {
|
||||||
TextField field = controller.searchKeyField;
|
TextField field = controller.searchKeyField;
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
return getViewModelService().getSpecification(field.getText());
|
return getViewModelService().getSpecification(field.getText());
|
||||||
@@ -552,7 +554,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
* @param searchText
|
* @param searchText
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected Map<String, Object> getSpecification(String searchText) {
|
protected ParamUtils.Builder getSpecification(String searchText) {
|
||||||
return getViewModelService().getSpecification(searchText);
|
return getViewModelService().getSpecification(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.FxmlUtils;
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
import org.apache.logging.log4j.util.Strings;
|
import org.apache.logging.log4j.util.Strings;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -184,7 +185,7 @@ public class BaseController {
|
|||||||
private String stageKey;
|
private String stageKey;
|
||||||
public Label leftStatusLabel;
|
public Label leftStatusLabel;
|
||||||
public Label rightStatusLabel;
|
public Label rightStatusLabel;
|
||||||
private Employee currentUser;
|
private EmployeeVo currentUser;
|
||||||
|
|
||||||
private HashMap<Class<?>, Object> cachedBeans = new HashMap<>();
|
private HashMap<Class<?>, Object> cachedBeans = new HashMap<>();
|
||||||
|
|
||||||
@@ -210,7 +211,7 @@ public class BaseController {
|
|||||||
return getCachedBean(EmployeeService.class);
|
return getCachedBean(EmployeeService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Employee getCurrentUser() {
|
public EmployeeVo getCurrentUser() {
|
||||||
if (currentUser == null) {
|
if (currentUser == null) {
|
||||||
currentUser = getEmployeeService().findById(Desktop.instance.getActiveEmployeeId());
|
currentUser = getEmployeeService().findById(Desktop.instance.getActiveEmployeeId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
package com.ecep.contract.controller;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.model.CloudRk;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CloudRkService;
|
import com.ecep.contract.service.CloudRkService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.vm.CloudRkViewModel;
|
import com.ecep.contract.vm.CloudRkViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudRkVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -21,7 +19,7 @@ import javafx.scene.control.cell.CheckBoxTableCell;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class CloudRkManagerSkin
|
public class CloudRkManagerSkin
|
||||||
extends AbstEntityManagerSkin<CloudRk, CloudRkViewModel, CloudRkManagerSkin, CloudRkManagerWindowController> {
|
extends AbstEntityManagerSkin<CloudRkVo, CloudRkViewModel, CloudRkManagerSkin, CloudRkManagerWindowController> {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
@@ -104,11 +102,8 @@ public class CloudRkManagerSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableRowDoubleClickedAction(CloudRkViewModel item) {
|
protected void onTableRowDoubleClickedAction(CloudRkViewModel item) {
|
||||||
Company company = item.getCompany().get();
|
Integer companyId = item.getCompany().get();
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
item.getCompany().set(company);
|
|
||||||
}
|
|
||||||
CompanyWindowController.show(company, getTableView().getScene().getWindow());
|
CompanyWindowController.show(company, getTableView().getScene().getWindow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.ecep.contract.Message;
|
import com.ecep.contract.Message;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.model.CloudRk;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CloudRkService;
|
import com.ecep.contract.service.CloudRkService;
|
||||||
import com.ecep.contract.task.CloudRkSyncTask;
|
import com.ecep.contract.task.CloudRkSyncTask;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CloudRkViewModel;
|
import com.ecep.contract.vm.CloudRkViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudRkVo;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -31,7 +30,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/cloud/rk_manager.fxml")
|
@FxmlPath("/ui/cloud/rk_manager.fxml")
|
||||||
public class CloudRkManagerWindowController
|
public class CloudRkManagerWindowController
|
||||||
extends AbstManagerWindowController<CloudRk, CloudRkViewModel, CloudRkManagerSkin> {
|
extends AbstManagerWindowController<CloudRkVo, CloudRkViewModel, CloudRkManagerSkin> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CloudRkManagerWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CloudRkManagerWindowController.class);
|
||||||
|
|
||||||
public static void show() {
|
public static void show() {
|
||||||
@@ -43,8 +42,10 @@ public class CloudRkManagerWindowController
|
|||||||
|
|
||||||
public TableColumn<CloudRkViewModel, Number> idColumn;
|
public TableColumn<CloudRkViewModel, Number> idColumn;
|
||||||
public TableColumn<CloudRkViewModel, LocalDateTime> latestUpdateColumn;
|
public TableColumn<CloudRkViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
|
/**
|
||||||
public TableColumn<CloudRkViewModel, Company> companyColumn;
|
* 集团相关方, Company
|
||||||
|
*/
|
||||||
|
public TableColumn<CloudRkViewModel, Integer> companyColumn;
|
||||||
public TableColumn<CloudRkViewModel, String> cloudIdColumn;
|
public TableColumn<CloudRkViewModel, String> cloudIdColumn;
|
||||||
public TableColumn<CloudRkViewModel, LocalDateTime> cloudLatestColumn;
|
public TableColumn<CloudRkViewModel, LocalDateTime> cloudLatestColumn;
|
||||||
public TableColumn<CloudRkViewModel, LocalDateTime> cloudBlackListUpdatedColumn;
|
public TableColumn<CloudRkViewModel, LocalDateTime> cloudBlackListUpdatedColumn;
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
package com.ecep.contract.controller;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.model.CloudTyc;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CloudTycService;
|
import com.ecep.contract.service.CloudTycService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudTycVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -26,7 +18,7 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class CloudTycManagerSkin
|
public class CloudTycManagerSkin
|
||||||
extends
|
extends
|
||||||
AbstEntityManagerSkin<CloudTyc, CloudTycInfoViewModel, CloudTycManagerSkin, CloudTycManagerWindowController> {
|
AbstEntityManagerSkin<CloudTycVo, CloudTycInfoViewModel, CloudTycManagerSkin, CloudTycManagerWindowController> {
|
||||||
@Setter
|
@Setter
|
||||||
private CloudTycService cloudTycService;
|
private CloudTycService cloudTycService;
|
||||||
|
|
||||||
@@ -91,21 +83,20 @@ public class CloudTycManagerSkin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (CloudTycInfoViewModel selectedItem : selectedItems) {
|
for (CloudTycInfoViewModel selectedItem : selectedItems) {
|
||||||
CloudTyc cloudTyc = getCloudTycService().findById(selectedItem.getId().get());
|
CloudTycVo cloudTyc = getCloudTycService().findById(selectedItem.getId().get());
|
||||||
// selectedItem.getDescription().set("");
|
// selectedItem.getDescription().set("");
|
||||||
if (selectedItem.copyTo(cloudTyc)) {
|
if (selectedItem.copyTo(cloudTyc)) {
|
||||||
CloudTyc saved = getCloudTycService().save(cloudTyc);
|
CloudTycVo saved = getCloudTycService().save(cloudTyc);
|
||||||
selectedItem.update(saved);
|
selectedItem.update(saved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
@Override
|
@Override
|
||||||
protected void onTableRowDoubleClickedAction(CloudTycInfoViewModel item) {
|
protected void onTableRowDoubleClickedAction(CloudTycInfoViewModel item) {
|
||||||
Company company = item.getCompany().get();
|
Integer companyId = item.getCompany().get();
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
}
|
|
||||||
CompanyWindowController.show(company, getTableView().getScene().getWindow());
|
CompanyWindowController.show(company, getTableView().getScene().getWindow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.model.CloudTyc;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CloudTycService;
|
import com.ecep.contract.service.CloudTycService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudTycVo;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -26,7 +25,7 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/cloud/tyc_manager.fxml")
|
@FxmlPath("/ui/cloud/tyc_manager.fxml")
|
||||||
public class CloudTycManagerWindowController
|
public class CloudTycManagerWindowController
|
||||||
extends AbstManagerWindowController<CloudTyc, CloudTycInfoViewModel, CloudTycManagerSkin> {
|
extends AbstManagerWindowController<CloudTycVo, CloudTycInfoViewModel, CloudTycManagerSkin> {
|
||||||
|
|
||||||
public static void show() {
|
public static void show() {
|
||||||
show(CloudTycManagerWindowController.class, null);
|
show(CloudTycManagerWindowController.class, null);
|
||||||
@@ -43,8 +42,11 @@ public class CloudTycManagerWindowController
|
|||||||
@FXML
|
@FXML
|
||||||
public TableColumn<CloudTycInfoViewModel, LocalDateTime> latestUpdateColumn;
|
public TableColumn<CloudTycInfoViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司, Company
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<CloudTycInfoViewModel, Company> companyColumn;
|
public TableColumn<CloudTycInfoViewModel, Integer> companyColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<CloudTycInfoViewModel, String> cloudIdColumn;
|
public TableColumn<CloudTycInfoViewModel, String> cloudIdColumn;
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.ecep.contract.model.BaseEnumEntity;
|
|||||||
import com.ecep.contract.model.BasedEntity;
|
import com.ecep.contract.model.BasedEntity;
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.model.NamedEntity;
|
import com.ecep.contract.model.NamedEntity;
|
||||||
|
import com.ecep.contract.service.IEntityService;
|
||||||
|
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
@@ -68,9 +69,7 @@ public class ComboBoxUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ComboBoxStringConverter<T> extends javafx.util.StringConverter<T> {
|
||||||
private static
|
|
||||||
class ComboBoxStringConverter<T> extends javafx.util.StringConverter<T> {
|
|
||||||
private final List<T> dataset;
|
private final List<T> dataset;
|
||||||
|
|
||||||
public ComboBoxStringConverter(ObservableList<T> list) {
|
public ComboBoxStringConverter(ObservableList<T> list) {
|
||||||
@@ -118,8 +117,41 @@ public class ComboBoxUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends IdentityEntity & NamedEntity> void initialComboBox(
|
public static <T extends IdentityEntity & NamedEntity> void initialComboBox(
|
||||||
ComboBox<T> comboBox, Property<T> property, List<T> dataSet, boolean hasNull
|
ComboBox<T> comboBox, Property<Integer> property, IEntityService<T> queryService, boolean hasNull) {
|
||||||
) {
|
ObservableList<T> list = FXCollections.observableArrayList();
|
||||||
|
if (hasNull) {
|
||||||
|
list.add(null);
|
||||||
|
}
|
||||||
|
list.addAll(queryService.findAll());
|
||||||
|
comboBox.setItems(list);
|
||||||
|
// 从ComboBox选择到property的单向绑定
|
||||||
|
comboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
property.setValue(newValue != null ? newValue.getId() : null);
|
||||||
|
});
|
||||||
|
// 从property到ComboBox的单向绑定
|
||||||
|
property.addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (newValue == null) {
|
||||||
|
comboBox.getSelectionModel().clearSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
list.stream()
|
||||||
|
.filter(item -> item != null && newValue.equals(item.getId()))
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(comboBox.getSelectionModel()::select);
|
||||||
|
});
|
||||||
|
EntityStringConverter<T> converter = new EntityStringConverter<>(list);
|
||||||
|
comboBox.setConverter(converter);
|
||||||
|
// 初始化ComboBox的值
|
||||||
|
if (property.getValue() != null) {
|
||||||
|
list.stream()
|
||||||
|
.filter(item -> item != null && property.getValue().equals(item.getId()))
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(comboBox.getSelectionModel()::select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends IdentityEntity & NamedEntity> void initialComboBox(
|
||||||
|
ComboBox<T> comboBox, Property<T> property, List<T> dataSet, boolean hasNull) {
|
||||||
ObservableList<T> list = FXCollections.observableArrayList();
|
ObservableList<T> list = FXCollections.observableArrayList();
|
||||||
if (hasNull) {
|
if (hasNull) {
|
||||||
list.add(null);
|
list.add(null);
|
||||||
@@ -138,7 +170,7 @@ public class ComboBoxUtils {
|
|||||||
public static <K> void bindComboBox(ComboBox<K> comboBox, Property<K> property) {
|
public static <K> void bindComboBox(ComboBox<K> comboBox, Property<K> property) {
|
||||||
property.addListener((observable, oldValue, newValue) -> {
|
property.addListener((observable, oldValue, newValue) -> {
|
||||||
comboBox.setValue(newValue);
|
comboBox.setValue(newValue);
|
||||||
// comboBox.getItems().stream().filter(k->k.equals(newValue)).findFirst().ifPresent(comboBox::setValue);
|
// comboBox.getItems().stream().filter(k->k.equals(newValue)).findFirst().ifPresent(comboBox::setValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
comboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
comboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
@@ -150,7 +182,8 @@ public class ComboBoxUtils {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <K extends Enum<?>, T extends BaseEnumEntity<K>> void bindComboBox(ComboBox<T> comboBox, Property<K> property, List<T> dataSet) {
|
public static <K extends Enum<?>, T extends BaseEnumEntity<K>> void bindComboBox(ComboBox<T> comboBox,
|
||||||
|
Property<K> property, List<T> dataSet) {
|
||||||
property.addListener((observable, oldValue, newValue) -> {
|
property.addListener((observable, oldValue, newValue) -> {
|
||||||
dataSet.stream().filter(l -> l.getType() == newValue).findFirst().ifPresent(comboBox::setValue);
|
dataSet.stream().filter(l -> l.getType() == newValue).findFirst().ifPresent(comboBox::setValue);
|
||||||
});
|
});
|
||||||
@@ -163,13 +196,13 @@ public class ComboBoxUtils {
|
|||||||
property.setValue(newValue.getType());
|
property.setValue(newValue.getType());
|
||||||
});
|
});
|
||||||
|
|
||||||
// comboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
|
// comboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
// if (newValue == null) {
|
// if (newValue == null) {
|
||||||
// property.setValue(null);
|
// property.setValue(null);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// property.setValue(newValue.getType());
|
// property.setValue(newValue.getType());
|
||||||
// });
|
// });
|
||||||
|
|
||||||
comboBox.setCellFactory(param -> new ListCell<>() {
|
comboBox.setCellFactory(param -> new ListCell<>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,32 +1,24 @@
|
|||||||
package com.ecep.contract.controller;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.model.CloudYu;
|
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.YongYouU8Service;
|
import com.ecep.contract.service.YongYouU8Service;
|
||||||
import com.ecep.contract.util.ParamUtils;
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.vm.CloudYuInfoViewModel;
|
import com.ecep.contract.vm.CloudYuInfoViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudYuVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
public class YongYouU8ManagerSkin
|
public class YongYouU8ManagerSkin
|
||||||
extends
|
extends
|
||||||
AbstEntityManagerSkin<CloudYu, CloudYuInfoViewModel, YongYouU8ManagerSkin, YongYouU8ManagerWindowController>
|
AbstEntityManagerSkin<CloudYuVo, CloudYuInfoViewModel, YongYouU8ManagerSkin, YongYouU8ManagerWindowController>
|
||||||
implements ManagerSkin {
|
implements ManagerSkin {
|
||||||
|
|
||||||
public YongYouU8ManagerSkin(YongYouU8ManagerWindowController controller) {
|
public YongYouU8ManagerSkin(YongYouU8ManagerWindowController controller) {
|
||||||
@@ -80,10 +72,10 @@ public class YongYouU8ManagerSkin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (CloudYuInfoViewModel selectedItem : selectedItems) {
|
for (CloudYuInfoViewModel selectedItem : selectedItems) {
|
||||||
CloudYu cloudYu = getU8Service().findById(selectedItem.getId().get());
|
CloudYuVo yongYouU8Vo = getU8Service().findById(selectedItem.getId().get());
|
||||||
selectedItem.getCustomerCode().set("");
|
selectedItem.getCustomerCode().set("");
|
||||||
if (selectedItem.copyTo(cloudYu)) {
|
if (selectedItem.copyTo(yongYouU8Vo)) {
|
||||||
CloudYu saved = getU8Service().save(cloudYu);
|
CloudYuVo saved = getU8Service().save(yongYouU8Vo);
|
||||||
selectedItem.update(saved);
|
selectedItem.update(saved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,10 +83,8 @@ public class YongYouU8ManagerSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableRowDoubleClickedAction(CloudYuInfoViewModel item) {
|
protected void onTableRowDoubleClickedAction(CloudYuInfoViewModel item) {
|
||||||
Company company = item.getCompany().get();
|
Integer companyId = item.getCompany().get();
|
||||||
if (!ProxyUtils.isInitialized(item)) {
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
}
|
|
||||||
CompanyWindowController.show(company, getTableView().getScene().getWindow());
|
CompanyWindowController.show(company, getTableView().getScene().getWindow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.Desktop;
|
import com.ecep.contract.Desktop;
|
||||||
import com.ecep.contract.model.CloudYu;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.YongYouU8Service;
|
import com.ecep.contract.service.YongYouU8Service;
|
||||||
import com.ecep.contract.task.ContractSyncTask;
|
import com.ecep.contract.task.ContractSyncTask;
|
||||||
import com.ecep.contract.task.CustomerSyncTask;
|
import com.ecep.contract.task.CustomerSyncTask;
|
||||||
@@ -19,6 +17,7 @@ import com.ecep.contract.task.VendorSyncTask;
|
|||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CloudYuInfoViewModel;
|
import com.ecep.contract.vm.CloudYuInfoViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudYuVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -29,7 +28,7 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/cloud/u8_manager.fxml")
|
@FxmlPath("/ui/cloud/u8_manager.fxml")
|
||||||
public class YongYouU8ManagerWindowController
|
public class YongYouU8ManagerWindowController
|
||||||
extends AbstManagerWindowController<CloudYu, CloudYuInfoViewModel, YongYouU8ManagerSkin> {
|
extends AbstManagerWindowController<CloudYuVo, CloudYuInfoViewModel, YongYouU8ManagerSkin> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(YongYouU8ManagerWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(YongYouU8ManagerWindowController.class);
|
||||||
|
|
||||||
public static void show() {
|
public static void show() {
|
||||||
@@ -38,7 +37,7 @@ public class YongYouU8ManagerWindowController
|
|||||||
|
|
||||||
public TableColumn<CloudYuInfoViewModel, Number> idColumn;
|
public TableColumn<CloudYuInfoViewModel, Number> idColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, LocalDateTime> latestUpdateColumn;
|
public TableColumn<CloudYuInfoViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, Company> companyColumn;
|
public TableColumn<CloudYuInfoViewModel, Integer> companyColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, String> cloudIdColumn;
|
public TableColumn<CloudYuInfoViewModel, String> cloudIdColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, LocalDateTime> cloudLatestColumn;
|
public TableColumn<CloudYuInfoViewModel, LocalDateTime> cloudLatestColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, String> descriptionColumn;
|
public TableColumn<CloudYuInfoViewModel, String> descriptionColumn;
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ package com.ecep.contract.controller.company;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
|
|
||||||
public abstract class AbstCompanyBasedTabSkin
|
public abstract class AbstCompanyBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<CompanyWindowController, Company, CompanyViewModel>
|
extends AbstEntityBasedTabSkin<CompanyWindowController, CompanyVo, CompanyViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstCompanyBasedTabSkin(CompanyWindowController controller) {
|
public AbstCompanyBasedTabSkin(CompanyWindowController controller) {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.ecep.contract.controller.company;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.controller.table.TableOfTabSkin;
|
import com.ecep.contract.controller.table.TableOfTabSkin;
|
||||||
@@ -40,8 +38,8 @@ public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(CompanyVo parent) {
|
public ParamUtils.Builder getSpecification(CompanyVo parent) {
|
||||||
return ParamUtils.equal("company", parent.getId());
|
return ParamUtils.builder().equals("company", parent.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.ecep.contract.controller.company;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -18,6 +17,7 @@ import com.ecep.contract.service.CompanyContactService;
|
|||||||
import com.ecep.contract.util.FxmlUtils;
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyContactViewModel;
|
import com.ecep.contract.vm.CompanyContactViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyContactVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -84,7 +84,7 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
public Label versionLabel;
|
public Label versionLabel;
|
||||||
public Button saveBtn;
|
public Button saveBtn;
|
||||||
|
|
||||||
private CompletableFuture<CompanyContact> companyContactLoadedFuture;
|
private CompletableFuture<CompanyContactVo> companyContactLoadedFuture;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
@@ -103,7 +103,7 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
initializeBaseTab();
|
initializeBaseTab();
|
||||||
|
|
||||||
companyContactLoadedFuture = CompletableFuture.supplyAsync(() -> {
|
companyContactLoadedFuture = CompletableFuture.supplyAsync(() -> {
|
||||||
CompanyContact oldName = companyContactService.findById(viewModel.getId().get());
|
CompanyContactVo oldName = companyContactService.findById(viewModel.getId().get());
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
viewModel.update(oldName);
|
viewModel.update(oldName);
|
||||||
viewModel.bindListener();
|
viewModel.bindListener();
|
||||||
@@ -128,9 +128,9 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
saveBtn.disableProperty().bind(viewModel.getChanged().not());
|
saveBtn.disableProperty().bind(viewModel.getChanged().not());
|
||||||
saveBtn.setOnAction(event -> {
|
saveBtn.setOnAction(event -> {
|
||||||
try {
|
try {
|
||||||
CompanyContact contact = companyContactLoadedFuture.join();
|
CompanyContactVo contact = companyContactLoadedFuture.join();
|
||||||
viewModel.copyTo(contact);
|
viewModel.copyTo(contact);
|
||||||
CompanyContact saved = companyContactService.save(contact);
|
CompanyContactVo saved = companyContactService.save(contact);
|
||||||
viewModel.update(saved);
|
viewModel.update(saved);
|
||||||
companyContactLoadedFuture = CompletableFuture.completedFuture(saved);
|
companyContactLoadedFuture = CompletableFuture.completedFuture(saved);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CompanyOldNameService;
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -16,7 +16,7 @@ import javafx.scene.control.TextInputDialog;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class CompanyManagerSkin
|
public class CompanyManagerSkin
|
||||||
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
|
extends AbstEntityManagerSkin<CompanyVo, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyOldNameService companyOldNameService;
|
private CompanyOldNameService companyOldNameService;
|
||||||
@@ -65,11 +65,11 @@ public class CompanyManagerSkin
|
|||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
CompanyService companyService = getCompanyService();
|
CompanyService companyService = getCompanyService();
|
||||||
String newCompanyName = optional.get();
|
String newCompanyName = optional.get();
|
||||||
List<Company> list = companyService.findAllByName(newCompanyName);
|
List<CompanyVo> list = companyService.findAllByName(newCompanyName);
|
||||||
if (list == null || list.isEmpty()) {
|
if (list == null || list.isEmpty()) {
|
||||||
// 未登记过
|
// 未登记过
|
||||||
Company company = companyService.createNewCompany(newCompanyName);
|
CompanyVo company = companyService.createNewCompany(newCompanyName);
|
||||||
Company saved = companyService.save(company);
|
CompanyVo saved = companyService.save(company);
|
||||||
CompanyWindowController.show(saved, getTableView().getScene().getWindow());
|
CompanyWindowController.show(saved, getTableView().getScene().getWindow());
|
||||||
} else {
|
} else {
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.task.CompanyFilesRebuildTasker;
|
import com.ecep.contract.task.CompanyFilesRebuildTasker;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -25,7 +25,7 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/company-manager.fxml")
|
@FxmlPath("/ui/company/company-manager.fxml")
|
||||||
public class CompanyManagerWindowController
|
public class CompanyManagerWindowController
|
||||||
extends AbstManagerWindowController<Company, CompanyViewModel, CompanyManagerSkin> {
|
extends AbstManagerWindowController<CompanyVo, CompanyViewModel, CompanyManagerSkin> {
|
||||||
|
|
||||||
// columns
|
// columns
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.SpringApp;
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.controller.customer.CompanyCustomerWindowController;
|
import com.ecep.contract.controller.customer.CompanyCustomerWindowController;
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
@@ -27,18 +26,16 @@ import com.ecep.contract.controller.tab.CompanyTabSkinOldName;
|
|||||||
import com.ecep.contract.controller.tab.CompanyTabSkinOther;
|
import com.ecep.contract.controller.tab.CompanyTabSkinOther;
|
||||||
import com.ecep.contract.controller.tab.CompanyTabSkinPurchaseBillVoucher;
|
import com.ecep.contract.controller.tab.CompanyTabSkinPurchaseBillVoucher;
|
||||||
import com.ecep.contract.controller.vendor.CompanyVendorWindowController;
|
import com.ecep.contract.controller.vendor.CompanyVendorWindowController;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.model.CompanyVendor;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.CompanyVendorService;
|
import com.ecep.contract.service.CompanyVendorService;
|
||||||
import com.ecep.contract.task.CompanyCompositeUpdateTasker;
|
import com.ecep.contract.task.CompanyCompositeUpdateTasker;
|
||||||
import com.ecep.contract.task.CompanyVerifyTasker;
|
import com.ecep.contract.task.CompanyVerifyTasker;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyViewModel;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
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.beans.property.SimpleObjectProperty;
|
||||||
@@ -131,8 +128,8 @@ public class CompanyWindowController
|
|||||||
// private final CompanyVendorViewModel companyVendorViewModel = new
|
// private final CompanyVendorViewModel companyVendorViewModel = new
|
||||||
// CompanyVendorViewModel();
|
// CompanyVendorViewModel();
|
||||||
|
|
||||||
private final SimpleObjectProperty<CompanyCustomer> companyCustomerProperty = new SimpleObjectProperty<>();
|
private final SimpleObjectProperty<CompanyCustomerVo> companyCustomerProperty = new SimpleObjectProperty<>();
|
||||||
private final SimpleObjectProperty<CompanyVendor> companyVendorProperty = new SimpleObjectProperty<>();
|
private final SimpleObjectProperty<CompanyVendorVo> companyVendorProperty = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
public Pane customerTab_pane1;
|
public Pane customerTab_pane1;
|
||||||
public Button customerTab_openBtn;
|
public Button customerTab_openBtn;
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import java.time.format.DateTimeFormatter;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.model.CompanyOldName;
|
|
||||||
import com.ecep.contract.service.CompanyOldNameService;
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
@@ -15,7 +15,7 @@ import lombok.Setter;
|
|||||||
|
|
||||||
|
|
||||||
public class CompanyOldNameTabSkinBase
|
public class CompanyOldNameTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<CompanyOldNameWindowController, CompanyOldName, CompanyOldNameViewModel>
|
extends AbstEntityBasedTabSkin<CompanyOldNameWindowController, CompanyOldNameVo, CompanyOldNameViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|||||||
@@ -12,13 +12,16 @@ import com.ecep.contract.CompanyFileType;
|
|||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.CompanyFile;
|
|
||||||
import com.ecep.contract.model.CompanyOldName;
|
import com.ecep.contract.model.CompanyOldName;
|
||||||
import com.ecep.contract.service.CompanyFileService;
|
import com.ecep.contract.service.CompanyFileService;
|
||||||
import com.ecep.contract.service.CompanyOldNameService;
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.util.ParamUtils.Builder;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyFileViewModel;
|
import com.ecep.contract.vm.CompanyFileViewModel;
|
||||||
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -33,7 +36,7 @@ import lombok.Setter;
|
|||||||
*/
|
*/
|
||||||
public class CompanyOldNameTabSkinFile
|
public class CompanyOldNameTabSkinFile
|
||||||
extends
|
extends
|
||||||
AbstEntityTableTabSkin<CompanyOldNameWindowController, CompanyOldName, CompanyOldNameViewModel, CompanyFile, CompanyFileViewModel>
|
AbstEntityTableTabSkin<CompanyOldNameWindowController, CompanyOldNameVo, CompanyOldNameViewModel, CompanyFileVo, CompanyFileViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyOldNameService companyOldNameService;
|
private CompanyOldNameService companyOldNameService;
|
||||||
@@ -62,10 +65,8 @@ public class CompanyOldNameTabSkinFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(CompanyOldName parent) {
|
public Builder getSpecification(CompanyOldNameVo parent) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
return ParamUtils.builder().equals("company", parent.getCompanyId());
|
||||||
params.put("company", parent.getCompanyId());
|
|
||||||
return params;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,7 +102,7 @@ public class CompanyOldNameTabSkinFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onTableResetAction(ActionEvent event) {
|
private void onTableResetAction(ActionEvent event) {
|
||||||
CompanyOldName oldName = getParent();
|
CompanyOldNameVo oldName = getParent();
|
||||||
// CompletableFuture.runAsync(() -> {
|
// CompletableFuture.runAsync(() -> {
|
||||||
// if (getCompanyFileService().reBuildingFiles(oldName, this::setStatus)) {
|
// if (getCompanyFileService().reBuildingFiles(oldName, this::setStatus)) {
|
||||||
// loadTableDataSet();
|
// loadTableDataSet();
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.CompanyOldName;
|
|
||||||
import com.ecep.contract.service.CompanyOldNameService;
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
import com.ecep.contract.vm.CompanyFileViewModel;
|
import com.ecep.contract.vm.CompanyFileViewModel;
|
||||||
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/company_old_name.fxml")
|
@FxmlPath("/ui/company/company_old_name.fxml")
|
||||||
public class CompanyOldNameWindowController extends AbstEntityController<CompanyOldName, CompanyOldNameViewModel> {
|
public class CompanyOldNameWindowController extends AbstEntityController<CompanyOldNameVo, CompanyOldNameViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyOldNameWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyOldNameWindowController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +97,7 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onOldCompanyOpenInExplorerAction(ActionEvent event) {
|
public void onOldCompanyOpenInExplorerAction(ActionEvent event) {
|
||||||
CompanyOldName companyOldName = getEntity();
|
CompanyOldNameVo companyOldName = getEntity();
|
||||||
String path = companyOldName.getPath();
|
String path = companyOldName.getPath();
|
||||||
|
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ package com.ecep.contract.controller.contract;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
|
||||||
public abstract class AbstContractBasedTabSkin
|
public abstract class AbstContractBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<ContractWindowController, Contract, ContractViewModel>
|
extends AbstEntityBasedTabSkin<ContractWindowController, ContractVo, ContractViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstContractBasedTabSkin(ContractWindowController controller) {
|
public AbstContractBasedTabSkin(ContractWindowController controller) {
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
package com.ecep.contract.controller.contract;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.controller.table.TableOfTabSkin;
|
import com.ecep.contract.controller.table.TableOfTabSkin;
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
import com.ecep.contract.vm.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
|
||||||
public abstract class AbstContractTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstContractTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends AbstEntityTableTabSkin<ContractWindowController, Contract, ContractViewModel, T, TV>
|
extends AbstEntityTableTabSkin<ContractWindowController, ContractVo, ContractViewModel, T, TV>
|
||||||
implements TabSkin, TableOfTabSkin<Contract, T, TV> {
|
implements TabSkin, TableOfTabSkin<ContractVo, T, TV> {
|
||||||
|
|
||||||
public AbstContractTableTabSkin(ContractWindowController controller) {
|
public AbstContractTableTabSkin(ContractWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -25,9 +24,9 @@ public abstract class AbstContractTableTabSkin<T extends IdentityEntity, TV exte
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Contract parent) {
|
public ParamUtils.Builder getSpecification(ContractVo parent) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("contract", parent.getId());
|
params.equals("contract", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,14 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.controller.tab.ContractManagerSkin;
|
import com.ecep.contract.controller.tab.ContractManagerSkin;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ContractGroup;
|
|
||||||
import com.ecep.contract.model.ContractKind;
|
|
||||||
import com.ecep.contract.model.ContractType;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.task.ContractFilesRebuildAllTasker;
|
import com.ecep.contract.task.ContractFilesRebuildAllTasker;
|
||||||
import com.ecep.contract.task.ContractRepairAllTasker;
|
import com.ecep.contract.task.ContractRepairAllTasker;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractGroupVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
@@ -34,27 +30,27 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/contract/contract-manager.fxml")
|
@FxmlPath("/ui/contract/contract-manager.fxml")
|
||||||
public class ContractManagerWindowController
|
public class ContractManagerWindowController
|
||||||
extends AbstManagerWindowController<Contract, ContractViewModel, ContractManagerSkin> {
|
extends AbstManagerWindowController<ContractVo, ContractViewModel, ContractManagerSkin> {
|
||||||
|
|
||||||
public ComboBox<ContractGroup> groupSelector;
|
public ComboBox<ContractGroupVo> groupSelector;
|
||||||
public CheckBox composeViewBtn;
|
public CheckBox composeViewBtn;
|
||||||
|
|
||||||
// columns
|
// columns
|
||||||
public TableColumn<ContractViewModel, Number> idColumn;
|
public TableColumn<ContractViewModel, Number> idColumn;
|
||||||
public TableColumn<ContractViewModel, String> nameColumn;
|
public TableColumn<ContractViewModel, String> nameColumn;
|
||||||
public TableColumn<ContractViewModel, String> codeColumn;
|
public TableColumn<ContractViewModel, String> codeColumn;
|
||||||
public TableColumn<ContractViewModel, ContractGroup> groupColumn;
|
public TableColumn<ContractViewModel, Integer> groupColumn;
|
||||||
public TableColumn<ContractViewModel, ContractType> typeColumn;
|
public TableColumn<ContractViewModel, Integer> typeColumn;
|
||||||
public TableColumn<ContractViewModel, ContractKind> kindColumn;
|
public TableColumn<ContractViewModel, Integer> kindColumn;
|
||||||
|
|
||||||
public TableColumn<ContractViewModel, String> parentCodeColumn;
|
public TableColumn<ContractViewModel, String> parentCodeColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> setupDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> setupDateColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> orderDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> orderDateColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> startDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> startDateColumn;
|
||||||
public TableColumn<ContractViewModel, Employee> employeeColumn;
|
public TableColumn<ContractViewModel, Integer> employeeColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDateTime> createdColumn;
|
public TableColumn<ContractViewModel, LocalDateTime> createdColumn;
|
||||||
public TableColumn<ContractViewModel, Number> amountColumn;
|
public TableColumn<ContractViewModel, Number> amountColumn;
|
||||||
public TableColumn<ContractViewModel, Company> companyColumn;
|
public TableColumn<ContractViewModel, Integer> companyColumn;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContractService contractService;
|
private ContractService contractService;
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.controller.ComboBoxUtils;
|
import com.ecep.contract.controller.ComboBoxUtils;
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ExtendVendorInfo;
|
|
||||||
import com.ecep.contract.model.VendorGroup;
|
import com.ecep.contract.model.VendorGroup;
|
||||||
import com.ecep.contract.service.ExtendVendorInfoService;
|
import com.ecep.contract.service.ExtendVendorInfoService;
|
||||||
import com.ecep.contract.service.VendorGroupService;
|
import com.ecep.contract.service.VendorGroupService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ExtendVendorInfoViewModel;
|
import com.ecep.contract.vm.ExtendVendorInfoViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import com.ecep.contract.vo.ExtendVendorInfoVo;
|
||||||
|
import com.ecep.contract.vo.VendorGroupVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
@@ -28,16 +28,13 @@ import javafx.util.converter.NumberStringConverter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@FxmlPath("/ui/contract/contract-tab-ext-vendor-info.fxml")
|
@FxmlPath("/ui/contract/contract-tab-ext-vendor-info.fxml")
|
||||||
public class ContractTabSkinExtendVendorInfo
|
public class ContractTabSkinExtendVendorInfo extends AbstContractBasedTabSkin {
|
||||||
extends AbstContractBasedTabSkin {
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private ExtendVendorInfoService extendVendorInfoService;
|
|
||||||
@Setter
|
|
||||||
private VendorGroupService vendorGroupService;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VendorGroup
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
public ComboBox<VendorGroup> vendorGroupField;
|
public ComboBox<VendorGroupVo> vendorGroupField;
|
||||||
@FXML
|
@FXML
|
||||||
public Label vendorGroupLabel;
|
public Label vendorGroupLabel;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -47,7 +44,7 @@ public class ContractTabSkinExtendVendorInfo
|
|||||||
@FXML
|
@FXML
|
||||||
public CheckBox prePurchaseField;
|
public CheckBox prePurchaseField;
|
||||||
|
|
||||||
CompletableFuture<ExtendVendorInfo> loadedFuture;
|
CompletableFuture<ExtendVendorInfoVo> loadedFuture;
|
||||||
private ExtendVendorInfoViewModel viewModel = new ExtendVendorInfoViewModel();
|
private ExtendVendorInfoViewModel viewModel = new ExtendVendorInfoViewModel();
|
||||||
|
|
||||||
public ContractTabSkinExtendVendorInfo(ContractWindowController controller) {
|
public ContractTabSkinExtendVendorInfo(ContractWindowController controller) {
|
||||||
@@ -75,13 +72,13 @@ public class ContractTabSkinExtendVendorInfo
|
|||||||
if (loadedFuture == null) {
|
if (loadedFuture == null) {
|
||||||
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
||||||
initializeTab();
|
initializeTab();
|
||||||
Contract contract = getEntity();
|
ContractVo contract = getEntity();
|
||||||
return loadExtendVendorInfo(contract);
|
return loadExtendVendorInfo(contract);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateViewModel(ExtendVendorInfo info) {
|
void updateViewModel(ExtendVendorInfoVo info) {
|
||||||
if (Platform.isFxApplicationThread()) {
|
if (Platform.isFxApplicationThread()) {
|
||||||
viewModel.update(info);
|
viewModel.update(info);
|
||||||
} else {
|
} else {
|
||||||
@@ -89,13 +86,14 @@ public class ContractTabSkinExtendVendorInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExtendVendorInfo loadExtendVendorInfo(Contract contract) {
|
private ExtendVendorInfoVo loadExtendVendorInfo(ContractVo contract) {
|
||||||
ExtendVendorInfoService service = getExtendVendorInfoService();
|
ExtendVendorInfoService service = getExtendVendorInfoService();
|
||||||
try {
|
try {
|
||||||
ExtendVendorInfo info = service.findByContract(contract);
|
ExtendVendorInfoVo info = service.findByContract(contract);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
info = service.newInstanceByContract(contract);
|
info = new ExtendVendorInfoVo();
|
||||||
info = service.save(info);
|
info.setContractId(contract.getId());
|
||||||
|
// 注意:这里可能需要调整,取决于service接口的实现
|
||||||
}
|
}
|
||||||
updateViewModel(info);
|
updateViewModel(info);
|
||||||
viewModel.bindListener();
|
viewModel.bindListener();
|
||||||
@@ -108,17 +106,11 @@ public class ContractTabSkinExtendVendorInfo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
List<VendorGroup> groups = getVendorGroupService().findAll();
|
ComboBoxUtils.initialComboBox(vendorGroupField, viewModel.getGroup(), getVendorGroupService(), true);
|
||||||
ComboBoxUtils.initialComboBox(vendorGroupField, groups, true);
|
|
||||||
vendorGroupField.valueProperty().bindBidirectional(viewModel.getGroup());
|
|
||||||
vendorGroupLabel.textProperty().bind(vendorGroupField.valueProperty().map(v -> {
|
vendorGroupLabel.textProperty().bind(vendorGroupField.valueProperty().map(v -> {
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(v)) {
|
|
||||||
v = getVendorGroupService().findById(v.getId());
|
|
||||||
viewModel.getGroup().set(v);
|
|
||||||
}
|
|
||||||
return v.getDescription();
|
return v.getDescription();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -126,7 +118,8 @@ public class ContractTabSkinExtendVendorInfo
|
|||||||
new NumberStringConverter());
|
new NumberStringConverter());
|
||||||
assignedProviderField.selectedProperty().bindBidirectional(viewModel.getAssignedProvider());
|
assignedProviderField.selectedProperty().bindBidirectional(viewModel.getAssignedProvider());
|
||||||
assignedProviderField.disableProperty().bind(Bindings.createBooleanBinding(() -> {
|
assignedProviderField.disableProperty().bind(Bindings.createBooleanBinding(() -> {
|
||||||
VendorGroup group = viewModel.getGroup().get();
|
Integer groupId = viewModel.getGroup().get();
|
||||||
|
VendorGroupVo group = getVendorGroupService().findById(groupId);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -139,26 +132,21 @@ public class ContractTabSkinExtendVendorInfo
|
|||||||
@Override
|
@Override
|
||||||
public void save() {
|
public void save() {
|
||||||
if (loadedFuture != null) {
|
if (loadedFuture != null) {
|
||||||
ExtendVendorInfo vendorInfo = loadedFuture.join();
|
ExtendVendorInfoVo vendorInfo = loadedFuture.join();
|
||||||
if (viewModel.copyTo(vendorInfo)) {
|
if (viewModel.copyTo(vendorInfo)) {
|
||||||
ExtendVendorInfo saved = getExtendVendorInfoService().save(vendorInfo);
|
// 注意:这里需要根据实际service接口实现调整,可能需要调用不同的方法
|
||||||
updateViewModel(saved);
|
// ExtendVendorInfoVo saved = getExtendVendorInfoService().saveVo(vendorInfo);
|
||||||
loadedFuture = CompletableFuture.completedFuture(saved);
|
// updateViewModel(saved);
|
||||||
|
// loadedFuture = CompletableFuture.completedFuture(saved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendVendorInfoService getExtendVendorInfoService() {
|
public ExtendVendorInfoService getExtendVendorInfoService() {
|
||||||
if (extendVendorInfoService == null) {
|
return getCachedBean(ExtendVendorInfoService.class);
|
||||||
extendVendorInfoService = SpringApp.getBean(ExtendVendorInfoService.class);
|
|
||||||
}
|
|
||||||
return extendVendorInfoService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VendorGroupService getVendorGroupService() {
|
public VendorGroupService getVendorGroupService() {
|
||||||
if (vendorGroupService == null) {
|
return getCachedBean(VendorGroupService.class);
|
||||||
vendorGroupService = SpringApp.getBean(VendorGroupService.class);
|
|
||||||
}
|
|
||||||
return vendorGroupService;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import static com.ecep.contract.util.TableViewUtils.bindEnterPressed;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@@ -29,7 +27,6 @@ import com.ecep.contract.Message;
|
|||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.controller.BaseController;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.service.EmployeeService;
|
import com.ecep.contract.service.EmployeeService;
|
||||||
@@ -40,6 +37,8 @@ import com.ecep.contract.task.ContractVerifyResultExportAsExcelFileTasker;
|
|||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ParamUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.SimpleListProperty;
|
import javafx.beans.property.SimpleListProperty;
|
||||||
@@ -94,7 +93,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
public static class Model implements MessageHolder {
|
public static class Model implements MessageHolder {
|
||||||
private SimpleStringProperty code = new SimpleStringProperty();
|
private SimpleStringProperty code = new SimpleStringProperty();
|
||||||
private SimpleStringProperty name = new SimpleStringProperty();
|
private SimpleStringProperty name = new SimpleStringProperty();
|
||||||
private SimpleObjectProperty<Employee> employee = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> employee = new SimpleObjectProperty<>();
|
||||||
private SimpleObjectProperty<LocalDate> setupDate = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDate> setupDate = new SimpleObjectProperty<>();
|
||||||
private SimpleListProperty<MessageExt> messages = new SimpleListProperty<>(FXCollections.observableArrayList());
|
private SimpleListProperty<MessageExt> messages = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||||
|
|
||||||
@@ -205,7 +204,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
@FXML
|
@FXML
|
||||||
public TableColumn<Model, String> viewTable_nameColumn;
|
public TableColumn<Model, String> viewTable_nameColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<Model, Employee> viewTable_employeeColumn;
|
public TableColumn<Model, Integer> viewTable_employeeColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<Model, LocalDate> viewTable_setupDateColumn;
|
public TableColumn<Model, LocalDate> viewTable_setupDateColumn;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -278,17 +277,17 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<Contract> page = contractService.findAll(params, pageRequest);
|
Page<ContractVo> page = contractService.findAll(params, pageRequest);
|
||||||
for (Contract contract : page) {
|
for (ContractVo contract : page) {
|
||||||
if (isCloseRequested()) {
|
if (isCloseRequested()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
counter.incrementAndGet();
|
counter.incrementAndGet();
|
||||||
Model model = new Model();
|
Model model = new Model();
|
||||||
viewTableDataSet.add(model);
|
viewTableDataSet.add(model);
|
||||||
Employee handler = contract.getHandler();
|
Integer handler = contract.getHandlerId();
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
model.getEmployee().set(contract.getEmployee());
|
model.getEmployee().set(contract.getEmployeeId());
|
||||||
} else {
|
} else {
|
||||||
model.getEmployee().set(handler);
|
model.getEmployee().set(handler);
|
||||||
}
|
}
|
||||||
@@ -336,7 +335,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runAsync(() -> {
|
runAsync(() -> {
|
||||||
Contract contract = null;
|
ContractVo contract = null;
|
||||||
try {
|
try {
|
||||||
contract = contractService.findByCode(contractCode);
|
contract = contractService.findByCode(contractCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -379,7 +378,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
if (!StringUtils.hasText(contractCode)) {
|
if (!StringUtils.hasText(contractCode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Contract contract = null;
|
ContractVo contract = null;
|
||||||
try {
|
try {
|
||||||
contract = contractService.findByCode(contractCode);
|
contract = contractService.findByCode(contractCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -1,12 +1,25 @@
|
|||||||
package com.ecep.contract.controller.contract;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.ContractPayWay;
|
import com.ecep.contract.ContractPayWay;
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.tab.*;
|
import com.ecep.contract.controller.tab.ContractTabSkinBase;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.controller.tab.ContractTabSkinFiles;
|
||||||
import com.ecep.contract.model.Contract;
|
import com.ecep.contract.controller.tab.ContractTabSkinItemsV2;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinPayPlan;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinPurchaseOrders;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinSaleOrders;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinSubContract;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinVendorBid;
|
||||||
|
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.task.ContractRepairTask;
|
import com.ecep.contract.task.ContractRepairTask;
|
||||||
@@ -14,30 +27,31 @@ import com.ecep.contract.task.ContractVerifyTasker;
|
|||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/contract/contract.fxml")
|
@FxmlPath("/ui/contract/contract.fxml")
|
||||||
public class ContractWindowController
|
public class ContractWindowController
|
||||||
extends AbstEntityController<Contract, ContractViewModel> {
|
extends AbstEntityController<ContractVo, ContractViewModel> {
|
||||||
|
|
||||||
public static void show(Contract contract, Window owner) {
|
public static void show(ContractVo contract, Window owner) {
|
||||||
ContractViewModel model = new ContractViewModel();
|
show(ContractViewModel.from(contract), owner);
|
||||||
model.update(contract);
|
|
||||||
show(model, owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,7 +174,7 @@ public class ContractWindowController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onContractOpenInExplorerAction(ActionEvent event) {
|
public void onContractOpenInExplorerAction(ActionEvent event) {
|
||||||
Contract contract = getEntity();
|
ContractVo contract = getEntity();
|
||||||
String path = contract.getPath();
|
String path = contract.getPath();
|
||||||
if (!StringUtils.hasText(path)) {
|
if (!StringUtils.hasText(path)) {
|
||||||
setStatus("未设置目录");
|
setStatus("未设置目录");
|
||||||
@@ -175,13 +189,13 @@ public class ContractWindowController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onContractOpenRelativeCompanyAction(ActionEvent event) {
|
public void onContractOpenRelativeCompanyAction(ActionEvent event) {
|
||||||
Contract contract = getEntity();
|
ContractVo contract = getEntity();
|
||||||
if (contract.getCompany() == null) {
|
if (contract.getCompanyId() == null) {
|
||||||
UITools.showAlertAndWait("没有关联的公司,你可以尝试同步修复异常。");
|
UITools.showAlertAndWait("没有关联的公司,你可以尝试同步修复异常。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Integer companyId = contract.getCompany().getId();
|
Integer companyId = contract.getCompanyId();
|
||||||
Company company = getCompanyService().findById(companyId);
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
if (company != null) {
|
if (company != null) {
|
||||||
CompanyWindowController.show(company, root.getScene().getWindow());
|
CompanyWindowController.show(company, root.getScene().getWindow());
|
||||||
}
|
}
|
||||||
@@ -224,7 +238,7 @@ public class ContractWindowController
|
|||||||
* 验证合同合规性
|
* 验证合同合规性
|
||||||
*/
|
*/
|
||||||
public void onContractVerifyAction(ActionEvent event) {
|
public void onContractVerifyAction(ActionEvent event) {
|
||||||
Contract contract = getEntity();
|
ContractVo contract = getEntity();
|
||||||
ContractVerifyTasker task = new ContractVerifyTasker();
|
ContractVerifyTasker task = new ContractVerifyTasker();
|
||||||
task.setContract(contract);
|
task.setContract(contract);
|
||||||
UITools.showTaskDialogAndWait("同步合规性验证", task, null);
|
UITools.showTaskDialogAndWait("同步合规性验证", task, null);
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package com.ecep.contract.controller.customer;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
import com.ecep.contract.vm.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
|
||||||
public abstract class AbstCompanyCustomerTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstCompanyCustomerTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends
|
extends
|
||||||
AbstEntityTableTabSkin<CompanyCustomerWindowController, CompanyCustomer, CompanyCustomerViewModel, T, TV>
|
AbstEntityTableTabSkin<CompanyCustomerWindowController, CompanyCustomerVo, CompanyCustomerViewModel, T, TV>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstCompanyCustomerTableTabSkin(CompanyCustomerWindowController controller) {
|
public AbstCompanyCustomerTableTabSkin(CompanyCustomerWindowController controller) {
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.controller.BaseController;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||||
import com.ecep.contract.model.CompanyCustomerFile;
|
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||||
import com.ecep.contract.util.FileUtils;
|
import com.ecep.contract.util.FileUtils;
|
||||||
import com.ecep.contract.util.FxmlUtils;
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerEvaluationFormFileViewModel;
|
||||||
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
@@ -54,13 +56,11 @@ import javafx.stage.WindowEvent;
|
|||||||
public class CompanyCustomerEvaluationFormFileWindowController extends BaseController {
|
public class CompanyCustomerEvaluationFormFileWindowController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormFileWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormFileWindowController.class);
|
||||||
|
|
||||||
public static void show(CompanyCustomerFile saved, Window window) {
|
public static void show(CompanyCustomerEvaluationFormFileVo saved, Window window) {
|
||||||
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
show(CompanyCustomerEvaluationFormFileViewModel.from(saved), window);
|
||||||
model.update(saved);
|
|
||||||
show(model, window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(CompanyCustomerFileViewModel viewModel, Window window) {
|
public static void show(CompanyCustomerEvaluationFormFileViewModel viewModel, Window window) {
|
||||||
String key = viewModel.getClass().getName() + "-" + viewModel.getId().get();
|
String key = viewModel.getClass().getName() + "-" + viewModel.getId().get();
|
||||||
if (toFront(key)) {
|
if (toFront(key)) {
|
||||||
return;
|
return;
|
||||||
@@ -91,7 +91,7 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
public ScrollPane leftPane;
|
public ScrollPane leftPane;
|
||||||
public Label totalCreditScoreLabel;
|
public Label totalCreditScoreLabel;
|
||||||
|
|
||||||
private CompanyCustomerFileViewModel viewModel;
|
private CompanyCustomerEvaluationFormFileViewModel viewModel;
|
||||||
|
|
||||||
private final SimpleStringProperty catalogProperty = new SimpleStringProperty("");
|
private final SimpleStringProperty catalogProperty = new SimpleStringProperty("");
|
||||||
private final SimpleStringProperty levelProperty = new SimpleStringProperty("");
|
private final SimpleStringProperty levelProperty = new SimpleStringProperty("");
|
||||||
@@ -105,11 +105,15 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
|
|
||||||
private SimpleObjectProperty<Image> imageProperty = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Image> imageProperty = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
private CompletableFuture<CompanyCustomerEvaluationFormFile> loadedFuture;
|
private CompletableFuture<CompanyCustomerEvaluationFormFileVo> loadedFuture;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyCustomerFileService companyCustomerFileService;
|
private CompanyCustomerFileService companyCustomerFileService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
@@ -138,8 +142,8 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
|
|
||||||
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
||||||
int id = viewModel.getId().get();
|
int id = viewModel.getId().get();
|
||||||
CompanyCustomerFile customerFile = companyCustomerFileService.findById(id);
|
CompanyCustomerFileVo customerFile = companyCustomerFileService.findById(id);
|
||||||
CompanyCustomerEvaluationFormFile formFile = companyCustomerFileService.findCustomerEvaluationFormFileByCustomerFile(customerFile);
|
CompanyCustomerEvaluationFormFileVo formFile = evaluationFormFileService.findByCustomerFile(customerFile);
|
||||||
Platform.runLater(() -> update(formFile));
|
Platform.runLater(() -> update(formFile));
|
||||||
return formFile;
|
return formFile;
|
||||||
});
|
});
|
||||||
@@ -255,10 +259,10 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
|
|
||||||
private void initializePane() {
|
private void initializePane() {
|
||||||
idField.textProperty().bind(viewModel.getId().asString());
|
idField.textProperty().bind(viewModel.getId().asString());
|
||||||
filePathField.textProperty().bind(viewModel.getFilePath());
|
// filePathField.textProperty().bind(viewModel.getFilePath());
|
||||||
editFilePathField.textProperty().bind(viewModel.getEditFilePath());
|
// editFilePathField.textProperty().bind(viewModel.getEditFilePath());
|
||||||
signDateField.valueProperty().bindBidirectional(viewModel.getSignDate());
|
// signDateField.valueProperty().bindBidirectional(viewModel.getSignDate());
|
||||||
validField.selectedProperty().bindBidirectional(viewModel.getValid());
|
// validField.selectedProperty().bindBidirectional(viewModel.getValid());
|
||||||
|
|
||||||
initializeRadioGroup(catalog, catalogProperty);
|
initializeRadioGroup(catalog, catalogProperty);
|
||||||
initializeRadioGroup(level, levelProperty);
|
initializeRadioGroup(level, levelProperty);
|
||||||
@@ -289,7 +293,7 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
|
|
||||||
Bindings.createBooleanBinding(() -> {
|
Bindings.createBooleanBinding(() -> {
|
||||||
boolean valid = calcValid();
|
boolean valid = calcValid();
|
||||||
viewModel.getValid().set(valid);
|
// viewModel.getValid().set(valid);
|
||||||
return valid;
|
return valid;
|
||||||
}, catalogProperty, levelProperty, score1Property, score2Property, score3Property, score4Property, score5Property, creditLevelProperty).addListener(((observable, oldValue, newValue) -> {
|
}, catalogProperty, levelProperty, score1Property, score2Property, score3Property, score4Property, score5Property, creditLevelProperty).addListener(((observable, oldValue, newValue) -> {
|
||||||
logger.info("valid:{}", newValue);
|
logger.info("valid:{}", newValue);
|
||||||
@@ -373,10 +377,9 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(CompanyCustomerEvaluationFormFile formFile) {
|
private void update(CompanyCustomerEvaluationFormFileVo formFile) {
|
||||||
|
|
||||||
|
viewModel.update(formFile);
|
||||||
viewModel.update(formFile.getCustomerFile());
|
|
||||||
|
|
||||||
// formFile.getScoreTemplateVersion();
|
// formFile.getScoreTemplateVersion();
|
||||||
|
|
||||||
@@ -389,55 +392,4 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
score5Property.set(formFile.getScore5());
|
score5Property.set(formFile.getScore5());
|
||||||
creditLevelProperty.set(formFile.getCreditLevel());
|
creditLevelProperty.set(formFile.getCreditLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSaveAction(ActionEvent event) {
|
|
||||||
boolean modified = false;
|
|
||||||
|
|
||||||
int id = viewModel.getId().get();
|
|
||||||
CompanyCustomerEvaluationFormFile formFile = companyCustomerFileService.findCustomerEvaluationFormFileById(id);
|
|
||||||
CompanyCustomerFile customerFile = formFile.getCustomerFile();
|
|
||||||
|
|
||||||
if (!Objects.equals(catalogProperty.get(), formFile.getCatalog())) {
|
|
||||||
formFile.setCatalog(catalogProperty.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(levelProperty.get(), formFile.getLevel())) {
|
|
||||||
formFile.setLevel(levelProperty.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(score1Property.get(), formFile.getScore1())) {
|
|
||||||
formFile.setScore1(score1Property.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(score2Property.get(), formFile.getScore2())) {
|
|
||||||
formFile.setScore2(score2Property.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(score3Property.get(), formFile.getScore3())) {
|
|
||||||
formFile.setScore3(score3Property.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(score4Property.get(), formFile.getScore4())) {
|
|
||||||
formFile.setScore4(score4Property.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(score5Property.get(), formFile.getScore5())) {
|
|
||||||
formFile.setScore5(score5Property.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(creditLevelProperty.get(), formFile.getCreditLevel())) {
|
|
||||||
formFile.setCreditLevel(creditLevelProperty.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (viewModel.copyTo(customerFile)) {
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modified) {
|
|
||||||
companyCustomerFileService.save(formFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,32 +14,32 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.service.*;
|
import com.ecep.contract.service.*;
|
||||||
|
import com.ecep.contract.task.Tasker;
|
||||||
import com.ecep.contract.util.CompanyUtils;
|
import com.ecep.contract.util.CompanyUtils;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyCustomerFileType;
|
import com.ecep.contract.CompanyCustomerFileType;
|
||||||
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.model.CloudTyc;
|
import com.ecep.contract.vo.CloudTycVo;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerFile;
|
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
public class CompanyCustomerEvaluationFormUpdateTask extends Tasker<Object> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormUpdateTask.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormUpdateTask.class);
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyCustomer customer;
|
private CompanyCustomerVo customer;
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
private CompanyContactService companyContactService;
|
private CompanyContactService companyContactService;
|
||||||
@@ -48,13 +48,6 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
@Setter
|
@Setter
|
||||||
private CompanyCustomerFileService companyCustomerFileService;
|
private CompanyCustomerFileService companyCustomerFileService;
|
||||||
|
|
||||||
private CompanyService getCompanyService() {
|
|
||||||
if (companyService == null) {
|
|
||||||
companyService = SpringApp.getBean(CompanyService.class);
|
|
||||||
}
|
|
||||||
return companyService;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CompanyCustomerService getCompanyCustomerService() {
|
private CompanyCustomerService getCompanyCustomerService() {
|
||||||
if (companyCustomerService == null) {
|
if (companyCustomerService == null) {
|
||||||
companyCustomerService = SpringApp.getBean(CompanyCustomerService.class);
|
companyCustomerService = SpringApp.getBean(CompanyCustomerService.class);
|
||||||
@@ -76,32 +69,36 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
return companyCustomerFileService;
|
return companyCustomerFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private CompanyCustomerEvaluationFormFileService getCompanyCustomerEvaluationFormFileService() {
|
||||||
protected Object call() throws Exception {
|
return getBean(CompanyCustomerEvaluationFormFileService.class);
|
||||||
try {
|
|
||||||
updateEvaluationForm();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
updateMessage(ex.getMessage());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getEvaluationFormTemplate() {
|
private File getEvaluationFormTemplate() {
|
||||||
return getCompanyCustomerFileService().getEvaluationFormTemplate();
|
return getCompanyCustomerFileService().getEvaluationFormTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEvaluationForm() {
|
@Override
|
||||||
|
protected Object execute(MessageHolder holder) throws Exception {
|
||||||
|
try {
|
||||||
|
updateEvaluationForm(holder);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
updateMessage(ex.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateEvaluationForm(MessageHolder holder) {
|
||||||
if (!StringUtils.hasText(customer.getPath())) {
|
if (!StringUtils.hasText(customer.getPath())) {
|
||||||
updateMessage("供应商目录未设置,请先设置供应商目录");
|
holder.error("供应商目录未设置,请先设置供应商目录");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File template = getEvaluationFormTemplate();
|
File template = getEvaluationFormTemplate();
|
||||||
if (template == null) {
|
if (template == null) {
|
||||||
updateMessage("评价表模板文件未设置,请先设置评价表模板文件");
|
holder.error("评价表模板文件未设置,请先设置评价表模板文件");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!template.exists()) {
|
if (!template.exists()) {
|
||||||
updateMessage("评价表模板文件 " + template.getAbsolutePath() + " 不存在,请检查");
|
holder.error("评价表模板文件 " + template.getAbsolutePath() + " 不存在,请检查");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,37 +107,37 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
File destFile = new File(dir, template_file_name);
|
File destFile = new File(dir, template_file_name);
|
||||||
|
|
||||||
if (destFile.exists()) {
|
if (destFile.exists()) {
|
||||||
updateMessage("表单文件已经存在," + destFile.getName());
|
holder.info("表单文件已经存在," + destFile.getName());
|
||||||
try (
|
try (
|
||||||
InputStream inp = new FileInputStream(destFile);
|
InputStream inp = new FileInputStream(destFile);
|
||||||
Workbook wb = WorkbookFactory.create(inp)) {
|
Workbook wb = WorkbookFactory.create(inp)) {
|
||||||
updateEvaluationForm(wb, destFile);
|
updateEvaluationForm(wb, destFile, holder);
|
||||||
updateMessage("评价表已更新");
|
holder.info("评价表已更新");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
updateMessage(e.getMessage());
|
holder.error(e.getMessage());
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateMessage("根据模板 " + template_file_name + " 创建表单 " + destFile.getName());
|
holder.info("根据模板 " + template_file_name + " 创建表单 " + destFile.getName());
|
||||||
try (
|
try (
|
||||||
InputStream inp = new FileInputStream(template);
|
InputStream inp = new FileInputStream(template);
|
||||||
Workbook wb = WorkbookFactory.create(inp)) {
|
Workbook wb = WorkbookFactory.create(inp)) {
|
||||||
updateEvaluationForm(wb, destFile);
|
updateEvaluationForm(wb, destFile, holder);
|
||||||
updateMessage("评价表已创建");
|
holder.info("评价表已创建");
|
||||||
CompanyCustomerFile customerFile = new CompanyCustomerFile();
|
CompanyCustomerFileVo customerFile = new CompanyCustomerFileVo();
|
||||||
customerFile.setCustomer(customer);
|
customerFile.setCustomer(customer.getId());
|
||||||
customerFile.setFilePath(destFile.getAbsolutePath());
|
customerFile.setFilePath(destFile.getAbsolutePath());
|
||||||
customerFile.setType(CompanyCustomerFileType.General);
|
customerFile.setType(CompanyCustomerFileType.General);
|
||||||
save(customerFile);
|
save(customerFile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
updateMessage(e.getMessage());
|
holder.error(e.getMessage());
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateProgress(1, 1);
|
updateProgress(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void save(CompanyCustomerFile customerFile) {
|
private void save(CompanyCustomerFileVo customerFile) {
|
||||||
getCompanyCustomerFileService().save(customerFile);
|
getCompanyCustomerFileService().save(customerFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,34 +147,26 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
* @param wb work book
|
* @param wb work book
|
||||||
* @param destFile 目标文件
|
* @param destFile 目标文件
|
||||||
*/
|
*/
|
||||||
public void updateEvaluationForm(
|
public void updateEvaluationForm(Workbook wb, File destFile, MessageHolder holder) throws IOException {
|
||||||
Workbook wb, File destFile) throws IOException {
|
Integer companyId = customer.getCompanyId();
|
||||||
Company company = customer.getCompany();
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
customer.setCompany(company);
|
|
||||||
}
|
|
||||||
|
|
||||||
Sheet sheet = wb.getSheetAt(0);
|
Sheet sheet = wb.getSheetAt(0);
|
||||||
updateSheet(company, sheet);
|
updateSheet(company, sheet, holder.sub(" - "));
|
||||||
|
updateProgress(900, 1000);
|
||||||
// 输出到文件
|
// 输出到文件
|
||||||
try (OutputStream fileOut = new FileOutputStream(destFile)) {
|
try (OutputStream fileOut = new FileOutputStream(destFile)) {
|
||||||
wb.write(fileOut);
|
wb.write(fileOut);
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
updateMessage("写评估表时发生文件错误,请检查评估表是否被打开中");
|
holder.error("写评估表时发生文件错误,请检查评估表是否被打开中:" + e.getMessage());
|
||||||
updateMessage(e.getMessage());
|
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSheet(Company company, Sheet sheet) {
|
private void updateSheet(CompanyVo company, Sheet sheet, MessageHolder holder) {
|
||||||
setCellValue(sheet, "B3", "客户编号:" + CompanyUtils.formatCompanyVendorId(customer.getId()));
|
setCellValue(sheet, "B3", "客户编号:" + CompanyUtils.formatCompanyVendorId(customer.getId()));
|
||||||
setCellValue(sheet, "B4", "客户名称:" + company.getName());
|
setCellValue(sheet, "B4", "客户名称:" + company.getName());
|
||||||
|
|
||||||
LocalDate suggestDate = getCompanyCustomerFileService().getNextSignDate(customer, (level, msg) -> {
|
LocalDate suggestDate = getCompanyCustomerFileService().getNextSignDate(customer, holder);
|
||||||
updateMessage(" - " + msg);
|
|
||||||
});
|
|
||||||
if (suggestDate == null) {
|
if (suggestDate == null) {
|
||||||
suggestDate = LocalDate.now();
|
suggestDate = LocalDate.now();
|
||||||
}
|
}
|
||||||
@@ -198,18 +187,18 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
setCellValue(sheet, "H10", "企业类型:" + company.getEntType());
|
setCellValue(sheet, "H10", "企业类型:" + company.getEntType());
|
||||||
// 天眼评分
|
// 天眼评分
|
||||||
CloudTycService cloudTycService = SpringApp.getBean(CloudTycService.class);
|
CloudTycService cloudTycService = SpringApp.getBean(CloudTycService.class);
|
||||||
CloudTyc cloudTyc = cloudTycService.getOrCreateCloudTyc(company);
|
CloudTycVo cloudTyc = cloudTycService.getOrCreateCloudTyc(company);
|
||||||
setCellValue(sheet, "D10", "天眼评分:" + (cloudTyc.getScore() > 0 ? cloudTyc.getScore() : ""));
|
setCellValue(sheet, "D10", "天眼评分:" + (cloudTyc.getScore() > 0 ? cloudTyc.getScore() : ""));
|
||||||
|
|
||||||
// 检索评估表
|
// 检索评估表
|
||||||
List<CompanyCustomerEvaluationFormFile> evaluationFormFiles = getCompanyCustomerFileService()
|
List<CompanyCustomerFileVo> customerFiles = getCompanyCustomerFileService().findAllByCustomerAndType(customer,
|
||||||
.findAllCustomerEvaluationFormFiles(customer);
|
CompanyCustomerFileType.EvaluationForm);
|
||||||
List<CompanyCustomerEvaluationFormFile> filteredList = evaluationFormFiles.stream()
|
|
||||||
.filter(v -> {
|
List<CompanyCustomerEvaluationFormFileVo> filteredList = customerFiles.stream().filter(file -> {
|
||||||
CompanyCustomerFile file = v.getCustomerFile();
|
|
||||||
return file.getSignDate() != null && file.isValid();
|
return file.getSignDate() != null && file.isValid();
|
||||||
})
|
})
|
||||||
.sorted(Comparator.comparing(v -> v.getCustomerFile().getSignDate()))
|
.sorted(Comparator.comparing(CompanyCustomerFileVo::getSignDate))
|
||||||
|
.map(getCompanyCustomerEvaluationFormFileService()::findByCustomerFile)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (filteredList.isEmpty()) {
|
if (filteredList.isEmpty()) {
|
||||||
@@ -229,8 +218,8 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
setCellValue(sheet, "G40", "资信等级");
|
setCellValue(sheet, "G40", "资信等级");
|
||||||
String[] CreditLevelTitles = new String[] { "-", "差★", " 一般★★", " 较好★★★", " 好★★★★", " " };
|
String[] CreditLevelTitles = new String[] { "-", "差★", " 一般★★", " 较好★★★", " 好★★★★", " " };
|
||||||
int baseRow = 40;
|
int baseRow = 40;
|
||||||
for (CompanyCustomerEvaluationFormFile form : filteredList) {
|
for (CompanyCustomerEvaluationFormFileVo form : filteredList) {
|
||||||
CompanyCustomerFile customerFile = form.getCustomerFile();
|
CompanyCustomerFileVo customerFile = getCompanyCustomerFileService().findById(form.getCustomerFile());
|
||||||
setCellValue(sheet, baseRow, 2, String.valueOf(customerFile.getSignDate()));
|
setCellValue(sheet, baseRow, 2, String.valueOf(customerFile.getSignDate()));
|
||||||
setCellValue(sheet, baseRow, 4, form.getCatalog());
|
setCellValue(sheet, baseRow, 4, form.getCatalog());
|
||||||
setCellValue(sheet, baseRow, 5, form.getLevel());
|
setCellValue(sheet, baseRow, 5, form.getLevel());
|
||||||
@@ -247,4 +236,5 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ package com.ecep.contract.controller.customer;
|
|||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.model.*;
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||||
import com.ecep.contract.service.CompanyCustomerEntityService;
|
import com.ecep.contract.service.CompanyCustomerEntityService;
|
||||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
@@ -15,7 +19,6 @@ import org.apache.poi.ss.util.AreaReference;
|
|||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFTable;
|
import org.apache.poi.xssf.usermodel.XSSFTable;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -94,39 +97,48 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
|
|||||||
setCellValue(sheet, "A19", "Build by CMS @ " + MyDateTimeUtils.format(LocalDateTime.now()));
|
setCellValue(sheet, "A19", "Build by CMS @ " + MyDateTimeUtils.format(LocalDateTime.now()));
|
||||||
|
|
||||||
int rowIndex = 0;
|
int rowIndex = 0;
|
||||||
for (CompanyCustomer customer : getCustomerService().findAll(null, Pageable.unpaged())) {
|
for (CompanyCustomerVo customer : getCustomerService().findAll(null, Pageable.unpaged())) {
|
||||||
Company company = customer.getCompany();
|
Integer companyId = customer.getCompanyId();
|
||||||
|
;
|
||||||
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
if (company == null) {
|
if (company == null) {
|
||||||
holder.warn("客户 #" + customer.getId() + " 不存在对应公司");
|
holder.warn("客户 #" + customer.getId() + " 不存在对应公司");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
// VO类不需要延迟加载代理,直接使用即可
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalDate devDate = null;
|
LocalDate devDate = null;
|
||||||
List<CompanyCustomerEntity> entities = getCustomerEntityService().findAllByCustomer(customer);
|
List<CompanyCustomerEntityVo> entities = getCustomerEntityService().findAllByCustomer(customer);
|
||||||
for (CompanyCustomerEntity entity : entities) {
|
for (CompanyCustomerEntityVo entity : entities) {
|
||||||
if (devDate == null || devDate.isAfter(entity.getDevelopDate())) {
|
if (devDate == null || devDate.isAfter(entity.getDevelopDate())) {
|
||||||
devDate = entity.getDevelopDate();
|
devDate = entity.getDevelopDate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFile evaluationFormFile = getCustomerFileService()
|
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCustomerFileService()
|
||||||
.findAllCustomerEvaluationFormFiles(customer).stream().filter(v -> {
|
.findAllCustomerEvaluationFormFiles(customer).stream().filter(v -> {
|
||||||
CompanyCustomerFile customerFile = v.getCustomerFile();
|
Integer customerFileId = v.getCustomerFile();
|
||||||
|
CompanyCustomerFileVo customerFile = getCustomerFileService().findById(customerFileId);
|
||||||
if (customerFile == null) {
|
if (customerFile == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return customerFile.isValid();
|
return customerFile.isValid();
|
||||||
}).max(Comparator.comparing(v -> v.getCustomerFile().getSignDate())).orElse(null);
|
}).max(Comparator.comparing(v -> {
|
||||||
|
Integer customerFileId = v.getCustomerFile();
|
||||||
|
CompanyCustomerFileVo customerFile = getCustomerFileService().findById(customerFileId);
|
||||||
|
if (customerFile == null) {
|
||||||
|
return LocalDate.MIN;
|
||||||
|
}
|
||||||
|
return customerFile.getSignDate();
|
||||||
|
})).orElse(null);
|
||||||
|
|
||||||
if (evaluationFormFile == null) {
|
if (evaluationFormFile == null) {
|
||||||
holder.warn(company.getName() + " 未匹配的客户评估");
|
holder.warn(company.getName() + " 未匹配的客户评估");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyCustomerFile customerFile = evaluationFormFile.getCustomerFile();
|
CompanyCustomerFileVo customerFile = getCustomerFileService()
|
||||||
|
.findById(evaluationFormFile.getCustomerFile());
|
||||||
if (devDate != null && devDate.isAfter(customerFile.getSignDate())) {
|
if (devDate != null && devDate.isAfter(customerFile.getSignDate())) {
|
||||||
holder.debug(company.getName() + " 最新评估日期早于客户开发日期,评估日期:" + customerFile.getSignDate() + ", 开发日期:"
|
holder.debug(company.getName() + " 最新评估日期早于客户开发日期,评估日期:" + customerFile.getSignDate() + ", 开发日期:"
|
||||||
+ devDate);
|
+ devDate);
|
||||||
|
|||||||
@@ -3,16 +3,17 @@ package com.ecep.contract.controller.customer;
|
|||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
public class CompanyCustomerManagerSkin
|
public class CompanyCustomerManagerSkin
|
||||||
extends
|
extends
|
||||||
AbstEntityManagerSkin<CompanyCustomer, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController> {
|
AbstEntityManagerSkin<CompanyCustomerVo, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController> {
|
||||||
|
|
||||||
public CompanyCustomerManagerSkin(CompanyCustomerManagerWindowController controller) {
|
public CompanyCustomerManagerSkin(CompanyCustomerManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -29,7 +30,7 @@ public class CompanyCustomerManagerSkin
|
|||||||
@Override
|
@Override
|
||||||
public void initializeTable() {
|
public void initializeTable() {
|
||||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany().getCompanyName());
|
||||||
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
||||||
|
|
||||||
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.time.LocalDate;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -15,12 +17,9 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
|
||||||
@@ -45,11 +44,14 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/customer/customer_manager.fxml")
|
@FxmlPath("/ui/company/customer/customer_manager.fxml")
|
||||||
public class CompanyCustomerManagerWindowController
|
public class CompanyCustomerManagerWindowController
|
||||||
extends AbstManagerWindowController<CompanyCustomer, CompanyCustomerViewModel, CompanyCustomerManagerSkin> {
|
extends AbstManagerWindowController<CompanyCustomerVo, CompanyCustomerViewModel, CompanyCustomerManagerSkin> {
|
||||||
|
|
||||||
// columns
|
// columns
|
||||||
public TableColumn<CompanyCustomerViewModel, Number> idColumn;
|
public TableColumn<CompanyCustomerViewModel, Number> idColumn;
|
||||||
public TableColumn<CompanyCustomerViewModel, Company> companyColumn;
|
/**
|
||||||
|
* 客户所属公司,Company
|
||||||
|
*/
|
||||||
|
public TableColumn<CompanyCustomerViewModel, Integer> companyColumn;
|
||||||
public TableColumn<CompanyCustomerViewModel, String> catalogColumn;
|
public TableColumn<CompanyCustomerViewModel, String> catalogColumn;
|
||||||
public TableColumn<CompanyCustomerViewModel, LocalDate> developDateColumn;
|
public TableColumn<CompanyCustomerViewModel, LocalDate> developDateColumn;
|
||||||
public TableColumn<CompanyCustomerViewModel, String> pathColumn;
|
public TableColumn<CompanyCustomerViewModel, String> pathColumn;
|
||||||
@@ -116,19 +118,16 @@ public class CompanyCustomerManagerWindowController
|
|||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
Pageable pageRequest = PageRequest.ofSize(50);
|
Pageable pageRequest = PageRequest.ofSize(50);
|
||||||
while (!canceled.get()) {
|
while (!canceled.get()) {
|
||||||
Page<CompanyCustomer> page = getViewModelService().findAll(null, pageRequest);
|
Page<CompanyCustomerVo> page = getViewModelService().findAll(null, pageRequest);
|
||||||
int index = page.getNumber() * page.getSize();
|
int index = page.getNumber() * page.getSize();
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (CompanyCustomer companyCustomer : page) {
|
for (CompanyCustomerVo companyCustomer : page) {
|
||||||
if (canceled.get()) {
|
if (canceled.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Company company = companyCustomer.getCompany();
|
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
CompanyVo company = getCompanyService().findById(companyCustomer.getCompanyId());
|
||||||
String prefix = (index + i) + "/" + page.getTotalElements() + ", " + company.getName() + "> ";
|
String prefix = (index + i) + "/" + page.getTotalElements() + ", " + company.getName() + "> ";
|
||||||
getViewModelService().reBuildingFiles(companyCustomer, (level, msg) -> {
|
getViewModelService().reBuildingFiles(companyCustomer, (level, msg) -> {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
|||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import com.ecep.contract.model.CompanyContact;
|
import com.ecep.contract.vo.CompanyContactVo;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
import com.ecep.contract.service.CompanyContactService;
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
@@ -27,7 +27,7 @@ import javafx.scene.control.TextField;
|
|||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
|
|
||||||
public class CompanyCustomerTabSkinBase
|
public class CompanyCustomerTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<CompanyCustomerWindowController, CompanyCustomer, CompanyCustomerViewModel>
|
extends AbstEntityBasedTabSkin<CompanyCustomerWindowController, CompanyCustomerVo, CompanyCustomerViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public CompanyCustomerTabSkinBase(CompanyCustomerWindowController controller) {
|
public CompanyCustomerTabSkinBase(CompanyCustomerWindowController controller) {
|
||||||
@@ -59,10 +59,13 @@ public class CompanyCustomerTabSkinBase
|
|||||||
|
|
||||||
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompany().isNull());
|
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompany().isNull());
|
||||||
controller.relativeCompanyBtn.setOnAction(event -> {
|
controller.relativeCompanyBtn.setOnAction(event -> {
|
||||||
Company company = viewModel.getCompany().get();
|
Integer companyId = viewModel.getCompany().get();
|
||||||
|
if (companyId != null) {
|
||||||
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
if (company != null) {
|
if (company != null) {
|
||||||
CompanyWindowController.show(company, controller.root.getScene().getWindow());
|
CompanyWindowController.show(company, controller.root.getScene().getWindow());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
controller.createPathBtn.setOnAction(this::onCompanyCustomerCreatePathAction);
|
controller.createPathBtn.setOnAction(this::onCompanyCustomerCreatePathAction);
|
||||||
@@ -79,7 +82,7 @@ public class CompanyCustomerTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeContactFieldAutoCompletion(TextField textField) {
|
private void initializeContactFieldAutoCompletion(TextField textField) {
|
||||||
EntityStringConverter<CompanyContact> stringConverter = new EntityStringConverter<>();
|
EntityStringConverter<CompanyContactVo> stringConverter = new EntityStringConverter<>();
|
||||||
stringConverter.setInitialized(cc -> getCompanyContactService().findById(cc.getId()));
|
stringConverter.setInitialized(cc -> getCompanyContactService().findById(cc.getId()));
|
||||||
UITools.autoCompletion(textField, viewModel.getContact(),
|
UITools.autoCompletion(textField, viewModel.getContact(),
|
||||||
p -> getCompanyContactService().searchByCompany(viewModel.getCompany().get(), p.getUserText()),
|
p -> getCompanyContactService().searchByCompany(viewModel.getCompany().get(), p.getUserText()),
|
||||||
@@ -92,7 +95,7 @@ public class CompanyCustomerTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCompanyCustomerCreatePathAction(ActionEvent event) {
|
public void onCompanyCustomerCreatePathAction(ActionEvent event) {
|
||||||
CompanyCustomer companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
||||||
if (getCompanyCustomerService().makePathAbsent(companyCustomer)) {
|
if (getCompanyCustomerService().makePathAbsent(companyCustomer)) {
|
||||||
companyCustomer = getCompanyCustomerService().save(companyCustomer);
|
companyCustomer = getCompanyCustomerService().save(companyCustomer);
|
||||||
viewModel.update(companyCustomer);
|
viewModel.update(companyCustomer);
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.service.CompanyContactService;
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -36,16 +36,14 @@ import javafx.stage.WindowEvent;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/customer/customer.fxml")
|
@FxmlPath("/ui/company/customer/customer.fxml")
|
||||||
public class CompanyCustomerWindowController extends AbstEntityController<CompanyCustomer, CompanyCustomerViewModel> {
|
public class CompanyCustomerWindowController extends AbstEntityController<CompanyCustomerVo, CompanyCustomerViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerWindowController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示界面
|
* 显示界面
|
||||||
*/
|
*/
|
||||||
public static void show(CompanyCustomer customer, Window window) {
|
public static void show(CompanyCustomerVo customer, Window window) {
|
||||||
CompanyCustomerViewModel viewModel = new CompanyCustomerViewModel();
|
show(CompanyCustomerWindowController.class, CompanyCustomerViewModel.from(customer), window);
|
||||||
viewModel.update(customer);
|
|
||||||
show(CompanyCustomerWindowController.class, viewModel, window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tab baseInfoTab;
|
public Tab baseInfoTab;
|
||||||
@@ -71,14 +69,11 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
|||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
super.show(stage);
|
super.show(stage);
|
||||||
getTitle().bind(viewModel.getCompany().map(company -> {
|
getTitle().bind(viewModel.getCompany().map(companyId -> {
|
||||||
if (company == null) {
|
if (companyId == null) {
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
viewModel.getCompany().set(company);
|
|
||||||
}
|
|
||||||
return getMessage("ui.customer.title", String.valueOf(viewModel.getId().get()), company.getName());
|
return getMessage("ui.customer.title", String.valueOf(viewModel.getId().get()), company.getName());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import com.ecep.contract.SpringApp;
|
|||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
import com.ecep.contract.model.CompanyCustomerEntity;
|
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
||||||
import com.ecep.contract.model.CustomerCatalog;
|
import com.ecep.contract.vo.CustomerCatalogVo;
|
||||||
import com.ecep.contract.service.CompanyCustomerEntityService;
|
import com.ecep.contract.service.CompanyCustomerEntityService;
|
||||||
import com.ecep.contract.service.CustomerCatalogService;
|
import com.ecep.contract.service.CustomerCatalogService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.CustomerEntityViewModel;
|
import com.ecep.contract.vm.CustomerEntityViewModel;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
@@ -18,11 +19,10 @@ import lombok.Setter;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/company/customer/customer-tab-entity.fxml")
|
@FxmlPath("/ui/company/customer/customer-tab-entity.fxml")
|
||||||
public class CustomerTabSkinEntity
|
public class CustomerTabSkinEntity
|
||||||
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerEntity, CustomerEntityViewModel> {
|
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerEntityVo, CustomerEntityViewModel> {
|
||||||
|
|
||||||
// 关联项 tab
|
// 关联项 tab
|
||||||
public TableColumn<CustomerEntityViewModel, Number> entityTable_idColumn;
|
public TableColumn<CustomerEntityViewModel, Number> entityTable_idColumn;
|
||||||
@@ -79,7 +79,7 @@ public class CustomerTabSkinEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
||||||
EntityStringConverter<CustomerCatalog> converter = new EntityStringConverter<>();
|
EntityStringConverter<CustomerCatalogVo> converter = new EntityStringConverter<>();
|
||||||
converter.setInitialized(v -> getCachedBean(CustomerCatalogService.class).findById(v.getId()));
|
converter.setInitialized(v -> getCachedBean(CustomerCatalogService.class).findById(v.getId()));
|
||||||
column.setCellValueFactory(param -> param.getValue().getCatalog().map(converter::toString));
|
column.setCellValueFactory(param -> param.getValue().getCatalog().map(converter::toString));
|
||||||
}
|
}
|
||||||
@@ -97,9 +97,9 @@ public class CustomerTabSkinEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(CompanyCustomer parent) {
|
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("customer", parent.getId());
|
params.equals("customer", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,11 @@ package com.ecep.contract.controller.customer;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.ecep.contract.service.CompanyCustomerFileTypeService;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyCustomerFileType;
|
import com.ecep.contract.CompanyCustomerFileType;
|
||||||
@@ -20,17 +17,18 @@ import com.ecep.contract.SpringApp;
|
|||||||
import com.ecep.contract.constant.CompanyCustomerConstant;
|
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.BaseEnumEntity;
|
import com.ecep.contract.model.BaseEnumEntity;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
|
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
|
||||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerFileTypeService;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.util.FileUtils;
|
import com.ecep.contract.util.FileUtils;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
@@ -52,8 +50,8 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@FxmlPath("/ui/company/customer/customer-tab-file.fxml")
|
@FxmlPath("/ui/company/customer/customer-tab-file.fxml")
|
||||||
public class CustomerTabSkinFile
|
public class CustomerTabSkinFile
|
||||||
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerFile, CompanyCustomerFileViewModel>
|
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerFileVo, CompanyCustomerFileViewModel>
|
||||||
implements EditableEntityTableTabSkin<CompanyCustomerFile, CompanyCustomerFileViewModel> {
|
implements EditableEntityTableTabSkin<CompanyCustomerFileVo, CompanyCustomerFileViewModel> {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyCustomerFileService companyCustomerFileService;
|
private CompanyCustomerFileService companyCustomerFileService;
|
||||||
@@ -91,9 +89,9 @@ public class CustomerTabSkinFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(CompanyCustomer parent) {
|
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("customer", parent.getId());
|
params.equals("customer", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +182,7 @@ public class CustomerTabSkinFile
|
|||||||
setStatus("目录错误,不存在");
|
setStatus("目录错误,不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompanyCustomer companyCustomer = getParent();
|
CompanyCustomerVo companyCustomer = getParent();
|
||||||
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer,
|
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer,
|
||||||
((level, message) -> setStatus(message)));
|
((level, message) -> setStatus(message)));
|
||||||
if (nextSignDate != null && files.size() == 1) {
|
if (nextSignDate != null && files.size() == 1) {
|
||||||
@@ -196,13 +194,13 @@ public class CustomerTabSkinFile
|
|||||||
+ "." + StringUtils.getFilenameExtension(fileName);
|
+ "." + StringUtils.getFilenameExtension(fileName);
|
||||||
File dest = new File(dir, destFileName);
|
File dest = new File(dir, destFileName);
|
||||||
if (file.renameTo(dest)) {
|
if (file.renameTo(dest)) {
|
||||||
CompanyCustomerFile ccf = new CompanyCustomerFile();
|
CompanyCustomerFileVo ccf = new CompanyCustomerFileVo();
|
||||||
ccf.setCustomer(companyCustomer);
|
ccf.setCustomer(companyCustomer.getId());
|
||||||
ccf.setType(CompanyCustomerFileType.EvaluationForm);
|
ccf.setType(CompanyCustomerFileType.EvaluationForm);
|
||||||
ccf.setFilePath(dest.getAbsolutePath());
|
ccf.setFilePath(dest.getAbsolutePath());
|
||||||
ccf.setSignDate(nextSignDate);
|
ccf.setSignDate(nextSignDate);
|
||||||
ccf.setValid(false);
|
ccf.setValid(false);
|
||||||
CompanyCustomerFile saved = getCompanyCustomerFileService().save(ccf);
|
CompanyCustomerFileVo saved = getCompanyCustomerFileService().save(ccf);
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
||||||
model.update(saved);
|
model.update(saved);
|
||||||
@@ -219,8 +217,8 @@ public class CustomerTabSkinFile
|
|||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
File dest = new File(dir, file.getName());
|
File dest = new File(dir, file.getName());
|
||||||
if (file.renameTo(dest)) {
|
if (file.renameTo(dest)) {
|
||||||
CompanyCustomerFile ccf = new CompanyCustomerFile();
|
CompanyCustomerFileVo ccf = new CompanyCustomerFileVo();
|
||||||
ccf.setCustomer(companyCustomer);
|
ccf.setCustomer(companyCustomer.getId());
|
||||||
ccf.setType(CompanyCustomerFileType.General);
|
ccf.setType(CompanyCustomerFileType.General);
|
||||||
ccf.setFilePath(dest.getAbsolutePath());
|
ccf.setFilePath(dest.getAbsolutePath());
|
||||||
ccf.setValid(false);
|
ccf.setValid(false);
|
||||||
@@ -234,7 +232,7 @@ public class CustomerTabSkinFile
|
|||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
CompanyCustomerService customerService = getCompanyCustomerService();
|
CompanyCustomerService customerService = getCompanyCustomerService();
|
||||||
try {
|
try {
|
||||||
CompanyCustomer companyCustomer = customerService.findById(viewModel.getId().get());
|
CompanyCustomerVo companyCustomer = customerService.findById(viewModel.getId().get());
|
||||||
if (customerService.reBuildingFiles(companyCustomer, (level, message) -> setStatus(message))) {
|
if (customerService.reBuildingFiles(companyCustomer, (level, message) -> setStatus(message))) {
|
||||||
loadTableDataSet();
|
loadTableDataSet();
|
||||||
}
|
}
|
||||||
@@ -245,17 +243,17 @@ public class CustomerTabSkinFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyCustomerFile loadRowData(CompanyCustomerFileViewModel row) {
|
public CompanyCustomerFileVo loadRowData(CompanyCustomerFileViewModel row) {
|
||||||
return getCompanyCustomerFileService().findById(row.getId().get());
|
return getCompanyCustomerFileService().findById(row.getId().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyCustomerFile saveRowData(CompanyCustomerFile entity) {
|
public CompanyCustomerFileVo saveRowData(CompanyCustomerFileVo entity) {
|
||||||
return getCompanyCustomerFileService().save(entity);
|
return getCompanyCustomerFileService().save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteRowData(CompanyCustomerFile entity) {
|
public void deleteRowData(CompanyCustomerFileVo entity) {
|
||||||
getCompanyCustomerFileService().delete(entity);
|
getCompanyCustomerFileService().delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,11 +278,8 @@ public class CustomerTabSkinFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onFileTableMoveToCompanyPathAction(ActionEvent event) {
|
public void onFileTableMoveToCompanyPathAction(ActionEvent event) {
|
||||||
Company company = viewModel.getCompany().get();
|
Integer companyId = viewModel.getCompany().get();
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
company = getCompanyService().findById(company.getId());
|
|
||||||
}
|
|
||||||
viewModel.getCompany().set(company);
|
|
||||||
|
|
||||||
if (!StringUtils.hasText(company.getPath())) {
|
if (!StringUtils.hasText(company.getPath())) {
|
||||||
setStatus("公司目录未设置");
|
setStatus("公司目录未设置");
|
||||||
@@ -360,7 +355,7 @@ public class CustomerTabSkinFile
|
|||||||
|
|
||||||
public void onCalcNextSignDateAction(ActionEvent event) {
|
public void onCalcNextSignDateAction(ActionEvent event) {
|
||||||
UITools.showDialogAndWait("计算客户下一个评价日期", "依据已有的客户评估表和登记采购的合同计算下一个评估日期", ds -> {
|
UITools.showDialogAndWait("计算客户下一个评价日期", "依据已有的客户评估表和登记采购的合同计算下一个评估日期", ds -> {
|
||||||
CompanyCustomer companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
||||||
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer, (level, msg) -> {
|
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer, (level, msg) -> {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
ds.add(msg);
|
ds.add(msg);
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ import com.ecep.contract.controller.project.satisfaction_survey.CustomerSatisfac
|
|||||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.ProjectTableCell;
|
import com.ecep.contract.controller.table.cell.ProjectTableCell;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
import com.ecep.contract.model.CustomerCatalog;
|
import com.ecep.contract.vo.CustomerCatalogVo;
|
||||||
import com.ecep.contract.model.CustomerSatisfactionSurvey;
|
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
|
||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
import com.ecep.contract.model.Project;
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.CustomerEntityViewModel;
|
import com.ecep.contract.vm.CustomerEntityViewModel;
|
||||||
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
||||||
|
|
||||||
@@ -27,14 +28,14 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@FxmlPath("/ui/company/customer/customer-tab-satisfaction-survey.fxml")
|
@FxmlPath("/ui/company/customer/customer-tab-satisfaction-survey.fxml")
|
||||||
public class CustomerTabSkinSatisfactionSurvey
|
public class CustomerTabSkinSatisfactionSurvey
|
||||||
extends AbstCompanyCustomerTableTabSkin<CustomerSatisfactionSurvey, CustomerSatisfactionSurveyViewModel> {
|
extends AbstCompanyCustomerTableTabSkin<CustomerSatisfactionSurveyVo, CustomerSatisfactionSurveyViewModel> {
|
||||||
|
|
||||||
// 关联项 tab
|
// 关联项 tab
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> idColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> idColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, Project> projectColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, ProjectVo> projectColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, String> codeColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, String> codeColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> totalScoreColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> totalScoreColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, Employee> applicantColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, EmployeeVo> applicantColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDateTime> applyTimeColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDateTime> applyTimeColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, String> descriptionColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, String> descriptionColumn;
|
||||||
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDate> dateColumn;
|
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDate> dateColumn;
|
||||||
@@ -75,7 +76,7 @@ public class CustomerTabSkinSatisfactionSurvey
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
||||||
EntityStringConverter<CustomerCatalog> converter = new EntityStringConverter<>();
|
EntityStringConverter<CustomerCatalogVo> converter = new EntityStringConverter<>();
|
||||||
converter.setInitialized(v -> getCachedBean(CustomerCatalogService.class).findById(v.getId()));
|
converter.setInitialized(v -> getCachedBean(CustomerCatalogService.class).findById(v.getId()));
|
||||||
column.setCellValueFactory(param -> param.getValue().getCatalog().map(converter::toString));
|
column.setCellValueFactory(param -> param.getValue().getCatalog().map(converter::toString));
|
||||||
}
|
}
|
||||||
@@ -100,9 +101,9 @@ public class CustomerTabSkinSatisfactionSurvey
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(CompanyCustomer parent) {
|
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("project.customer", parent.getId());
|
params.equals("project.customer", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ecep.contract.controller.customer;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.SalesOrderVo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@@ -11,7 +12,6 @@ import com.ecep.contract.util.FxmlPath;
|
|||||||
import com.ecep.contract.controller.tab.SalesOrderTabSkinBase;
|
import com.ecep.contract.controller.tab.SalesOrderTabSkinBase;
|
||||||
import com.ecep.contract.controller.tab.SalesOrderTabSkinBillVoucher;
|
import com.ecep.contract.controller.tab.SalesOrderTabSkinBillVoucher;
|
||||||
import com.ecep.contract.controller.tab.SalesOrderTabSkinItems;
|
import com.ecep.contract.controller.tab.SalesOrderTabSkinItems;
|
||||||
import com.ecep.contract.model.SalesOrder;
|
|
||||||
import com.ecep.contract.service.SaleOrdersService;
|
import com.ecep.contract.service.SaleOrdersService;
|
||||||
import com.ecep.contract.vm.SalesOrderViewModel;
|
import com.ecep.contract.vm.SalesOrderViewModel;
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ import javafx.stage.Window;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/contract/sale-orders.fxml")
|
@FxmlPath("/ui/contract/sale-orders.fxml")
|
||||||
public class SalesOrderWindowController extends AbstEntityController<SalesOrder, SalesOrderViewModel> {
|
public class SalesOrderWindowController extends AbstEntityController<SalesOrderVo, SalesOrderViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SalesOrderWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(SalesOrderWindowController.class);
|
||||||
public TabPane tabPane;
|
public TabPane tabPane;
|
||||||
public Button saveBtn;
|
public Button saveBtn;
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.model.Department;
|
|
||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.util.ParamUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vo.DepartmentVo;
|
||||||
import com.ecep.contract.vm.DepartmentViewModel;
|
import com.ecep.contract.vm.DepartmentViewModel;
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
@@ -21,9 +22,9 @@ import javafx.scene.control.cell.ComboBoxTableCell;
|
|||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
|
|
||||||
public class DepartmentManagerSkin
|
public class DepartmentManagerSkin
|
||||||
extends AbstEntityManagerSkin<Department, DepartmentViewModel, DepartmentManagerSkin, DepartmentManagerWindowController>
|
extends
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<Department, DepartmentViewModel> {
|
AbstEntityManagerSkin<DepartmentVo, DepartmentViewModel, DepartmentManagerSkin, DepartmentManagerWindowController>
|
||||||
|
implements ManagerSkin, EditableEntityTableTabSkin<DepartmentVo, DepartmentViewModel> {
|
||||||
|
|
||||||
public DepartmentManagerSkin(DepartmentManagerWindowController controller) {
|
public DepartmentManagerSkin(DepartmentManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -33,7 +34,7 @@ public class DepartmentManagerSkin
|
|||||||
public void initializeTable() {
|
public void initializeTable() {
|
||||||
getTableView().setEditable(true);
|
getTableView().setEditable(true);
|
||||||
|
|
||||||
List<Employee> employees = controller.getEmployeeService().findAll(ParamUtils.equal("isActive", true), Pageable.ofSize(30)).getContent();
|
// 不再需要获取所有员工列表,因为现在使用的是leaderId和leaderName
|
||||||
|
|
||||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||||
|
|
||||||
@@ -46,8 +47,7 @@ public class DepartmentManagerSkin
|
|||||||
controller.codeColumn.setOnEditCommit(this::onCodeColumnEditCommit);
|
controller.codeColumn.setOnEditCommit(this::onCodeColumnEditCommit);
|
||||||
|
|
||||||
controller.leaderColumn.setCellValueFactory(param -> param.getValue().getLeader());
|
controller.leaderColumn.setCellValueFactory(param -> param.getValue().getLeader());
|
||||||
controller.leaderColumn.setCellFactory(ComboBoxTableCell.forTableColumn(getBean(EmployeeStringConverter.class), FXCollections.observableArrayList(employees)));
|
controller.leaderColumn.setCellFactory(param -> new EmployeeTableCell<>(controller.getEmployeeService()));
|
||||||
controller.leaderColumn.setOnEditCommit(this::onLeaderColumnEditCommit);
|
|
||||||
|
|
||||||
controller.activeColumn.setCellValueFactory(param -> param.getValue().getIsActive());
|
controller.activeColumn.setCellValueFactory(param -> param.getValue().getIsActive());
|
||||||
controller.activeColumn.setEditable(true);
|
controller.activeColumn.setEditable(true);
|
||||||
@@ -55,7 +55,6 @@ public class DepartmentManagerSkin
|
|||||||
controller.activeColumn.setOnEditCommit(this::onActiveColumnEditCommit);
|
controller.activeColumn.setOnEditCommit(this::onActiveColumnEditCommit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onCodeColumnEditCommit(TableColumn.CellEditEvent<DepartmentViewModel, String> event) {
|
private void onCodeColumnEditCommit(TableColumn.CellEditEvent<DepartmentViewModel, String> event) {
|
||||||
DepartmentViewModel row = event.getRowValue();
|
DepartmentViewModel row = event.getRowValue();
|
||||||
row.getCode().set(event.getNewValue());
|
row.getCode().set(event.getNewValue());
|
||||||
@@ -68,9 +67,11 @@ public class DepartmentManagerSkin
|
|||||||
saveRowData(row);
|
saveRowData(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLeaderColumnEditCommit(TableColumn.CellEditEvent<DepartmentViewModel, Employee> event) {
|
private void onLeaderColumnEditCommit(TableColumn.CellEditEvent<DepartmentViewModel, Integer> event) {
|
||||||
DepartmentViewModel row = event.getRowValue();
|
DepartmentViewModel row = event.getRowValue();
|
||||||
row.getLeader().set(event.getNewValue());
|
row.getLeader().set(event.getNewValue());
|
||||||
|
// 注意:这里我们只设置了leaderName,但没有设置leaderId
|
||||||
|
// 在实际应用中,您可能需要根据leaderName查找对应的leaderId
|
||||||
saveRowData(row);
|
saveRowData(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,14 +83,14 @@ public class DepartmentManagerSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableRowDoubleClickedAction(DepartmentViewModel item) {
|
protected void onTableRowDoubleClickedAction(DepartmentViewModel item) {
|
||||||
//TODO 显示详情
|
// TODO 显示详情
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableCreateNewAction(ActionEvent event) {
|
protected void onTableCreateNewAction(ActionEvent event) {
|
||||||
Department employee = new Department();
|
DepartmentVo department = new DepartmentVo();
|
||||||
employee = controller.getViewModelService().save(employee);
|
department = controller.getViewModelService().save(department);
|
||||||
DepartmentViewModel viewModel = DepartmentViewModel.from(employee);
|
DepartmentViewModel viewModel = DepartmentViewModel.from(department);
|
||||||
dataSet.add(viewModel);
|
dataSet.add(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
package com.ecep.contract.controller.department;
|
package com.ecep.contract.controller.department;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.Department;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.service.DepartmentService;
|
import com.ecep.contract.service.DepartmentService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.DepartmentViewModel;
|
import com.ecep.contract.vm.DepartmentViewModel;
|
||||||
|
import com.ecep.contract.vo.DepartmentVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -22,12 +20,12 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath(value = "/ui/employee/department-manager.fxml")
|
@FxmlPath(value = "/ui/employee/department-manager.fxml")
|
||||||
public class DepartmentManagerWindowController
|
public class DepartmentManagerWindowController
|
||||||
extends AbstManagerWindowController<Department, DepartmentViewModel, DepartmentManagerSkin> {
|
extends AbstManagerWindowController<DepartmentVo, DepartmentViewModel, DepartmentManagerSkin> {
|
||||||
|
|
||||||
public TableColumn<DepartmentViewModel, Number> idColumn;
|
public TableColumn<DepartmentViewModel, Number> idColumn;
|
||||||
public TableColumn<DepartmentViewModel, String> nameColumn;
|
public TableColumn<DepartmentViewModel, String> nameColumn;
|
||||||
public TableColumn<DepartmentViewModel, String> codeColumn;
|
public TableColumn<DepartmentViewModel, String> codeColumn;
|
||||||
public TableColumn<DepartmentViewModel, Employee> leaderColumn;
|
public TableColumn<DepartmentViewModel, Integer> leaderColumn;
|
||||||
public TableColumn<DepartmentViewModel, Boolean> activeColumn;
|
public TableColumn<DepartmentViewModel, Boolean> activeColumn;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import com.ecep.contract.service.EmployeeService;
|
|||||||
import com.ecep.contract.service.PermissionService;
|
import com.ecep.contract.service.PermissionService;
|
||||||
import com.ecep.contract.vm.EmployeeViewModel;
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public abstract class AbstEmployeeBasedTabSkin
|
public abstract class AbstEmployeeBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<EmployeeWindowController, Employee, EmployeeViewModel>
|
extends AbstEntityBasedTabSkin<EmployeeWindowController, EmployeeVo, EmployeeViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
|||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.service.EmployeeService;
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.EmployeeBasedViewModel;
|
import com.ecep.contract.vm.EmployeeBasedViewModel;
|
||||||
import com.ecep.contract.vm.EmployeeViewModel;
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
import com.ecep.contract.vm.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
|
||||||
public abstract class AbstEmployeeTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstEmployeeTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends AbstEntityTableTabSkin<EmployeeWindowController, Employee, EmployeeViewModel, T, TV>
|
extends AbstEntityTableTabSkin<EmployeeWindowController, EmployeeVo, EmployeeViewModel, T, TV>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstEmployeeTableTabSkin(EmployeeWindowController controller) {
|
public AbstEmployeeTableTabSkin(EmployeeWindowController controller) {
|
||||||
@@ -27,16 +29,16 @@ public abstract class AbstEmployeeTableTabSkin<T extends IdentityEntity, TV exte
|
|||||||
protected TV createNewViewModel() {
|
protected TV createNewViewModel() {
|
||||||
TV model = super.createNewViewModel();
|
TV model = super.createNewViewModel();
|
||||||
if (model instanceof EmployeeBasedViewModel m) {
|
if (model instanceof EmployeeBasedViewModel m) {
|
||||||
m.getEmployee().set(getEntity());
|
m.getEmployee().set(getEntity().getId());
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Employee parent) {
|
public ParamUtils.Builder getSpecification(EmployeeVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("employee", parent.getId());
|
params.equals("employee", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
package com.ecep.contract.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.cell.DepartmentTableCell;
|
import com.ecep.contract.controller.table.cell.DepartmentTableCell;
|
||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.service.DepartmentService;
|
import com.ecep.contract.service.DepartmentService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.EmployeeViewModel;
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
|
|
||||||
public class EmployeeManagerSkin
|
public class EmployeeManagerSkin
|
||||||
extends AbstEntityManagerSkin<Employee, EmployeeViewModel, EmployeeManagerSkin, EmployeeManagerWindowController>
|
extends
|
||||||
|
AbstEntityManagerSkin<EmployeeVo, EmployeeViewModel, EmployeeManagerSkin, EmployeeManagerWindowController>
|
||||||
implements ManagerSkin {
|
implements ManagerSkin {
|
||||||
public EmployeeManagerSkin(EmployeeManagerWindowController controller) {
|
public EmployeeManagerSkin(EmployeeManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -29,10 +30,10 @@ public class EmployeeManagerSkin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification() {
|
public ParamUtils.Builder getSpecification() {
|
||||||
Map<String, Object> params = super.getSpecification();
|
ParamUtils.Builder params = super.getSpecification();
|
||||||
if (controller.activeCheckBox.isSelected()) {
|
if (controller.activeCheckBox.isSelected()) {
|
||||||
params.put("isActive", true);
|
params.equals("isActive", true);
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
@@ -64,7 +65,7 @@ public class EmployeeManagerSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableCreateNewAction(ActionEvent event) {
|
protected void onTableCreateNewAction(ActionEvent event) {
|
||||||
Employee employee = new Employee();
|
EmployeeVo employee = new EmployeeVo();
|
||||||
employee = controller.getViewModelService().save(employee);
|
employee = controller.getViewModelService().save(employee);
|
||||||
EmployeeViewModel viewModel = EmployeeViewModel.from(employee);
|
EmployeeViewModel viewModel = EmployeeViewModel.from(employee);
|
||||||
dataSet.add(viewModel);
|
dataSet.add(viewModel);
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import org.springframework.stereotype.Component;
|
|||||||
import com.ecep.contract.constant.CloudServiceConstant;
|
import com.ecep.contract.constant.CloudServiceConstant;
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.Department;
|
import com.ecep.contract.model.Department;
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.service.EmployeeService;
|
import com.ecep.contract.service.EmployeeService;
|
||||||
import com.ecep.contract.task.EmployeesSyncTask;
|
import com.ecep.contract.task.EmployeesSyncTask;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.EmployeeViewModel;
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -27,14 +27,14 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/employee/employee-manager.fxml")
|
@FxmlPath("/ui/employee/employee-manager.fxml")
|
||||||
public class EmployeeManagerWindowController
|
public class EmployeeManagerWindowController
|
||||||
extends AbstManagerWindowController<Employee, EmployeeViewModel, EmployeeManagerSkin> {
|
extends AbstManagerWindowController<EmployeeVo, EmployeeViewModel, EmployeeManagerSkin> {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<EmployeeViewModel, Number> idColumn;
|
public TableColumn<EmployeeViewModel, Number> idColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<EmployeeViewModel, String> accountColumn;
|
public TableColumn<EmployeeViewModel, String> accountColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<EmployeeViewModel, Department> departmentColumn;
|
public TableColumn<EmployeeViewModel, Integer> departmentColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<EmployeeViewModel, String> nameColumn;
|
public TableColumn<EmployeeViewModel, String> nameColumn;
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
package com.ecep.contract.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import com.ecep.contract.Desktop;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.model.EmployeeAuthBind;
|
import com.ecep.contract.model.EmployeeAuthBind;
|
||||||
import com.ecep.contract.service.EmployeeAuthBindService;
|
import com.ecep.contract.service.EmployeeAuthBindService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.EmployeeAuthBindViewModel;
|
import com.ecep.contract.vm.EmployeeAuthBindViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeAuthBindVo;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
@@ -19,15 +15,18 @@ import javafx.scene.control.Tab;
|
|||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@FxmlPath("/ui/employee/employee-auth-bind.fxml")
|
@FxmlPath("/ui/employee/employee-auth-bind.fxml")
|
||||||
public class EmployeeTabSkinAuthBind
|
public class EmployeeTabSkinAuthBind
|
||||||
extends AbstEmployeeTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel> {
|
extends AbstEmployeeTableTabSkin<EmployeeAuthBindVo, EmployeeAuthBindViewModel> {
|
||||||
public TableColumn<EmployeeAuthBindViewModel, Number> idColumn;
|
public TableColumn<EmployeeAuthBindViewModel, Number> idColumn;
|
||||||
public TableColumn<EmployeeAuthBindViewModel, String> ipColumn;
|
public TableColumn<EmployeeAuthBindViewModel, String> ipColumn;
|
||||||
public TableColumn<EmployeeAuthBindViewModel, String> macColumn;
|
public TableColumn<EmployeeAuthBindViewModel, String> macColumn;
|
||||||
public TableColumn<EmployeeAuthBindViewModel, LocalDateTime> createTime;
|
public TableColumn<EmployeeAuthBindViewModel, LocalDateTime> createTime;
|
||||||
public TableColumn<EmployeeAuthBindViewModel, LocalDateTime> updateTimeColumn;
|
public TableColumn<EmployeeAuthBindViewModel, LocalDateTime> updateTimeColumn;
|
||||||
public TableColumn<EmployeeAuthBindViewModel, Employee> updaterColumn;
|
public TableColumn<EmployeeAuthBindViewModel, Integer> updaterColumn;
|
||||||
public TableColumn<EmployeeAuthBindViewModel, String> descriptionColumn;
|
public TableColumn<EmployeeAuthBindViewModel, String> descriptionColumn;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@@ -81,13 +80,18 @@ public class EmployeeTabSkinAuthBind
|
|||||||
protected void createContextMenu(ContextMenu contextMenu) {
|
protected void createContextMenu(ContextMenu contextMenu) {
|
||||||
super.createContextMenu(contextMenu);
|
super.createContextMenu(contextMenu);
|
||||||
MenuItem menuItem = new MenuItem("导入未关联");
|
MenuItem menuItem = new MenuItem("导入未关联");
|
||||||
|
int activeEmployeeId = Desktop.instance.getActiveEmployeeId();
|
||||||
|
if (activeEmployeeId <= 0) {
|
||||||
|
logger.warn("未登录员工{}", activeEmployeeId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
menuItem.setOnAction(event -> {
|
menuItem.setOnAction(event -> {
|
||||||
EmployeeAuthBindService service = getEmployeeAuthBindService();
|
EmployeeAuthBindService service = getEmployeeAuthBindService();
|
||||||
List<EmployeeAuthBind> authBinds = service.findAllByEmployee(null);
|
List<EmployeeAuthBindVo> authBinds = service.findAllByEmployee(null);
|
||||||
for (EmployeeAuthBind authBind : authBinds) {
|
for (EmployeeAuthBindVo authBind : authBinds) {
|
||||||
authBind.setEmployee(getEntity());
|
authBind.setEmployeeId(getEntity().getId());
|
||||||
authBind.setUpdateTime(LocalDateTime.now());
|
authBind.setUpdateTime(LocalDateTime.now());
|
||||||
authBind.setUpdater(controller.getCurrentUser());
|
authBind.setUpdaterId(activeEmployeeId);
|
||||||
service.save(authBind);
|
service.save(authBind);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.ecep.contract.controller.employee;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
|
||||||
import com.ecep.contract.model.Department;
|
|
||||||
import com.ecep.contract.service.DepartmentService;
|
import com.ecep.contract.service.DepartmentService;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
|
||||||
@@ -25,11 +23,8 @@ public class EmployeeTabSkinBase
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
EntityStringConverter<Department> departmentEntityStringConverter = new EntityStringConverter<>();
|
|
||||||
DepartmentService departmentService = getBean(DepartmentService.class);
|
|
||||||
departmentEntityStringConverter.setInitialized(department -> departmentService.findById(department.getId()));
|
|
||||||
UITools.autoCompletion(controller.departmentField, viewModel.getDepartment(),
|
UITools.autoCompletion(controller.departmentField, viewModel.getDepartment(),
|
||||||
p -> departmentService.search(p.getUserText()), departmentEntityStringConverter);
|
getCachedBean(DepartmentService.class));
|
||||||
|
|
||||||
controller.nameField.textProperty().bindBidirectional(viewModel.getName());
|
controller.nameField.textProperty().bindBidirectional(viewModel.getName());
|
||||||
controller.aliasField.textProperty().bindBidirectional(viewModel.getAlias());
|
controller.aliasField.textProperty().bindBidirectional(viewModel.getAlias());
|
||||||
@@ -49,23 +44,25 @@ public class EmployeeTabSkinBase
|
|||||||
|
|
||||||
controller.isActiveField.selectedProperty().bindBidirectional(viewModel.getIsActive());
|
controller.isActiveField.selectedProperty().bindBidirectional(viewModel.getIsActive());
|
||||||
|
|
||||||
|
// Callback<ListView<EmployeeRole>, ListCell<EmployeeRole>> cellFactory =
|
||||||
|
// controller.rolesField.getCellFactory();
|
||||||
|
// StringConverter<EmployeeRole> employeeRoleStringConverter = new
|
||||||
|
// EntityStringConverter<>();
|
||||||
|
// controller.rolesField.setCellFactory(param -> {
|
||||||
|
// ListCell<EmployeeRole> cell = cellFactory.call(param);
|
||||||
|
// if (cell instanceof CheckBoxListCell<EmployeeRole> list) {
|
||||||
|
// list.setConverter(employeeRoleStringConverter);
|
||||||
|
// }
|
||||||
|
// return cell;
|
||||||
|
// });
|
||||||
|
|
||||||
// Callback<ListView<EmployeeRole>, ListCell<EmployeeRole>> cellFactory = controller.rolesField.getCellFactory();
|
// controller.rolesField.getCheckModel().getCheckedItems().setAll();
|
||||||
// StringConverter<EmployeeRole> employeeRoleStringConverter = new EntityStringConverter<>();
|
// Property<IndexedCheckModel<EmployeeRole>> selectedRoles = new
|
||||||
// controller.rolesField.setCellFactory(param -> {
|
// SimpleObjectProperty<>();
|
||||||
// ListCell<EmployeeRole> cell = cellFactory.call(param);
|
// controller.rolesField.getCheckModel().getCheckedItems().addListener((ListChangeListener<?
|
||||||
// if (cell instanceof CheckBoxListCell<EmployeeRole> list) {
|
// super EmployeeRole>) changed -> {
|
||||||
// list.setConverter(employeeRoleStringConverter);
|
// System.out.println("newValue = " + changed);
|
||||||
// }
|
// });
|
||||||
// return cell;
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// controller.rolesField.getCheckModel().getCheckedItems().setAll();
|
|
||||||
// Property<IndexedCheckModel<EmployeeRole>> selectedRoles = new SimpleObjectProperty<>();
|
|
||||||
// controller.rolesField.getCheckModel().getCheckedItems().addListener((ListChangeListener<? super EmployeeRole>) changed -> {
|
|
||||||
// System.out.println("newValue = " + changed);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ecep.contract.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
import org.controlsfx.control.ListSelectionView;
|
import org.controlsfx.control.ListSelectionView;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -30,7 +31,7 @@ import lombok.Getter;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/employee/employee.fxml")
|
@FxmlPath("/ui/employee/employee.fxml")
|
||||||
public class EmployeeWindowController extends AbstEntityController<Employee, EmployeeViewModel> {
|
public class EmployeeWindowController extends AbstEntityController<EmployeeVo, EmployeeViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(EmployeeWindowController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +72,7 @@ public class EmployeeWindowController extends AbstEntityController<Employee, Emp
|
|||||||
public TableView<Tab> permissionsTable;
|
public TableView<Tab> permissionsTable;
|
||||||
|
|
||||||
|
|
||||||
public static void show(Employee employee, Window owner) {
|
public static void show(EmployeeVo employee, Window owner) {
|
||||||
EmployeeViewModel model = EmployeeViewModel.from(employee);
|
EmployeeViewModel model = EmployeeViewModel.from(employee);
|
||||||
show(model, owner);
|
show(model, owner);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,15 @@ package com.ecep.contract.controller.inventory;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.InventoryCatalogTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Inventory;
|
|
||||||
import com.ecep.contract.model.InventoryCatalog;
|
|
||||||
import com.ecep.contract.service.InventoryCatalogService;
|
import com.ecep.contract.service.InventoryCatalogService;
|
||||||
import com.ecep.contract.service.InventoryService;
|
import com.ecep.contract.service.InventoryService;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
import com.ecep.contract.vo.InventoryCatalogVo;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -21,7 +22,7 @@ import javafx.util.converter.NumberStringConverter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class InventoryManagerSkin extends
|
public class InventoryManagerSkin extends
|
||||||
AbstEntityManagerSkin<Inventory, InventoryViewModel, InventoryManagerSkin, InventoryManagerWindowController> {
|
AbstEntityManagerSkin<InventoryVo, InventoryViewModel, InventoryManagerSkin, InventoryManagerWindowController> {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private InventoryCatalogService catalogService;
|
private InventoryCatalogService catalogService;
|
||||||
@@ -56,13 +57,7 @@ public class InventoryManagerSkin extends
|
|||||||
controller.codeColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getCode));
|
controller.codeColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getCode));
|
||||||
|
|
||||||
controller.catalogColumn.setCellValueFactory(param -> param.getValue().getCatalog());
|
controller.catalogColumn.setCellValueFactory(param -> param.getValue().getCatalog());
|
||||||
EntityStringConverter<InventoryCatalog> catalogStringConverter = new EntityStringConverter<>();
|
controller.catalogColumn.setCellFactory(param-> new InventoryCatalogTableCell<>(getInventoryCatalogService()));
|
||||||
catalogStringConverter.setInitialized(v -> getInventoryCatalogService().findById(v.getId()));
|
|
||||||
catalogStringConverter.setFormater(InventoryCatalog::getName);
|
|
||||||
catalogStringConverter.setFromString(v -> getInventoryCatalogService().findByName(v));
|
|
||||||
catalogStringConverter.setSuggestion(getInventoryCatalogService()::search);
|
|
||||||
|
|
||||||
controller.catalogColumn.setCellFactory(TextFieldTableCell.forTableColumn(catalogStringConverter));
|
|
||||||
controller.catalogColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getCatalog));
|
controller.catalogColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getCatalog));
|
||||||
|
|
||||||
controller.specificationColumn.setCellValueFactory(param -> param.getValue().getSpecification());
|
controller.specificationColumn.setCellValueFactory(param -> param.getValue().getSpecification());
|
||||||
@@ -125,7 +120,7 @@ public class InventoryManagerSkin extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableCreateNewAction(ActionEvent event) {
|
protected void onTableCreateNewAction(ActionEvent event) {
|
||||||
Inventory inventory = getService().save(getService().createNewInstance());
|
InventoryVo inventory = getService().save(getService().createNewEntity());
|
||||||
InventoryViewModel viewModel = InventoryViewModel.from(inventory);
|
InventoryViewModel viewModel = InventoryViewModel.from(inventory);
|
||||||
dataSet.add(viewModel);
|
dataSet.add(viewModel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.Inventory;
|
|
||||||
import com.ecep.contract.model.InventoryCatalog;
|
|
||||||
import com.ecep.contract.service.InventoryService;
|
import com.ecep.contract.service.InventoryService;
|
||||||
import com.ecep.contract.task.InventorySyncTask;
|
import com.ecep.contract.task.InventorySyncTask;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
import com.ecep.contract.vo.InventoryCatalogVo;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -27,7 +27,7 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath(value = "/ui/inventory/inventory-manager.fxml")
|
@FxmlPath(value = "/ui/inventory/inventory-manager.fxml")
|
||||||
public class InventoryManagerWindowController
|
public class InventoryManagerWindowController
|
||||||
extends AbstManagerWindowController<Inventory, InventoryViewModel, InventoryManagerSkin> {
|
extends AbstManagerWindowController<InventoryVo, InventoryViewModel, InventoryManagerSkin> {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<InventoryViewModel, Number> idColumn;
|
public TableColumn<InventoryViewModel, Number> idColumn;
|
||||||
@@ -35,8 +35,11 @@ public class InventoryManagerWindowController
|
|||||||
public TableColumn<InventoryViewModel, String> nameColumn;
|
public TableColumn<InventoryViewModel, String> nameColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<InventoryViewModel, String> codeColumn;
|
public TableColumn<InventoryViewModel, String> codeColumn;
|
||||||
|
/**
|
||||||
|
* InventoryCatalogVo
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<InventoryViewModel, InventoryCatalog> catalogColumn;
|
public TableColumn<InventoryViewModel, Integer> catalogColumn;
|
||||||
@FXML
|
@FXML
|
||||||
public TableColumn<InventoryViewModel, String> specificationColumn;
|
public TableColumn<InventoryViewModel, String> specificationColumn;
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import com.ecep.contract.controller.tab.TabSkin;
|
|||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Inventory;
|
|
||||||
import com.ecep.contract.model.InventoryCatalog;
|
|
||||||
import com.ecep.contract.service.InventoryCatalogService;
|
import com.ecep.contract.service.InventoryCatalogService;
|
||||||
import com.ecep.contract.service.InventoryService;
|
import com.ecep.contract.service.InventoryService;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
import com.ecep.contract.vo.InventoryCatalogVo;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.SimpleDoubleProperty;
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
@@ -31,8 +31,8 @@ import javafx.util.converter.LocalDateTimeStringConverter;
|
|||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
|
|
||||||
public class InventoryTabSkinBase
|
public class InventoryTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<InventoryWindowController, Inventory, InventoryViewModel>
|
extends AbstEntityBasedTabSkin<InventoryWindowController, InventoryVo, InventoryViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<Inventory, InventoryViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<InventoryVo, InventoryViewModel> {
|
||||||
|
|
||||||
public InventoryTabSkinBase(InventoryWindowController controller) {
|
public InventoryTabSkinBase(InventoryWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -67,12 +67,7 @@ public class InventoryTabSkinBase
|
|||||||
controller.specificationField.textProperty().bindBidirectional(viewModel.getSpecification());
|
controller.specificationField.textProperty().bindBidirectional(viewModel.getSpecification());
|
||||||
controller.specificationLockField.selectedProperty().bindBidirectional(viewModel.getSpecificationLock());
|
controller.specificationLockField.selectedProperty().bindBidirectional(viewModel.getSpecificationLock());
|
||||||
|
|
||||||
EntityStringConverter<InventoryCatalog> catalogConverter = new EntityStringConverter<>();
|
UITools.autoCompletion(controller.catalogField, viewModel.getCatalog(), getCatalogService());
|
||||||
catalogConverter.setInitialized(v -> getCatalogService().findById(v.getId()));
|
|
||||||
catalogConverter.setFormater(InventoryCatalog::getName);
|
|
||||||
catalogConverter.setSuggestion(getCatalogService()::search);
|
|
||||||
catalogConverter.setFromString(getCatalogService()::findByName);
|
|
||||||
UITools.autoCompletion(controller.catalogField, viewModel.getCatalog(), catalogConverter);
|
|
||||||
|
|
||||||
controller.purchaseTaxRateField.textProperty().bindBidirectional(viewModel.getPurchaseTaxRate(),
|
controller.purchaseTaxRateField.textProperty().bindBidirectional(viewModel.getPurchaseTaxRate(),
|
||||||
new NumberStringConverter());
|
new NumberStringConverter());
|
||||||
@@ -112,13 +107,12 @@ public class InventoryTabSkinBase
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
EmployeeStringConverter employeeStringConverter = getBean(EmployeeStringConverter.class);
|
UITools.autoCompletion(controller.creatorField, viewModel.getCreator(), controller.getEmployeeService());
|
||||||
UITools.autoCompletion(controller.creatorField, viewModel.getCreator(), employeeStringConverter);
|
|
||||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATE_FORMAT_PATTERN);
|
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATE_FORMAT_PATTERN);
|
||||||
controller.createTimeField.textProperty().bindBidirectional(viewModel.getCreateTime(),
|
controller.createTimeField.textProperty().bindBidirectional(viewModel.getCreateTime(),
|
||||||
new LocalDateStringConverter(dateFormatter, null));
|
new LocalDateStringConverter(dateFormatter, null));
|
||||||
|
|
||||||
UITools.autoCompletion(controller.updaterField, viewModel.getUpdater(), employeeStringConverter);
|
UITools.autoCompletion(controller.updaterField, viewModel.getUpdater(), controller.getEmployeeService());
|
||||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter
|
||||||
.ofPattern(MyDateTimeUtils.DEFAULT_DATETIME_FORMAT_PATTERN);
|
.ofPattern(MyDateTimeUtils.DEFAULT_DATETIME_FORMAT_PATTERN);
|
||||||
controller.updateDateField.textProperty().bindBidirectional(viewModel.getUpdateDate(),
|
controller.updateDateField.textProperty().bindBidirectional(viewModel.getUpdateDate(),
|
||||||
@@ -162,7 +156,7 @@ public class InventoryTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onSyncAction(ActionEvent event) {
|
private void onSyncAction(ActionEvent event) {
|
||||||
Inventory inventory = getEntity();
|
InventoryVo inventory = getEntity();
|
||||||
setStatus("开始同步数据...");
|
setStatus("开始同步数据...");
|
||||||
if (inventory == null) {
|
if (inventory == null) {
|
||||||
setStatus("请选择要同步的数据.");
|
setStatus("请选择要同步的数据.");
|
||||||
@@ -179,17 +173,17 @@ public class InventoryTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteRowData(Inventory entity) {
|
public void deleteRowData(InventoryVo entity) {
|
||||||
getService().delete(entity);
|
getService().delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory loadRowData(InventoryViewModel row) {
|
public InventoryVo loadRowData(InventoryViewModel row) {
|
||||||
return getService().findById(row.getId().get());
|
return getService().findById(row.getId().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory saveRowData(Inventory entity) {
|
public InventoryVo saveRowData(InventoryVo entity) {
|
||||||
return getService().save(entity);
|
return getService().save(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,19 @@ package com.ecep.contract.controller.inventory;
|
|||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.contract.ContractWindowController;
|
import com.ecep.contract.controller.contract.ContractWindowController;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.Inventory;
|
|
||||||
import com.ecep.contract.service.ContractItemService;
|
import com.ecep.contract.service.ContractItemService;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.service.InventoryHistoryPriceService;
|
import com.ecep.contract.service.InventoryHistoryPriceService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
@@ -26,7 +26,7 @@ import lombok.Setter;
|
|||||||
@FxmlPath("/ui/inventory/inventory-contract.fxml")
|
@FxmlPath("/ui/inventory/inventory-contract.fxml")
|
||||||
public class InventoryTabSkinContracts
|
public class InventoryTabSkinContracts
|
||||||
extends
|
extends
|
||||||
AbstEntityTableTabSkin<InventoryWindowController, Inventory, InventoryViewModel, Contract, ContractViewModel>
|
AbstEntityTableTabSkin<InventoryWindowController, InventoryVo, InventoryViewModel, ContractVo, ContractViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
public TableColumn<ContractViewModel, Number> idColumn;
|
public TableColumn<ContractViewModel, Number> idColumn;
|
||||||
public TableColumn<ContractViewModel, String> nameColumn;
|
public TableColumn<ContractViewModel, String> nameColumn;
|
||||||
@@ -90,21 +90,9 @@ public class InventoryTabSkinContracts
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Inventory parent) {
|
public ParamUtils.Builder getSpecification(InventoryVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("inventory", parent);
|
params.equals("inventory", parent);
|
||||||
|
|
||||||
// return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
|
||||||
// // 创建ContractItem的子查询
|
|
||||||
// Subquery<Integer> subquery = query.subquery(Integer.class);
|
|
||||||
// Root<ContractItem> from = subquery.from(ContractItem.class);
|
|
||||||
// // 子查询选择与指定库存相关的合同ID
|
|
||||||
// subquery.select(from.get("contract").get("id"))
|
|
||||||
// .where(builder.equal(from.get("inventory"), parent));
|
|
||||||
|
|
||||||
// // 主查询筛选ID在子查询结果中的合同
|
|
||||||
// return builder.in(root.get("id")).value(subquery);
|
|
||||||
// });
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,8 @@ import java.time.Year;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.ContractPayWay;
|
import com.ecep.contract.ContractPayWay;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
@@ -23,8 +20,14 @@ import com.ecep.contract.service.ContractItemService;
|
|||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.service.InventoryHistoryPriceService;
|
import com.ecep.contract.service.InventoryHistoryPriceService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.vm.InventoryHistoryPriceViewModel;
|
import com.ecep.contract.vm.InventoryHistoryPriceViewModel;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractItemVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import com.ecep.contract.vo.InventoryHistoryPriceVo;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -35,12 +38,11 @@ import javafx.scene.control.TableColumn;
|
|||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import javafx.util.converter.CurrencyStringConverter;
|
import javafx.util.converter.CurrencyStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/inventory/inventory-history-price.fxml")
|
@FxmlPath("/ui/inventory/inventory-history-price.fxml")
|
||||||
public class InventoryTabSkinHistoryPrice
|
public class InventoryTabSkinHistoryPrice
|
||||||
extends
|
extends
|
||||||
AbstEntityTableTabSkin<InventoryWindowController, Inventory, InventoryViewModel, InventoryHistoryPrice, InventoryHistoryPriceViewModel>
|
AbstEntityTableTabSkin<InventoryWindowController, InventoryVo, InventoryViewModel, InventoryHistoryPriceVo, InventoryHistoryPriceViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
public Button refreshBtn;
|
public Button refreshBtn;
|
||||||
public TableColumn<InventoryHistoryPriceViewModel, Number> idColumn;
|
public TableColumn<InventoryHistoryPriceViewModel, Number> idColumn;
|
||||||
@@ -164,57 +166,57 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
private void onRefreshAction(ActionEvent event) {
|
private void onRefreshAction(ActionEvent event) {
|
||||||
runAsync(() -> {
|
runAsync(() -> {
|
||||||
|
|
||||||
HashMap<Integer, InventoryHistoryPrice> historyPriceMap = new HashMap<>();
|
HashMap<Integer, InventoryHistoryPriceVo> historyPriceMap = new HashMap<>();
|
||||||
|
|
||||||
for (InventoryHistoryPrice historyPrice : getHistoryPriceService().findAllByInventory(getParent())) {
|
for (InventoryHistoryPriceVo historyPrice : getHistoryPriceService().findAllByInventory(getParent())) {
|
||||||
InventoryHistoryPrice oldValue = historyPriceMap.put(historyPrice.getYear().getValue(), historyPrice);
|
InventoryHistoryPriceVo oldValue = historyPriceMap.put(historyPrice.getYear().getValue(), historyPrice);
|
||||||
if (oldValue != null) {
|
if (oldValue != null) {
|
||||||
getHistoryPriceService().delete(oldValue);
|
getHistoryPriceService().delete(oldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ContractItem> items = getContractItemService().findAllByInventory(getParent());
|
List<ContractItemVo> items = getContractItemService().findAllByInventory(getParent());
|
||||||
items.stream().collect(Collectors.groupingBy(v -> {
|
items.stream().collect(Collectors.groupingBy(v -> {
|
||||||
Contract contract = v.getContract();
|
Integer contractId = v.getContractId();
|
||||||
if (!ProxyUtils.isInitialized(contract)) {
|
ContractVo contract = getContractService().findById(contractId);
|
||||||
contract = getContractService().findById(contract.getId());
|
|
||||||
v.setContract(contract);
|
|
||||||
}
|
|
||||||
return contract.getSetupDate().getYear();
|
return contract.getSetupDate().getYear();
|
||||||
})).forEach((year, list) -> {
|
})).forEach((year, list) -> {
|
||||||
InventoryHistoryPrice historyPrice = historyPriceMap.computeIfAbsent(year, k -> {
|
InventoryHistoryPriceVo historyPrice = historyPriceMap.computeIfAbsent(year, k -> {
|
||||||
InventoryHistoryPrice price = new InventoryHistoryPrice();
|
InventoryHistoryPriceVo price = new InventoryHistoryPriceVo();
|
||||||
price.setInventory(getParent());
|
price.setInventoryId(getParent().getId());
|
||||||
price.setYear(year);
|
price.setYear(Year.of(year));
|
||||||
return price;
|
return price;
|
||||||
});
|
});
|
||||||
|
|
||||||
list.stream().collect(Collectors.groupingBy(v -> {
|
list.stream().collect(Collectors.groupingBy(v -> {
|
||||||
Contract contract = v.getContract();
|
Integer contractId = v.getContractId();
|
||||||
|
ContractVo contract = getContractService().findById(contractId);
|
||||||
return contract.getPayWay();
|
return contract.getPayWay();
|
||||||
})).forEach((payWay, contractItems) -> {
|
})).forEach((payWay, contractItems) -> {
|
||||||
if (ContractPayWay.RECEIVE.equals(payWay)) {
|
if (ContractPayWay.RECEIVE.equals(payWay)) {
|
||||||
// 销售
|
// 销售
|
||||||
list.stream().max(Comparator.comparing(v -> {
|
list.stream().max(Comparator.comparing(v -> {
|
||||||
Contract contract = v.getContract();
|
Integer contractId = v.getContractId();
|
||||||
|
ContractVo contract = getContractService().findById(contractId);
|
||||||
return contract.getSetupDate();
|
return contract.getSetupDate();
|
||||||
})).ifPresent(v -> update(historyPrice.getLatestSalePrice(), v));
|
})).ifPresent(v -> update(historyPrice.getLatestSalePrice(), v));
|
||||||
|
|
||||||
list.stream().max(Comparator.comparing(ContractItem::getTaxPrice))
|
list.stream().max(Comparator.comparing(ContractItemVo::getTaxPrice))
|
||||||
.ifPresent(v -> update(historyPrice.getMaxSalePrice(), v));
|
.ifPresent(v -> update(historyPrice.getMaxSalePrice(), v));
|
||||||
list.stream().min(Comparator.comparing(ContractItem::getTaxPrice))
|
list.stream().min(Comparator.comparing(ContractItemVo::getTaxPrice))
|
||||||
.ifPresent(v -> update(historyPrice.getMiniSalePrice(), v));
|
.ifPresent(v -> update(historyPrice.getMiniSalePrice(), v));
|
||||||
|
|
||||||
} else if (ContractPayWay.PAY.equals(payWay)) {
|
} else if (ContractPayWay.PAY.equals(payWay)) {
|
||||||
// 采购
|
// 采购
|
||||||
list.stream().max(Comparator.comparing(v -> {
|
list.stream().max(Comparator.comparing(v -> {
|
||||||
Contract contract = v.getContract();
|
Integer contractId = v.getContractId();
|
||||||
|
ContractVo contract = getContractService().findById(contractId);
|
||||||
return contract.getSetupDate();
|
return contract.getSetupDate();
|
||||||
})).ifPresent(v -> update(historyPrice.getLatestPurchasePrice(), v));
|
})).ifPresent(v -> update(historyPrice.getLatestPurchasePrice(), v));
|
||||||
|
|
||||||
list.stream().max(Comparator.comparing(ContractItem::getTaxPrice))
|
list.stream().max(Comparator.comparing(ContractItemVo::getTaxPrice))
|
||||||
.ifPresent(v -> update(historyPrice.getMaxPurchasePrice(), v));
|
.ifPresent(v -> update(historyPrice.getMaxPurchasePrice(), v));
|
||||||
list.stream().min(Comparator.comparing(ContractItem::getTaxPrice))
|
list.stream().min(Comparator.comparing(ContractItemVo::getTaxPrice))
|
||||||
.ifPresent(v -> update(historyPrice.getMiniPurchasePrice(), v));
|
.ifPresent(v -> update(historyPrice.getMiniPurchasePrice(), v));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(HistoryPrice historyPrice, ContractItem item) {
|
void update(HistoryPrice historyPrice, ContractItemVo item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
historyPrice.setTaxRate(0);
|
historyPrice.setTaxRate(0);
|
||||||
historyPrice.setPreTaxPrice(0);
|
historyPrice.setPreTaxPrice(0);
|
||||||
@@ -236,21 +238,18 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getContractService();
|
getContractService();
|
||||||
Contract contract = item.getContract();
|
Integer contractId = item.getContractId();
|
||||||
if (!ProxyUtils.isInitialized(contract)) {
|
ContractVo contract = getContractService().findById(contractId);
|
||||||
contract = getContractService().findById(contract.getId());
|
historyPrice.setTaxRate(item.getTaxRate().floatValue());
|
||||||
item.setContract(contract);
|
|
||||||
}
|
|
||||||
historyPrice.setTaxRate((float) item.getTaxRate());
|
|
||||||
historyPrice.setPreTaxPrice(item.getExclusiveTaxPrice());
|
historyPrice.setPreTaxPrice(item.getExclusiveTaxPrice());
|
||||||
historyPrice.setPostTaxPrice(item.getTaxPrice());
|
historyPrice.setPostTaxPrice(item.getTaxPrice());
|
||||||
historyPrice.setMonthDay(MonthDay.from(contract.getSetupDate()));
|
historyPrice.setMonthDay(MonthDay.from(contract.getSetupDate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Inventory parent) {
|
public ParamUtils.Builder getSpecification(InventoryVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("inventory", parent.getId());
|
params.equals("inventory", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package com.ecep.contract.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.Inventory;
|
|
||||||
import com.ecep.contract.service.InventoryService;
|
import com.ecep.contract.service.InventoryService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -26,7 +25,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/inventory/inventory.fxml")
|
@FxmlPath("/ui/inventory/inventory.fxml")
|
||||||
public class InventoryWindowController extends AbstEntityController<Inventory, InventoryViewModel> {
|
public class InventoryWindowController extends AbstEntityController<InventoryVo, InventoryViewModel> {
|
||||||
@FXML
|
@FXML
|
||||||
public BorderPane root;
|
public BorderPane root;
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package com.ecep.contract.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.service.EmployeeRoleService;
|
import com.ecep.contract.service.EmployeeRoleService;
|
||||||
import com.ecep.contract.service.FunctionService;
|
import com.ecep.contract.service.FunctionService;
|
||||||
import com.ecep.contract.service.PermissionService;
|
import com.ecep.contract.service.PermissionService;
|
||||||
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeRoleVo;
|
||||||
|
|
||||||
public abstract class AbstEmployeeRoleBasedTabSkin
|
public abstract class AbstEmployeeRoleBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRole, EmployeeRoleViewModel> {
|
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRoleVo, EmployeeRoleViewModel> {
|
||||||
|
|
||||||
public AbstEmployeeRoleBasedTabSkin(EmployeeRoleWindowController controller) {
|
public AbstEmployeeRoleBasedTabSkin(EmployeeRoleWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import java.util.List;
|
|||||||
import org.controlsfx.control.ListSelectionView;
|
import org.controlsfx.control.ListSelectionView;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import com.ecep.contract.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.model.Function;
|
|
||||||
import com.ecep.contract.util.ParamUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vo.EmployeeRoleVo;
|
||||||
|
import com.ecep.contract.vo.FunctionVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
@@ -20,7 +20,7 @@ import javafx.scene.control.Tab;
|
|||||||
public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
||||||
|
|
||||||
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||||
private ListSelectionView<Function> functionsField;
|
private ListSelectionView<FunctionVo> functionsField;
|
||||||
|
|
||||||
public EmployeeRoleTabSkinFunctions(EmployeeRoleWindowController controller) {
|
public EmployeeRoleTabSkinFunctions(EmployeeRoleWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
@@ -50,7 +50,7 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadSelectedRoles() {
|
private void loadSelectedRoles() {
|
||||||
List<Function> selectedRoles = getRoleService().getFunctionsByRoleId(viewModel.getId().get());
|
List<FunctionVo> selectedRoles = getRoleService().getFunctionsByRoleId(viewModel.getId().get());
|
||||||
if (selectedRoles != null) {
|
if (selectedRoles != null) {
|
||||||
functionsField.getTargetItems().setAll(selectedRoles);
|
functionsField.getTargetItems().setAll(selectedRoles);
|
||||||
}
|
}
|
||||||
@@ -59,14 +59,14 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
|||||||
|
|
||||||
private void initializeListView() {
|
private void initializeListView() {
|
||||||
// 非系统内置账户
|
// 非系统内置账户
|
||||||
List<Function> roles = getFunctionService()
|
List<FunctionVo> roles = getFunctionService()
|
||||||
.findAll(ParamUtils.builder().equals("active", true).build(), Pageable.ofSize(500)).getContent();
|
.findAll(ParamUtils.builder().equals("active", true).build(), Pageable.ofSize(500)).getContent();
|
||||||
|
|
||||||
functionsField.getSourceItems().setAll(roles);
|
functionsField.getSourceItems().setAll(roles);
|
||||||
functionsField.setCellFactory(param -> {
|
functionsField.setCellFactory(param -> {
|
||||||
return new ListCell<>() {
|
return new ListCell<FunctionVo>() {
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(Function item, boolean empty) {
|
protected void updateItem(FunctionVo item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item == null || empty) {
|
if (item == null || empty) {
|
||||||
setText(null);
|
setText(null);
|
||||||
@@ -77,10 +77,10 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
functionsField.getTargetItems().addListener((ListChangeListener<Function>) change -> {
|
functionsField.getTargetItems().addListener((ListChangeListener<FunctionVo>) change -> {
|
||||||
while (change.next()) {
|
while (change.next()) {
|
||||||
List<? extends Function> added = change.getAddedSubList();
|
List<? extends FunctionVo> added = change.getAddedSubList();
|
||||||
List<? extends Function> removed = change.getRemoved();
|
List<? extends FunctionVo> removed = change.getRemoved();
|
||||||
if (!added.isEmpty() || !removed.isEmpty()) {
|
if (!added.isEmpty() || !removed.isEmpty()) {
|
||||||
changed.set(true);
|
changed.set(true);
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveRoles(ActionEvent event) {
|
private void saveRoles(ActionEvent event) {
|
||||||
EmployeeRole entity = getEntity();
|
EmployeeRoleVo entity = getEntity();
|
||||||
entity.setFunctions(functionsField.getTargetItems());
|
entity.setFunctions(functionsField.getTargetItems());
|
||||||
save(entity);
|
save(entity);
|
||||||
loadSelectedRoles();
|
loadSelectedRoles();
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.service.EmployeeRoleService;
|
import com.ecep.contract.service.EmployeeRoleService;
|
||||||
import com.ecep.contract.service.PermissionService;
|
import com.ecep.contract.service.PermissionService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeRoleVo;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
@@ -31,7 +31,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/employee/role.fxml")
|
@FxmlPath("/ui/employee/role.fxml")
|
||||||
public class EmployeeRoleWindowController extends AbstEntityController<EmployeeRole, EmployeeRoleViewModel> {
|
public class EmployeeRoleWindowController extends AbstEntityController<EmployeeRoleVo, EmployeeRoleViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeRoleWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(EmployeeRoleWindowController.class);
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class EmployeeRoleWindowController extends AbstEntityController<EmployeeR
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
public Tab functionsTab;
|
public Tab functionsTab;
|
||||||
public ListSelectionView<com.ecep.contract.model.Function> functionsField;
|
public ListSelectionView<com.ecep.contract.vo.FunctionVo> functionsField;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ecep.contract.controller.permission;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
@@ -61,9 +62,9 @@ public class FunctionTabSkinPermission
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Function parent) {
|
public ParamUtils.Builder getSpecification(Function parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("function", parent.getId());
|
params.equals("function", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -164,8 +165,8 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification() {
|
public ParamUtils.Builder getSpecification() {
|
||||||
Map<String, Object> params = new HashMap<>();
|
ParamUtils.Builder params = ParamUtils.builder();
|
||||||
// 使用permissionService的specification逻辑
|
// 使用permissionService的specification逻辑
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import com.ecep.contract.controller.tab.TabSkin;
|
|||||||
import com.ecep.contract.model.Project;
|
import com.ecep.contract.model.Project;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.vm.ProjectViewModel;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
public abstract class AbstProjectBasedTabSkin
|
public abstract class AbstProjectBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<ProjectWindowController, Project, ProjectViewModel>
|
extends AbstEntityBasedTabSkin<ProjectWindowController, ProjectVo, ProjectViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstProjectBasedTabSkin(ProjectWindowController controller) {
|
public AbstProjectBasedTabSkin(ProjectWindowController controller) {
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ import java.util.Map;
|
|||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
import com.ecep.contract.vm.ProjectBasedViewModel;
|
import com.ecep.contract.vm.ProjectBasedViewModel;
|
||||||
import com.ecep.contract.vm.ProjectViewModel;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
public abstract class AbstProjectTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstProjectTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends AbstEntityTableTabSkin<ProjectWindowController, Project, ProjectViewModel, T, TV>
|
extends AbstEntityTableTabSkin<ProjectWindowController, ProjectVo, ProjectViewModel, T, TV>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstProjectTableTabSkin(ProjectWindowController controller) {
|
public AbstProjectTableTabSkin(ProjectWindowController controller) {
|
||||||
@@ -27,15 +28,15 @@ public abstract class AbstProjectTableTabSkin<T extends IdentityEntity, TV exten
|
|||||||
protected TV createNewViewModel() {
|
protected TV createNewViewModel() {
|
||||||
TV model = super.createNewViewModel();
|
TV model = super.createNewViewModel();
|
||||||
if (model instanceof ProjectBasedViewModel m) {
|
if (model instanceof ProjectBasedViewModel m) {
|
||||||
m.getProject().set(getEntity());
|
m.getProject().set(getEntity().getId());
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Project parent) {
|
public ParamUtils.Builder getSpecification(ProjectVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("project", parent.getId());
|
params.equals("project", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,15 @@ import org.springframework.stereotype.Component;
|
|||||||
import com.ecep.contract.Desktop;
|
import com.ecep.contract.Desktop;
|
||||||
import com.ecep.contract.controller.BaseController;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
import com.ecep.contract.service.EmployeeService;
|
import com.ecep.contract.service.EmployeeService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.ProjectViewModel;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
@@ -49,8 +50,7 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmployeeService employeeService;
|
private EmployeeService employeeService;
|
||||||
|
|
||||||
|
public ComboBox<ProjectSaleTypeVo> saleTypeComboBox;
|
||||||
public ComboBox<ProjectSaleType> saleTypeComboBox;
|
|
||||||
public TextField codeYearField;
|
public TextField codeYearField;
|
||||||
public Label codeYearLabel;
|
public Label codeYearLabel;
|
||||||
|
|
||||||
@@ -65,11 +65,10 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
public Button cancelBtn;
|
public Button cancelBtn;
|
||||||
public Button applyBtn;
|
public Button applyBtn;
|
||||||
|
|
||||||
|
|
||||||
private ProjectViewModel viewModel = new ProjectViewModel();
|
private ProjectViewModel viewModel = new ProjectViewModel();
|
||||||
private ObjectProperty<Consumer<Project>> onApplied = new SimpleObjectProperty<>();
|
private ObjectProperty<Consumer<ProjectVo>> onApplied = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
public void setOnApplied(Consumer<Project> onApplied) {
|
public void setOnApplied(Consumer<ProjectVo> onApplied) {
|
||||||
this.onApplied.set(onApplied);
|
this.onApplied.set(onApplied);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,11 +86,11 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
|
|
||||||
initializeSaleTypeField(saleTypeComboBox);
|
initializeSaleTypeField(saleTypeComboBox);
|
||||||
|
|
||||||
|
|
||||||
NumberStringConverter stringConverter = new NumberStringConverter();
|
NumberStringConverter stringConverter = new NumberStringConverter();
|
||||||
Bindings.bindBidirectional(codeYearField.textProperty(), viewModel.getCodeYear(), stringConverter);
|
Bindings.bindBidirectional(codeYearField.textProperty(), viewModel.getCodeYear(), stringConverter);
|
||||||
|
|
||||||
Bindings.bindBidirectional(codeSequenceNumberField.textProperty(), viewModel.getCodeSequenceNumber(), stringConverter);
|
Bindings.bindBidirectional(codeSequenceNumberField.textProperty(), viewModel.getCodeSequenceNumber(),
|
||||||
|
stringConverter);
|
||||||
initializeApplicantLabel(applicantLabel);
|
initializeApplicantLabel(applicantLabel);
|
||||||
initializeCodePreviewLabel(codePreviewLabel);
|
initializeCodePreviewLabel(codePreviewLabel);
|
||||||
|
|
||||||
@@ -99,10 +98,9 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
cancelBtn.getScene().getWindow().hide();
|
cancelBtn.getScene().getWindow().hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
applyBtn.disableProperty().bind(viewModel.getSaleType().isNull());
|
applyBtn.disableProperty().bind(viewModel.getSaleType().isNull());
|
||||||
applyBtn.setOnAction(event -> {
|
applyBtn.setOnAction(event -> {
|
||||||
Project newProject = new Project();
|
ProjectVo newProject = new ProjectVo();
|
||||||
newProject.setCodeYear(viewModel.getCodeYear().get());
|
newProject.setCodeYear(viewModel.getCodeYear().get());
|
||||||
int codeSequenceNumber = viewModel.getCodeSequenceNumber().get();
|
int codeSequenceNumber = viewModel.getCodeSequenceNumber().get();
|
||||||
if (codeSequenceNumber == 0) {
|
if (codeSequenceNumber == 0) {
|
||||||
@@ -114,11 +112,11 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
codeSequenceNumberLabel.setStyle("");
|
codeSequenceNumberLabel.setStyle("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
newProject.setCodeSequenceNumber(codeSequenceNumber);
|
newProject.setCodeSequenceNumber(codeSequenceNumber);
|
||||||
newProject.setSaleType(viewModel.getSaleType().get());
|
newProject.setSaleTypeId(viewModel.getSaleType().get());
|
||||||
|
|
||||||
Project exist = projectService.findBySaleTypeAndCodeYearAndCodeSequenceNumber(newProject.getSaleType(), newProject.getCodeYear(), newProject.getCodeSequenceNumber());
|
ProjectVo exist = projectService.findBySaleTypeAndCodeYearAndCodeSequenceNumber(newProject.getSaleTypeId(),
|
||||||
|
newProject.getCodeYear(), newProject.getCodeSequenceNumber());
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
codeLabel.setText("项目编号已存在");
|
codeLabel.setText("项目编号已存在");
|
||||||
codeLabel.setStyle("-fx-text-fill: #ffa2a2");
|
codeLabel.setStyle("-fx-text-fill: #ffa2a2");
|
||||||
@@ -131,10 +129,10 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
// 暂时的项目编号
|
// 暂时的项目编号
|
||||||
newProject.setCode(codePreviewLabel.getText());
|
newProject.setCode(codePreviewLabel.getText());
|
||||||
|
|
||||||
newProject.setApplicant(viewModel.getApplicant().get());
|
newProject.setApplicantId(viewModel.getApplicant().get());
|
||||||
newProject.setCreated(LocalDate.now());
|
newProject.setCreated(LocalDate.now());
|
||||||
Project saved = projectService.save(newProject);
|
ProjectVo saved = projectService.save(newProject);
|
||||||
Consumer<Project> consumer = onApplied.get();
|
Consumer<ProjectVo> consumer = onApplied.get();
|
||||||
if (consumer != null) {
|
if (consumer != null) {
|
||||||
consumer.accept(saved);
|
consumer.accept(saved);
|
||||||
}
|
}
|
||||||
@@ -144,11 +142,9 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeApplicantLabel(Label applicantLabel) {
|
private void initializeApplicantLabel(Label applicantLabel) {
|
||||||
Employee operator = employeeService.findById(Desktop.instance.getActiveEmployeeId());
|
viewModel.getApplicant().set(Desktop.instance.getActiveEmployeeId());
|
||||||
viewModel.getApplicant().set(operator);
|
|
||||||
|
|
||||||
applicantLabel.textProperty().bind(Bindings.createObjectBinding(() -> {
|
applicantLabel.textProperty().bind(Bindings.createObjectBinding(() -> {
|
||||||
Employee employee = viewModel.getApplicant().get();
|
EmployeeVo employee = employeeService.findById(viewModel.getApplicant().get());
|
||||||
if (employee == null) {
|
if (employee == null) {
|
||||||
return "- 异常,未取得当前操作员信息 -";
|
return "- 异常,未取得当前操作员信息 -";
|
||||||
}
|
}
|
||||||
@@ -160,13 +156,13 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
private void initializeCodePreviewLabel(Label codePreviewLabel) {
|
private void initializeCodePreviewLabel(Label codePreviewLabel) {
|
||||||
codePreviewLabel.textProperty().bind(Bindings.createObjectBinding(() -> {
|
codePreviewLabel.textProperty().bind(Bindings.createObjectBinding(() -> {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
ProjectSaleType saleType = viewModel.getSaleType().get();
|
ProjectSaleTypeVo saleType = getCachedBean(ProjectSaleTypeService.class)
|
||||||
|
.findById(viewModel.getSaleType().get());
|
||||||
if (saleType == null) {
|
if (saleType == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
sb.append(saleType.getCode());
|
sb.append(saleType.getCode());
|
||||||
|
|
||||||
|
|
||||||
int year = viewModel.getCodeYear().get();
|
int year = viewModel.getCodeYear().get();
|
||||||
if (year < 10) {
|
if (year < 10) {
|
||||||
sb.append("0");
|
sb.append("0");
|
||||||
@@ -184,27 +180,33 @@ public class ApplyNewProjectWindowController extends BaseController {
|
|||||||
}, viewModel.getSaleType(), viewModel.getCodeYear(), viewModel.getCodeSequenceNumber()));
|
}, viewModel.getSaleType(), viewModel.getCodeYear(), viewModel.getCodeSequenceNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSaleTypeField(ComboBox<ProjectSaleType> field) {
|
private void initializeSaleTypeField(ComboBox<ProjectSaleTypeVo> field) {
|
||||||
ObservableList<ProjectSaleType> list = FXCollections.observableArrayList();
|
ObservableList<ProjectSaleTypeVo> list = FXCollections.observableArrayList();
|
||||||
saleTypeService.findAll().stream().filter(ProjectSaleType::isActive).forEach(list::add);
|
saleTypeService.findAll().stream().filter(ProjectSaleTypeVo::isActive).forEach(list::add);
|
||||||
field.setItems(list);
|
field.setItems(list);
|
||||||
field.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
field.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
viewModel.getSaleType().set(newValue);
|
viewModel.getSaleType().set(newValue.getId());
|
||||||
// 当 SequenceNumber 为 0 时, 自动检索最新的 SequenceNumber
|
// 当 SequenceNumber 为 0 时, 自动检索最新的 SequenceNumber
|
||||||
if (viewModel.getCodeYear().get() != 0) {
|
if (viewModel.getCodeYear().get() != 0) {
|
||||||
int nextCodeSequenceNumber = projectService.getNextCodeSequenceNumber(newValue, viewModel.getCodeYear().get());
|
int nextCodeSequenceNumber = projectService.getNextCodeSequenceNumber(newValue,
|
||||||
|
viewModel.getCodeYear().get());
|
||||||
viewModel.getCodeSequenceNumber().set(nextCodeSequenceNumber);
|
viewModel.getCodeSequenceNumber().set(nextCodeSequenceNumber);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EntityStringConverter<ProjectSaleType> converter = new EntityStringConverter<>();
|
|
||||||
|
EntityStringConverter<ProjectSaleTypeVo> converter = new EntityStringConverter<>();
|
||||||
converter.setInitialized(saleType -> {
|
converter.setInitialized(saleType -> {
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getId(), saleType.getId())).findFirst().orElse(null);
|
return list.stream().filter(v -> v != null && Objects.equals(v.getId(), saleType.getId())).findFirst()
|
||||||
|
.orElse(null);
|
||||||
});
|
});
|
||||||
converter.setFromString(name -> {
|
converter.setFromString(name -> {
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getName(), name)).findFirst().orElse(null);
|
return list.stream().filter(v -> v != null && Objects.equals(v.getName(), name)).findFirst().orElse(null);
|
||||||
});
|
});
|
||||||
field.setConverter(converter);
|
field.setConverter(converter);
|
||||||
field.valueProperty().bindBidirectional(viewModel.getSaleType());
|
viewModel.getSaleType().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (newValue != null) {
|
||||||
|
field.getSelectionModel().select(newValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,21 @@
|
|||||||
package com.ecep.contract.controller.project;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.BaseController;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import com.ecep.contract.controller.ComboBoxUtils;
|
import com.ecep.contract.controller.ComboBoxUtils;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.controller.table.cell.ProductTypeTableCell;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.controller.table.cell.ProjectSaleTypeTableCell;
|
||||||
import com.ecep.contract.model.ProductType;
|
import com.ecep.contract.controller.table.cell.ProjectTypeTableCell;
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.model.ProjectType;
|
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.ProductTypeService;
|
import com.ecep.contract.service.ProductTypeService;
|
||||||
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.service.ProjectTypeService;
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.ProjectViewModel;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -29,7 +26,7 @@ import javafx.util.converter.CurrencyStringConverter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class ProjectManagerSkin
|
public class ProjectManagerSkin
|
||||||
extends AbstEntityManagerSkin<Project, ProjectViewModel, ProjectManagerSkin, ProjectManagerWindowController>
|
extends AbstEntityManagerSkin<ProjectVo, ProjectViewModel, ProjectManagerSkin, ProjectManagerWindowController>
|
||||||
implements ManagerSkin {
|
implements ManagerSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
@@ -77,10 +74,10 @@ public class ProjectManagerSkin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification() {
|
public ParamUtils.Builder getSpecification() {
|
||||||
Map<String, Object> params = super.getSpecification();
|
ParamUtils.Builder params = super.getSpecification();
|
||||||
if (controller.saleTypeSelector.getValue() != null) {
|
if (controller.saleTypeSelector.getValue() != null) {
|
||||||
params.put("saleType", controller.saleTypeSelector.getValue());
|
params.equals("saleType", controller.saleTypeSelector.getValue());
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
@@ -118,30 +115,24 @@ public class ProjectManagerSkin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeCustomerColumn(TableColumn<ProjectViewModel, Company> column) {
|
private void initializeCustomerColumn(TableColumn<ProjectViewModel, Integer> column) {
|
||||||
column.setCellValueFactory(param -> param.getValue().getCustomer());
|
column.setCellValueFactory(param -> param.getValue().getCustomer());
|
||||||
column.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
column.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeProductTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
private void initializeProductTypeColumn(TableColumn<ProjectViewModel, Integer> column) {
|
||||||
EntityStringConverter<ProductType> converter = new EntityStringConverter<>();
|
column.setCellValueFactory(param -> param.getValue().getProductType());
|
||||||
converter.setInitialized(productType -> getProductTypeService().findById(productType.getId()));
|
column.setCellFactory(param -> new ProductTypeTableCell<>(getProductTypeService()));
|
||||||
converter.setFromString(name -> getProductTypeService().findByName(name));
|
|
||||||
column.setCellValueFactory(param -> param.getValue().getProductType().map(converter::toString));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeProjectTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
private void initializeProjectTypeColumn(TableColumn<ProjectViewModel, Integer> column) {
|
||||||
EntityStringConverter<ProjectType> converter = new EntityStringConverter<>();
|
column.setCellValueFactory(param -> param.getValue().getProjectType());
|
||||||
converter.setInitialized(projectType -> getProjectTypeService().findById(projectType.getId()));
|
column.setCellFactory(param -> new ProjectTypeTableCell<>(getProjectTypeService()));
|
||||||
converter.setFromString(name -> getProjectTypeService().findByName(name));
|
|
||||||
column.setCellValueFactory(param -> param.getValue().getProjectType().map(converter::toString));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSaleTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
private void initializeSaleTypeColumn(TableColumn<ProjectViewModel, Integer> column) {
|
||||||
EntityStringConverter<ProjectSaleType> converter = new EntityStringConverter<>();
|
column.setCellValueFactory(param -> param.getValue().getSaleType());
|
||||||
converter.setInitialized(saleType -> getSaleTypeService().findById(saleType.getId()));
|
column.setCellFactory(param -> new ProjectSaleTypeTableCell<>(getSaleTypeService()));
|
||||||
converter.setFromString(name -> getSaleTypeService().findByName(name));
|
|
||||||
column.setCellValueFactory(param -> param.getValue().getSaleType().map(converter::toString));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,12 +16,11 @@ import com.ecep.contract.controller.project.product_type.ProductTypeManagerWindo
|
|||||||
import com.ecep.contract.controller.project.project_type.ProjectTypeManagerWindowController;
|
import com.ecep.contract.controller.project.project_type.ProjectTypeManagerWindowController;
|
||||||
import com.ecep.contract.controller.project.sale_type.ProjectSaleTypeManagerWindowController;
|
import com.ecep.contract.controller.project.sale_type.ProjectSaleTypeManagerWindowController;
|
||||||
import com.ecep.contract.controller.project.usage.ProductUsageManagerWindowController;
|
import com.ecep.contract.controller.project.usage.ProductUsageManagerWindowController;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.ProjectViewModel;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
@@ -33,19 +32,19 @@ import javafx.stage.WindowEvent;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/project-manager.fxml")
|
@FxmlPath("/ui/project/project-manager.fxml")
|
||||||
public class ProjectManagerWindowController
|
public class ProjectManagerWindowController
|
||||||
extends AbstManagerWindowController<Project, ProjectViewModel, ProjectManagerSkin> {
|
extends AbstManagerWindowController<ProjectVo, ProjectViewModel, ProjectManagerSkin> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectManagerWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectManagerWindowController.class);
|
||||||
|
|
||||||
public ComboBox<ProjectSaleType> saleTypeSelector;
|
public ComboBox<ProjectSaleTypeVo> saleTypeSelector;
|
||||||
|
|
||||||
public TableColumn<ProjectViewModel, Number> idColumn;
|
public TableColumn<ProjectViewModel, Number> idColumn;
|
||||||
public TableColumn<ProjectViewModel, String> codeColumn;
|
public TableColumn<ProjectViewModel, String> codeColumn;
|
||||||
public TableColumn<ProjectViewModel, String> nameColumn;
|
public TableColumn<ProjectViewModel, String> nameColumn;
|
||||||
public TableColumn<ProjectViewModel, String> saleTypeColumn;
|
public TableColumn<ProjectViewModel, Integer> saleTypeColumn;
|
||||||
public TableColumn<ProjectViewModel, String> projectTypeColumn;
|
public TableColumn<ProjectViewModel, Integer> projectTypeColumn;
|
||||||
public TableColumn<ProjectViewModel, String> productTypeColumn;
|
public TableColumn<ProjectViewModel, Integer> productTypeColumn;
|
||||||
public TableColumn<ProjectViewModel, LocalDate> createdColumn;
|
public TableColumn<ProjectViewModel, LocalDate> createdColumn;
|
||||||
public TableColumn<ProjectViewModel, Company> customerColumn;
|
public TableColumn<ProjectViewModel, Integer> customerColumn;
|
||||||
public TableColumn<ProjectViewModel, Boolean> useBidColumn;
|
public TableColumn<ProjectViewModel, Boolean> useBidColumn;
|
||||||
public TableColumn<ProjectViewModel, Boolean> useOfferColumn;
|
public TableColumn<ProjectViewModel, Boolean> useOfferColumn;
|
||||||
public TableColumn<ProjectViewModel, Number> amountColumn;
|
public TableColumn<ProjectViewModel, Number> amountColumn;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ecep.contract.controller.project;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -9,34 +10,31 @@ import com.ecep.contract.controller.ComboBoxUtils;
|
|||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.DeliverySignMethod;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.ProductType;
|
|
||||||
import com.ecep.contract.model.ProductUsage;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectCost;
|
|
||||||
import com.ecep.contract.model.ProjectIndustry;
|
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.model.ProjectType;
|
|
||||||
import com.ecep.contract.service.DeliverySignMethodService;
|
import com.ecep.contract.service.DeliverySignMethodService;
|
||||||
import com.ecep.contract.service.EmployeeService;
|
import com.ecep.contract.service.EmployeeService;
|
||||||
import com.ecep.contract.service.ProductTypeService;
|
import com.ecep.contract.service.ProductTypeService;
|
||||||
import com.ecep.contract.service.ProductUsageService;
|
import com.ecep.contract.service.ProductUsageService;
|
||||||
import com.ecep.contract.service.ProjectCostService;
|
import com.ecep.contract.service.ProjectCostService;
|
||||||
import com.ecep.contract.service.ProjectIndustryService;
|
import com.ecep.contract.service.ProjectIndustryService;
|
||||||
import com.ecep.contract.service.ProjectTypeService;
|
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vo.DeliverySignMethodVo;
|
||||||
|
import com.ecep.contract.vo.ProductTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProductUsageVo;
|
||||||
|
import com.ecep.contract.vo.ProjectCostVo;
|
||||||
|
import com.ecep.contract.vo.ProjectIndustryVo;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.collections.transformation.FilteredList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.ListCell;
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -52,20 +50,9 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
@Setter
|
@Setter
|
||||||
EmployeeService employeeService;
|
EmployeeService employeeService;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private ProjectTypeService projectTypeService;
|
|
||||||
@Setter
|
|
||||||
private ProductTypeService productTypeService;
|
|
||||||
@Setter
|
|
||||||
private ProjectSaleTypeService saleTypeService;
|
|
||||||
@Setter
|
|
||||||
private ProductUsageService productUsageService;
|
|
||||||
@Setter
|
|
||||||
private ProjectIndustryService projectIndustryService;
|
|
||||||
@Setter
|
@Setter
|
||||||
private DeliverySignMethodService deliverySignMethodService;
|
private DeliverySignMethodService deliverySignMethodService;
|
||||||
|
|
||||||
|
|
||||||
public ProjectTabSkinBase(ProjectWindowController controller) {
|
public ProjectTabSkinBase(ProjectWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
@@ -76,59 +63,31 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
}
|
}
|
||||||
|
|
||||||
private EmployeeService getEmployeeService() {
|
private EmployeeService getEmployeeService() {
|
||||||
if (employeeService == null) {
|
return getBean(EmployeeService.class);
|
||||||
employeeService = getBean(EmployeeService.class);
|
|
||||||
}
|
|
||||||
return employeeService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectTypeService getProjectTypeService() {
|
private ProjectTypeService getProjectTypeService() {
|
||||||
if (projectTypeService == null) {
|
return getBean(ProjectTypeService.class);
|
||||||
projectTypeService = getBean(ProjectTypeService.class);
|
|
||||||
}
|
|
||||||
return projectTypeService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProductTypeService getProductTypeService() {
|
private ProductTypeService getProductTypeService() {
|
||||||
if (productTypeService == null) {
|
return getBean(ProductTypeService.class);
|
||||||
productTypeService = getBean(ProductTypeService.class);
|
|
||||||
}
|
|
||||||
return productTypeService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectSaleTypeService getSaleTypeService() {
|
private ProjectSaleTypeService getSaleTypeService() {
|
||||||
if (saleTypeService == null) {
|
return getBean(ProjectSaleTypeService.class);
|
||||||
saleTypeService = getBean(ProjectSaleTypeService.class);
|
|
||||||
}
|
|
||||||
return saleTypeService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProductUsageService getProductUsageService() {
|
private ProductUsageService getProductUsageService() {
|
||||||
if (productUsageService == null) {
|
return getBean(ProductUsageService.class);
|
||||||
productUsageService = getBean(ProductUsageService.class);
|
|
||||||
}
|
|
||||||
return productUsageService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectIndustryService getProjectIndustryService() {
|
private ProjectIndustryService getProjectIndustryService() {
|
||||||
if (projectIndustryService == null) {
|
return getBean(ProjectIndustryService.class);
|
||||||
projectIndustryService = getBean(ProjectIndustryService.class);
|
|
||||||
}
|
|
||||||
return projectIndustryService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeliverySignMethodService getDeliverySignMethodService() {
|
private DeliverySignMethodService getDeliverySignMethodService() {
|
||||||
if (deliverySignMethodService == null) {
|
return getBean(DeliverySignMethodService.class);
|
||||||
deliverySignMethodService = getBean(DeliverySignMethodService.class);
|
|
||||||
}
|
|
||||||
return deliverySignMethodService;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EmployeeStringConverter getEmployeeStringConverter() {
|
|
||||||
if (employeeStringConverter == null) {
|
|
||||||
employeeStringConverter = getBean(EmployeeStringConverter.class);
|
|
||||||
}
|
|
||||||
return employeeStringConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -138,25 +97,54 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
controller.codeField.textProperty().bind(viewModel.getCode());
|
controller.codeField.textProperty().bind(viewModel.getCode());
|
||||||
NumberStringConverter stringConverter = new NumberStringConverter();
|
NumberStringConverter stringConverter = new NumberStringConverter();
|
||||||
Bindings.bindBidirectional(controller.codeYearField.textProperty(), viewModel.getCodeYear(), stringConverter);
|
Bindings.bindBidirectional(controller.codeYearField.textProperty(), viewModel.getCodeYear(), stringConverter);
|
||||||
Bindings.bindBidirectional(controller.codeSequenceNumberField.textProperty(), viewModel.getCodeSequenceNumber(), stringConverter);
|
Bindings.bindBidirectional(controller.codeSequenceNumberField.textProperty(), viewModel.getCodeSequenceNumber(),
|
||||||
|
stringConverter);
|
||||||
|
|
||||||
controller.addressField.textProperty().bindBidirectional(viewModel.getAddress());
|
controller.addressField.textProperty().bindBidirectional(viewModel.getAddress());
|
||||||
controller.useBidField.selectedProperty().bindBidirectional(viewModel.getUseBid());
|
controller.useBidField.selectedProperty().bindBidirectional(viewModel.getUseBid());
|
||||||
controller.useOfferField.selectedProperty().bindBidirectional(viewModel.getUseOffer());
|
controller.useOfferField.selectedProperty().bindBidirectional(viewModel.getUseOffer());
|
||||||
controller.standardPayWayField.selectedProperty().bindBidirectional(viewModel.getStandardPayWay());
|
controller.standardPayWayField.selectedProperty().bindBidirectional(viewModel.getStandardPayWay());
|
||||||
Bindings.bindBidirectional(controller.amountField.textProperty(), viewModel.getAmount(), new NumberStringConverter());
|
Bindings.bindBidirectional(controller.amountField.textProperty(), viewModel.getAmount(),
|
||||||
|
new NumberStringConverter());
|
||||||
|
|
||||||
initializeSaleTypeField(controller.saleTypeField);
|
ComboBoxUtils.initialComboBox(controller.saleTypeField, viewModel.getSaleType(), getSaleTypeService(), true);
|
||||||
initializeSaleIndustryField(controller.industryField);
|
ComboBoxUtils.initialComboBox(controller.projectTypeField, viewModel.getProjectType(), getProjectTypeService(),
|
||||||
initializeProjectTypeField(controller.projectTypeField);
|
true);
|
||||||
initializeProductTypeField(controller.productTypeField);
|
ComboBoxUtils.initialComboBox(controller.saleTypeField, viewModel.getSaleType(), getSaleTypeService(), true);
|
||||||
initializeDeliverySignMethodField(controller.saleTypeField, controller.deliverySignMethodField);
|
ComboBoxUtils.initialComboBox(controller.industryField, viewModel.getIndustry(), getProjectIndustryService(),
|
||||||
initializeProductUsageField(controller.productUsageField);
|
true);
|
||||||
|
ComboBoxUtils.initialComboBox(controller.productTypeField, viewModel.getProductType(), getProductTypeService(),
|
||||||
|
true);
|
||||||
|
ComboBoxUtils.initialComboBox(controller.productUsageField, viewModel.getProductUsage(),
|
||||||
|
getProductUsageService(), true);
|
||||||
|
ComboBoxUtils.initialComboBox(controller.deliverySignMethodField, viewModel.getDeliverySignMethod(),
|
||||||
|
getDeliverySignMethodService(), true);
|
||||||
|
|
||||||
|
controller.saleTypeField.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
Predicate<DeliverySignMethodVo> predicate = p -> {
|
||||||
|
return p == null || Objects.equals(p.getSaleTypeId(), newValue.getId());
|
||||||
|
};
|
||||||
|
|
||||||
|
ObservableList<DeliverySignMethodVo> items = controller.deliverySignMethodField.getItems();
|
||||||
|
if (items instanceof FilteredList<DeliverySignMethodVo> filteredList) {
|
||||||
|
filteredList.setPredicate(predicate);
|
||||||
|
} else {
|
||||||
|
items = items.filtered(predicate);
|
||||||
|
controller.deliverySignMethodField.setItems(items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// initializeDeliverySignMethodField(controller.saleTypeField,
|
||||||
|
// controller.deliverySignMethodField); // Changed from
|
||||||
|
// initializeDeliverySignMethodField(ComboBox<ProjectSaleType>
|
||||||
|
// saleTypeField,
|
||||||
|
// ComboBox<DeliverySignMethod>
|
||||||
|
// field)
|
||||||
|
|
||||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||||
|
|
||||||
employeeAutoCompletion(controller.applicantField, viewModel.getApplicant());
|
UITools.autoCompletion(controller.applicantField, viewModel.getApplicant(), getEmployeeService());
|
||||||
employeeAutoCompletion(controller.authorizerField, viewModel.getAuthorizer());
|
UITools.autoCompletion(controller.authorizerField, viewModel.getAuthorizer(), getEmployeeService());
|
||||||
|
|
||||||
controller.createdField.setConverter(localDateStringConverter);
|
controller.createdField.setConverter(localDateStringConverter);
|
||||||
controller.createdField.valueProperty().bindBidirectional(viewModel.getCreated());
|
controller.createdField.valueProperty().bindBidirectional(viewModel.getCreated());
|
||||||
@@ -170,146 +158,14 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
|
|
||||||
private void onDeleteAction(ActionEvent event) {
|
private void onDeleteAction(ActionEvent event) {
|
||||||
ProjectCostService projectCostService = getBean(ProjectCostService.class);
|
ProjectCostService projectCostService = getBean(ProjectCostService.class);
|
||||||
Project project = getEntity();
|
ProjectVo project = getEntity();
|
||||||
for (ProjectCost cost : projectCostService.findAllByProject(project)) {
|
for (ProjectCostVo cost : projectCostService.findAllByProject(project)) {
|
||||||
projectCostService.delete(cost);
|
projectCostService.delete(cost);
|
||||||
}
|
}
|
||||||
getProjectService().delete(project);
|
getProjectService().delete(project);
|
||||||
controller.root.getScene().getWindow().hide();
|
controller.root.getScene().getWindow().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSaleIndustryField(ComboBox<ProjectIndustry> field) {
|
|
||||||
ComboBoxUtils.initialComboBox(field, viewModel.getIndustry(), getProjectIndustryService().findAll(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeProjectTypeField(ComboBox<ProjectType> field) {
|
|
||||||
ComboBoxUtils.initialComboBox(field, viewModel.getProjectType(), getProjectTypeService().findAll(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeProductTypeField(ComboBox<ProductType> field) {
|
|
||||||
ObservableList<ProductType> list = FXCollections.observableArrayList();
|
|
||||||
list.add(null);
|
|
||||||
list.addAll(getProductTypeService().findAll());
|
|
||||||
field.setItems(list);
|
|
||||||
field.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
viewModel.getProductType().set(newValue);
|
|
||||||
});
|
|
||||||
EntityStringConverter<ProductType> converter = new EntityStringConverter<>();
|
|
||||||
converter.setInitialized(type -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getId(), type.getId())).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
converter.setFromString(name -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getName(), name)).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
field.setConverter(converter);
|
|
||||||
field.valueProperty().bindBidirectional(viewModel.getProductType());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeDeliverySignMethodField(
|
|
||||||
ComboBox<ProjectSaleType> saleTypeField,
|
|
||||||
ComboBox<DeliverySignMethod> field
|
|
||||||
) {
|
|
||||||
ObservableList<DeliverySignMethod> list = FXCollections.observableArrayList();
|
|
||||||
list.add(null);
|
|
||||||
list.addAll(getDeliverySignMethodService().findAll());
|
|
||||||
field.setItems(list);
|
|
||||||
|
|
||||||
ProjectSaleType saleType = saleTypeField.getValue();
|
|
||||||
if (saleType != null) {
|
|
||||||
field.setItems(list.filtered(p -> {
|
|
||||||
return p == null || Objects.equals(p.getSaleType(), saleType);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
saleTypeField.valueProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
if (newValue == null) {
|
|
||||||
field.setItems(list);
|
|
||||||
} else {
|
|
||||||
field.setItems(list.filtered(p -> {
|
|
||||||
return p == null || Objects.equals(p.getSaleType(), newValue);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
field.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
viewModel.getDeliverySignMethod().set(newValue);
|
|
||||||
});
|
|
||||||
EntityStringConverter<DeliverySignMethod> converter = new EntityStringConverter<>();
|
|
||||||
converter.setInitialized(signMethod -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getId(), signMethod.getId())).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
converter.setFromString(name -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getName(), name)).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
field.setConverter(converter);
|
|
||||||
field.valueProperty().bindBidirectional(viewModel.getDeliverySignMethod());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeProductUsageField(ComboBox<ProductUsage> field) {
|
|
||||||
ObservableList<ProductUsage> list = FXCollections.observableArrayList();
|
|
||||||
list.add(null);
|
|
||||||
list.addAll(getProductUsageService().findAll());
|
|
||||||
field.setItems(list);
|
|
||||||
field.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
viewModel.getProductUsage().set(newValue);
|
|
||||||
});
|
|
||||||
EntityStringConverter<ProductUsage> converter = new EntityStringConverter<>();
|
|
||||||
converter.setInitialized(usage -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getId(), usage.getId())).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
converter.setFromString(name -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getName(), name)).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
field.setConverter(converter);
|
|
||||||
field.valueProperty().bindBidirectional(viewModel.getProductUsage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeSaleTypeField(ComboBox<ProjectSaleType> field) {
|
|
||||||
ObservableList<ProjectSaleType> list = FXCollections.observableArrayList();
|
|
||||||
list.add(null);
|
|
||||||
list.addAll(getSaleTypeService().findAll());
|
|
||||||
field.setItems(list);
|
|
||||||
field.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
viewModel.getSaleType().set(newValue);
|
|
||||||
// 当 SequenceNumber 为 0 时, 自动检索最新的 SequenceNumber
|
|
||||||
if (viewModel.getCodeSequenceNumber().get() == 0 && viewModel.getCodeYear().get() != 0) {
|
|
||||||
int nextCodeSequenceNumber = getProjectService().getNextCodeSequenceNumber(newValue, viewModel.getCodeYear().get());
|
|
||||||
viewModel.getCodeSequenceNumber().set(nextCodeSequenceNumber);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
field.setCellFactory(param -> new ListCell<>() {
|
|
||||||
@Override
|
|
||||||
protected void updateItem(ProjectSaleType item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
if (empty || item == null) {
|
|
||||||
setText("-");
|
|
||||||
setStyle("");
|
|
||||||
} else {
|
|
||||||
setText(item.getName());
|
|
||||||
if (item.isActive()) {
|
|
||||||
this.setStyle("");
|
|
||||||
} else {
|
|
||||||
this.setStyle("-fx-text-fill: grey;");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
EntityStringConverter<ProjectSaleType> converter = new EntityStringConverter<>();
|
|
||||||
converter.setInitialized(saleType -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getId(), saleType.getId())).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
converter.setFromString(name -> {
|
|
||||||
return list.stream().filter(v -> v != null && Objects.equals(v.getName(), name)).findFirst().orElse(null);
|
|
||||||
});
|
|
||||||
field.setConverter(converter);
|
|
||||||
field.valueProperty().bindBidirectional(viewModel.getSaleType());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void employeeAutoCompletion(TextField textField, SimpleObjectProperty<Employee> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getEmployeeStringConverter());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
makeProjectCode();
|
makeProjectCode();
|
||||||
super.save();
|
super.save();
|
||||||
@@ -318,7 +174,7 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
private void makeProjectCode() {
|
private void makeProjectCode() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
ProjectSaleType saleType = controller.saleTypeField.getValue();
|
ProjectSaleTypeVo saleType = controller.saleTypeField.getValue();
|
||||||
if (saleType == null) {
|
if (saleType == null) {
|
||||||
sb.append("_");
|
sb.append("_");
|
||||||
} else {
|
} else {
|
||||||
@@ -328,7 +184,6 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
.ifPresent(item -> sb.append(item.getCode()));
|
.ifPresent(item -> sb.append(item.getCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int year = 0;
|
int year = 0;
|
||||||
{
|
{
|
||||||
String text = controller.codeYearField.getText();
|
String text = controller.codeYearField.getText();
|
||||||
@@ -355,12 +210,11 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
}
|
}
|
||||||
sb.append(sn);
|
sb.append(sn);
|
||||||
|
|
||||||
DeliverySignMethod signMethod = controller.deliverySignMethodField.getValue();
|
DeliverySignMethodVo signMethod = controller.deliverySignMethodField.getValue();
|
||||||
ProductType productType = controller.productTypeField.getValue();
|
ProductTypeVo productType = controller.productTypeField.getValue();
|
||||||
ProjectType projectType = controller.projectTypeField.getValue();
|
ProjectTypeVo projectType = controller.projectTypeField.getValue();
|
||||||
ProjectIndustry industry = controller.industryField.getValue();
|
ProjectIndustryVo industry = controller.industryField.getValue();
|
||||||
ProductUsage productUsage = controller.productUsageField.getValue();
|
ProductUsageVo productUsage = controller.productUsageField.getValue();
|
||||||
|
|
||||||
|
|
||||||
if (!Stream.of(signMethod, productType, projectType, industry, productUsage)
|
if (!Stream.of(signMethod, productType, projectType, industry, productUsage)
|
||||||
.allMatch(Objects::isNull)) {
|
.allMatch(Objects::isNull)) {
|
||||||
@@ -382,7 +236,6 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
.ifPresent(item -> sb.append(item.getCode()));
|
.ifPresent(item -> sb.append(item.getCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (projectType == null) {
|
if (projectType == null) {
|
||||||
sb.append("_");
|
sb.append("_");
|
||||||
} else {
|
} else {
|
||||||
@@ -392,7 +245,6 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
.ifPresent(item -> sb.append(item.getCode()));
|
.ifPresent(item -> sb.append(item.getCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (industry != null) {
|
if (industry != null) {
|
||||||
controller.industryField.getItems().stream()
|
controller.industryField.getItems().stream()
|
||||||
.filter(item -> item != null && item.getId().equals(industry.getId()))
|
.filter(item -> item != null && item.getId().equals(industry.getId()))
|
||||||
@@ -402,7 +254,6 @@ public class ProjectTabSkinBase extends AbstProjectBasedTabSkin implements TabSk
|
|||||||
sb.append("_");
|
sb.append("_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (productUsage != null) {
|
if (productUsage != null) {
|
||||||
controller.productUsageField.getItems().stream()
|
controller.productUsageField.getItems().stream()
|
||||||
.filter(item -> item != null && item.getId().equals(productUsage.getId()))
|
.filter(item -> item != null && item.getId().equals(productUsage.getId()))
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ public class ProjectTabSkinBid
|
|||||||
public TableColumn<ProjectBidViewModel, CompanyCustomerEvaluationFormFile> evaluationFileColumn;
|
public TableColumn<ProjectBidViewModel, CompanyCustomerEvaluationFormFile> evaluationFileColumn;
|
||||||
|
|
||||||
public TableColumn<ProjectBidViewModel, String> descriptionColumn;
|
public TableColumn<ProjectBidViewModel, String> descriptionColumn;
|
||||||
public TableColumn<ProjectBidViewModel, Employee> applicantColumn;
|
public TableColumn<ProjectBidViewModel, Integer> applicantColumn;
|
||||||
public TableColumn<ProjectBidViewModel, LocalDateTime> applyTimeColumn;
|
public TableColumn<ProjectBidViewModel, LocalDateTime> applyTimeColumn;
|
||||||
public TableColumn<ProjectBidViewModel, Employee> authorizerColumn;
|
public TableColumn<ProjectBidViewModel, Integer> authorizerColumn;
|
||||||
public TableColumn<ProjectBidViewModel, LocalDateTime> authorizationTimeColumn;
|
public TableColumn<ProjectBidViewModel, LocalDateTime> authorizationTimeColumn;
|
||||||
public TableColumn<ProjectBidViewModel, Number> levelColumn;
|
public TableColumn<ProjectBidViewModel, Number> levelColumn;
|
||||||
public TableColumn<ProjectBidViewModel, String> standardPayWayColumn;
|
public TableColumn<ProjectBidViewModel, String> standardPayWayColumn;
|
||||||
@@ -62,7 +62,6 @@ public class ProjectTabSkinBid
|
|||||||
@Setter
|
@Setter
|
||||||
private CompanyCustomerFileService customerFileService;
|
private CompanyCustomerFileService customerFileService;
|
||||||
|
|
||||||
|
|
||||||
public ProjectTabSkinBid(ProjectWindowController controller) {
|
public ProjectTabSkinBid(ProjectWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
@@ -82,15 +81,18 @@ public class ProjectTabSkinBid
|
|||||||
super.initializeTable();
|
super.initializeTable();
|
||||||
bindNumberColumn(idColumn, ProjectBidViewModel::getId);
|
bindNumberColumn(idColumn, ProjectBidViewModel::getId);
|
||||||
|
|
||||||
// levelColumn.setCellValueFactory(param -> param.getValue().getLevel());
|
// levelColumn.setCellValueFactory(param -> param.getValue().getLevel());
|
||||||
// levelColumn.setCellFactory(param -> new LevelTableCell());
|
// levelColumn.setCellFactory(param -> new LevelTableCell());
|
||||||
// standardPayWayColumn.setCellValueFactory(param -> param.getValue().getStandardPayWay().map(value -> value == null ? "" : (value ? "标准" : "非标准")));
|
// standardPayWayColumn.setCellValueFactory(param ->
|
||||||
// evaluationFileColumn.setCellValueFactory(param -> param.getValue().getEvaluationFile());
|
// param.getValue().getStandardPayWay().map(value -> value == null ? "" : (value
|
||||||
// evaluationFileColumn.setCellFactory(param -> new EvaluationFileTableCell());
|
// ? "标准" : "非标准")));
|
||||||
|
// evaluationFileColumn.setCellValueFactory(param ->
|
||||||
|
// param.getValue().getEvaluationFile());
|
||||||
|
// evaluationFileColumn.setCellFactory(param -> new EvaluationFileTableCell());
|
||||||
|
|
||||||
|
// amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
|
||||||
// amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
|
// amountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new
|
||||||
// amountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
|
// CurrencyStringConverter(getLocale())));
|
||||||
|
|
||||||
applicantColumn.setCellValueFactory(param -> param.getValue().getApplicant());
|
applicantColumn.setCellValueFactory(param -> param.getValue().getApplicant());
|
||||||
applicantColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService()));
|
applicantColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService()));
|
||||||
@@ -190,7 +192,6 @@ public class ProjectTabSkinBid
|
|||||||
return getProjectBidService().save(entity);
|
return getProjectBidService().save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class LevelTableCell extends TableCell<ProjectBidViewModel, Number> {
|
private static class LevelTableCell extends TableCell<ProjectBidViewModel, Number> {
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(Number item, boolean empty) {
|
protected void updateItem(Number item, boolean empty) {
|
||||||
|
|||||||
@@ -1,18 +1,11 @@
|
|||||||
package com.ecep.contract.controller.project;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyBankAccount;
|
|
||||||
import com.ecep.contract.model.CompanyContact;
|
import com.ecep.contract.model.CompanyContact;
|
||||||
import com.ecep.contract.model.CompanyInvoiceInfo;
|
import com.ecep.contract.model.CompanyInvoiceInfo;
|
||||||
import com.ecep.contract.service.BankService;
|
import com.ecep.contract.service.BankService;
|
||||||
@@ -21,9 +14,10 @@ import com.ecep.contract.service.CompanyContactService;
|
|||||||
import com.ecep.contract.service.CompanyInvoiceInfoService;
|
import com.ecep.contract.service.CompanyInvoiceInfoService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vo.BankVo;
|
import com.ecep.contract.vo.BankVo;
|
||||||
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
import com.ecep.contract.vo.CompanyContactVo;
|
||||||
import com.ecep.contract.vo.CompanyVo;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
@@ -33,7 +27,6 @@ import javafx.scene.control.Button;
|
|||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.util.StringConverter;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/project/project-tab-customer.fxml")
|
@FxmlPath("/ui/project/project-tab-customer.fxml")
|
||||||
public class ProjectTabSkinCustomerInfo
|
public class ProjectTabSkinCustomerInfo
|
||||||
@@ -62,13 +55,6 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
@FXML
|
@FXML
|
||||||
public Label subContactLabel;
|
public Label subContactLabel;
|
||||||
|
|
||||||
private CompanyService companyService;
|
|
||||||
private BankService bankService;
|
|
||||||
private CompanyInvoiceInfoService invoiceInfoService;
|
|
||||||
private CompanyBankAccountService bankAccountService;
|
|
||||||
private CompanyContactService contactService;
|
|
||||||
|
|
||||||
|
|
||||||
public ProjectTabSkinCustomerInfo(ProjectWindowController controller) {
|
public ProjectTabSkinCustomerInfo(ProjectWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
@@ -87,28 +73,16 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
initSubContactField();
|
initSubContactField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initCompanyField() {
|
private void initCompanyField() {
|
||||||
companyAutoCompletion(companyField, companyLabel, viewModel.getCustomer()).setOnAutoCompleted(event -> {
|
companyAutoCompletion(companyField, companyLabel, viewModel.getCustomer()).setOnAutoCompleted(event -> {
|
||||||
Company company = event.getCompletion();
|
CompanyVo company = event.getCompletion();
|
||||||
viewModel.getCustomer().set(company);
|
viewModel.getCustomer().set(company.getId());
|
||||||
|
|
||||||
//
|
|
||||||
// updateAbsent(company.getUniscid(), companyTaxCodeField.textProperty());
|
|
||||||
// updateAbsent(company.getTelephone(), companyTelField.textProperty());
|
|
||||||
//
|
|
||||||
// updateAbsent(
|
|
||||||
// // 优先使用通讯地址
|
|
||||||
// StringUtils.hasText(company.getAddress()) ? company.getAddress() : company.getRegAddr(),
|
|
||||||
// companyAddressField.textProperty());
|
|
||||||
|
|
||||||
// viewModel.getInvoiceInfo();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
companyDetailBtn.setOnAction(event -> {
|
companyDetailBtn.setOnAction(event -> {
|
||||||
CompanyVo company = viewModel.getCustomer().get();
|
Integer companyId = viewModel.getCustomer().get();
|
||||||
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
if (company == null) {
|
if (company == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -117,32 +91,33 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBankAccountField() {
|
private void initBankAccountField() {
|
||||||
bankAccountAutoCompletion(bankAccountField, bankAccountLabel, viewModel.getBankAccount()).setOnAutoCompleted(event -> {
|
bankAccountAutoCompletion(bankAccountField, bankAccountLabel, viewModel.getBankAccount())
|
||||||
CompanyBankAccount account = event.getCompletion();
|
.setOnAutoCompleted(event -> {
|
||||||
viewModel.getBankAccount().set(account);
|
CompanyBankAccountVo account = event.getCompletion();
|
||||||
|
viewModel.getBankAccount().set(account.getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initInvoiceInfoField() {
|
private void initInvoiceInfoField() {
|
||||||
invoiceInfoAutoCompletion(invoiceInfoField, invoiceInfoLabel, viewModel.getInvoiceInfo()).setOnAutoCompleted(event -> {
|
invoiceInfoAutoCompletion(invoiceInfoField, invoiceInfoLabel, viewModel.getInvoiceInfo())
|
||||||
|
.setOnAutoCompleted(event -> {
|
||||||
CompanyInvoiceInfo invoiceInfo = event.getCompletion();
|
CompanyInvoiceInfo invoiceInfo = event.getCompletion();
|
||||||
viewModel.getInvoiceInfo().set(invoiceInfo);
|
viewModel.getInvoiceInfo().set(invoiceInfo.getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initMainContactField() {
|
private void initMainContactField() {
|
||||||
contactAutoCompletion(mainContactField, mainContactLabel, viewModel.getMainContact()).setOnAutoCompleted(event -> {
|
contactAutoCompletion(mainContactField, mainContactLabel, viewModel.getMainContact())
|
||||||
CompanyContact contact = event.getCompletion();
|
.setOnAutoCompleted(event -> {
|
||||||
viewModel.getMainContact().set(contact);
|
CompanyContactVo contact = event.getCompletion();
|
||||||
|
viewModel.getMainContact().set(contact.getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initSubContactField() {
|
private void initSubContactField() {
|
||||||
contactAutoCompletion(subContactField, subContactLabel, viewModel.getSubContact()).setOnAutoCompleted(event -> {
|
contactAutoCompletion(subContactField, subContactLabel, viewModel.getSubContact()).setOnAutoCompleted(event -> {
|
||||||
CompanyContact contact = event.getCompletion();
|
CompanyContactVo contact = event.getCompletion();
|
||||||
viewModel.getSubContact().set(contact);
|
viewModel.getSubContact().set(contact.getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,17 +137,17 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
property.set(value);
|
property.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutoCompletionBinding<Company> companyAutoCompletion(TextField textField, Label label, SimpleObjectProperty<Company> property) {
|
private AutoCompletionBinding<CompanyVo> companyAutoCompletion(TextField textField, Label label,
|
||||||
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
|
SimpleObjectProperty<Integer> property) {
|
||||||
|
|
||||||
label.textProperty().bind(property.map(company -> {
|
label.textProperty().bind(property.map(companyId -> {
|
||||||
if (company == null) {
|
if (companyId == null) {
|
||||||
return "未选择";
|
return "未选择";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ProxyUtils.isInitialized(company)) {
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
company = getCompanyService().findById(company.getId());
|
if (company == null) {
|
||||||
property.set(company);
|
return "#" + companyId;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("经营状态:");
|
sb.append("经营状态:");
|
||||||
@@ -192,30 +167,26 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return UITools.autoCompletion(textField, property, converter::suggest, converter);
|
return UITools.autoCompletion(textField, property, getCompanyService());
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutoCompletionBinding<CompanyBankAccount> bankAccountAutoCompletion(TextField textField, Label label, SimpleObjectProperty<CompanyBankAccount> property) {
|
private AutoCompletionBinding<CompanyBankAccountVo> bankAccountAutoCompletion(TextField textField, Label label,
|
||||||
EntityStringConverter<CompanyBankAccount> converter = new EntityStringConverter<>();
|
SimpleObjectProperty<Integer> property) {
|
||||||
converter.setInitialized(account -> getBankAccountService().findById(account.getId()));
|
|
||||||
|
|
||||||
label.textProperty().bind(property.map(account -> {
|
label.textProperty().bind(property.map(accountId -> {
|
||||||
if (account == null) {
|
if (accountId == null) {
|
||||||
return "未选择";
|
return "未选择";
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(account)) {
|
CompanyBankAccountVo account = getBankAccountService().findById(accountId);
|
||||||
account = getBankAccountService().findById(account.getId());
|
if (account == null) {
|
||||||
property.set(account);
|
return "#" + accountId;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Integer bankId = account.getBankId();
|
||||||
|
BankVo bank = getBankService().findById(bankId);
|
||||||
sb.append("开户行:");
|
sb.append("开户行:");
|
||||||
BankVo bank = account.getBank();
|
|
||||||
if (bank != null) {
|
if (bank != null) {
|
||||||
if (!ProxyUtils.isInitialized(bank)) {
|
sb.append(getBankService().getStringConverter().toString(bank));
|
||||||
bank = getBankService().findById(bank.getId());
|
|
||||||
account.setBank(bank);
|
|
||||||
}
|
|
||||||
sb.append(bank.toPrettyString());
|
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
sb.append(account.getOpeningBank());
|
sb.append(account.getOpeningBank());
|
||||||
@@ -225,20 +196,21 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
sb.append(account.getAccount());
|
sb.append(account.getAccount());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}));
|
}));
|
||||||
return autoCompletion(textField, property, getBankAccountService()::searchByCompany, converter);
|
return UITools.autoCompletion(textField, property, getBankAccountService());
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutoCompletionBinding<CompanyInvoiceInfo> invoiceInfoAutoCompletion(TextField textField, Label label, SimpleObjectProperty<CompanyInvoiceInfo> property) {
|
private AutoCompletionBinding<CompanyInvoiceInfo> invoiceInfoAutoCompletion(TextField textField, Label label,
|
||||||
|
SimpleObjectProperty<Integer> property) {
|
||||||
EntityStringConverter<CompanyInvoiceInfo> converter = new EntityStringConverter<>();
|
EntityStringConverter<CompanyInvoiceInfo> converter = new EntityStringConverter<>();
|
||||||
converter.setInitialized(info -> getInvoiceInfoService().findById(info.getId()));
|
converter.setInitialized(info -> getInvoiceInfoService().findById(info.getId()));
|
||||||
|
|
||||||
label.textProperty().bind(property.map(info -> {
|
label.textProperty().bind(property.map(infoId -> {
|
||||||
if (info == null) {
|
if (infoId == null) {
|
||||||
return "未选择";
|
return "未选择";
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(info)) {
|
CompanyInvoiceInfo info = getInvoiceInfoService().findById(infoId);
|
||||||
info = getInvoiceInfoService().findById(info.getId());
|
if (info == null) {
|
||||||
property.set(info);
|
return "#" + infoId;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("发票抬头:");
|
sb.append("发票抬头:");
|
||||||
@@ -257,20 +229,19 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
sb.append(info.getPhone());
|
sb.append(info.getPhone());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}));
|
}));
|
||||||
return autoCompletion(textField, property, getInvoiceInfoService()::searchByCompany, converter);
|
return UITools.autoCompletion(textField, property, getInvoiceInfoService());
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutoCompletionBinding<CompanyContact> contactAutoCompletion(TextField textField, Label label, SimpleObjectProperty<CompanyContact> property) {
|
private AutoCompletionBinding<CompanyContactVo> contactAutoCompletion(TextField textField, Label label,
|
||||||
EntityStringConverter<CompanyContact> converter = new EntityStringConverter<>();
|
SimpleObjectProperty<Integer> property) {
|
||||||
converter.setInitialized(contact -> getContactService().findById(contact.getId()));
|
|
||||||
|
|
||||||
label.textProperty().bind(property.map(contact -> {
|
label.textProperty().bind(property.map(contactId -> {
|
||||||
if (contact == null) {
|
if (contactId == null) {
|
||||||
return "未选择";
|
return "未选择";
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(contact)) {
|
CompanyContactVo contact = getContactService().findById(contactId);
|
||||||
contact = getContactService().findById(contact.getId());
|
if (contact == null) {
|
||||||
property.set(contact);
|
return "#" + contactId;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("联系人:");
|
sb.append("联系人:");
|
||||||
@@ -290,56 +261,26 @@ public class ProjectTabSkinCustomerInfo
|
|||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}));
|
}));
|
||||||
return autoCompletion(textField, property, getContactService()::searchByCompany, converter);
|
return UITools.autoCompletion(textField, property, getContactService());
|
||||||
}
|
|
||||||
|
|
||||||
public <T> AutoCompletionBinding<T> autoCompletion(
|
|
||||||
TextField textField,
|
|
||||||
SimpleObjectProperty<T> property,
|
|
||||||
BiFunction<Company, String, List<T>> func,
|
|
||||||
StringConverter<T> converter
|
|
||||||
) {
|
|
||||||
return UITools.autoCompletion(textField, property, text -> {
|
|
||||||
Company company = viewModel.getCustomer().get();
|
|
||||||
if (company == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return func.apply(company, text.getUserText());
|
|
||||||
}, converter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyService getCompanyService() {
|
public CompanyService getCompanyService() {
|
||||||
if (companyService == null) {
|
return getCachedBean(CompanyService.class);
|
||||||
companyService = getBean(CompanyService.class);
|
|
||||||
}
|
|
||||||
return companyService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BankService getBankService() {
|
public BankService getBankService() {
|
||||||
if (bankService == null) {
|
return getCachedBean(BankService.class);
|
||||||
bankService = getBean(BankService.class);
|
|
||||||
}
|
|
||||||
return bankService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyInvoiceInfoService getInvoiceInfoService() {
|
public CompanyInvoiceInfoService getInvoiceInfoService() {
|
||||||
if (invoiceInfoService == null) {
|
return getCachedBean(CompanyInvoiceInfoService.class);
|
||||||
invoiceInfoService = getBean(CompanyInvoiceInfoService.class);
|
|
||||||
}
|
|
||||||
return invoiceInfoService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyBankAccountService getBankAccountService() {
|
public CompanyBankAccountService getBankAccountService() {
|
||||||
if (bankAccountService == null) {
|
return getCachedBean(CompanyBankAccountService.class);
|
||||||
bankAccountService = getBean(CompanyBankAccountService.class);
|
|
||||||
}
|
|
||||||
return bankAccountService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyContactService getContactService() {
|
public CompanyContactService getContactService() {
|
||||||
if (contactService == null) {
|
return getCachedBean(CompanyContactService.class);
|
||||||
contactService = getBean(CompanyContactService.class);
|
|
||||||
}
|
|
||||||
return contactService;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -144,7 +146,7 @@ public class ProjectTabSkinFundPlan
|
|||||||
private void onUpdatePlanAction(ActionEvent event) {
|
private void onUpdatePlanAction(ActionEvent event) {
|
||||||
try {
|
try {
|
||||||
// 获取当前项目
|
// 获取当前项目
|
||||||
Project project = getParent();
|
ProjectVo project = getParent();
|
||||||
if (project == null || project.getId() == null) {
|
if (project == null || project.getId() == null) {
|
||||||
setStatus("提示, 无法获取项目信息");
|
setStatus("提示, 无法获取项目信息");
|
||||||
return;
|
return;
|
||||||
@@ -159,14 +161,14 @@ public class ProjectTabSkinFundPlan
|
|||||||
plan -> plan));
|
plan -> plan));
|
||||||
|
|
||||||
// 获取项目关联的所有合同
|
// 获取项目关联的所有合同
|
||||||
List<Contract> contracts = getContractService().findAllByProject(project);
|
List<ContractVo> contracts = getContractService().findAllByProject(project);
|
||||||
if (contracts == null || contracts.isEmpty()) {
|
if (contracts == null || contracts.isEmpty()) {
|
||||||
setStatus("提示, 未找到与项目关联的合同");
|
setStatus("提示, 未找到与项目关联的合同");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 遍历所有合同
|
// 遍历所有合同
|
||||||
for (Contract contract : contracts) {
|
for (ContractVo contract : contracts) {
|
||||||
// 获取合同的付款计划
|
// 获取合同的付款计划
|
||||||
List<ContractPayPlan> payPlans = getContractPayPlanService().findAllByContract(contract);
|
List<ContractPayPlan> payPlans = getContractPayPlanService().findAllByContract(contract);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.ecep.contract.controller.project;
|
|||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
|
import com.ecep.contract.vo.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -47,18 +49,11 @@ import javafx.util.converter.LocalDateStringConverter;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/project.fxml")
|
@FxmlPath("/ui/project/project.fxml")
|
||||||
public class ProjectWindowController extends AbstEntityController<Project, ProjectViewModel> {
|
public class ProjectWindowController extends AbstEntityController<ProjectVo, ProjectViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectWindowController.class);
|
||||||
|
|
||||||
|
public static void show(ProjectVo project, Window window) {
|
||||||
|
show(ProjectViewModel.from(project), window);
|
||||||
public static void show(Project project, Window window) {
|
|
||||||
ProjectViewModel viewModel = new ProjectViewModel();
|
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = SpringApp.getBean(ProjectService.class).findById(project.getId());
|
|
||||||
}
|
|
||||||
viewModel.update(project);
|
|
||||||
show(viewModel, window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(ProjectViewModel model, Window window) {
|
public static void show(ProjectViewModel model, Window window) {
|
||||||
@@ -71,8 +66,8 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
public Button refreshBtn;
|
public Button refreshBtn;
|
||||||
public Button deleteBtn;
|
public Button deleteBtn;
|
||||||
|
|
||||||
|
LocalDateStringConverter localDateStringConverter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE,
|
||||||
LocalDateStringConverter localDateStringConverter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
|
null);
|
||||||
|
|
||||||
// 基本信息 Tab
|
// 基本信息 Tab
|
||||||
public Tab baseInfoTab;
|
public Tab baseInfoTab;
|
||||||
@@ -86,12 +81,12 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
public CheckBox useOfferField;
|
public CheckBox useOfferField;
|
||||||
public TextField amountField;
|
public TextField amountField;
|
||||||
public CheckBox standardPayWayField;
|
public CheckBox standardPayWayField;
|
||||||
public ComboBox<ProjectIndustry> industryField;
|
public ComboBox<ProjectIndustryVo> industryField;
|
||||||
public ComboBox<ProjectSaleType> saleTypeField;
|
public ComboBox<ProjectSaleTypeVo> saleTypeField;
|
||||||
public ComboBox<ProjectType> projectTypeField;
|
public ComboBox<ProjectTypeVo> projectTypeField;
|
||||||
public ComboBox<ProductType> productTypeField;
|
public ComboBox<ProductTypeVo> productTypeField;
|
||||||
public ComboBox<DeliverySignMethod> deliverySignMethodField;
|
public ComboBox<DeliverySignMethodVo> deliverySignMethodField;
|
||||||
public ComboBox<ProductUsage> productUsageField;
|
public ComboBox<ProductUsageVo> productUsageField;
|
||||||
public TextField applicantField;
|
public TextField applicantField;
|
||||||
public TextField authorizerField;
|
public TextField authorizerField;
|
||||||
public DatePicker plannedStartTimeField;
|
public DatePicker plannedStartTimeField;
|
||||||
@@ -100,13 +95,12 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
public Label versionLabel;
|
public Label versionLabel;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
合同 Tab
|
* 合同 Tab
|
||||||
*/
|
*/
|
||||||
public Tab contractTab;
|
public Tab contractTab;
|
||||||
/* 成本审批 */
|
/* 成本审批 */
|
||||||
public Tab costTab;
|
public Tab costTab;
|
||||||
|
|
||||||
|
|
||||||
// 文件 Tab
|
// 文件 Tab
|
||||||
public Tab fileTab;
|
public Tab fileTab;
|
||||||
public TableView fileTable;
|
public TableView fileTable;
|
||||||
@@ -148,7 +142,12 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
refreshBtn.setOnAction(event -> refreshByButton((Button) event.getSource()));
|
refreshBtn.setOnAction(event -> refreshByButton((Button) event.getSource()));
|
||||||
getTitle().bind(Bindings.createStringBinding(() -> "[" + viewModel.getId().get() + "] " + viewModel.getCode().get() + " " + viewModel.getName().getValue() + " 项目详情", viewModel.getCode(), viewModel.getName()));
|
getTitle()
|
||||||
|
.bind(Bindings
|
||||||
|
.createStringBinding(
|
||||||
|
() -> "[" + viewModel.getId().get() + "] " + viewModel.getCode().get() + " "
|
||||||
|
+ viewModel.getName().getValue() + " 项目详情",
|
||||||
|
viewModel.getCode(), viewModel.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -160,7 +159,7 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
registerTabSkin(quotationApprovalTab, tab -> new ProjectTabSkinQuotation(this));
|
registerTabSkin(quotationApprovalTab, tab -> new ProjectTabSkinQuotation(this));
|
||||||
registerTabSkin(bidTab, tab -> new ProjectTabSkinBid(this));
|
registerTabSkin(bidTab, tab -> new ProjectTabSkinBid(this));
|
||||||
registerTabSkin(fundPlanTab, tab -> new ProjectTabSkinFundPlan(this));
|
registerTabSkin(fundPlanTab, tab -> new ProjectTabSkinFundPlan(this));
|
||||||
// registerTabSkin(costItemTab, this::createCostItemTabSkin);
|
// registerTabSkin(costItemTab, this::createCostItemTabSkin);
|
||||||
registerTabSkin(satisfactionTab, tab -> new ProjectTabSkinCustomerSatisfactionSurvey(this));
|
registerTabSkin(satisfactionTab, tab -> new ProjectTabSkinCustomerSatisfactionSurvey(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +168,6 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
return projectService;
|
return projectService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ProjectTabSkinBase createBaseTabSkin(Tab tab) {
|
private ProjectTabSkinBase createBaseTabSkin(Tab tab) {
|
||||||
ProjectTabSkinBase skin = new ProjectTabSkinBase(this);
|
ProjectTabSkinBase skin = new ProjectTabSkinBase(this);
|
||||||
skin.setLocalDateStringConverter(localDateStringConverter);
|
skin.setLocalDateStringConverter(localDateStringConverter);
|
||||||
@@ -190,7 +188,8 @@ public class ProjectWindowController extends AbstEntityController<Project, Proje
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onGetNextCodeSNAction(ActionEvent event) {
|
public void onGetNextCodeSNAction(ActionEvent event) {
|
||||||
ProjectSaleType projectSaleType = viewModel.getSaleType().get();
|
Integer saleTypeId = viewModel.getSaleType().get();
|
||||||
|
ProjectSaleTypeVo projectSaleType = getCachedBean(ProjectSaleTypeService.class).findById(saleTypeId);
|
||||||
int year = viewModel.getCodeYear().get();
|
int year = viewModel.getCodeYear().get();
|
||||||
int sn = viewModel.getCodeSequenceNumber().get();
|
int sn = viewModel.getCodeSequenceNumber().get();
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,5 @@
|
|||||||
package com.ecep.contract.controller.project.bid;
|
package com.ecep.contract.controller.project.bid;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.CompanyCustomerFileType;
|
import com.ecep.contract.CompanyCustomerFileType;
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
@@ -24,27 +11,12 @@ import com.ecep.contract.controller.tab.TabSkin;
|
|||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.service.*;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ContractFile;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectBid;
|
|
||||||
import com.ecep.contract.model.ProjectCost;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
|
||||||
import com.ecep.contract.service.CompanyService;
|
|
||||||
import com.ecep.contract.service.ContractFileService;
|
|
||||||
import com.ecep.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.service.ProjectCostService;
|
|
||||||
import com.ecep.contract.service.ProjectQuotationService;
|
|
||||||
import com.ecep.contract.service.ProjectService;
|
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ProjectBidViewModel;
|
import com.ecep.contract.vm.ProjectBidViewModel;
|
||||||
|
import com.ecep.contract.vo.*;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -56,9 +28,21 @@ import javafx.util.converter.LocalDateStringConverter;
|
|||||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public class ProjectBidTabSkinBase
|
public class ProjectBidTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<ProjectBidWindowController, ProjectBid, ProjectBidViewModel>
|
extends AbstEntityBasedTabSkin<ProjectBidWindowController, ProjectBidVo, ProjectBidViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@@ -86,6 +70,9 @@ public class ProjectBidTabSkinBase
|
|||||||
@Setter
|
@Setter
|
||||||
private ContractFileService contractFileService;
|
private ContractFileService contractFileService;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;
|
||||||
|
|
||||||
private ProjectService getProjectService() {
|
private ProjectService getProjectService() {
|
||||||
if (projectService == null) {
|
if (projectService == null) {
|
||||||
projectService = getBean(ProjectService.class);
|
projectService = getBean(ProjectService.class);
|
||||||
@@ -134,10 +121,11 @@ public class ProjectBidTabSkinBase
|
|||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
|
|
||||||
employeeAutoCompletion(controller.applicantField, viewModel.getApplicant());
|
UITools.autoCompletion(controller.applicantField, viewModel.getApplicant(), controller.getEmployeeService());
|
||||||
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(),
|
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(),
|
||||||
getLocalDateTimeStringConverter());
|
getLocalDateTimeStringConverter());
|
||||||
employeeAutoCompletion(controller.authorizerField, viewModel.getAuthorizer());
|
|
||||||
|
UITools.autoCompletion(controller.authorizerField, viewModel.getAuthorizer(), controller.getEmployeeService());
|
||||||
controller.authorizationTimeField.textProperty().bindBidirectional(viewModel.getAuthorizationTime(),
|
controller.authorizationTimeField.textProperty().bindBidirectional(viewModel.getAuthorizationTime(),
|
||||||
getLocalDateTimeStringConverter());
|
getLocalDateTimeStringConverter());
|
||||||
|
|
||||||
@@ -177,28 +165,25 @@ public class ProjectBidTabSkinBase
|
|||||||
controller.amountField.textProperty().bindBidirectional(viewModel.getAmount(),
|
controller.amountField.textProperty().bindBidirectional(viewModel.getAmount(),
|
||||||
new NumberStringConverter(getLocale()));
|
new NumberStringConverter(getLocale()));
|
||||||
|
|
||||||
evaluationFileAutoCompletion(controller.evaluationFileField, viewModel.getEvaluationFile());
|
UITools.autoCompletion(controller.evaluationFileField, viewModel.getEvaluationFile(),
|
||||||
|
getCompanyCustomerFileService());
|
||||||
controller.evaluationFileBtn.setOnAction(event -> {
|
controller.evaluationFileBtn.setOnAction(event -> {
|
||||||
CompletableFuture.runAsync(() -> {
|
runAsync(() -> {
|
||||||
CompanyCustomerEvaluationFormFile file = viewModel.getEvaluationFile().get();
|
Integer fileId = viewModel.getEvaluationFile().get();
|
||||||
|
CompanyCustomerEvaluationFormFileVo file = getEvaluationFormFileService().findById(fileId);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
if (!ProxyUtils.isInitialized(file)) {
|
CompanyCustomerEvaluationFormFileWindowController.show(file,
|
||||||
file = getCompanyCustomerFileService().findCustomerEvaluationFormFileById(file.getId());
|
|
||||||
}
|
|
||||||
CompanyCustomerEvaluationFormFileWindowController.show(file.getCustomerFile(),
|
|
||||||
getTab().getTabPane().getScene().getWindow());
|
getTab().getTabPane().getScene().getWindow());
|
||||||
}
|
}
|
||||||
}).exceptionally(this::handleException);
|
}).exceptionally(this::handleException);
|
||||||
});
|
});
|
||||||
|
|
||||||
projectCostAutoCompletion(controller.costField, viewModel.getCost());
|
UITools.autoCompletion(controller.costField, viewModel.getCost(), getProjectCostService());
|
||||||
controller.costBtn.setOnAction(event -> {
|
controller.costBtn.setOnAction(event -> {
|
||||||
CompletableFuture.runAsync(() -> {
|
runAsync(() -> {
|
||||||
ProjectCost cost = viewModel.getCost().get();
|
Integer costId = viewModel.getCost().get();
|
||||||
|
ProjectCostVo cost = getProjectCostService().findById(costId);
|
||||||
if (cost != null) {
|
if (cost != null) {
|
||||||
if (!ProxyUtils.isInitialized(cost)) {
|
|
||||||
cost = getProjectCostService().findById(cost.getId());
|
|
||||||
}
|
|
||||||
ProjectCostWindowController.show(cost, getTab().getTabPane().getScene().getWindow());
|
ProjectCostWindowController.show(cost, getTab().getTabPane().getScene().getWindow());
|
||||||
}
|
}
|
||||||
}).exceptionally(this::handleException);
|
}).exceptionally(this::handleException);
|
||||||
@@ -263,17 +248,13 @@ public class ProjectBidTabSkinBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInitialDirectory(FileChooser fileChooser, File file, Project project) {
|
void setInitialDirectory(FileChooser fileChooser, File file, Integer projectId) {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
if (project != null) {
|
ProjectVo projectVo = getProjectService().findById(projectId);
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
File path = getProjectService().searchPath(projectVo);
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
File path = getProjectService().searchPath(project);
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
fileChooser.setInitialDirectory(path);
|
fileChooser.setInitialDirectory(path);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fileChooser.setInitialDirectory(file.getParentFile());
|
fileChooser.setInitialDirectory(file.getParentFile());
|
||||||
}
|
}
|
||||||
@@ -283,29 +264,33 @@ public class ProjectBidTabSkinBase
|
|||||||
* 尝试获取客户资信评估表
|
* 尝试获取客户资信评估表
|
||||||
*/
|
*/
|
||||||
private void tryGetEvaluationFile() {
|
private void tryGetEvaluationFile() {
|
||||||
Project project = getViewModel().getProject().get();
|
Integer projectId = getViewModel().getProject().get();
|
||||||
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
Integer companyId = project.getCustomerId();
|
||||||
project = getProjectService().findById(project.getId());
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
}
|
CompanyCustomerVo customer = getCompanyCustomerService().findByCompany(company);
|
||||||
Company company = project.getCustomer();
|
|
||||||
CompanyCustomer customer = getCompanyCustomerService().findByCompany(company);
|
|
||||||
if (customer == null) {
|
if (customer == null) {
|
||||||
|
// 没有对应的客户
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyCustomerFileService companyCustomerFileService = getBean(CompanyCustomerFileService.class);
|
CompanyCustomerFileService fileService = getBean(CompanyCustomerFileService.class);
|
||||||
List<CompanyCustomerFile> list = companyCustomerFileService.findAllByCustomerAndType(customer,
|
|
||||||
|
// 获取客户资信评估表
|
||||||
|
List<CompanyCustomerFileVo> list = fileService.findAllByCustomerAndType(customer,
|
||||||
CompanyCustomerFileType.EvaluationForm);
|
CompanyCustomerFileType.EvaluationForm);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
// 没有评估表
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在时间范围内是否有评估表
|
||||||
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
||||||
LocalDate verifyDate = applyTime.toLocalDate();
|
LocalDate verifyDate = applyTime.toLocalDate();
|
||||||
CompanyCustomerFile file = list.stream()
|
CompanyCustomerFileVo file = list.stream()
|
||||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||||
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
|
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
|
||||||
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
||||||
@@ -315,14 +300,17 @@ public class ProjectBidTabSkinBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFile evaluationFile = companyCustomerFileService
|
// 查找评估表对象
|
||||||
.findCustomerEvaluationFormFileByCustomerFile(file);
|
CompanyCustomerEvaluationFormFileVo evaluationFileVo = getEvaluationFormFileService()
|
||||||
if (evaluationFile == null) {
|
.findByCustomerFile(file);
|
||||||
|
if (evaluationFileVo == null) {
|
||||||
|
// 没找到对应的评估表对象,跳过
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
getViewModel().getEvaluationFile().set(evaluationFile);
|
getViewModel().getEvaluationFile().set(evaluationFileVo.getId());
|
||||||
Integer creditLevel = evaluationFile.getCreditLevel();
|
Integer creditLevel = evaluationFileVo.getCreditLevel();
|
||||||
getViewModel().getLevel().set(creditLevel >= 4 ? 2 : creditLevel >= 2 ? 1 : 0);
|
getViewModel().getLevel().set(creditLevel >= 4 ? 2 : creditLevel >= 2 ? 1 : 0);
|
||||||
save();
|
save();
|
||||||
});
|
});
|
||||||
@@ -346,19 +334,21 @@ public class ProjectBidTabSkinBase
|
|||||||
|
|
||||||
private void getContractFile(SimpleObjectProperty<File> fileProperty,
|
private void getContractFile(SimpleObjectProperty<File> fileProperty,
|
||||||
SimpleObjectProperty<LocalDateTime> dateTimeProperty, ContractFileType type) {
|
SimpleObjectProperty<LocalDateTime> dateTimeProperty, ContractFileType type) {
|
||||||
Project project = getViewModel().getProject().get();
|
Integer projectId = getViewModel().getProject().get();
|
||||||
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<ContractFile> list = new ArrayList<>();
|
ContractFileService fileService = getContractFileService();
|
||||||
for (Contract contract : getContractService().findAllSalesByProject(project)) {
|
List<ContractFileVo> list = new ArrayList<>();
|
||||||
list.addAll(getContractFileService().findAllByContractAndFileType(contract, type));
|
for (ContractVo contract : getContractService().findAllSalesByProject(project)) {
|
||||||
|
list.addAll(fileService.findAllByContractAndFileType(contract, type));
|
||||||
}
|
}
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContractFile contractFile = list.stream().max(Comparator.comparing(ContractFile::getApplyDate))
|
ContractFileVo contractFile = list.stream().max(Comparator.comparing(ContractFileVo::getApplyDate))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (contractFile == null) {
|
if (contractFile == null) {
|
||||||
return;
|
return;
|
||||||
@@ -368,8 +358,8 @@ public class ProjectBidTabSkinBase
|
|||||||
LocalDateTime localDateTime = LocalDateTime.of(contractFile.getApplyDate(), LocalTime.MIN);
|
LocalDateTime localDateTime = LocalDateTime.of(contractFile.getApplyDate(), LocalTime.MIN);
|
||||||
dateTimeProperty.set(localDateTime);
|
dateTimeProperty.set(localDateTime);
|
||||||
}
|
}
|
||||||
Contract c = contractFile.getContract();
|
Integer contractId = contractFile.getContractId();
|
||||||
;
|
ContractVo c = getContractService().findById(contractId);
|
||||||
File file = new File(c.getPath(), contractFile.getFileName());
|
File file = new File(c.getPath(), contractFile.getFileName());
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
@@ -395,72 +385,12 @@ public class ProjectBidTabSkinBase
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
private void projectCostAutoCompletion(TextField textField, SimpleObjectProperty<ProjectCost> property) {
|
private void employeeAutoCompletion(TextField textField, SimpleObjectProperty<Integer> property) {
|
||||||
EntityStringConverter<ProjectCost> converter = new EntityStringConverter<>();
|
UITools.autoCompletion(textField, property, controller.getEmployeeService());
|
||||||
converter.setInitialized(formFile -> getProjectCostService().findById(formFile.getId()));
|
|
||||||
NumberFormat numberInstance = NumberFormat.getNumberInstance(getLocale());
|
|
||||||
numberInstance.setMinimumFractionDigits(2);
|
|
||||||
numberInstance.setMaximumFractionDigits(2);
|
|
||||||
converter.setFormater(cost -> {
|
|
||||||
return "v" + cost.getVersion() + ", GM:" + numberInstance.format(cost.getGrossProfitMargin()) + "%";
|
|
||||||
});
|
|
||||||
converter.setSuggestion(searchText -> {
|
|
||||||
Project project = getViewModel().getProject().get();
|
|
||||||
if (project == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getProjectCostService().findAllByProject(project);
|
|
||||||
});
|
|
||||||
UITools.autoCompletion(textField, property, converter).setOnAutoCompleted(event -> {
|
|
||||||
property.set(event.getCompletion());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void evaluationFileAutoCompletion(TextField textField,
|
private void companyAutoCompletion(TextField textField, SimpleObjectProperty<Integer> property) {
|
||||||
SimpleObjectProperty<CompanyCustomerEvaluationFormFile> property) {
|
UITools.autoCompletion(textField, property, getCompanyService());
|
||||||
EntityStringConverter<CompanyCustomerEvaluationFormFile> converter = new EntityStringConverter<>();
|
|
||||||
converter.setInitialized(
|
|
||||||
formFile -> getCompanyCustomerFileService().findCustomerEvaluationFormFileById(formFile.getId()));
|
|
||||||
converter.setFormater(formFile -> {
|
|
||||||
CompanyCustomerFile customerFile = formFile.getCustomerFile();
|
|
||||||
if (customerFile == null) {
|
|
||||||
return "无";
|
|
||||||
}
|
|
||||||
File file = new File(customerFile.getFilePath());
|
|
||||||
return file.getName() + ", 等级:" + formFile.getCreditLevel();
|
|
||||||
});
|
|
||||||
converter.setSuggestion(searchText -> {
|
|
||||||
Project project = getViewModel().getProject().get();
|
|
||||||
if (project == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
Company company = project.getCustomer();
|
|
||||||
if (company == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
CompanyCustomer customer = getCompanyCustomerService().findByCompany(company);
|
|
||||||
if (customer == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getCompanyCustomerFileService().searchEvaluationFile(customer, searchText);
|
|
||||||
});
|
|
||||||
UITools.autoCompletion(textField, property, converter).setOnAutoCompleted(event -> {
|
|
||||||
CompanyCustomerEvaluationFormFile evaluationFile = event.getCompletion();
|
|
||||||
Integer creditLevel = evaluationFile.getCreditLevel();
|
|
||||||
viewModel.getLevel().set(creditLevel >= 4 ? 2 : creditLevel >= 2 ? 1 : 0);
|
|
||||||
property.set(evaluationFile);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void employeeAutoCompletion(TextField textField, SimpleObjectProperty<Employee> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getEmployeeStringConverter());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void companyAutoCompletion(TextField textField, SimpleObjectProperty<Company> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getCompanyStringConverter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectQuotationService getProjectQuotationService() {
|
private ProjectQuotationService getProjectQuotationService() {
|
||||||
@@ -511,4 +441,11 @@ public class ProjectBidTabSkinBase
|
|||||||
}
|
}
|
||||||
return customerFileService;
|
return customerFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CompanyCustomerEvaluationFormFileService getEvaluationFormFileService() {
|
||||||
|
if (evaluationFormFileService == null) {
|
||||||
|
evaluationFormFileService = getBean(CompanyCustomerEvaluationFormFileService.class);
|
||||||
|
}
|
||||||
|
return evaluationFormFileService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,27 @@
|
|||||||
package com.ecep.contract.controller.project.bid;
|
package com.ecep.contract.controller.project.bid;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectBid;
|
|
||||||
import com.ecep.contract.service.ProjectBidService;
|
import com.ecep.contract.service.ProjectBidService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.ProjectBidViewModel;
|
import com.ecep.contract.vm.ProjectBidViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectBidVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.RadioButton;
|
|
||||||
import javafx.scene.control.Tab;
|
|
||||||
import javafx.scene.control.TextArea;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import lombok.Setter;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/project-bid.fxml")
|
@FxmlPath("/ui/project/project-bid.fxml")
|
||||||
public class ProjectBidWindowController
|
public class ProjectBidWindowController
|
||||||
extends AbstEntityController<ProjectBid, ProjectBidViewModel> {
|
extends AbstEntityController<ProjectBidVo, ProjectBidViewModel> {
|
||||||
public BorderPane root;
|
public BorderPane root;
|
||||||
public Tab baseInfoTab;
|
public Tab baseInfoTab;
|
||||||
|
|
||||||
@@ -74,10 +65,8 @@ public class ProjectBidWindowController
|
|||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
Project project = viewModel.getProject().get();
|
Integer projectId = viewModel.getProject().get();
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目投标");
|
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目投标");
|
||||||
|
|
||||||
exportExcelBtn.setOnAction(this::onExportExcelAction);
|
exportExcelBtn.setOnAction(this::onExportExcelAction);
|
||||||
|
|||||||
@@ -26,30 +26,30 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import org.apache.poi.ss.util.CellAddress;
|
import org.apache.poi.ss.util.CellAddress;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.constant.ContractConstant;
|
import com.ecep.contract.constant.ContractConstant;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.ProductType;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectCost;
|
|
||||||
import com.ecep.contract.model.ProjectCostItem;
|
import com.ecep.contract.model.ProjectCostItem;
|
||||||
import com.ecep.contract.model.ProjectIndustry;
|
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.model.ProjectType;
|
|
||||||
import com.ecep.contract.service.ProductTypeService;
|
import com.ecep.contract.service.ProductTypeService;
|
||||||
import com.ecep.contract.service.ProjectCostItemService;
|
import com.ecep.contract.service.ProjectCostItemService;
|
||||||
import com.ecep.contract.service.ProjectCostService;
|
import com.ecep.contract.service.ProjectCostService;
|
||||||
import com.ecep.contract.service.ProjectIndustryService;
|
import com.ecep.contract.service.ProjectIndustryService;
|
||||||
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.service.ProjectTypeService;
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
|
||||||
import com.ecep.contract.task.Tasker;
|
import com.ecep.contract.task.Tasker;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
import com.ecep.contract.vo.ProductTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectCostItemVo;
|
||||||
|
import com.ecep.contract.vo.ProjectCostVo;
|
||||||
|
import com.ecep.contract.vo.ProjectIndustryVo;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectTypeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectCostExportExcelTasker.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectCostExportExcelTasker.class);
|
||||||
private String name = "成本核算审批表";
|
private String name = "成本核算审批表";
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectCost cost;
|
private ProjectCostVo cost;
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
@Setter
|
@Setter
|
||||||
@@ -102,11 +102,7 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Project project = cost.getProject();
|
ProjectVo project = getProjectService().findById(cost.getProject());
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
cost.setProject(project);
|
|
||||||
}
|
|
||||||
File dir = getProjectService().searchPath(project);
|
File dir = getProjectService().searchPath(project);
|
||||||
LocalDate thatDay = LocalDate.now();
|
LocalDate thatDay = LocalDate.now();
|
||||||
if (cost.getApplyTime() != null) {
|
if (cost.getApplyTime() != null) {
|
||||||
@@ -164,39 +160,28 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
|
|
||||||
private void updateProjectCost(Sheet sheet, MessageHolder holder) {
|
private void updateProjectCost(Sheet sheet, MessageHolder holder) {
|
||||||
updateTitle("更新 " + sheet.getSheetName() + " Sheet");
|
updateTitle("更新 " + sheet.getSheetName() + " Sheet");
|
||||||
Project project = cost.getProject();
|
ProjectVo project = getProjectService().findById(cost.getProject());
|
||||||
|
|
||||||
setCellValue(sheet, "C5", project.getName());
|
setCellValue(sheet, "C5", project.getName());
|
||||||
|
|
||||||
Company customer = project.getCustomer();
|
CompanyVo customer = getCompanyService().findById(project.getCustomerId());
|
||||||
if (customer != null) {
|
if (customer != null) {
|
||||||
if (!ProxyUtils.isInitialized(customer)) {
|
|
||||||
customer = getCompanyService().findById(customer.getId());
|
|
||||||
project.setCustomer(customer);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "C6", customer.getName());
|
setCellValue(sheet, "C6", customer.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "C6", "-");
|
setCellValue(sheet, "C6", "-");
|
||||||
}
|
}
|
||||||
setCellValue(sheet, "C7", project.getAddress());
|
setCellValue(sheet, "C7", project.getAddress());
|
||||||
|
|
||||||
ProjectType projectType = project.getProjectType();
|
|
||||||
|
ProjectTypeVo projectType = getBean(ProjectTypeService.class).findById(project.getProjectTypeId());
|
||||||
if (projectType != null) {
|
if (projectType != null) {
|
||||||
if (!ProxyUtils.isInitialized(projectType)) {
|
|
||||||
projectType = getBean(ProjectTypeService.class).findById(projectType.getId());
|
|
||||||
project.setProjectType(projectType);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "I5", projectType.getName());
|
setCellValue(sheet, "I5", projectType.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "I5", "");
|
setCellValue(sheet, "I5", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductType productType = project.getProductType();
|
ProductTypeVo productType = getBean(ProductTypeService.class).findById(project.getProductTypeId());
|
||||||
if (productType != null) {
|
if (productType != null) {
|
||||||
if (!ProxyUtils.isInitialized(productType)) {
|
|
||||||
productType = getBean(ProductTypeService.class).findById(productType.getId());
|
|
||||||
project.setProductType(productType);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "I6", productType.getName());
|
setCellValue(sheet, "I6", productType.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "I6", "");
|
setCellValue(sheet, "I6", "");
|
||||||
@@ -208,34 +193,22 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
setCellValue(sheet, "I7", project.getCreated());
|
setCellValue(sheet, "I7", project.getCreated());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectSaleType saleType = project.getSaleType();
|
ProjectSaleTypeVo saleType = getBean(ProjectSaleTypeService.class).findById(project.getSaleTypeId());
|
||||||
if (saleType != null) {
|
if (saleType != null) {
|
||||||
if (!ProxyUtils.isInitialized(saleType)) {
|
|
||||||
saleType = getBean(ProjectSaleTypeService.class).findById(saleType.getId());
|
|
||||||
project.setSaleType(saleType);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "M5", saleType.getName());
|
setCellValue(sheet, "M5", saleType.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "M5", "");
|
setCellValue(sheet, "M5", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectIndustry industry = project.getIndustry();
|
ProjectIndustryVo industry = getBean(ProjectIndustryService.class).findById(project.getIndustryId());
|
||||||
if (industry != null) {
|
if (industry != null) {
|
||||||
if (!ProxyUtils.isInitialized(industry)) {
|
|
||||||
industry = getBean(ProjectIndustryService.class).findById(industry.getId());
|
|
||||||
project.setIndustry(industry);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "M6", industry.getName());
|
setCellValue(sheet, "M6", industry.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "M6", "");
|
setCellValue(sheet, "M6", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Employee applicant = project.getApplicant();
|
EmployeeVo applicant = getEmployeeService().findById(project.getApplicantId());
|
||||||
if (applicant != null) {
|
if (applicant != null) {
|
||||||
if (!ProxyUtils.isInitialized(applicant)) {
|
|
||||||
applicant = getEmployeeService().findById(applicant.getId());
|
|
||||||
project.setApplicant(applicant);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "M7", applicant.getName());
|
setCellValue(sheet, "M7", applicant.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "M7", "");
|
setCellValue(sheet, "M7", "");
|
||||||
@@ -244,7 +217,7 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
setCellValue(sheet, "D39", cost.getStampTax() / 100);
|
setCellValue(sheet, "D39", cost.getStampTax() / 100);
|
||||||
setCellValue(sheet, "D40", cost.getTaxAndSurcharges() / 100);
|
setCellValue(sheet, "D40", cost.getTaxAndSurcharges() / 100);
|
||||||
|
|
||||||
List<ProjectCostItem> items = getItemService().findByCost(cost);
|
List<ProjectCostItemVo> items = getBean(ProjectCostItemService.class).findByCost(cost);
|
||||||
if (items.size() > 27) {
|
if (items.size() > 27) {
|
||||||
holder.warn("读取到 " + items.size() + " 行, 超出最大行数27行,已截断导出到附加表中");
|
holder.warn("读取到 " + items.size() + " 行, 超出最大行数27行,已截断导出到附加表中");
|
||||||
int row = 10;
|
int row = 10;
|
||||||
@@ -276,13 +249,13 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
ProjectCostItem item = items.get(i);
|
ProjectCostItemVo item = items.get(i);
|
||||||
int row = 10 + i;
|
int row = 10 + i;
|
||||||
drawRow(sheet, row, item);
|
drawRow(sheet, row, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeItem2Detail(Sheet sheet, List<ProjectCostItem> items, MessageHolder holder) {
|
private void writeItem2Detail(Sheet sheet, List<ProjectCostItemVo> items, MessageHolder holder) {
|
||||||
Sheet detailSheet = findSheetByNameContains(sheet.getWorkbook(), "附加表");
|
Sheet detailSheet = findSheetByNameContains(sheet.getWorkbook(), "附加表");
|
||||||
if (detailSheet == null) {
|
if (detailSheet == null) {
|
||||||
detailSheet = sheet.getWorkbook().createSheet("附加表");
|
detailSheet = sheet.getWorkbook().createSheet("附加表");
|
||||||
@@ -366,7 +339,7 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
ProjectCostItem item = items.get(i);
|
ProjectCostItemVo item = items.get(i);
|
||||||
int rowIndex = 3 + i;
|
int rowIndex = 3 + i;
|
||||||
Row theRow = getRow(detailSheet, rowIndex, true);
|
Row theRow = getRow(detailSheet, rowIndex, true);
|
||||||
if (theRow == null) {
|
if (theRow == null) {
|
||||||
@@ -510,7 +483,7 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawRow(Sheet sheet, int row, ProjectCostItem item) {
|
void drawRow(Sheet sheet, int row, ProjectCostItemVo item) {
|
||||||
setCellValue(sheet, row, 0, item.getTitle());
|
setCellValue(sheet, row, 0, item.getTitle());
|
||||||
setCellValue(sheet, row, 2, item.getSpecification());
|
setCellValue(sheet, row, 2, item.getSpecification());
|
||||||
setCellValue(sheet, row, 3, item.getInQuantity());
|
setCellValue(sheet, row, 3, item.getInQuantity());
|
||||||
@@ -521,7 +494,7 @@ public class ProjectCostExportExcelTasker extends Tasker<Object> {
|
|||||||
setCellValue(sheet, row, 10, item.getOutTaxRate() / 100);
|
setCellValue(sheet, row, 10, item.getOutTaxRate() / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawDetailRow(Row row, ProjectCostItem item) {
|
void drawDetailRow(Row row, ProjectCostItemVo item) {
|
||||||
|
|
||||||
setCellValue(row, 0, item.getTitle());
|
setCellValue(row, 0, item.getTitle());
|
||||||
setCellValue(row, 1, item.getSpecification());
|
setCellValue(row, 1, item.getSpecification());
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package com.ecep.contract.controller.project.cost;
|
|||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.WebSocketClientTasker;
|
import com.ecep.contract.WebSocketClientTasker;
|
||||||
import com.ecep.contract.model.ProjectCost;
|
|
||||||
import com.ecep.contract.task.Tasker;
|
import com.ecep.contract.task.Tasker;
|
||||||
|
import com.ecep.contract.vo.ProjectCostVo;
|
||||||
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +12,7 @@ import lombok.Setter;
|
|||||||
*/
|
*/
|
||||||
public class ProjectCostImportItemsFromContractsTasker extends Tasker<Object> implements WebSocketClientTasker {
|
public class ProjectCostImportItemsFromContractsTasker extends Tasker<Object> implements WebSocketClientTasker {
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectCost cost;
|
private ProjectCostVo cost;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object execute(MessageHolder holder) throws Exception {
|
protected Object execute(MessageHolder holder) throws Exception {
|
||||||
|
|||||||
@@ -9,23 +9,21 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ContractFile;
|
import com.ecep.contract.model.ContractFile;
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectCost;
|
|
||||||
import com.ecep.contract.service.ContractFileService;
|
import com.ecep.contract.service.ContractFileService;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ProjectCostViewModel;
|
import com.ecep.contract.vm.ProjectCostViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractFileVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
import com.ecep.contract.vo.ProjectCostVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -37,7 +35,7 @@ import javafx.util.converter.NumberStringConverter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class ProjectCostTabSkinBase
|
public class ProjectCostTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<ProjectCostWindowController, ProjectCost, ProjectCostViewModel>
|
extends AbstEntityBasedTabSkin<ProjectCostWindowController, ProjectCostVo, ProjectCostViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@Setter
|
@Setter
|
||||||
LocalDateTimeStringConverter localDateTimeStringConverter;
|
LocalDateTimeStringConverter localDateTimeStringConverter;
|
||||||
@@ -113,14 +111,8 @@ public class ProjectCostTabSkinBase
|
|||||||
controller.outExclusiveTaxAmountField.textProperty().bindBidirectional(viewModel.getOutExclusiveTaxAmount(),
|
controller.outExclusiveTaxAmountField.textProperty().bindBidirectional(viewModel.getOutExclusiveTaxAmount(),
|
||||||
currencyStringConverter);
|
currencyStringConverter);
|
||||||
|
|
||||||
EmployeeStringConverter employeeStringConverter = getBean(EmployeeStringConverter.class);
|
UITools.autoCompletion(controller.applicantField, viewModel.getApplicant(), controller.getEmployeeService());
|
||||||
// controller.applicantField.textProperty().bindBidirectional(viewModel.getApplicant(),
|
UITools.autoCompletion(controller.authorizerField, viewModel.getAuthorizer(), controller.getEmployeeService());
|
||||||
// employeeStringConverter);
|
|
||||||
// controller.authorizerField.textProperty().bindBidirectional(viewModel.getAuthorizer(),
|
|
||||||
// employeeStringConverter);
|
|
||||||
|
|
||||||
UITools.autoCompletion(controller.applicantField, viewModel.getApplicant(), employeeStringConverter);
|
|
||||||
UITools.autoCompletion(controller.authorizerField, viewModel.getAuthorizer(), employeeStringConverter);
|
|
||||||
|
|
||||||
LocalDateTimeStringConverter converter = getLocalDateTimeStringConverter();
|
LocalDateTimeStringConverter converter = getLocalDateTimeStringConverter();
|
||||||
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(), converter);
|
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(), converter);
|
||||||
@@ -139,11 +131,9 @@ public class ProjectCostTabSkinBase
|
|||||||
FileChooser fileChooser = new FileChooser();
|
FileChooser fileChooser = new FileChooser();
|
||||||
File file = viewModel.getAuthorizationFile().get();
|
File file = viewModel.getAuthorizationFile().get();
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
Project project = viewModel.getProject().get();
|
Integer projectId = viewModel.getProject().get();
|
||||||
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
File path = getProjectService().searchPath(project);
|
File path = getProjectService().searchPath(project);
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
fileChooser.setInitialDirectory(path);
|
fileChooser.setInitialDirectory(path);
|
||||||
@@ -160,25 +150,26 @@ public class ProjectCostTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tryGetAuthorizationFile() {
|
private void tryGetAuthorizationFile() {
|
||||||
Project project = getViewModel().getProject().get();
|
Integer projectId = viewModel.getProject().get();
|
||||||
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContractService contractService = getBean(ContractService.class);
|
ContractService contractService = getBean(ContractService.class);
|
||||||
Contract contract = contractService.findSalesByProject(project);
|
ContractVo contract = contractService.findSalesByProject(project);
|
||||||
if (contract == null) {
|
if (contract == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContractFileService contractFileService = getBean(ContractFileService.class);
|
ContractFileService contractFileService = getBean(ContractFileService.class);
|
||||||
List<ContractFile> list = contractFileService.findAllByContractAndFileType(contract, ContractFileType.CostForm);
|
List<ContractFileVo> list = contractFileService.findAllByContractAndFileType(contract, ContractFileType.CostForm);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContractFile contractFile = list.stream()
|
ContractFileVo contractFile = list.stream()
|
||||||
.max(Comparator.comparing(ContractFile::getApplyDate, Comparator.nullsLast(Comparator.naturalOrder())))
|
.max(Comparator.comparing(ContractFileVo::getApplyDate, Comparator.nullsLast(Comparator.naturalOrder())))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
if (contractFile.getApplyDate() != null && getViewModel().getAuthorizationTime().get() == null) {
|
if (contractFile.getApplyDate() != null && getViewModel().getAuthorizationTime().get() == null) {
|
||||||
|
|||||||
@@ -2,56 +2,48 @@ package com.ecep.contract.controller.project.cost;
|
|||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
|
||||||
import org.controlsfx.control.textfield.TextFields;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import com.ecep.contract.Desktop;
|
import com.ecep.contract.Desktop;
|
||||||
import com.ecep.contract.controller.inventory.InventoryWindowController;
|
import com.ecep.contract.controller.inventory.InventoryWindowController;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
|
import com.ecep.contract.controller.table.cell.InventoryAutoCompletionTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.Inventory;
|
|
||||||
import com.ecep.contract.model.Price;
|
import com.ecep.contract.model.Price;
|
||||||
import com.ecep.contract.model.ProjectCost;
|
|
||||||
import com.ecep.contract.model.ProjectCostItem;
|
|
||||||
import com.ecep.contract.service.ContractItemService;
|
import com.ecep.contract.service.ContractItemService;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.service.InventoryService;
|
import com.ecep.contract.service.InventoryService;
|
||||||
import com.ecep.contract.service.ProjectCostItemService;
|
import com.ecep.contract.service.ProjectCostItemService;
|
||||||
import com.ecep.contract.service.ProjectCostService;
|
import com.ecep.contract.service.ProjectCostService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.InventoryViewModel;
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
import com.ecep.contract.vm.ProjectCostItemViewModel;
|
import com.ecep.contract.vm.ProjectCostItemViewModel;
|
||||||
import com.ecep.contract.vm.ProjectCostViewModel;
|
import com.ecep.contract.vm.ProjectCostViewModel;
|
||||||
|
import com.ecep.contract.vo.InventoryVo;
|
||||||
|
import com.ecep.contract.vo.ProjectCostItemVo;
|
||||||
|
import com.ecep.contract.vo.ProjectCostVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Cell;
|
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.SelectionMode;
|
import javafx.scene.control.SelectionMode;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableCell;
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.ToggleButton;
|
import javafx.scene.control.ToggleButton;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import javafx.scene.input.KeyCode;
|
|
||||||
import javafx.util.converter.CurrencyStringConverter;
|
import javafx.util.converter.CurrencyStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import javafx.util.converter.PercentageStringConverter;
|
import javafx.util.converter.PercentageStringConverter;
|
||||||
@@ -60,7 +52,7 @@ import lombok.Setter;
|
|||||||
@FxmlPath("/ui/project/project-cost-tab-item.fxml")
|
@FxmlPath("/ui/project/project-cost-tab-item.fxml")
|
||||||
public class ProjectCostTabSkinItems
|
public class ProjectCostTabSkinItems
|
||||||
extends
|
extends
|
||||||
AbstEntityTableTabSkin<ProjectCostWindowController, ProjectCost, ProjectCostViewModel, ProjectCostItem, ProjectCostItemViewModel>
|
AbstEntityTableTabSkin<ProjectCostWindowController, ProjectCostVo, ProjectCostViewModel, ProjectCostItemVo, ProjectCostItemViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public TableColumn<ProjectCostItemViewModel, Number> idColumn;
|
public TableColumn<ProjectCostItemViewModel, Number> idColumn;
|
||||||
@@ -81,12 +73,18 @@ public class ProjectCostTabSkinItems
|
|||||||
public TableColumn<ProjectCostItemViewModel, Number> outTaxAmountColumn;
|
public TableColumn<ProjectCostItemViewModel, Number> outTaxAmountColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, Number> grossProfitColumn;
|
public TableColumn<ProjectCostItemViewModel, Number> grossProfitColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, Number> grossProfitMarginColumn;
|
public TableColumn<ProjectCostItemViewModel, Number> grossProfitMarginColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, Employee> creatorColumn;
|
/**
|
||||||
|
* 创建人, Employee
|
||||||
|
*/
|
||||||
|
public TableColumn<ProjectCostItemViewModel, Integer> creatorColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, LocalDateTime> createDateColumn;
|
public TableColumn<ProjectCostItemViewModel, LocalDateTime> createDateColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, Employee> updaterColumn;
|
/**
|
||||||
|
* 修改人, Employee
|
||||||
|
*/
|
||||||
|
public TableColumn<ProjectCostItemViewModel, Integer> updaterColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, LocalDateTime> updateDateColumn;
|
public TableColumn<ProjectCostItemViewModel, LocalDateTime> updateDateColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, String> remarkColumn;
|
public TableColumn<ProjectCostItemViewModel, String> remarkColumn;
|
||||||
public TableColumn<ProjectCostItemViewModel, Inventory> inventoryColumn;
|
public TableColumn<ProjectCostItemViewModel, Integer> inventoryColumn;
|
||||||
|
|
||||||
public Button importFromSalesContractBtn;
|
public Button importFromSalesContractBtn;
|
||||||
public ToggleButton lockPriceMethodBtn;
|
public ToggleButton lockPriceMethodBtn;
|
||||||
@@ -154,118 +152,15 @@ public class ProjectCostTabSkinItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProjectCostItemViewModel> loadTableData(ProjectCost parent) {
|
public List<ProjectCostItemViewModel> loadTableData(ProjectCostVo parent) {
|
||||||
List<ProjectCostItemViewModel> models = super.loadTableData(parent);
|
List<ProjectCostItemViewModel> models = super.loadTableData(parent);
|
||||||
Platform.runLater(() -> up(models));
|
Platform.runLater(() -> up(models));
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(ProjectCost parent) {
|
public ParamUtils.Builder getSpecification(ProjectCostVo parent) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
return ParamUtils.builder().equals("cost", parent);
|
||||||
params.put("cost", parent);
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
static class AutoCompletionInventoryTableCell extends TableCell<ProjectCostItemViewModel, Inventory> {
|
|
||||||
private TextField textField;
|
|
||||||
@Setter
|
|
||||||
private EntityStringConverter<Inventory> converter;
|
|
||||||
|
|
||||||
public AutoCompletionInventoryTableCell() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public AutoCompletionInventoryTableCell(EntityStringConverter<Inventory> converter) {
|
|
||||||
this();
|
|
||||||
this.converter = converter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startEdit() {
|
|
||||||
super.startEdit();
|
|
||||||
if (!isEditing()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (textField == null) {
|
|
||||||
textField = createTextField(this, converter);
|
|
||||||
AutoCompletionBinding<Inventory> binding = TextFields.bindAutoCompletion(textField, converter::suggest,
|
|
||||||
converter);
|
|
||||||
binding.setOnAutoCompleted(event -> {
|
|
||||||
commitEdit(event.getCompletion());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
startEdit(this, converter, textField);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void cancelEdit() {
|
|
||||||
super.cancelEdit();
|
|
||||||
cancelEdit(this, converter, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateItem(Inventory item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
if (empty || item == null) {
|
|
||||||
setText("");
|
|
||||||
setGraphic(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isEditing()) {
|
|
||||||
if (textField != null) {
|
|
||||||
textField.setText(getItemText(this, converter));
|
|
||||||
}
|
|
||||||
setText(null);
|
|
||||||
setGraphic(textField);
|
|
||||||
} else {
|
|
||||||
setText(getItemText(this, converter));
|
|
||||||
setGraphic(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getItemText(Cell<Inventory> cell, EntityStringConverter<Inventory> converter) {
|
|
||||||
Inventory inventory = converter.prefixObject(cell.getItem());
|
|
||||||
return inventory == null ? "-"
|
|
||||||
: StringUtils.hasText(inventory.getCode()) ? inventory.getCode() : ("#" + inventory.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
static TextField createTextField(final Cell<Inventory> cell, final EntityStringConverter<Inventory> converter) {
|
|
||||||
final TextField textField = new TextField(getItemText(cell, converter));
|
|
||||||
textField.setOnKeyReleased(t -> {
|
|
||||||
if (t.getCode() == KeyCode.ESCAPE) {
|
|
||||||
cell.cancelEdit();
|
|
||||||
t.consume();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (t.getCode() == KeyCode.ENTER) {
|
|
||||||
cell.commitEdit(converter.fromString(textField.getText()));
|
|
||||||
t.consume();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return textField;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void startEdit(final Cell<Inventory> cell,
|
|
||||||
final EntityStringConverter<Inventory> converter,
|
|
||||||
final TextField textField) {
|
|
||||||
if (textField != null) {
|
|
||||||
textField.setText(getItemText(cell, converter));
|
|
||||||
}
|
|
||||||
cell.setText(null);
|
|
||||||
cell.setGraphic(textField);
|
|
||||||
textField.selectAll();
|
|
||||||
// requesting focus so that key input can immediately go into the
|
|
||||||
// TextField (see RT-28132)
|
|
||||||
textField.requestFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cancelEdit(Cell<Inventory> cell, final EntityStringConverter<Inventory> converter, Node graphic) {
|
|
||||||
cell.setText(getItemText(cell, converter));
|
|
||||||
cell.setGraphic(graphic);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -319,18 +214,11 @@ public class ProjectCostTabSkinItems
|
|||||||
unitColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
unitColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
unitColumn.setOnEditCommit(event -> changed(event, ProjectCostItemViewModel::getUnit));
|
unitColumn.setOnEditCommit(event -> changed(event, ProjectCostItemViewModel::getUnit));
|
||||||
|
|
||||||
EntityStringConverter<Inventory> converter = new EntityStringConverter<>();
|
inventoryColumn.setCellValueFactory(param -> param.getValue().getInventoryId());
|
||||||
converter.setInitialized(v -> getInventoryService().findById(v.getId()));
|
inventoryColumn.setCellFactory(InventoryAutoCompletionTableCell.forTableColumn(getInventoryService()));
|
||||||
converter.setSuggestion(getInventoryService()::search);
|
|
||||||
// converter.setFormater(Inventory::getCode);
|
|
||||||
converter.setFromString(code -> {
|
|
||||||
return getInventoryService().findByCode(code);
|
|
||||||
});
|
|
||||||
inventoryColumn.setCellValueFactory(param -> param.getValue().getInventory());
|
|
||||||
inventoryColumn.setCellFactory(param -> new AutoCompletionInventoryTableCell(converter));
|
|
||||||
|
|
||||||
inventoryColumn.comparatorProperty()
|
// inventoryColumn.comparatorProperty()
|
||||||
.set(Comparator.comparing(converter::toString, Comparator.nullsLast(Comparator.naturalOrder())));
|
// .set(Comparator.comparing(converter::toString, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||||
inventoryColumn.setOnEditCommit(this::inventoryColumnEditCommit);
|
inventoryColumn.setOnEditCommit(this::inventoryColumnEditCommit);
|
||||||
|
|
||||||
initializeNumberColumn(inQuantityColumn, ProjectCostItemViewModel::getInQuantity);
|
initializeNumberColumn(inQuantityColumn, ProjectCostItemViewModel::getInQuantity);
|
||||||
@@ -447,9 +335,9 @@ public class ProjectCostTabSkinItems
|
|||||||
.setCellFactory(TextFieldTableCell.forTableColumn(new PercentageStringConverter(getLocale())));
|
.setCellFactory(TextFieldTableCell.forTableColumn(new PercentageStringConverter(getLocale())));
|
||||||
grossProfitMarginColumn.setEditable(false);
|
grossProfitMarginColumn.setEditable(false);
|
||||||
|
|
||||||
creatorColumn.setCellValueFactory(param -> param.getValue().getCreator());
|
creatorColumn.setCellValueFactory(param -> param.getValue().getCreatorId());
|
||||||
creatorColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService()));
|
creatorColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService()));
|
||||||
updaterColumn.setCellValueFactory(param -> param.getValue().getUpdater());
|
updaterColumn.setCellValueFactory(param -> param.getValue().getUpdaterId());
|
||||||
updaterColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService()));
|
updaterColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService()));
|
||||||
createDateColumn.setCellValueFactory(param -> param.getValue().getCreateDate());
|
createDateColumn.setCellValueFactory(param -> param.getValue().getCreateDate());
|
||||||
createDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
createDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||||
@@ -465,10 +353,12 @@ public class ProjectCostTabSkinItems
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inventoryColumnEditCommit(TableColumn.CellEditEvent<ProjectCostItemViewModel, Inventory> event) {
|
private void inventoryColumnEditCommit(TableColumn.CellEditEvent<ProjectCostItemViewModel, Integer> event) {
|
||||||
ProjectCostItemViewModel row = event.getRowValue();
|
ProjectCostItemViewModel row = event.getRowValue();
|
||||||
Inventory inventory = event.getNewValue();
|
Integer inventoryId = event.getNewValue();
|
||||||
row.getInventory().set(inventory);
|
row.getInventoryId().set(inventoryId);
|
||||||
|
if (inventoryId != null) {
|
||||||
|
InventoryVo inventory = getInventoryService().findById(inventoryId);
|
||||||
if (inventory != null) {
|
if (inventory != null) {
|
||||||
row.getTitle().set(inventory.getName());
|
row.getTitle().set(inventory.getName());
|
||||||
row.getSpecification().set(inventory.getSpecification());
|
row.getSpecification().set(inventory.getSpecification());
|
||||||
@@ -498,6 +388,7 @@ public class ProjectCostTabSkinItems
|
|||||||
}
|
}
|
||||||
row.updateOut();
|
row.updateOut();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
changed(row);
|
changed(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,12 +414,13 @@ public class ProjectCostTabSkinItems
|
|||||||
MenuItem showInventory = new MenuItem("查看存货");
|
MenuItem showInventory = new MenuItem("查看存货");
|
||||||
showInventory.setOnAction(event -> {
|
showInventory.setOnAction(event -> {
|
||||||
ProjectCostItemViewModel selectedItem = getTableView().getSelectionModel().getSelectedItem();
|
ProjectCostItemViewModel selectedItem = getTableView().getSelectionModel().getSelectedItem();
|
||||||
Inventory inventory = selectedItem.getInventory().get();
|
Integer inventoryId = selectedItem.getInventoryId().get();
|
||||||
if (inventory == null) {
|
if (inventoryId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(inventory)) {
|
InventoryVo inventory = getInventoryService().findById(inventoryId);
|
||||||
inventory = getInventoryService().findById(inventory.getId());
|
if (inventory == null) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
showInOwner(InventoryWindowController.class, InventoryViewModel.from(inventory));
|
showInOwner(InventoryWindowController.class, InventoryViewModel.from(inventory));
|
||||||
});
|
});
|
||||||
@@ -539,8 +431,8 @@ public class ProjectCostTabSkinItems
|
|||||||
showInventory.setDisable(true);
|
showInventory.setDisable(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Inventory inventory = selectedItem.getInventory().get();
|
Integer inventoryId = selectedItem.getInventoryId().get();
|
||||||
if (inventory == null) {
|
if (inventoryId == null) {
|
||||||
showInventory.setDisable(true);
|
showInventory.setDisable(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -559,6 +451,8 @@ public class ProjectCostTabSkinItems
|
|||||||
List<ProjectCostItemViewModel> selectedItems = new ArrayList<>(
|
List<ProjectCostItemViewModel> selectedItems = new ArrayList<>(
|
||||||
getTableView().getSelectionModel().getSelectedItems());
|
getTableView().getSelectionModel().getSelectedItems());
|
||||||
|
|
||||||
|
int activeEmployeeId = Desktop.instance.getActiveEmployeeId();
|
||||||
|
|
||||||
double inQuantity = selectedItems.stream().mapToDouble(v -> v.getInQuantity().get()).sum();
|
double inQuantity = selectedItems.stream().mapToDouble(v -> v.getInQuantity().get()).sum();
|
||||||
double inAmount = selectedItems.stream().mapToDouble(v -> v.getInTaxAmount().get()).sum();
|
double inAmount = selectedItems.stream().mapToDouble(v -> v.getInTaxAmount().get()).sum();
|
||||||
double inPrice = inQuantity != 0 ? inAmount / inQuantity : 0;
|
double inPrice = inQuantity != 0 ? inAmount / inQuantity : 0;
|
||||||
@@ -570,7 +464,7 @@ public class ProjectCostTabSkinItems
|
|||||||
model.updateInTaxPrice(inPrice);
|
model.updateInTaxPrice(inPrice);
|
||||||
model.getOutQuantity().set(outQuantity);
|
model.getOutQuantity().set(outQuantity);
|
||||||
model.updateOutTaxPrice(outPrice);
|
model.updateOutTaxPrice(outPrice);
|
||||||
model.getUpdater().set(controller.getCurrentUser());
|
model.getUpdaterId().set(activeEmployeeId);
|
||||||
model.getUpdateDate().set(LocalDateTime.now());
|
model.getUpdateDate().set(LocalDateTime.now());
|
||||||
// saveRow(model);
|
// saveRow(model);
|
||||||
|
|
||||||
@@ -583,7 +477,7 @@ public class ProjectCostTabSkinItems
|
|||||||
}
|
}
|
||||||
selectedItem.updateInQuantity(0);
|
selectedItem.updateInQuantity(0);
|
||||||
selectedItem.updateOutQuantity(0);
|
selectedItem.updateOutQuantity(0);
|
||||||
selectedItem.getUpdater().set(controller.getCurrentUser());
|
selectedItem.getUpdaterId().set(activeEmployeeId);
|
||||||
selectedItem.getUpdateDate().set(LocalDateTime.now());
|
selectedItem.getUpdateDate().set(LocalDateTime.now());
|
||||||
selectedItem.getRemark().set("del");
|
selectedItem.getRemark().set("del");
|
||||||
// saveRow(selectedItem);
|
// saveRow(selectedItem);
|
||||||
@@ -594,9 +488,9 @@ public class ProjectCostTabSkinItems
|
|||||||
@Override
|
@Override
|
||||||
protected ProjectCostItemViewModel createNewViewModel() {
|
protected ProjectCostItemViewModel createNewViewModel() {
|
||||||
ProjectCostItemViewModel model = super.createNewViewModel();
|
ProjectCostItemViewModel model = super.createNewViewModel();
|
||||||
ProjectCost projectCost = getParent();
|
ProjectCostVo projectCost = getParent();
|
||||||
model.getCost().set(projectCost);
|
model.getCostId().set(projectCost.getId());
|
||||||
model.getCreator().set(getEmployeeService().findById(Desktop.instance.getActiveEmployeeId()));
|
model.getCreatorId().set(Desktop.instance.getActiveEmployeeId());
|
||||||
model.getCreateDate().set(LocalDateTime.now());
|
model.getCreateDate().set(LocalDateTime.now());
|
||||||
saveRow(model);
|
saveRow(model);
|
||||||
return model;
|
return model;
|
||||||
@@ -612,14 +506,14 @@ public class ProjectCostTabSkinItems
|
|||||||
|
|
||||||
// 批量保存(内部可能需要优化为真正的批量操作)
|
// 批量保存(内部可能需要优化为真正的批量操作)
|
||||||
for (ProjectCostItemViewModel row : changedRows) {
|
for (ProjectCostItemViewModel row : changedRows) {
|
||||||
ProjectCostItem entity = loadRowData(row);
|
ProjectCostItemVo entity = loadRowData(row);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = createNewEntity(row);
|
entity = createNewEntity(row);
|
||||||
}
|
}
|
||||||
if (row.copyTo(entity)) {
|
if (row.copyTo(entity)) {
|
||||||
entity.setUpdater(controller.getCurrentUser());
|
entity.setUpdaterId(Desktop.instance.getActiveEmployeeId());
|
||||||
entity.setUpdateDate(LocalDateTime.now());
|
entity.setUpdateDate(LocalDateTime.now());
|
||||||
ProjectCostItem saved = saveRowData(entity);
|
ProjectCostItemVo saved = saveRowData(entity);
|
||||||
row.update(saved);
|
row.update(saved);
|
||||||
}
|
}
|
||||||
if (row.isChanged()) {
|
if (row.isChanged()) {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.ecep.contract.controller.project.cost;
|
package com.ecep.contract.controller.project.cost;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
|
import com.ecep.contract.vo.ProjectCostVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -30,7 +32,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/project-cost.fxml")
|
@FxmlPath("/ui/project/project-cost.fxml")
|
||||||
public class ProjectCostWindowController
|
public class ProjectCostWindowController
|
||||||
extends AbstEntityController<ProjectCost, ProjectCostViewModel> {
|
extends AbstEntityController<ProjectCostVo, ProjectCostViewModel> {
|
||||||
public BorderPane root;
|
public BorderPane root;
|
||||||
public Tab baseInfoTab;
|
public Tab baseInfoTab;
|
||||||
public Tab itemTab;
|
public Tab itemTab;
|
||||||
@@ -64,7 +66,7 @@ public class ProjectCostWindowController
|
|||||||
public Button exportExcelBtn;
|
public Button exportExcelBtn;
|
||||||
public Button importExcelBtn;
|
public Button importExcelBtn;
|
||||||
|
|
||||||
public static void show(ProjectCost cost, Window window) {
|
public static void show(ProjectCostVo cost, Window window) {
|
||||||
ProjectCostViewModel model = new ProjectCostViewModel();
|
ProjectCostViewModel model = new ProjectCostViewModel();
|
||||||
model.update(cost);
|
model.update(cost);
|
||||||
show(ProjectCostWindowController.class, model, window);
|
show(ProjectCostWindowController.class, model, window);
|
||||||
@@ -74,10 +76,8 @@ public class ProjectCostWindowController
|
|||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
root.getScene().getStylesheets().add("/ui/project/comm.css");
|
root.getScene().getStylesheets().add("/ui/project/comm.css");
|
||||||
Project project = viewModel.getProject().get();
|
Integer projectId = viewModel.getProject().get();
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目成本 Ver:"
|
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目成本 Ver:"
|
||||||
+ viewModel.getVersion().getValue() + " ");
|
+ viewModel.getVersion().getValue() + " ");
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,16 @@ package com.ecep.contract.controller.project.industry;
|
|||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.ProjectIndustry;
|
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.vm.ProjectIndustryViewModel;
|
import com.ecep.contract.vm.ProjectIndustryViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectIndustryVo;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
public class ProjectIndustryManagerSkin
|
public class ProjectIndustryManagerSkin
|
||||||
extends AbstEntityManagerSkin<ProjectIndustry, ProjectIndustryViewModel, ProjectIndustryManagerSkin, ProjectIndustryManagerWindowController>
|
extends AbstEntityManagerSkin<ProjectIndustryVo, ProjectIndustryViewModel, ProjectIndustryManagerSkin, ProjectIndustryManagerWindowController>
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<ProjectIndustry, ProjectIndustryViewModel> {
|
implements ManagerSkin, EditableEntityTableTabSkin<ProjectIndustryVo, ProjectIndustryViewModel> {
|
||||||
@Setter
|
|
||||||
private ProjectService projectService;
|
|
||||||
|
|
||||||
public ProjectIndustryManagerSkin(ProjectIndustryManagerWindowController controller) {
|
public ProjectIndustryManagerSkin(ProjectIndustryManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
@@ -55,9 +51,6 @@ public class ProjectIndustryManagerSkin
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ProjectService getProjectService() {
|
public ProjectService getProjectService() {
|
||||||
if (projectService == null) {
|
return getBean(ProjectService.class);
|
||||||
projectService = getBean(ProjectService.class);
|
|
||||||
}
|
|
||||||
return projectService;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.ProjectIndustry;
|
|
||||||
import com.ecep.contract.service.ProjectIndustryService;
|
import com.ecep.contract.service.ProjectIndustryService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.ProjectIndustryViewModel;
|
import com.ecep.contract.vm.ProjectIndustryViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectIndustryVo;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
@@ -22,10 +21,8 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/used-industry-manager.fxml")
|
@FxmlPath("/ui/project/used-industry-manager.fxml")
|
||||||
public class ProjectIndustryManagerWindowController
|
public class ProjectIndustryManagerWindowController
|
||||||
extends AbstManagerWindowController<ProjectIndustry, ProjectIndustryViewModel, ProjectIndustryManagerSkin> {
|
extends AbstManagerWindowController<ProjectIndustryVo, ProjectIndustryViewModel, ProjectIndustryManagerSkin> {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ProjectService projectService;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectIndustryService projectIndustryService;
|
private ProjectIndustryService projectIndustryService;
|
||||||
|
|
||||||
@@ -45,7 +42,6 @@ public class ProjectIndustryManagerWindowController
|
|||||||
@Override
|
@Override
|
||||||
protected ProjectIndustryManagerSkin createDefaultSkin() {
|
protected ProjectIndustryManagerSkin createDefaultSkin() {
|
||||||
ProjectIndustryManagerSkin skin = new ProjectIndustryManagerSkin(this);
|
ProjectIndustryManagerSkin skin = new ProjectIndustryManagerSkin(this);
|
||||||
skin.setProjectService(projectService);
|
|
||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ package com.ecep.contract.controller.project.product_type;
|
|||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.ProductType;
|
import com.ecep.contract.vo.ProductTypeVo;
|
||||||
import com.ecep.contract.vm.ProductTypeViewModel;
|
import com.ecep.contract.vm.ProductTypeViewModel;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
|
|
||||||
public class ProductTypeManagerSkin
|
public class ProductTypeManagerSkin
|
||||||
extends AbstEntityManagerSkin<ProductType, ProductTypeViewModel, ProductTypeManagerSkin, ProductTypeManagerWindowController>
|
extends AbstEntityManagerSkin<ProductTypeVo, ProductTypeViewModel, ProductTypeManagerSkin, ProductTypeManagerWindowController>
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<ProductType, ProductTypeViewModel> {
|
implements ManagerSkin, EditableEntityTableTabSkin<ProductTypeVo, ProductTypeViewModel> {
|
||||||
|
|
||||||
public ProductTypeManagerSkin(ProductTypeManagerWindowController controller) {
|
public ProductTypeManagerSkin(ProductTypeManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.ProductType;
|
|
||||||
import com.ecep.contract.service.ProductTypeService;
|
import com.ecep.contract.service.ProductTypeService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.ProductTypeViewModel;
|
import com.ecep.contract.vm.ProductTypeViewModel;
|
||||||
|
import com.ecep.contract.vo.ProductTypeVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -24,7 +24,7 @@ import javafx.stage.Stage;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/product-type-manager.fxml")
|
@FxmlPath("/ui/project/product-type-manager.fxml")
|
||||||
public class ProductTypeManagerWindowController extends AbstManagerWindowController<ProductType, ProductTypeViewModel, ProductTypeManagerSkin> {
|
public class ProductTypeManagerWindowController extends AbstManagerWindowController<ProductTypeVo, ProductTypeViewModel, ProductTypeManagerSkin> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProductTypeManagerWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProductTypeManagerWindowController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ecep.contract.controller.project.project_type;
|
|||||||
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.ProjectType;
|
import com.ecep.contract.vo.ProjectTypeVo;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.service.ProjectTypeService;
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
import com.ecep.contract.vm.ProjectTypeViewModel;
|
import com.ecep.contract.vm.ProjectTypeViewModel;
|
||||||
@@ -13,8 +13,8 @@ import javafx.scene.control.cell.TextFieldTableCell;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class ProjectTypeManagerSkin
|
public class ProjectTypeManagerSkin
|
||||||
extends AbstEntityManagerSkin<ProjectType, ProjectTypeViewModel, ProjectTypeManagerSkin, ProjectTypeManagerWindowController>
|
extends AbstEntityManagerSkin<ProjectTypeVo, ProjectTypeViewModel, ProjectTypeManagerSkin, ProjectTypeManagerWindowController>
|
||||||
implements ManagerSkin , EditableEntityTableTabSkin<ProjectType, ProjectTypeViewModel> {
|
implements ManagerSkin , EditableEntityTableTabSkin<ProjectTypeVo, ProjectTypeViewModel> {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.ProjectType;
|
import com.ecep.contract.vo.ProjectTypeVo;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.service.ProjectTypeService;
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
@@ -22,7 +22,7 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/project-type-manager.fxml")
|
@FxmlPath("/ui/project/project-type-manager.fxml")
|
||||||
public class ProjectTypeManagerWindowController
|
public class ProjectTypeManagerWindowController
|
||||||
extends AbstManagerWindowController<ProjectType, ProjectTypeViewModel, ProjectTypeManagerSkin> {
|
extends AbstManagerWindowController<ProjectTypeVo, ProjectTypeViewModel, ProjectTypeManagerSkin> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|||||||
@@ -21,13 +21,12 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.constant.ContractConstant;
|
import com.ecep.contract.constant.ContractConstant;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectQuotation;
|
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.task.Tasker;
|
import com.ecep.contract.task.Tasker;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectQuotationVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -43,7 +42,7 @@ public class ProjectQuotationExportAsExcelFile extends Tasker<Object> {
|
|||||||
private String name = "报价审批表";
|
private String name = "报价审批表";
|
||||||
File destFile;
|
File destFile;
|
||||||
|
|
||||||
ProjectQuotation quotation;
|
ProjectQuotationVo quotation;
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
@@ -69,12 +68,8 @@ public class ProjectQuotationExportAsExcelFile extends Tasker<Object> {
|
|||||||
holder.warn(name + "模板文件 " + template.getAbsolutePath() + " 不存在,请检查");
|
holder.warn(name + "模板文件 " + template.getAbsolutePath() + " 不存在,请检查");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Integer projectId = quotation.getProject();
|
||||||
Project project = quotation.getProject();
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
quotation.setProject(project);
|
|
||||||
}
|
|
||||||
File dir = getProjectService().searchPath(project);
|
File dir = getProjectService().searchPath(project);
|
||||||
LocalDate thatDay = LocalDate.now();
|
LocalDate thatDay = LocalDate.now();
|
||||||
if (quotation.getApplyTime() != null) {
|
if (quotation.getApplyTime() != null) {
|
||||||
@@ -129,14 +124,13 @@ public class ProjectQuotationExportAsExcelFile extends Tasker<Object> {
|
|||||||
|
|
||||||
private void updateProjectQuotation(Sheet sheet, MessageHolder holder) {
|
private void updateProjectQuotation(Sheet sheet, MessageHolder holder) {
|
||||||
updateTitle("更新 " + sheet.getSheetName() + " Sheet");
|
updateTitle("更新 " + sheet.getSheetName() + " Sheet");
|
||||||
Project project = quotation.getProject();
|
Integer projectId = quotation.getProject();
|
||||||
Employee applicant = quotation.getApplicant();
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
|
|
||||||
|
Integer applicantId = quotation.getApplicantId();
|
||||||
|
EmployeeVo applicant = getEmployeeService().findById(applicantId);
|
||||||
|
|
||||||
if (applicant != null) {
|
if (applicant != null) {
|
||||||
if (!ProxyUtils.isInitialized(applicant)) {
|
|
||||||
applicant = getEmployeeService().findById(applicant.getId());
|
|
||||||
project.setApplicant(applicant);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "B4", applicant.getName());
|
setCellValue(sheet, "B4", applicant.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "B4", "");
|
setCellValue(sheet, "B4", "");
|
||||||
@@ -144,12 +138,9 @@ public class ProjectQuotationExportAsExcelFile extends Tasker<Object> {
|
|||||||
|
|
||||||
setCellValue(sheet, "B5", project.getName());
|
setCellValue(sheet, "B5", project.getName());
|
||||||
|
|
||||||
Company customer = project.getCustomer();
|
Integer customerId = project.getCustomerId();
|
||||||
|
CompanyVo customer = getCompanyService().findById(customerId);
|
||||||
if (customer != null) {
|
if (customer != null) {
|
||||||
if (!ProxyUtils.isInitialized(customer)) {
|
|
||||||
customer = getCompanyService().findById(customer.getId());
|
|
||||||
project.setCustomer(customer);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "B6", customer.getName());
|
setCellValue(sheet, "B6", customer.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "B6", "-");
|
setCellValue(sheet, "B6", "-");
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
package com.ecep.contract.controller.project.quotation;
|
package com.ecep.contract.controller.project.quotation;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyCustomerFileType;
|
|
||||||
import com.ecep.contract.ContractFileType;
|
|
||||||
import com.ecep.contract.DesktopUtils;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.controller.customer.CompanyCustomerEvaluationFormFileWindowController;
|
import com.ecep.contract.controller.customer.CompanyCustomerEvaluationFormFileWindowController;
|
||||||
@@ -18,28 +11,21 @@ import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
|||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.converter.EntityStringConverter;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ContractFile;
|
|
||||||
import com.ecep.contract.model.Employee;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.model.Project;
|
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||||
import com.ecep.contract.model.ProjectQuotation;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.ContractFileService;
|
|
||||||
import com.ecep.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.service.ProjectQuotationService;
|
import com.ecep.contract.service.ProjectQuotationService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ProjectQuotationViewModel;
|
import com.ecep.contract.vm.ProjectQuotationViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.ProjectQuotationVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
@@ -52,7 +38,7 @@ import javafx.util.converter.NumberStringConverter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class ProjectQuotationTabSkinBase
|
public class ProjectQuotationTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<ProjectQuotationWindowController, ProjectQuotation, ProjectQuotationViewModel>
|
extends AbstEntityBasedTabSkin<ProjectQuotationWindowController, ProjectQuotationVo, ProjectQuotationViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@@ -72,6 +58,8 @@ public class ProjectQuotationTabSkinBase
|
|||||||
@Setter
|
@Setter
|
||||||
private CompanyCustomerFileService customerFileService;
|
private CompanyCustomerFileService customerFileService;
|
||||||
@Setter
|
@Setter
|
||||||
|
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;
|
||||||
|
@Setter
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
private ProjectService getProjectService() {
|
private ProjectService getProjectService() {
|
||||||
@@ -106,10 +94,11 @@ public class ProjectQuotationTabSkinBase
|
|||||||
controller.openFileBtn.disableProperty().bind(viewModel.getAuthorizationFile().isNull());
|
controller.openFileBtn.disableProperty().bind(viewModel.getAuthorizationFile().isNull());
|
||||||
controller.changeFileBtn.setOnAction(this::onChangeAuthorizationFileAction);
|
controller.changeFileBtn.setOnAction(this::onChangeAuthorizationFileAction);
|
||||||
|
|
||||||
employeeAutoCompletion(controller.applicantField, viewModel.getApplicant());
|
UITools.autoCompletion(controller.applicantField, viewModel.getApplicant(), controller.getEmployeeService());
|
||||||
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(),
|
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(),
|
||||||
getLocalDateTimeStringConverter());
|
getLocalDateTimeStringConverter());
|
||||||
employeeAutoCompletion(controller.authorizerField, viewModel.getAuthorizer());
|
//
|
||||||
|
UITools.autoCompletion(controller.authorizerField, viewModel.getAuthorizer(), controller.getEmployeeService());
|
||||||
controller.authorizationTimeField.textProperty().bindBidirectional(viewModel.getAuthorizationTime(),
|
controller.authorizationTimeField.textProperty().bindBidirectional(viewModel.getAuthorizationTime(),
|
||||||
getLocalDateTimeStringConverter());
|
getLocalDateTimeStringConverter());
|
||||||
|
|
||||||
@@ -143,7 +132,8 @@ public class ProjectQuotationTabSkinBase
|
|||||||
controller.amountField.textProperty().bindBidirectional(viewModel.getAmount(),
|
controller.amountField.textProperty().bindBidirectional(viewModel.getAmount(),
|
||||||
new NumberStringConverter(getLocale()));
|
new NumberStringConverter(getLocale()));
|
||||||
|
|
||||||
evaluationFileAutoCompletion(controller.evaluationFileField, viewModel.getEvaluationFile());
|
UITools.autoCompletion(controller.evaluationFileField, viewModel.getEvaluationFile(),
|
||||||
|
getEvaluationFormFileService());
|
||||||
|
|
||||||
controller.authorizationFileField.textProperty().bind(viewModel.getAuthorizationFile().map(File::getName));
|
controller.authorizationFileField.textProperty().bind(viewModel.getAuthorizationFile().map(File::getName));
|
||||||
|
|
||||||
@@ -151,12 +141,11 @@ public class ProjectQuotationTabSkinBase
|
|||||||
|
|
||||||
controller.evaluationFileBtn.setOnAction(event -> {
|
controller.evaluationFileBtn.setOnAction(event -> {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
CompanyCustomerEvaluationFormFile file = viewModel.getEvaluationFile().get();
|
Integer formFileId = viewModel.getEvaluationFile().get();
|
||||||
|
CompanyCustomerEvaluationFormFileVo file = getEvaluationFormFileService().findById(formFileId);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
if (!ProxyUtils.isInitialized(file)) {
|
// 直接使用Vo对象,不再需要初始化检查
|
||||||
file = getCompanyCustomerFileService().findCustomerEvaluationFormFileById(file.getId());
|
CompanyCustomerEvaluationFormFileWindowController.show(file,
|
||||||
}
|
|
||||||
CompanyCustomerEvaluationFormFileWindowController.show(file.getCustomerFile(),
|
|
||||||
getTab().getTabPane().getScene().getWindow());
|
getTab().getTabPane().getScene().getWindow());
|
||||||
}
|
}
|
||||||
}).exceptionally(this::handleException);
|
}).exceptionally(this::handleException);
|
||||||
@@ -183,7 +172,8 @@ public class ProjectQuotationTabSkinBase
|
|||||||
FileChooser fileChooser = new FileChooser();
|
FileChooser fileChooser = new FileChooser();
|
||||||
File file = viewModel.getAuthorizationFile().get();
|
File file = viewModel.getAuthorizationFile().get();
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
Project project = viewModel.getProject().get();
|
Integer projectId = viewModel.getProject().get();
|
||||||
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
if (!ProxyUtils.isInitialized(project)) {
|
||||||
project = getProjectService().findById(project.getId());
|
project = getProjectService().findById(project.getId());
|
||||||
@@ -204,87 +194,13 @@ public class ProjectQuotationTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tryGetEvaluationFile() {
|
private void tryGetEvaluationFile() {
|
||||||
Project project = getViewModel().getProject().get();
|
// 不需要再手动转换Vo为实体
|
||||||
if (project == null) {
|
// 该方法已不再需要实现,因为我们直接使用Vo
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
Company company = project.getCustomer();
|
|
||||||
CompanyCustomer customer = getCompanyCustomerService().findByCompany(company);
|
|
||||||
if (customer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompanyCustomerFileService companyCustomerFileService = getBean(CompanyCustomerFileService.class);
|
|
||||||
List<CompanyCustomerFile> list = companyCustomerFileService.findAllByCustomerAndType(customer,
|
|
||||||
CompanyCustomerFileType.EvaluationForm);
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
|
||||||
LocalDate verifyDate = applyTime.toLocalDate();
|
|
||||||
CompanyCustomerFile file = list.stream()
|
|
||||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
|
||||||
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
|
|
||||||
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
|
||||||
7))
|
|
||||||
.findFirst().orElse(null);
|
|
||||||
if (file == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFile evaluationFile = companyCustomerFileService
|
|
||||||
.findCustomerEvaluationFormFileByCustomerFile(file);
|
|
||||||
if (evaluationFile == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
getViewModel().getEvaluationFile().set(evaluationFile);
|
|
||||||
Integer creditLevel = evaluationFile.getCreditLevel();
|
|
||||||
getViewModel().getLevel().set(creditLevel >= 4 ? 2 : creditLevel >= 2 ? 1 : 0);
|
|
||||||
save();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryGetAuthorizationFile() {
|
private void tryGetAuthorizationFile() {
|
||||||
Project project = getViewModel().getProject().get();
|
// 直接使用Vo类,不再需要手动转换实体
|
||||||
if (project == null) {
|
// 该方法已不再需要实现,因为我们直接使用Vo
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContractService contractService = getBean(ContractService.class);
|
|
||||||
Contract contract = contractService.findSalesByProject(project);
|
|
||||||
if (contract == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContractFileService contractFileService = getBean(ContractFileService.class);
|
|
||||||
List<ContractFile> list = contractFileService.findAllByContractAndFileType(contract,
|
|
||||||
ContractFileType.QuotationApprovalForm);
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContractFile contractFile = list.stream()
|
|
||||||
.max(Comparator.comparing(ContractFile::getApplyDate, Comparator.nullsLast(Comparator.naturalOrder())))
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
if (contractFile.getApplyDate() != null && getViewModel().getAuthorizationTime().get() == null) {
|
|
||||||
LocalDateTime localDateTime = LocalDateTime.of(contractFile.getApplyDate(), LocalTime.MIN);
|
|
||||||
getViewModel().getAuthorizationTime().set(localDateTime);
|
|
||||||
}
|
|
||||||
File file = new File(contract.getPath(), contractFile.getFileName());
|
|
||||||
if (!file.exists()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
getViewModel().getAuthorizationFile().set(file);
|
|
||||||
save();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalDateTimeStringConverter getLocalDateTimeStringConverter() {
|
private LocalDateTimeStringConverter getLocalDateTimeStringConverter() {
|
||||||
@@ -304,98 +220,39 @@ public class ProjectQuotationTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void evaluationFileAutoCompletion(TextField textField,
|
private void evaluationFileAutoCompletion(TextField textField,
|
||||||
SimpleObjectProperty<CompanyCustomerEvaluationFormFile> property) {
|
SimpleObjectProperty<CompanyCustomerEvaluationFormFileVo> property) {
|
||||||
EntityStringConverter<CompanyCustomerEvaluationFormFile> converter = new EntityStringConverter<>();
|
// 直接使用Vo类,不再需要手动转换
|
||||||
converter.setInitialized(
|
|
||||||
formFile -> getCompanyCustomerFileService().findCustomerEvaluationFormFileById(formFile.getId()));
|
|
||||||
converter.setFormater(formFile -> {
|
|
||||||
CompanyCustomerFile customerFile = formFile.getCustomerFile();
|
|
||||||
if (customerFile == null) {
|
|
||||||
return "无";
|
|
||||||
}
|
|
||||||
File file = new File(customerFile.getFilePath());
|
|
||||||
return file.getName() + ", 等级:" + formFile.getCreditLevel();
|
|
||||||
});
|
|
||||||
converter.setSuggestion(searchText -> {
|
|
||||||
Project project = getViewModel().getProject().get();
|
|
||||||
if (project == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
Company company = project.getCustomer();
|
|
||||||
if (company == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
CompanyCustomer customer = getCompanyCustomerService().findByCompany(company);
|
|
||||||
if (customer == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getCompanyCustomerFileService().searchEvaluationFile(customer, searchText);
|
|
||||||
});
|
|
||||||
UITools.autoCompletion(textField, property, converter).setOnAutoCompleted(event -> {
|
|
||||||
CompanyCustomerEvaluationFormFile evaluationFile = event.getCompletion();
|
|
||||||
Integer creditLevel = evaluationFile.getCreditLevel();
|
|
||||||
viewModel.getLevel().set(creditLevel >= 4 ? 2 : creditLevel >= 2 ? 1 : 0);
|
|
||||||
property.set(evaluationFile);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void employeeAutoCompletion(TextField textField, SimpleObjectProperty<Employee> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getEmployeeStringConverter());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void companyAutoCompletion(TextField textField, SimpleObjectProperty<Company> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getCompanyStringConverter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectQuotationService getProjectQuotationService() {
|
private ProjectQuotationService getProjectQuotationService() {
|
||||||
if (projectQuotationService == null) {
|
return getBean(ProjectQuotationService.class);
|
||||||
projectQuotationService = getBean(ProjectQuotationService.class);
|
|
||||||
}
|
|
||||||
return projectQuotationService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalDateStringConverter getLocalDateStringConverter() {
|
private LocalDateStringConverter getLocalDateStringConverter() {
|
||||||
if (localDateStringConverter == null) {
|
return new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
|
||||||
localDateStringConverter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
|
|
||||||
}
|
|
||||||
return localDateStringConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmployeeStringConverter getEmployeeStringConverter() {
|
private EmployeeStringConverter getEmployeeStringConverter() {
|
||||||
if (employeeStringConverter == null) {
|
return getBean(EmployeeStringConverter.class);
|
||||||
employeeStringConverter = getBean(EmployeeStringConverter.class);
|
|
||||||
}
|
|
||||||
return employeeStringConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyService getCompanyService() {
|
public CompanyService getCompanyService() {
|
||||||
if (companyService == null) {
|
return getBean(CompanyService.class);
|
||||||
companyService = getBean(CompanyService.class);
|
|
||||||
}
|
|
||||||
return companyService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanyStringConverter getCompanyStringConverter() {
|
private CompanyStringConverter getCompanyStringConverter() {
|
||||||
if (companyStringConverter == null) {
|
return getBean(CompanyStringConverter.class);
|
||||||
companyStringConverter = getBean(CompanyStringConverter.class);
|
|
||||||
}
|
|
||||||
return companyStringConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanyCustomerService getCompanyCustomerService() {
|
private CompanyCustomerService getCompanyCustomerService() {
|
||||||
if (customerService == null) {
|
return getBean(CompanyCustomerService.class);
|
||||||
customerService = getBean(CompanyCustomerService.class);
|
|
||||||
}
|
|
||||||
return customerService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
||||||
if (customerFileService == null) {
|
return getBean(CompanyCustomerFileService.class);
|
||||||
customerFileService = getBean(CompanyCustomerFileService.class);
|
|
||||||
}
|
}
|
||||||
return customerFileService;
|
|
||||||
|
private CompanyCustomerEvaluationFormFileService getEvaluationFormFileService() {
|
||||||
|
return getBean(CompanyCustomerEvaluationFormFileService.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package com.ecep.contract.controller.project.quotation;
|
package com.ecep.contract.controller.project.quotation;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.model.ProjectQuotation;
|
|
||||||
import com.ecep.contract.service.ProjectQuotationService;
|
import com.ecep.contract.service.ProjectQuotationService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ProjectQuotationViewModel;
|
import com.ecep.contract.vm.ProjectQuotationViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectQuotationVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -32,7 +31,7 @@ import javafx.stage.WindowEvent;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/project-quotation.fxml")
|
@FxmlPath("/ui/project/project-quotation.fxml")
|
||||||
public class ProjectQuotationWindowController
|
public class ProjectQuotationWindowController
|
||||||
extends AbstEntityController<ProjectQuotation, ProjectQuotationViewModel> {
|
extends AbstEntityController<ProjectQuotationVo, ProjectQuotationViewModel> {
|
||||||
@FXML
|
@FXML
|
||||||
public BorderPane root;
|
public BorderPane root;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -91,12 +90,8 @@ public class ProjectQuotationWindowController
|
|||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
Project project = viewModel.getProject().get();
|
ProjectVo project = getProjectService().findById(viewModel.getProject().get());
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目报价");
|
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目报价");
|
||||||
|
|
||||||
exportExcelBtn.setOnAction(this::onExportExcelAction);
|
exportExcelBtn.setOnAction(this::onExportExcelAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package com.ecep.contract.controller.project.sale_type;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
|
||||||
public abstract class AbstProjectSaleTypeBasedTabSkin
|
public abstract class AbstProjectSaleTypeBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<ProjectSaleTypeWindowController, ProjectSaleType, ProjectSaleTypeViewModel>
|
extends AbstEntityBasedTabSkin<ProjectSaleTypeWindowController, ProjectSaleTypeVo, ProjectSaleTypeViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstProjectSaleTypeBasedTabSkin(ProjectSaleTypeWindowController controller) {
|
public AbstProjectSaleTypeBasedTabSkin(ProjectSaleTypeWindowController controller) {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.ecep.contract.controller.project.sale_type;
|
package com.ecep.contract.controller.project.sale_type;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
|
||||||
public abstract class AbstProjectSaleTypeTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstProjectSaleTypeTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends AbstEntityTableTabSkin<ProjectSaleTypeWindowController, ProjectSaleType,ProjectSaleTypeViewModel, T, TV>
|
extends
|
||||||
|
AbstEntityTableTabSkin<ProjectSaleTypeWindowController, ProjectSaleTypeVo, ProjectSaleTypeViewModel, T, TV>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
public AbstProjectSaleTypeTableTabSkin(ProjectSaleTypeWindowController controller) {
|
public AbstProjectSaleTypeTableTabSkin(ProjectSaleTypeWindowController controller) {
|
||||||
@@ -23,9 +23,9 @@ public abstract class AbstProjectSaleTypeTableTabSkin<T extends IdentityEntity,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(ProjectSaleType parent) {
|
public ParamUtils.Builder getSpecification(ProjectSaleTypeVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
params.put("saleType", parent.getId());
|
params.equals("saleType", parent.getId());
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ecep.contract.controller.project.sale_type;
|
package com.ecep.contract.controller.project.sale_type;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
@@ -11,7 +10,9 @@ import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
|||||||
import com.ecep.contract.model.ProjectSaleType;
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.service.ViewModelService;
|
import com.ecep.contract.service.ViewModelService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
@@ -20,8 +21,8 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class ProjectSaleTypeManagerSkin
|
public class ProjectSaleTypeManagerSkin
|
||||||
extends
|
extends
|
||||||
AbstEntityManagerSkin<ProjectSaleType, ProjectSaleTypeViewModel, ProjectSaleTypeManagerSkin, ProjectSaleTypeManagerWindowController>
|
AbstEntityManagerSkin<ProjectSaleTypeVo, ProjectSaleTypeViewModel, ProjectSaleTypeManagerSkin, ProjectSaleTypeManagerWindowController>
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<ProjectSaleType, ProjectSaleTypeViewModel> {
|
implements ManagerSkin, EditableEntityTableTabSkin<ProjectSaleTypeVo, ProjectSaleTypeViewModel> {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectSaleTypeService saleTypeService;
|
private ProjectSaleTypeService saleTypeService;
|
||||||
@@ -44,11 +45,12 @@ public class ProjectSaleTypeManagerSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<ProjectSaleTypeViewModel> loadTableData() {
|
protected List<ProjectSaleTypeViewModel> loadTableData() {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
ViewModelService<ProjectSaleType, ProjectSaleTypeViewModel> service = getViewModelService();
|
ProjectSaleTypeService service = getSaleTypeService();
|
||||||
Page<ProjectSaleType> page = service.findAll(params, getPageable());
|
Page<ProjectSaleTypeVo> page = service.findAll(params.build(), getPageable());
|
||||||
updateFooter(page);
|
updateFooter(page);
|
||||||
return page.map(service::from).stream().peek(v -> {
|
return page.map(service::from).stream().peek(v -> {
|
||||||
|
// 监听属性变化,触发保存
|
||||||
v.getStoreByYear().addListener((observable, oldValue, newValue) -> saveRowData(v));
|
v.getStoreByYear().addListener((observable, oldValue, newValue) -> saveRowData(v));
|
||||||
v.getActive().addListener((observable, oldValue, newValue) -> saveRowData(v));
|
v.getActive().addListener((observable, oldValue, newValue) -> saveRowData(v));
|
||||||
}).toList();
|
}).toList();
|
||||||
@@ -91,10 +93,10 @@ public class ProjectSaleTypeManagerSkin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProjectSaleType loadRowData(ProjectSaleTypeViewModel row) {
|
public ProjectSaleTypeVo loadRowData(ProjectSaleTypeViewModel row) {
|
||||||
ProjectSaleType type = super.loadRowData(row);
|
ProjectSaleTypeVo type = super.loadRowData(row);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
type = new ProjectSaleType();
|
type = new ProjectSaleTypeVo();
|
||||||
type.setCode("-");
|
type.setCode("-");
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstManagerWindowController;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
@@ -21,7 +21,7 @@ import javafx.stage.Stage;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/sale-type-manager.fxml")
|
@FxmlPath("/ui/project/sale-type-manager.fxml")
|
||||||
public class ProjectSaleTypeManagerWindowController
|
public class ProjectSaleTypeManagerWindowController
|
||||||
extends AbstManagerWindowController<ProjectSaleType, ProjectSaleTypeViewModel, ProjectSaleTypeManagerSkin> {
|
extends AbstManagerWindowController<ProjectSaleTypeVo, ProjectSaleTypeViewModel, ProjectSaleTypeManagerSkin> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSaleTypeService saleTypeService;
|
private ProjectSaleTypeService saleTypeService;
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import com.ecep.contract.ContractFileType;
|
|||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
import com.ecep.contract.model.ContractFileTypeLocal;
|
||||||
import com.ecep.contract.model.ProjectSaleTypeRequireFileType;
|
|
||||||
import com.ecep.contract.service.ContractFileService;
|
import com.ecep.contract.service.ContractFileService;
|
||||||
import com.ecep.contract.service.ContractFileTypeService;
|
import com.ecep.contract.service.ContractFileTypeService;
|
||||||
import com.ecep.contract.service.ProjectSaleTypeRequireFileTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeRequireFileTypeService;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeRequireFileTypeVo;
|
||||||
|
|
||||||
import impl.org.controlsfx.skin.ListSelectionViewSkin;
|
import impl.org.controlsfx.skin.ListSelectionViewSkin;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
@@ -67,9 +67,9 @@ public class ProjectSaleTypeRequireFilesTabSkin extends AbstProjectSaleTypeBased
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadSelectedRoles() {
|
private void loadSelectedRoles() {
|
||||||
List<ProjectSaleTypeRequireFileType> list = getRequireFileTypeService()
|
List<ProjectSaleTypeRequireFileTypeVo> list = getRequireFileTypeService()
|
||||||
.findBySaleTypeId(viewModel.getId().get());
|
.findBySaleTypeId(viewModel.getId().get());
|
||||||
List<ContractFileType> types = list.stream().map(ProjectSaleTypeRequireFileType::getFileType).toList();
|
List<ContractFileType> types = list.stream().map(ProjectSaleTypeRequireFileTypeVo::getFileType).toList();
|
||||||
fileTypesField.getTargetItems().setAll(types);
|
fileTypesField.getTargetItems().setAll(types);
|
||||||
changed.set(false);
|
changed.set(false);
|
||||||
}
|
}
|
||||||
@@ -134,16 +134,16 @@ public class ProjectSaleTypeRequireFilesTabSkin extends AbstProjectSaleTypeBased
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveRequireFileTypes(ActionEvent event) {
|
private void saveRequireFileTypes(ActionEvent event) {
|
||||||
List<ProjectSaleTypeRequireFileType> list = getRequireFileTypeService()
|
List<ProjectSaleTypeRequireFileTypeVo> list = getRequireFileTypeService()
|
||||||
.findBySaleTypeId(viewModel.getId().get());
|
.findBySaleTypeId(viewModel.getId().get());
|
||||||
ObservableList<ContractFileType> types = fileTypesField.getTargetItems();
|
ObservableList<ContractFileType> types = fileTypesField.getTargetItems();
|
||||||
// 保存 types ,list 中是已经存储的,如果types 中没有则删除,如果 types 中有则新增保存
|
// 保存 types ,list 中是已经存储的,如果types 中没有则删除,如果 types 中有则新增保存
|
||||||
for (ContractFileType type : types) {
|
for (ContractFileType type : types) {
|
||||||
ProjectSaleTypeRequireFileType entity = list.stream().filter(v -> v.getFileType() == type).findFirst()
|
ProjectSaleTypeRequireFileTypeVo entity = list.stream().filter(v -> v.getFileType() == type).findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = new ProjectSaleTypeRequireFileType();
|
entity = new ProjectSaleTypeRequireFileTypeVo();
|
||||||
entity.setSaleType(getEntity());
|
entity.setSaleTypeId(viewModel.getId().get());
|
||||||
entity.setFileType(type);
|
entity.setFileType(type);
|
||||||
getRequireFileTypeService().save(entity);
|
getRequireFileTypeService().save(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.service.ProjectSaleTypeService;
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.DeliverySignMethodViewModel;
|
import com.ecep.contract.vm.DeliverySignMethodViewModel;
|
||||||
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
import com.ecep.contract.vm.ProjectSaleTypeViewModel;
|
||||||
|
import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||||
|
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.DatePicker;
|
import javafx.scene.control.DatePicker;
|
||||||
@@ -38,7 +38,7 @@ import javafx.stage.Window;
|
|||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/sale-type.fxml")
|
@FxmlPath("/ui/project/sale-type.fxml")
|
||||||
public class ProjectSaleTypeWindowController
|
public class ProjectSaleTypeWindowController
|
||||||
extends AbstEntityController<ProjectSaleType, ProjectSaleTypeViewModel> {
|
extends AbstEntityController<ProjectSaleTypeVo, ProjectSaleTypeViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectSaleTypeWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectSaleTypeWindowController.class);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.ecep.contract.controller.project.sale_type;
|
package com.ecep.contract.controller.project.sale_type;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.model.DeliverySignMethod;
|
|
||||||
import com.ecep.contract.service.DeliverySignMethodService;
|
import com.ecep.contract.service.DeliverySignMethodService;
|
||||||
import com.ecep.contract.vm.DeliverySignMethodViewModel;
|
import com.ecep.contract.vm.DeliverySignMethodViewModel;
|
||||||
|
import com.ecep.contract.vo.DeliverySignMethodVo;
|
||||||
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -13,13 +15,12 @@ import javafx.scene.control.cell.TextFieldTableCell;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class SignMethodTabSkin
|
public class SignMethodTabSkin
|
||||||
extends AbstProjectSaleTypeTableTabSkin<DeliverySignMethod, DeliverySignMethodViewModel>
|
extends AbstProjectSaleTypeTableTabSkin<DeliverySignMethodVo, DeliverySignMethodViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private DeliverySignMethodService deliverySignMethodService;
|
private DeliverySignMethodService deliverySignMethodService;
|
||||||
|
|
||||||
|
|
||||||
public SignMethodTabSkin(ProjectSaleTypeWindowController controller) {
|
public SignMethodTabSkin(ProjectSaleTypeWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,8 @@ public class SignMethodTabSkin
|
|||||||
@Override
|
@Override
|
||||||
protected DeliverySignMethodViewModel createNewViewModel() {
|
protected DeliverySignMethodViewModel createNewViewModel() {
|
||||||
DeliverySignMethodViewModel model = super.createNewViewModel();
|
DeliverySignMethodViewModel model = super.createNewViewModel();
|
||||||
model.getSaleType().set(getEntity());
|
model.getSaleType().set(getEntity().getId());
|
||||||
|
model.getCreated().set(LocalDate.now());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,20 +63,24 @@ public class SignMethodTabSkin
|
|||||||
|
|
||||||
controller.signMethodTable_descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
controller.signMethodTable_descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||||
controller.signMethodTable_descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
controller.signMethodTable_descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
controller.signMethodTable_descriptionColumn.setOnEditCommit(this::onSignMethodTableDescriptionColumnEditCommitAction);
|
controller.signMethodTable_descriptionColumn
|
||||||
|
.setOnEditCommit(this::onSignMethodTableDescriptionColumnEditCommitAction);
|
||||||
|
|
||||||
controller.signMethodTable_createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
controller.signMethodTable_createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSignMethodTableDescriptionColumnEditCommitAction(TableColumn.CellEditEvent<DeliverySignMethodViewModel, String> event) {
|
private void onSignMethodTableDescriptionColumnEditCommitAction(
|
||||||
|
TableColumn.CellEditEvent<DeliverySignMethodViewModel, String> event) {
|
||||||
acceptCellEditEvent(event, DeliverySignMethodViewModel::getDescription);
|
acceptCellEditEvent(event, DeliverySignMethodViewModel::getDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSignMethodTableNameColumnEditCommitAction(TableColumn.CellEditEvent<DeliverySignMethodViewModel, String> event) {
|
private void onSignMethodTableNameColumnEditCommitAction(
|
||||||
|
TableColumn.CellEditEvent<DeliverySignMethodViewModel, String> event) {
|
||||||
acceptCellEditEvent(event, DeliverySignMethodViewModel::getName);
|
acceptCellEditEvent(event, DeliverySignMethodViewModel::getName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSignMethodTableCodeColumnEditCommitAction(TableColumn.CellEditEvent<DeliverySignMethodViewModel, String> event) {
|
private void onSignMethodTableCodeColumnEditCommitAction(
|
||||||
|
TableColumn.CellEditEvent<DeliverySignMethodViewModel, String> event) {
|
||||||
acceptCellEditEvent(event, DeliverySignMethodViewModel::getCode);
|
acceptCellEditEvent(event, DeliverySignMethodViewModel::getCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyCustomerFileType;
|
import com.ecep.contract.CompanyCustomerFileType;
|
||||||
@@ -17,31 +16,30 @@ import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
|||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.converter.CompanyStringConverter;
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
import com.ecep.contract.converter.EmployeeStringConverter;
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
import com.ecep.contract.model.Company;
|
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||||
import com.ecep.contract.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
|
||||||
import com.ecep.contract.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.model.CustomerSatisfactionSurvey;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
import com.ecep.contract.service.CompanyCustomerService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.ProjectCostService;
|
import com.ecep.contract.service.ProjectCostService;
|
||||||
import com.ecep.contract.service.ProjectQuotationService;
|
import com.ecep.contract.service.ProjectQuotationService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.util.ProxyUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.Slider;
|
import javafx.scene.control.Slider;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||||
@@ -50,7 +48,7 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class CustomerSatisfactionSurveyTabSkinBase
|
public class CustomerSatisfactionSurveyTabSkinBase
|
||||||
extends
|
extends
|
||||||
AbstEntityBasedTabSkin<CustomerSatisfactionSurveyWindowController, CustomerSatisfactionSurvey, CustomerSatisfactionSurveyViewModel>
|
AbstEntityBasedTabSkin<CustomerSatisfactionSurveyWindowController, CustomerSatisfactionSurveyVo, CustomerSatisfactionSurveyViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@@ -74,6 +72,9 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
@Setter
|
@Setter
|
||||||
private ProjectCostService projectCostService;
|
private ProjectCostService projectCostService;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;
|
||||||
|
|
||||||
private ProjectService getProjectService() {
|
private ProjectService getProjectService() {
|
||||||
if (projectService == null) {
|
if (projectService == null) {
|
||||||
projectService = getBean(ProjectService.class);
|
projectService = getBean(ProjectService.class);
|
||||||
@@ -175,7 +176,8 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
controller.dateField.textProperty().bindBidirectional(viewModel.getDate(), getLocalDateStringConverter());
|
controller.dateField.textProperty().bindBidirectional(viewModel.getDate(), getLocalDateStringConverter());
|
||||||
controller.totalScoreField.textProperty().bind(viewModel.getTotalScore().asString());
|
controller.totalScoreField.textProperty().bind(viewModel.getTotalScore().asString());
|
||||||
|
|
||||||
employeeAutoCompletion(controller.applicantField, viewModel.getApplicant());
|
UITools.autoCompletion(controller.applicantField, viewModel.getApplicant(), controller.getEmployeeService());
|
||||||
|
|
||||||
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(),
|
controller.applyTimeField.textProperty().bindBidirectional(viewModel.getApplyTime(),
|
||||||
getLocalDateTimeStringConverter());
|
getLocalDateTimeStringConverter());
|
||||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||||
@@ -199,12 +201,9 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
UITools.showTaskDialogAndWait("导出Excel", tasker, null);
|
UITools.showTaskDialogAndWait("导出Excel", tasker, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInitialDirectory(FileChooser fileChooser, File file, Project project) {
|
void setInitialDirectory(FileChooser fileChooser, File file, ProjectVo project) {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
File path = getProjectService().searchPath(project);
|
File path = getProjectService().searchPath(project);
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
fileChooser.setInitialDirectory(path);
|
fileChooser.setInitialDirectory(path);
|
||||||
@@ -219,21 +218,23 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
* 尝试获取客户资信评估表
|
* 尝试获取客户资信评估表
|
||||||
*/
|
*/
|
||||||
private void tryGetEvaluationFile() {
|
private void tryGetEvaluationFile() {
|
||||||
Project project = getViewModel().getProject().get();
|
Integer projectId = getViewModel().getProject().get();
|
||||||
|
ProjectVo project = getProjectService().findById(projectId);
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
if (!ProxyUtils.isInitialized(project)) {
|
||||||
project = getProjectService().findById(project.getId());
|
project = getProjectService().findById(project.getId());
|
||||||
}
|
}
|
||||||
Company company = project.getCustomer();
|
Integer companyId = project.getCustomerId();
|
||||||
CompanyCustomer customer = getCompanyCustomerService().findByCompany(company);
|
CompanyVo company = getCompanyService().findById(companyId);
|
||||||
|
CompanyCustomerVo customer = getCompanyCustomerService().findByCompany(company);
|
||||||
if (customer == null) {
|
if (customer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyCustomerFileService companyCustomerFileService = getBean(CompanyCustomerFileService.class);
|
CompanyCustomerFileService companyCustomerFileService = getBean(CompanyCustomerFileService.class);
|
||||||
List<CompanyCustomerFile> list = companyCustomerFileService.findAllByCustomerAndType(customer,
|
List<CompanyCustomerFileVo> list = companyCustomerFileService.findAllByCustomerAndType(customer,
|
||||||
CompanyCustomerFileType.EvaluationForm);
|
CompanyCustomerFileType.EvaluationForm);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +242,7 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
|
|
||||||
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
LocalDateTime applyTime = getViewModel().getApplyTime().get();
|
||||||
LocalDate verifyDate = applyTime.toLocalDate();
|
LocalDate verifyDate = applyTime.toLocalDate();
|
||||||
CompanyCustomerFile file = list.stream()
|
CompanyCustomerFileVo file = list.stream()
|
||||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||||
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
|
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
|
||||||
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
|
||||||
@@ -251,13 +252,13 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFile evaluationFile = companyCustomerFileService
|
// 使用新服务,获取Vo
|
||||||
.findCustomerEvaluationFormFileByCustomerFile(file);
|
CompanyCustomerEvaluationFormFileVo evaluationFileVo = getEvaluationFormFileService()
|
||||||
if (evaluationFile == null) {
|
.findByCustomerFile(getCompanyCustomerFileService().findById(file.getId()));
|
||||||
|
if (evaluationFileVo == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
// getViewModel().getEvaluationFile().set(evaluationFile);
|
|
||||||
save();
|
save();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -278,14 +279,6 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
private void employeeAutoCompletion(TextField textField, SimpleObjectProperty<Employee> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getEmployeeStringConverter());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void companyAutoCompletion(TextField textField, SimpleObjectProperty<Company> property) {
|
|
||||||
UITools.autoCompletion(textField, property, getCompanyStringConverter());
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProjectQuotationService getProjectQuotationService() {
|
private ProjectQuotationService getProjectQuotationService() {
|
||||||
if (projectQuotationService == null) {
|
if (projectQuotationService == null) {
|
||||||
projectQuotationService = getBean(ProjectQuotationService.class);
|
projectQuotationService = getBean(ProjectQuotationService.class);
|
||||||
@@ -334,4 +327,11 @@ public class CustomerSatisfactionSurveyTabSkinBase
|
|||||||
}
|
}
|
||||||
return customerFileService;
|
return customerFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CompanyCustomerEvaluationFormFileService getEvaluationFormFileService() {
|
||||||
|
if (evaluationFormFileService == null) {
|
||||||
|
evaluationFormFileService = getBean(CompanyCustomerEvaluationFormFileService.class);
|
||||||
|
}
|
||||||
|
return evaluationFormFileService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package com.ecep.contract.controller.project.satisfaction_survey;
|
package com.ecep.contract.controller.project.satisfaction_survey;
|
||||||
|
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
import com.ecep.contract.model.CustomerSatisfactionSurvey;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
||||||
|
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -22,14 +21,13 @@ import javafx.scene.control.TextArea;
|
|||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/project/customer-satisfaction-survey.fxml")
|
@FxmlPath("/ui/project/customer-satisfaction-survey.fxml")
|
||||||
public class CustomerSatisfactionSurveyWindowController
|
public class CustomerSatisfactionSurveyWindowController
|
||||||
extends AbstEntityController<CustomerSatisfactionSurvey, CustomerSatisfactionSurveyViewModel> {
|
extends AbstEntityController<CustomerSatisfactionSurveyVo, CustomerSatisfactionSurveyViewModel> {
|
||||||
public BorderPane root;
|
public BorderPane root;
|
||||||
public Tab baseInfoTab;
|
public Tab baseInfoTab;
|
||||||
|
|
||||||
@@ -78,10 +76,7 @@ public class CustomerSatisfactionSurveyWindowController
|
|||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
Project project = viewModel.getProject().get();
|
ProjectVo project = getProjectService().findById(viewModel.getProject().get());
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
}
|
|
||||||
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目客户满意度调查");
|
getTitle().set("[" + viewModel.getId().get() + "] " + project.getCode() + " 项目客户满意度调查");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.apache.poi.ss.usermodel.Row;
|
|||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import com.ecep.contract.util.ProxyUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -25,22 +24,23 @@ import org.springframework.util.StringUtils;
|
|||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.constant.ProjectConstant;
|
import com.ecep.contract.constant.ProjectConstant;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CustomerSatisfactionSurvey;
|
|
||||||
import com.ecep.contract.model.Employee;
|
|
||||||
import com.ecep.contract.model.Project;
|
|
||||||
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
||||||
import com.ecep.contract.service.ProjectService;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.task.Tasker;
|
import com.ecep.contract.task.Tasker;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
|
||||||
|
import com.ecep.contract.vo.EmployeeVo;
|
||||||
|
import com.ecep.contract.vo.ProjectVo;
|
||||||
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<Void> {
|
public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<Void> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectCustomerSatisfactionSurveyExportAsExcelFile.class);
|
private static final Logger logger = LoggerFactory
|
||||||
|
.getLogger(ProjectCustomerSatisfactionSurveyExportAsExcelFile.class);
|
||||||
private String name = "顾客满意度调查表";
|
private String name = "顾客满意度调查表";
|
||||||
File destFile;
|
File destFile;
|
||||||
@Setter
|
@Setter
|
||||||
private CustomerSatisfactionSurvey satisfactionSurvey;
|
private CustomerSatisfactionSurveyVo satisfactionSurvey;
|
||||||
@Setter
|
@Setter
|
||||||
private CustomerSatisfactionSurveyService satisfactionSurveyService;
|
private CustomerSatisfactionSurveyService satisfactionSurveyService;
|
||||||
@Setter
|
@Setter
|
||||||
@@ -73,11 +73,7 @@ public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<V
|
|||||||
holder.warn(name + "模板文件 " + template.getAbsolutePath() + " 不存在,请检查");
|
holder.warn(name + "模板文件 " + template.getAbsolutePath() + " 不存在,请检查");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Project project = satisfactionSurvey.getProject();
|
ProjectVo project = getProjectService().findById(satisfactionSurvey.getProject());
|
||||||
if (!ProxyUtils.isInitialized(project)) {
|
|
||||||
project = getProjectService().findById(project.getId());
|
|
||||||
satisfactionSurvey.setProject(project);
|
|
||||||
}
|
|
||||||
File dir = getProjectService().searchPath(project);
|
File dir = getProjectService().searchPath(project);
|
||||||
LocalDate thatDay = LocalDate.now();
|
LocalDate thatDay = LocalDate.now();
|
||||||
if (satisfactionSurvey.getApplyTime() != null) {
|
if (satisfactionSurvey.getApplyTime() != null) {
|
||||||
@@ -93,8 +89,7 @@ public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<V
|
|||||||
}
|
}
|
||||||
try (
|
try (
|
||||||
InputStream inp = new FileInputStream(template);
|
InputStream inp = new FileInputStream(template);
|
||||||
Workbook wb = WorkbookFactory.create(inp)
|
Workbook wb = WorkbookFactory.create(inp)) {
|
||||||
) {
|
|
||||||
updateProjectCustomerSatisfactionSurvey(wb, destFile, holder);
|
updateProjectCustomerSatisfactionSurvey(wb, destFile, holder);
|
||||||
holder.info(destFile.getName() + "已创建");
|
holder.info(destFile.getName() + "已创建");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -104,7 +99,8 @@ public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<V
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProjectCustomerSatisfactionSurvey(Workbook wb, File destFile, MessageHolder holder) throws IOException {
|
private void updateProjectCustomerSatisfactionSurvey(Workbook wb, File destFile, MessageHolder holder)
|
||||||
|
throws IOException {
|
||||||
Sheet sheet = null;
|
Sheet sheet = null;
|
||||||
if (wb.getNumberOfSheets() == 1) {
|
if (wb.getNumberOfSheets() == 1) {
|
||||||
sheet = wb.getSheetAt(0);
|
sheet = wb.getSheetAt(0);
|
||||||
@@ -126,6 +122,7 @@ public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<V
|
|||||||
updateProjectCustomerSatisfactionSurvey(sheet, holder);
|
updateProjectCustomerSatisfactionSurvey(sheet, holder);
|
||||||
wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
|
wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
|
||||||
// 输出到文件
|
// 输出到文件
|
||||||
|
holder.info("准备写入 " + destFile.getAbsolutePath());
|
||||||
try (OutputStream fileOut = new FileOutputStream(destFile)) {
|
try (OutputStream fileOut = new FileOutputStream(destFile)) {
|
||||||
wb.write(fileOut);
|
wb.write(fileOut);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
@@ -136,16 +133,10 @@ public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<V
|
|||||||
|
|
||||||
private void updateProjectCustomerSatisfactionSurvey(Sheet sheet, MessageHolder holder) {
|
private void updateProjectCustomerSatisfactionSurvey(Sheet sheet, MessageHolder holder) {
|
||||||
updateTitle("更新 " + sheet.getSheetName() + " Sheet");
|
updateTitle("更新 " + sheet.getSheetName() + " Sheet");
|
||||||
Project project = satisfactionSurvey.getProject();
|
ProjectVo project = getProjectService().findById(satisfactionSurvey.getProject());
|
||||||
Employee applicant = satisfactionSurvey.getApplicant();
|
EmployeeVo applicant = getEmployeeService().findById(satisfactionSurvey.getApplicantId());
|
||||||
|
CompanyVo customer = getCompanyService().findById(project.getCustomerId());
|
||||||
|
|
||||||
Company customer = project.getCustomer();
|
|
||||||
if (customer != null) {
|
if (customer != null) {
|
||||||
if (!ProxyUtils.isInitialized(customer)) {
|
|
||||||
customer = getCompanyService().findById(customer.getId());
|
|
||||||
project.setCustomer(customer);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "A5", "致 " + customer.getName() + " (" + project.getCode() + ")");
|
setCellValue(sheet, "A5", "致 " + customer.getName() + " (" + project.getCode() + ")");
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "A5", "");
|
setCellValue(sheet, "A5", "");
|
||||||
@@ -169,12 +160,7 @@ public class ProjectCustomerSatisfactionSurveyExportAsExcelFile extends Tasker<V
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (applicant != null) {
|
if (applicant != null) {
|
||||||
if (!ProxyUtils.isInitialized(applicant)) {
|
|
||||||
applicant = getEmployeeService().findById(applicant.getId());
|
|
||||||
project.setApplicant(applicant);
|
|
||||||
}
|
|
||||||
setCellValue(sheet, "H31", applicant.getName());
|
setCellValue(sheet, "H31", applicant.getName());
|
||||||
} else {
|
} else {
|
||||||
setCellValue(sheet, "H31", "");
|
setCellValue(sheet, "H31", "");
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import com.ecep.contract.controller.company.CompanyWindowController;
|
|||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.controller.table.cell.BankTableCell;
|
import com.ecep.contract.controller.table.cell.BankTableCell;
|
||||||
import com.ecep.contract.model.Bank;
|
import com.ecep.contract.model.Bank;
|
||||||
import com.ecep.contract.model.CompanyBankAccount;
|
|
||||||
import com.ecep.contract.service.BankService;
|
import com.ecep.contract.service.BankService;
|
||||||
import com.ecep.contract.service.CompanyBankAccountService;
|
import com.ecep.contract.service.CompanyBankAccountService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
@@ -25,13 +25,13 @@ import lombok.Setter;
|
|||||||
*/
|
*/
|
||||||
@FxmlPath("/ui/company/company-tab-bank-account.fxml")
|
@FxmlPath("/ui/company/company-tab-bank-account.fxml")
|
||||||
public class CompanyTabSkinBankAccount
|
public class CompanyTabSkinBankAccount
|
||||||
extends AbstCompanyTableTabSkin<CompanyBankAccount, CompanyBankAccountViewModel>
|
extends AbstCompanyTableTabSkin<CompanyBankAccountVo, CompanyBankAccountViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<CompanyBankAccount, CompanyBankAccountViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<CompanyBankAccountVo, CompanyBankAccountViewModel> {
|
||||||
/**
|
/**
|
||||||
* 银行账户
|
* 银行账户
|
||||||
*/
|
*/
|
||||||
public TableColumn<CompanyBankAccountViewModel, Number> bankAccountTable_idColumn;
|
public TableColumn<CompanyBankAccountViewModel, Number> bankAccountTable_idColumn;
|
||||||
public TableColumn<CompanyBankAccountViewModel, Bank> bankAccountTable_bankColumn;
|
public TableColumn<CompanyBankAccountViewModel, Integer> bankAccountTable_bankColumn;
|
||||||
public TableColumn<CompanyBankAccountViewModel, String> bankAccountTable_openingBankColumn;
|
public TableColumn<CompanyBankAccountViewModel, String> bankAccountTable_openingBankColumn;
|
||||||
public TableColumn<CompanyBankAccountViewModel, String> bankAccountTable_accountColumn;
|
public TableColumn<CompanyBankAccountViewModel, String> bankAccountTable_accountColumn;
|
||||||
public TextField bankAccountSearchKeyField;
|
public TextField bankAccountSearchKeyField;
|
||||||
@@ -63,7 +63,7 @@ public class CompanyTabSkinBankAccount
|
|||||||
bankAccountSearchBtn.setOnAction(this::onTableRefreshAction);
|
bankAccountSearchBtn.setOnAction(this::onTableRefreshAction);
|
||||||
|
|
||||||
bankAccountTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
bankAccountTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||||
bankAccountTable_bankColumn.setCellValueFactory(param -> param.getValue().getBank());
|
bankAccountTable_bankColumn.setCellValueFactory(param -> param.getValue().getBankId());
|
||||||
bankAccountTable_bankColumn.setCellFactory(param -> new BankTableCell<>(getBankService()));
|
bankAccountTable_bankColumn.setCellFactory(param -> new BankTableCell<>(getBankService()));
|
||||||
|
|
||||||
bankAccountTable_openingBankColumn.setCellValueFactory(param -> param.getValue().getOpeningBank());
|
bankAccountTable_openingBankColumn.setCellValueFactory(param -> param.getValue().getOpeningBank());
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import com.ecep.contract.controller.company.AbstCompanyBasedTabSkin;
|
import com.ecep.contract.controller.company.AbstCompanyBasedTabSkin;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyOldName;
|
import com.ecep.contract.model.CompanyOldName;
|
||||||
import com.ecep.contract.service.CompanyOldNameService;
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
@@ -87,7 +88,7 @@ public class CompanyTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onCompanyPathCreatePathAction(ActionEvent event) {
|
private void onCompanyPathCreatePathAction(ActionEvent event) {
|
||||||
Company company = getEntity();
|
CompanyVo company = getEntity();
|
||||||
if (getCompanyService().makePathAbsent(company)) {
|
if (getCompanyService().makePathAbsent(company)) {
|
||||||
save(company);
|
save(company);
|
||||||
} else {
|
} else {
|
||||||
@@ -99,7 +100,7 @@ public class CompanyTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onCompanyPathSameAsNameAction(ActionEvent event) {
|
private void onCompanyPathSameAsNameAction(ActionEvent event) {
|
||||||
Company company = getEntity();
|
CompanyVo company = getEntity();
|
||||||
String path = company.getPath();
|
String path = company.getPath();
|
||||||
if (!StringUtils.hasText(path)) {
|
if (!StringUtils.hasText(path)) {
|
||||||
return;
|
return;
|
||||||
@@ -183,10 +184,10 @@ public class CompanyTabSkinBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Company company = getEntity();
|
CompanyVo company = getEntity();
|
||||||
List<CompanyOldName> oldNames = getCompanyOldNameService().findAllByCompanyAndName(company, oldName);
|
List<CompanyOldNameVo> oldNames = getCompanyOldNameService().findAllByCompanyAndName(company, oldName);
|
||||||
if (oldNames.isEmpty()) {
|
if (oldNames.isEmpty()) {
|
||||||
CompanyOldName companyOldName = new CompanyOldName();
|
CompanyOldNameVo companyOldName = new CompanyOldNameVo();
|
||||||
companyOldName.setCompanyId(company.getId());
|
companyOldName.setCompanyId(company.getId());
|
||||||
companyOldName.setName(oldName);
|
companyOldName.setName(oldName);
|
||||||
companyOldName.setAmbiguity(ambiguity.isSelected());
|
companyOldName.setAmbiguity(ambiguity.isSelected());
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ import com.ecep.contract.BlackReasonType;
|
|||||||
import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
|
import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.model.CloudRk;
|
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.CompanyBlackReason;
|
import com.ecep.contract.model.CompanyBlackReason;
|
||||||
import com.ecep.contract.service.CloudRkService;
|
import com.ecep.contract.service.CloudRkService;
|
||||||
import com.ecep.contract.service.CompanyBlackReasonService;
|
import com.ecep.contract.service.CompanyBlackReasonService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.CompanyBlackReasonViewModel;
|
import com.ecep.contract.vm.CompanyBlackReasonViewModel;
|
||||||
|
import com.ecep.contract.vo.CloudRkVo;
|
||||||
|
import com.ecep.contract.vo.CompanyBlackReasonVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -29,8 +30,8 @@ import lombok.Setter;
|
|||||||
*/
|
*/
|
||||||
@FxmlPath("/ui/company/company-tab-black-list.fxml")
|
@FxmlPath("/ui/company/company-tab-black-list.fxml")
|
||||||
public class CompanyTabSkinBlackReason
|
public class CompanyTabSkinBlackReason
|
||||||
extends AbstCompanyTableTabSkin<CompanyBlackReason, CompanyBlackReasonViewModel>
|
extends AbstCompanyTableTabSkin<CompanyBlackReasonVo, CompanyBlackReasonViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<CompanyBlackReason, CompanyBlackReasonViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<CompanyBlackReasonVo, CompanyBlackReasonViewModel> {
|
||||||
/**
|
/**
|
||||||
* 以下是黑名单列定义
|
* 以下是黑名单列定义
|
||||||
*/
|
*/
|
||||||
@@ -97,10 +98,10 @@ public class CompanyTabSkinBlackReason
|
|||||||
|
|
||||||
|
|
||||||
private void onTableUpdateAction(ActionEvent event) {
|
private void onTableUpdateAction(ActionEvent event) {
|
||||||
Company company = getParent();
|
CompanyVo company = getParent();
|
||||||
|
|
||||||
CloudRkService cloudRkService = getCloudRkService();
|
CloudRkService cloudRkService = getCloudRkService();
|
||||||
CloudRk cloudRk = cloudRkService.getOrCreateCloudRk(company);
|
CloudRkVo cloudRk = cloudRkService.getOrCreateCloudRk(company);
|
||||||
if (cloudRkService.checkBlackListUpdateElapse(company, cloudRk)) {
|
if (cloudRkService.checkBlackListUpdateElapse(company, cloudRk)) {
|
||||||
try {
|
try {
|
||||||
cloudRkService.updateBlackList(company, cloudRk);
|
cloudRkService.updateBlackList(company, cloudRk);
|
||||||
@@ -116,17 +117,17 @@ public class CompanyTabSkinBlackReason
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyBlackReason loadRowData(CompanyBlackReasonViewModel row) {
|
public CompanyBlackReasonVo loadRowData(CompanyBlackReasonViewModel row) {
|
||||||
return getViewModelService().findById(row.getId().get());
|
return getViewModelService().findById(row.getId().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyBlackReason saveRowData(CompanyBlackReason entity) {
|
public CompanyBlackReasonVo saveRowData(CompanyBlackReasonVo entity) {
|
||||||
return getViewModelService().save(entity);
|
return getViewModelService().save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteRowData(CompanyBlackReason entity) {
|
public void deleteRowData(CompanyBlackReasonVo entity) {
|
||||||
getViewModelService().delete(entity);
|
getViewModelService().delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.ecep.contract.model.CompanyContact;
|
|||||||
import com.ecep.contract.service.CompanyContactService;
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.vm.CompanyContactViewModel;
|
import com.ecep.contract.vm.CompanyContactViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyContactVo;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -25,8 +26,8 @@ import lombok.Setter;
|
|||||||
*/
|
*/
|
||||||
@FxmlPath("/ui/company/company-tab-contact.fxml")
|
@FxmlPath("/ui/company/company-tab-contact.fxml")
|
||||||
public class CompanyTabSkinContact
|
public class CompanyTabSkinContact
|
||||||
extends AbstCompanyTableTabSkin<CompanyContact, CompanyContactViewModel>
|
extends AbstCompanyTableTabSkin<CompanyContactVo, CompanyContactViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<CompanyContact, CompanyContactViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<CompanyContactVo, CompanyContactViewModel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 以下是联系人列定义
|
* 以下是联系人列定义
|
||||||
@@ -86,8 +87,8 @@ public class CompanyTabSkinContact
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableAddAction(ActionEvent event) {
|
protected void onTableAddAction(ActionEvent event) {
|
||||||
CompanyContact contact = new CompanyContact();
|
CompanyContactVo contact = new CompanyContactVo();
|
||||||
contact.setCompany(getParent());
|
contact.setCompanyId(getParent().getId());
|
||||||
contact.setCreated(LocalDate.now());
|
contact.setCreated(LocalDate.now());
|
||||||
getViewModelService().save(contact);
|
getViewModelService().save(contact);
|
||||||
loadTableDataSet();
|
loadTableDataSet();
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.ecep.contract.controller.tab;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@@ -20,7 +19,6 @@ import com.ecep.contract.controller.table.cell.ContractTypeTableCell;
|
|||||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.converter.ContractGroupStringConverter;
|
import com.ecep.contract.converter.ContractGroupStringConverter;
|
||||||
import com.ecep.contract.model.Company;
|
|
||||||
import com.ecep.contract.model.Contract;
|
import com.ecep.contract.model.Contract;
|
||||||
import com.ecep.contract.model.ContractGroup;
|
import com.ecep.contract.model.ContractGroup;
|
||||||
import com.ecep.contract.model.ContractKind;
|
import com.ecep.contract.model.ContractKind;
|
||||||
@@ -32,8 +30,12 @@ import com.ecep.contract.service.ContractService;
|
|||||||
import com.ecep.contract.service.ContractTypeService;
|
import com.ecep.contract.service.ContractTypeService;
|
||||||
import com.ecep.contract.task.ContractRepairByCompanyTask;
|
import com.ecep.contract.task.ContractRepairByCompanyTask;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
|
import com.ecep.contract.vo.ContractGroupVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
@@ -51,29 +53,38 @@ import javafx.scene.input.KeyCode;
|
|||||||
*/
|
*/
|
||||||
@FxmlPath("/ui/company/company-tab-contract.fxml")
|
@FxmlPath("/ui/company/company-tab-contract.fxml")
|
||||||
public class CompanyTabSkinContract
|
public class CompanyTabSkinContract
|
||||||
extends AbstCompanyTableTabSkin<Contract, ContractViewModel>
|
extends AbstCompanyTableTabSkin<ContractVo, ContractViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<Contract, ContractViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<ContractVo, ContractViewModel> {
|
||||||
|
|
||||||
public TableColumn<ContractViewModel, Number> contractTable_idColumn;
|
public TableColumn<ContractViewModel, Number> contractTable_idColumn;
|
||||||
public TableColumn<ContractViewModel, String> contractTable_codeColumn;
|
public TableColumn<ContractViewModel, String> contractTable_codeColumn;
|
||||||
public TableColumn<ContractViewModel, String> contractTable_nameColumn;
|
public TableColumn<ContractViewModel, String> contractTable_nameColumn;
|
||||||
public TableColumn<ContractViewModel, String> contractTable_stateColumn;
|
public TableColumn<ContractViewModel, String> contractTable_stateColumn;
|
||||||
public TableColumn<ContractViewModel, ContractGroup> contractTable_groupColumn;
|
/**
|
||||||
public TableColumn<ContractViewModel, ContractType> contractTable_typeColumn;
|
* ContractGroup
|
||||||
public TableColumn<ContractViewModel, ContractKind> contractTable_kindColumn;
|
*/
|
||||||
|
public TableColumn<ContractViewModel, Integer> contractTable_groupColumn;
|
||||||
|
/**
|
||||||
|
* ContractType
|
||||||
|
*/
|
||||||
|
public TableColumn<ContractViewModel, Integer> contractTable_typeColumn;
|
||||||
|
/**
|
||||||
|
* ContractKind
|
||||||
|
*/
|
||||||
|
public TableColumn<ContractViewModel, Integer> contractTable_kindColumn;
|
||||||
public TableColumn<ContractViewModel, String> contractTable_parentCodeColumn;
|
public TableColumn<ContractViewModel, String> contractTable_parentCodeColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> contractTable_orderDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> contractTable_orderDateColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> contractTable_startDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> contractTable_startDateColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> contractTable_endDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> contractTable_endDateColumn;
|
||||||
public TableColumn<ContractViewModel, Employee> contractTable_setupPersonColumn;
|
public TableColumn<ContractViewModel, Integer> contractTable_setupPersonColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> contractTable_setupDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> contractTable_setupDateColumn;
|
||||||
public TableColumn<ContractViewModel, Employee> contractTable_inurePersonColumn;
|
public TableColumn<ContractViewModel, Integer> contractTable_inurePersonColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> contractTable_inureDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> contractTable_inureDateColumn;
|
||||||
public TableColumn<ContractViewModel, Employee> contractTable_varyPersonColumn;
|
public TableColumn<ContractViewModel, Integer> contractTable_varyPersonColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDate> contractTable_varyDateColumn;
|
public TableColumn<ContractViewModel, LocalDate> contractTable_varyDateColumn;
|
||||||
public TableColumn<ContractViewModel, LocalDateTime> contractTable_createdColumn;
|
public TableColumn<ContractViewModel, LocalDateTime> contractTable_createdColumn;
|
||||||
|
|
||||||
public ComboBox<ContractGroup> contractGroupSelector;
|
public ComboBox<ContractGroupVo> contractGroupSelector;
|
||||||
public TextField contractSearchKeyField;
|
public TextField contractSearchKeyField;
|
||||||
public Button contractSearchBtn;
|
public Button contractSearchBtn;
|
||||||
public Button contractTabToolBtn1;
|
public Button contractTabToolBtn1;
|
||||||
@@ -93,11 +104,11 @@ public class CompanyTabSkinContract
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Company parent) {
|
public ParamUtils.Builder getSpecification(CompanyVo parent) {
|
||||||
Map<String, Object> spec = super.getSpecification(parent);
|
ParamUtils.Builder spec = super.getSpecification(parent);
|
||||||
ContractGroup selectedGroup = contractGroupSelector.getValue();
|
ContractGroupVo selectedGroup = contractGroupSelector.getValue();
|
||||||
if (selectedGroup != null) {
|
if (selectedGroup != null) {
|
||||||
spec.put("group", selectedGroup.getId());
|
spec.equals("group", selectedGroup.getId());
|
||||||
}
|
}
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@@ -112,7 +123,7 @@ public class CompanyTabSkinContract
|
|||||||
|
|
||||||
contractSearchBtn.setOnAction(this::onTableRefreshAction);
|
contractSearchBtn.setOnAction(this::onTableRefreshAction);
|
||||||
|
|
||||||
ObservableList<ContractGroup> contractGroups = FXCollections.observableArrayList();
|
ObservableList<ContractGroupVo> contractGroups = FXCollections.observableArrayList();
|
||||||
contractGroups.add(null);
|
contractGroups.add(null);
|
||||||
contractGroups.addAll(getContractGroupService().findAll());
|
contractGroups.addAll(getContractGroupService().findAll());
|
||||||
contractGroupSelector.setItems(contractGroups);
|
contractGroupSelector.setItems(contractGroups);
|
||||||
@@ -127,13 +138,13 @@ public class CompanyTabSkinContract
|
|||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
// 计算主合同编号
|
// 计算主合同编号
|
||||||
for (ContractViewModel model : dataSet) {
|
for (ContractViewModel model : dataSet) {
|
||||||
Contract contract = getViewModelService().findById(model.getId().get());
|
ContractVo contract = getViewModelService().findById(model.getId().get());
|
||||||
if (contract == null) {
|
if (contract == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (getViewModelService().updateParentCode(contract)) {
|
if (getViewModelService().updateParentCode(contract)) {
|
||||||
Contract updated = getViewModelService().save(contract);
|
ContractVo updated = getViewModelService().save(contract);
|
||||||
model.update(updated);
|
model.update(updated);
|
||||||
}
|
}
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import com.ecep.contract.service.CompanyFileTypeService;
|
import com.ecep.contract.service.CompanyFileTypeService;
|
||||||
import com.ecep.contract.service.ContractFileTypeService;
|
import com.ecep.contract.service.ContractFileTypeService;
|
||||||
|
import com.ecep.contract.vo.CompanyFileVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import org.springframework.util.FileSystemUtils;
|
import org.springframework.util.FileSystemUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
@@ -46,8 +48,8 @@ import javafx.scene.control.TableColumn;
|
|||||||
*/
|
*/
|
||||||
@FxmlPath("/ui/company/company-tab-file.fxml")
|
@FxmlPath("/ui/company/company-tab-file.fxml")
|
||||||
public class CompanyTabSkinFile
|
public class CompanyTabSkinFile
|
||||||
extends AbstCompanyTableTabSkin<CompanyFile, CompanyFileViewModel>
|
extends AbstCompanyTableTabSkin<CompanyFileVo, CompanyFileViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<CompanyFile, CompanyFileViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<CompanyFileVo, CompanyFileViewModel> {
|
||||||
|
|
||||||
public TableColumn<CompanyFileViewModel, Number> idColumn;
|
public TableColumn<CompanyFileViewModel, Number> idColumn;
|
||||||
public TableColumn<CompanyFileViewModel, String> typeColumn;
|
public TableColumn<CompanyFileViewModel, String> typeColumn;
|
||||||
@@ -120,7 +122,7 @@ public class CompanyTabSkinFile
|
|||||||
* 从 下载目录 中查找相关的资质文件
|
* 从 下载目录 中查找相关的资质文件
|
||||||
*/
|
*/
|
||||||
private void onTableRetrieveFromDownloadDirAction(ActionEvent event) {
|
private void onTableRetrieveFromDownloadDirAction(ActionEvent event) {
|
||||||
Company company = getParent();
|
CompanyVo company = getParent();
|
||||||
MyProperties myProperties = getBean(MyProperties.class);
|
MyProperties myProperties = getBean(MyProperties.class);
|
||||||
File dir = myProperties.getDownloadDirectory();
|
File dir = myProperties.getDownloadDirectory();
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
@@ -152,8 +154,8 @@ public class CompanyTabSkinFile
|
|||||||
*/
|
*/
|
||||||
private void onTableMoveFileAction(ActionEvent event) {
|
private void onTableMoveFileAction(ActionEvent event) {
|
||||||
CompanyFileService companyFileService = getCompanyFileService();
|
CompanyFileService companyFileService = getCompanyFileService();
|
||||||
Company company = getParent();
|
CompanyVo company = getParent();
|
||||||
List<CompanyFile> list = companyFileService.findByCompany(company);
|
List<CompanyFileVo> list = companyFileService.findByCompany(company);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -167,7 +169,7 @@ public class CompanyTabSkinFile
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File companyPath = new File(path);
|
File companyPath = new File(path);
|
||||||
for (CompanyFile companyFile : list) {
|
for (CompanyFileVo companyFile : list) {
|
||||||
String filePath = companyFile.getFilePath();
|
String filePath = companyFile.getFilePath();
|
||||||
if (StringUtils.hasText(filePath)) {
|
if (StringUtils.hasText(filePath)) {
|
||||||
File file = new File(filePath);
|
File file = new File(filePath);
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package com.ecep.contract.controller.tab;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
|
import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
|
||||||
@@ -38,7 +39,7 @@ import lombok.Setter;
|
|||||||
*/
|
*/
|
||||||
@FxmlPath("/ui/company/company-tab-oldname.fxml")
|
@FxmlPath("/ui/company/company-tab-oldname.fxml")
|
||||||
public class CompanyTabSkinOldName
|
public class CompanyTabSkinOldName
|
||||||
extends AbstCompanyTableTabSkin<CompanyOldName, CompanyOldNameViewModel>
|
extends AbstCompanyTableTabSkin<CompanyOldNameVo, CompanyOldNameViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,12 +73,9 @@ public class CompanyTabSkinOldName
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getSpecification(Company parent) {
|
public ParamUtils.Builder getSpecification(CompanyVo parent) {
|
||||||
Map<String, Object> params = getSpecification();
|
ParamUtils.Builder params = getSpecification();
|
||||||
if (params == null) {
|
params.equals("company", parent.getId());
|
||||||
params = new HashMap<>();
|
|
||||||
}
|
|
||||||
params.put("company", parent.getId());
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +122,7 @@ public class CompanyTabSkinOldName
|
|||||||
if (optional.isEmpty()) {
|
if (optional.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompanyOldName oldName = new CompanyOldName();
|
CompanyOldNameVo oldName = new CompanyOldNameVo();
|
||||||
oldName.setName(optional.get());
|
oldName.setName(optional.get());
|
||||||
oldName.setCompanyId(viewModel.getId().get());
|
oldName.setCompanyId(viewModel.getId().get());
|
||||||
oldName.setAmbiguity(true);
|
oldName.setAmbiguity(true);
|
||||||
@@ -134,7 +132,7 @@ public class CompanyTabSkinOldName
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean deleteRow(CompanyOldNameViewModel row) {
|
protected boolean deleteRow(CompanyOldNameViewModel row) {
|
||||||
CompanyOldName entity = getViewModelService().findById(row.getId().get());
|
CompanyOldNameVo entity = getViewModelService().findById(row.getId().get());
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
getViewModelService().delete(entity);
|
getViewModelService().delete(entity);
|
||||||
}
|
}
|
||||||
@@ -142,7 +140,7 @@ public class CompanyTabSkinOldName
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onTableMergeAction(ActionEvent event) {
|
private void onTableMergeAction(ActionEvent event) {
|
||||||
Company updater = getParent();
|
CompanyVo updater = getParent();
|
||||||
HashSet<String> nameSet = new HashSet<>();
|
HashSet<String> nameSet = new HashSet<>();
|
||||||
nameSet.add(updater.getName());
|
nameSet.add(updater.getName());
|
||||||
|
|
||||||
@@ -168,8 +166,8 @@ public class CompanyTabSkinOldName
|
|||||||
for (String name : nameSet) {
|
for (String name : nameSet) {
|
||||||
controller.setRightStatus(count + "/" + size);
|
controller.setRightStatus(count + "/" + size);
|
||||||
if (StringUtils.hasText(name)) {
|
if (StringUtils.hasText(name)) {
|
||||||
List<Company> list = getParentService().findAllByName(name);
|
List<CompanyVo> list = getParentService().findAllByName(name);
|
||||||
for (Company company : list) {
|
for (CompanyVo company : list) {
|
||||||
// fixed 曾用名中有可能有 updater 的名字,会导致自己删除自己
|
// fixed 曾用名中有可能有 updater 的名字,会导致自己删除自己
|
||||||
if (Objects.equals(company.getId(), updater.getId())) {
|
if (Objects.equals(company.getId(), updater.getId())) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ecep.contract.controller.tab;
|
package com.ecep.contract.controller.tab;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ecep.contract.ContractPayWay;
|
import com.ecep.contract.ContractPayWay;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
@@ -15,14 +14,15 @@ import com.ecep.contract.controller.table.cell.ContractGroupTableCell;
|
|||||||
import com.ecep.contract.controller.table.cell.ContractKindTableCell;
|
import com.ecep.contract.controller.table.cell.ContractKindTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.ContractTypeTableCell;
|
import com.ecep.contract.controller.table.cell.ContractTypeTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import com.ecep.contract.model.Contract;
|
|
||||||
import com.ecep.contract.model.ContractGroup;
|
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.ContractGroupService;
|
import com.ecep.contract.service.ContractGroupService;
|
||||||
import com.ecep.contract.service.ContractKindService;
|
import com.ecep.contract.service.ContractKindService;
|
||||||
import com.ecep.contract.service.ContractService;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.service.ContractTypeService;
|
import com.ecep.contract.service.ContractTypeService;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.ContractViewModel;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vo.ContractGroupVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
@@ -31,7 +31,7 @@ import javafx.util.converter.LocalDateTimeStringConverter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class ContractManagerSkin
|
public class ContractManagerSkin
|
||||||
extends AbstEntityManagerSkin<Contract, ContractViewModel, ContractManagerSkin, ContractManagerWindowController>
|
extends AbstEntityManagerSkin<ContractVo, ContractViewModel, ContractManagerSkin, ContractManagerWindowController>
|
||||||
implements ManagerSkin {
|
implements ManagerSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
@@ -49,26 +49,31 @@ public class ContractManagerSkin
|
|||||||
public ContractService getContractService() {
|
public ContractService getContractService() {
|
||||||
return controller.getViewModelService();
|
return controller.getViewModelService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyService getCompanyService() {
|
public CompanyService getCompanyService() {
|
||||||
return getBean(CompanyService.class);
|
return getBean(CompanyService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContractTypeService getContractTypeService() {
|
private ContractTypeService getContractTypeService() {
|
||||||
return getBean(ContractTypeService.class);
|
return getBean(ContractTypeService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContractKindService getContractKindService() {
|
private ContractKindService getContractKindService() {
|
||||||
return getBean(ContractKindService.class);
|
return getBean(ContractKindService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContractGroupService getContractGroupService() {
|
private ContractGroupService getContractGroupService() {
|
||||||
return getBean(ContractGroupService.class);
|
return getBean(ContractGroupService.class);
|
||||||
}
|
}
|
||||||
public Map<String, Object> getSpecification() {
|
|
||||||
Map<String, Object> params = super.getSpecification();
|
public ParamUtils.Builder getSpecification() {
|
||||||
|
ParamUtils.Builder params = super.getSpecification();
|
||||||
if (controller.composeViewBtn.isSelected()) {
|
if (controller.composeViewBtn.isSelected()) {
|
||||||
params.put("payWay", ContractPayWay.RECEIVE);
|
params.equals("payWay", ContractPayWay.RECEIVE);
|
||||||
}
|
}
|
||||||
ContractGroup selectedGroup = controller.groupSelector.getValue();
|
ContractGroupVo selectedGroup = controller.groupSelector.getValue();
|
||||||
if (selectedGroup != null) {
|
if (selectedGroup != null) {
|
||||||
params.put("group", selectedGroup);
|
params.equals("group", selectedGroup.getId());
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user