refactor(vo): 重构VO类及相关模型,添加Voable接口实现
feat(constant): 添加WebSocket错误码常量 docs(model): 为模型类添加注释 fix(service): 修复ProductUsageService缓存键问题 refactor(converter): 重构字符串转换器,移除EntityStringConverter依赖 feat(tab): 添加ComboBoxUtils工具类,优化下拉框初始化 style: 移除无用导入和字段
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(() -> {
|
||||
// 检查单元格是否仍然显示相同的项目
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
/**
|
||||
* 创建单元格工厂
|
||||
*
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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实例
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
/**
|
||||
* 创建单元格工厂
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import javafx.util.Callback;
|
||||
/**
|
||||
* 供应商类型单元格,用于在表格中显示供应商类型信息
|
||||
*/
|
||||
public class VendorTypeTableCell<T> extends AsyncUpdateTableCell<T, VendorTypeLocalVo> {
|
||||
public class VendorTypeTableCell<T> extends AsyncUpdateTableCell<T, VendorType, VendorTypeLocalVo> {
|
||||
private VendorTypeService vendorTypeService;
|
||||
|
||||
/**
|
||||
@@ -39,4 +39,10 @@ public class VendorTypeTableCell<T> extends AsyncUpdateTableCell<T, VendorTypeLo
|
||||
return vendorTypeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VendorTypeLocalVo initialize() {
|
||||
VendorType item = getItem();
|
||||
return getServiceBean().findByType(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.VendorTypeLocal;
|
||||
import com.ecep.contract.vm.VendorTypeLocalViewModel;
|
||||
import com.ecep.contract.vo.VendorTypeLocalVo;
|
||||
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 java.util.List;
|
||||
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")
|
||||
@@ -20,19 +24,25 @@ public class VendorTypeService extends QueryService<VendorTypeLocalVo, VendorTyp
|
||||
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<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 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(VendorTypeLocalVo entity) {
|
||||
super.delete(entity);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ecep.contract;
|
||||
|
||||
/**
|
||||
* 供应商类型
|
||||
*/
|
||||
public enum VendorType {
|
||||
/**
|
||||
* 合格供应商
|
||||
|
||||
@@ -13,4 +13,5 @@ public class WebSocketConstant {
|
||||
|
||||
|
||||
public static final String SESSION_ID_FIELD_NAME = "sessionId";
|
||||
public static final int ERROR_CODE_UNAUTHORIZED = 401;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Objects;
|
||||
|
||||
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<CustomerFileType>, Serializable {
|
||||
public class CompanyCustomerFile implements CompanyBasicFile<CustomerFileType>, Serializable, Voable<CompanyCustomerFileVo> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -78,4 +79,17 @@ public class CompanyCustomerFile implements CompanyBasicFile<CustomerFileType>,
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
||||
|
||||
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<CustomerFileType> 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<CustomerFileTyp
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
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 CompanyCustomerFileTypeLocalVo extends BaseEnumEntity<CustomerFileType> implements IdentityEntity {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.ecep.contract.vo;
|
||||
|
||||
import com.ecep.contract.CompanyFileType;
|
||||
import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.model.BaseEnumEntity;
|
||||
import com.ecep.contract.model.IdentityEntity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -12,7 +12,8 @@ Model和Vo的对应关系记录在 create_vo.md 结果记录中,如果未找
|
||||
- 注解为 @Entity 的 .java 文件
|
||||
- 请根据所在目录找到的Model,更新本文件中的 Entity 类清单
|
||||
如果 model 不在 Entity 类清单中,从清单中移除
|
||||
- Model 需要继承 Voable 接口的类,并且实现 toVo 方
|
||||
- Model 需要继承 com.ecep.contract.model.Voable 接口的类,并且实现 toVo 方法
|
||||
- 以 Local 结尾的 Model 类,并且前面部分名称正好是一个枚举类,则需继承自 BaseEnumEntity
|
||||
|
||||
### 参考
|
||||
|
||||
@@ -47,7 +48,7 @@ Model和Vo的对应关系记录在 create_vo.md 结果记录中,如果未找
|
||||
|
||||
- D:\idea-workspace\Contract-Manager\common\src\main\java\com\ecep\contract\vo\BankVo.java
|
||||
|
||||
## Service
|
||||
## Service (client 模块)
|
||||
|
||||
- 所在目录: D:\idea-workspace\Contract-Manager\client\src\main\java\com\ecep\contract\service
|
||||
- 继承 QueryService<Vo, VM>
|
||||
@@ -66,6 +67,9 @@ Model和Vo的对应关系记录在 create_vo.md 结果记录中,如果未找
|
||||
- 查询条件中的 .equals("company", vendor.getCompanyId()) 中的company 是对应 model 中对应的字段的名,不对 vo 中对应字段的名
|
||||
- 如果方法内没有具体的实现,也用如上代码实现
|
||||
|
||||
## Service (Server 模块)
|
||||
|
||||
|
||||
## Controller
|
||||
|
||||
- ManagerWindowController
|
||||
@@ -76,8 +80,7 @@ Model和Vo的对应关系记录在 create_vo.md 结果记录中,如果未找
|
||||
|
||||
### 参考
|
||||
|
||||
- D:
|
||||
\idea-workspace\Contract-Manager\client\src\main\java\com\ecep\contract\controller\bank\BankManagerWindowController.java
|
||||
- D:\idea-workspace\Contract-Manager\client\src\main\java\com\ecep\contract\controller\bank\BankManagerWindowController.java
|
||||
- D:\idea-workspace\Contract-Manager\client\src\main\java\com\ecep\contract\controller\bank\BankManagerSkin.java
|
||||
|
||||
## TabSkin
|
||||
@@ -206,29 +209,29 @@ PurchaseBillVoucherItem: PurchaseBillVoucherItemVo (已创建)
|
||||
PurchaseBillVoucher: PurchaseBillVoucherVo (已创建)
|
||||
CompanyOldName: CompanyOldNameVo (已创建)
|
||||
ContractCatalog: ContractCatalogVo (已创建)
|
||||
CompanyBlackReason: CompanyBlackReasonVo (已创建)
|
||||
CompanyContract: CompanyContractVo (已创建)
|
||||
CompanyCustomer: CompanyCustomerVo (已创建)
|
||||
CompanyBlackReason: CompanyBlackReasonVo (已更新)
|
||||
CompanyContract: CompanyContractVo (已更新)
|
||||
CompanyCustomer: CompanyCustomerVo (已更新)
|
||||
CompanyCustomerEntity: CompanyCustomerEntityVo (已创建)
|
||||
CompanyCustomerEvaluationFormFile: CompanyCustomerEvaluationFormFileVo (已创建)
|
||||
CompanyCustomerFile: CompanyCustomerFileVo (已创建)
|
||||
CompanyCustomerFileTypeLocal: CompanyCustomerFileTypeLocalVo (已创建)
|
||||
CompanyExtendInfo: CompanyExtendInfoVo (已创建)
|
||||
CompanyFileTypeLocal: CompanyFileTypeLocalVo (已创建)
|
||||
CompanyVendor: CompanyVendorVo (已创建)
|
||||
CompanyVendorApprovedFile: CompanyVendorApprovedFileVo (已创建)
|
||||
CompanyVendorApprovedItem: CompanyVendorApprovedItemVo (已创建)
|
||||
CompanyVendorApprovedList: CompanyVendorApprovedListVo (已创建)
|
||||
CompanyVendorEntity: CompanyVendorEntityVo (已创建)
|
||||
CompanyVendorFile: CompanyVendorFileVo (已创建)
|
||||
CustomerSatisfactionSurvey: CustomerSatisfactionSurveyVo (已创建)
|
||||
EmployeeRole: EmployeeRoleVo (已创建)
|
||||
ProductType: ProductTypeVo (已创建)
|
||||
PurchaseOrder: PurchaseOrderVo (已创建)
|
||||
CloudRk: CloudRkVo (已创建)
|
||||
CloudTyc: CloudTycVo (已创建)
|
||||
CloudYu: CloudYuVo (已创建)
|
||||
ProjectFile: ProjectFileVo (已创建)
|
||||
CompanyCustomerEvaluationFormFile: CompanyCustomerEvaluationFormFileVo (已更新)
|
||||
CompanyCustomerFile: CompanyCustomerFileVo (已更新)
|
||||
CompanyCustomerFileTypeLocal: CompanyCustomerFileTypeLocalVo (已更新)
|
||||
CompanyExtendInfo: CompanyExtendInfoVo (已更新)
|
||||
CompanyFileTypeLocal: CompanyFileTypeLocalVo (已更新)
|
||||
CompanyVendor: CompanyVendorVo (已更新)
|
||||
CompanyVendorApprovedFile: CompanyVendorApprovedFileVo (已更新)
|
||||
CompanyVendorApprovedItem: CompanyVendorApprovedItemVo (已更新)
|
||||
CompanyVendorApprovedList: CompanyVendorApprovedListVo (已更新)
|
||||
CompanyVendorEntity: CompanyVendorEntityVo (已更新)
|
||||
CompanyVendorFile: CompanyVendorFileVo (已更新)
|
||||
CustomerSatisfactionSurvey: CustomerSatisfactionSurveyVo (已更新)
|
||||
EmployeeRole: EmployeeRoleVo (已更新)
|
||||
ProductType: ProductTypeVo (已更新)
|
||||
PurchaseOrder: PurchaseOrderVo (已更新)
|
||||
CloudRk: CloudRkVo (已更新)
|
||||
CloudTyc: CloudTycVo (已更新)
|
||||
CloudYu: CloudYuVo (已更新)
|
||||
ProjectFile: ProjectFileVo (已更新)
|
||||
|
||||
CompanyContact: CompanyContactVo (已更新)
|
||||
ContractType: ContractTypeVo (已更新)
|
||||
@@ -275,10 +278,14 @@ Company: CompanyVo (已检查)
|
||||
Invoice: InvoiceVo (已更新)
|
||||
PurchaseOrder: PurchaseOrderVo (已更新)
|
||||
SalesOrder: SalesOrderVo (已更新)
|
||||
ProjectBid: ProjectBidVo (已创建)
|
||||
ProjectQuotation: ProjectQuotationVo (已创建)
|
||||
ProjectBid: ProjectBidVo (已更新)
|
||||
ProjectQuotation: ProjectQuotationVo (已更新)
|
||||
CompanyBankAccount: CompanyBankAccountVo (已检查)
|
||||
ExtendVendorInfo: ExtendVendorInfoVo (已创建)
|
||||
ExtendVendorInfo: ExtendVendorInfoVo (已更新)
|
||||
ProjectCost: ProjectCostVo (已更新)
|
||||
VendorGroup: VendorGroupVo (已创建)
|
||||
VendorGroupRequireFileType: VendorGroupRequireFileTypeVo (已创建)
|
||||
VendorGroup: VendorGroupVo (已更新)
|
||||
VendorGroupRequireFileType: VendorGroupRequireFileTypeVo (已更新)
|
||||
ProjectCostItem: ProjectCostItemVo (已更新)
|
||||
ProjectFileTypeLocal: ProjectFileTypeLocalVo (已更新)
|
||||
VendorTypeLocal: VendorTypeLocalVo (已更新)
|
||||
VendorFileTypeLocal: VendorFileTypeLocalVo (已更新)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ecep.contract.ds.company.service;
|
||||
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
@@ -28,8 +29,8 @@ public class CompanyFileTypeService
|
||||
@Override
|
||||
public Page<CompanyFileTypeLocal> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<CompanyFileTypeLocal> spec = null;
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
||||
}
|
||||
// field
|
||||
return findAll(spec, pageable);
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.ContractFileType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.contract.repository.ContractFileTypeLocalRepository;
|
||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
@@ -35,8 +36,8 @@ public class ContractFileTypeService
|
||||
@Override
|
||||
public Page<ContractFileTypeLocal> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<ContractFileTypeLocal> spec = null;
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
||||
}
|
||||
|
||||
// field
|
||||
|
||||
98
server/src/main/java/com/ecep/contract/ds/vendor/service/VendorFileTypeService.java
vendored
Normal file
98
server/src/main/java/com/ecep/contract/ds/vendor/service/VendorFileTypeService.java
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
package com.ecep.contract.ds.vendor.service;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.vendor.repository.CompanyVendorFileTypeLocalRepository;
|
||||
import com.ecep.contract.model.VendorFileTypeLocal;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
* 供应商文件类型服务类
|
||||
* 提供对供应商文件类型的查询、创建、更新和删除操作
|
||||
*/
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-file-type")
|
||||
public class VendorFileTypeService implements IEntityService<VendorFileTypeLocal>, QueryService<VendorFileTypeLocal> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyVendorFileTypeLocalRepository repository;
|
||||
|
||||
@Override
|
||||
public Page<VendorFileTypeLocal> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<VendorFileTypeLocal> spec = null;
|
||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
||||
}
|
||||
|
||||
// field
|
||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "lang", "value");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public VendorFileTypeLocal findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<VendorFileTypeLocal> findAll(Specification<VendorFileTypeLocal> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Cacheable(key = "'all-'+#p0.toLanguageTag()")
|
||||
public Map<VendorFileType, VendorFileTypeLocal> findAll(Locale locale) {
|
||||
return repository.getCompleteMapByLocal(locale.toLanguageTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<VendorFileTypeLocal> getSpecification(String searchText) {
|
||||
if (!StringUtils.hasText(searchText)) {
|
||||
return null;
|
||||
}
|
||||
return (root, query, builder) -> {
|
||||
return
|
||||
// builder.or(
|
||||
builder.like(root.get("type"), "%" + searchText + "%")
|
||||
// )
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'all-'+#p0.getLang()")
|
||||
})
|
||||
@Override
|
||||
public void delete(VendorFileTypeLocal entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'all-'+#p0.getLang()")
|
||||
})
|
||||
@Override
|
||||
public VendorFileTypeLocal save(VendorFileTypeLocal entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,94 @@
|
||||
package com.ecep.contract.ds.vendor.service;
|
||||
|
||||
public class VendorTypeService {
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorTypeLocalRepository;
|
||||
import com.ecep.contract.model.VendorTypeLocal;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-type")
|
||||
public class VendorTypeService implements IEntityService<VendorTypeLocal>, QueryService<VendorTypeLocal> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorTypeLocalRepository repository;
|
||||
|
||||
@Override
|
||||
public Page<VendorTypeLocal> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<VendorTypeLocal> spec = null;
|
||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
||||
}
|
||||
|
||||
// field
|
||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "lang", "value");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public VendorTypeLocal findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<VendorTypeLocal> findAll(Specification<VendorTypeLocal> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Cacheable(key = "'all-'+#p0.toLanguageTag()")
|
||||
public Map<VendorType, VendorTypeLocal> findAll(Locale locale) {
|
||||
return repository.getCompleteMapByLocal(locale.toLanguageTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<VendorTypeLocal> getSpecification(String searchText) {
|
||||
if (!StringUtils.hasText(searchText)) {
|
||||
return null;
|
||||
}
|
||||
return (root, query, builder) -> {
|
||||
return
|
||||
// builder.or(
|
||||
builder.like(root.get("type"), "%" + searchText + "%")
|
||||
// )
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'all-'+#p0.getLang()")
|
||||
})
|
||||
@Override
|
||||
public void delete(VendorTypeLocal entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'all-'+#p0.getLang()")
|
||||
})
|
||||
@Override
|
||||
public VendorTypeLocal save(VendorTypeLocal entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class WebSocketServerHandler extends TextWebSocketHandler {
|
||||
|
||||
if (sessionInfo.getEmployeeId() == null) {
|
||||
logger.error("会话未绑定用户: {}", session.getId());
|
||||
sendError(session, 401, "会话未绑定用户");
|
||||
sendError(session, WebSocketConstant.ERROR_CODE_UNAUTHORIZED, "会话未绑定用户");
|
||||
session.close(CloseStatus.NOT_ACCEPTABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user