feat: 添加VendorGroupRequireFileTypeVo及相关服务功能

refactor: 重构多个服务类和方法,优化代码结构
fix: 修复PermissionVo中code字段更名为key的问题
docs: 更新create_vo.md文档,添加新创建的VO记录
perf: 优化WebSocketClientService中的session关闭逻辑
style: 清理无用导入和注释,统一代码格式
This commit is contained in:
2025-09-21 23:08:34 +08:00
parent 039d753bab
commit 35b33d401b
94 changed files with 1260 additions and 810 deletions

View File

@@ -330,7 +330,7 @@ public class WebSocketClientService {
public void closeSession(WebSocketClientSession session) {
if (session != null) {
sessions.remove(session.getSessionId());
session.close();
// session.close();
}
}

View File

@@ -1,20 +1,25 @@
package com.ecep.contract.controller.customer;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.MyDateTimeUtils;
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.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.task.Tasker;
import com.ecep.contract.util.UITools;
import lombok.Setter;
import static com.ecep.contract.util.ExcelUtils.setCellValue;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.PrintSetup;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.AreaReference;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -24,13 +29,22 @@ import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import java.io.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.service.CompanyCustomerEntityService;
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
import com.ecep.contract.service.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.task.Tasker;
import com.ecep.contract.util.ExcelUtils;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vo.CompanyCustomerEntityVo;
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 static com.ecep.contract.util.ExcelUtils.*;
import lombok.Setter;
public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerExportExcelTasker.class);
@@ -41,6 +55,7 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
CompanyCustomerService customerService;
CompanyCustomerEntityService customerEntityService;
CompanyCustomerFileService customerFileService;
CompanyCustomerEvaluationFormFileService customerEvaluationFormFileService;
CompanyCustomerService getCustomerService() {
if (customerService == null)
@@ -60,6 +75,12 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
return customerEntityService;
}
CompanyCustomerEvaluationFormFileService getCustomerEvaluationFormFileService() {
if (customerEvaluationFormFileService == null)
customerEvaluationFormFileService = getBean(CompanyCustomerEvaluationFormFileService.class);
return customerEvaluationFormFileService;
}
@Override
protected Object execute(MessageHolder holder) throws Exception {
if (destFile.exists()) {
@@ -115,30 +136,15 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
}
}
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCustomerFileService()
.findAllCustomerEvaluationFormFiles(customer).stream().filter(v -> {
Integer customerFileId = v.getCustomerFile();
CompanyCustomerFileVo customerFile = getCustomerFileService().findById(customerFileId);
if (customerFile == null) {
return false;
}
return customerFile.isValid();
}).max(Comparator.comparing(v -> {
Integer customerFileId = v.getCustomerFile();
CompanyCustomerFileVo customerFile = getCustomerFileService().findById(customerFileId);
if (customerFile == null) {
return LocalDate.MIN;
}
return customerFile.getSignDate();
})).orElse(null);
CompanyCustomerFileVo customerFile = getCustomerFileService()
.findAllByCustomer(customer).stream().filter(v -> v.isValid())
.max(Comparator.comparing(v -> v.getSignDate())).orElse(null);
if (evaluationFormFile == null) {
if (customerFile == null) {
holder.warn(company.getName() + " 未匹配的客户评估");
continue;
}
CompanyCustomerFileVo customerFile = getCustomerFileService()
.findById(evaluationFormFile.getCustomerFile());
if (devDate != null && devDate.isAfter(customerFile.getSignDate())) {
holder.debug(company.getName() + " 最新评估日期早于客户开发日期,评估日期:" + customerFile.getSignDate() + ", 开发日期:"
+ devDate);
@@ -149,12 +155,12 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
if (rowIndex > 11) {
// 插入行,并复制行的格式
sheet.shiftRows(rowIndex + 3, sheet.getLastRowNum(), 1);
Row templateRow = getRow(sheet, rowIndex + 2, true);
Row newRow = getRow(sheet, rowIndex + 3, true);
Row templateRow = ExcelUtils.getRow(sheet, rowIndex + 2, true);
Row newRow = ExcelUtils.getRow(sheet, rowIndex + 3, true);
if (templateRow != null && newRow != null) {
for (int i = 0; i < templateRow.getLastCellNum(); i++) {
Cell templateCell = templateRow.getCell(i);
Cell newCell = getCell(newRow, i, true);
Cell newCell = ExcelUtils.getCell(newRow, i, true);
if (templateCell != null && newCell != null) {
newCell.setCellStyle(templateCell.getCellStyle());
}
@@ -162,7 +168,9 @@ public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
}
}
Row row = getRow(sheet, rowIndex + 3, true);
Row row = ExcelUtils.getRow(sheet, rowIndex + 3, true);
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCustomerEvaluationFormFileService()
.findByCustomerFile(customerFile);
setCellValue(row, 0, rowIndex);
setCellValue(row, 1, company.getName());

View File

@@ -30,7 +30,7 @@ public class CompanyCustomerManagerSkin
@Override
public void initializeTable() {
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany().getCompanyName());
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());

View File

@@ -44,6 +44,8 @@ public class CompanyCustomerTabSkinBase
initializeCompanyFieldAutoCompletion(controller.companyField);
initializeContactFieldAutoCompletion(controller.contactField);
UITools.autoCompletion(controller.contactField, viewModel.getContact(), getCompanyContactService());
LocalDateStringConverter converter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
controller.developDateField.setConverter(converter);
@@ -82,16 +84,11 @@ public class CompanyCustomerTabSkinBase
}
private void initializeContactFieldAutoCompletion(TextField textField) {
EntityStringConverter<CompanyContactVo> stringConverter = new EntityStringConverter<>();
stringConverter.setInitialized(cc -> getCompanyContactService().findById(cc.getId()));
UITools.autoCompletion(textField, viewModel.getContact(),
p -> getCompanyContactService().searchByCompany(viewModel.getCompany().get(), p.getUserText()),
stringConverter);
UITools.autoCompletion(textField, viewModel.getContact(), getCompanyContactService());
}
private void initializeCompanyFieldAutoCompletion(TextField textField) {
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
UITools.autoCompletion(textField, viewModel.getCompany(), converter::suggest, converter);
UITools.autoCompletion(textField, viewModel.getCompany(), getCompanyService());
}
public void onCompanyCustomerCreatePathAction(ActionEvent event) {

View File

@@ -1,24 +1,22 @@
package com.ecep.contract.controller.customer;
import com.ecep.contract.SpringApp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import com.ecep.contract.controller.table.cell.CustomerCatalogTableCell;
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.converter.EntityStringConverter;
import com.ecep.contract.vo.CompanyCustomerVo;
import com.ecep.contract.vo.CompanyCustomerEntityVo;
import com.ecep.contract.vo.CustomerCatalogVo;
import com.ecep.contract.service.CompanyCustomerEntityService;
import com.ecep.contract.service.CustomerCatalogService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.CustomerEntityViewModel;
import com.ecep.contract.vo.CompanyCustomerEntityVo;
import com.ecep.contract.vo.CompanyCustomerVo;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TableColumn;
import lombok.Setter;
import java.time.LocalDate;
import java.time.LocalDateTime;
@FxmlPath("/ui/company/customer/customer-tab-entity.fxml")
public class CustomerTabSkinEntity
@@ -26,13 +24,13 @@ public class CustomerTabSkinEntity
// 关联项 tab
public TableColumn<CustomerEntityViewModel, Number> entityTable_idColumn;
public TableColumn<CustomerEntityViewModel, String> entityTable_catalogColumn;
public TableColumn<CustomerEntityViewModel, Integer> entityTable_catalogColumn;
public TableColumn<CustomerEntityViewModel, String> entityTable_nameColumn;
public TableColumn<CustomerEntityViewModel, String> entityTable_abbNameColumn;
public TableColumn<CustomerEntityViewModel, String> entityTable_codeColumn;
public TableColumn<CustomerEntityViewModel, String> entityTable_creatorColumn;
public TableColumn<CustomerEntityViewModel, Integer> entityTable_creatorColumn;
public TableColumn<CustomerEntityViewModel, LocalDate> entityTable_developDateColumn;
public TableColumn<CustomerEntityViewModel, String> entityTable_modifierColumn;
public TableColumn<CustomerEntityViewModel, Integer> entityTable_modifierColumn;
public TableColumn<CustomerEntityViewModel, LocalDate> entityTable_modifyDateColumn;
public TableColumn<CustomerEntityViewModel, LocalDate> entityTable_updatedDateColumn;
public TableColumn<CustomerEntityViewModel, LocalDateTime> fetchedTimeColumn;
@@ -40,9 +38,6 @@ public class CustomerTabSkinEntity
public MenuItem entityTable_menu_refresh;
public MenuItem entityTable_menu_del;
@Setter
private CompanyCustomerEntityService customerEntityService;
public CustomerTabSkinEntity(CompanyCustomerWindowController controller) {
super(controller);
}
@@ -60,35 +55,28 @@ public class CustomerTabSkinEntity
entityTable_nameColumn.setCellValueFactory(param -> param.getValue().getName());
entityTable_abbNameColumn.setCellValueFactory(param -> param.getValue().getAbbName());
entityTable_codeColumn.setCellValueFactory(param -> param.getValue().getCode());
initializeEntityTabCatalogColumn(entityTable_catalogColumn);
EmployeeStringConverter stringConverter = SpringApp.getBean(EmployeeStringConverter.class);
entityTable_catalogColumn.setCellValueFactory(param -> param.getValue().getCatalog());
entityTable_catalogColumn.setCellFactory(CustomerCatalogTableCell.forTableColumn(getCustomerCatalogService()));
entityTable_developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
entityTable_modifyDateColumn.setCellValueFactory(param -> param.getValue().getModifyDate());
entityTable_creatorColumn
.setCellValueFactory(param -> param.getValue().getCreator().map(stringConverter::toString));
entityTable_modifierColumn
.setCellValueFactory(param -> param.getValue().getModifier().map(stringConverter::toString));
entityTable_updatedDateColumn.setCellValueFactory(param -> param.getValue().getUpdatedDate());
fetchedTimeColumn.setCellValueFactory(param -> param.getValue().getFetchedTime());
fetchedTimeColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
entityTable_creatorColumn.setCellValueFactory(param -> param.getValue().getCreator());
entityTable_creatorColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
entityTable_modifierColumn.setCellValueFactory(param -> param.getValue().getModifier());
entityTable_modifierColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
entityTable_menu_refresh.setOnAction(this::onTableRefreshAction);
entityTable_menu_del.setOnAction(this::onTableDeleteAction);
}
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
EntityStringConverter<CustomerCatalogVo> converter = new EntityStringConverter<>();
converter.setInitialized(v -> getCachedBean(CustomerCatalogService.class).findById(v.getId()));
column.setCellValueFactory(param -> param.getValue().getCatalog().map(converter::toString));
}
CompanyCustomerEntityService getCompanyCustomerEntityService() {
if (customerEntityService == null) {
customerEntityService = getBean(CompanyCustomerEntityService.class);
}
return customerEntityService;
return getCachedBean(CompanyCustomerEntityService.class);
}
@Override
@@ -96,6 +84,10 @@ public class CustomerTabSkinEntity
return getCompanyCustomerEntityService();
}
CustomerCatalogService getCustomerCatalogService() {
return getCachedBean(CustomerCatalogService.class);
}
@Override
public ParamUtils.Builder getSpecification(CompanyCustomerVo parent) {
ParamUtils.Builder params = getSpecification();

View File

@@ -18,6 +18,7 @@ import com.ecep.contract.constant.CompanyCustomerConstant;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
import com.ecep.contract.service.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerFileTypeService;
import com.ecep.contract.service.CompanyCustomerService;
@@ -26,6 +27,7 @@ import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
import com.ecep.contract.vo.CompanyCustomerFileVo;
import com.ecep.contract.vo.CompanyCustomerVo;
import com.ecep.contract.vo.CompanyVo;
@@ -156,10 +158,13 @@ public class CustomerTabSkinFile
protected void onTableRowDoubleClickedAction(CompanyCustomerFileViewModel item) {
CompanyCustomerFileType fileType = item.getType().get();
if (fileType == CompanyCustomerFileType.EvaluationForm) {
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCachedBean(
CompanyCustomerEvaluationFormFileService.class).findByCustomerFile(item.getId().get());
// 文件不是 Excel 文件时打开编辑UI
if (!FileUtils.withExtensions(item.getFilePath().get(), FileUtils.XLS,
FileUtils.XLSX)) {
CompanyCustomerEvaluationFormFileWindowController.show(item, controller.root.getScene().getWindow());
CompanyCustomerEvaluationFormFileWindowController.show(evaluationFormFile,
controller.root.getScene().getWindow());
return;
}
}
@@ -205,7 +210,11 @@ public class CustomerTabSkinFile
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
model.update(saved);
dataSet.add(model);
CompanyCustomerEvaluationFormFileWindowController.show(model,
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCachedBean(
CompanyCustomerEvaluationFormFileService.class).findByCustomerFile(saved);
CompanyCustomerEvaluationFormFileWindowController.show(evaluationFormFile,
getTableView().getScene().getWindow());
});
return;

View File

@@ -32,10 +32,10 @@ public class CustomerTabSkinSatisfactionSurvey
// 关联项 tab
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> idColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, ProjectVo> projectColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, Integer> projectColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, String> codeColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> totalScoreColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, EmployeeVo> applicantColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, Integer> applicantColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDateTime> applyTimeColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, String> descriptionColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDate> dateColumn;
@@ -62,8 +62,9 @@ public class CustomerTabSkinSatisfactionSurvey
bindNumberColumn(idColumn, CustomerSatisfactionSurveyViewModel::getId);
bindColumn(codeColumn, CustomerSatisfactionSurveyViewModel::getCode);
projectColumn.setCellValueFactory(param -> param.getValue().getProject());
projectColumn.setCellFactory(cell -> new ProjectTableCell<>(getProjectService()));
projectColumn.setCellFactory(ProjectTableCell.forTableColumn(getProjectService()));
bindLocalDateColumn(dateColumn, CustomerSatisfactionSurveyViewModel::getDate);
bindNumberColumn(totalScoreColumn, CustomerSatisfactionSurveyViewModel::getTotalScore);
applicantColumn.setCellValueFactory(param -> param.getValue().getApplicant());
@@ -75,12 +76,6 @@ public class CustomerTabSkinSatisfactionSurvey
entityTable_menu_del.setOnAction(this::onTableDeleteAction);
}
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
EntityStringConverter<CustomerCatalogVo> converter = new EntityStringConverter<>();
converter.setInitialized(v -> getCachedBean(CustomerCatalogService.class).findById(v.getId()));
column.setCellValueFactory(param -> param.getValue().getCatalog().map(converter::toString));
}
private CustomerSatisfactionSurveyService getCustomerSatisfactionSurveyService() {
if (satisfactionSurveyService == null) {
satisfactionSurveyService = getBean(CustomerSatisfactionSurveyService.class);

View File

@@ -4,9 +4,9 @@ import java.time.LocalDateTime;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import com.ecep.contract.model.EmployeeLoginHistory;
import com.ecep.contract.service.EmployeeLoginHistoryService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vo.EmployeeLoginHistoryVo;
import com.ecep.contract.vm.EmployeeLoginHistoryViewModel;
import javafx.application.Platform;
@@ -15,7 +15,7 @@ import javafx.scene.control.TableColumn;
@FxmlPath("/ui/employee/employee-login-history.fxml")
public class EmployeeTabSkinLoginHistory
extends AbstEmployeeTableTabSkin<EmployeeLoginHistory, EmployeeLoginHistoryViewModel>
extends AbstEmployeeTableTabSkin<EmployeeLoginHistoryVo, EmployeeLoginHistoryViewModel>
implements TabSkin {
public TableColumn<EmployeeLoginHistoryViewModel, Number> idColumn;
public TableColumn<EmployeeLoginHistoryViewModel, String> ipColumn;

View File

@@ -1,18 +1,18 @@
package com.ecep.contract.controller.employee;
import java.util.HashMap;
import java.util.List;
import org.springframework.data.domain.Pageable;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.service.EmployeeRoleService;
import com.ecep.contract.vo.EmployeeRoleVo;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ListChangeListener;
import javafx.scene.control.ListCell;
import javafx.scene.control.Tab;
import org.springframework.data.domain.Pageable;
import java.util.HashMap;
import java.util.List;
public class EmployeeTabSkinRole
extends AbstEmployeeBasedTabSkin
@@ -41,7 +41,7 @@ public class EmployeeTabSkinRole
}
private void loadSelectedRoles() {
List<EmployeeRole> selectedRoles = getEmployeeService().getRolesByEmployeeId(viewModel.getId().get());
List<EmployeeRoleVo> selectedRoles = getEmployeeService().getRolesByEmployeeId(viewModel.getId().get());
controller.rolesField.getTargetItems().setAll(selectedRoles);
changed.set(false);
}
@@ -49,13 +49,13 @@ public class EmployeeTabSkinRole
private void initializeListView() {
// 非系统内置账户
HashMap<String, Object> params = new HashMap<>();
List<EmployeeRole> roles = getEmployeeRoleService().findAll(params, Pageable.ofSize(500)).getContent();
List<EmployeeRoleVo> roles = getEmployeeRoleService().findAll(params, Pageable.ofSize(500)).getContent();
controller.rolesField.getSourceItems().setAll(roles);
controller.rolesField.setCellFactory(param -> {
return new ListCell<>() {
return new ListCell<EmployeeRoleVo>() {
@Override
protected void updateItem(EmployeeRole item, boolean empty) {
protected void updateItem(EmployeeRoleVo item, boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setText(null);
@@ -66,10 +66,10 @@ public class EmployeeTabSkinRole
};
});
controller.rolesField.getTargetItems().addListener((ListChangeListener<EmployeeRole>) change -> {
controller.rolesField.getTargetItems().addListener((ListChangeListener<EmployeeRoleVo>) change -> {
while (change.next()) {
List<? extends EmployeeRole> added = change.getAddedSubList();
List<? extends EmployeeRole> removed = change.getRemoved();
List<? extends EmployeeRoleVo> added = change.getAddedSubList();
List<? extends EmployeeRoleVo> removed = change.getRemoved();
if (!added.isEmpty() || !removed.isEmpty()) {
changed.set(true);
}
@@ -79,9 +79,7 @@ public class EmployeeTabSkinRole
@Override
public void save() {
Employee entity = getEntity();
entity.setRoles(controller.rolesField.getTargetItems());
save(entity);
getEmployeeService().getUpdateEmployeeRoles(viewModel.getId().get(), controller.rolesField.getTargetItems());
loadSelectedRoles();
}
}

View File

@@ -1,6 +1,5 @@
package com.ecep.contract.controller.employee;
import com.ecep.contract.vo.EmployeeVo;
import org.controlsfx.control.ListSelectionView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,11 +9,11 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.controller.AbstEntityController;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.service.EmployeeService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.EmployeeViewModel;
import com.ecep.contract.vo.EmployeeRoleVo;
import com.ecep.contract.vo.EmployeeVo;
import javafx.scene.control.CheckBox;
import javafx.scene.control.DatePicker;
@@ -61,7 +60,7 @@ public class EmployeeWindowController extends AbstEntityController<EmployeeVo, E
*/
public Tab rolesTab;
public ListSelectionView<EmployeeRole> rolesField;
public ListSelectionView<EmployeeRoleVo> rolesField;
public Tab loginHistoryTab;
public Tab authBindTab;

View File

@@ -7,11 +7,11 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.model.Function;
import com.ecep.contract.service.FunctionService;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.FunctionViewModel;
import com.ecep.contract.vo.FunctionVo;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
@@ -25,7 +25,7 @@ import javafx.stage.Stage;
@FxmlPath("/ui/employee/functions-manager.fxml")
@Component
public class EmployeeFunctionsManagerWindowController
extends AbstManagerWindowController<Function, FunctionViewModel, FunctionManagerSkin> {
extends AbstManagerWindowController<FunctionVo, FunctionViewModel, FunctionManagerSkin> {
@Autowired
PermissionService permissionService;

View File

@@ -3,7 +3,7 @@ package com.ecep.contract.controller.permission;
import com.ecep.contract.controller.AbstEntityManagerSkin;
import com.ecep.contract.controller.ManagerSkin;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.vo.EmployeeRoleVo;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.vm.EmployeeRoleViewModel;
@@ -12,8 +12,8 @@ import lombok.Setter;
public class EmployeeRoleManagerSkin
extends
AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRoleManagerWindowController>
implements ManagerSkin, EditableEntityTableTabSkin<EmployeeRole, EmployeeRoleViewModel> {
AbstEntityManagerSkin<EmployeeRoleVo, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRoleManagerWindowController>
implements ManagerSkin, EditableEntityTableTabSkin<EmployeeRoleVo, EmployeeRoleViewModel> {
@Setter
private PermissionService permissionService;

View File

@@ -8,11 +8,11 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.service.EmployeeRoleService;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.EmployeeRoleViewModel;
import com.ecep.contract.vo.EmployeeRoleVo;
import javafx.event.ActionEvent;
import javafx.scene.control.TableColumn;
@@ -23,7 +23,7 @@ import javafx.stage.Stage;
@Component
@FxmlPath("/ui/employee/roles-manager.fxml")
public class EmployeeRoleManagerWindowController
extends AbstManagerWindowController<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin> {
extends AbstManagerWindowController<EmployeeRoleVo, EmployeeRoleViewModel, EmployeeRoleManagerSkin> {
private static final Logger logger = LoggerFactory.getLogger(EmployeeRoleManagerWindowController.class);
@Autowired

View File

@@ -1,10 +1,10 @@
package com.ecep.contract.controller.permission;
import com.ecep.contract.controller.AbstEntityManagerSkin;
import com.ecep.contract.model.Function;
import com.ecep.contract.service.FunctionService;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.vm.FunctionViewModel;
import com.ecep.contract.vo.FunctionVo;
import javafx.scene.control.TableColumn;
import javafx.scene.control.cell.CheckBoxTableCell;
@@ -12,7 +12,7 @@ import javafx.scene.control.cell.TextFieldTableCell;
public class FunctionManagerSkin
extends
AbstEntityManagerSkin<Function, FunctionViewModel, FunctionManagerSkin, EmployeeFunctionsManagerWindowController> {
AbstEntityManagerSkin<FunctionVo, FunctionViewModel, FunctionManagerSkin, EmployeeFunctionsManagerWindowController> {
public FunctionManagerSkin(EmployeeFunctionsManagerWindowController controller) {
super(controller);

View File

@@ -1,13 +1,13 @@
package com.ecep.contract.controller.permission;
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.model.Function;
import com.ecep.contract.vm.FunctionViewModel;
import com.ecep.contract.vo.FunctionVo;
import javafx.scene.control.Tab;
public class FunctionTabSkinBase
extends AbstEntityBasedTabSkin<FunctionWindowController, Function, FunctionViewModel> {
extends AbstEntityBasedTabSkin<FunctionWindowController, FunctionVo, FunctionViewModel> {
public FunctionTabSkinBase(FunctionWindowController controller) {
super(controller);

View File

@@ -1,8 +1,5 @@
package com.ecep.contract.controller.permission;
import java.util.Map;
import com.ecep.contract.util.ParamUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
@@ -10,8 +7,11 @@ import com.ecep.contract.model.Function;
import com.ecep.contract.model.Permission;
import com.ecep.contract.service.PermissionService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.FunctionViewModel;
import com.ecep.contract.vm.PermissionViewModel;
import com.ecep.contract.vo.FunctionVo;
import com.ecep.contract.vo.PermissionVo;
import javafx.fxml.FXML;
import javafx.scene.control.Tab;
@@ -20,7 +20,7 @@ import javafx.scene.control.TableColumn;
@FxmlPath("/ui/employee/function-tab-permission.fxml")
public class FunctionTabSkinPermission
extends
AbstEntityTableTabSkin<FunctionWindowController, Function, FunctionViewModel, Permission, PermissionViewModel> {
AbstEntityTableTabSkin<FunctionWindowController, FunctionVo, FunctionViewModel, PermissionVo, PermissionViewModel> {
@FXML
public TableColumn<PermissionViewModel, Number> idColumn;
@@ -62,7 +62,7 @@ public class FunctionTabSkinPermission
}
@Override
public ParamUtils.Builder getSpecification(Function parent) {
public ParamUtils.Builder getSpecification(FunctionVo parent) {
ParamUtils.Builder params = getSpecification();
params.equals("function", parent.getId());
return params;

View File

@@ -8,10 +8,11 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.controller.AbstEntityController;
import com.ecep.contract.model.Function;
import com.ecep.contract.service.FunctionService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.FunctionViewModel;
import com.ecep.contract.vo.FunctionVo;
import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
@@ -28,7 +29,7 @@ import lombok.Getter;
@Scope("prototype")
@Component
@FxmlPath("/ui/employee/function.fxml")
public class FunctionWindowController extends AbstEntityController<Function, FunctionViewModel> {
public class FunctionWindowController extends AbstEntityController<FunctionVo, FunctionViewModel> {
private static final Logger logger = LoggerFactory.getLogger(FunctionWindowController.class);
/**
@@ -61,8 +62,8 @@ public class FunctionWindowController extends AbstEntityController<Function, Fun
@FXML
public Label versionLabel;
public static void show(Function function, Window owner) {
FunctionViewModel model = FunctionViewModel.from(function);
public static void show(FunctionVo functionVo, Window owner) {
FunctionViewModel model = FunctionViewModel.from(functionVo);
show(model, owner);
}

View File

@@ -1,22 +1,20 @@
package com.ecep.contract.controller.permission;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import com.ecep.contract.util.ParamUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ecep.contract.controller.ManagerSkin;
import com.ecep.contract.controller.table.TableTabSkin;
import com.ecep.contract.model.Permission;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.FunctionViewModel;
import com.ecep.contract.vm.PermissionViewModel;
import com.ecep.contract.vo.PermissionVo;
import javafx.application.Platform;
import javafx.beans.property.Property;
@@ -29,7 +27,7 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import lombok.Setter;
public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permission, PermissionViewModel> {
public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<PermissionVo, PermissionViewModel> {
private static final Logger logger = LoggerFactory.getLogger(PermissionManagerSkin.class);
EmployeeFunctionsManagerWindowController controller;
@@ -100,11 +98,9 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
}
protected void onTableCreateNewAction(ActionEvent event) {
Permission newRow = new Permission();
com.ecep.contract.model.Function function = controller.functionService.findById(viewModel.getId().get());
newRow.setFunction(function);
Permission saved = controller.permissionService.save(newRow);
PermissionVo newRow = new PermissionVo();
newRow.setFunctionId(viewModel.getId().get());
PermissionVo saved = controller.getPermissionService().save(newRow);
PermissionViewModel row = PermissionViewModel.from(saved);
dataSet.add(row);
}
@@ -129,7 +125,17 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
}
protected boolean deleteRow(PermissionViewModel row) {
throw new UnsupportedOperationException("未实现");
try {
int id = row.getId().get();
PermissionVo permissionVo = controller.permissionService.findById(id);
if (permissionVo != null) {
controller.permissionService.delete(permissionVo);
return true;
}
} catch (Exception e) {
handleException("删除权限失败", e);
}
return false;
}
private void onNameColumnEditCommitAction(TableColumn.CellEditEvent<PermissionViewModel, String> event) {
@@ -185,9 +191,9 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
protected void save(PermissionViewModel row) {
int id = row.getId().get();
Permission type = controller.permissionService.findById(id);
if (row.copyTo(type)) {
Permission saved = controller.permissionService.save(type);
PermissionVo permissionVo = controller.permissionService.findById(id);
if (permissionVo != null && row.copyTo(permissionVo)) {
PermissionVo saved = controller.permissionService.save(permissionVo);
row.update(saved);
}
}

View File

@@ -14,14 +14,14 @@ import com.ecep.contract.converter.CompanyStringConverter;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.Project;
import com.ecep.contract.model.ProjectBid;
import com.ecep.contract.service.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.ProjectBidService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProjectBidViewModel;
import com.ecep.contract.vo.ProjectBidVo;
import com.ecep.contract.vo.ProjectVo;
import javafx.scene.control.Tab;
import javafx.scene.control.TableCell;
@@ -31,8 +31,8 @@ import lombok.Setter;
@FxmlPath("/ui/project/project-tab-bid.fxml")
public class ProjectTabSkinBid
extends AbstProjectTableTabSkin<ProjectBid, ProjectBidViewModel>
implements TabSkin, EditableEntityTableTabSkin<ProjectBid, ProjectBidViewModel>, RefreshableSkin {
extends AbstProjectTableTabSkin<ProjectBidVo, ProjectBidViewModel>
implements TabSkin, EditableEntityTableTabSkin<ProjectBidVo, ProjectBidViewModel>, RefreshableSkin {
public TableColumn<ProjectBidViewModel, Number> idColumn;
public TableColumn<ProjectBidViewModel, Number> versionColumn;
@@ -107,9 +107,11 @@ public class ProjectTabSkinBid
@Override
protected ProjectBidViewModel createNewViewModel() {
ProjectBidViewModel model = new ProjectBidViewModel();
Project project = getParent();
model.getProject().set(project);
model.getApplicant().set(project.getApplicant());
ProjectVo project = getParent();
model.getProject().set(project.getId());
if (project.getApplicantId() != null) {
model.getApplicant().set(project.getApplicantId());
}
if (project.getAmount() != null) {
model.getAmount().set(project.getAmount());
}
@@ -178,17 +180,17 @@ public class ProjectTabSkinBid
}
@Override
public void deleteRowData(ProjectBid entity) {
public void deleteRowData(ProjectBidVo entity) {
getProjectBidService().delete(entity);
}
@Override
public ProjectBid loadRowData(ProjectBidViewModel row) {
public ProjectBidVo loadRowData(ProjectBidViewModel row) {
return getProjectBidService().findById(row.getId().get());
}
@Override
public ProjectBid saveRowData(ProjectBid entity) {
public ProjectBidVo saveRowData(ProjectBidVo entity) {
return getProjectBidService().save(entity);
}

View File

@@ -4,10 +4,11 @@ import java.time.LocalDate;
import com.ecep.contract.controller.contract.ContractWindowController;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.model.Contract;
import com.ecep.contract.service.ContractService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ContractViewModel;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.ProjectVo;
import javafx.application.Platform;
import javafx.scene.control.MenuItem;
@@ -16,7 +17,7 @@ import javafx.scene.control.TableColumn;
@FxmlPath("/ui/project/project-tab-contract.fxml")
public class ProjectTabSkinContract
extends AbstProjectTableTabSkin<Contract, ContractViewModel>
extends AbstProjectTableTabSkin<ContractVo, ContractViewModel>
implements TabSkin {
public TableColumn<ContractViewModel, Number> idColumn;
public TableColumn<ContractViewModel, String> codeColumn;
@@ -66,6 +67,30 @@ public class ProjectTabSkinContract
ContractWindowController.show(item, controller.root.getScene().getWindow());
}
@Override
protected ContractViewModel createNewViewModel() {
ContractViewModel model = new ContractViewModel();
ProjectVo project = getParent();
model.getProject().set(project.getId());
saveRow(model);
return model;
}
@Override
public void deleteRowData(ContractVo entity) {
getContractService().delete(entity);
}
@Override
public ContractVo loadRowData(ContractViewModel row) {
return getContractService().findById(row.getId().get());
}
@Override
public ContractVo saveRowData(ContractVo entity) {
return getContractService().save(entity);
}
private ContractService getContractService() {
return controller.contractService;
}

View File

@@ -7,9 +7,6 @@ import com.ecep.contract.controller.project.cost.ProjectCostWindowController;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.Project;
import com.ecep.contract.model.ProjectCost;
import com.ecep.contract.model.ProjectCostItem;
import com.ecep.contract.service.ContractItemService;
import com.ecep.contract.service.ProjectCostItemService;
@@ -17,6 +14,9 @@ import com.ecep.contract.service.ProjectCostService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProjectCostItemViewModel;
import com.ecep.contract.vm.ProjectCostViewModel;
import com.ecep.contract.vo.ProjectCostItemVo;
import com.ecep.contract.vo.ProjectCostVo;
import com.ecep.contract.vo.ProjectVo;
import javafx.application.Platform;
import javafx.event.ActionEvent;
@@ -31,13 +31,19 @@ import lombok.Setter;
@FxmlPath("/ui/project/project-tab-cost.fxml")
public class ProjectTabSkinCost
extends AbstProjectTableTabSkin<ProjectCost, ProjectCostViewModel>
extends AbstProjectTableTabSkin<ProjectCostVo, ProjectCostViewModel>
implements TabSkin {
public TableColumn<ProjectCostViewModel, Number> idColumn;
public TableColumn<ProjectCostViewModel, Employee> applicantColumn;
/**
* 申请人, Employee
*/
public TableColumn<ProjectCostViewModel, Integer> applicantColumn;
public TableColumn<ProjectCostViewModel, LocalDateTime> applyTimeColumn;
public TableColumn<ProjectCostViewModel, Employee> authorizerColumn;
/**
* 审批人, Employee
*/
public TableColumn<ProjectCostViewModel, Integer> authorizerColumn;
public TableColumn<ProjectCostViewModel, LocalDateTime> authorizationTimeColumn;
public TableColumn<ProjectCostViewModel, Number> grossProfitMarginColumn;
@@ -96,29 +102,37 @@ public class ProjectTabSkinCost
super.initializeTable();
idColumn.setCellValueFactory(param -> param.getValue().getId());
// 申请人, Employee
applicantColumn.setCellValueFactory(param -> param.getValue().getApplicant());
applicantColumn.setCellFactory(cell -> new EmployeeTableCell<>());
applicantColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
// 申请时间
applyTimeColumn.setCellValueFactory(param -> param.getValue().getApplyTime());
applyTimeColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
// 审批人, Employee
authorizerColumn.setCellValueFactory(param -> param.getValue().getAuthorizer());
authorizerColumn.setCellFactory(cell -> new EmployeeTableCell<>());
authorizerColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
// 审批时间
authorizationTimeColumn.setCellValueFactory(param -> param.getValue().getAuthorizationTime());
authorizationTimeColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
inTaxAmountColumn.setCellValueFactory(param -> param.getValue().getInTaxAmount());
inTaxAmountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
inExclusiveTaxAmountColumn.setCellValueFactory(param -> param.getValue().getInExclusiveTaxAmount());
inExclusiveTaxAmountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
inExclusiveTaxAmountColumn
.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
outTaxAmountColumn.setCellValueFactory(param -> param.getValue().getOutTaxAmount());
outTaxAmountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
outExclusiveTaxAmountColumn.setCellValueFactory(param -> param.getValue().getOutExclusiveTaxAmount());
outExclusiveTaxAmountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
outExclusiveTaxAmountColumn
.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
grossProfitMarginColumn.setCellValueFactory(param -> param.getValue().getGrossProfitMargin());
NumberFormat numberInstance = NumberFormat.getNumberInstance(getLocale());
numberInstance.setMaximumFractionDigits(2);
numberInstance.setMinimumFractionDigits(2);
grossProfitMarginColumn.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter(numberInstance)));
grossProfitMarginColumn
.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter(numberInstance)));
versionColumn.setCellValueFactory(param -> param.getValue().getVersion());
descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
@@ -128,13 +142,12 @@ public class ProjectTabSkinCost
});
}
@Override
protected ProjectCostViewModel createNewViewModel() {
ProjectCostViewModel model = new ProjectCostViewModel();
Project project = getParent();
model.getProject().set(project);
ProjectCost latest = getCostService().findLatestByProject(project);
ProjectVo project = getParent();
model.getProject().set(project.getId());
ProjectCostVo latest = getCostService().findLatestByProject(project);
if (latest != null) {
model.getVersion().set(latest.getVersion() + 1);
} else {
@@ -142,7 +155,9 @@ public class ProjectTabSkinCost
}
model.getStampTax().set(0.03f);
model.getTaxAndSurcharges().set(11);
model.getApplicant().set(project.getApplicant());
if (project.getApplicantId() != null) {
model.getApplicant().set(project.getApplicantId());
}
model.getApplyTime().set(LocalDateTime.now());
saveRow(model);
return model;
@@ -166,21 +181,20 @@ public class ProjectTabSkinCost
private void onTableCopyAction(ActionEvent event) {
ProjectCostViewModel selectedItem = table.getSelectionModel().getSelectedItem();
ProjectCost selectedCost = loadRowData(selectedItem);
ProjectCost projectCost = new ProjectCost();
ProjectCostVo selectedCost = loadRowData(selectedItem);
ProjectCostVo projectCost = new ProjectCostVo();
selectedItem.copyTo(projectCost);
projectCost.setId(null);
projectCost.setVersion(selectedItem.getVersion().get() + 1);
projectCost.setApplyTime(LocalDateTime.now());
projectCost = saveRowData(projectCost);
ProjectCostItemService costItemService = getCostItemService();
for (ProjectCostItem selectedCostItem : costItemService.findByCost(selectedCost)) {
ProjectCostItem item = new ProjectCostItem();
for (ProjectCostItemVo selectedCostItem : costItemService.findByCost(selectedCost)) {
ProjectCostItemVo item = new ProjectCostItemVo();
ProjectCostItemViewModel.from(selectedCostItem).copyTo(item);
item.setId(null);
item.setCost(projectCost);
item.setCostId(projectCost.getId());
costItemService.save(item);
}

View File

@@ -1,5 +1,6 @@
package com.ecep.contract.controller.project;
import java.awt.Desktop;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -10,15 +11,14 @@ import com.ecep.contract.controller.tab.RefreshableSkin;
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
import com.ecep.contract.converter.CompanyStringConverter;
import com.ecep.contract.converter.EmployeeStringConverter;
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.CompanyCustomerService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
import com.ecep.contract.vo.ProjectVo;
import javafx.scene.control.Tab;
import javafx.scene.control.TableColumn;
@@ -27,13 +27,16 @@ import lombok.Setter;
@FxmlPath("/ui/project/project-tab-customer-satisfaction-survey.fxml")
public class ProjectTabSkinCustomerSatisfactionSurvey
extends AbstProjectTableTabSkin<CustomerSatisfactionSurvey, CustomerSatisfactionSurveyViewModel>
extends AbstProjectTableTabSkin<CustomerSatisfactionSurveyVo, CustomerSatisfactionSurveyViewModel>
implements RefreshableSkin {
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> idColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, String> codeColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, Number> totalScoreColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, Employee> applicantColumn;
/**
* 申请方, Employee
*/
public TableColumn<CustomerSatisfactionSurveyViewModel, Integer> applicantColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDateTime> applyTimeColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, String> descriptionColumn;
public TableColumn<CustomerSatisfactionSurveyViewModel, LocalDate> dateColumn;
@@ -84,8 +87,8 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
@Override
protected CustomerSatisfactionSurveyViewModel createNewViewModel() {
CustomerSatisfactionSurveyViewModel model = super.createNewViewModel();
Project project = getParent();
model.getApplicant().set(controller.getCurrentUser());
ProjectVo project = getParent();
model.getApplicant().set(com.ecep.contract.Desktop.instance.getActiveEmployeeId());
LocalDate created = project.getCreated();
if (created == null) {
created = LocalDate.now();

View File

@@ -6,8 +6,6 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.ProjectVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,8 +13,6 @@ import com.ecep.contract.ContractPayWay;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.controller.table.cell.NumberTableCell;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractPayPlan;
import com.ecep.contract.model.Project;
import com.ecep.contract.model.ProjectFundPlan;
import com.ecep.contract.service.ContractPayPlanService;
@@ -25,6 +21,10 @@ import com.ecep.contract.service.ProjectFundPlanService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.NumberUtils;
import com.ecep.contract.vm.ProjectFundPlanViewModel;
import com.ecep.contract.vo.ContractPayPlanVo;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.ProjectFundPlanVo;
import com.ecep.contract.vo.ProjectVo;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
@@ -39,8 +39,8 @@ import lombok.Setter;
*/
@FxmlPath("/ui/project/project-tab-fund-plan.fxml")
public class ProjectTabSkinFundPlan
extends AbstProjectTableTabSkin<ProjectFundPlan, ProjectFundPlanViewModel>
implements TabSkin, EditableEntityTableTabSkin<ProjectFundPlan, ProjectFundPlanViewModel> {
extends AbstProjectTableTabSkin<ProjectFundPlanVo, ProjectFundPlanViewModel>
implements TabSkin, EditableEntityTableTabSkin<ProjectFundPlanVo, ProjectFundPlanViewModel> {
private static final Logger logger = LoggerFactory.getLogger(ProjectTabSkinFundPlan.class);
public TableColumn<ProjectFundPlanViewModel, Number> idColumn;
@@ -114,7 +114,7 @@ public class ProjectTabSkinFundPlan
}
@Override
public List<ProjectFundPlanViewModel> loadTableData(Project parent) {
public List<ProjectFundPlanViewModel> loadTableData(ProjectVo parent) {
List<ProjectFundPlanViewModel> rows = super.loadTableData(parent);
if (rows == null) {
return null;
@@ -152,12 +152,12 @@ public class ProjectTabSkinFundPlan
return;
}
List<ProjectFundPlan> fundPlans = getViewModelService().findAllByProject(project);
List<ProjectFundPlanVo> fundPlans = getViewModelService().findAllByProject(project);
// 将现有的项目资金计划转为以 ContractPayPlan 的id为key的map
java.util.Map<Number, ProjectFundPlan> fundPlansMap = fundPlans.stream()
.filter(plan -> plan.getContractPayPlan() != null && plan.getContractPayPlan().getId() != null)
java.util.Map<Number, ProjectFundPlanVo> fundPlansMap = fundPlans.stream()
.filter(plan -> plan.getContractPayPlanId() != null)
.collect(Collectors.toMap(
plan -> plan.getContractPayPlan().getId(),
plan -> plan.getContractPayPlanId(),
plan -> plan));
// 获取项目关联的所有合同
@@ -170,14 +170,14 @@ public class ProjectTabSkinFundPlan
// 遍历所有合同
for (ContractVo contract : contracts) {
// 获取合同的付款计划
List<ContractPayPlan> payPlans = getContractPayPlanService().findAllByContract(contract);
List<ContractPayPlanVo> payPlans = getContractPayPlanService().findAllByContract(contract);
// 遍历每个付款计划
for (ContractPayPlan payPlan : payPlans) {
for (ContractPayPlanVo payPlan : payPlans) {
// 检查是否已存在相同的合同付款计划
if (fundPlansMap.containsKey(payPlan.getId())) {
// 更新
ProjectFundPlan fundPlan = fundPlansMap.remove(payPlan.getId());
ProjectFundPlanVo fundPlan = fundPlansMap.remove(payPlan.getId());
// 检查是否需要更新
boolean needsUpdate = false;
if (!Objects.equals(fundPlan.getPayWay(), contract.getPayWay())) {
@@ -201,7 +201,7 @@ public class ProjectTabSkinFundPlan
needsUpdate = true;
}
if (needsUpdate) {
fundPlan.setContractPayPlan(payPlan);
fundPlan.setContractPayPlanId(payPlan.getId());
fundPlan.setUpdateDate(LocalDateTime.now());
saveRowData(fundPlan);
}
@@ -209,14 +209,14 @@ public class ProjectTabSkinFundPlan
}
// 创建新的项目资金计划
ProjectFundPlan fundPlan = getViewModelService().newInstanceByProject(project);
ProjectFundPlanVo fundPlan = getViewModelService().newInstanceByProject(project);
// 设置资金计划的属性
fundPlan.setPayDate(payPlan.getPayDate());
fundPlan.setPayWay(contract.getPayWay());
fundPlan.setPayRatio(payPlan.getPayRatio());
fundPlan.setPayTerm(payPlan.getPayTerm());
fundPlan.setPayCurrency(payPlan.getPayCurrency());
fundPlan.setContractPayPlan(payPlan);
fundPlan.setContractPayPlanId(payPlan.getId());
fundPlan.setUpdateDate(LocalDateTime.now());
saveRowData(fundPlan);
}
@@ -224,7 +224,7 @@ public class ProjectTabSkinFundPlan
// 删除
if (!fundPlansMap.isEmpty()) {
for (ProjectFundPlan fundPlan : fundPlansMap.values()) {
for (ProjectFundPlanVo fundPlan : fundPlansMap.values()) {
getViewModelService().delete(fundPlan);
}
}
@@ -237,12 +237,11 @@ public class ProjectTabSkinFundPlan
@Override
protected ProjectFundPlanViewModel createNewViewModel() {
ProjectFundPlanViewModel model = new ProjectFundPlanViewModel();
Project project = getParent();
model.getProject().set(project);
model.getUpdateDate().set(LocalDateTime.now());
saveRow(model);
return model;
ProjectFundPlanViewModel newViewModel = getViewModelService().createNewViewModel();
ProjectVo project = getParent();
newViewModel.getProject().set(project.getId());
saveRow(newViewModel);
return newViewModel;
}
@Override
@@ -259,17 +258,17 @@ public class ProjectTabSkinFundPlan
}
@Override
public void deleteRowData(ProjectFundPlan entity) {
public void deleteRowData(ProjectFundPlanVo entity) {
getProjectFundPlanService().delete(entity);
}
@Override
public ProjectFundPlan loadRowData(ProjectFundPlanViewModel row) {
public ProjectFundPlanVo loadRowData(ProjectFundPlanViewModel row) {
return getProjectFundPlanService().findById(row.getId().get());
}
@Override
public ProjectFundPlan saveRowData(ProjectFundPlan entity) {
public ProjectFundPlanVo saveRowData(ProjectFundPlanVo entity) {
return getProjectFundPlanService().save(entity);
}
}

View File

@@ -14,16 +14,14 @@ import com.ecep.contract.controller.table.cell.EvaluationFileTableCell;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import com.ecep.contract.converter.CompanyStringConverter;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.Project;
import com.ecep.contract.model.ProjectQuotation;
import com.ecep.contract.service.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.ProjectQuotationService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProjectQuotationViewModel;
import com.ecep.contract.vo.ProjectQuotationVo;
import com.ecep.contract.vo.ProjectVo;
import javafx.scene.control.Tab;
import javafx.scene.control.TableCell;
@@ -35,17 +33,26 @@ import lombok.Setter;
@FxmlPath("/ui/project/project-tab-quotation.fxml")
public class ProjectTabSkinQuotation
extends AbstProjectTableTabSkin<ProjectQuotation, ProjectQuotationViewModel>
implements TabSkin, EditableEntityTableTabSkin<ProjectQuotation, ProjectQuotationViewModel>, RefreshableSkin {
extends AbstProjectTableTabSkin<ProjectQuotationVo, ProjectQuotationViewModel>
implements TabSkin, EditableEntityTableTabSkin<ProjectQuotationVo, ProjectQuotationViewModel>, RefreshableSkin {
public TableColumn<ProjectQuotationViewModel, Number> idColumn;
public TableColumn<ProjectQuotationViewModel, Number> versionColumn;
public TableColumn<ProjectQuotationViewModel, CompanyCustomerEvaluationFormFile> evaluationFileColumn;
/**
* 合同文件, CompanyCustomerEvaluationFormFile
*/
public TableColumn<ProjectQuotationViewModel, Integer> evaluationFileColumn;
public TableColumn<ProjectQuotationViewModel, String> descriptionColumn;
public TableColumn<ProjectQuotationViewModel, Employee> applicantColumn;
/**
* 申请人, Employee
*/
public TableColumn<ProjectQuotationViewModel, Integer> applicantColumn;
public TableColumn<ProjectQuotationViewModel, LocalDateTime> applyTimeColumn;
public TableColumn<ProjectQuotationViewModel, Employee> authorizerColumn;
/**
* 审批人, Employee
*/
public TableColumn<ProjectQuotationViewModel, Integer> authorizerColumn;
public TableColumn<ProjectQuotationViewModel, LocalDateTime> authorizationTimeColumn;
public TableColumn<ProjectQuotationViewModel, Number> levelColumn;
public TableColumn<ProjectQuotationViewModel, String> standardPayWayColumn;
@@ -66,7 +73,6 @@ public class ProjectTabSkinQuotation
@Setter
private CompanyCustomerFileService customerFileService;
public ProjectTabSkinQuotation(ProjectWindowController controller) {
super(controller);
}
@@ -86,11 +92,11 @@ public class ProjectTabSkinQuotation
super.initializeTable();
levelColumn.setCellValueFactory(param -> param.getValue().getLevel());
levelColumn.setCellFactory(param -> new LevelTableCell());
standardPayWayColumn.setCellValueFactory(param -> param.getValue().getStandardPayWay().map(value -> value == null ? "" : (value ? "标准" : "非标准")));
standardPayWayColumn.setCellValueFactory(param -> param.getValue().getStandardPayWay()
.map(value -> value == null ? "" : (value ? "标准" : "非标准")));
evaluationFileColumn.setCellValueFactory(param -> param.getValue().getEvaluationFile());
evaluationFileColumn.setCellFactory(param -> new EvaluationFileTableCell<>(getCompanyCustomerFileService()));
amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
amountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));
@@ -103,7 +109,6 @@ public class ProjectTabSkinQuotation
authorizationTimeColumn.setCellValueFactory(param -> param.getValue().getAuthorizationTime());
authorizationTimeColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
}
@@ -111,9 +116,9 @@ public class ProjectTabSkinQuotation
@Override
protected ProjectQuotationViewModel createNewViewModel() {
ProjectQuotationViewModel model = new ProjectQuotationViewModel();
Project project = getParent();
model.getProject().set(project);
model.getApplicant().set(project.getApplicant());
ProjectVo project = getParent();
model.getProject().set(project.getId());
model.getApplicant().set(project.getApplicantId());
if (project.getAmount() != null) {
model.getAmount().set(project.getAmount());
}

View File

@@ -3,18 +3,18 @@ package com.ecep.contract.controller.project.usage;
import com.ecep.contract.controller.AbstEntityManagerSkin;
import com.ecep.contract.controller.ManagerSkin;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.model.ProductUsage;
import com.ecep.contract.service.ProductUsageService;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.vm.ProductUsageViewModel;
import com.ecep.contract.vo.ProductUsageVo;
import javafx.scene.control.TableColumn;
import javafx.scene.control.cell.TextFieldTableCell;
import lombok.Setter;
public class ProductUsageManagerSkin
extends AbstEntityManagerSkin<ProductUsage, ProductUsageViewModel, ProductUsageManagerSkin, ProductUsageManagerWindowController>
implements ManagerSkin , EditableEntityTableTabSkin<ProductUsage, ProductUsageViewModel> {
extends AbstEntityManagerSkin<ProductUsageVo, ProductUsageViewModel, ProductUsageManagerSkin, ProductUsageManagerWindowController>
implements ManagerSkin , EditableEntityTableTabSkin<ProductUsageVo, ProductUsageViewModel> {
@Setter
private ProjectService projectService;

View File

@@ -8,11 +8,11 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.model.ProductUsage;
import com.ecep.contract.service.ProductUsageService;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ProductUsageViewModel;
import com.ecep.contract.vo.ProductUsageVo;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
@@ -23,7 +23,7 @@ import javafx.stage.Stage;
@Component
@FxmlPath("/ui/project/product-usage-manager.fxml")
public class ProductUsageManagerWindowController
extends AbstManagerWindowController<ProductUsage, ProductUsageViewModel, ProductUsageManagerSkin> {
extends AbstManagerWindowController<ProductUsageVo, ProductUsageViewModel, ProductUsageManagerSkin> {
@Autowired
private ProjectService projectService;

View File

@@ -204,7 +204,7 @@ public class CompanyTabSkinFile
}
private void onTableCopyAsMatchedAction_(Consumer<String> state) {
Company company = getParent();
CompanyVo company = getParent();
CompanyFileViewModel selectedItem = getSelectedItem();
if (selectedItem == null) {
@@ -279,12 +279,12 @@ public class CompanyTabSkinFile
state.accept("新文件复制失败:" + e.getMessage());
}
CompanyFile companyFile = new CompanyFile();
CompanyFileVo companyFile = new CompanyFileVo();
companyFile.setFilePath(dest.getAbsolutePath());
companyFile.setApplyDate(nextCreditReportDate);
companyFile.setExpiringDate(nextCreditReportDate.plusYears(1));
companyFile.setType(CompanyFileType.CreditReport);
companyFile.setCompany(company);
companyFile.setCompanyId(company.getId());
saveRowData(companyFile);
state.accept("新文件已记录");

View File

@@ -8,12 +8,12 @@ import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
import com.ecep.contract.controller.company.CompanyWindowController;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.model.Invoice;
import com.ecep.contract.service.InvoiceService;
import com.ecep.contract.service.PurchaseBillVoucherService;
import com.ecep.contract.service.YongYouU8Service;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.InvoiceViewModel;
import com.ecep.contract.vo.InvoiceVo;
import javafx.scene.control.Button;
import javafx.scene.control.Tab;
@@ -27,8 +27,8 @@ import lombok.Setter;
*/
@FxmlPath("/ui/company/company-tab-invoice.fxml")
public class CompanyTabSkinInvoice
extends AbstCompanyTableTabSkin<Invoice, InvoiceViewModel>
implements TabSkin, EditableEntityTableTabSkin<Invoice, InvoiceViewModel> {
extends AbstCompanyTableTabSkin<InvoiceVo, InvoiceViewModel>
implements TabSkin, EditableEntityTableTabSkin<InvoiceVo, InvoiceViewModel> {
public TableColumn<InvoiceViewModel, Number> idColumn;
public TableColumn<InvoiceViewModel, String> codeColumn;
@@ -63,14 +63,6 @@ public class CompanyTabSkinInvoice
@Override
public void initializeTab() {
if (u8Service == null) {
try {
u8Service = getBean(YongYouU8Service.class);
} catch (BeansException ignored) {
}
}
searchKeyField.setOnKeyReleased(event -> {
if (event.getCode() == KeyCode.ENTER) {
searchBtn.fire();
@@ -96,18 +88,11 @@ public class CompanyTabSkinInvoice
// ContractWindowController.show(item, controller.root.getScene().getWindow());
}
private PurchaseBillVoucherService getPurchaseBillVoucherService() {
if (purchaseBillVoucherService == null) {
purchaseBillVoucherService = getBean(PurchaseBillVoucherService.class);
private YongYouU8Service getU8Service() {
if (u8Service == null) {
u8Service = getBean(YongYouU8Service.class);
}
return purchaseBillVoucherService;
}
private EmployeeStringConverter getEmployeeStringConverter() {
if (employeeStringConverter == null) {
employeeStringConverter = getBean(EmployeeStringConverter.class);
}
return employeeStringConverter;
return u8Service;
}
private InvoiceService getInvoiceService() {

View File

@@ -19,11 +19,7 @@ import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.controller.company.AbstCompanyBasedTabSkin;
import com.ecep.contract.controller.company.CompanyWindowController;
import com.ecep.contract.model.CloudRk;
import com.ecep.contract.model.CloudTyc;
import com.ecep.contract.model.CloudYu;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyExtendInfo;
import com.ecep.contract.service.CloudRkService;
import com.ecep.contract.service.CloudTycService;
import com.ecep.contract.service.CompanyExtendInfoService;
@@ -35,6 +31,11 @@ import com.ecep.contract.vm.CloudRkViewModel;
import com.ecep.contract.vm.CloudTycInfoViewModel;
import com.ecep.contract.vm.CloudYuInfoViewModel;
import com.ecep.contract.vm.CompanyExtendInfoViewModel;
import com.ecep.contract.vo.CloudRkVo;
import com.ecep.contract.vo.CloudTycVo;
import com.ecep.contract.vo.CloudYuVo;
import com.ecep.contract.vo.CompanyExtendInfoVo;
import com.ecep.contract.vo.CompanyVo;
import javafx.application.Platform;
import javafx.event.ActionEvent;
@@ -145,7 +146,7 @@ public class CompanyTabSkinOther
@Override
public void onTabShown() {
Company parent = getEntity();
CompanyVo parent = getEntity();
updateRKCloudPane(parent, rkCloudPane);
updateTYCCloudPane(parent, tycCloudPane);
updateYuCloudPane(parent, yuCloudPane);
@@ -194,12 +195,12 @@ public class CompanyTabSkinOther
public void save(CloudRkViewModel viewModel) {
int infoId = viewModel.getId().get();
CloudRkService service = getCloudRkService();
CloudRk cloudRk = service.findById(infoId);
CloudRkVo cloudRk = service.findById(infoId);
if (cloudRk == null) {
throw new RuntimeException("CloudRk not found");
}
if (viewModel.copyTo(cloudRk)) {
CloudRk saved = service.save(cloudRk);
CloudRkVo saved = service.save(cloudRk);
if (Platform.isFxApplicationThread()) {
viewModel.update(saved);
} else {
@@ -234,7 +235,7 @@ public class CompanyTabSkinOther
*/
private void onCloudRkUpdateButtonClicked(ActionEvent actionEvent) throws IOException {
Button button = (Button) actionEvent.getSource();
Company company = getEntity();
CompanyVo company = getEntity();
MessageHolder holder = (level, message) -> {
setStatus(message);
if (level == Level.WARNING) {
@@ -245,7 +246,7 @@ public class CompanyTabSkinOther
}
};
CloudRk cloudRk = getCloudRkService().updateCloudRk(company, holder);
CloudRkVo cloudRk = getCloudRkService().updateCloudRk(company, holder);
Platform.runLater(() -> {
rkCloudInfoViewModel.update(cloudRk);
});
@@ -284,14 +285,14 @@ public class CompanyTabSkinOther
if (StringUtils.hasText(cloudId)) {
url = String.format(CloudServiceConstant.TYC_URL_COMPANY, cloudId);
} else {
Company company = getEntity();
CompanyVo company = getEntity();
url = String.format(CloudServiceConstant.TYC_URL_COMPANY_SEARCH, company.getName());
}
DesktopUtils.showInBrowse(url);
}
public void onTycCloudPaneHyperLinkInnerViewClickedAction(ActionEvent event) {
Company company = getEntity();
CompanyVo company = getEntity();
String cloudId = tycCloudInfoViewModel.getCloudId().get();
String url = String.format(CloudServiceConstant.TYC_URL_COMPANY_SEARCH, company.getName());
@@ -441,11 +442,10 @@ public class CompanyTabSkinOther
button.setDisable(false);
});
});
}
private void onCloudYuUpdateButtonClicked(ActionEvent event) {
Company company = getEntity();
CompanyVo company = getEntity();
// service.syncVendor(company);
}
@@ -473,12 +473,12 @@ public class CompanyTabSkinOther
public void save(CompanyExtendInfoViewModel viewModel) {
int infoId = viewModel.getId().get();
CompanyExtendInfoService service = getExtendInfoService();
CompanyExtendInfo cloudRk = service.findById(infoId);
CompanyExtendInfoVo cloudRk = service.findById(infoId);
if (cloudRk == null) {
throw new RuntimeException("CloudRk not found");
throw new RuntimeException("CompanyExtendInfo not found");
}
if (viewModel.copyTo(cloudRk)) {
CompanyExtendInfo saved = service.save(cloudRk);
CompanyExtendInfoVo saved = service.save(cloudRk);
if (Platform.isFxApplicationThread()) {
viewModel.update(saved);
} else {
@@ -489,38 +489,39 @@ public class CompanyTabSkinOther
}
}
private void updateRKCloudPane(Company company, TitledPane pane) {
private void updateRKCloudPane(CompanyVo company, TitledPane pane) {
CloudRkViewModel viewModel = rkCloudInfoViewModel;
CloudRk cloudRk = getCloudRkService().getOrCreateCloudRk(company);
CloudRkVo cloudRk = getCloudRkService().getOrCreateCloudRk(company);
Platform.runLater(() -> {
viewModel.update(cloudRk);
});
}
private void updateTYCCloudPane(Company company, TitledPane pane) {
private void updateTYCCloudPane(CompanyVo company, TitledPane pane) {
CloudTycInfoViewModel viewModel = tycCloudInfoViewModel;
CloudTyc cloudTyc = getCloudTycService().getOrCreateCloudTyc(company);
CloudTycVo cloudTyc = getCloudTycService().getOrCreateCloudTyc(company);
Platform.runLater(() -> {
viewModel.update(cloudTyc);
});
}
private void updateYuCloudPane(Company company, TitledPane pane) {
private void updateYuCloudPane(CompanyVo company, TitledPane pane) {
CloudYuInfoViewModel viewModel = yuCloudInfoViewModel;
if (yongYouU8Service == null) {
setStatus("未启用 " + CloudServiceConstant.U8_NAME + " 服务");
return;
}
CloudYu cloudYu = yongYouU8Service.getOrCreateCloudYu(company);
CloudYuVo cloudYu = yongYouU8Service.getOrCreateCloudYu(company);
Platform.runLater(() -> {
viewModel.update(cloudYu);
});
}
private void updateExtendInfoPane(Company company, TitledPane pane) {
private void updateExtendInfoPane(CompanyVo company, TitledPane pane) {
CompanyExtendInfoViewModel viewModel = extendInfoViewModel;
CompanyExtendInfoService service = getExtendInfoService();
CompanyExtendInfo extendInfo = service.findByCompany(company);
CompanyExtendInfoVo extendInfo = service.findByCompany(company);
Platform.runLater(() -> {
viewModel.update(extendInfo);
});

View File

@@ -4,19 +4,19 @@ import java.time.LocalDateTime;
import org.springframework.beans.BeansException;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.controller.company.AbstCompanyTableTabSkin;
import com.ecep.contract.controller.company.CompanyWindowController;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.Invoice;
import com.ecep.contract.model.PurchaseBillVoucher;
import com.ecep.contract.service.InvoiceService;
import com.ecep.contract.service.YongYouU8Service;
import com.ecep.contract.service.PurchaseBillVoucherService;
import com.ecep.contract.vm.PurchaseBillVoucherViewModel;
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
import com.ecep.contract.controller.table.cell.InvoiceTableCell;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.model.Invoice;
import com.ecep.contract.service.InvoiceService;
import com.ecep.contract.service.PurchaseBillVoucherService;
import com.ecep.contract.service.YongYouU8Service;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.PurchaseBillVoucherViewModel;
import com.ecep.contract.vo.PurchaseBillVoucherVo;
import javafx.scene.control.Button;
import javafx.scene.control.MenuItem;
@@ -32,18 +32,30 @@ import lombok.Setter;
*/
@FxmlPath("/ui/company/company-tab-purchase-bill-voucher.fxml")
public class CompanyTabSkinPurchaseBillVoucher
extends AbstCompanyTableTabSkin<PurchaseBillVoucher, PurchaseBillVoucherViewModel>
extends AbstCompanyTableTabSkin<PurchaseBillVoucherVo, PurchaseBillVoucherViewModel>
implements TabSkin {
public TableColumn<PurchaseBillVoucherViewModel, Number> contractTable_idColumn;
public TableColumn<PurchaseBillVoucherViewModel, Number> contractTable_refIdColumn;
public TableColumn<PurchaseBillVoucherViewModel, Invoice> invoiceColumn;
/**
* 发票, Invoice
*/
public TableColumn<PurchaseBillVoucherViewModel, Integer> invoiceColumn;
public TableColumn<PurchaseBillVoucherViewModel, String> contractTable_codeColumn;
public TableColumn<PurchaseBillVoucherViewModel, Employee> employeeColumn;
public TableColumn<PurchaseBillVoucherViewModel, Employee> makerColumn;
/**
* 关联的员工, Employee
*/
public TableColumn<PurchaseBillVoucherViewModel, Integer> employeeColumn;
/**
* 制单人, Employee
*/
public TableColumn<PurchaseBillVoucherViewModel, Integer> makerColumn;
public TableColumn<PurchaseBillVoucherViewModel, LocalDateTime> makerDateColumn;
public TableColumn<PurchaseBillVoucherViewModel, LocalDateTime> modifyDateColumn;
public TableColumn<PurchaseBillVoucherViewModel, Employee> verifierColumn;
/**
* 审核人, Employee
*/
public TableColumn<PurchaseBillVoucherViewModel, Integer> verifierColumn;
public TableColumn<PurchaseBillVoucherViewModel, LocalDateTime> verifierDateColumn;
public TableColumn<PurchaseBillVoucherViewModel, String> descriptionColumn;
@@ -53,7 +65,6 @@ public class CompanyTabSkinPurchaseBillVoucher
public MenuItem contractTable_menu_add;
public MenuItem contractTable_menu_del;
@Setter
private PurchaseBillVoucherService purchaseBillVoucherService;
@Setter
@@ -100,21 +111,20 @@ public class CompanyTabSkinPurchaseBillVoucher
contractTable_codeColumn.setCellValueFactory(param -> param.getValue().getCode());
employeeColumn.setCellValueFactory(param -> param.getValue().getEmployee());
employeeColumn.setCellFactory(TextFieldTableCell.forTableColumn(getEmployeeStringConverter()));
invoiceColumn.setCellValueFactory(param -> param.getValue().getInvoice());
invoiceColumn.setCellFactory(param -> new InvoiceTableCell<>(getInvoiceService()));
employeeColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
invoiceColumn.setCellValueFactory(param -> param.getValue().getInvoiceId());
invoiceColumn.setCellFactory(InvoiceTableCell.forTableColumn(getInvoiceService()));
makerColumn.setCellValueFactory(param -> param.getValue().getMaker());
makerColumn.setCellFactory(TextFieldTableCell.forTableColumn(getEmployeeStringConverter()));
makerColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
makerDateColumn.setCellValueFactory(param -> param.getValue().getMakerDate());
makerDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
modifyDateColumn.setCellValueFactory(param -> param.getValue().getModifyDate());
modifyDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
verifierColumn.setCellValueFactory(param -> param.getValue().getVerifier());
verifierColumn.setCellFactory(TextFieldTableCell.forTableColumn(getEmployeeStringConverter()));
verifierColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
verifierDateColumn.setCellValueFactory(param -> param.getValue().getVerifierDate());
verifierDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());

View File

@@ -1,14 +1,14 @@
package com.ecep.contract.controller.tab;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.model.Contract;
import com.ecep.contract.task.Tasker;
import com.ecep.contract.vo.ContractVo;
import lombok.Setter;
public class ContractFilesRebuildTasker extends Tasker<Object> {
@Setter
private Contract contract;
private ContractVo contract;
@Override
public Object execute(MessageHolder holder) {

View File

@@ -7,15 +7,9 @@ import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import javafx.beans.value.ObservableValue;
import org.controlsfx.control.textfield.TextFields;
import org.controlsfx.glyphfont.Glyph;
import com.ecep.contract.util.ProxyUtils;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
import com.ecep.contract.ContractPayWay;
@@ -27,16 +21,8 @@ import com.ecep.contract.controller.project.ProjectWindowController;
import com.ecep.contract.controller.vendor.CompanyVendorWindowController;
import com.ecep.contract.converter.CompanyStringConverter;
import com.ecep.contract.converter.ContractStringConverter;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.converter.ProjectStringConverter;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractType;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.Project;
import com.ecep.contract.model.ProjectSaleType;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyVendorService;
import com.ecep.contract.service.ContractGroupService;
@@ -48,6 +34,14 @@ import com.ecep.contract.service.ProjectSaleTypeService;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.service.VendorGroupService;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vo.CompanyCustomerVo;
import com.ecep.contract.vo.CompanyVendorVo;
import com.ecep.contract.vo.CompanyVo;
import com.ecep.contract.vo.ContractTypeVo;
import com.ecep.contract.vo.ContractVo;
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.event.ActionEvent;
@@ -113,47 +107,23 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
initializeBaseTabCompanyFieldAutoCompletion(controller.companyField);
controller.groupField.textProperty().bind(viewModel.getGroup().map(group -> {
ContractGroupService groupService = getContractGroupService();
if (!ProxyUtils.isInitialized(group)) {
group = groupService.findById(group.getId());
}
return group.getCode() + " " + group.getName() + " " + group.getTitle();
}));
controller.typeField.textProperty().bind(viewModel.getType().map(type -> {
ContractTypeService typeService = controller.getCachedBean(ContractTypeService.class);
if (!ProxyUtils.isInitialized(type)) {
type = typeService.findById(type.getId());
}
return type.getCode() + " " + type.getCatalog() + " " + type.getName() + " " + type.getTitle() + "("
+ type.getDirection() + ")";
}));
controller.kindField.textProperty().bind(viewModel.getKind().map(kind -> {
ContractKindService kindService = controller.getCachedBean(ContractKindService.class);
if (!ProxyUtils.isInitialized(kind)) {
kind = kindService.findById(kind.getId());
}
return kind.getCode() + " " + kind.getName() + " " + kind.getTitle();
}));
UITools.autoCompletion(controller.groupField, viewModel.getGroup(), getContractGroupService());
UITools.autoCompletion(controller.typeField, viewModel.getType(), getContractTypeService());
UITools.autoCompletion(controller.kindField, viewModel.getKind(), getContractKindService());
// as customer
controller.openRelativeCompanyCustomerBtn.setOnAction(this::onContractOpenRelativeCompanyCustomerAction);
controller.openRelativeCompanyCustomerBtn.disableProperty().bind(Bindings.createBooleanBinding(() -> {
ContractType type = viewModel.getType().get();
if (type == null) {
Integer typeId = viewModel.getType().get();
if (typeId == null) {
return true;
}
Company company = viewModel.getCompany().get();
if (company == null) {
Integer companyId = viewModel.getCompany().get();
if (companyId == null) {
return true;
}
if (!ProxyUtils.isInitialized(type)) {
ContractTypeService typeService = controller.getCachedBean(ContractTypeService.class);
type = typeService.findById(type.getId());
}
ContractTypeService typeService = controller.getCachedBean(ContractTypeService.class);
ContractTypeVo type = typeService.findById(typeId);
return !Objects.equals(type.getDirection(), "");
}, viewModel.getType()));
controller.openRelativeCompanyCustomerBtn.managedProperty()
@@ -164,18 +134,16 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
// as vendor
controller.openRelativeCompanyVendorBtn.setOnAction(this::onContractOpenRelativeCompanyVendorAction);
controller.openRelativeCompanyVendorBtn.disableProperty().bind(Bindings.createBooleanBinding(() -> {
ContractType type = viewModel.getType().get();
if (type == null) {
Integer typeId = viewModel.getType().get();
if (typeId == null) {
return true;
}
Company company = viewModel.getCompany().get();
if (company == null) {
Integer companyId = viewModel.getCompany().get();
if (companyId == null) {
return true;
}
if (!ProxyUtils.isInitialized(type)) {
ContractTypeService typeService = controller.getCachedBean(ContractTypeService.class);
type = typeService.findById(type.getId());
}
ContractTypeService typeService = controller.getCachedBean(ContractTypeService.class);
ContractTypeVo type = typeService.findById(typeId);
return !Objects.equals(type.getDirection(), "");
}, viewModel.getType()));
controller.openRelativeCompanyVendorBtn.managedProperty()
@@ -199,17 +167,16 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
controller.varyDateField.setConverter(localDateStringConverter);
controller.varyDateField.valueProperty().bindBidirectional(viewModel.getVaryDate());
EmployeeStringConverter employeeStringConverter = SpringApp.getBean(EmployeeStringConverter.class);
UITools.autoCompletion(controller.setupPersonField, viewModel.getSetupPerson(),
employeeStringConverter::suggest, employeeStringConverter);
controller.getEmployeeService());
UITools.autoCompletion(controller.inurePersonField, viewModel.getInurePerson(),
employeeStringConverter::suggest, employeeStringConverter);
controller.getEmployeeService());
UITools.autoCompletion(controller.varyPersonField, viewModel.getVaryPerson(),
employeeStringConverter::suggest, employeeStringConverter);
controller.getEmployeeService());
UITools.autoCompletion(controller.employeeField, viewModel.getEmployee(),
employeeStringConverter::suggest, employeeStringConverter);
controller.getEmployeeService());
UITools.autoCompletion(controller.handlerField, viewModel.getHandler(),
employeeStringConverter::suggest, employeeStringConverter);
controller.getEmployeeService());
initializeBaseTabProjectFieldAutoCompletion(controller.projectField);
@@ -237,13 +204,13 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
private void parentCodeFieldAutoCompletion(TextField textField) {
ContractStringConverter converter = SpringApp.getBean(ContractStringConverter.class);
converter.setFormater(Contract::getCode);
converter.setFormater(ContractVo::getCode);
TextFields.bindAutoCompletion(textField, converter::suggest, converter);
}
private void calcMainContractNoAction(ActionEvent event) {
try {
Contract contract = controller.getEntity();
ContractVo contract = controller.getEntity();
if (getContractService().updateParentCode(contract)) {
save(contract);
}
@@ -253,8 +220,13 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
public void onLinkContractProjectAction(ActionEvent event) {
Project project = viewModel.getProject().get();
if (project != null) {
Integer projectId = viewModel.getProject().get();
if (projectId != null) {
ProjectVo project = getProjectService().findById(projectId);
if (project == null) {
setStatus("未找到关联项目");
return;
}
ProjectWindowController.show(project, null);
return;
}
@@ -271,46 +243,51 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
}
project = getProjectService().findByCode(code);
if (project == null) {
if (code.contains("-")) {
setStatus("未找到关联项目");
return;
}
project = new Project();
String name = viewModel.getName().get();
if (StringUtils.hasText(name)) {
project.setName(name);
}
getProjectService().applyCode(project, code);
// 设置项目的开始创建时间,从合同的创建时间、提交日期、开始日期中取最早的日期
List<LocalDate> dates = new ArrayList<>();
if (viewModel.getCreated().getValue() != null) {
dates.add(viewModel.getCreated().get().toLocalDate());
}
if (viewModel.getSetupDate().get() != null) {
dates.add(viewModel.getSetupDate().get());
}
if (viewModel.getStartDate().get() != null) {
dates.add(viewModel.getStartDate().get());
}
dates.stream().min(LocalDate::compareTo).ifPresent(project::setCreated);
Employee applicant = viewModel.getEmployee().get();
if (applicant != null) {
project.setApplicant(applicant);
}
if (viewModel.getAmount().get() > 0) {
project.setAmount((int) viewModel.getAmount().get());
}
project = getProjectService().save(project);
ProjectVo project = getProjectService().findByCode(code);
if (project != null) {
viewModel.getProject().set(project.getId());
save();
setStatus("已关联项目");
return;
}
viewModel.getProject().set(project);
if (code.contains("-")) {
return;
}
project = new ProjectVo();
String name = viewModel.getName().get();
if (StringUtils.hasText(name)) {
project.setName(name);
}
getProjectService().applyCode(project, code);
// 设置项目的开始创建时间,从合同的创建时间、提交日期、开始日期中取最早的日期
List<LocalDate> dates = new ArrayList<>();
if (viewModel.getCreated().getValue() != null) {
dates.add(viewModel.getCreated().get().toLocalDate());
}
if (viewModel.getSetupDate().get() != null) {
dates.add(viewModel.getSetupDate().get());
}
if (viewModel.getStartDate().get() != null) {
dates.add(viewModel.getStartDate().get());
}
dates.stream().min(LocalDate::compareTo).ifPresent(project::setCreated);
Integer applicantId = viewModel.getEmployee().get();
EmployeeVo applicant = controller.getEmployeeService().findById(applicantId);
if (applicant != null) {
project.setApplicantId(applicant.getId());
}
if (viewModel.getAmount().get() > 0) {
project.setAmount((int) viewModel.getAmount().get());
}
project = getProjectService().save(project);
viewModel.getProject().set(project.getId());
save();
}
@@ -332,7 +309,7 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
public void onContractOpenMainContractAction(ActionEvent event) {
String parentCode = viewModel.getParentCode().get();
Contract parent = null;
ContractVo parent = null;
try {
parent = getContractService().findByCode(parentCode);
} catch (Exception e) {
@@ -350,7 +327,7 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
* 创建合同存储目录
*/
public void onContractCreatePathAction(ActionEvent event) {
Contract contract = getEntity();
ContractVo contract = getEntity();
ContractService contractService = getContractService();
if (contractService.existsContractPath(contract)) {
File dir = new File(contract.getPath());
@@ -368,9 +345,9 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
}
public void onContractChangePathAction(ActionEvent event) {
public void onContractChangePathAction(ActionEvent event) {
DirectoryChooser chooser = new DirectoryChooser();
Contract entity = getEntity();
ContractVo entity = getEntity();
String path = entity.getPath();
File initialDirectory = null;
// 如果当前已经设置了目录并且路径有效,则设置初始目录为该目录
@@ -383,17 +360,11 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
if (initialDirectory == null) {
if (entity.getPayWay() == ContractPayWay.RECEIVE) {
// 根据项目设置初始目录
Project project = entity.getProject();
ProjectVo project = getProjectService().findById(entity.getProject());
if (project != null) {
if (!ProxyUtils.isInitialized(project)) {
project = getProjectService().findById(project.getId());
}
// 根据项目销售方式设置初始目录
ProjectSaleType saleType = project.getSaleType();
ProjectSaleTypeVo saleType = getSaleTypeService().findById(project.getSaleTypeId());
if (saleType != null) {
if (!ProxyUtils.isInitialized(saleType)) {
saleType = getSaleTypeService().findById(saleType.getId());
}
File dir = new File(saleType.getPath());
if (saleType.isStoreByYear()) {
dir = new File(dir, "20" + project.getCodeYear());
@@ -406,7 +377,7 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
String parentCode = entity.getParentCode();
if (StringUtils.hasText(parentCode)) {
try {
Contract parent = getContractService().findByCode(parentCode);
ContractVo parent = getContractService().findByCode(parentCode);
if (parent != null) {
if (StringUtils.hasText(parent.getPath())) {
File dir = new File(parent.getPath());
@@ -437,7 +408,7 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
public void onContractPathSameAsNameAction(ActionEvent event) {
Contract contract = getEntity();
ContractVo contract = getEntity();
String path = contract.getPath();
if (!StringUtils.hasText(path)) {
return;
@@ -459,7 +430,7 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
public void onContractPathSameAsCodeAction(ActionEvent event) {
Contract contract = getEntity();
ContractVo contract = getEntity();
String path = contract.getPath();
if (!StringUtils.hasText(path)) {
return;
@@ -480,45 +451,26 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
public void onContractOpenRelativeCompanyCustomerAction(ActionEvent event) {
Contract contract = getEntity();
Company company = contract.getCompany();
CompanyCustomer companyCustomer = getCompanyCustomerService().findByCompany(company);
ContractVo contract = getEntity();
CompanyVo company = controller.getCompanyService().findById(contract.getCompanyId());
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
CompanyCustomerWindowController.show(companyCustomer, null);
}
public void onContractOpenRelativeCompanyVendorAction(ActionEvent event) {
Contract contract = getEntity();
Company company = contract.getCompany();
ContractVo contract = getEntity();
CompanyVo company = controller.getCompanyService().findById(contract.getCompanyId());
CompanyVendorService service = SpringApp.getBean(CompanyVendorService.class);
CompanyVendor companyVendor = service.findByCompany(company);
CompanyVendorVo companyVendor = service.findByCompany(company);
CompanyVendorWindowController.show(companyVendor, null);
}
private void initializeBaseTabCompanyFieldAutoCompletion(TextField textField) {
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
UITools.autoCompletion(textField, viewModel.getCompany(), converter);
UITools.autoCompletion(textField, viewModel.getCompany(), controller.getCompanyService());
}
private void initializeBaseTabProjectFieldAutoCompletion(TextField textField) {
ProjectStringConverter converter = SpringApp.getBean(ProjectStringConverter.class);
StringConverter<Project> stringConverter = new StringConverter<>() {
@Override
public String toString(Project object) {
Project project = converter.prefixObject(object);
if (project == null) {
return "";
}
return project.getCode();
}
@Override
public Project fromString(String string) {
return converter.fromString(string);
}
};
converter.setFormater(Project::getCode);
UITools.autoCompletion(textField, viewModel.getProject(), converter::suggest, stringConverter);
UITools.autoCompletion(textField, viewModel.getProject(), getProjectService());
}
public CompanyCustomerService getCompanyCustomerService() {
@@ -541,6 +493,14 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
return getCachedBean(ContractGroupService.class);
}
public ContractTypeService getContractTypeService() {
return getCachedBean(ContractTypeService.class);
}
public ContractKindService getContractKindService() {
return getCachedBean(ContractKindService.class);
}
public VendorGroupService getVendorGroupService() {
return getCachedBean(VendorGroupService.class);
}

View File

@@ -38,12 +38,13 @@ import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractFile;
import com.ecep.contract.model.ContractFileTypeLocal;
import com.ecep.contract.model.ContractType;
import com.ecep.contract.service.ContractFileService;
import com.ecep.contract.service.ContractFileTypeService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.ContractFileViewModel;
import com.ecep.contract.vo.ContractFileVo;
import com.ecep.contract.vo.ContractVo;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
@@ -70,8 +71,8 @@ import lombok.Setter;
*/
@FxmlPath("/ui/contract/contract-tab-file.fxml")
public class ContractTabSkinFiles
extends AbstContractTableTabSkin<ContractFile, ContractFileViewModel>
implements TabSkin, EditableEntityTableTabSkin<ContractFile, ContractFileViewModel> {
extends AbstContractTableTabSkin<ContractFileVo, ContractFileViewModel>
implements TabSkin, EditableEntityTableTabSkin<ContractFileVo, ContractFileViewModel> {
public Button fileTableReBuildBtn;
public MenuItem fileTable_menu_refresh;
@@ -133,7 +134,6 @@ public class ContractTabSkinFiles
public void initializeTab() {
TableView<ContractFileViewModel> table = getTableView();
ContractPayWay payWay = viewModel.getPayWay().get();
ContractType contractType = viewModel.getType().get();
boolean isCustomer = payWay == ContractPayWay.RECEIVE;
boolean isVendor = payWay == ContractPayWay.PAY;
@@ -273,7 +273,7 @@ public class ContractTabSkinFiles
* @param event 菜单事件
*/
private void onFileTableComposePDFAction(ActionEvent event) {
Contract contract = getParent();
ContractVo contract = getParent();
if (!StringUtils.hasText(contract.getPath())) {
setStatus("合同未设置路径");
return;
@@ -329,7 +329,7 @@ public class ContractTabSkinFiles
}
ContractFileViewModel append = new ContractFileViewModel();
append.getContract().set(contract);
append.getContract().set(contract.getId());
append.getFileName().set(dest.getName());
append.getType().set(ContractFileType.General);
saveRow(append);
@@ -343,7 +343,7 @@ public class ContractTabSkinFiles
}
private void onFileTableComposePDFAction_V2(ActionEvent event) {
Contract contract = getParent();
ContractVo contract = getParent();
if (!StringUtils.hasText(contract.getPath())) {
setStatus("合同未设置路径");
return;
@@ -426,7 +426,7 @@ public class ContractTabSkinFiles
}
ContractFileViewModel append = new ContractFileViewModel();
append.getContract().set(contract);
append.getContract().set(contract.getId());
append.getFileName().set(dest.getName());
append.getType().set(ContractFileType.General);
saveRow(append);
@@ -482,7 +482,7 @@ public class ContractTabSkinFiles
item.setText("成本核算审批表");
item.visibleProperty().bind(viewModel.getPayWay().isEqualTo(ContractPayWay.RECEIVE));
item.setOnAction(event -> {
Contract contract = getContractService().findById(viewModel.getId().get());
ContractVo contract = getContractService().findById(viewModel.getId().get());
if (contract == null) {
setStatus("异常,对应的合同不存在#" + viewModel.getId().get());
return;
@@ -502,8 +502,8 @@ public class ContractTabSkinFiles
.filter(v -> v.getType().get().equals(ContractFileType.Cost))
.findFirst().orElse(null);
if (model == null) {
ContractFile file = new ContractFile();
file.setContract(contract);
ContractFileVo file = new ContractFileVo();
file.setContractId(contract.getId());
file.setType(ContractFileType.Cost);
file.setApplyDate(LocalDate.now());
@@ -657,27 +657,17 @@ public class ContractTabSkinFiles
}
@Override
public ContractFile loadRowData(ContractFileViewModel row) {
public ContractFileVo loadRowData(ContractFileViewModel row) {
return getContractFileService().findById(row.getId().get());
}
@Override
public ContractFile saveRowData(ContractFile entity) {
return getContractFileService().save(entity);
}
@Override
public void deleteRowData(ContractFile entity) {
getContractFileService().delete(entity);
}
/**
* 重置文件
* <br>
* 依据已存在的文件重建
*/
public void onFileReBuildingAction(ActionEvent event) {
Contract contract = getParent();
ContractVo contract = getParent();
ContractFilesRebuildTasker task = new ContractFilesRebuildTasker();
task.setContract(contract);
UITools.showTaskDialogAndWait("文件重置", task, null);
@@ -698,13 +688,13 @@ public class ContractTabSkinFiles
setStatus("目录错误,不存在");
return;
}
Contract contract = getParent();
ContractVo contract = getParent();
for (File file : files) {
File dest = new File(dir, file.getName());
if (file.renameTo(dest)) {
ContractFile ccf = new ContractFile();
ccf.setContract(contract);
ContractFileVo ccf = new ContractFileVo();
ccf.setContractId(contract.getId());
ccf.setType(ContractFileType.General);
ccf.setFileName(dest.getName());
getContractFileService().save(ccf);
@@ -721,7 +711,7 @@ public class ContractTabSkinFiles
return;
}
Contract contract = getParent();
ContractVo contract = getParent();
if (!StringUtils.hasText(contract.getPath())) {
setStatus("合同未设置路径");
return;
@@ -757,12 +747,12 @@ public class ContractTabSkinFiles
File outputFile = new File(contractPath, name + "-" + (i + 1) + ".pdf");
page.save(outputFile);
page.close();
ContractFile contractFile = new ContractFile();
contractFile.setContract(contract);
ContractFileVo contractFile = new ContractFileVo();
contractFile.setContractId(contract.getId());
getContractService().syncContractFile(contractFile, outputFile, (lv, message) -> {
setStatus(message);
});
ContractFile saved = getContractFileService().save(contractFile);
ContractFileVo saved = getContractFileService().save(contractFile);
dataSet.add(ContractFileViewModel.from(saved));
}
} catch (Exception e) {
@@ -775,7 +765,7 @@ public class ContractTabSkinFiles
@Override
protected void onTableDeleteAction(ActionEvent event) {
Contract contract = getParent();
ContractVo contract = getParent();
String path = contract.getPath();
if (!StringUtils.hasText(path)) {
setStatus("未设置目录");
@@ -792,7 +782,7 @@ public class ContractTabSkinFiles
protected boolean deleteRow(ContractFileViewModel row, boolean confirm) {
boolean deleted = super.deleteRow(row);
if (deleted) {
Contract contract = getParent();
ContractVo contract = getParent();
File file = new File(contract.getPath(), row.getFileName().get());
if (!file.exists()) {
setStatus(file.getAbsolutePath() + " 文件不存在, 无法删除");

View File

@@ -10,19 +10,17 @@ import com.ecep.contract.controller.contract.ContractWindowController;
import com.ecep.contract.controller.inventory.InventoryWindowController;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
import com.ecep.contract.controller.table.cell.InventoryTableCell;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import com.ecep.contract.converter.EntityStringConverter;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractItem;
import com.ecep.contract.model.Employee;
import com.ecep.contract.model.Inventory;
import com.ecep.contract.service.ContractItemService;
import com.ecep.contract.service.InventoryService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.vm.ContractItemComposeViewModel;
import com.ecep.contract.vm.ContractItemViewModel;
import com.ecep.contract.vm.InventoryViewModel;
import com.ecep.contract.vo.ContractItemVo;
import com.ecep.contract.vo.InventoryVo;
import javafx.application.Platform;
import javafx.scene.control.ContextMenu;
@@ -36,27 +34,34 @@ import lombok.Setter;
@FxmlPath("/ui/contract/contract-tab-item-v2.fxml")
public class ContractTabSkinItemsV2
extends AbstContractTableTabSkin<ContractItem, ContractItemViewModel>
implements TabSkin, EditableEntityTableTabSkin<ContractItem, ContractItemViewModel> {
extends AbstContractTableTabSkin<ContractItemVo, ContractItemViewModel>
implements TabSkin, EditableEntityTableTabSkin<ContractItemVo, ContractItemViewModel> {
@Setter
ContractItemService itemService;
@Setter
InventoryService inventoryService;
/* 以下是合同内容 */
/* 以下是合同内容 */
public TableColumn<ContractItemViewModel, Number> idColumn;
public TableColumn<ContractItemViewModel, String> titleColumn;
public TableColumn<ContractItemViewModel, String> specificationColumn;
public TableColumn<ContractItemViewModel, String> unitColumn;
public TableColumn<ContractItemViewModel, Inventory> inventoryColumn;
/**
* 合同内容, Inventory
*/
public TableColumn<ContractItemViewModel, Integer> inventoryColumn;
public TableColumn<ContractItemViewModel, Number> refIdColumn;
public TableColumn<ContractItemViewModel, String> codeColumn;
public TableColumn<ContractItemViewModel, Employee> creatorColumn;
/**
* 合同内容, 合同创建人, Employee
*/
public TableColumn<ContractItemViewModel, Integer> creatorColumn;
public TableColumn<ContractItemViewModel, LocalDateTime> createDateColumn;
public TableColumn<ContractItemViewModel, Employee> updaterColumn;
/**
* 合同内容, 合同更新人, Employee
*/
public TableColumn<ContractItemViewModel, Integer> updaterColumn;
public TableColumn<ContractItemViewModel, LocalDateTime> updateDateColumn;
public TableColumn<ContractItemViewModel, LocalDate> startDateColumn;
@@ -99,11 +104,7 @@ public class ContractTabSkinItemsV2
unitColumn.setCellValueFactory(param -> param.getValue().getUnit());
inventoryColumn.setCellValueFactory(param -> param.getValue().getInventory());
EntityStringConverter<Inventory> converter = new EntityStringConverter<>();
converter.setInitialized(v -> getInventoryService().findById(v.getId()));
converter.setFormater(Inventory::getCode);
inventoryColumn.setCellFactory(TextFieldTableCell.forTableColumn(converter));
inventoryColumn.setCellFactory(InventoryTableCell.forTableColumn(getInventoryService()));
exclusiveTaxPriceColumn.setCellValueFactory(param -> param.getValue().getExclusiveTaxPrice());
exclusiveTaxPriceColumn.setCellFactory(TextFieldTableCell.forTableColumn(currencyStringConverter));
@@ -147,29 +148,38 @@ public class ContractTabSkinItemsV2
}
return itemService;
}
InventoryService getInventoryService() {
if (inventoryService == null) {
inventoryService = getBean(InventoryService.class);
}
return inventoryService;
}
private void sum(ContractItemComposeViewModel model, Contract contract, HashMap<String, ContractItemComposeViewModel> map) {
double inQuantity = map.values().stream().map(ContractItemComposeViewModel::getIn).mapToDouble(v -> v.getQuantity().get()).sum();
private void sum(ContractItemComposeViewModel model, Contract contract,
HashMap<String, ContractItemComposeViewModel> map) {
double inQuantity = map.values().stream().map(ContractItemComposeViewModel::getIn)
.mapToDouble(v -> v.getQuantity().get()).sum();
Platform.runLater(() -> model.getIn().getQuantity().set(inQuantity));
double inTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getIn).mapToDouble(v -> v.getTaxAmount().get()).sum();
double inTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getIn)
.mapToDouble(v -> v.getTaxAmount().get()).sum();
Platform.runLater(() -> model.getIn().getTaxAmount().set(inTaxAmount));
double inExclusiveTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getIn).mapToDouble(v -> v.getExclusiveTaxAmount().get()).sum();
double inExclusiveTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getIn)
.mapToDouble(v -> v.getExclusiveTaxAmount().get()).sum();
Platform.runLater(() -> model.getIn().getExclusiveTaxAmount().set(inExclusiveTaxAmount));
double outQuantity = map.values().stream().map(ContractItemComposeViewModel::getOut).mapToDouble(v -> v.getQuantity().get()).sum();
double outQuantity = map.values().stream().map(ContractItemComposeViewModel::getOut)
.mapToDouble(v -> v.getQuantity().get()).sum();
Platform.runLater(() -> model.getOut().getQuantity().set(outQuantity));
double outTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getOut).mapToDouble(v -> v.getTaxAmount().get()).sum();
double outTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getOut)
.mapToDouble(v -> v.getTaxAmount().get()).sum();
Platform.runLater(() -> model.getOut().getTaxAmount().set(outTaxAmount));
double outExclusiveTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getOut).mapToDouble(v -> v.getExclusiveTaxAmount().get()).sum();
double outExclusiveTaxAmount = map.values().stream().map(ContractItemComposeViewModel::getOut)
.mapToDouble(v -> v.getExclusiveTaxAmount().get()).sum();
Platform.runLater(() -> model.getOut().getExclusiveTaxAmount().set(outExclusiveTaxAmount));
}
@@ -179,12 +189,13 @@ public class ContractTabSkinItemsV2
MenuItem showInventory = new MenuItem("查看存货");
showInventory.setOnAction(event -> {
ContractItemViewModel selectedItem = getTableView().getSelectionModel().getSelectedItem();
Inventory inventory = selectedItem.getInventory().get();
if (inventory == null) {
Integer inventoryId = selectedItem.getInventory().get();
if (inventoryId == null) {
return;
}
if (!ProxyUtils.isInitialized(inventory)) {
inventory = getInventoryService().findById(inventory.getId());
InventoryVo inventory = getInventoryService().findById(inventoryId);
if (inventory == null) {
return;
}
showInOwner(InventoryWindowController.class, InventoryViewModel.from(inventory));
});

View File

@@ -12,6 +12,7 @@ import com.ecep.contract.service.ContractPayPlanService;
import com.ecep.contract.service.ViewModelService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ContractPayPlanViewModel;
import com.ecep.contract.vo.ContractPayPlanVo;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Tab;
@@ -21,7 +22,7 @@ import javafx.util.converter.CurrencyStringConverter;
import javafx.util.converter.NumberStringConverter;
@FxmlPath("/ui/contract/contract-tab-pay-plan.fxml")
public class ContractTabSkinPayPlan extends AbstContractTableTabSkin<ContractPayPlan, ContractPayPlanViewModel> {
public class ContractTabSkinPayPlan extends AbstContractTableTabSkin<ContractPayPlanVo, ContractPayPlanViewModel> {
public TableColumn<ContractPayPlanViewModel, Number> idColumn;
public TableColumn<ContractPayPlanViewModel, LocalDate> payDateColumn;
@@ -50,7 +51,7 @@ public class ContractTabSkinPayPlan extends AbstContractTableTabSkin<ContractPay
}
@Override
protected ViewModelService<ContractPayPlan, ContractPayPlanViewModel> getViewModelService() {
protected ContractPayPlanService getViewModelService() {
return getPayPlanService();
}

View File

@@ -8,9 +8,12 @@ import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
import com.ecep.contract.controller.contract.ContractWindowController;
import com.ecep.contract.controller.vendor.PurchaseOrderWindowController;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.PurchaseOrdersService;
import com.ecep.contract.vm.PurchaseOrderViewModel;
import com.ecep.contract.vo.PurchaseOrderVo;
import com.ecep.contract.model.PurchaseOrder;
import com.ecep.contract.controller.table.cell.CompanyTableCell;
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
import javafx.scene.control.MenuItem;
@@ -22,19 +25,16 @@ import javafx.scene.control.TableColumn;
*/
@FxmlPath("/ui/contract/contract-tab-purchase-orders.fxml")
public class ContractTabSkinPurchaseOrders
extends AbstContractTableTabSkin<PurchaseOrder, PurchaseOrderViewModel>
extends AbstContractTableTabSkin<PurchaseOrderVo, PurchaseOrderViewModel>
implements TabSkin {
private PurchaseOrdersService purchaseOrdersService;
private EmployeeStringConverter employeeStringConverter;
public TableColumn<PurchaseOrderViewModel, Number> idColumn;
public TableColumn<PurchaseOrderViewModel, String> codeColumn;
public TableColumn<PurchaseOrderViewModel, String> table_makerColumn;
public TableColumn<PurchaseOrderViewModel, Integer> table_makerColumn;
public TableColumn<PurchaseOrderViewModel, LocalDateTime> table_makerDateColumn;
public TableColumn<PurchaseOrderViewModel, String> table_verifierColumn;
public TableColumn<PurchaseOrderViewModel, Integer> table_verifierColumn;
public TableColumn<PurchaseOrderViewModel, LocalDateTime> table_verifierDateColumn;
public TableColumn<PurchaseOrderViewModel, String> table_closerColumn;
public TableColumn<PurchaseOrderViewModel, Integer> table_closerColumn;
public TableColumn<PurchaseOrderViewModel, LocalDateTime> table_closerDateColumn;
public TableColumn<PurchaseOrderViewModel, String> table_descriptionColumn;
@@ -72,13 +72,16 @@ public class ContractTabSkinPurchaseOrders
codeColumn.setCellValueFactory(param -> param.getValue().getCode());
EmployeeStringConverter converter = getEmployeeStringConverter();
table_makerColumn.setCellValueFactory(param -> param.getValue().getMaker().map(converter::toString));
table_makerColumn.setCellValueFactory(param -> param.getValue().getMaker());
table_makerColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
table_makerDateColumn.setCellValueFactory(param -> param.getValue().getMakerDate());
table_makerDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
table_verifierColumn.setCellValueFactory(param -> param.getValue().getMaker().map(converter::toString));
table_verifierColumn.setCellValueFactory(param -> param.getValue().getMaker());
table_verifierColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
table_verifierDateColumn.setCellValueFactory(param -> param.getValue().getVerifierDate());
table_verifierDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
table_closerColumn.setCellValueFactory(param -> param.getValue().getMaker().map(converter::toString));
table_closerColumn.setCellValueFactory(param -> param.getValue().getMaker());
table_closerColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
table_closerDateColumn.setCellValueFactory(param -> param.getValue().getCloserDate());
table_closerDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
@@ -92,16 +95,14 @@ public class ContractTabSkinPurchaseOrders
}
PurchaseOrdersService getPurchaseOrdersService() {
if (purchaseOrdersService == null) {
purchaseOrdersService = getBean(PurchaseOrdersService.class);
}
return purchaseOrdersService;
return getBean(PurchaseOrdersService.class);
}
EmployeeStringConverter getEmployeeStringConverter() {
if (employeeStringConverter == null) {
employeeStringConverter = getBean(EmployeeStringConverter.class);
}
return employeeStringConverter;
return getBean(EmployeeStringConverter.class);
}
CompanyService getCompanyService() {
return controller.getCompanyService();
}
}

View File

@@ -5,13 +5,12 @@ import java.time.LocalDate;
import com.ecep.contract.ContractPayWay;
import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
import com.ecep.contract.controller.contract.ContractWindowController;
import com.ecep.contract.model.Contract;
import com.ecep.contract.service.ContractService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ContractViewModel;
import com.ecep.contract.vo.ContractVo;
import javafx.application.Platform;
import javafx.scene.control.Button;
import javafx.scene.control.MenuItem;
@@ -61,7 +60,7 @@ public class ContractTabSkinSubContract
}
@Override
public ParamUtils.Builder getSpecification(Contract parent) {
public ParamUtils.Builder getSpecification(ContractVo parent) {
ParamUtils.Builder params = getSpecification();
params.equals("parentCode", parent.getCode());
return params;

View File

@@ -9,9 +9,9 @@ import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
import com.ecep.contract.controller.contract.ContractWindowController;
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
import com.ecep.contract.controller.table.cell.CompanyTableCell;
import com.ecep.contract.controller.table.cell.ContractFileTableCell;
import com.ecep.contract.controller.vendor.VendorBidWindowController;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractBidVendor;
import com.ecep.contract.model.ContractFile;
import com.ecep.contract.service.CompanyService;
@@ -21,6 +21,9 @@ import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.vm.CompanyViewModel;
import com.ecep.contract.vm.ContractBidVendorViewModel;
import com.ecep.contract.vo.CompanyVo;
import com.ecep.contract.vo.ContractBidVendorVo;
import com.ecep.contract.vo.ContractVo;
import javafx.event.ActionEvent;
import javafx.scene.control.Alert;
@@ -39,13 +42,16 @@ import lombok.Setter;
*/
@FxmlPath("/ui/contract/contract-tab-bid.fxml")
public class ContractTabSkinVendorBid
extends AbstContractTableTabSkin<ContractBidVendor, ContractBidVendorViewModel>
implements TabSkin, EditableEntityTableTabSkin<ContractBidVendor, ContractBidVendorViewModel> {
extends AbstContractTableTabSkin<ContractBidVendorVo, ContractBidVendorViewModel>
implements TabSkin, EditableEntityTableTabSkin<ContractBidVendorVo, ContractBidVendorViewModel> {
@Setter
private ContractBidVendorService service;
public TableColumn<ContractBidVendorViewModel, Number> bidVendorTable_idColumn;
public TableColumn<ContractBidVendorViewModel, String> bidVendorTable_companyColumn;
public TableColumn<ContractBidVendorViewModel, ContractFile> bidVendorTable_quotationSheetColumn;
public TableColumn<ContractBidVendorViewModel, Integer> bidVendorTable_companyColumn;
/**
* 报价单, 合同文件, ContractFile
*/
public TableColumn<ContractBidVendorViewModel, Integer> bidVendorTable_quotationSheetColumn;
public Button bidVendorCreateBtn;
public MenuItem bidVendorTable_menu_refresh;
@@ -73,32 +79,6 @@ public class ContractTabSkinVendorBid
return controller.bidVendorTab;
}
static class QuotationSheetColumnTableCell extends TableCell<ContractBidVendorViewModel, ContractFile> {
private ContractFileService contractFileService;
public ContractFileService getContractFileService() {
if (contractFileService == null) {
contractFileService = SpringApp.getBean(ContractFileService.class);
}
return contractFileService;
}
@Override
protected void updateItem(ContractFile item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(null);
} else {
if (!ProxyUtils.isInitialized(item)) {
item = getContractFileService().findById(item.getId());
ContractBidVendorViewModel viewModel = getTableRow().getItem();
viewModel.getQuotationSheet().set(item);
}
setText(item.getFileName());
}
}
}
@Override
public void initializeTab() {
bidVendorCreateBtn.setOnAction(this::onBidVendorTableCreateAction);
@@ -107,15 +87,10 @@ public class ContractTabSkinVendorBid
bidVendorTable_menu_chose_sheet.setOnAction(this::onBidVendorTableChoseQuotationSheetAction);
bidVendorTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
bidVendorTable_companyColumn.setCellValueFactory(param -> param.getValue().getCompany().map(c -> {
if (c == null) {
return null;
} else {
return c.getName();
}
}));
bidVendorTable_quotationSheetColumn.setCellValueFactory(param -> param.getValue().getQuotationSheet());
bidVendorTable_quotationSheetColumn.setCellFactory(param -> new QuotationSheetColumnTableCell());
bidVendorTable_companyColumn.setCellValueFactory(param -> param.getValue().getCompanyId());
bidVendorTable_companyColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
bidVendorTable_quotationSheetColumn.setCellValueFactory(param -> param.getValue().getQuotationSheetFileId());
bidVendorTable_quotationSheetColumn.setCellFactory(ContractFileTableCell.forTableColumn(getContractService()));
super.initializeTab();
}
@@ -126,8 +101,7 @@ public class ContractTabSkinVendorBid
}
public void onBidVendorTableCreateAction(ActionEvent event) {
Contract contract = getParent();
ContractVo contract = getParent();
ChoiceDialog<String> dialog = new ChoiceDialog<>();
dialog.setTitle("添加比价供应商");
@@ -154,13 +128,13 @@ public class ContractTabSkinVendorBid
comboBox.setEditable(true);
dialog.showAndWait().ifPresent(selectedItem -> {
Company company = getCompanyService().findAllByName(selectedItem).getFirst();
CompanyVo company = getCompanyService().findAllByName(selectedItem).getFirst();
List<ContractBidVendor> list = getService().findByContractAndCompany(contract, company);
List<ContractBidVendorVo> list = getService().findByContractAndCompany(contract, company);
if (list == null || list.isEmpty()) {
ContractBidVendor bidVendor = new ContractBidVendor();
bidVendor.setContract(contract);
bidVendor.setCompany(company);
ContractBidVendorVo bidVendor = new ContractBidVendorVo();
bidVendor.setContractId(contract.getId());
bidVendor.setCompanyId(company.getId());
getService().save(bidVendor);
loadTableDataSet();
} else {
@@ -172,7 +146,6 @@ public class ContractTabSkinVendorBid
});
}
/**
* 匹配报价表
*
@@ -198,5 +171,4 @@ public class ContractTabSkinVendorBid
return controller.getCompanyService();
}
}

View File

@@ -6,10 +6,6 @@ import java.util.logging.Level;
import org.springframework.beans.BeansException;
import com.ecep.contract.MessageHolder;
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.CompanyCustomerService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CompanyVendorService;
@@ -20,6 +16,10 @@ import com.ecep.contract.service.ContractTypeService;
import com.ecep.contract.service.EmployeeService;
import com.ecep.contract.service.YongYouU8Service;
import com.ecep.contract.util.BeanCacher;
import com.ecep.contract.vo.ContractGroupVo;
import com.ecep.contract.vo.ContractKindVo;
import com.ecep.contract.vo.ContractTypeVo;
import com.ecep.contract.vo.EmployeeVo;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
@@ -127,26 +127,26 @@ public class ContractUpdater implements MessageHolder {
return getBean(EmployeeService.class);
}
private ContractType getTypeByCode(String typeCode) {
ContractType type = getBean(ContractTypeService.class).findByCode(typeCode);
private ContractTypeVo getTypeByCode(String typeCode) {
ContractTypeVo type = getBean(ContractTypeService.class).findByCode(typeCode);
return type;
}
private ContractGroup getGroupByCode(String groupCode) {
ContractGroup group = getBean(ContractGroupService.class).findByCode(groupCode);
private ContractGroupVo getGroupByCode(String groupCode) {
ContractGroupVo group = getBean(ContractGroupService.class).findByCode(groupCode);
return group;
}
private ContractKind getKindByName(String kindName) {
ContractKind kind = getBean(ContractKindService.class).findByName(kindName);
private ContractKindVo getKindByName(String kindName) {
ContractKindVo kind = getBean(ContractKindService.class).findByName(kindName);
return kind;
}
private Employee findEmployeeByCode(String personCode) {
private EmployeeVo findEmployeeByCode(String personCode) {
return getEmployeeService().findByCode(personCode);
}
private Employee findEmployeeByName(String personName) {
private EmployeeVo findEmployeeByName(String personName) {
if (personName == null) {
return null;
}

View File

@@ -3,14 +3,14 @@ package com.ecep.contract.controller.tab;
import java.time.LocalDate;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.model.Contract;
import com.ecep.contract.task.Tasker;
import com.ecep.contract.vo.ContractVo;
import lombok.Setter;
public class CustomerContractCostFormUpdateTask extends Tasker<Object> {
@Setter
private Contract contract;
private ContractVo contract;
/**
* 成本表文件名
*/

View File

@@ -12,6 +12,7 @@ import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.ContractFileService;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.SalesOrderViewModel;
import com.ecep.contract.vo.SalesOrderVo;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.control.Tab;
@@ -19,7 +20,7 @@ import javafx.scene.control.TextField;
import lombok.Setter;
public class SalesOrderTabSkinBase
extends AbstEntityBasedTabSkin<SalesOrderWindowController, SalesOrder, SalesOrderViewModel>
extends AbstEntityBasedTabSkin<SalesOrderWindowController, SalesOrderVo, SalesOrderViewModel>
implements TabSkin {
@Setter
@@ -45,7 +46,6 @@ public class SalesOrderTabSkinBase
initializeEmployeeField(controller.makerField, viewModel.getMaker());
initializeEmployeeField(controller.verifierField, viewModel.getVerifier());
controller.makeDateField.textProperty().bind(viewModel.getMakerDate().map(MyDateTimeUtils::format));
controller.verifierDateField.textProperty().bind(viewModel.getVerifierDate().map(MyDateTimeUtils::format));
@@ -63,9 +63,8 @@ public class SalesOrderTabSkinBase
return MyDateTimeUtils.format(dateTime);
}
private void initializeEmployeeField(TextField textField, SimpleObjectProperty<Employee> property) {
EmployeeStringConverter converter = getEmployeeStringConverter();
UITools.autoCompletion(textField, property, converter::suggest, converter);
private void initializeEmployeeField(TextField textField, SimpleObjectProperty<Integer> property) {
UITools.autoCompletion(textField, property, controller.getEmployeeService());
}
public CompanyService getCompanyService() {

View File

@@ -16,6 +16,8 @@ import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.vm.ContractItemComposeViewModel;
import com.ecep.contract.vm.SalesBillVoucherViewModel;
import com.ecep.contract.vm.SalesOrderViewModel;
import com.ecep.contract.vo.ContractItemVo;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.SalesBillVoucherVo;
import com.ecep.contract.vo.SalesOrderVo;
import javafx.application.Platform;
@@ -128,7 +130,7 @@ public class SalesOrderTabSkinBillVoucher
}
private void sum(ContractItemComposeViewModel model, Contract contract,
HashMap<String, ContractItemComposeViewModel> map) {
HashMap<String, ContractItemComposeViewModel> map) {
double inQuantity = map.values().stream().map(ContractItemComposeViewModel::getIn)
.mapToDouble(v -> v.getQuantity().get()).sum();
Platform.runLater(() -> model.getIn().getQuantity().set(inQuantity));
@@ -179,13 +181,9 @@ public class SalesOrderTabSkinBillVoucher
setText(String.format(format, item));
}
private void setTooltip(ObservableList<ContractItem> list, Function<ContractItem, Double> getPrice) {
private void setTooltip(ObservableList<ContractItemVo> list, Function<ContractItemVo, Double> getPrice) {
String text = list.stream().map(v -> {
Contract contract = v.getContract();
if (!ProxyUtils.isInitialized(contract)) {
contract = SpringApp.getBean(ContractService.class).findById(contract.getId());
}
ContractVo contract = SpringApp.getBean(ContractService.class).findById(v.getContractId());
Double price = getPrice.apply(v);
double quantity = v.getQuantity();
return contract.getCode() + " " + String.format(format, price) + " x " + quantity + " = "

View File

@@ -6,26 +6,24 @@ import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.ecep.contract.vo.SalesOrderItemVo;
import com.ecep.contract.vo.SalesOrderVo;
import org.springframework.util.StringUtils;
import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.customer.SalesOrderWindowController;
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractItem;
import com.ecep.contract.model.SalesOrder;
import com.ecep.contract.model.SalesOrderItem;
import com.ecep.contract.service.ContractService;
import com.ecep.contract.service.SaleOrdersService;
import com.ecep.contract.service.SalesOrderItemService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.vm.ContractItemComposeViewModel;
import com.ecep.contract.vm.SalesOrderItemViewModel;
import com.ecep.contract.vm.SalesOrderViewModel;
import com.ecep.contract.vo.ContractItemVo;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.SalesOrderItemVo;
import com.ecep.contract.vo.SalesOrderVo;
import javafx.application.Platform;
import javafx.collections.ObservableList;
@@ -106,13 +104,13 @@ public class SalesOrderTabSkinItems
}
@Override
public ParamUtils.Builder getSpecification(SalesOrder parent) {
public ParamUtils.Builder getSpecification(SalesOrderVo parent) {
ParamUtils.Builder params = getSpecification();
params.equals("order", parent);
return params;
}
ContractItemComposeViewModel createNew(String key, ContractItem item) {
ContractItemComposeViewModel createNew(String key, ContractItemVo item) {
ContractItemComposeViewModel m = new ContractItemComposeViewModel();
// set key
m.getTitle().set(item.getTitle());
@@ -120,8 +118,8 @@ public class SalesOrderTabSkinItems
return m;
}
private void addIn(HashMap<String, ContractItemComposeViewModel> map, List<ContractItem> list) {
for (ContractItem item : list) {
private void addIn(HashMap<String, ContractItemComposeViewModel> map, List<ContractItemVo> list) {
for (ContractItemVo item : list) {
String key = makeKey(item);
ContractItemComposeViewModel model = map.computeIfAbsent(key, k -> createNew(k, item));
model.getUnit().set(item.getUnit());
@@ -129,8 +127,8 @@ public class SalesOrderTabSkinItems
}
}
private void addOut(List<ContractItem> list, HashMap<String, ContractItemComposeViewModel> map) {
for (ContractItem item : list) {
private void addOut(List<ContractItemVo> list, HashMap<String, ContractItemComposeViewModel> map) {
for (ContractItemVo item : list) {
String key = makeKey(item);
ContractItemComposeViewModel model = map.computeIfAbsent(key, k -> createNew(k, item));
model.getUnit().set(item.getUnit());
@@ -222,7 +220,7 @@ public class SalesOrderTabSkinItems
Platform.runLater(() -> model.getOut().getExclusiveTaxAmount().set(outExclusiveTaxAmount));
}
String makeKey(ContractItem item) {
String makeKey(ContractItemVo item) {
return item.getTitle() + "-" + item.getSpecification();
}
@@ -247,12 +245,10 @@ public class SalesOrderTabSkinItems
setText(String.format(format, item));
}
private void setTooltip(ObservableList<ContractItem> list, Function<ContractItem, Double> getPrice) {
private void setTooltip(ObservableList<ContractItemVo> list, Function<ContractItemVo, Double> getPrice) {
String text = list.stream().map(v -> {
Contract contract = v.getContract();
if (!ProxyUtils.isInitialized(contract)) {
contract = SpringApp.getBean(ContractService.class).findById(contract.getId());
}
Integer contractId = v.getContractId();
ContractVo contract = SpringApp.getBean(ContractService.class).findById(contractId);
Double price = getPrice.apply(v);
double quantity = v.getQuantity();
return contract.getCode() + " " + String.format(format, price) + " x " + quantity + " = "

View File

@@ -13,17 +13,18 @@ import com.ecep.contract.controller.company.CompanyWindowController;
import com.ecep.contract.controller.vendor.VendorBidWindowController;
import com.ecep.contract.converter.CompanyStringConverter;
import com.ecep.contract.converter.EntityStringConverter;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractBidVendor;
import com.ecep.contract.model.ContractFile;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.ContractFileService;
import com.ecep.contract.service.ContractService;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.BaseViewModel;
import com.ecep.contract.vm.ContractBidVendorViewModel;
import com.ecep.contract.vm.ContractFileViewModel;
import com.ecep.contract.vo.CompanyVo;
import com.ecep.contract.vo.ContractBidVendorVo;
import com.ecep.contract.vo.ContractFileVo;
import com.ecep.contract.vo.ContractVo;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
@@ -35,13 +36,8 @@ import javafx.util.converter.LocalDateStringConverter;
import lombok.Setter;
public class VendorBidTabSkinBase
extends AbstEntityBasedTabSkin<VendorBidWindowController, ContractBidVendor, ContractBidVendorViewModel>
extends AbstEntityBasedTabSkin<VendorBidWindowController, ContractBidVendorVo, ContractBidVendorViewModel>
implements TabSkin {
@Setter
private ContractFileService companyContactService;
@Setter
private CompanyService companyService;
private final ContractFileViewModel quotationSheetViewModel = new ContractFileViewModel();
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
@@ -75,8 +71,13 @@ public class VendorBidTabSkinBase
controller.developDateField.setConverter(converter);
controller.developDateField.valueProperty().bindBidirectional(quotationSheetViewModel.getApplyDate());
viewModel.getQuotationSheet()
.addListener((observable, oldValue, newValue) -> quotationSheetViewModel.update(newValue));
viewModel.getQuotationSheetFileId()
.addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
ContractFileVo file = getContractFileService().findById(newValue);
quotationSheetViewModel.update(file);
}
});
quotationSheetViewModel.getApplyDate()
.addListener((observable, oldValue, newValue) -> quotationSheetViewModel.getChanged().set(true));
@@ -91,16 +92,21 @@ public class VendorBidTabSkinBase
// );
// controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompany().isNull());
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompanyId().isNull());
controller.relativeCompanyBtn.setOnAction(event -> {
Company company = viewModel.getCompany().get();
if (company != null) {
Integer companyId = viewModel.getCompanyId().get();
if (companyId != null) {
CompanyVo company = getCompanyService().findById(companyId);
CompanyWindowController.show(company, controller.tabPane.getScene().getWindow());
}
});
if (viewModel.getQuotationSheet().get() != null) {
quotationSheetViewModel.update(viewModel.getQuotationSheet().get());
if (viewModel.getQuotationSheetFileId() != null) {
Integer fileId = viewModel.getQuotationSheetFileId().get();
if (fileId != null) {
ContractFileVo file = getContractFileService().findById(fileId);
quotationSheetViewModel.update(file);
}
}
}
@@ -113,11 +119,12 @@ public class VendorBidTabSkinBase
}
private void initializeFileFieldAutoCompletion(TextField textField) {
EntityStringConverter<ContractFile> stringConverter = new EntityStringConverter<>();
EntityStringConverter<ContractFileVo> stringConverter = new EntityStringConverter<>();
stringConverter.setInitialized(cc -> getContractFileService().findById(cc.getId()));
stringConverter.setFormater(ContractFile::getFileName);
stringConverter.setFormater(ContractFileVo::getFileName);
stringConverter.setSuggestion(p -> {
Contract contract = viewModel.getContract().get();
Integer contractId = viewModel.getContractId().get();
ContractVo contract = getContractService().findById(contractId);
if (contract == null) {
return new ArrayList<>();
}
@@ -125,26 +132,23 @@ public class VendorBidTabSkinBase
params.put("searchText", p);
return getContractFileService().findAll(params, Pageable.ofSize(10)).getContent();
});
UITools.autoCompletion(textField, viewModel.getQuotationSheet(), stringConverter::suggest, stringConverter);
UITools.autoCompletion(textField, viewModel.getQuotationSheetFileId(), getContractFileService());
}
private void initializeCompanyFieldAutoCompletion(TextField textField) {
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
UITools.autoCompletion(textField, viewModel.getCompany(), converter::suggest, converter);
UITools.autoCompletion(textField, viewModel.getCompanyId(), getCompanyService());
}
public CompanyService getCompanyService() {
if (companyService == null) {
companyService = SpringApp.getBean(CompanyService.class);
}
return companyService;
return getCachedBean(CompanyService.class);
}
public ContractService getContractService() {
return getCachedBean(ContractService.class);
}
public ContractFileService getContractFileService() {
if (companyContactService == null) {
companyContactService = SpringApp.getBean(ContractFileService.class);
}
return companyContactService;
return getCachedBean(ContractFileService.class);
}
@Override
@@ -157,7 +161,7 @@ public class VendorBidTabSkinBase
super.save();
if (quotationSheetViewModel.isChanged()) {
ContractFile contractFile = getContractFileService().findById(quotationSheetViewModel.getId().get());
ContractFileVo contractFile = getContractFileService().findById(quotationSheetViewModel.getId().get());
if (quotationSheetViewModel.copyTo(contractFile)) {
contractFile = getContractFileService().save(contractFile);
BaseViewModel.updateInFxApplicationThread(contractFile, quotationSheetViewModel);

View File

@@ -149,7 +149,6 @@ public class AsyncUpdateTableCell<V, T extends IdentityEntity> extends javafx.sc
// 检查单元格是否仍然显示相同的项目
// 如果单元格已被重用或当前项目已改变,则不更新
if (isEmpty() || getItem() == null) {
logger.debug("Skipping async update - cell reused ");
return;
}

View File

@@ -5,12 +5,24 @@ import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.vo.CompanyVo;
import javafx.util.Callback;
import lombok.NoArgsConstructor;
/**
* 公司单元格
*/
@NoArgsConstructor
public class CompanyTableCell<V> extends AsyncUpdateTableCell<V, CompanyVo> {
/**
* 创建单元格工厂
*
* @param companyService 公司服务
* @return 单元格工厂
*/
public static <V> Callback<javafx.scene.control.TableColumn<V, Integer>, javafx.scene.control.TableCell<V, Integer>> forTableColumn(
CompanyService companyService) {
return param -> new CompanyTableCell<V>(companyService);
}
public CompanyTableCell(CompanyService companyService) {
setService(companyService);
@@ -20,4 +32,5 @@ public class CompanyTableCell<V> extends AsyncUpdateTableCell<V, CompanyVo> {
protected CompanyService getServiceBean() {
return getBean(CompanyService.class);
}
}

View File

@@ -0,0 +1,66 @@
package com.ecep.contract.controller.table.cell;
import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.service.ContractService;
import com.ecep.contract.vo.ContractVo;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ContractFileTableCell<V> extends AsyncUpdateTableCell<V, ContractVo> {
/**
* 创建一个ContractFileTableCell的TableCell工厂自动获取ContractService实例
*
* @param <S> 表格行类型
* @return TableCell工厂回调
*/
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(getBean(ContractService.class));
}
/**
* 创建一个ContractFileTableCell的TableCell工厂使用提供的ContractService实例
*
* @param <S> 表格行类型
* @param service ContractService实例
* @return TableCell工厂回调
*/
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn(ContractService service) {
return param -> new ContractFileTableCell<S>(service);
}
/**
* 使用指定的ContractService创建ContractFileTableCell实例
*
* @param contractService ContractService实例
*/
public ContractFileTableCell(ContractService contractService) {
setService(contractService);
}
/**
* 获取ContractService实例
*
* @return ContractService实例
*/
@Override
protected ContractService getServiceBean() {
return getBean(ContractService.class);
}
/**
* 格式化ContractVo对象为显示文本
*
* @param entity ContractVo对象
* @return 格式化后的文本
*/
@Override
public String format(ContractVo entity) {
return entity.getCode() + " " + entity.getName();
}
}

View File

@@ -0,0 +1,33 @@
package com.ecep.contract.controller.table.cell;
import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.SpringApp;
import com.ecep.contract.service.CustomerCatalogService;
import com.ecep.contract.vo.CustomerCatalogVo;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class CustomerCatalogTableCell<T> extends AsyncUpdateTableCell<T, CustomerCatalogVo> {
public CustomerCatalogTableCell(CustomerCatalogService service) {
setService(service);
}
@Override
protected CustomerCatalogService getServiceBean() {
return SpringApp.getBean(CustomerCatalogService.class);
}
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(getBean(CustomerCatalogService.class));
}
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn(CustomerCatalogService service) {
return param -> new CustomerCatalogTableCell<S>(service);
}
}

View File

@@ -13,13 +13,6 @@ import lombok.Setter;
@Setter
public class EmployeeTableCell<V> extends AsyncUpdateTableCell<V, EmployeeVo> {
public EmployeeTableCell() {
}
public EmployeeTableCell(EmployeeService employeeService) {
setService(employeeService);
}
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(getBean(EmployeeService.class));
}
@@ -28,6 +21,13 @@ public class EmployeeTableCell<V> extends AsyncUpdateTableCell<V, EmployeeVo> {
return param -> new EmployeeTableCell<S>(service);
}
public EmployeeTableCell() {
}
public EmployeeTableCell(EmployeeService employeeService) {
setService(employeeService);
}
@Override
protected EmployeeService getServiceBean() {
return getBean(EmployeeService.class);

View File

@@ -41,7 +41,7 @@ public class EvaluationFileTableCell<V> extends AsyncUpdateTableCell<V, CompanyC
@Override
protected CompanyCustomerEvaluationFormFileVo initialize() {
// 直接返回Vo对象
return getEvaluationFormFileService().findCustomerEvaluationFormFileById(getItem());
return getEvaluationFormFileService().findById(getItem());
}
@Override

View File

@@ -1,17 +1,26 @@
package com.ecep.contract.controller.table.cell;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.SpringApp;
import com.ecep.contract.service.InventoryCatalogService;
import com.ecep.contract.service.InventoryService;
import com.ecep.contract.vo.InventoryCatalogVo;
import com.ecep.contract.vo.InventoryVo;
import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, InventoryVo> {
/**
* 创建单元格工厂
*
* @param inventoryService 库存服务
* @return 单元格工厂
*/
public static <V> Callback<javafx.scene.control.TableColumn<V, Integer>, javafx.scene.control.TableCell<V, Integer>> forTableColumn(
InventoryService inventoryService) {
return param -> new InventoryTableCell<>(inventoryService);
}
private InventoryCatalogService inventoryCatalogService;
@@ -32,4 +41,5 @@ public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, InventoryVo>
InventoryCatalogVo catalog = getInventoryCatalogService().findById(catalogId);
return (catalog != null ? (catalog.getName() + " ") : "") + entity.getName();
}
}

View File

@@ -1,15 +1,24 @@
package com.ecep.contract.controller.table.cell;
import com.ecep.contract.model.Project;
import com.ecep.contract.service.IEntityService;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.vo.ProjectVo;
import lombok.NoArgsConstructor;
import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.service.ProjectService;
import com.ecep.contract.vo.ProjectVo;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ProjectTableCell<V> extends AsyncUpdateTableCell<V, ProjectVo> {
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(getBean(ProjectService.class));
}
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn(ProjectService service) {
return param -> new ProjectTableCell<S>(service);
}
public ProjectTableCell(ProjectService projectService) {
setService(projectService);
@@ -20,7 +29,6 @@ public class ProjectTableCell<V> extends AsyncUpdateTableCell<V, ProjectVo> {
return getBean(ProjectService.class);
}
@Override
public String format(ProjectVo entity) {
return entity.getCode() + " " + entity.getName();

View File

@@ -6,13 +6,13 @@ import java.util.List;
import org.controlsfx.control.ListSelectionView;
import com.ecep.contract.ContractFileType;
import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.model.ContractFileTypeLocal;
import com.ecep.contract.model.VendorGroupRequireFileType;
import com.ecep.contract.service.ContractFileService;
import com.ecep.contract.service.ContractFileTypeService;
import com.ecep.contract.service.VendorGroupRequireFileTypeService;
import com.ecep.contract.vo.VendorGroupRequireFileTypeVo;
import impl.org.controlsfx.skin.ListSelectionViewSkin;
import javafx.beans.property.SimpleBooleanProperty;
@@ -58,8 +58,8 @@ public class VendorGroupRequireFilesTabSkin extends AbstVendorGroupBasedTabSkin
}
private void loadSelectedRoles() {
List<VendorGroupRequireFileType> list = getRequireFileTypeService().findByGroupId(viewModel.getId().get());
List<ContractFileType> types = list.stream().map(VendorGroupRequireFileType::getFileType).toList();
List<VendorGroupRequireFileTypeVo> list = getRequireFileTypeService().findByGroupId(viewModel.getId().get());
List<ContractFileType> types = list.stream().map(VendorGroupRequireFileTypeVo::getFileType).toList();
fileTypesField.getTargetItems().setAll(types);
changed.set(false);
}
@@ -124,15 +124,15 @@ public class VendorGroupRequireFilesTabSkin extends AbstVendorGroupBasedTabSkin
}
private void saveRequireFileTypes(ActionEvent event) {
List<VendorGroupRequireFileType> list = getRequireFileTypeService().findByGroupId(viewModel.getId().get());
List<VendorGroupRequireFileTypeVo> list = getRequireFileTypeService().findByGroupId(viewModel.getId().get());
ObservableList<ContractFileType> types = fileTypesField.getTargetItems();
// 保存 types list 中是已经存储的如果types 中没有则删除,如果 types 中有则新增保存
for (ContractFileType type : types) {
VendorGroupRequireFileType entity = list.stream().filter(v -> v.getFileType() == type).findFirst()
VendorGroupRequireFileTypeVo entity = list.stream().filter(v -> v.getFileType() == type).findFirst()
.orElse(null);
if (entity == null) {
entity = new VendorGroupRequireFileType();
entity.setGroup(getEntity());
entity = new VendorGroupRequireFileTypeVo();
entity.setGroupId(viewModel.getId().get());
entity.setFileType(type);
getRequireFileTypeService().save(entity);
}

View File

@@ -48,7 +48,7 @@ public class CloudRkService extends QueryService<CloudRkVo, CloudRkViewModel> {
}, 1, TimeUnit.MINUTES);
}
public CloudRkVo updateCloudRk(Integer companyId, MessageHolder holder) {
public CloudRkVo updateCloudRk(CompanyVo company, MessageHolder holder) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'updateCloudRk'");
}
@@ -63,6 +63,8 @@ public class CloudRkService extends QueryService<CloudRkVo, CloudRkViewModel> {
cloudRk.setVendorGrade("");
cloudRk.setVendorScore(-1);
cloudRk.setRank("");
cloudRk.setActive(false);
cloudRk.setVersion(1);
cloudRk = save(cloudRk);
}
return cloudRk;

View File

@@ -2,12 +2,14 @@ package com.ecep.contract.service;
import java.time.LocalDateTime;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.ecep.contract.DesktopUtils;
import com.ecep.contract.SpringApp;
import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CloudTycInfoViewModel;
import com.ecep.contract.vo.CloudTycVo;
@@ -57,6 +59,20 @@ public class CloudTycService extends QueryService<CloudTycVo, CloudTycInfoViewMo
}
public CloudTycVo getOrCreateCloudTyc(CompanyVo company) {
throw new UnsupportedOperationException("Unimplemented method 'getOrCreateCloudTyc'");
CloudTycVo cloudTyc = findByCompany(company);
if (cloudTyc == null) {
cloudTyc = new CloudTycVo();
cloudTyc.setCompanyId(company.getId());
cloudTyc.setActive(false);
cloudTyc.setVersion(1);
cloudTyc = save(cloudTyc);
}
return cloudTyc;
}
public CloudTycVo findByCompany(CompanyVo company) {
return findAll(ParamUtils.builder().equals("company", company.getId()).build(), Pageable.ofSize(1)).stream()
.findFirst().orElse(null);
}
}

View File

@@ -25,8 +25,12 @@ public class CompanyCustomerEvaluationFormFileService
* 根据客户文件查找评估表文件
*/
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(CompanyCustomerFileVo customerFile) {
return findByCustomerFile(customerFile.getId());
}
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(Integer customerFileId) {
List<CompanyCustomerEvaluationFormFileVo> page = findAll(ParamUtils.builder()
.equals("customerFile", customerFile.getId())
.equals("customerFile", customerFileId)
.build(), Pageable.ofSize(1))
.getContent();
if (page.isEmpty()) {
@@ -42,10 +46,4 @@ public class CompanyCustomerEvaluationFormFileService
return super.save(formFile);
}
/**
* 根据ID查找评估表文件
*/
public CompanyCustomerEvaluationFormFileVo findCustomerEvaluationFormFileById(int id) {
return findById(id);
}
}

View File

@@ -11,6 +11,8 @@ import org.springframework.stereotype.Service;
import com.ecep.contract.vm.ContractKindViewModel;
import com.ecep.contract.vo.ContractKindVo;
import javafx.util.StringConverter;
@Service
@CacheConfig(cacheNames = "contract-kind")
public class ContractKindService extends QueryService<ContractKindVo, ContractKindViewModel> {
@@ -68,4 +70,19 @@ public class ContractKindService extends QueryService<ContractKindVo, ContractKi
super.delete(entity);
}
@Override
public StringConverter<ContractKindVo> getStringConverter() {
return new StringConverter<ContractKindVo>() {
@Override
public String toString(ContractKindVo object) {
return object.getCode() + " " + object.getName() + " " + object.getTitle();
}
@Override
public ContractKindVo fromString(String string) {
return findByCode(string);
}
};
}
}

View File

@@ -2,18 +2,28 @@ package com.ecep.contract.service;
import java.util.List;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractPayPlan;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ContractPayPlanViewModel;
import com.ecep.contract.vo.ContractPayPlanVo;
import com.ecep.contract.vo.ContractVo;
@Service
public class ContractPayPlanService extends QueryService<ContractPayPlan, ContractPayPlanViewModel> {
public class ContractPayPlanService extends QueryService<ContractPayPlanVo, ContractPayPlanViewModel> {
public List<ContractPayPlan> findAllByContract(Contract contract) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'findAllByContract'");
public List<ContractPayPlanVo> findAllByContract(Contract contract) {
return findAll(ParamUtils.builder()
.equals("contract", contract.getId())
.build(), Pageable.unpaged()).getContent();
}
public List<ContractPayPlanVo> findAllByContract(ContractVo contract) {
return findAll(ParamUtils.builder()
.equals("contract", contract.getId())
.build(), Pageable.unpaged()).getContent();
}
}

View File

@@ -19,6 +19,7 @@ import com.ecep.contract.model.ContractFile;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ContractViewModel;
import com.ecep.contract.vo.CompanyVendorVo;
import com.ecep.contract.vo.ContractFileVo;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.ProjectVo;
@@ -165,7 +166,7 @@ public class ContractService extends QueryService<ContractVo, ContractViewModel>
return findAll(ParamUtils.equal("project", project.getId()), Pageable.unpaged()).getContent();
}
public void syncContractFile(ContractFile contractFile, File outputFile, MessageHolder holder) {
public void syncContractFile(ContractFileVo contractFile, File outputFile, MessageHolder holder) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'syncContractFile'");
}

View File

@@ -11,6 +11,8 @@ import org.springframework.stereotype.Service;
import com.ecep.contract.vm.ContractTypeViewModel;
import com.ecep.contract.vo.ContractTypeVo;
import javafx.util.StringConverter;
@Service
@CacheConfig(cacheNames = "contract-type")
public class ContractTypeService extends QueryService<ContractTypeVo, ContractTypeViewModel> {
@@ -66,4 +68,21 @@ public class ContractTypeService extends QueryService<ContractTypeVo, ContractTy
public ContractTypeVo save(ContractTypeVo entity) {
return super.save(entity);
}
@Override
public StringConverter<ContractTypeVo> getStringConverter() {
return new StringConverter<ContractTypeVo>() {
@Override
public String toString(ContractTypeVo object) {
return object.getCode() + " " + object.getCatalog() + " " + object.getName() + " " + object.getTitle()
+ "("
+ object.getDirection() + ")";
}
@Override
public ContractTypeVo fromString(String string) {
return findByCode(string);
}
};
}
}

View File

@@ -3,11 +3,11 @@ package com.ecep.contract.service;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import com.ecep.contract.model.CustomerCatalog;
import com.ecep.contract.vm.CustomerCatalogViewModel;
import com.ecep.contract.vo.CustomerCatalogVo;
@Service
@CacheConfig(cacheNames = "customer-catalog")
public class CustomerCatalogService extends QueryService<CustomerCatalog, CustomerCatalogViewModel>{
public class CustomerCatalogService extends QueryService<CustomerCatalogVo, CustomerCatalogViewModel> {
}

View File

@@ -1,13 +1,32 @@
package com.ecep.contract.service;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.DeliverySignMethodViewModel;
import com.ecep.contract.vo.DeliverySignMethodVo;
import com.ecep.contract.vo.ProjectSaleTypeVo;
@Service
@CacheConfig(cacheNames = "delivery-sign-method")
public class DeliverySignMethodService extends QueryService<DeliverySignMethodVo, DeliverySignMethodViewModel> {
/**
* 根据销售类型和编码查询发货方式
*
* @param saleType
* @param code
* @return
*/
public DeliverySignMethodVo findBySaleTypeAndCode(ProjectSaleTypeVo saleType, String code) {
Page<DeliverySignMethodVo> page = findAll(ParamUtils.builder()
.equals("saleType", saleType.getId()).build(), Pageable.unpaged());
if (page.isEmpty()) {
return null;
}
return page.stream().filter(v -> v.getCode().equals(code)).findFirst().orElse(null);
}
}

View File

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.vm.EmployeeViewModel;
import com.ecep.contract.vo.EmployeeRoleVo;
import com.ecep.contract.vo.EmployeeVo;
import com.fasterxml.jackson.databind.JsonNode;
@@ -52,14 +53,17 @@ public class EmployeeService extends QueryService<EmployeeVo, EmployeeViewModel>
}
}
public List<EmployeeRole> getRolesByEmployeeId(Integer id) {
public List<EmployeeRoleVo> getRolesByEmployeeId(Integer employeeId) {
try {
return async("getRolesByEmployeeId", List.of(id), List.of(Integer.class)).handle((response, ex) -> {
return async("getRolesByEmployeeId", List.of(employeeId), List.of(Integer.class)).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("远程方法+getRolesByEmployeeId+调用失败", ex);
}
if (response != null) {
try {
List<EmployeeRole> content = new ArrayList<>();
List<EmployeeRoleVo> content = new ArrayList<>();
for (JsonNode node : response) {
EmployeeRole newEntity = new EmployeeRole();
EmployeeRoleVo newEntity = new EmployeeRoleVo();
objectMapper.updateValue(newEntity, node);
content.add(newEntity);
}
@@ -90,4 +94,9 @@ public class EmployeeService extends QueryService<EmployeeVo, EmployeeViewModel>
public void delete(EmployeeVo entity) {
super.delete(entity);
}
public void getUpdateEmployeeRoles(int employeeId, List<EmployeeRoleVo> roles) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getUpdateEmployeeRoles'");
}
}

View File

@@ -2,17 +2,41 @@ package com.ecep.contract.service;
import java.util.List;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.model.Permission;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.PermissionViewModel;
import com.ecep.contract.vo.PermissionVo;
@Service
public class PermissionService extends QueryService<Permission, PermissionViewModel> {
@CacheConfig(cacheNames = "permission")
public class PermissionService extends QueryService<PermissionVo, PermissionViewModel> {
public List<Permission> findByFunctionId(int i) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'findByFunctionId'");
@Cacheable(key = "#p0")
@Override
public PermissionVo findById(Integer id) {
return super.findById(id);
}
@Caching(evict = { @CacheEvict(key = "#p0.id") })
@Override
public PermissionVo save(PermissionVo entity) {
return super.save(entity);
}
@Caching(evict = { @CacheEvict(key = "#p0.id") })
@Override
public void delete(PermissionVo entity) {
super.delete(entity);
}
public List<PermissionVo> findByFunctionId(int functionId) {
return findAll(ParamUtils.builder().equals("null", functionId).build(), Pageable.unpaged()).getContent();
}
}

View File

@@ -10,6 +10,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.model.ProductType;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ProductTypeViewModel;
import com.ecep.contract.vo.ProductTypeVo;
@@ -52,4 +53,13 @@ public class ProductTypeService extends QueryService<ProductTypeVo, ProductTypeV
public void delete(ProductTypeVo entity) {
super.delete(entity);
}
public ProductTypeVo findByCode(String code) {
Page<ProductTypeVo> page = findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1));
if (page.isEmpty()) {
return null;
}
return page.getContent().getFirst();
}
}

View File

@@ -3,8 +3,11 @@ package com.ecep.contract.service;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ProductUsageViewModel;
import com.ecep.contract.vo.ProductUsageVo;
@@ -36,4 +39,12 @@ public class ProductUsageService extends QueryService<ProductUsageVo, ProductUsa
super.delete(usage);
}
public ProductUsageVo findByCode(String code) {
Page<ProductUsageVo> page = findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1));
if (page.isEmpty()) {
return null;
}
return page.getContent().getFirst();
}
}

View File

@@ -1,17 +1,19 @@
package com.ecep.contract.service;
import java.util.List;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ProjectCostItemViewModel;
import com.ecep.contract.vo.ProjectCostItemVo;
import com.ecep.contract.vo.ProjectCostVo;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ProjectCostItemService extends QueryService<ProjectCostItemVo, ProjectCostItemViewModel> {
public List<ProjectCostItemVo> findByCost(ProjectCostVo cost) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'findByCost'");
return findAll(ParamUtils.builder().equals("cost", cost).build(), Pageable.unpaged()).getContent();
}
}

View File

@@ -1,5 +1,6 @@
package com.ecep.contract.service;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.data.domain.Pageable;
@@ -8,14 +9,19 @@ import org.springframework.stereotype.Service;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ProjectFundPlanViewModel;
import com.ecep.contract.vo.ProjectFundPlanVo;
import com.ecep.contract.vo.ProjectVo;
@Service
public class ProjectFundPlanService extends QueryService<ProjectFundPlanVo, ProjectFundPlanViewModel> {
public List<ProjectFundPlanVo> findAllByProject(ProjectVo project) {
return findAllByProject(project.getId());
}
public List<ProjectFundPlanVo> findAllByProject(Integer projectId) {
return findAll(ParamUtils.builder()
.equals("project", projectId)
.build(), Pageable.unpaged()).getContent();
.equals("project", projectId)
.build(), Pageable.unpaged()).getContent();
}
public ProjectFundPlanVo newInstanceByProject(Integer projectId) {
@@ -24,4 +30,16 @@ public class ProjectFundPlanService extends QueryService<ProjectFundPlanVo, Proj
return vo;
}
public ProjectFundPlanVo newInstanceByProject(ProjectVo project) {
ProjectFundPlanVo vo = new ProjectFundPlanVo();
vo.setProjectId(project.getId());
return vo;
}
@Override
public ProjectFundPlanViewModel createNewViewModel() {
ProjectFundPlanViewModel model = new ProjectFundPlanViewModel();
model.getUpdateDate().set(LocalDateTime.now());
return model;
}
}

View File

@@ -1,14 +1,18 @@
package com.ecep.contract.service;
import com.ecep.contract.vm.ProjectIndustryViewModel;
import com.ecep.contract.vo.ProjectIndustryVo;
import java.util.List;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ProjectIndustryViewModel;
import com.ecep.contract.vo.ProjectIndustryVo;
@Service
@CacheConfig(cacheNames = "project-industry")
@@ -25,15 +29,23 @@ public class ProjectIndustryService extends QueryService<ProjectIndustryVo, Proj
return super.findAll();
}
@Caching(evict = {@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'all'")})
@Caching(evict = { @CacheEvict(key = "#p0.id"), @CacheEvict(key = "'all'") })
@Override
public ProjectIndustryVo save(ProjectIndustryVo entity) {
return super.save(entity);
}
@Caching(evict = {@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'all'")})
@Caching(evict = { @CacheEvict(key = "#p0.id"), @CacheEvict(key = "'all'") })
@Override
public void delete(ProjectIndustryVo entity) {
super.delete(entity);
}
public ProjectIndustryVo findByCode(String code) {
Page<ProjectIndustryVo> page = findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1));
if (page.isEmpty()) {
return null;
}
return page.getContent().getFirst();
}
}

View File

@@ -3,6 +3,8 @@ package com.ecep.contract.service;
import java.io.File;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -16,7 +18,12 @@ import com.ecep.contract.SpringApp;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ProjectViewModel;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.DeliverySignMethodVo;
import com.ecep.contract.vo.ProductTypeVo;
import com.ecep.contract.vo.ProductUsageVo;
import com.ecep.contract.vo.ProjectIndustryVo;
import com.ecep.contract.vo.ProjectSaleTypeVo;
import com.ecep.contract.vo.ProjectTypeVo;
import com.ecep.contract.vo.ProjectVo;
@Service
@@ -43,7 +50,75 @@ public class ProjectService extends QueryService<ProjectVo, ProjectViewModel> {
}
public void applyCode(ProjectVo project, String code) {
throw new UnsupportedOperationException();
project.setCode(code);
String saleTypeCode = null;
String seqCode = null;
String extCode = null;
// 第二个字符是数字时,快速处理
if (Character.isDigit(code.charAt(1))) {
// 只有一个字母表示合同类型
saleTypeCode = String.valueOf(code.charAt(0));
seqCode = code.substring(1, 6);
extCode = code.substring(6);
} else {
// 使用正则找出 A-Z 1~4字母引导 合同类型
String regex = "^([A-Z]{1,4})(\\d{4,5})([A-Z]{0,5})";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(code);
if (matcher.find()) {
saleTypeCode = matcher.group(1);
seqCode = matcher.group(2);
extCode = matcher.group(3);
}
}
ProjectSaleTypeVo saleType = SpringApp.getBean(ProjectSaleTypeService.class).findByCode(saleTypeCode);
if (saleType != null) {
project.setSaleTypeId(saleType.getId());
}
if (seqCode != null) {
project.setCodeYear(Integer.parseInt(seqCode.substring(0, 2)));
project.setCodeSequenceNumber(Integer.parseInt(seqCode.substring(2)));
}
if (extCode != null) {
// 4个后缀编码
if (extCode.length() > 3) {
DeliverySignMethodVo signMethod = SpringApp.getBean(DeliverySignMethodService.class)
.findBySaleTypeAndCode(saleType,
String.valueOf(extCode.charAt(0)));
if (signMethod != null) {
project.setDeliverySignMethodId(signMethod.getId());
}
ProductTypeVo productType = SpringApp.getBean(ProductTypeService.class)
.findByCode(extCode.substring(1, 2));
if (productType != null) {
project.setProductTypeId(productType.getId());
}
ProjectTypeVo projectType = SpringApp.getBean(ProjectTypeService.class)
.findByCode(extCode.substring(2, 3));
if (projectType != null) {
project.setProjectTypeId(projectType.getId());
}
ProjectIndustryVo industry = SpringApp.getBean(ProjectIndustryService.class)
.findByCode(extCode.substring(3, 4));
if (industry != null) {
project.setIndustryId(industry.getId());
}
}
// 扩展至 5个后缀编码
if (extCode.length() > 4) {
ProductUsageVo productUsage = SpringApp.getBean(ProductUsageService.class)
.findByCode(extCode.substring(4, 5));
if (productUsage != null) {
project.setProductUsageId(productUsage.getId());
}
}
}
}
public ProjectVo newInstanceByContract(ContractVo contract) {

View File

@@ -21,4 +21,12 @@ public class ProjectTypeService extends QueryService<ProjectTypeVo, ProjectTypeV
return page.getContent().getFirst();
}
public ProjectTypeVo findByCode(String code) {
Page<ProjectTypeVo> page = findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1));
if (page.isEmpty()) {
return null;
}
return page.getContent().getFirst();
}
}

View File

@@ -258,6 +258,16 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
}
public StringConverter<T> getStringConverter() {
throw new UnsupportedOperationException("Not implemented");
return new StringConverter<>() {
@Override
public String toString(T object) {
return object.toString();
}
@Override
public T fromString(String string) {
return null;
}
};
}
}

View File

@@ -1,20 +1,20 @@
package com.ecep.contract.service;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.model.VendorGroupRequireFileType;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.VendorGroupRequireFileTypeViewModel;
import com.ecep.contract.vo.VendorGroupRequireFileTypeVo;
@Service
public class VendorGroupRequireFileTypeService
extends QueryService<VendorGroupRequireFileType, VendorGroupRequireFileTypeViewModel> {
extends QueryService<VendorGroupRequireFileTypeVo, VendorGroupRequireFileTypeViewModel> {
public List<VendorGroupRequireFileType> findByGroupId(Integer id) {
return findAll(Map.of("group", id), Pageable.unpaged()).getContent();
public List<VendorGroupRequireFileTypeVo> findByGroupId(Integer id) {
return findAll(ParamUtils.builder().equals("group", id).build(), Pageable.unpaged()).getContent();
}
}

View File

@@ -1,20 +1,22 @@
package com.ecep.contract.service;
import java.time.LocalDateTime;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.controlsfx.control.TaskProgressView;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.Desktop;
import com.ecep.contract.model.CloudYu;
import com.ecep.contract.model.Company;
import com.ecep.contract.task.ContractSyncTask;
import com.ecep.contract.task.CustomerSyncTask;
import com.ecep.contract.task.MonitoredTask;
import com.ecep.contract.task.VendorSyncTask;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.CloudYuInfoViewModel;
import com.ecep.contract.vo.CloudYuVo;
import com.ecep.contract.vo.CompanyVo;
import javafx.concurrent.Task;
@@ -50,9 +52,30 @@ public class YongYouU8Service extends QueryService<CloudYuVo, CloudYuInfoViewMod
}
public CloudYu getOrCreateCloudYu(Company company) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getOrCreateCloudYu'");
@Override
public CloudYuVo createNewEntity() {
CloudYuVo cloudYu = new CloudYuVo();
cloudYu.setLatestUpdate(LocalDateTime.now());
cloudYu.setActive(false);
cloudYu.setVersion(1);
return cloudYu;
}
public CloudYuVo getOrCreateCloudYu(CompanyVo company) {
CloudYuVo cloudYu = findByCompany(company);
if (cloudYu == null) {
cloudYu = createNewEntity();
cloudYu.setCompanyId(company.getId());
cloudYu.setActive(false);
cloudYu.setVersion(1);
save(cloudYu);
}
return cloudYu;
}
public CloudYuVo findByCompany(CompanyVo company) {
return findAll(ParamUtils.builder().equals("company", company.getId()).build(), Pageable.ofSize(1)).stream()
.findFirst().orElse(null);
}
}

View File

@@ -444,9 +444,9 @@ public class ContractVerifyComm {
boolean loseFile = false;
ContractFileService fileService = getContractFileService();
List<ContractFileVo> files = fileService.findAllByContract(contract);
List<VendorGroupRequireFileType> list = getVendorGroupRequireFileTypeService().findByGroupId(group.getId());
List<VendorGroupRequireFileTypeVo> list = getVendorGroupRequireFileTypeService().findByGroupId(group.getId());
if (list != null && !list.isEmpty()) {
for (VendorGroupRequireFileType item : list) {
for (VendorGroupRequireFileTypeVo item : list) {
ContractFileType fileType = item.getFileType();
if (fileType == null) {
continue;
@@ -469,17 +469,18 @@ public class ContractVerifyComm {
holder.debug("指定供应商, 跳过供应商比价");
} else {
boolean requireQuotation = group.isRequireQuotationSheetForBid();
List<ContractBidVendor> bidVendors = getContractBidVendorService().findByContract(contract);
List<ContractBidVendorVo> bidVendors = getContractBidVendorService().findByContract(contract);
if (bidVendors == null || bidVendors.isEmpty()) {
holder.error("未上报供应商比价");
} else {
for (ContractBidVendor bidVendor : bidVendors) {
ContractFileVo contractFile = fileService.findById(bidVendor.getQuotationSheet().getId());
for (ContractBidVendorVo bidVendor : bidVendors) {
ContractFileVo contractFile = fileService.findById(bidVendor.getQuotationSheetFileId());
if (contractFile == null) {
if (requireQuotation && bidVendor.getCompany().getId().equals(contract.getCompanyId())) {
if (requireQuotation && bidVendor.getCompanyId().equals(contract.getCompanyId())) {
holder.debug("供应商类型启用了允许选中供应商不必须要有报价表");
} else {
holder.error("供应商比价:" + bidVendor.getCompany().getName() + " 未上传/关联报价表");
CompanyVo company = getCompanyService().findById(bidVendor.getCompanyId());
holder.error("供应商比价:" + company.getName() + " 未上传/关联报价表");
loseFile = true;
}
} else {

View File

@@ -251,12 +251,13 @@ public class UITools {
public static <T extends IdentityEntity, TV extends IdentityViewModel<T>> AutoCompletionBinding<T> autoCompletion(
TextField textField, ObjectProperty<Integer> idProperty, QueryService<T, TV> queryService) {
Integer id = idProperty.get();
T entity = queryService.findById(id);
StringConverter<T> converter = queryService.getStringConverter();
if (id != null) {
T entity = queryService.findById(id);
// 先赋值
textField.textProperty().set(converter.toString(entity));
}
// 先赋值
textField.textProperty().set(converter.toString(entity));
// 监听 property 变化
idProperty.addListener((observable, oldValue, newValue) -> {
T newEntity = queryService.findById(newValue);

View File

@@ -5,6 +5,7 @@ import java.util.Objects;
import com.ecep.contract.vo.ContractBidVendorVo;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -13,8 +14,11 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
public class ContractBidVendorViewModel extends IdentityViewModel<ContractBidVendorVo> {
private SimpleIntegerProperty contractId = new SimpleIntegerProperty();
private SimpleIntegerProperty companyId = new SimpleIntegerProperty();
private SimpleIntegerProperty quotationSheetFileId = new SimpleIntegerProperty();
private SimpleObjectProperty<Integer> companyId = new SimpleObjectProperty<>();
/**
* 报价单文件ID, ContractFile
*/
private SimpleObjectProperty<Integer> quotationSheetFileId = new SimpleObjectProperty<>();
private SimpleStringProperty quotationSheetFileName = new SimpleStringProperty();
public static ContractBidVendorViewModel from(ContractBidVendorVo v) {

View File

@@ -6,6 +6,7 @@ import java.util.Objects;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractPayPlan;
import com.ecep.contract.vo.ContractPayPlanVo;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleFloatProperty;
@@ -16,11 +17,11 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class ContractPayPlanViewModel extends IdentityViewModel<ContractPayPlan> {
public class ContractPayPlanViewModel extends IdentityViewModel<ContractPayPlanVo> {
/**
* 关联的合同对象
* 关联的合同对象, Contract
*/
SimpleObjectProperty<Contract> contract = new SimpleObjectProperty<>();
SimpleObjectProperty<Integer> contract = new SimpleObjectProperty<>();
/**
* 关联的用友系统中的数据ID
*/
@@ -34,9 +35,9 @@ public class ContractPayPlanViewModel extends IdentityViewModel<ContractPayPlan>
SimpleObjectProperty<LocalDateTime> updateDate = new SimpleObjectProperty<>();
@Override
protected void updateFrom(ContractPayPlan v) {
protected void updateFrom(ContractPayPlanVo v) {
super.updateFrom(v);
getContract().set(v.getContract());
getContract().set(v.getContractId());
getRefId().set(v.getRefId());
getPayDate().set(v.getPayDate());
getPayRatio().set(v.getPayRatio());
@@ -46,10 +47,10 @@ public class ContractPayPlanViewModel extends IdentityViewModel<ContractPayPlan>
}
@Override
public boolean copyTo(ContractPayPlan v) {
public boolean copyTo(ContractPayPlanVo v) {
boolean modified = super.copyTo(v);
if (!Objects.equals(contract.get(), v.getContract())) {
v.setContract(contract.get());
if (!Objects.equals(contract.get(), v.getContractId())) {
v.setContractId(contract.get());
modified = true;
}
if (!Objects.equals(refId.get(), v.getRefId())) {

View File

@@ -6,6 +6,7 @@ import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.CurrentEmployeeInitialedEvent;
import com.ecep.contract.model.EmployeeRole;
import com.ecep.contract.service.EmployeeService;
import com.ecep.contract.vo.EmployeeRoleVo;
import com.ecep.contract.vo.EmployeeVo;
import javafx.application.Platform;
import javafx.beans.property.SimpleListProperty;
@@ -40,7 +41,7 @@ public class CurrentEmployee extends EmployeeViewModel {
/**
* 角色
*/
private SimpleListProperty<EmployeeRole> roles = new SimpleListProperty<>(FXCollections.observableArrayList());
private SimpleListProperty<EmployeeRoleVo> roles = new SimpleListProperty<>(FXCollections.observableArrayList());
private DateTimeFormatter dateFormatter = DateTimeFormatter
.ofPattern(MyDateTimeUtils.DEFAULT_DATE_FORMAT_PATTERN);
@@ -61,7 +62,7 @@ public class CurrentEmployee extends EmployeeViewModel {
* 是否系统管理员
*/
public boolean isSystemAdministrator() {
return roles.stream().anyMatch(EmployeeRole::isSystemAdministrator);
return roles.stream().anyMatch(EmployeeRoleVo::isSystemAdministrator);
}
/**
@@ -74,7 +75,7 @@ public class CurrentEmployee extends EmployeeViewModel {
/**
* 角色属性
*/
public SimpleListProperty<EmployeeRole> rolesProperty() {
public SimpleListProperty<EmployeeRoleVo> rolesProperty() {
return roles;
}
@@ -141,7 +142,7 @@ public class CurrentEmployee extends EmployeeViewModel {
// issue #1 sss 2020-07-05
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
EmployeeVo employee = employeeService.findById(getId().get());
List<EmployeeRole> roles = employeeService.getRolesByEmployeeId(getId().get());
List<EmployeeRoleVo> roles = employeeService.getRolesByEmployeeId(getId().get());
Platform.runLater(() -> {
update(employee);
rolesProperty().setAll(roles);

View File

@@ -1,6 +1,6 @@
package com.ecep.contract.vm;
import com.ecep.contract.model.CustomerCatalog;
import com.ecep.contract.vo.CustomerCatalogVo;
import javafx.beans.property.SimpleStringProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -9,13 +9,24 @@ import java.util.Objects;
@Data
@EqualsAndHashCode(callSuper = false)
public class CustomerCatalogViewModel extends IdentityViewModel<CustomerCatalog> {
public class CustomerCatalogViewModel extends IdentityViewModel<CustomerCatalogVo> {
private SimpleStringProperty code = new SimpleStringProperty();
private SimpleStringProperty name = new SimpleStringProperty();
private SimpleStringProperty description = new SimpleStringProperty();
/**
* 创建CustomerCatalogViewModel实例
* @param v CustomerCatalogVo对象
* @return CustomerCatalogViewModel实例
*/
public static CustomerCatalogViewModel from(CustomerCatalogVo v) {
CustomerCatalogViewModel vm = new CustomerCatalogViewModel();
vm.update(v);
return vm;
}
@Override
protected void updateFrom(CustomerCatalog v) {
protected void updateFrom(CustomerCatalogVo v) {
super.updateFrom(v);
code.set(v.getCode());
name.set(v.getName());
@@ -23,7 +34,7 @@ public class CustomerCatalogViewModel extends IdentityViewModel<CustomerCatalog>
}
@Override
public boolean copyTo(CustomerCatalog v) {
public boolean copyTo(CustomerCatalogVo v) {
boolean ret = super.copyTo(v);
if (!Objects.equals(code.get(), v.getCode())) {
v.setCode(code.get());

View File

@@ -3,7 +3,6 @@ package com.ecep.contract.vm;
import java.time.LocalDate;
import java.util.Objects;
import com.ecep.contract.model.Company;
import com.ecep.contract.vo.InvoiceVo;
import javafx.beans.property.SimpleIntegerProperty;

View File

@@ -2,8 +2,7 @@ package com.ecep.contract.vm;
import java.util.Objects;
import com.ecep.contract.model.Function;
import com.ecep.contract.model.Permission;
import com.ecep.contract.vo.PermissionVo;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
@@ -12,34 +11,34 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class PermissionViewModel extends IdentityViewModel<Permission> {
public class PermissionViewModel extends IdentityViewModel<PermissionVo> {
private SimpleStringProperty name = new SimpleStringProperty();
private SimpleObjectProperty<Function> function = new SimpleObjectProperty<>();
private SimpleStringProperty key = new SimpleStringProperty();
private SimpleObjectProperty<Integer> function = new SimpleObjectProperty<>();
public static PermissionViewModel from(Permission v) {
public static PermissionViewModel from(PermissionVo v) {
PermissionViewModel model = new PermissionViewModel();
model.update(v);
return model;
}
@Override
protected void updateFrom(Permission v) {
protected void updateFrom(PermissionVo v) {
super.updateFrom(v);
getName().set(v.getName());
getFunction().set(v.getFunction());
getFunction().set(v.getFunctionId());
getKey().set(v.getKey());
}
@Override
public boolean copyTo(Permission v) {
public boolean copyTo(PermissionVo v) {
boolean modified = super.copyTo(v);
if (!Objects.equals(name.get(), v.getName())) {
v.setName(name.get());
modified = true;
}
if (!Objects.equals(function.get(), v.getFunction())) {
v.setFunction(function.get());
if (!Objects.equals(function.get(), v.getFunctionId())) {
v.setFunctionId(function.get());
modified = true;
}
if (!Objects.equals(key.get(), v.getKey())) {

View File

@@ -3,41 +3,57 @@ package com.ecep.contract.vm;
import java.util.Objects;
import com.ecep.contract.ContractFileType;
import com.ecep.contract.model.VendorGroup;
import com.ecep.contract.model.VendorGroupRequireFileType;
import com.ecep.contract.vo.VendorGroupRequireFileTypeVo;
import javafx.beans.property.SimpleObjectProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* 供应商组要求的文件类型视图模型
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class VendorGroupRequireFileTypeViewModel extends IdentityViewModel<VendorGroupRequireFileType> {
private SimpleObjectProperty<VendorGroup> group = new SimpleObjectProperty<>();
public class VendorGroupRequireFileTypeViewModel extends IdentityViewModel<VendorGroupRequireFileTypeVo> {
private SimpleObjectProperty<Integer> groupId = new SimpleObjectProperty<>();
private SimpleObjectProperty<ContractFileType> fileType = new SimpleObjectProperty<>();
private SimpleObjectProperty<ContractFileType.Frequency> frequency = new SimpleObjectProperty<>();
@Override
protected void updateFrom(VendorGroupRequireFileType v) {
super.updateFrom(v);
getGroup().set(v.getGroup());
getFileType().set(v.getFileType());
/**
* 创建VendorGroupRequireFileTypeViewModel实例
*
* @param v VendorGroupRequireFileTypeVo对象
* @return VendorGroupRequireFileTypeViewModel实例
*/
public static VendorGroupRequireFileTypeViewModel from(VendorGroupRequireFileTypeVo v) {
VendorGroupRequireFileTypeViewModel vm = new VendorGroupRequireFileTypeViewModel();
vm.update(v);
return vm;
}
@Override
public boolean copyTo(VendorGroupRequireFileType v) {
protected void updateFrom(VendorGroupRequireFileTypeVo v) {
super.updateFrom(v);
getGroupId().set(v.getGroupId());
getFileType().set(v.getFileType());
getFrequency().set(v.getFrequency());
}
@Override
public boolean copyTo(VendorGroupRequireFileTypeVo v) {
boolean modified = super.copyTo(v);
if (!Objects.equals(getGroup().get(), v.getGroup())) {
v.setGroup(getGroup().get());
if (!Objects.equals(getGroupId().get(), v.getGroupId())) {
v.setGroupId(getGroupId().get());
modified = true;
}
if (!Objects.equals(getFileType().get(), v.getFileType())) {
v.setFileType(getFileType().get());
modified = true;
}
if (!Objects.equals(getFrequency().get(), v.getFrequency())) {
v.setFrequency(getFrequency().get());
modified = true;
}
return modified;
}
}

View File

@@ -44,7 +44,7 @@ public class Company implements IdentityEntity, NamedEntity, BasedEntity, Serial
* 统一社会信用代码
* <p>
* 编码结构
*
*
* <pre>
* 1 | 1 | 6 | 9 | 1 < br > 登记管理部门代码 | 机构类别代码 | 登记管理机关行政区划码 | 主体标识码 | 校验码
* </pre>
@@ -205,7 +205,7 @@ public class Company implements IdentityEntity, NamedEntity, BasedEntity, Serial
vo.setName(name);
vo.setUniscid(getUniscid());
vo.setShortName(getShortName());
vo.setPathExist(getPathExist());
vo.setPathExist(getPathExist() != null && getPathExist());
vo.setPath(getPath());
vo.setCreated(getCreated());
vo.setEntStatus(getEntStatus());

View File

@@ -10,8 +10,14 @@ import lombok.Data;
@Data
public class ContractPayPlanVo implements IdentityEntity, ContractBasedVo {
private Integer id;
/**
* 关联的合同对象, Contract
*/
private Integer contractId;
private Integer refId;
private float payRatio;
private Double payCurrency;
private LocalDate payDate;
private LocalDateTime updateDate;

View File

@@ -13,7 +13,6 @@ public class DeliverySignMethodVo implements IdentityEntity, NamedEntity {
private String name;
private String code;
private Integer saleTypeId;
private String saleTypeName;
private String description;
private boolean active = false;
private LocalDate created;

View File

@@ -8,7 +8,7 @@ public class PermissionVo implements IdentityEntity {
private Integer id;
private Integer functionId;
private String name;
private String code;
private String key;
private String description;
private Boolean active;
}

View File

@@ -0,0 +1,14 @@
package com.ecep.contract.vo;
import com.ecep.contract.ContractFileType;
import com.ecep.contract.model.IdentityEntity;
import lombok.Data;
@Data
public class VendorGroupRequireFileTypeVo implements IdentityEntity {
private Integer id;
private Integer groupId;
private ContractFileType fileType;
private ContractFileType.Frequency frequency;
}

View File

@@ -280,4 +280,5 @@ ProjectQuotation: ProjectQuotationVo (已创建)
CompanyBankAccount: CompanyBankAccountVo (已检查)
ExtendVendorInfo: ExtendVendorInfoVo (已创建)
ProjectCost: ProjectCostVo (已更新)
VendorGroup: VendorGroupVo (已创建)
VendorGroup: VendorGroupVo (已创建)
VendorGroupRequireFileType: VendorGroupRequireFileTypeVo (已创建)

View File

@@ -1,6 +1,7 @@
package com.ecep.contract.cloud;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
@@ -57,7 +58,7 @@ public class CloudInfo {
* 本地更新时间戳,控制更新频率和重复更新
*/
@Column(name = "LATEST_UPDATE")
private Instant latestUpdate;
private LocalDateTime latestUpdate;
/**
* 关联的公司

View File

@@ -2,6 +2,7 @@ package com.ecep.contract.cloud.u8;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
@@ -110,7 +111,7 @@ public class CustomerSyncTask extends AbstContractRepairTasker {
return;
}
cloudYu.setCustomerUpdateDate(LocalDate.now());
cloudYu.setCloudLatest(Instant.now());
cloudYu.setCloudLatest(LocalDateTime.now());
cloudYu.setExceptionMessage("");
yongYouU8Service.save(cloudYu);

View File

@@ -2,6 +2,7 @@ package com.ecep.contract.cloud.u8;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
@@ -124,7 +125,7 @@ public class VendorSyncTask extends AbstContractRepairTasker {
return;
}
cloudYu.setVendorUpdateDate(LocalDate.now());
cloudYu.setCloudLatest(Instant.now());
cloudYu.setCloudLatest(LocalDateTime.now());
cloudYu.setExceptionMessage("");
yongYouU8Service.save(cloudYu);
}

View File

@@ -121,7 +121,7 @@ public class CompanyCompositeUpdateTasker extends Tasker<Object> {
yongYouU8Service.initialize(contractCtx);
contractCtx.syncContract(company, holder);
cloudYu.setCloudLatest(Instant.now());
cloudYu.setCloudLatest(LocalDateTime.now());
cloudYu.setExceptionMessage("");
} catch (Exception e) {
String message = e.getMessage();
@@ -132,7 +132,7 @@ public class CompanyCompositeUpdateTasker extends Tasker<Object> {
}
cloudYu.setExceptionMessage(message);
} finally {
cloudYu.setLatestUpdate(Instant.now());
cloudYu.setLatestUpdate(LocalDateTime.now());
yongYouU8Service.save(cloudYu);
}
}

View File

@@ -2,6 +2,7 @@ package com.ecep.contract.ds.contract.tasker;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.springframework.beans.BeansException;
@@ -58,12 +59,12 @@ public class ContractRepairByCompanyTask extends AbstContractRepairTasker {
repaired = true;
}
cloudYu.setCloudLatest(Instant.now());
cloudYu.setCloudLatest(LocalDateTime.now());
cloudYu.setExceptionMessage("");
} catch (Exception e) {
cloudYu.setExceptionMessage(e.getMessage());
} finally {
cloudYu.setLatestUpdate(Instant.now());
cloudYu.setLatestUpdate(LocalDateTime.now());
yongYouU8Service.save(cloudYu);
}
}