Compare commits

..

4 Commits

Author SHA1 Message Date
866e08224a refactor(vo): 重构VO类及相关模型,添加Voable接口实现
feat(constant): 添加WebSocket错误码常量
docs(model): 为模型类添加注释
fix(service): 修复ProductUsageService缓存键问题
refactor(converter): 重构字符串转换器,移除EntityStringConverter依赖
feat(tab): 添加ComboBoxUtils工具类,优化下拉框初始化
style: 移除无用导入和字段
2025-09-22 23:11:21 +08:00
8aac509e51 feat(vendor): 添加VendorTypeService基础类结构 2025-09-22 23:10:45 +08:00
35a15f4702 refactor(contract): 重构客户文件类型相关代码,统一命名和继承结构
- 将 CompanyCustomerFileType 重命名为 CustomerFileType
- 统一相关 VO 和 model 的继承结构,使用 BaseEnumEntity
- 更新所有引用点,保持代码一致性
- 优化表格单元格显示逻辑,使用专用单元格工厂
2025-09-22 17:25:24 +08:00
3c3003fdf3 feat(contract): 添加供应商和客户文件类型相关类
添加VendorFileTypeLocalVo、CustomerFileType枚举和CustomerFileTypeLocalVo类,用于处理文件类型分类和本地化展示
2025-09-22 17:25:03 +08:00
112 changed files with 1221 additions and 427 deletions

View File

