This commit is contained in:
2025-10-11 09:21:14 +08:00
parent bda92193d4
commit 553feac0a4
93 changed files with 1736 additions and 676 deletions

View File

@@ -4,11 +4,13 @@ import com.ecep.contract.*;
import com.ecep.contract.controller.project.cost.ProjectCostImportItemsFromContractsTasker;
import com.ecep.contract.model.ContractFileTypeLocal;
import com.ecep.contract.service.*;
import com.ecep.contract.util.ContextUtils;
import com.ecep.contract.vo.*;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ObservableMap;
import javafx.util.converter.NumberStringConverter;
import lombok.Data;
import org.springframework.beans.BeansException;
import org.springframework.util.StringUtils;
import java.io.File;
@@ -20,173 +22,101 @@ import java.util.*;
import java.util.stream.Collectors;
@Data
public class ContractVerifyComm {
// Project
private ProjectService projectService;
private ProjectSaleTypeRequireFileTypeService saleTypeRequireFileTypeService;
private ProjectSaleTypeService saleTypeService;
private ProjectCostService projectCostService;
private ProjectQuotationService projectQuotationService;
private ProjectBidService projectBidService;
// Contract
private ContractService contractService;
private ContractFileService contractFileService;
private ContractFileTypeService contractFileTypeService;
private ContractBidVendorService contractBidVendorService;
public class ContractVerifyComm implements ContextUtils {
ContextUtils parent;
// Company
private CompanyService companyService;
private CompanyFileService companyFileService;
// Vendor
private VendorService vendorService;
private VendorGroupService vendorGroupService;
private VendorGroupRequireFileTypeService vendorGroupRequireFileTypeService;
private ExtendVendorInfoService extendVendorInfoService;
// Customer
private CompanyCustomerService companyCustomerService;
private CompanyCustomerFileService companyCustomerFileService;
private CompanyExtendInfoService companyExtendInfoService;
// Employee
private EmployeeService employeeService;
public ContractVerifyComm(ContextUtils parent) {
this.parent = parent;
}
@Override
public <T> T getBean(Class<T> requiredType) throws BeansException {
return parent.getBean(requiredType);
}
@Override
public <T> T getCachedBean(Class<T> requiredType) throws BeansException {
return parent.getCachedBean(requiredType);
}
private ProjectService getProjectService() {
if (projectService == null) {
projectService = SpringApp.getBean(ProjectService.class);
}
return projectService;
return getCachedBean(ProjectService.class);
}
private ProjectSaleTypeService getSaleTypeService() {
if (saleTypeService == null) {
saleTypeService = SpringApp.getBean(ProjectSaleTypeService.class);
}
return saleTypeService;
return getCachedBean(ProjectSaleTypeService.class);
}
ProjectCostService getProjectCostService() {
if (projectCostService == null) {
projectCostService = SpringApp.getBean(ProjectCostService.class);
}
return projectCostService;
private ProjectCostService getProjectCostService() {
return getCachedBean(ProjectCostService.class);
}
ProjectQuotationService getProjectQuotationService() {
if (projectQuotationService == null) {
projectQuotationService = SpringApp.getBean(ProjectQuotationService.class);
}
return projectQuotationService;
private ProjectQuotationService getProjectQuotationService() {
return getCachedBean(ProjectQuotationService.class);
}
ProjectBidService getProjectBidService() {
if (projectBidService == null) {
projectBidService = SpringApp.getBean(ProjectBidService.class);
}
return projectBidService;
private ProjectBidService getProjectBidService() {
return getCachedBean(ProjectBidService.class);
}
private ProjectSaleTypeRequireFileTypeService getSaleTypeRequireFileTypeService() {
if (saleTypeRequireFileTypeService == null) {
saleTypeRequireFileTypeService = SpringApp.getBean(ProjectSaleTypeRequireFileTypeService.class);
}
return saleTypeRequireFileTypeService;
return getCachedBean(ProjectSaleTypeRequireFileTypeService.class);
}
public ContractService getContractService() {
if (contractService == null) {
contractService = SpringApp.getBean(ContractService.class);
}
return contractService;
return getCachedBean(ContractService.class);
}
private ContractFileService getContractFileService() {
if (contractFileService == null) {
contractFileService = SpringApp.getBean(ContractFileService.class);
}
return contractFileService;
return getCachedBean(ContractFileService.class);
}
private ContractFileTypeService getContractFileTypeService() {
if (contractFileTypeService == null) {
contractFileTypeService = SpringApp.getBean(ContractFileTypeService.class);
}
return contractFileTypeService;
return getCachedBean(ContractFileTypeService.class);
}
private ContractBidVendorService getContractBidVendorService() {
if (contractBidVendorService == null) {
contractBidVendorService = SpringApp.getBean(ContractBidVendorService.class);
}
return contractBidVendorService;
return getCachedBean(ContractBidVendorService.class);
}
private CompanyService getCompanyService() {
if (companyService == null) {
companyService = SpringApp.getBean(CompanyService.class);
}
return companyService;
return getBean(CompanyService.class);
}
private CompanyFileService getCompanyFileService() {
if (companyFileService == null) {
companyFileService = SpringApp.getBean(CompanyFileService.class);
}
return companyFileService;
return getCachedBean(CompanyFileService.class);
}
private VendorGroupService getVendorGroupService() {
if (vendorGroupService == null) {
vendorGroupService = SpringApp.getBean(VendorGroupService.class);
}
return vendorGroupService;
return getCachedBean(VendorGroupService.class);
}
private VendorGroupRequireFileTypeService getVendorGroupRequireFileTypeService() {
if (vendorGroupRequireFileTypeService == null) {
vendorGroupRequireFileTypeService = SpringApp.getBean(VendorGroupRequireFileTypeService.class);
}
return vendorGroupRequireFileTypeService;
return getCachedBean(VendorGroupRequireFileTypeService.class);
}
private ExtendVendorInfoService getExtendVendorInfoService() {
if (extendVendorInfoService == null) {
extendVendorInfoService = SpringApp.getBean(ExtendVendorInfoService.class);
}
return extendVendorInfoService;
return getCachedBean(ExtendVendorInfoService.class);
}
private VendorService getVendorService() {
if (vendorService == null) {
vendorService = SpringApp.getBean(VendorService.class);
}
return vendorService;
return getCachedBean(VendorService.class);
}
private CompanyCustomerService getCompanyCustomerService() {
if (companyCustomerService == null) {
companyCustomerService = SpringApp.getBean(CompanyCustomerService.class);
}
return companyCustomerService;
private CustomerService getCompanyCustomerService() {
return getCachedBean(CustomerService.class);
}
private CompanyCustomerFileService getCompanyCustomerFileService() {
if (companyCustomerFileService == null) {
companyCustomerFileService = SpringApp.getBean(CompanyCustomerFileService.class);
}
return companyCustomerFileService;
return getCachedBean(CompanyCustomerFileService.class);
}
private CompanyExtendInfoService getCompanyExtendInfoService() {
if (companyExtendInfoService == null) {
companyExtendInfoService = SpringApp.getBean(CompanyExtendInfoService.class);
}
return companyExtendInfoService;
return getCachedBean(CompanyExtendInfoService.class);
}
private EmployeeService getEmployeeService() {
if (employeeService == null) {
employeeService = SpringApp.getBean(EmployeeService.class);
}
return employeeService;
return getCachedBean(EmployeeService.class);
}
/**
@@ -389,6 +319,7 @@ public class ContractVerifyComm {
}
}
if (verifyVendor.get()) {
getVendorService().verify(contract, holder);
}
@@ -581,7 +512,7 @@ public class ContractVerifyComm {
valid = false;
}
CompanyCustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
CustomerVo companyCustomer = getCompanyCustomerService().findByCompany(company);
if (companyCustomer == null) {
holder.warn("合同未关联客户");
valid = false;
@@ -602,7 +533,7 @@ public class ContractVerifyComm {
return valid;
}
private boolean verifyCustomerFileByContract(CompanyCustomerVo companyCustomer, ContractVo contract,
private boolean verifyCustomerFileByContract(CustomerVo companyCustomer, ContractVo contract,
MessageHolder holder) {
List<LocalDate> verifyDates = new ArrayList<>();
LocalDate minDate = LocalDate.of(2022, 1, 1);
@@ -655,14 +586,14 @@ public class ContractVerifyComm {
}
// 客户
List<CompanyCustomerFileVo> files = getCompanyCustomerFileService().findAllByCustomer(companyCustomer);
List<CustomerFileVo> files = getCompanyCustomerFileService().findAllByCustomer(companyCustomer);
if (files == null || files.isEmpty()) {
holder.warn("未见客户评估表");
return false;
}
for (LocalDate verifyDate : verifyDates) {
CompanyCustomerFileVo customerFile = files.stream()
CustomerFileVo customerFile = files.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(),
@@ -673,10 +604,10 @@ public class ContractVerifyComm {
}
}
CompanyCustomerFileVo latestFile = files.stream()
CustomerFileVo latestFile = files.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
.max(Comparator.comparing(CompanyCustomerFileVo::getSignDate))
.max(Comparator.comparing(CustomerFileVo::getSignDate))
.orElse(null);
if (latestFile == null) {