@@ -1,24 +1,5 @@
package com.ecep.contract;
import com.ecep.contract.constant.WebSocketConstant;
import com.ecep.contract.msg.SimpleMessage;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import lombok.Getter;
import lombok.Setter;
import okhttp3.*;
import okio.ByteString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -28,6 +9,32 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ecep.contract.constant.WebSocketConstant;
import com.ecep.contract.controller.OkHttpLoginController;
import com.ecep.contract.msg.SimpleMessage;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import lombok.Getter;
import lombok.Setter;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import okio.ByteString;
/**
* WebSocket消息服务
* 提供向服务器端发送WebSocket消息的功能
@@ -90,7 +97,10 @@ public class WebSocketClientService {
} else {
logger.error("未找到对应的回调future: {}", messageId);
}
} else if (node.has(WebSocketConstant.SESSION_ID_FIELD_NAME)) {
return;
}
if (node.has(WebSocketConstant.SESSION_ID_FIELD_NAME)) {
String sessionId = node.get(WebSocketConstant.SESSION_ID_FIELD_NAME).asText();
WebSocketClientSession session = sessions.get(sessionId);
if (session != null) {
@@ -100,18 +110,26 @@ public class WebSocketClientService {
session.updateMessage(java.util.logging.Level.SEVERE, "会话异常: " + e.getMessage());
}
}
} else if (node.has(WebSocketConstant.ERROR_CODE_FIELD_NAME)) {
return;
}
if (node.has(WebSocketConstant.ERROR_CODE_FIELD_NAME)) {
int errorCode = node.get(WebSocketConstant.ERROR_CODE_FIELD_NAME).asInt();
String errorMsg = node.get(WebSocketConstant.MESSAGE_FIELD_NAME).asText();
// TODO 需要重新登录
logger.error("收到错误消息: 错误码={}, 错误信息={}", errorCode, errorMsg);
if (errorCode == WebSocketConstant.ERROR_CODE_UNAUTHORIZED) {
// 处理未授权错误,重新登录
OkHttpLoginController controller = new OkHttpLoginController();
controller.tryLogin();
// 需要把窗口顶置
}
return;
}
} catch (Exception e) {
logger.error("处理WebSocket消息失败: {}", e.getMessage(), e);
}
}
@Override
public void onMessage(WebSocket webSocket, ByteString bytes) {
// 处理收到的二进制消息
@@ -149,7 +167,8 @@ public class WebSocketClientService {
if (node.has(WebSocketConstant.SUCCESS_FIELD_VALUE)) {
if (!node.get(WebSocketConstant.SUCCESS_FIELD_VALUE).asBoolean()) {
future.completeExceptionally(
new RuntimeException("请求失败:来自服务器的消息=" + node.get(WebSocketConstant.MESSAGE_FIELD_NAME).asText()));
new RuntimeException(
"请求失败:来自服务器的消息=" + node.get(WebSocketConstant.MESSAGE_FIELD_NAME).asText()));
return;
}
}

View File

@@ -116,7 +116,7 @@ public class ComboBoxUtils {
}
}
public static <T extends IdentityEntity & NamedEntity> void initialComboBox(
public static <T extends IdentityEntity> void initialComboBox(
ComboBox<T> comboBox, Property<Integer> property, IEntityService<T> queryService, boolean hasNull) {
ObservableList<T> list = FXCollections.observableArrayList();
if (hasNull) {

View File

@@ -26,7 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp;
import com.ecep.contract.vo.CloudTycVo;
@@ -127,7 +127,7 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Tasker<Object> {
CompanyCustomerFileVo customerFile = new CompanyCustomerFileVo();
customerFile.setCustomer(customer.getId());
customerFile.setFilePath(destFile.getAbsolutePath());
customerFile.setType(CompanyCustomerFileType.General);
customerFile.setType(CustomerFileType.General);
save(customerFile);
} catch (Exception e) {
holder.error(e.getMessage());
@@ -192,7 +192,7 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Tasker<Object> {
// 检索评估表
List<CompanyCustomerFileVo> customerFiles = getCompanyCustomerFileService().findAllByCustomerAndType(customer,
CompanyCustomerFileType.EvaluationForm);
CustomerFileType.EvaluationForm);
List<CompanyCustomerEvaluationFormFileVo> filteredList = customerFiles.stream().filter(file -> {
return file.getSignDate() != null && file.isValid();

View File

@@ -9,7 +9,7 @@ import java.util.function.Consumer;
import org.springframework.util.StringUtils;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.DesktopUtils;
import com.ecep.contract.Message;
import com.ecep.contract.MyDateTimeUtils;
@@ -106,7 +106,7 @@ public class CustomerTabSkinFile
table.disableProperty().bind(viewModel.getPath().isEmpty());
fileTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
CompanyCustomerFileTypeService fileTypeService = getCachedBean(CompanyCustomerFileTypeService.class);
ObservableMap<CompanyCustomerFileType, CompanyCustomerFileTypeLocal> observableMapByLocal = FXCollections
ObservableMap<CustomerFileType, CompanyCustomerFileTypeLocal> observableMapByLocal = FXCollections
.observableMap(fileTypeService.findAll(getLocale()));
fileTable_typeColumn.setCellValueFactory(param -> Bindings.valueAt(observableMapByLocal,
param.getValue().getType()).map(BaseEnumEntity::getValue));
@@ -156,8 +156,8 @@ public class CustomerTabSkinFile
@Override
protected void onTableRowDoubleClickedAction(CompanyCustomerFileViewModel item) {
CompanyCustomerFileType fileType = item.getType().get();
if (fileType == CompanyCustomerFileType.EvaluationForm) {
CustomerFileType fileType = item.getType().get();
if (fileType == CustomerFileType.EvaluationForm) {
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCachedBean(
CompanyCustomerEvaluationFormFileService.class).findByCustomerFile(item.getId().get());
// 文件不是 Excel 文件时打开编辑UI
@@ -201,7 +201,7 @@ public class CustomerTabSkinFile
if (file.renameTo(dest)) {
CompanyCustomerFileVo ccf = new CompanyCustomerFileVo();
ccf.setCustomer(companyCustomer.getId());
ccf.setType(CompanyCustomerFileType.EvaluationForm);
ccf.setType(CustomerFileType.EvaluationForm);
ccf.setFilePath(dest.getAbsolutePath());
ccf.setSignDate(nextSignDate);
ccf.setValid(false);
@@ -228,7 +228,7 @@ public class CustomerTabSkinFile
if (file.renameTo(dest)) {
CompanyCustomerFileVo ccf = new CompanyCustomerFileVo();
ccf.setCustomer(companyCustomer.getId());
ccf.setType(CompanyCustomerFileType.General);
ccf.setType(CustomerFileType.General);
ccf.setFilePath(dest.getAbsolutePath());
ccf.setValid(false);
getCompanyCustomerFileService().save(ccf);

View File

@@ -1,6 +1,6 @@
package com.ecep.contract.controller.project.bid;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.ContractFileType;
import com.ecep.contract.DesktopUtils;
import com.ecep.contract.MyDateTimeUtils;
@@ -10,10 +10,7 @@ import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.controller.tab.TabSkin;
import com.ecep.contract.converter.CompanyStringConverter;
import com.ecep.contract.converter.EmployeeStringConverter;
import com.ecep.contract.converter.EntityStringConverter;
import com.ecep.contract.service.*;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.util.ProxyUtils;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.ProjectBidViewModel;
import com.ecep.contract.vo.*;
@@ -28,10 +25,8 @@ import javafx.util.converter.LocalDateStringConverter;
import javafx.util.converter.LocalDateTimeStringConverter;
import javafx.util.converter.NumberStringConverter;
import lombok.Setter;
import org.springframework.data.domain.Pageable;
import java.io.File;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -281,7 +276,7 @@ public class ProjectBidTabSkinBase
// 获取客户资信评估表
List<CompanyCustomerFileVo> list = fileService.findAllByCustomerAndType(customer,
CompanyCustomerFileType.EvaluationForm);
CustomerFileType.EvaluationForm);
if (list.isEmpty()) {
// 没有评估表
return;
@@ -292,7 +287,7 @@ public class ProjectBidTabSkinBase
LocalDate verifyDate = applyTime.toLocalDate();
CompanyCustomerFileVo file = list.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
7))
.findFirst().orElse(null);

View File

@@ -10,7 +10,7 @@ import java.util.stream.Collectors;
import org.springframework.util.StringUtils;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.controller.tab.TabSkin;
@@ -235,7 +235,7 @@ public class CustomerSatisfactionSurveyTabSkinBase
CompanyCustomerFileService companyCustomerFileService = getBean(CompanyCustomerFileService.class);
List<CompanyCustomerFileVo> list = companyCustomerFileService.findAllByCustomerAndType(customer,
CompanyCustomerFileType.EvaluationForm);
CustomerFileType.EvaluationForm);
if (list.isEmpty()) {
return;
}
@@ -244,7 +244,7 @@ public class CustomerSatisfactionSurveyTabSkinBase
LocalDate verifyDate = applyTime.toLocalDate();
CompanyCustomerFileVo file = list.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(), v.getSignDate().plusYears(1),
7))
.findFirst().orElse(null);

View File

@@ -6,6 +6,7 @@ import java.time.LocalDateTime;
import java.util.NoSuchElementException;
import java.util.concurrent.CompletableFuture;
import com.ecep.contract.controller.ComboBoxUtils;
import org.springframework.util.StringUtils;
import com.ecep.contract.DesktopUtils;
@@ -123,11 +124,7 @@ public class CompanyTabSkinContract
contractSearchBtn.setOnAction(this::onTableRefreshAction);
ObservableList<ContractGroupVo> contractGroups = FXCollections.observableArrayList();
contractGroups.add(null);
contractGroups.addAll(getContractGroupService().findAll());
contractGroupSelector.setItems(contractGroups);
contractGroupSelector.setConverter(new ContractGroupStringConverter(contractGroups));
ComboBoxUtils.initialComboBox(contractGroupSelector, null, getContractGroupService(), true);
contractSearchKeyField.setOnKeyReleased(event -> {
if (event.getCode() == KeyCode.ENTER) {
contractSearchBtn.fire();

View File

@@ -8,6 +8,7 @@ import java.util.function.Consumer;
import com.ecep.contract.service.CompanyFileTypeService;
import com.ecep.contract.service.ContractFileTypeService;
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
import com.ecep.contract.vo.CompanyFileVo;
import com.ecep.contract.vo.CompanyVo;
import org.springframework.util.FileSystemUtils;
@@ -64,7 +65,7 @@ public class CompanyTabSkinFile
public MenuItem fileTable_menu_del;
public MenuItem fileTable_menu_copy_as_matched_by_contract;
private final ObservableMap<CompanyFileType, CompanyFileTypeLocal> fileTypeLocalMap = FXCollections
private final ObservableMap<CompanyFileType, CompanyFileTypeLocalVo> fileTypeLocalMap = FXCollections
.observableHashMap();
public CompanyTabSkinFile(CompanyWindowController controller) {
@@ -96,7 +97,7 @@ public class CompanyTabSkinFile
idColumn.setCellValueFactory(param -> param.getValue().getId());
typeColumn.setCellValueFactory(param -> Bindings.valueAt(fileTypeLocalMap, param.getValue().getType())
.map(CompanyFileTypeLocal::getValue));
.map(CompanyFileTypeLocalVo::getValue));
filePathColumn.setCellValueFactory(param -> param.getValue().getFilePath());
filePathColumn.setCellFactory(param -> new CompanyFilePathTableCell<>(viewModel.getPath()));
applyDateColumn.setCellValueFactory(param -> param.getValue().getApplyDate());

View File

@@ -203,9 +203,13 @@ public class ContractTabSkinBase extends AbstContractBasedTabSkin {
}
private void parentCodeFieldAutoCompletion(TextField textField) {
ContractStringConverter converter = SpringApp.getBean(ContractStringConverter.class);
converter.setFormater(ContractVo::getCode);
TextFields.bindAutoCompletion(textField, converter::suggest, converter);
ContractService contractService = getContractService();
TextFields.bindAutoCompletion(textField, suggest -> contractService.search(suggest.getUserText()), new ContractStringConverter(contractService) {
@Override
public String toString(ContractVo object) {
return object.getCode();
}
});
}
private void calcMainContractNoAction(ActionEvent event) {

View File

@@ -3,8 +3,6 @@ package com.ecep.contract.controller.table.cell;
import java.util.Objects;
import java.util.concurrent.Future;
import com.ecep.contract.service.QueryService;
import com.ecep.contract.util.ProxyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -13,6 +11,7 @@ import com.ecep.contract.model.BasedEntity;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.model.NamedEntity;
import com.ecep.contract.service.IEntityService;
import com.ecep.contract.util.ProxyUtils;
import javafx.application.Platform;
@@ -22,7 +21,7 @@ import javafx.application.Platform;
* @param <V>
* @param <T>
*/
public class AsyncUpdateTableCell<V, T extends IdentityEntity> extends javafx.scene.control.TableCell<V, Integer> {
public class AsyncUpdateTableCell<V, K, T extends IdentityEntity> extends javafx.scene.control.TableCell<V, K> {
private static final Logger logger = LoggerFactory.getLogger(AsyncUpdateTableCell.class);
/**
@@ -66,7 +65,7 @@ public class AsyncUpdateTableCell<V, T extends IdentityEntity> extends javafx.sc
}
@Override
protected void updateItem(Integer itemId, boolean empty) {
protected void updateItem(K itemId, boolean empty) {
super.updateItem(itemId, empty);
// 取消之前的异步任务
if (syncFuture != null) {
@@ -103,7 +102,11 @@ public class AsyncUpdateTableCell<V, T extends IdentityEntity> extends javafx.sc
* @return
*/
protected T initialize() {
return getService().findById(getItem());
K k = getItem();
if (k instanceof Integer id) {
return getService().findById(id);
}
throw new UnsupportedOperationException("Not supported yet.");
}
/**
@@ -143,7 +146,7 @@ public class AsyncUpdateTableCell<V, T extends IdentityEntity> extends javafx.sc
// 保存当前需要更新的项目信息,避免闭包引用导致的问题
final T updatedEntity = entity;
final String updatedText = texted;
final Integer finalCurrentLoadingItem = getItem();
final K finalCurrentLoadingItem = getItem();
Platform.runLater(() -> {
// 检查单元格是否仍然显示相同的项目

View File

@@ -7,7 +7,7 @@ import com.ecep.contract.vo.BankVo;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class BankTableCell<T> extends AsyncUpdateTableCell<T, BankVo> {
public class BankTableCell<T> extends AsyncUpdateTableCell<T, Integer, BankVo> {
public BankTableCell(BankService service) {
setService(service);
}

View File

@@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
* 公司单元格
*/
@NoArgsConstructor
public class CompanyTableCell<V> extends AsyncUpdateTableCell<V, CompanyVo> {
public class CompanyTableCell<V> extends AsyncUpdateTableCell<V, Integer, CompanyVo> {
/**
* 创建单元格工厂
*

View File

@@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
@NoArgsConstructor
public class CompanyVendorTableCell<T> extends AsyncUpdateTableCell<T, CompanyVendorVo> {
public class CompanyVendorTableCell<T> extends AsyncUpdateTableCell<T, Integer, CompanyVendorVo> {
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(SpringApp.getBean(CompanyVendorService.class));
}

View File

@@ -11,7 +11,7 @@ import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ContractFileTableCell<V> extends AsyncUpdateTableCell<V, ContractVo> {
public class ContractFileTableCell<V> extends AsyncUpdateTableCell<V, Integer, ContractVo> {
/**
* 创建一个ContractFileTableCell的TableCell工厂自动获取ContractService实例

View File

@@ -5,7 +5,7 @@ import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.service.ContractGroupService;
import com.ecep.contract.vo.ContractGroupVo;
public class ContractGroupTableCell<V> extends AsyncUpdateTableCell<V, ContractGroupVo> {
public class ContractGroupTableCell<V> extends AsyncUpdateTableCell<V, Integer, ContractGroupVo> {
public ContractGroupTableCell() {
}

View File

@@ -5,7 +5,7 @@ import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.service.ContractKindService;
import com.ecep.contract.vo.ContractKindVo;
public class ContractKindTableCell<V> extends AsyncUpdateTableCell<V, ContractKindVo> {
public class ContractKindTableCell<V> extends AsyncUpdateTableCell<V, Integer, ContractKindVo> {
public ContractKindTableCell() {
}

View File

@@ -7,7 +7,7 @@ import com.ecep.contract.vo.ContractVo;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ContractTableCell<T> extends AsyncUpdateTableCell<T, ContractVo> {
public class ContractTableCell<T> extends AsyncUpdateTableCell<T, Integer, ContractVo> {
public ContractTableCell(ContractService service) {
setService(service);
}

View File

@@ -7,7 +7,7 @@ import com.ecep.contract.vo.ContractTypeVo;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ContractTypeTableCell<V> extends AsyncUpdateTableCell<V, ContractTypeVo> {
public class ContractTypeTableCell<V> extends AsyncUpdateTableCell<V, Integer, ContractTypeVo> {
public ContractTypeTableCell(ContractTypeService contractService) {
setService(contractService);
}

View File

@@ -12,7 +12,7 @@ import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class CustomerCatalogTableCell<T> extends AsyncUpdateTableCell<T, CustomerCatalogVo> {
public class CustomerCatalogTableCell<T> extends AsyncUpdateTableCell<T, Integer, CustomerCatalogVo> {
public CustomerCatalogTableCell(CustomerCatalogService service) {
setService(service);
}

View File

@@ -7,7 +7,7 @@ import com.ecep.contract.vo.DepartmentVo;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class DepartmentTableCell<T> extends AsyncUpdateTableCell<T, DepartmentVo> {
public class DepartmentTableCell<T> extends AsyncUpdateTableCell<T, Integer, DepartmentVo> {
public DepartmentTableCell(DepartmentService service) {
setService(service);
}

View File

@@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
* @param <V>
*/
@NoArgsConstructor
public class EmployeeRoleTableCell<V> extends AsyncUpdateTableCell<V, EmployeeRoleVo> {
public class EmployeeRoleTableCell<V> extends AsyncUpdateTableCell<V, Integer, EmployeeRoleVo> {
public EmployeeRoleTableCell(EmployeeRoleService service) {
setService(service);

View File

@@ -11,7 +11,7 @@ import javafx.util.Callback;
import lombok.Setter;
@Setter
public class EmployeeTableCell<V> extends AsyncUpdateTableCell<V, EmployeeVo> {
public class EmployeeTableCell<V> extends AsyncUpdateTableCell<V, Integer, EmployeeVo> {
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(getBean(EmployeeService.class));

View File

@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
* 评估文件 TableCell
*/
@NoArgsConstructor
public class EvaluationFileTableCell<V> extends AsyncUpdateTableCell<V, CompanyCustomerEvaluationFormFileVo> {
public class EvaluationFileTableCell<V> extends AsyncUpdateTableCell<V, Integer, CompanyCustomerEvaluationFormFileVo> {
private CompanyCustomerFileService fileService;
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;

View File

@@ -8,7 +8,7 @@ import com.ecep.contract.vo.InventoryCatalogVo;
import lombok.Setter;
@Setter
public class InventoryCatalogTableCell<V> extends AsyncUpdateTableCell<V, InventoryCatalogVo> {
public class InventoryCatalogTableCell<V> extends AsyncUpdateTableCell<V, Integer, InventoryCatalogVo> {
public InventoryCatalogTableCell() {
}

View File

@@ -10,7 +10,7 @@ import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, InventoryVo> {
public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, Integer, InventoryVo> {
/**
* 创建单元格工厂
*

View File

@@ -10,7 +10,7 @@ import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class InvoiceTableCell<V> extends AsyncUpdateTableCell<V, InvoiceVo> {
public class InvoiceTableCell<V> extends AsyncUpdateTableCell<V, Integer, InvoiceVo> {
public InvoiceTableCell(InvoiceService invoiceService) {
setService(invoiceService);

View File

@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
* 产品类型单元格
*/
@NoArgsConstructor
public class ProductTypeTableCell<V> extends AsyncUpdateTableCell<V, ProductTypeVo> {
public class ProductTypeTableCell<V> extends AsyncUpdateTableCell<V, Integer, ProductTypeVo> {
public ProductTypeTableCell(ProductTypeService productTypeService) {
setService(productTypeService);

View File

@@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
* 项目销售类型单元格
*/
@NoArgsConstructor
public class ProjectSaleTypeTableCell<V> extends AsyncUpdateTableCell<V, ProjectSaleTypeVo> {
public class ProjectSaleTypeTableCell<V> extends AsyncUpdateTableCell<V, Integer, ProjectSaleTypeVo> {
public ProjectSaleTypeTableCell(ProjectSaleTypeService projectSaleTypeService) {
setService(projectSaleTypeService);

View File

@@ -11,7 +11,7 @@ import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ProjectTableCell<V> extends AsyncUpdateTableCell<V, ProjectVo> {
public class ProjectTableCell<V> extends AsyncUpdateTableCell<V, Integer, ProjectVo> {
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(getBean(ProjectService.class));
}

View File

@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
* 项目类型单元格
*/
@NoArgsConstructor
public class ProjectTypeTableCell<V> extends AsyncUpdateTableCell<V, ProjectTypeVo> {
public class ProjectTypeTableCell<V> extends AsyncUpdateTableCell<V, Integer, ProjectTypeVo> {
public ProjectTypeTableCell(ProjectTypeService projectTypeService) {
setService(projectTypeService);

View File

@@ -11,7 +11,7 @@ import com.ecep.contract.vo.PurchaseOrderItemVo;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class PurchaseOrderItemTableCell<V> extends AsyncUpdateTableCell<V, PurchaseOrderItemVo> {
public class PurchaseOrderItemTableCell<V> extends AsyncUpdateTableCell<V, Integer, PurchaseOrderItemVo> {
PurchaseOrdersService purchaseOrdersService;
PurchaseOrderItemService purchaseOrderItemService;
private InventoryService inventoryService;

View File

@@ -7,7 +7,7 @@ import com.ecep.contract.vo.UnitVo;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class UnitTableCell<T> extends AsyncUpdateTableCell<T, UnitVo> {
public class UnitTableCell<T> extends AsyncUpdateTableCell<T, Integer, UnitVo> {
public UnitTableCell(UnitService service) {
setService(service);
}

View File

@@ -11,7 +11,7 @@ import javafx.util.Callback;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class VendorCatalogTableCell<T> extends AsyncUpdateTableCell<T, VendorCatalogVo> {
public class VendorCatalogTableCell<T> extends AsyncUpdateTableCell<T, Integer, VendorCatalogVo> {
public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
return forTableColumn(SpringApp.getBean(VendorCatalogService.class));
}

View File

@@ -0,0 +1,48 @@
package com.ecep.contract.controller.table.cell;
import com.ecep.contract.SpringApp;
import com.ecep.contract.VendorType;
import com.ecep.contract.service.VendorTypeService;
import com.ecep.contract.vo.VendorTypeLocalVo;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
/**
* 供应商类型单元格,用于在表格中显示供应商类型信息
*/
public class VendorTypeTableCell<T> extends AsyncUpdateTableCell<T, VendorType, VendorTypeLocalVo> {
private VendorTypeService vendorTypeService;
/**
* 创建一个用于表格列的单元格工厂
*/
public static <T> Callback<TableColumn<T, VendorType>, TableCell<T, VendorType>> forTableColumn(
VendorTypeService service) {
return param -> new VendorTypeTableCell<>(service);
}
public VendorTypeTableCell() {
this.vendorTypeService = SpringApp.getBean(VendorTypeService.class);
}
public VendorTypeTableCell(VendorTypeService service) {
setService(service);
}
@Override
protected VendorTypeService getServiceBean() {
if (vendorTypeService == null) {
vendorTypeService = SpringApp.getBean(VendorTypeService.class);
}
return vendorTypeService;
}
@Override
protected VendorTypeLocalVo initialize() {
VendorType item = getItem();
return getServiceBean().findByType(item);
}
}

View File

@@ -1,16 +1,11 @@
package com.ecep.contract.controller.vendor;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.controller.AbstEntityManagerSkin;
import com.ecep.contract.controller.ComboBoxUtils;
import com.ecep.contract.controller.table.cell.CompanyTableCell;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.VendorCatalog;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.controller.table.cell.VendorCatalogTableCell;
import com.ecep.contract.controller.table.cell.VendorTypeTableCell;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CompanyVendorService;
import com.ecep.contract.service.VendorCatalogService;
@@ -18,11 +13,7 @@ import com.ecep.contract.service.VendorTypeService;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.CompanyVendorViewModel;
import com.ecep.contract.vo.CompanyVendorVo;
import com.ecep.contract.vo.VendorCatalogVo;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty;
import lombok.Setter;
public class CompanyVendorManagerSkin
@@ -63,41 +54,21 @@ public class CompanyVendorManagerSkin
@Override
public void initializeTable() {
List<VendorTypeLocal> vendorTypeLocals = getBean(VendorTypeService.class).findAll();
ComboBoxUtils.initialComboBox(controller.typeSelector, vendorTypeLocals, true);
controller.typeSelector.valueProperty().addListener((observable, oldValue, newValue) -> {
loadTableDataSet(true);
});
ComboBoxUtils.initialComboBox(controller.typeSelector, null, getBean(VendorTypeService.class), true);
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
controller.codeColumn.setCellValueFactory(param -> param.getValue().getCode());
controller.catalogColumn.setCellValueFactory(param -> Bindings.createStringBinding(() -> {
SimpleObjectProperty<Integer> catalog = param.getValue().getCatalog();
Integer catalogId = catalog.get();
if (catalogId == null) {
return "-";
}
VendorCatalogVo vendorCatalog = getBean(VendorCatalogService.class).findById(catalogId);
if (vendorCatalog == null) {
return "-";
} else {
return vendorCatalog.getName();
}
}, param.getValue().getCatalog()));
controller.catalogColumn.setCellValueFactory(param -> param.getValue().getCatalog());
controller.catalogColumn.setCellFactory(VendorCatalogTableCell.forTableColumn(getBean(VendorCatalogService.class)));
controller.typeColumn.setCellValueFactory(param -> param.getValue().getType().map(type -> {
VendorTypeLocal local = vendorTypeLocals.stream().filter(v -> v.getType() == type).findFirst().orElse(null);
if (local == null) {
return type.name();
} else {
return local.getValue();
}
}));
controller.typeColumn.setCellValueFactory(param -> param.getValue().getType());
controller.typeColumn.setCellFactory(VendorTypeTableCell.forTableColumn(getBean(VendorTypeService.class)));
controller.purchaseColumn.setCellValueFactory(param -> param.getValue().getPurchase());
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
controller.companyColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath());

View File

@@ -12,11 +12,10 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.VendorType;
import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.controller.vendor.approved_list.CompanyVendorApprovedListManagerWindowController;
import com.ecep.contract.controller.vendor.group.VendorGroupManagerWindowController;
import com.ecep.contract.model.CompanyVendor;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CompanyVendorService;
import com.ecep.contract.task.VendorVerifyAllTasker;
@@ -24,6 +23,7 @@ import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CompanyVendorViewModel;
import com.ecep.contract.vo.CompanyVendorVo;
import com.ecep.contract.vo.VendorTypeLocalVo;
import javafx.event.ActionEvent;
import javafx.scene.control.ComboBox;
@@ -41,14 +41,14 @@ public class CompanyVendorManagerWindowController
public TableColumn<CompanyVendorViewModel, Number> idColumn;
public TableColumn<CompanyVendorViewModel, Integer> companyColumn;
public TableColumn<CompanyVendorViewModel, String> codeColumn;
public TableColumn<CompanyVendorViewModel, String> catalogColumn;
public TableColumn<CompanyVendorViewModel, String> typeColumn;
public TableColumn<CompanyVendorViewModel, Integer> catalogColumn;
public TableColumn<CompanyVendorViewModel, VendorType> typeColumn;
public TableColumn<CompanyVendorViewModel, String> purchaseColumn;
public TableColumn<CompanyVendorViewModel, LocalDate> developDateColumn;
public TableColumn<CompanyVendorViewModel, String> pathColumn;
public TableColumn<CompanyVendorViewModel, String> createdColumn;
public ComboBox<VendorTypeLocal> typeSelector;
public ComboBox<VendorTypeLocalVo> typeSelector;
@Autowired
private CompanyService companyService;

View File

@@ -1,32 +1,24 @@
package com.ecep.contract.converter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import com.ecep.contract.service.BankService;
import com.ecep.contract.vo.BankVo;
import javafx.util.StringConverter;
import jakarta.annotation.PostConstruct;
public class BankStringConverter extends StringConverter<BankVo> {
@Lazy
@Component
@Deprecated
public class BankStringConverter extends EntityStringConverter<BankVo> {
@Lazy
@Autowired
BankService service;
public BankStringConverter() {
public BankStringConverter(BankService service) {
this.service = service;
}
@PostConstruct
private void init() {
// #2
setInitialized(project -> service.findById(project.getId()));
setSuggestion(service::search);
setFromString(service::findByName);
@Override
public String toString(BankVo object) {
return object == null ? "" : object.getCode() + " " + object.getName();
}
@Override
public BankVo fromString(String string) {
return service.findByName(string);
}
}

View File

@@ -2,19 +2,17 @@ package com.ecep.contract.converter;
import java.util.List;
import com.ecep.contract.service.ContractGroupService;
import javafx.util.StringConverter;
import org.springframework.util.StringUtils;
import com.ecep.contract.vo.ContractGroupVo;
public class ContractGroupStringConverter extends EntityStringConverter<ContractGroupVo> {
public class ContractGroupStringConverter extends StringConverter<ContractGroupVo> {
private ContractGroupService service;
private List<ContractGroupVo> dataset;
public ContractGroupStringConverter() {
}
public ContractGroupStringConverter(List<ContractGroupVo> dataset) {
this.dataset = dataset;
public ContractGroupStringConverter(ContractGroupService contractGroupService) {
this.service = contractGroupService;
}
@Override
@@ -22,32 +20,14 @@ public class ContractGroupStringConverter extends EntityStringConverter<Contract
if (group == null) {
return "All";
}
return group.getName();
return group.getCode() + " " + group.getName() + " " + group.getTitle();
}
@Override
public ContractGroupVo fromString(String string) {
if (dataset == null) {
return null;
}
if (!StringUtils.hasText(string)) {
return null;
}
for (ContractGroupVo group : dataset) {
if (group == null) {
continue;
}
if (toString(group).equals(string)) {
return group;
}
if (group.getCode().equals(string)) {
return group;
}
if (group.getName().contains(string)) {
return group;
}
}
return null;
return service.findByCode(string);
}
}

View File

@@ -1,5 +1,6 @@
package com.ecep.contract.converter;
import javafx.util.StringConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@@ -9,21 +10,20 @@ import com.ecep.contract.vo.ContractVo;
import jakarta.annotation.PostConstruct;
@Lazy
@Component
public class ContractStringConverter extends EntityStringConverter<ContractVo> {
@Lazy
@Autowired
public class ContractStringConverter extends StringConverter<ContractVo> {
ContractService service;
public ContractStringConverter() {
public ContractStringConverter(ContractService service) {
this.service = service;
}
@PostConstruct
private void init() {
setInitialized(project -> service.findById(project.getId()));
setSuggestion(service::search);
// TODO 按名称找出,容易出问题
setFromString(service::findByName);
@Override
public String toString(ContractVo cc) {
return cc.getCode() + " " + cc.getName();
}
@Override
public ContractVo fromString(String string) {
return service.findByCode(string);
}
}

View File

@@ -2,19 +2,30 @@ package com.ecep.contract.converter;
import com.ecep.contract.service.ContractTypeService;
import com.ecep.contract.vo.ContractTypeVo;
import javafx.util.StringConverter;
public class ContractTypeStringConverter extends EntityStringConverter<ContractTypeVo> {
/**
* 合同类型字符串转换器
*
* @author songqq
*/
public class ContractTypeStringConverter extends StringConverter<ContractTypeVo> {
ContractTypeService contractTypeService;
public ContractTypeStringConverter(ContractTypeService contractTypeService) {
this.contractTypeService = contractTypeService;
init();
}
private void init() {
setInitialized(project -> contractTypeService.findById(project.getId()));
setSuggestion(contractTypeService::search);
setFromString(contractTypeService::findByName);
@Override
public String toString(ContractTypeVo object) {
return object.getCode() + " " + object.getCatalog() + " " + object.getName() + " " + object.getTitle()
+ "("
+ object.getDirection() + ")";
}
@Override
public ContractTypeVo fromString(String string) {
return contractTypeService.findByCode(string);
}
}

View File

@@ -1,5 +1,10 @@
package com.ecep.contract.service;
import com.ecep.contract.converter.BankStringConverter;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.BankViewModel;
import com.ecep.contract.vo.BankVo;
import javafx.util.StringConverter;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@@ -8,15 +13,12 @@ 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.BankViewModel;
import com.ecep.contract.vo.BankVo;
import javafx.util.StringConverter;
@Service
@CacheConfig(cacheNames = "bank")
public class BankService extends QueryService<BankVo, BankViewModel> {
private final BankStringConverter stringConverter = new BankStringConverter(this);
@Cacheable(key = "#p0")
@Override
public BankVo findById(Integer id) {
@@ -31,32 +33,20 @@ public class BankService extends QueryService<BankVo, BankViewModel> {
return page.getContent().getFirst();
}
@Caching(evict = { @CacheEvict(key = "#p0.id") })
@Caching(evict = {@CacheEvict(key = "#p0.id")})
@Override
public BankVo save(BankVo entity) {
return super.save(entity);
}
@Caching(evict = { @CacheEvict(key = "#p0.id") })
@Caching(evict = {@CacheEvict(key = "#p0.id")})
@Override
public void delete(BankVo entity) {
super.delete(entity);
}
private StringConverter<BankVo> stringConverter = new StringConverter<BankVo>() {
@Override
public String toString(BankVo object) {
return object == null ? "" : object.getName();
}
@Override
public BankVo fromString(String string) {
return findByName(string);
}
};
@Override
public StringConverter<BankVo> getStringConverter() {
public BankStringConverter getStringConverter() {
return stringConverter;
}

View File

@@ -12,7 +12,7 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp;
import com.ecep.contract.model.CompanyCustomer;
@@ -49,7 +49,7 @@ public class CompanyCustomerFileService extends QueryService<CompanyCustomerFile
// 检索评估表
List<CompanyCustomerFileVo> files = findAllByCustomerAndType(companyCustomer,
CompanyCustomerFileType.EvaluationForm);
CustomerFileType.EvaluationForm);
CompanyCustomerFileVo latestFile = files.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.max(Comparator.comparing(CompanyCustomerFileVo::getSignDate))
@@ -104,7 +104,7 @@ public class CompanyCustomerFileService extends QueryService<CompanyCustomerFile
.getContent();
}
public List<CompanyCustomerFileVo> findAllByCustomerAndType(CompanyCustomerVo customer, CompanyCustomerFileType type) {
public List<CompanyCustomerFileVo> findAllByCustomerAndType(CompanyCustomerVo customer, CustomerFileType type) {
return findAll(ParamUtils.builder()
.equals("customer", customer.getId())
.equals("type", type.name())

View File

@@ -1,6 +1,6 @@
package com.ecep.contract.service;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
import com.ecep.contract.vm.CompanyCustomerFileTypeLocalViewModel;
import org.springframework.cache.annotation.CacheConfig;
@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
@CacheConfig(cacheNames = "company-file-type")
public class CompanyCustomerFileTypeService extends QueryService<CompanyCustomerFileTypeLocal, CompanyCustomerFileTypeLocalViewModel>{
@Cacheable
public Map<CompanyCustomerFileType, CompanyCustomerFileTypeLocal> findAll(Locale locale) {
public Map<CustomerFileType, CompanyCustomerFileTypeLocal> findAll(Locale locale) {
Map<String, Object> params = new HashMap<>();
params.put("lang", locale.toLanguageTag());
return findAll(params, Pageable.unpaged()).stream()

View File

@@ -6,6 +6,8 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Pageable;
@@ -17,13 +19,11 @@ import com.ecep.contract.vm.CompanyFileTypeLocalViewModel;
@Service
@CacheConfig(cacheNames = "company-file-type")
public class CompanyFileTypeService extends QueryService<CompanyFileTypeLocal, CompanyFileTypeLocalViewModel> {
public class CompanyFileTypeService extends QueryService<CompanyFileTypeLocalVo, CompanyFileTypeLocalViewModel> {
@Cacheable
public Map<CompanyFileType, CompanyFileTypeLocal> findAll(Locale locale) {
Map<String, Object> params = new HashMap<>();
params.put("lang", locale.toLanguageTag());
return findAll(params, Pageable.unpaged()).stream()
.collect(Collectors.toMap(CompanyFileTypeLocal::getType, Function.identity()));
public Map<CompanyFileType, CompanyFileTypeLocalVo> findAll(Locale locale) {
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).build(), Pageable.unpaged()).stream()
.collect(Collectors.toMap(CompanyFileTypeLocalVo::getType, Function.identity()));
}
}

View File

@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javafx.util.StringConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
@@ -210,4 +211,8 @@ public class CompanyService extends QueryService<CompanyVo, CompanyViewModel> {
return retrieved;
}
@Override
public StringConverter<CompanyVo> getStringConverter() {
return super.getStringConverter();
}
}

View File

@@ -1,20 +1,25 @@
package com.ecep.contract.service;
import java.util.List;
import com.ecep.contract.converter.ContractGroupStringConverter;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.ContractGroupViewModel;
import com.ecep.contract.vo.ContractGroupVo;
import javafx.util.StringConverter;
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.vm.ContractGroupViewModel;
import com.ecep.contract.vo.ContractGroupVo;
import java.util.List;
@Service
@CacheConfig(cacheNames = "contract-group")
public class ContractGroupService extends QueryService<ContractGroupVo, ContractGroupViewModel> {
private final ContractGroupStringConverter converter = new ContractGroupStringConverter(this);
@Override
@Cacheable(key = "#p0")
public ContractGroupVo findById(Integer id) {
@@ -22,19 +27,14 @@ public class ContractGroupService extends QueryService<ContractGroupVo, Contract
}
public ContractGroupVo findByCode(String code) {
try {
return async("findByCode", code, String.class).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("远程方法+findByCode+调用失败", ex);
}
ContractGroupVo newEntity = createNewEntity();
return updateValue(newEntity, response);
}).get();
} catch (Exception e) {
throw new RuntimeException("查询实体失败" + code, e);
}
return findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1)).stream().findFirst().orElse(null);
}
public ContractGroupVo findByName(String name) {
return findAll(ParamUtils.builder().equals("name", name).build(), Pageable.ofSize(1)).stream().findFirst().orElse(null);
}
@Cacheable(key = "'groups'")
@Override
public List<ContractGroupVo> findAll() {
@@ -56,4 +56,9 @@ public class ContractGroupService extends QueryService<ContractGroupVo, Contract
public void delete(ContractGroupVo entity) {
super.delete(entity);
}
@Override
public StringConverter<ContractGroupVo> getStringConverter() {
return converter;
}
}

View File

@@ -2,6 +2,7 @@ package com.ecep.contract.service;
import java.util.List;
import com.ecep.contract.converter.ContractTypeStringConverter;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@@ -16,6 +17,8 @@ import javafx.util.StringConverter;
@Service
@CacheConfig(cacheNames = "contract-type")
public class ContractTypeService extends QueryService<ContractTypeVo, ContractTypeViewModel> {
private final ContractTypeStringConverter stringConverter = new ContractTypeStringConverter(this);
@Cacheable(key = "#p0")
@Override
public ContractTypeVo findById(Integer id) {
@@ -70,19 +73,7 @@ public class ContractTypeService extends QueryService<ContractTypeVo, ContractTy
}
@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);
}
};
public ContractTypeStringConverter getStringConverter() {
return stringConverter;
}
}

View File

@@ -1,6 +1,8 @@
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;
@@ -10,13 +12,21 @@ import com.ecep.contract.vm.DeliverySignMethodViewModel;
import com.ecep.contract.vo.DeliverySignMethodVo;
import com.ecep.contract.vo.ProjectSaleTypeVo;
import java.util.List;
@Service
@CacheConfig(cacheNames = "delivery-sign-method")
public class DeliverySignMethodService extends QueryService<DeliverySignMethodVo, DeliverySignMethodViewModel> {
@Cacheable(key = "#id")
@Override
public DeliverySignMethodVo findById(Integer id) {
return super.findById(id);
}
/**
* 根据销售类型和编码查询发货方式
*
*
* @param saleType
* @param code
* @return
@@ -29,4 +39,23 @@ public class DeliverySignMethodService extends QueryService<DeliverySignMethodVo
}
return page.stream().filter(v -> v.getCode().equals(code)).findFirst().orElse(null);
}
@Cacheable(key = "'all'")
@Override
public List<DeliverySignMethodVo> findAll() {
return super.findAll();
}
@CacheEvict(allEntries = true)
@Override
public DeliverySignMethodVo save(DeliverySignMethodVo entity) {
return super.save(entity);
}
@CacheEvict(allEntries = true)
@Override
public void delete(DeliverySignMethodVo entity) {
super.delete(entity);
}
}

View File

@@ -22,7 +22,7 @@ public class ProductUsageService extends QueryService<ProductUsageVo, ProductUsa
}
@Override
@Cacheable(unless = "'all'")
@Cacheable(key = "'all'")
public java.util.List<ProductUsageVo> findAll() {
return super.findAll();
}

View File

@@ -1,5 +1,23 @@
package com.ecep.contract.service;
import com.ecep.contract.PageArgument;
import com.ecep.contract.PageContent;
import com.ecep.contract.WebSocketClientService;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.model.NamedEntity;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.IdentityViewModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
@@ -7,25 +25,6 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.ecep.contract.PageArgument;
import com.ecep.contract.PageContent;
import com.ecep.contract.WebSocketClientService;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.IdentityViewModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import javafx.util.StringConverter;
public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel<T>>
implements ViewModelService<T, TV> {
// 添加日志记录器
@@ -166,7 +165,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
return pageContent.toPage();
} catch (Exception e) {
// 处理转换过程中的异常包装为RuntimeException并附带响应内容
throw new RuntimeException(response.toString(), e);
throw new RuntimeException("响应结果转换失败, JSON = " + response.toString(), e);
}
});
}
@@ -189,7 +188,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
return asyncFindAll(params, pageable).get();
} catch (Exception e) {
// 处理异步查询过程中的任何异常,转换为运行时异常抛出
throw new RuntimeException("查询所有实体失败", e);
throw new RuntimeException("查询失败, 参数:" + params, e);
}
}
@@ -261,6 +260,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
return new StringConverter<>() {
@Override
public String toString(T object) {
if (object instanceof NamedEntity named) {
return named.getName();
}
return object.toString();
}

View File

@@ -1,39 +1,50 @@
package com.ecep.contract.service;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.vm.VendorTypeLocalViewModel;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;
import java.util.List;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
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.VendorType;
import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vm.VendorTypeLocalViewModel;
import com.ecep.contract.vo.VendorTypeLocalVo;
@Service
@CacheConfig(cacheNames = "vendor-type")
public class VendorTypeService extends QueryService<VendorTypeLocal, VendorTypeLocalViewModel> {
public class VendorTypeService extends QueryService<VendorTypeLocalVo, VendorTypeLocalViewModel> {
@Cacheable(key = "#p0")
@Override
public VendorTypeLocal findById(Integer id) {
public VendorTypeLocalVo findById(Integer id) {
return super.findById(id);
}
@Cacheable(key = "'type-'+#p0")
public VendorTypeLocalVo findByType(VendorType type) {
return findAll(ParamUtils.builder().equals("type", type).build(), Pageable.ofSize(1)).stream().findFirst()
.orElse(null);
}
@Cacheable(key = "'all'")
@Override
public List<VendorTypeLocal> findAll() {
public List<VendorTypeLocalVo> findAll() {
return super.findAll();
}
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
@Caching(put = { @CachePut(key = "#p0.id"), @CachePut(key = "'type-'+#p0.type"), @CachePut(key = "'all'") })
@Override
public VendorTypeLocal save(VendorTypeLocal entity) {
public VendorTypeLocalVo save(VendorTypeLocalVo entity) {
return super.save(entity);
}
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
@Caching(evict = { @CacheEvict(key = "#p0.id"), @CacheEvict(key = "'type-'+#p0.type"), @CacheEvict(key = "'all'") })
@Override
public void delete(VendorTypeLocal entity) {
public void delete(VendorTypeLocalVo entity) {
super.delete(entity);
}
}

View File

@@ -16,7 +16,7 @@ import java.util.stream.Collectors;
import com.ecep.contract.vo.*;
import org.springframework.util.StringUtils;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.ContractFileType;
import com.ecep.contract.ContractPayWay;
import com.ecep.contract.MessageHolder;
@@ -24,9 +24,7 @@ import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.project.cost.ProjectCostImportItemsFromContractsTasker;
import com.ecep.contract.model.Contract;
import com.ecep.contract.model.ContractBidVendor;
import com.ecep.contract.model.ContractFileTypeLocal;
import com.ecep.contract.model.VendorGroupRequireFileType;
import com.ecep.contract.service.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyExtendInfoService;
@@ -690,7 +688,7 @@ public class ContractVerifyComm {
for (LocalDate verifyDate : verifyDates) {
CompanyCustomerFileVo customerFile = files.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
.filter(v -> MyDateTimeUtils.dateValidFilter(verifyDate, v.getSignDate(),
v.getSignDate().plusYears(1), 7))
.findFirst().orElse(null);
@@ -701,7 +699,7 @@ public class ContractVerifyComm {
CompanyCustomerFileVo latestFile = files.stream()
.filter(v -> v.getSignDate() != null && v.isValid())
.filter(v -> v.getType() == CompanyCustomerFileType.EvaluationForm)
.filter(v -> v.getType() == CustomerFileType.EvaluationForm)
.max(Comparator.comparing(CompanyCustomerFileVo::getSignDate))
.orElse(null);

View File

@@ -1,12 +1,12 @@
package com.ecep.contract.vm;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class CompanyCustomerFileTypeLocalViewModel extends EnumViewModel<CompanyCustomerFileType, CompanyCustomerFileTypeLocal> {
public class CompanyCustomerFileTypeLocalViewModel extends EnumViewModel<CustomerFileType, CompanyCustomerFileTypeLocal> {
}

View File

@@ -3,7 +3,7 @@ package com.ecep.contract.vm;
import java.time.LocalDate;
import java.util.Objects;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.vo.CompanyCustomerFileVo;
import javafx.beans.property.SimpleBooleanProperty;
@@ -32,7 +32,7 @@ public class CompanyCustomerFileViewModel extends IdentityViewModel<CompanyCusto
/**
* 类型
*/
private SimpleObjectProperty<CompanyCustomerFileType> type = new SimpleObjectProperty<>();
private SimpleObjectProperty<CustomerFileType> type = new SimpleObjectProperty<>();
private SimpleStringProperty filePath = new SimpleStringProperty();

View File

@@ -3,22 +3,25 @@ package com.ecep.contract.vm;
import java.util.Objects;
import com.ecep.contract.CompanyFileType;
import com.ecep.contract.model.CompanyFileTypeLocal;
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 文件类型本地化信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class CompanyFileTypeLocalViewModel extends IdentityViewModel<CompanyFileTypeLocal> {
public class CompanyFileTypeLocalViewModel extends IdentityViewModel<CompanyFileTypeLocalVo> {
private SimpleObjectProperty<CompanyFileType> type = new SimpleObjectProperty<>();
private SimpleStringProperty lang = new SimpleStringProperty();
private SimpleStringProperty value = new SimpleStringProperty();
@Override
protected void updateFrom(CompanyFileTypeLocal v) {
protected void updateFrom(CompanyFileTypeLocalVo v) {
super.updateFrom(v);
type.set(v.getType());
lang.set(v.getLang());
@@ -26,7 +29,7 @@ public class CompanyFileTypeLocalViewModel extends IdentityViewModel<CompanyFile
}
@Override
public boolean copyTo(CompanyFileTypeLocal v) {
public boolean copyTo(CompanyFileTypeLocalVo v) {
boolean ret = super.copyTo(v);
if (!Objects.equals(type.get(), v.getType())) {
v.setType(type.get());

View File

@@ -1,11 +1,11 @@
package com.ecep.contract.vm;
import com.ecep.contract.VendorType;
import com.ecep.contract.model.VendorTypeLocal;
import com.ecep.contract.vo.VendorTypeLocalVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class VendorTypeLocalViewModel extends EnumViewModel<VendorType, VendorTypeLocal> {
public class VendorTypeLocalViewModel extends EnumViewModel<VendorType, VendorTypeLocalVo> {
}

View File

@@ -1,6 +1,6 @@
package com.ecep.contract;
public enum CompanyCustomerFileType {
public enum CustomerFileType {
/**
* 普通文件一般文件
*/

View File

@@ -1,5 +1,8 @@
package com.ecep.contract;
/**
* 供应商类型
*/
public enum VendorType {
/**
* 合格供应商

View File

@@ -13,4 +13,5 @@ public class WebSocketConstant {
public static final String SESSION_ID_FIELD_NAME = "sessionId";
public static final int ERROR_CODE_UNAUTHORIZED = 401;
}

View File

@@ -34,6 +34,5 @@ public abstract class BaseEnumEntity<T extends Enum<?>> implements IdentityEntit
@Column(name = "VALUE")
private String value;
}

View File

@@ -7,6 +7,7 @@ import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CloudRkVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -25,7 +26,7 @@ import lombok.ToString;
@Setter
@Entity
@Table(name = "CLOUD_RK", schema = "supplier_ms")
public class CloudRk implements IdentityEntity, Serializable {
public class CloudRk implements IdentityEntity, Serializable, Voable<CloudRkVo> {
private static final long serialVersionUID = 1L;
/**
@@ -153,4 +154,27 @@ public class CloudRk implements IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CloudRkVo toVo() {
CloudRkVo vo = new CloudRkVo();
vo.setId(getId());
vo.setCloudId(getCloudId());
vo.setCompanyId(getCompany() != null ? getCompany().getId() : null);
vo.setAutoUpdate(isAutoUpdate());
vo.setUpdateDays(getUpdateDays());
vo.setCustomerGrade(getCustomerGrade());
vo.setCustomerScore(getCustomerScore());
vo.setCustomerDescription(getCustomerDescription());
vo.setVendorGrade(getVendorGrade());
vo.setVendorScore(getVendorScore());
vo.setVendorDescription(getVendorDescription());
vo.setRank(getRank());
vo.setRankDescription(getRankDescription());
vo.setCloudLatest(getCloudLatest());
vo.setCloudBlackListUpdated(getCloudBlackListUpdated());
vo.setCloudEntUpdate(getCloudEntUpdate());
vo.setDescription(getDescription());
return vo;
}
}

View File

@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyBankAccountVo;
import jakarta.persistence.Column;
import jakarta.persistence.FetchType;
@@ -21,7 +22,7 @@ import lombok.ToString;
@Setter
@jakarta.persistence.Entity
@Table(name = "COMPANY_BANK_ACCOUNT", schema = "supplier_ms")
public class CompanyBankAccount implements IdentityEntity, BasedEntity, CompanyBasedEntity, Serializable {
public class CompanyBankAccount implements IdentityEntity, BasedEntity, CompanyBasedEntity, Serializable, Voable<CompanyBankAccountVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -72,4 +73,17 @@ public class CompanyBankAccount implements IdentityEntity, BasedEntity, CompanyB
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyBankAccountVo toVo() {
CompanyBankAccountVo vo = new CompanyBankAccountVo();
vo.setId(getId());
vo.setCompanyId(getCompany() != null ? getCompany().getId() : null);
vo.setBankId(getBank() != null ? getBank().getId() : null);
vo.setAccount(getAccount());
vo.setOpeningBank(getOpeningBank());
vo.setDescription(getDescription());
vo.setActive(false); // 默认值
return vo;
}
}

View File

@@ -9,6 +9,7 @@ import org.hibernate.annotations.OnDeleteAction;
import com.ecep.contract.BlackReasonType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyBlackReasonVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
@@ -33,7 +34,7 @@ import lombok.Setter;
})
// @org.springframework.data.relational.core.mapping.Table("COMPANY_BLACK_REASON")
@JsonIgnoreProperties(ignoreUnknown = true)
public class CompanyBlackReason implements IdentityEntity, CompanyBasedEntity, Serializable {
public class CompanyBlackReason implements IdentityEntity, CompanyBasedEntity, Serializable, Voable<CompanyBlackReasonVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -90,4 +91,21 @@ public class CompanyBlackReason implements IdentityEntity, CompanyBasedEntity, S
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyBlackReasonVo toVo() {
CompanyBlackReasonVo vo = new CompanyBlackReasonVo();
vo.setId(getId());
vo.setCompanyId(getCompany() != null ? getCompany().getId() : null);
vo.setType(getType());
vo.setApplyName(getApplyName());
vo.setApplyDate(getApplyDate());
vo.setUpdateTime(getUpdateTime());
vo.setCreateTime(getCreateTime());
vo.setIncludeDate(getIncludeDate());
vo.setBlackReason(getBlackReason());
vo.setDescription(getDescription());
vo.setKey(getKey());
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyContractVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -31,7 +32,7 @@ import lombok.ToString;
})
@ToString(exclude = { "company", "contract" })
public class CompanyContract implements IdentityEntity, CompanyBasedEntity, Serializable {
public class CompanyContract implements IdentityEntity, CompanyBasedEntity, Serializable, Voable<CompanyContractVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -75,4 +76,15 @@ public class CompanyContract implements IdentityEntity, CompanyBasedEntity, Seri
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyContractVo toVo() {
CompanyContractVo vo = new CompanyContractVo();
vo.setId(getId());
vo.setCompanyId(getCompany() != null ? getCompany().getId() : null);
vo.setContractId(getContract() != null ? getContract().getId() : null);
vo.setContractCode(getContract() != null ? getContract().getCode() : null);
vo.setContractName(getContract() != null ? getContract().getName() : null);
return vo;
}
}

View File

@@ -1,7 +1,6 @@
package com.ecep.contract.model;
import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Objects;
@@ -9,6 +8,7 @@ import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyCustomerVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -29,7 +29,7 @@ import lombok.ToString;
})
@ToString
public class CompanyCustomer implements IdentityEntity, CompanyBasedEntity, Serializable {
public class CompanyCustomer implements IdentityEntity, CompanyBasedEntity, Serializable, Voable<CompanyCustomerVo> {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@@ -91,4 +91,18 @@ public class CompanyCustomer implements IdentityEntity, CompanyBasedEntity, Seri
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyCustomerVo toVo() {
CompanyCustomerVo vo = new CompanyCustomerVo();
vo.setId(id);
vo.setCompanyId(company != null ? company.getId() : null);
vo.setDevelopDate(developDate);
vo.setPath(path);
vo.setContactId(contact != null ? contact.getId() : null);
vo.setDescription(description);
vo.setCreated(created);
vo.setVersion(version);
return vo;
}
}

View File

@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
@@ -29,7 +30,7 @@ import lombok.ToString;
@Setter
@ToString
@Table(name = "COMPANY_CUSTOMER_EVALUATION_FORM_FILE")
public class CompanyCustomerEvaluationFormFile implements IdentityEntity, BasedEntity, Serializable {
public class CompanyCustomerEvaluationFormFile implements IdentityEntity, BasedEntity, Serializable, Voable<CompanyCustomerEvaluationFormFileVo> {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@@ -85,4 +86,21 @@ public class CompanyCustomerEvaluationFormFile implements IdentityEntity, BasedE
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyCustomerEvaluationFormFileVo toVo() {
CompanyCustomerEvaluationFormFileVo vo = new CompanyCustomerEvaluationFormFileVo();
vo.setId(getId());
vo.setCustomerFile(getCustomerFile() != null ? getCustomerFile().getId() : null);
vo.setCatalog(getCatalog());
vo.setLevel(getLevel());
vo.setCreditLevel(getCreditLevel() != null ? getCreditLevel() : 0);
vo.setScore1(getScore1() != null ? getScore1() : 0);
vo.setScore2(getScore2() != null ? getScore2() : 0);
vo.setScore3(getScore3() != null ? getScore3() : 0);
vo.setScore4(getScore4() != null ? getScore4() : 0);
vo.setScore5(getScore5() != null ? getScore5() : 0);
vo.setScoreTemplateVersion(getScoreTemplateVersion() != null ? getScoreTemplateVersion() : 1);
return vo;
}
}

View File

@@ -4,8 +4,9 @@ import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyCustomerFileVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -27,7 +28,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_CUSTOMER_FILE")
@ToString
public class CompanyCustomerFile implements CompanyBasicFile<CompanyCustomerFileType>, Serializable {
public class CompanyCustomerFile implements CompanyBasicFile<CustomerFileType>, Serializable, Voable<CompanyCustomerFileVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -41,7 +42,7 @@ public class CompanyCustomerFile implements CompanyBasicFile<CompanyCustomerFile
@Column(name = "TYPE")
@Enumerated(EnumType.STRING)
private CompanyCustomerFileType type;
private CustomerFileType type;
/**
* 文件路径
@@ -78,4 +79,17 @@ public class CompanyCustomerFile implements CompanyBasicFile<CompanyCustomerFile
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyCustomerFileVo toVo() {
CompanyCustomerFileVo vo = new CompanyCustomerFileVo();
vo.setId(getId());
vo.setCustomer(getCustomer() != null ? getCustomer().getId() : null);
vo.setType(getType());
vo.setFilePath(getFilePath());
vo.setEditFilePath(getEditFilePath());
vo.setSignDate(getSignDate());
vo.setValid(isValid());
return vo;
}
}

View File

@@ -3,8 +3,9 @@ package com.ecep.contract.model;
import java.io.Serializable;
import java.util.Objects;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyCustomerFileTypeLocalVo;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
@@ -17,7 +18,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_CUSTOMER_FILE_TYPE_LOCAL")
@ToString
public class CompanyCustomerFileTypeLocal extends BaseEnumEntity<CompanyCustomerFileType> implements Serializable {
public class CompanyCustomerFileTypeLocal extends BaseEnumEntity<CustomerFileType> implements Serializable, Voable<CompanyCustomerFileTypeLocalVo> {
private static final long serialVersionUID = 1L;
@Override
@@ -37,4 +38,14 @@ public class CompanyCustomerFileTypeLocal extends BaseEnumEntity<CompanyCustomer
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyCustomerFileTypeLocalVo toVo() {
CompanyCustomerFileTypeLocalVo vo = new CompanyCustomerFileTypeLocalVo();
vo.setId(getId());
vo.setType(getType());
vo.setLang(getLang());
vo.setValue(getValue());
return vo;
}
}

View File

@@ -6,6 +6,7 @@ import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyExtendInfoVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -26,7 +27,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_EXTEND_INFO", schema = "supplier_ms")
@ToString
public class CompanyExtendInfo implements IdentityEntity, Serializable {
public class CompanyExtendInfo implements IdentityEntity, Serializable, Voable<CompanyExtendInfoVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -64,4 +65,14 @@ public class CompanyExtendInfo implements IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyExtendInfoVo toVo() {
CompanyExtendInfoVo vo = new CompanyExtendInfoVo();
vo.setId(getId());
vo.setCompanyId(getCompany() != null ? getCompany().getId() : null);
vo.setDisableVerify(isDisableVerify());
vo.setVersion(getVersion());
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Objects;
import com.ecep.contract.CompanyFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
@@ -17,7 +18,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_FILE_TYPE_LOCAL")
@ToString
public class CompanyFileTypeLocal extends BaseEnumEntity<CompanyFileType> implements Serializable {
public class CompanyFileTypeLocal extends BaseEnumEntity<CompanyFileType> implements Serializable, Voable<CompanyFileTypeLocalVo> {
private static final long serialVersionUID = 1L;
@Override
@@ -37,4 +38,15 @@ public class CompanyFileTypeLocal extends BaseEnumEntity<CompanyFileType> implem
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyFileTypeLocalVo toVo() {
CompanyFileTypeLocalVo vo = new CompanyFileTypeLocalVo();
vo.setId(getId());
vo.setType(getType());
vo.setLang(getLang());
vo.setValue(getValue());
vo.setActive(false); // 设置默认值,因为实体中没有这个字段
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.time.LocalDate;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyVendorApprovedFileVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -27,7 +28,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_VENDOR_APPROVED_FILE")
@ToString
public class CompanyVendorApprovedFile implements IdentityEntity, Serializable {
public class CompanyVendorApprovedFile implements IdentityEntity, Serializable, Voable<CompanyVendorApprovedFileVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -74,4 +75,15 @@ public class CompanyVendorApprovedFile implements IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyVendorApprovedFileVo toVo() {
CompanyVendorApprovedFileVo vo = new CompanyVendorApprovedFileVo();
vo.setId(getId());
vo.setListId(getList() != null ? getList().getId() : null);
vo.setFileName(getFileName());
vo.setSignDate(getSignDate());
vo.setDescription(getDescription());
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Objects;
import com.ecep.contract.VendorType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyVendorApprovedItemVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -27,7 +28,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_VENDOR_APPROVED_ITEM")
@ToString
public class CompanyVendorApprovedItem implements IdentityEntity, Serializable {
public class CompanyVendorApprovedItem implements IdentityEntity, Serializable, Voable<CompanyVendorApprovedItemVo> {
private static final long serialVersionUID = 1L;
@Id
@@ -80,4 +81,16 @@ public class CompanyVendorApprovedItem implements IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyVendorApprovedItemVo toVo() {
CompanyVendorApprovedItemVo vo = new CompanyVendorApprovedItemVo();
vo.setId(getId());
vo.setListId(getList() != null ? getList().getId() : null);
vo.setVendorId(getVendor() != null ? getVendor().getId() : null);
vo.setVendorName(getVendorName());
vo.setType(getType());
vo.setDescription(getDescription());
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.time.LocalDate;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyVendorApprovedListVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -26,7 +27,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_VENDOR_APPROVED")
@ToString
public class CompanyVendorApprovedList implements IdentityEntity, Serializable {
public class CompanyVendorApprovedList implements IdentityEntity, Serializable, Voable<CompanyVendorApprovedListVo> {
private static final long serialVersionUID = 1L;
@Id
@@ -74,4 +75,15 @@ public class CompanyVendorApprovedList implements IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyVendorApprovedListVo toVo() {
CompanyVendorApprovedListVo vo = new CompanyVendorApprovedListVo();
vo.setId(getId());
vo.setTitle(getTitle());
vo.setPublishDate(getPublishDate());
vo.setPath(getPath());
vo.setDescription(getDescription());
return vo;
}
}

View File

@@ -6,6 +6,7 @@ import java.util.Objects;
import com.ecep.contract.VendorFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CompanyVendorFileVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -30,7 +31,7 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_VENDOR_FILE")
@ToString
public class CompanyVendorFile implements CompanyBasicFile<VendorFileType>, Serializable {
public class CompanyVendorFile implements CompanyBasicFile<VendorFileType>, Serializable, Voable<CompanyVendorFileVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -84,4 +85,19 @@ public class CompanyVendorFile implements CompanyBasicFile<VendorFileType>, Seri
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CompanyVendorFileVo toVo() {
CompanyVendorFileVo vo = new CompanyVendorFileVo();
vo.setId(getId());
if (getVendor() != null) {
vo.setVendorId(getVendor().getId());
}
vo.setType(getType());
vo.setFilePath(getFilePath());
vo.setEditFilePath(getEditFilePath());
vo.setSignDate(getSignDate());
vo.setValid(isValid());
return vo;
}
}

View File

@@ -55,7 +55,7 @@ public class ContractFileTypeLocal extends BaseEnumEntity<ContractFileType> impl
public ContractFileTypeLocalVo toVo() {
ContractFileTypeLocalVo vo = new ContractFileTypeLocalVo();
vo.setId(getId());
vo.setLanguage(getLang());
vo.setLang(getLang());
vo.setType(getType());
vo.setDescription(getDescription());
vo.setSuggestFileName(suggestFileName);

View File

@@ -6,6 +6,7 @@ import java.time.LocalDateTime;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.CustomerSatisfactionSurveyVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -28,7 +29,7 @@ import lombok.ToString;
@Entity
@Table(name = "PROJECT_CUSTOMER_SATISFACTION_SURVEY", schema = "supplier_ms")
@ToString
public class CustomerSatisfactionSurvey implements IdentityEntity, ProjectBasedEntity, Serializable {
public class CustomerSatisfactionSurvey implements IdentityEntity, ProjectBasedEntity, Serializable, Voable<CustomerSatisfactionSurveyVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -99,4 +100,23 @@ public class CustomerSatisfactionSurvey implements IdentityEntity, ProjectBasedE
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public CustomerSatisfactionSurveyVo toVo() {
CustomerSatisfactionSurveyVo vo = new CustomerSatisfactionSurveyVo();
vo.setId(getId());
if (getProject() != null) {
vo.setProject(getProject().getId());
}
vo.setCode(getCode());
vo.setDate(getDate());
vo.setTotalScore(getTotalScore());
vo.setData(getData());
if (getApplicant() != null) {
vo.setApplicantId(getApplicant().getId());
}
vo.setApplyTime(getApplyTime());
vo.setDescription(getDescription());
return vo;
}
}

View File

@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.DeliverySignMethodVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -25,7 +26,7 @@ import lombok.ToString;
@Setter
@Entity
@Table(name = "PRODUCT_DELIVERY_SIGN_METHOD", schema = "supplier_ms")
public class DeliverySignMethod implements BasedEntity, IdentityEntity , Serializable {
public class DeliverySignMethod implements BasedEntity, IdentityEntity , Serializable, Voable<DeliverySignMethodVo> {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@@ -68,4 +69,17 @@ public class DeliverySignMethod implements BasedEntity, IdentityEntity , Seriali
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public DeliverySignMethodVo toVo() {
DeliverySignMethodVo vo = new DeliverySignMethodVo();
vo.setId(id);
vo.setName(name);
vo.setCode(code);
vo.setSaleTypeId(saleType != null ? saleType.getId() : null);
vo.setDescription(description);
vo.setActive(false);
vo.setCreated(null);
return vo;
}
}

View File

@@ -1,9 +1,13 @@
package com.ecep.contract.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.EmployeeRoleVo;
import com.ecep.contract.vo.FunctionVo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.CascadeType;
@@ -23,7 +27,7 @@ import lombok.Setter;
@Setter
@jakarta.persistence.Entity
@Table(name = "EMPLOYEE_ROLE", schema = "supplier_ms")
public class EmployeeRole implements IdentityEntity, NamedEntity, Serializable {
public class EmployeeRole implements IdentityEntity, NamedEntity, Serializable, Voable<EmployeeRoleVo> {
private static final long serialVersionUID = 1L;
@Id
@@ -82,4 +86,32 @@ public class EmployeeRole implements IdentityEntity, NamedEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public EmployeeRoleVo toVo() {
EmployeeRoleVo vo = new EmployeeRoleVo();
vo.setId(getId());
vo.setCode(getCode());
vo.setName(getName());
vo.setSystemAdministrator(isSystemAdministrator());
vo.setManager(isManager());
vo.setActive(isActive());
// 转换functions列表
if (getFunctions() != null && !getFunctions().isEmpty()) {
List<FunctionVo> functionVos = new ArrayList<>();
for (Function function : getFunctions()) {
if (function != null) {
FunctionVo functionVo = new FunctionVo();
functionVo.setId(function.getId());
functionVo.setName(function.getName());
functionVo.setKey(function.getKey());
functionVos.add(functionVo);
}
}
vo.setFunctions(functionVos);
}
return vo;
}
}

View File

@@ -1,6 +1,8 @@
package com.ecep.contract.model;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ExtendVendorInfoVo;
import com.ecep.contract.model.Voable;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
@@ -14,7 +16,7 @@ import java.util.Objects;
@Entity
@Table(name = "CONTRACT_EXTEND_VENDOR_INFO", schema = "supplier_ms")
@ToString
public class ExtendVendorInfo implements IdentityEntity, Serializable {
public class ExtendVendorInfo implements IdentityEntity, Serializable, Voable<ExtendVendorInfoVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -66,4 +68,20 @@ public class ExtendVendorInfo implements IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public ExtendVendorInfoVo toVo() {
ExtendVendorInfoVo vo = new ExtendVendorInfoVo();
vo.setId(id);
if (contract != null) {
vo.setContractId(contract.getId());
}
if (group != null) {
vo.setGroupId(group.getId());
}
vo.setCodeSequenceNumber(codeSequenceNumber);
vo.setAssignedProvider(assignedProvider);
vo.setPrePurchase(prePurchase);
return vo;
}
}

View File

@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ProductTypeVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -21,7 +22,7 @@ import lombok.Setter;
@Setter
@Entity
@Table(name = "PRODUCT_TYPE")
public class ProductType implements BasedEntity, IdentityEntity, Serializable {
public class ProductType implements BasedEntity, IdentityEntity, Serializable, Voable<ProductTypeVo> {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@@ -59,4 +60,19 @@ public class ProductType implements BasedEntity, IdentityEntity, Serializable {
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public ProductTypeVo toVo() {
ProductTypeVo vo = new ProductTypeVo();
vo.setId(getId());
vo.setName(getName());
vo.setCode(getCode());
vo.setDescription(getDescription());
// parentId和order字段在ProductType中不存在设置为null
vo.setParentId(null);
vo.setOrder(null);
// active字段设置为默认值false
vo.setActive(false);
return vo;
}
}

View File

@@ -7,6 +7,7 @@ import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ProjectBidVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -31,7 +32,7 @@ import lombok.ToString;
@Entity
@Table(name = "PROJECT_BID")
@ToString
public class ProjectBid implements IdentityEntity, ProjectBasedEntity, Serializable {
public class ProjectBid implements IdentityEntity, ProjectBasedEntity, Serializable, Voable<ProjectBidVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -153,4 +154,40 @@ public class ProjectBid implements IdentityEntity, ProjectBasedEntity, Serializa
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public ProjectBidVo toVo() {
ProjectBidVo vo = new ProjectBidVo();
vo.setId(id);
if (project != null) {
vo.setProject(project.getId());
}
vo.setLevel(level);
vo.setAmount(amount);
if (evaluationFile != null) {
vo.setEvaluationFileId(evaluationFile.getId());
}
if (cost != null) {
vo.setCostId(cost.getId());
}
vo.setStandardPayWay(standardPayWay);
vo.setNoStandardPayWayText(noStandardPayWayText);
vo.setStandardContractText(standardContractText);
vo.setNoStandardContractText(noStandardContractText);
vo.setAuthorizationFile(authorizationFile);
vo.setBidAcceptanceLetterFile(bidAcceptanceLetterFile);
if (applicant != null) {
vo.setApplicantId(applicant.getId());
vo.setApplicantName(applicant.getName());
}
vo.setApplyTime(applyTime);
if (authorizer != null) {
vo.setAuthorizerId(authorizer.getId());
vo.setAuthorizerName(authorizer.getName());
}
vo.setAuthorizationTime(authorizationTime);
vo.setDescription(description);
// active字段默认为false在ProjectBidVo类中已经设置
return vo;
}
}

View File

@@ -7,6 +7,7 @@ import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ProjectCostVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -26,7 +27,7 @@ import lombok.ToString;
@Entity
@Table(name = "PROJECT_COST")
@ToString
public class ProjectCost implements IdentityEntity, ProjectBasedEntity, Serializable {
public class ProjectCost implements IdentityEntity, ProjectBasedEntity, Serializable, Voable<ProjectCostVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -220,4 +221,42 @@ public class ProjectCost implements IdentityEntity, ProjectBasedEntity, Serializ
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public ProjectCostVo toVo() {
ProjectCostVo vo = new ProjectCostVo();
vo.setId(id);
vo.setContractId(contract != null ? contract.getId() : null);
vo.setProject(project != null ? project.getId() : null);
vo.setVersion(version);
vo.setStandardPayWay(standardPayWay);
vo.setNoStandardPayWayText(noStandardPayWayText);
vo.setStandardContractText(standardContractText);
vo.setNoStandardContractText(noStandardContractText);
vo.setStampTax(stampTax);
vo.setStampTaxFee(stampTaxFee);
vo.setOnSiteServiceFee(onSiteServiceFee);
vo.setAssemblyServiceFee(assemblyServiceFee);
vo.setTechnicalServiceFee(technicalServiceFee);
vo.setBidServiceFee(bidServiceFee);
vo.setFreightCost(freightCost);
vo.setGuaranteeLetterFee(guaranteeLetterFee);
vo.setTaxAndSurcharges(taxAndSurcharges);
vo.setTaxAndSurchargesFee(taxAndSurchargesFee);
vo.setInQuantities(inQuantities);
vo.setInTaxAmount(inTaxAmount);
vo.setInExclusiveTaxAmount(inExclusiveTaxAmount);
vo.setOutQuantities(outQuantities);
vo.setOutTaxAmount(outTaxAmount);
vo.setOutExclusiveTaxAmount(outExclusiveTaxAmount);
vo.setGrossProfitMargin(grossProfitMargin);
vo.setApplicantId(applicant != null ? applicant.getId() : null);
vo.setApplyTime(applyTime);
vo.setAuthorizerId(authorizer != null ? authorizer.getId() : null);
vo.setAuthorizationTime(authorizationTime);
vo.setAuthorizationFile(authorizationFile);
vo.setDescription(description);
vo.setImportLock(importLock);
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.time.LocalDateTime;
import java.util.Objects;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ProjectCostItemVo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -24,7 +25,7 @@ import lombok.ToString;
@Entity
@Table(name = "PROJECT_COST_ITEM")
@ToString
public class ProjectCostItem implements IdentityEntity, BasedEntity, Serializable {
public class ProjectCostItem implements IdentityEntity, BasedEntity, Serializable, Voable<ProjectCostItemVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -155,4 +156,27 @@ public class ProjectCostItem implements IdentityEntity, BasedEntity, Serializabl
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public ProjectCostItemVo toVo() {
ProjectCostItemVo vo = new ProjectCostItemVo();
vo.setId(id);
vo.setCostId(cost != null ? cost.getId() : null);
vo.setTitle(title);
vo.setSpecification(specification);
vo.setUnit(unit);
vo.setInventoryId(inventory != null ? inventory.getId() : null);
vo.setInTaxRate(inTaxRate);
vo.setInExclusiveTaxPrice(inExclusiveTaxPrice);
vo.setInQuantity(inQuantity);
vo.setOutTaxRate(outTaxRate);
vo.setOutExclusiveTaxPrice(outExclusiveTaxPrice);
vo.setOutQuantity(outQuantity);
vo.setRemark(remark);
vo.setCreateDate(createDate);
vo.setCreatorId(creator != null ? creator.getId() : null);
vo.setUpdateDate(updateDate);
vo.setUpdaterId(updater != null ? updater.getId() : null);
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Objects;
import com.ecep.contract.ProjectFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ProjectFileTypeLocalVo;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
@@ -17,8 +18,10 @@ import lombok.ToString;
@Entity
@Table(name = "PROJECT_FILE_TYPE_LOCAL")
@ToString
public class ProjectFileTypeLocal extends BaseEnumEntity<ProjectFileType> implements java.io.Serializable {
public class ProjectFileTypeLocal extends BaseEnumEntity<ProjectFileType>
implements java.io.Serializable, Voable<ProjectFileTypeLocalVo> {
private static final long serialVersionUID = 1L;
@Override
public final boolean equals(Object object) {
if (this == object) {
@@ -38,4 +41,14 @@ public class ProjectFileTypeLocal extends BaseEnumEntity<ProjectFileType> implem
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public ProjectFileTypeLocalVo toVo() {
ProjectFileTypeLocalVo vo = new ProjectFileTypeLocalVo();
vo.setId(getId());
vo.setLang(getLang());
vo.setValue(getValue());
vo.setType(getType());
return vo;
}
}

View File

@@ -6,6 +6,8 @@ import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.ProjectQuotationVo;
import com.ecep.contract.model.Voable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -30,7 +32,7 @@ import lombok.ToString;
@Entity
@Table(name = "PROJECT_QUOTATION")
@ToString
public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, java.io.Serializable {
public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, java.io.Serializable, Voable<ProjectQuotationVo> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -132,4 +134,31 @@ public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, jav
return HibernateProxyUtils.hashCode(this);
}
@Override
public ProjectQuotationVo toVo() {
ProjectQuotationVo vo = new ProjectQuotationVo();
vo.setId(id);
if (project != null) {
vo.setProject(project.getId());
}
vo.setLevel(level);
vo.setStandardPayWay(standardPayWay);
vo.setNoStandardPayWayText(noStandardPayWayText);
vo.setAmount(amount);
if (applicant != null) {
vo.setApplicantId(applicant.getId());
}
vo.setApplyTime(applyTime);
if (authorizer != null) {
vo.setAuthorizerId(authorizer.getId());
}
vo.setAuthorizationTime(authorizationTime);
vo.setAuthorizationFile(authorizationFile);
vo.setDescription(description);
if (evaluationFile != null) {
vo.setEvaluationFileId(evaluationFile.getId());
}
// active字段默认为false在ProjectQuotationVo类中已经设置
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Objects;
import com.ecep.contract.VendorFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.VendorFileTypeLocalVo;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
@@ -20,8 +21,9 @@ import lombok.ToString;
@Entity
@Table(name = "COMPANY_VENDOR_FILE_TYPE_LOCAL")
@ToString
public class VendorFileTypeLocal extends BaseEnumEntity<VendorFileType> implements Serializable {
public class VendorFileTypeLocal extends BaseEnumEntity<VendorFileType> implements Serializable, Voable<VendorFileTypeLocalVo> {
private static final long serialVersionUID = 1L;
@Override
public final boolean equals(Object object) {
if (this == object)
@@ -39,4 +41,14 @@ public class VendorFileTypeLocal extends BaseEnumEntity<VendorFileType> implemen
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public VendorFileTypeLocalVo toVo() {
VendorFileTypeLocalVo vo = new VendorFileTypeLocalVo();
vo.setId(getId());
vo.setLang(getLang());
vo.setValue(getValue());
vo.setType(getType());
return vo;
}
}

View File

@@ -1,6 +1,8 @@
package com.ecep.contract.model;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.VendorGroupVo;
import com.ecep.contract.model.Voable;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
@@ -17,7 +19,7 @@ import java.util.Objects;
@Entity
@Table(name = "VENDOR_GROUP", schema = "supplier_ms")
@ToString
public class VendorGroup implements IdentityEntity, NamedEntity, BasedEntity, Serializable {
public class VendorGroup implements IdentityEntity, NamedEntity, BasedEntity, Serializable, Voable<VendorGroupVo> {
private static final long serialVersionUID = 1L;
@Id
@@ -74,4 +76,22 @@ public class VendorGroup implements IdentityEntity, NamedEntity, BasedEntity, Se
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public VendorGroupVo toVo() {
VendorGroupVo vo = new VendorGroupVo();
vo.setId(id);
vo.setName(name);
vo.setCode(code);
vo.setDescription(description);
vo.setActive(active);
vo.setPriceComparison(priceComparison);
vo.setRequireQuotationSheetForBid(requireQuotationSheetForBid);
vo.setCanPrePurchase(canPrePurchase);
// path字段在VendorGroup中没有对应字段设置为null
vo.setPath(null);
// version字段在VendorGroup中没有对应字段设置为0
vo.setVersion(0);
return vo;
}
}

View File

@@ -5,6 +5,8 @@ import java.util.Objects;
import com.ecep.contract.ContractFileType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.VendorGroupRequireFileTypeVo;
import com.ecep.contract.model.Voable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
@@ -28,7 +30,7 @@ import lombok.ToString;
@Setter
@Entity
@Table(name = "VENDOR_GROUP_REQ_FILE_TYPE")
public class VendorGroupRequireFileType implements IdentityEntity, BasedEntity, Serializable {
public class VendorGroupRequireFileType implements IdentityEntity, BasedEntity, Serializable, Voable<VendorGroupRequireFileTypeVo> {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@@ -73,4 +75,16 @@ public class VendorGroupRequireFileType implements IdentityEntity, BasedEntity,
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public VendorGroupRequireFileTypeVo toVo() {
VendorGroupRequireFileTypeVo vo = new VendorGroupRequireFileTypeVo();
vo.setId(id);
if (group != null) {
vo.setGroupId(group.getId());
}
vo.setFileType(fileType);
vo.setFrequency(frequency);
return vo;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Objects;
import com.ecep.contract.VendorType;
import com.ecep.contract.util.HibernateProxyUtils;
import com.ecep.contract.vo.VendorTypeLocalVo;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
@@ -20,7 +21,7 @@ import lombok.ToString;
@Entity
@Table(name = "VENDOR_TYPE_LOCAL")
@ToString(callSuper = true)
public class VendorTypeLocal extends BaseEnumEntity<VendorType> implements Serializable {
public class VendorTypeLocal extends BaseEnumEntity<VendorType> implements Serializable, Voable<VendorTypeLocalVo> {
private static final long serialVersionUID = 1L;
@Override
@@ -42,4 +43,14 @@ public class VendorTypeLocal extends BaseEnumEntity<VendorType> implements Seria
public final int hashCode() {
return HibernateProxyUtils.hashCode(this);
}
@Override
public VendorTypeLocalVo toVo() {
VendorTypeLocalVo vo = new VendorTypeLocalVo();
vo.setId(getId());
vo.setLang(getLang());
vo.setValue(getValue());
vo.setType(getType());
return vo;
}
}

View File

@@ -1,14 +1,12 @@
package com.ecep.contract.vo;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import lombok.Data;
@Data
public class CompanyCustomerFileTypeLocalVo implements IdentityEntity {
private Integer id;
private String name;
private CompanyCustomerFileType value;
private Integer orderNum = 0;
private boolean active = false;
public class CompanyCustomerFileTypeLocalVo extends BaseEnumEntity<CustomerFileType> implements IdentityEntity {
}

View File

@@ -1,7 +1,7 @@
package com.ecep.contract.vo;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.CompanyCustomerFileType;
import com.ecep.contract.CustomerFileType;
import java.time.LocalDate;
import lombok.Data;
@@ -9,7 +9,7 @@ import lombok.Data;
public class CompanyCustomerFileVo implements IdentityEntity {
private Integer id;
private Integer customer;
private CompanyCustomerFileType type;
private CustomerFileType type;
private String filePath;
private String editFilePath;
private LocalDate signDate;

View File

@@ -10,6 +10,9 @@ import lombok.Data;
@Data
public class CompanyCustomerVo implements IdentityEntity, CompanyBasedVo {
private Integer id;
/**
* 公司
*/
private Integer companyId;
private LocalDate developDate;
private String path;

View File

@@ -1,14 +1,12 @@
package com.ecep.contract.vo;
import com.ecep.contract.CompanyFileType;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import lombok.Data;
@Data
public class CompanyFileTypeLocalVo implements IdentityEntity {
private Integer id;
private String name;
private CompanyFileType value;
private Integer orderNum = 0;
public class CompanyFileTypeLocalVo extends BaseEnumEntity<CompanyFileType> implements IdentityEntity {
private boolean active = false;
}

View File

@@ -14,7 +14,6 @@ import lombok.Data;
public class CompanyVendorFileVo implements IdentityEntity {
private Integer id;
private Integer vendorId;
private String vendorName;
private VendorFileType type;
private String filePath;
private String editFilePath;

View File

@@ -1,14 +1,13 @@
package com.ecep.contract.vo;
import com.ecep.contract.VendorFileType;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.ContractFileType;
import lombok.Data;
@Data
public class ContractFileTypeLocalVo implements IdentityEntity {
private Integer id;
private String language;
private ContractFileType type;
public class ContractFileTypeLocalVo extends BaseEnumEntity<ContractFileType> implements IdentityEntity {
private String description;
private String suggestFileName;
}

View File

@@ -0,0 +1,14 @@
package com.ecep.contract.vo;
import com.ecep.contract.CustomerFileType;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import lombok.Data;
@Data
public class CustomerFileTypeLocalVo
extends BaseEnumEntity<CustomerFileType>
implements IdentityEntity {
private Integer orderNum = 0;
private boolean active = false;
}

View File

@@ -0,0 +1,12 @@
package com.ecep.contract.vo;
import com.ecep.contract.ProjectFileType;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import lombok.Data;
@Data
public class ProjectFileTypeLocalVo extends BaseEnumEntity<ProjectFileType> implements IdentityEntity {
private boolean active = false;
}

View File

@@ -15,13 +15,17 @@ public class ProjectQuotationVo implements IdentityEntity, ProjectBasedVo {
private String noStandardPayWayText;
private double amount;
private Integer applicantId;
private String applicantName;
private LocalDateTime applyTime;
private Integer authorizerId;
private String authorizerName;
private LocalDateTime authorizationTime;
/**
* 审核文件
*/
private String authorizationFile;
private String description;
/**
* 评价表单文件, CompanyCustomerEvaluationFormFile
*/
private Integer evaluationFileId;
private boolean active = false;
}

View File

@@ -0,0 +1,11 @@
package com.ecep.contract.vo;
import com.ecep.contract.VendorFileType;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import lombok.Data;
@Data
public class VendorFileTypeLocalVo extends BaseEnumEntity<VendorFileType>
implements IdentityEntity {
}

View File

@@ -1,14 +1,11 @@
package com.ecep.contract.vo;
import com.ecep.contract.model.BaseEnumEntity;
import com.ecep.contract.model.IdentityEntity;
import com.ecep.contract.VendorType;
import lombok.Data;
@Data
public class VendorTypeLocalVo implements IdentityEntity {
private Integer id;
private String language;
private VendorType type;
private String name;
private String description;
public class VendorTypeLocalVo extends BaseEnumEntity<VendorType> implements IdentityEntity {
}

Some files were not shown because too many files have changed in this diff Show More