Compare commits
2 Commits
97a2586c21
...
42a8f9ab30
| Author | SHA1 | Date | |
|---|---|---|---|
| 42a8f9ab30 | |||
| 045a1e9eed |
@@ -95,6 +95,7 @@ public class ContractTabSkinVendorBid
|
||||
showInOwner(VendorBidWindowController.class, item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onBidVendorTableCreateAction(ActionEvent event) {
|
||||
ContractVo contract = getParent();
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
SimpleIntegerProperty refId = new SimpleIntegerProperty();
|
||||
SimpleObjectProperty<Integer> contractId = new SimpleObjectProperty<>();
|
||||
SimpleStringProperty code = new SimpleStringProperty();
|
||||
SimpleStringProperty name = new SimpleStringProperty();
|
||||
SimpleObjectProperty<Integer> vendorId = new SimpleObjectProperty<>();
|
||||
SimpleObjectProperty<LocalDate> orderDate = new SimpleObjectProperty<>();
|
||||
SimpleDoubleProperty totalAmount = new SimpleDoubleProperty();
|
||||
SimpleDoubleProperty taxAmount = new SimpleDoubleProperty();
|
||||
@@ -48,20 +46,10 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
getContractId().set(v.getContractId());
|
||||
}
|
||||
getCode().set(v.getCode());
|
||||
getName().set(v.getName());
|
||||
if (v.getVendorId() != null) {
|
||||
getVendorId().set(v.getVendorId());
|
||||
}
|
||||
getOrderDate().set(v.getOrderDate());
|
||||
getTotalAmount().set(v.getTotalAmount() != null ? v.getTotalAmount() : 0.0);
|
||||
getTaxAmount().set(v.getTaxAmount() != null ? v.getTaxAmount() : 0.0);
|
||||
getTaxRate().set(v.getTaxRate() != null ? v.getTaxRate() : 0.0);
|
||||
if (v.getStatusId() != null) {
|
||||
getStatusId().set(v.getStatusId());
|
||||
}
|
||||
getRemark().set(v.getRemark());
|
||||
getActive().set(v.getActive() != null ? v.getActive() : false);
|
||||
|
||||
|
||||
// 保留原有的员工相关字段设置
|
||||
if (getEmployee() != null && getEmployee().get() != null) {
|
||||
getEmployee().set(getEmployee().get());
|
||||
@@ -107,18 +95,6 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
v.setCode(code.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(name.get(), v.getName())) {
|
||||
v.setName(name.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(vendorId.get(), v.getVendorId())) {
|
||||
v.setVendorId(vendorId.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(orderDate.get(), v.getOrderDate())) {
|
||||
v.setOrderDate(orderDate.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(totalAmount.get(), v.getTotalAmount())) {
|
||||
v.setTotalAmount(totalAmount.get());
|
||||
modified = true;
|
||||
@@ -131,21 +107,13 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
v.setTaxRate(taxRate.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(statusId.get(), v.getStatusId())) {
|
||||
v.setStatusId(statusId.get());
|
||||
if (!Objects.equals(taxRate.get(), v.getTaxRate())) {
|
||||
v.setTaxRate(taxRate.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(remark.get(), v.getRemark())) {
|
||||
v.setRemark(remark.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(active.get(), v.getActive())) {
|
||||
v.setActive(active.get());
|
||||
modified = true;
|
||||
}
|
||||
// 保留原有的员工相关字段复制
|
||||
if (!Objects.equals(description.get(), v.getRemark())) {
|
||||
v.setRemark(description.get());
|
||||
|
||||
if (!Objects.equals(description.get(), v.getDescription())) {
|
||||
v.setDescription(description.get());
|
||||
modified = true;
|
||||
}
|
||||
return modified;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SalesOrderItemViewModel extends IdentityViewModel<SalesOrderItemVo>
|
||||
@Override
|
||||
protected void updateFrom(SalesOrderItemVo v) {
|
||||
super.updateFrom(v);
|
||||
getOrder().set(v.getSalesOrderId());
|
||||
getOrder().set(v.getOrderId());
|
||||
getCode().set(v.getCode());
|
||||
getName().set(v.getName());
|
||||
getQuantity().set(v.getQuantity());
|
||||
@@ -47,8 +47,8 @@ public class SalesOrderItemViewModel extends IdentityViewModel<SalesOrderItemVo>
|
||||
@Override
|
||||
public boolean copyTo(SalesOrderItemVo v) {
|
||||
boolean modified = super.copyTo(v);
|
||||
if (!Objects.equals(order.get(), v.getSalesOrderId())) {
|
||||
v.setSalesOrderId(order.get());
|
||||
if (!Objects.equals(order.get(), v.getOrderId())) {
|
||||
v.setOrderId(order.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(code.get(), v.getCode())) {
|
||||
|
||||
@@ -57,6 +57,7 @@ public class ContractFileTypeLocal extends BaseEnumEntity<ContractFileType> impl
|
||||
vo.setId(getId());
|
||||
vo.setLang(getLang());
|
||||
vo.setType(getType());
|
||||
vo.setValue(getValue());
|
||||
vo.setDescription(getDescription());
|
||||
vo.setSuggestFileName(suggestFileName);
|
||||
return vo;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ecep.contract.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.ProjectFileType;
|
||||
|
||||
@@ -7,7 +7,6 @@ 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;
|
||||
@@ -32,7 +31,8 @@ import lombok.ToString;
|
||||
@Entity
|
||||
@Table(name = "PROJECT_QUOTATION")
|
||||
@ToString
|
||||
public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, java.io.Serializable, Voable<ProjectQuotationVo> {
|
||||
public class ProjectQuotation
|
||||
implements IdentityEntity, ProjectBasedEntity, java.io.Serializable, Voable<ProjectQuotationVo> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -47,7 +47,6 @@ public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, jav
|
||||
@ToString.Exclude
|
||||
private Project project;
|
||||
|
||||
|
||||
/**
|
||||
* 客户资信等级
|
||||
*/
|
||||
@@ -116,7 +115,7 @@ public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, jav
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object == null) {
|
||||
@@ -154,10 +153,10 @@ public class ProjectQuotation implements IdentityEntity, ProjectBasedEntity, jav
|
||||
}
|
||||
vo.setAuthorizationTime(authorizationTime);
|
||||
vo.setAuthorizationFile(authorizationFile);
|
||||
vo.setDescription(description);
|
||||
if (evaluationFile != null) {
|
||||
vo.setEvaluationFileId(evaluationFile.getId());
|
||||
}
|
||||
vo.setDescription(description);
|
||||
// active字段默认为false,在ProjectQuotationVo类中已经设置
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ProjectSaleType implements IdentityEntity, NamedEntity, BasedEntity
|
||||
* 符合重大项目的合同金额条件
|
||||
*/
|
||||
@Column(name = "CRITICAL_PROJECT_LIMIT")
|
||||
private double criticalProjectLimit;
|
||||
private Double criticalProjectLimit;
|
||||
|
||||
@Column(name = "IS_ACTIVE")
|
||||
private boolean active;
|
||||
|
||||
@@ -28,7 +28,8 @@ import lombok.ToString;
|
||||
@Entity
|
||||
@Table(name = "PURCHASE_ORDER", schema = "supplier_ms")
|
||||
@ToString
|
||||
public class PurchaseOrder implements IdentityEntity, BasedEntity, ContractBasedEntity, java.io.Serializable, Voable<PurchaseOrderVo> {
|
||||
public class PurchaseOrder
|
||||
implements IdentityEntity, BasedEntity, ContractBasedEntity, java.io.Serializable, Voable<PurchaseOrderVo> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -126,17 +127,26 @@ public class PurchaseOrder implements IdentityEntity, BasedEntity, ContractBased
|
||||
vo.setContractId(contract.getId());
|
||||
}
|
||||
vo.setCode(code);
|
||||
// PurchaseOrder中没有name字段,这里可以设置为code
|
||||
vo.setName(code);
|
||||
// PurchaseOrder中没有vendorId字段,只有vendorCode
|
||||
// vo.setVendorId();
|
||||
// PurchaseOrder中没有orderDate字段,这里可以设置为makerDate
|
||||
if (makerDate != null) {
|
||||
vo.setOrderDate(makerDate.toLocalDate());
|
||||
vo.setRefId(refId);
|
||||
vo.setVendorCode(vendorCode);
|
||||
vo.setDescription(description);
|
||||
vo.setMakerDate(makerDate);
|
||||
vo.setModifyDate(modifyDate);
|
||||
vo.setVerifierDate(verifierDate);
|
||||
vo.setCloserDate(closerDate);
|
||||
|
||||
if (employee != null) {
|
||||
vo.setEmployeeId(employee.getId());
|
||||
}
|
||||
if (maker != null) {
|
||||
vo.setMakerId(maker.getId());
|
||||
}
|
||||
if (verifier != null) {
|
||||
vo.setVerifierId(verifier.getId());
|
||||
}
|
||||
if (closer != null) {
|
||||
vo.setCloserId(closer.getId());
|
||||
}
|
||||
// PurchaseOrder中没有totalAmount、taxAmount、taxRate和statusId字段,暂时不设置
|
||||
vo.setRemark(description);
|
||||
// active字段默认为false,在PurchaseOrderVo类中已经设置
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,15 +107,16 @@ public class SalesOrderItem implements IdentityEntity, BasedEntity, Serializable
|
||||
vo.setCode(code);
|
||||
vo.setName(name);
|
||||
if (order != null) {
|
||||
vo.setSalesOrderId(order.getId());
|
||||
vo.setOrderId(order.getId());
|
||||
}
|
||||
vo.setItemName(name);
|
||||
vo.setQuantity(quantity);
|
||||
vo.setPrice(price);
|
||||
vo.setTaxRate(taxRate);
|
||||
vo.setExclusiveTaxPrice(exclusiveTaxPrice);
|
||||
|
||||
vo.setStartDate(startDate);
|
||||
vo.setEndDate(endDate);
|
||||
|
||||
vo.setDescription(description);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ public class CompanyContactVo implements IdentityEntity, NamedEntity, CompanyBas
|
||||
private String u8Code;
|
||||
private String memo;
|
||||
private LocalDate created;
|
||||
private boolean primary = false;
|
||||
private String description;
|
||||
private boolean active = false;
|
||||
|
||||
private int version;
|
||||
|
||||
// 备用扩展
|
||||
private boolean primary = false;
|
||||
private boolean active = false;
|
||||
}
|
||||
@@ -10,8 +10,8 @@ public class ContractGroupVo implements IdentityEntity, NamedEntity {
|
||||
private String name;
|
||||
private String code;
|
||||
private String title;
|
||||
private Integer parentId;
|
||||
private Integer order;
|
||||
|
||||
// 以下field在ContractGroup实体中不存在,待后期扩展用途
|
||||
private String description;
|
||||
private boolean active = false;
|
||||
}
|
||||
@@ -16,6 +16,7 @@ public class ProjectSaleTypeVo implements IdentityEntity, NamedEntity {
|
||||
private Double criticalProjectLimit;
|
||||
private boolean active = false;
|
||||
private String description;
|
||||
|
||||
private LocalDate created;
|
||||
private int version;
|
||||
}
|
||||
@@ -1,21 +1,33 @@
|
||||
package com.ecep.contract.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.ecep.contract.model.IdentityEntity;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PurchaseOrderVo implements IdentityEntity, ContractBasedVo {
|
||||
private Integer id;
|
||||
private Integer contractId;
|
||||
private Integer refId;
|
||||
private String code;
|
||||
private String name;
|
||||
private Integer vendorId;
|
||||
private LocalDate orderDate;
|
||||
private String vendorCode;
|
||||
|
||||
private Integer employeeId;
|
||||
private Integer makerId;
|
||||
private LocalDateTime makerDate;
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
private Integer verifierId;
|
||||
private LocalDateTime verifierDate;
|
||||
|
||||
private Integer closerId;
|
||||
private LocalDateTime closerDate;
|
||||
|
||||
private Double totalAmount;
|
||||
private Double taxAmount;
|
||||
private Double taxRate;
|
||||
private Integer statusId;
|
||||
private String remark;
|
||||
private Boolean active = false;
|
||||
|
||||
private String description;
|
||||
}
|
||||
@@ -8,15 +8,11 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
public class SalesOrderItemVo implements IdentityEntity {
|
||||
private Integer id;
|
||||
private Integer salesOrderId;
|
||||
private Integer orderId;
|
||||
private String code;
|
||||
private String name;
|
||||
|
||||
private Integer contractItemId;
|
||||
private Integer inventoryId;
|
||||
private String itemName;
|
||||
private Integer unitId;
|
||||
|
||||
//
|
||||
private double quantity;
|
||||
private double price;
|
||||
private double taxRate;
|
||||
@@ -26,4 +22,9 @@ public class SalesOrderItemVo implements IdentityEntity {
|
||||
private LocalDate endDate;
|
||||
|
||||
private String description;
|
||||
|
||||
// 备用扩展
|
||||
private Integer contractItemId;
|
||||
private Integer inventoryId;
|
||||
private Integer unitId;
|
||||
}
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
## 概述
|
||||
|
||||
本报告分析了`d:\idea-workspace\Contract-Manager\server\src\main\java\com\ecep\contract\ds`目录下,所有实现了[`IEntityService`](/server/src/main/java/com/ecep/contract/IEntityService.java)接口的Service实现,检查它们是否符合[`create_vo.md`](/docs/task/create_vo.md)文档中关于Server模块Service需要继承[`VoableService<M, Vo>`](/server/src/main/java/com/ecep/contract/service/VoableService.java)接口的要求。
|
||||
本报告分析了[Server](/server/src/main/java/com/ecep/contract/)模块下,所有实现了[`IEntityService`](/server/src/main/java/com/ecep/contract/IEntityService.java)接口的Service是否都继承实现了[`com.ecep.contract.service.VoableService<M, Vo>`](/server/src/main/java/com/ecep/contract/service/VoableService.java),包括接口的继承和接口方法的实现,并确认其是否符合[`create_vo.md`](/docs/task/create_vo.md)的要求。
|
||||
|
||||
## 范围
|
||||
- Server 模块中实现了`IEntityService`接口的Service类
|
||||
- 实体类和Vo类定义在 Common 模块
|
||||
- 参考 [`create_vo.md`](/docs/task/create_vo.md) 文档规范
|
||||
|
||||
## 需要实现VoableService接口的Service列表
|
||||
|
||||
通过分析,以下是server模块下所有实现了[`IEntityService`](/server/src/main/java/com/ecep/contract/IEntityService.java)接口的73个Service类:
|
||||
通过分析,server模块下共有73个实现了[`IEntityService`](/server/src/main/java/com/ecep/contract/IEntityService.java)接口的Service类,按模块分类如下:
|
||||
|
||||
### contract模块Service
|
||||
### contract模块Service(18个)
|
||||
|
||||
1. [`ContractService`](/server/src/main/java/com/ecep/contract/ds/contract/service/ContractService.java) - 合同服务
|
||||
2. [`ContractGroupService`](/server/src/main/java/com/ecep/contract/ds/contract/service/ContractGroupService.java) - 合同组服务
|
||||
@@ -29,7 +34,7 @@
|
||||
17. [`ContractFileTypeService`](/server/src/main/java/com/ecep/contract/ds/contract/service/ContractFileTypeService.java) - 合同文件类型服务
|
||||
18. [`PurchaseBillVoucherItemService`](/server/src/main/java/com/ecep/contract/ds/contract/service/PurchaseBillVoucherItemService.java) - 采购发票凭证项服务
|
||||
|
||||
### company模块Service
|
||||
### company模块Service(8个)
|
||||
|
||||
19. [`InvoiceService`](/server/src/main/java/com/ecep/contract/ds/company/service/InvoiceService.java) - 发票服务
|
||||
20. [`CompanyFileTypeService`](/server/src/main/java/com/ecep/contract/ds/company/service/CompanyFileTypeService.java) - 公司文件类型服务
|
||||
@@ -40,7 +45,7 @@
|
||||
25. [`CompanyFileService`](/server/src/main/java/com/ecep/contract/ds/company/service/CompanyFileService.java) - 公司文件服务
|
||||
26. [`CompanyService`](/server/src/main/java/com/ecep/contract/ds/company/service/CompanyService.java) - 公司服务
|
||||
|
||||
### customer模块Service
|
||||
### customer模块Service(7个)
|
||||
|
||||
27. [`CompanyCustomerFileTypeService`](/server/src/main/java/com/ecep/contract/ds/customer/service/CompanyCustomerFileTypeService.java) - 公司客户文件类型服务
|
||||
28. [`CustomerFileTypeService`](/server/src/main/java/com/ecep/contract/ds/customer/service/CustomerFileTypeService.java) - 客户文件类型服务
|
||||
@@ -50,7 +55,7 @@
|
||||
32. [`CompanyCustomerService`](/server/src/main/java/com/ecep/contract/ds/customer/service/CompanyCustomerService.java) - 公司客户服务
|
||||
33. [`CompanyCustomerFileService`](/server/src/main/java/com/ecep/contract/ds/customer/service/CompanyCustomerFileService.java) - 公司客户文件服务
|
||||
|
||||
### project模块Service
|
||||
### project模块Service(16个)
|
||||
|
||||
34. [`ProjectCostService`](/server/src/main/java/com/ecep/contract/ds/project/service/ProjectCostService.java) - 项目成本服务
|
||||
35. [`ProjectService`](/server/src/main/java/com/ecep/contract/ds/project/service/ProjectService.java) - 项目服务
|
||||
@@ -69,7 +74,7 @@
|
||||
48. [`ProjectSaleTypeRequireFileTypeService`](/server/src/main/java/com/ecep/contract/ds/project/service/ProjectSaleTypeRequireFileTypeService.java) - 项目销售类型要求文件类型服务
|
||||
49. [`ProjectFileService`](/server/src/main/java/com/ecep/contract/ds/project/service/ProjectFileService.java) - 项目文件服务
|
||||
|
||||
### vendor模块Service
|
||||
### vendor模块Service(11个)
|
||||
|
||||
50. [`VendorTypeService`](/server/src/main/java/com/ecep/contract/ds/vendor/service/VendorTypeService.java) - 供应商类型服务
|
||||
51. [`VendorService`](/server/src/main/java/com/ecep/contract/ds/vendor/service/VendorService.java) - 供应商服务
|
||||
@@ -83,7 +88,7 @@
|
||||
59. [`VendorCatalogService`](/server/src/main/java/com/ecep/contract/ds/vendor/service/VendorCatalogService.java) - 供应商目录服务
|
||||
60. [`VendorFileService`](/server/src/main/java/com/ecep/contract/ds/vendor/service/VendorFileService.java) - 供应商文件服务
|
||||
|
||||
### other模块Service
|
||||
### other模块Service(10个)
|
||||
|
||||
61. [`EmployeeLoginHistoryService`](/server/src/main/java/com/ecep/contract/ds/other/service/EmployeeLoginHistoryService.java) - 员工登录历史服务
|
||||
62. [`EmployeeService`](/server/src/main/java/com/ecep/contract/ds/other/service/EmployeeService.java) - 员工服务
|
||||
@@ -96,7 +101,7 @@
|
||||
69. [`InventoryService`](/server/src/main/java/com/ecep/contract/ds/other/service/InventoryService.java) - 库存服务
|
||||
70. [`PermissionService`](/server/src/main/java/com/ecep/contract/ds/other/service/PermissionService.java) - 权限服务
|
||||
|
||||
### cloud模块Service
|
||||
### cloud模块Service(3个)
|
||||
|
||||
71. [`YongYouU8Service`](/server/src/main/java/com/ecep/contract/cloud/u8/YongYouU8Service.java) - 用友U8服务
|
||||
72. [`CloudTycService`](/server/src/main/java/com/ecep/contract/cloud/tyc/CloudTycService.java) - 云天眼查服务
|
||||
@@ -234,6 +239,84 @@
|
||||
- ✅ 方法实现了将InventoryHistoryPriceVo的inventoryId、price、changeDate等属性映射到InventoryHistoryPrice实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.InventoryHistoryPriceVo`包
|
||||
|
||||
#### SalesBillVoucherService
|
||||
- ✅ 已实现`VoableService<SalesBillVoucher, SalesBillVoucherVo>`接口
|
||||
- ✅ 已实现`updateByVo(SalesBillVoucher model, SalesBillVoucherVo vo)`方法
|
||||
- ✅ 方法实现了将SalesBillVoucherVo的refId、code、makerDate、modifyDate、verifierDate、description等属性映射到SalesBillVoucher实体
|
||||
- ✅ 已正确处理company、order、employee、maker、verifier等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.SalesBillVoucherVo`包
|
||||
|
||||
#### ExtendVendorInfoService
|
||||
- ✅ 已实现`VoableService<ExtendVendorInfo, ExtendVendorInfoVo>`接口
|
||||
- ✅ 已实现`updateByVo(ExtendVendorInfo info, ExtendVendorInfoVo vo)`方法
|
||||
- ✅ 方法实现了将ExtendVendorInfoVo的codeSequenceNumber、assignedProvider、prePurchase等属性映射到ExtendVendorInfo实体
|
||||
- ✅ 已正确处理contract、group等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ExtendVendorInfoVo`包
|
||||
|
||||
#### ContractItemService
|
||||
- ✅ 已实现`VoableService<ContractItem, ContractItemVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractItem item, ContractItemVo vo)`方法
|
||||
- ✅ 方法实现了将ContractItemVo的基本属性映射到ContractItem实体
|
||||
- ✅ 已正确处理contract、inventory、creator、updater等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractItemVo`包
|
||||
|
||||
#### ContractTypeService
|
||||
- ✅ 已实现`VoableService<ContractType, ContractTypeVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractType type, ContractTypeVo vo)`方法
|
||||
- ✅ 方法实现了将ContractTypeVo的name、code、catalog、title、direction等属性映射到ContractType实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractTypeVo`包
|
||||
|
||||
#### ContractFileTypeService
|
||||
- ✅ 已实现`VoableService<ContractFileTypeLocal, ContractFileTypeLocalVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractFileTypeLocal model, ContractFileTypeLocalVo vo)`方法
|
||||
- ✅ 方法实现了将ContractFileTypeLocalVo的id、lang、type、value、description、suggestFileName等属性映射到ContractFileTypeLocal实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractFileTypeLocalVo`包
|
||||
|
||||
#### SaleOrdersService
|
||||
- ✅ 已实现`VoableService<SalesOrder, SalesOrderVo>`接口
|
||||
- ✅ 已实现`updateByVo(SalesOrder model, SalesOrderVo vo)`方法
|
||||
- ✅ 方法实现了将SalesOrderVo的code、makerDate、verifierDate、description等属性映射到SalesOrder实体
|
||||
- ✅ 已正确处理contract、employee、maker、verifier等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.SalesOrderVo`包
|
||||
|
||||
#### ContractKindService
|
||||
- ✅ 已实现`VoableService<ContractKind, ContractKindVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractKind model, ContractKindVo vo)`方法
|
||||
- ✅ 方法实现了将ContractKindVo的name、code、title等属性映射到ContractKind实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractKindVo`包
|
||||
|
||||
#### ContractBidVendorService
|
||||
- ✅ 已实现`VoableService<ContractBidVendor, ContractBidVendorVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractBidVendor model, ContractBidVendorVo vo)`方法
|
||||
- ✅ 已正确处理contract、company、quotationSheet等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractBidVendorVo`包
|
||||
|
||||
#### ContractPayPlanService
|
||||
- ✅ 已实现`VoableService<ContractPayPlan, ContractPayPlanVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractPayPlan model, ContractPayPlanVo vo)`方法
|
||||
- ✅ 方法实现了将ContractPayPlanVo的refId、payRatio、payCurrency、payDate、payTerm等属性映射到ContractPayPlan实体
|
||||
- ✅ 已正确处理contract关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractPayPlanVo`包
|
||||
|
||||
#### PurchaseBillVoucherService
|
||||
- ✅ 已实现`VoableService<PurchaseBillVoucher, PurchaseBillVoucherVo>`接口
|
||||
- ✅ 已实现`updateByVo(PurchaseBillVoucher voucher, PurchaseBillVoucherVo vo)`方法
|
||||
- ✅ 方法实现了将PurchaseBillVoucherVo的id、refId、code、companyId、invoiceId、employeeId、makerId、makerDate、modifyDate、verifierId、verifierDate、description等属性映射到PurchaseBillVoucher实体
|
||||
- ✅ 已正确处理company、invoice、employee、maker、verifier等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.PurchaseBillVoucherVo`包
|
||||
|
||||
#### PurchaseOrderItemService
|
||||
- ✅ 已实现`VoableService<PurchaseOrderItem, PurchaseOrderItemVo>`接口
|
||||
- ✅ 已实现`updateByVo(PurchaseOrderItem item, PurchaseOrderItemVo vo)`方法
|
||||
- ✅ 方法实现了将PurchaseOrderItemVo的id、code、name、quantity、price等属性映射到PurchaseOrderItem实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.PurchaseOrderItemVo`包
|
||||
|
||||
#### SalesOrderItemService
|
||||
- ✅ 已实现`VoableService<SalesOrderItem, SalesOrderItemVo>`接口
|
||||
- ✅ 已实现`updateByVo(SalesOrderItem item, SalesOrderItemVo vo)`方法
|
||||
- ✅ 方法实现了将SalesOrderItemVo的id、code、name、quantity、price等属性映射到SalesOrderItem实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.SalesOrderItemVo`包
|
||||
|
||||
#### CompanyBlackReasonService
|
||||
- ✅ 已实现`VoableService<CompanyBlackReason, CompanyBlackReasonVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyBlackReason reason, CompanyBlackReasonVo vo)`方法
|
||||
@@ -243,7 +326,8 @@
|
||||
#### CompanyCustomerEntityService
|
||||
- ✅ 已实现`VoableService<CompanyCustomerEntity, CompanyCustomerEntityVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyCustomerEntity entity, CompanyCustomerEntityVo vo)`方法
|
||||
- ✅ 方法实现了将CompanyCustomerEntityVo的companyCustomerId、entityType、entityId等属性映射到CompanyCustomerEntity实体
|
||||
- ✅ 方法实现了将CompanyCustomerEntityVo的name、abbName、code等基本属性映射到CompanyCustomerEntity实体
|
||||
- ✅ 已正确处理customer、catalog、creator、modifier等关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.CompanyCustomerEntityVo`包
|
||||
|
||||
#### CompanyFileTypeService
|
||||
@@ -264,225 +348,260 @@
|
||||
- ✅ 方法实现了将PurchaseBillVoucherItemVo的id、refId、quantity、price等属性映射到PurchaseBillVoucherItem实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.PurchaseBillVoucherItemVo`包
|
||||
|
||||
### 尚未实现VoableService接口的Service列表
|
||||
#### ContractFileService
|
||||
- ✅ 已实现`VoableService<ContractFile, ContractFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractFile file, ContractFileVo vo)`方法
|
||||
- ✅ 方法实现了将ContractFileVo的id、contractId、type、fileName、applyDate、description等属性映射到ContractFile实体
|
||||
- ✅ 已正确处理contract关联实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractFileVo`包
|
||||
|
||||
经过重新检查,以下48个Service尚未实现`VoableService<M, Vo>`接口:
|
||||
#### ContractCatalogService
|
||||
- ✅ 已实现`VoableService<ContractCatalog, ContractCatalogVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractCatalog catalog, ContractCatalogVo vo)`方法
|
||||
- ✅ 方法实现了将ContractCatalogVo的id、code、name、path、parent、useYear等属性映射到ContractCatalog实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractCatalogVo`包
|
||||
|
||||
### contract模块(11个)
|
||||
1. **ContractGroupService** - 合同组服务
|
||||
- ❌ 未实现`VoableService<ContractGroup, ContractGroupVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractGroup group, ContractGroupVo vo)`方法
|
||||
#### ContractGroupService
|
||||
- ✅ 已实现`VoableService<ContractGroup, ContractGroupVo>`接口
|
||||
- ✅ 已实现`updateByVo(ContractGroup group, ContractGroupVo vo)`方法
|
||||
- ✅ 方法实现了将ContractGroupVo的id、name、code、title等属性映射到ContractGroup实体
|
||||
- ✅ 已正确导入`com.ecep.contract.service.VoableService`和`com.ecep.contract.vo.ContractGroupVo`包
|
||||
|
||||
2. **ContractFileService** - 合同文件服务
|
||||
- ❌ 未实现`VoableService<ContractFile, ContractFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractFile file, ContractFileVo vo)`方法
|
||||
### VoableService接口实现状态分析
|
||||
|
||||
3. **SalesBillVoucherService** - 销售票据凭证服务
|
||||
- ❌ 未实现`VoableService<SalesBillVoucher, SalesBillVoucherVo>`接口
|
||||
- ❌ 未实现`updateByVo(SalesBillVoucher voucher, SalesBillVoucherVo vo)`方法
|
||||
经过重新检查,contract、company、customer、project、vendor和other模块的所有Service已实现`VoableService<M, Vo>`接口,仅cloud模块的3个Service尚未实现,具体参考后续各模块的实现状态分析
|
||||
|
||||
4. **ContractCatalogService** - 合同目录服务
|
||||
- ❌ 未实现`VoableService<ContractCatalog, ContractCatalogVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractCatalog catalog, ContractCatalogVo vo)`方法
|
||||
### contract模块(0个未实现)
|
||||
> 所有contract模块Service已实现VoableService接口
|
||||
|
||||
5. **PurchaseOrderItemService** - 采购订单项服务
|
||||
- ❌ 未实现`VoableService<PurchaseOrderItem, PurchaseOrderItemVo>`接口
|
||||
- ❌ 未实现`updateByVo(PurchaseOrderItem item, PurchaseOrderItemVo vo)`方法
|
||||
### contract模块已实现的Service
|
||||
1. **PurchaseOrdersService** - 采购订单服务
|
||||
- ✅ 已实现`VoableService<PurchaseOrder, PurchaseOrderVo>`接口
|
||||
- ✅ 已实现`updateByVo(PurchaseOrder order, PurchaseOrderVo vo)`方法
|
||||
|
||||
6. **PurchaseBillVoucherService** - 采购票据凭证服务
|
||||
- ❌ 未实现`VoableService<PurchaseBillVoucher, PurchaseBillVoucherVo>`接口
|
||||
- ❌ 未实现`updateByVo(PurchaseBillVoucher voucher, PurchaseBillVoucherVo vo)`方法
|
||||
|
||||
7. **ExtendVendorInfoService** - 扩展供应商信息服务
|
||||
- ❌ 未实现`VoableService<ExtendVendorInfo, ExtendVendorInfoVo>`接口
|
||||
- ❌ 未实现`updateByVo(ExtendVendorInfo info, ExtendVendorInfoVo vo)`方法
|
||||
|
||||
8. **SalesOrderItemService** - 销售订单项服务
|
||||
- ❌ 未实现`VoableService<SalesOrderItem, SalesOrderItemVo>`接口
|
||||
- ❌ 未实现`updateByVo(SalesOrderItem item, SalesOrderItemVo vo)`方法
|
||||
|
||||
9. **ContractItemService** - 合同项目服务
|
||||
- ❌ 未实现`VoableService<ContractItem, ContractItemVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractItem item, ContractItemVo vo)`方法
|
||||
|
||||
10. **ContractTypeService** - 合同类型服务
|
||||
- ❌ 未实现`VoableService<ContractType, ContractTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractType type, ContractTypeVo vo)`方法
|
||||
|
||||
11. **PurchaseOrdersService** - 采购订单服务
|
||||
- ❌ 未实现`VoableService<PurchaseOrders, PurchaseOrdersVo>`接口
|
||||
- ❌ 未实现`updateByVo(PurchaseOrders orders, PurchaseOrdersVo vo)`方法
|
||||
|
||||
12. **ContractFileTypeService** - 合同文件类型服务
|
||||
- ❌ 未实现`VoableService<ContractFileType, ContractFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractFileType fileType, ContractFileTypeVo vo)`方法
|
||||
|
||||
13. **SaleOrdersService** - 销售订单服务
|
||||
- ❌ 未实现`VoableService<SaleOrders, SaleOrdersVo>`接口
|
||||
- ❌ 未实现`updateByVo(SaleOrders orders, SaleOrdersVo vo)`方法
|
||||
|
||||
14. **ContractKindService** - 合同种类服务
|
||||
- ❌ 未实现`VoableService<ContractKind, ContractKindVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractKind kind, ContractKindVo vo)`方法
|
||||
|
||||
15. **ContractBidVendorService** - 合同投标供应商服务
|
||||
- ❌ 未实现`VoableService<ContractBidVendor, ContractBidVendorVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractBidVendor vendor, ContractBidVendorVo vo)`方法
|
||||
|
||||
16. **ContractPayPlanService** - 合同付款计划服务
|
||||
- ❌ 未实现`VoableService<ContractPayPlan, ContractPayPlanVo>`接口
|
||||
- ❌ 未实现`updateByVo(ContractPayPlan plan, ContractPayPlanVo vo)`方法
|
||||
|
||||
### company模块(8个)
|
||||
### company模块 (0个未实现)
|
||||
1. **InvoiceService** - 发票服务
|
||||
- ❌ 未实现`VoableService<Invoice, InvoiceVo>`接口
|
||||
- ❌ 未实现`updateByVo(Invoice invoice, InvoiceVo vo)`方法
|
||||
- ✅ 已实现`VoableService<Invoice, InvoiceVo>`接口
|
||||
- ✅ 已实现`updateByVo(Invoice invoice, InvoiceVo vo)`方法
|
||||
- 实体类`Invoice`已实现`Voable<InvoiceVo>`接口
|
||||
- VO类`InvoiceVo`已创建
|
||||
|
||||
2. **CompanyContactService** - 公司联系人服务
|
||||
- ❌ 未实现`VoableService<CompanyContact, CompanyContactVo>`接口
|
||||
- ❌ 未实现`updateByVo(CompanyContact contact, CompanyContactVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CompanyContact, CompanyContactVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyContact contact, CompanyContactVo vo)`方法
|
||||
- 实体类`CompanyContact`已实现`Voable<CompanyContactVo>`接口
|
||||
- VO类`CompanyContactVo`已创建
|
||||
|
||||
3. **CompanyBankAccountService** - 公司银行账户服务
|
||||
- ❌ 未实现`VoableService<CompanyBankAccount, CompanyBankAccountVo>`接口
|
||||
- ❌ 未实现`updateByVo(CompanyBankAccount account, CompanyBankAccountVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CompanyBankAccount, CompanyBankAccountVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyBankAccount account, CompanyBankAccountVo vo)`方法
|
||||
- 实体类`CompanyBankAccount`已实现`Voable<CompanyBankAccountVo>`接口
|
||||
- VO类`CompanyBankAccountVo`已创建
|
||||
|
||||
4. **CompanyFileService** - 公司文件服务
|
||||
- ❌ 未实现`VoableService<CompanyFile, CompanyFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(CompanyFile file, CompanyFileVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CompanyFile, CompanyFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyFile file, CompanyFileVo vo)`方法
|
||||
- 实体类`CompanyFile`已实现`Voable<CompanyFileVo>`接口
|
||||
- VO类`CompanyFileVo`已创建
|
||||
|
||||
### customer模块(5个)
|
||||
### customer模块(0个未实现)
|
||||
1. **CompanyCustomerFileTypeService** - 公司客户文件类型服务
|
||||
- ❌ 未实现`VoableService<CompanyCustomerFileType, CompanyCustomerFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(CompanyCustomerFileType fileType, CompanyCustomerFileTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CompanyCustomerFileTypeLocal, CompanyCustomerFileTypeLocalVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyCustomerFileTypeLocal fileType, CompanyCustomerFileTypeLocalVo vo)`方法
|
||||
- 客户端已实现`QueryService<CustomerFileTypeLocalVo, CompanyCustomerFileTypeLocalViewModel>`
|
||||
- 实现细节:映射了type、lang、value等基本属性
|
||||
|
||||
2. **CustomerFileTypeService** - 客户文件类型服务
|
||||
- ❌ 未实现`VoableService<CustomerFileType, CustomerFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(CustomerFileType fileType, CustomerFileTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CustomerFileTypeLocal, CustomerFileTypeLocalVo>`接口
|
||||
- ✅ 已实现`updateByVo(CustomerFileTypeLocal fileType, CustomerFileTypeLocalVo vo)`方法
|
||||
- 实现细节:映射了type、lang、value等基本属性
|
||||
|
||||
3. **CustomerCatalogService** - 客户目录服务
|
||||
- ❌ 未实现`VoableService<CustomerCatalog, CustomerCatalogVo>`接口
|
||||
- ❌ 未实现`updateByVo(CustomerCatalog catalog, CustomerCatalogVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CustomerCatalog, CustomerCatalogVo>`接口
|
||||
- ✅ 已实现`updateByVo(CustomerCatalog catalog, CustomerCatalogVo vo)`方法
|
||||
- VO类`CustomerCatalogVo`已创建(标记为已更新)
|
||||
- 实现细节:映射了code、name、description等基本属性
|
||||
|
||||
4. **CompanyCustomerEvaluationFormFileService** - 公司客户评估表单文件服务
|
||||
- ❌ 未实现`VoableService<CompanyCustomerEvaluationFormFile, CompanyCustomerEvaluationFormFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(CompanyCustomerEvaluationFormFile file, CompanyCustomerEvaluationFormFileVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CompanyCustomerEvaluationFormFile, CompanyCustomerEvaluationFormFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyCustomerEvaluationFormFile file, CompanyCustomerEvaluationFormFileVo vo)`方法
|
||||
- 实现细节:映射了catalog、level、creditLevel、score1-5、scoreTemplateVersion等基本属性,以及通过SpringApp.getBean获取CompanyCustomerFileService处理customerFile关联实体
|
||||
- 实体类`CompanyCustomerEvaluationFormFile`已实现`Voable<CompanyCustomerEvaluationFormFileVo>`接口
|
||||
- 客户端已实现`QueryService<CompanyCustomerEvaluationFormFileVo, CompanyCustomerEvaluationFormFileViewModel>`
|
||||
|
||||
5. **CompanyCustomerFileService** - 公司客户文件服务
|
||||
- ❌ 未实现`VoableService<CompanyCustomerFile, CompanyCustomerFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(CompanyCustomerFile file, CompanyCustomerFileVo vo)`方法
|
||||
- ✅ 已实现`VoableService<CompanyCustomerFile, CompanyCustomerFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(CompanyCustomerFile file, CompanyCustomerFileVo vo)`方法
|
||||
- 方法实现了将CompanyCustomerFileVo的filePath、type、signDate、valid等属性映射到CompanyCustomerFile实体
|
||||
- 已正确处理customer关联实体
|
||||
- 实体类`CompanyCustomerFile`已实现`Voable<CompanyCustomerFileVo>`接口
|
||||
- 客户端已实现`QueryService<CompanyCustomerFileVo, CompanyCustomerFileViewModel>`
|
||||
|
||||
### project模块(12个)
|
||||
### project模块(0个未实现)
|
||||
1. **ProjectCostService** - 项目成本服务
|
||||
- ❌ 未实现`VoableService<ProjectCost, ProjectCostVo>`接口
|
||||
- ❌ 未实现`updateByVo(ProjectCost cost, ProjectCostVo vo)`方法
|
||||
- ✅ 已实现`VoableService<ProjectCost, ProjectCostVo>`接口
|
||||
- ✅ 已实现`updateByVo(ProjectCost cost, ProjectCostVo vo)`方法
|
||||
- 方法实现了将ProjectCostVo的description、version等属性映射到ProjectCost实体
|
||||
- 已正确处理project、contract、applicant、authorizer等关联实体
|
||||
- 实体类`ProjectCost`已实现`Voable<ProjectCostVo>`接口
|
||||
- VO类`ProjectCostVo`已创建
|
||||
|
||||
2. **DeliverySignMethodService** - 交付签收方法服务
|
||||
- ❌ 未实现`VoableService<DeliverySignMethod, DeliverySignMethodVo>`接口
|
||||
- ❌ 未实现`updateByVo(DeliverySignMethod method, DeliverySignMethodVo vo)`方法
|
||||
- ✅ 已实现`VoableService<DeliverySignMethod, DeliverySignMethodVo>`接口
|
||||
- ✅ 已实现`updateByVo(DeliverySignMethod method, DeliverySignMethodVo vo)`方法,映射name、code、description基本属性,处理saleType关联实体转换
|
||||
- 实体类`DeliverySignMethod`已实现`Voable<DeliverySignMethodVo>`接口
|
||||
- VO类`DeliverySignMethodVo`已创建
|
||||
|
||||
3. **ProjectFileTypeService** - 项目文件类型服务
|
||||
- ❌ 未实现`VoableService<ProjectFileType, ProjectFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(ProjectFileType fileType, ProjectFileTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<ProjectFileTypeLocal, ProjectFileTypeLocalVo>`接口
|
||||
- ✅ 已实现`updateByVo(ProjectFileTypeLocal fileType, ProjectFileTypeLocalVo vo)`方法,映射type、lang、value基本属性
|
||||
- VO类`ProjectFileTypeLocalVo`已创建
|
||||
|
||||
4. **ProjectQuotationService** - 项目报价服务
|
||||
- ❌ 未实现`VoableService<ProjectQuotation, ProjectQuotationVo>`接口
|
||||
- ❌ 未实现`updateByVo(ProjectQuotation quotation, ProjectQuotationVo vo)`方法
|
||||
- ✅ 已实现`VoableService<ProjectQuotation, ProjectQuotationVo>`接口
|
||||
- ✅ 已实现`updateByVo(ProjectQuotation quotation, ProjectQuotationVo vo)`方法,映射level、standardPayWay等基本属性,处理project、applicant、authorizer关联实体转换
|
||||
- 实体类`ProjectQuotation`已实现`Voable<ProjectQuotationVo>`接口
|
||||
- VO类`ProjectQuotationVo`已创建
|
||||
|
||||
5. **ProjectBidService** - 项目投标服务
|
||||
- ❌ 未实现`VoableService<ProjectBid, ProjectBidVo>`接口
|
||||
- ❌ 未实现`updateByVo(ProjectBid bid, ProjectBidVo vo)`方法
|
||||
- ✅ 已实现`VoableService<ProjectBid, ProjectBidVo>`接口
|
||||
- ✅ 已实现`updateByVo(ProjectBid bid, ProjectBidVo vo)`方法
|
||||
- 实体类`ProjectBid`已实现`Voable<ProjectBidVo>`接口
|
||||
- VO类`ProjectBidVo`已创建
|
||||
|
||||
6. **ProjectSaleTypeRequireFileTypeService** - 项目销售类型要求文件类型服务
|
||||
- ❌ 未实现`VoableService<ProjectSaleTypeRequireFileType, ProjectSaleTypeRequireFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(ProjectSaleTypeRequireFileType fileType, ProjectSaleTypeRequireFileTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<ProjectSaleTypeRequireFileType, ProjectSaleTypeRequireFileTypeVo>`接口
|
||||
- ✅ 已实现`updateByVo(ProjectSaleTypeRequireFileType fileType, ProjectSaleTypeRequireFileTypeVo vo)`方法
|
||||
|
||||
7. **ProjectFileService** - 项目文件服务
|
||||
- ❌ 未实现`VoableService<ProjectFile, ProjectFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(ProjectFile file, ProjectFileVo vo)`方法
|
||||
- ✅ 已实现`VoableService<ProjectFile, ProjectFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(ProjectFile file, ProjectFileVo vo)`方法
|
||||
|
||||
### vendor模块(10个)
|
||||
### vendor模块(0个未实现)
|
||||
1. **VendorTypeService** - 供应商类型服务
|
||||
- ❌ 未实现`VoableService<VendorType, VendorTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorType type, VendorTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorTypeLocal, VendorTypeLocalVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorTypeLocal entity, VendorTypeLocalVo vo)`方法
|
||||
- ✅ 方法实现了将VendorTypeLocalVo的id、lang、type、value属性映射到VendorTypeLocal实体
|
||||
|
||||
2. **VendorApprovedFileService** - 供应商批准文件服务
|
||||
- ❌ 未实现`VoableService<VendorApprovedFile, VendorApprovedFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorApprovedFile file, VendorApprovedFileVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorApprovedFile, VendorApprovedFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorApprovedFile entity, VendorApprovedFileVo vo)`方法
|
||||
- ✅ 方法实现了将VendorApprovedFileVo的id、fileName、signDate、description属性映射到VendorApprovedFile实体
|
||||
- ✅ 方法处理了listId到VendorApproved关联实体的转换
|
||||
- 实体类`VendorApprovedFile`已实现`Voable<VendorApprovedFileVo>`接口
|
||||
|
||||
3. **VendorEntityService** - 供应商实体服务
|
||||
- ❌ 未实现`VoableService<VendorEntity, VendorEntityVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorEntity entity, VendorEntityVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorEntity, VendorEntityVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorEntity entity, VendorEntityVo vo)`方法
|
||||
- VO类`CompanyVendorEntityVo`已创建
|
||||
|
||||
4. **VendorApprovedItemService** - 供应商批准项服务
|
||||
- ❌ 未实现`VoableService<VendorApprovedItem, VendorApprovedItemVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorApprovedItem item, VendorApprovedItemVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorApprovedItem, VendorApprovedItemVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorApprovedItem entity, VendorApprovedItemVo vo)`方法
|
||||
- ✅ 方法实现了将VendorApprovedItemVo的id、vendorName、type、description属性映射到VendorApprovedItem实体
|
||||
- ✅ 方法处理了listId到VendorApproved、vendorId到Vendor的关联实体转换
|
||||
- 实体类`VendorApprovedItem`已实现`Voable<VendorApprovedItemVo>`接口
|
||||
- VO类`VendorApprovedItemVo`已创建
|
||||
|
||||
5. **VendorGroupRequireFileTypeService** - 供应商组要求文件类型服务
|
||||
- ❌ 未实现`VoableService<VendorGroupRequireFileType, VendorGroupRequireFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorGroupRequireFileType fileType, VendorGroupRequireFileTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorGroupRequireFileType, VendorGroupRequireFileTypeVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorGroupRequireFileType entity, VendorGroupRequireFileTypeVo vo)`方法
|
||||
- ✅ 方法实现了将VendorGroupRequireFileTypeVo的id、fileType、frequency属性映射到VendorGroupRequireFileType实体
|
||||
- ✅ 方法处理了groupId到VendorGroup的关联实体转换
|
||||
- 实体类`VendorGroupRequireFileType`已实现`Voable<VendorGroupRequireFileTypeVo>`接口
|
||||
- VO类`VendorGroupRequireFileTypeVo`已创建
|
||||
|
||||
6. **VendorFileTypeService** - 供应商文件类型服务
|
||||
- ❌ 未实现`VoableService<VendorFileType, VendorFileTypeVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorFileType fileType, VendorFileTypeVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorFileTypeLocal, VendorFileTypeLocalVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorFileTypeLocal entity, VendorFileTypeLocalVo vo)`方法
|
||||
- ✅ 方法实现了将VendorFileTypeLocalVo的id、lang、value、type属性映射到VendorFileTypeLocal实体
|
||||
- 实体类`VendorFileTypeLocal`已实现`Voable<VendorFileTypeLocalVo>`接口
|
||||
- VO类`VendorFileTypeLocalVo`已创建
|
||||
|
||||
7. **VendorGroupService** - 供应商组服务
|
||||
- ❌ 未实现`VoableService<VendorGroup, VendorGroupVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorGroup group, VendorGroupVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorGroup, VendorGroupVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorGroupVo vo)`方法
|
||||
- 方法实现了实体和VO的空值检查,以及id、name、code、description、active、priceComparison、requireQuotationSheetForBid属性的映射
|
||||
- 实体类`VendorGroup`已实现`Voable<VendorGroupVo>`接口
|
||||
- VO类`VendorGroupVo`已创建
|
||||
|
||||
8. **VendorApprovedService** - 供应商批准服务
|
||||
- ❌ 未实现`VoableService<VendorApproved, VendorApprovedVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorApproved approved, VendorApprovedVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorApproved, VendorApprovedVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorApprovedVo vo)`方法
|
||||
- 方法实现了实体和VO的空值检查,以及title、publishDate、path、description属性的映射(id属性不更新)
|
||||
- 实体类`VendorApproved`已实现`Voable<VendorApprovedVo>`接口
|
||||
- VO类`VendorApprovedVo`已创建
|
||||
|
||||
9. **VendorCatalogService** - 供应商目录服务
|
||||
- ❌ 未实现`VoableService<VendorCatalog, VendorCatalogVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorCatalog catalog, VendorCatalogVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorCatalog, VendorCatalogVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorCatalogVo vo)`方法
|
||||
- 方法实现了实体和VO的空值检查,以及name、code、type属性的映射(id属性不更新)
|
||||
- 实体类`VendorCatalog`已实现`Voable<VendorCatalogVo>`接口
|
||||
- VO类`VendorCatalogVo`已创建
|
||||
|
||||
10. **VendorFileService** - 供应商文件服务
|
||||
- ❌ 未实现`VoableService<VendorFile, VendorFileVo>`接口
|
||||
- ❌ 未实现`updateByVo(VendorFile file, VendorFileVo vo)`方法
|
||||
- ✅ 已实现`VoableService<VendorFile, VendorFileVo>`接口
|
||||
- ✅ 已实现`updateByVo(VendorFileVo vo)`方法
|
||||
- 方法实现了实体和VO的空值检查,以及type、filePath、editFilePath、signDate、valid属性的映射(id属性不更新)
|
||||
- 实体类`VendorFile`已实现`Voable<VendorFileVo>`接口
|
||||
- VO类`VendorFileVo`已创建
|
||||
|
||||
### other模块(2个)
|
||||
### other模块(0个未实现)
|
||||
1. **EmployeeLoginHistoryService** - 员工登录历史服务
|
||||
- ❌ 未实现`VoableService<EmployeeLoginHistory, EmployeeLoginHistoryVo>`接口
|
||||
- ❌ 未实现`updateByVo(EmployeeLoginHistory history, EmployeeLoginHistoryVo vo)`方法
|
||||
- ✅ 已实现`VoableService<EmployeeLoginHistory, EmployeeLoginHistoryVo>`接口
|
||||
- ✅ 已实现`updateByVo(EmployeeLoginHistoryVo vo)`方法
|
||||
- 方法实现了实体和VO的空值检查,以及employee、ip、mac、loginTime、activeTime属性的映射(id属性不更新)
|
||||
- 实体类`EmployeeLoginHistory`已实现`Voable<EmployeeLoginHistoryVo>`接口
|
||||
- VO类`EmployeeLoginHistoryVo`已创建
|
||||
|
||||
2. **EmployeeAuthBindService** - 员工授权绑定服务
|
||||
- ❌ 未实现`VoableService<EmployeeAuthBind, EmployeeAuthBindVo>`接口
|
||||
- ❌ 未实现`updateByVo(EmployeeAuthBind bind, EmployeeAuthBindVo vo)`方法
|
||||
- ✅ 已实现`VoableService<EmployeeAuthBind, EmployeeAuthBindVo>`接口
|
||||
- ✅ 已实现`updateByVo(EmployeeAuthBind model, EmployeeAuthBindVo vo)`方法
|
||||
- 方法实现了将EmployeeAuthBindVo的ip、mac、createTime、updateTime、description属性映射到EmployeeAuthBind实体
|
||||
- employee和updater属性通过ID查找对应的实体
|
||||
- 实体类`EmployeeAuthBind`已实现`Voable<EmployeeAuthBindVo>`接口
|
||||
- VO类`EmployeeAuthBindVo`已创建
|
||||
|
||||
### cloud模块(3个)
|
||||
1. **YongYouU8Service** - 用友U8服务
|
||||
- ❌ 未实现`VoableService<YongYouU8, YongYouU8Vo>`接口
|
||||
- ❌ 未实现`updateByVo(YongYouU8 u8, YongYouU8Vo vo)`方法
|
||||
- ❌ 未实现`VoableService<CloudYu, CloudYuVo>`接口(实际实体类为CloudYu)
|
||||
- ❌ 未实现`updateByVo(CloudYu cloudYu, CloudYuVo vo)`方法
|
||||
- ✅ 实体类`CloudYu`已实现`Voable<CloudYuVo>`接口
|
||||
- ✅ `CloudYuVo`类已创建
|
||||
|
||||
2. **CloudTycService** - 云天眼查服务
|
||||
- ❌ 未实现`VoableService<CloudTyc, CloudTycVo>`接口
|
||||
- ❌ 未实现`updateByVo(CloudTyc tyc, CloudTycVo vo)`方法
|
||||
- ✅ 实体类`CloudTyc`已实现`Voable<CloudTycVo>`接口
|
||||
- ✅ `CloudTycVo`类已创建
|
||||
|
||||
3. **CloudRkService** - 云瑞科服务
|
||||
- ❌ 未实现`VoableService<CloudRk, CloudRkVo>`接口
|
||||
- ❌ 未实现`updateByVo(CloudRk rk, CloudRkVo vo)`方法
|
||||
- ✅ 实体类`CloudRk`已实现`Voable<CloudRkVo>`接口
|
||||
- ✅ `CloudRkVo`类已创建
|
||||
|
||||
## 已完成的实现修改
|
||||
|
||||
通过对server模块下所有实现了[`IEntityService`](/server/src/main/java/com/ecep/contract/IEntityService.java)接口的73个Service的分析,我们发现:
|
||||
|
||||
1. **已实现VoableService接口的Service**:
|
||||
- 25个Service已成功实现`VoableService<M, Vo>`接口
|
||||
- 这些Service包括:ContractService、CompanyService、CompanyCustomerService、ProjectService、VendorService、BankService、DepartmentService、EmployeeService、FunctionService、ProjectCostItemService、EmployeeRoleService、PermissionService、ProductTypeService、ProjectFundPlanService、ProjectIndustryService、ProjectSaleTypeService、ProjectTypeService、ProductUsageService、CustomerSatisfactionSurveyService、InventoryService、InventoryHistoryPriceService、CompanyBlackReasonService、CompanyCustomerEntityService、CompanyFileTypeService、CompanyOldNameService和PurchaseBillVoucherItemService
|
||||
- 所有Service已经正确实现了`updateByVo`方法,能够将VO对象的数据映射到实体对象中
|
||||
- 已完成的实现修改已经通过Maven编译验证,确保了代码的正确性和稳定性
|
||||
- 70个Service已成功实现`VoableService<M, Vo>`接口(contract、company、customer、project、vendor和other模块的所有Service)
|
||||
- 所有Service已经正确实现了`updateByVo`方法,能够将Vo对象的数据映射到实体对象中
|
||||
- 仅有cloud模块的3个Service尚未实现
|
||||
|
||||
2. **在实现过程中修复的问题**:
|
||||
- 移除不存在的ServiceException导入
|
||||
- 调整SpringApp导入路径
|
||||
- 修复ProjectFundPlan.java中调用不存在的setProjectName方法的问题
|
||||
- 为PurchaseBillVoucherService添加VoableService接口实现和updateByVo方法
|
||||
- 为ContractFileService添加VoableService接口实现和updateByVo方法,并完善空值检查
|
||||
- 为ContractCatalogService添加VoableService接口实现和updateByVo方法
|
||||
- 为ContractGroupService添加VoableService接口实现和updateByVo方法
|
||||
|
||||
## 需要进行的实现修改
|
||||
|
||||
以下48个Service需要实现`VoableService<M, Vo>`接口:
|
||||
|
||||
所有未实现的Service需要按照以下规范进行实现:
|
||||
所有未实现的Service需要实现`com.ecep.contract.service.VoableService<M, Vo>`接口,按照以下规范进行实现:
|
||||
|
||||
1. 添加`implements VoableService<M, Vo>`接口声明
|
||||
2. 实现`updateByVo(M model, Vo vo)`方法,将VO对象的属性映射到实体对象中
|
||||
@@ -490,21 +609,22 @@
|
||||
4. 确保正确导入`com.ecep.contract.service.VoableService`和对应的VO类包
|
||||
5. 如果实体类有@Version注解的字段,在updateByVo方法中检查版本号一致性
|
||||
|
||||
> 注:根据[`create_vo.md`](/docs/task/create_vo.md)文档中的要求,所有Server模块的Service都需要继承`VoableService<M, Vo>`接口。目前还有48个Service未实现该接口,需要尽快完成实现以满足系统架构要求。
|
||||
|
||||
## 关于 `updateByVo` 方法实现规范
|
||||
|
||||
在实现`updateByVo`方法时,请遵循以下规范:
|
||||
|
||||
- Service 如果缺少`updateByVo`方法,请添加该方法 `void updateByVo(M model, Vo vo)`,并确保该方法将VO对象中的数据映射到实体对象中
|
||||
- 如果实体类有 @Version 注解的字段,如 version 字段,在 updateByVo 方法中,判断版本号是否一致,不一致则打印警告日志
|
||||
- 如果Vo的属性转换时可以使用 `SpringApp.getBean( Service.class ).findById(id)` 方法来转换为对象
|
||||
- Vo的属性转换时可以使用 `SpringApp.getBean().findById(id)` 方法来转换为对象
|
||||
- id 属性不用更新
|
||||
- 方法的返回类型为 void
|
||||
- 确保正确处理关联实体的映射逻辑
|
||||
- 确保所有必要的包都已正确导入
|
||||
- 参考 [`ContractService`](/server/src/main/java/com/ecep/contract/ds/contract/service/ContractService.java) 的 updateByVo 方法实现
|
||||
|
||||
## 结论
|
||||
|
||||
通过本次分析,我们确认了Contract-Manager项目中Server模块Service对VoableService接口的实现状况。目前已有25个Service成功实现了该接口,并正确实现了updateByVo方法,还有48个Service尚未实现。
|
||||
通过本次分析,我们确认了Contract-Manager项目中Server模块Service对VoableService接口的实现状况。目前已有70个Service成功实现了该接口,并正确实现了updateByVo方法,还有3个Service尚未实现(均在cloud模块中)。
|
||||
|
||||
这些修改将确保:
|
||||
1. 所有Service都符合系统架构要求,支持Vo对象到实体对象的转换
|
||||
@@ -512,4 +632,4 @@
|
||||
3. 为前端UI提供更好的数据绑定和更新支持
|
||||
4. 使系统整体设计更加统一,便于后续扩展和维护
|
||||
|
||||
建议尽快完成剩余48个Service的实现,以确保系统架构的完整性和一致性。
|
||||
建议尽快完成剩余3个Service的实现(cloud模块中的YongYouU8Service、CloudTycService和CloudRkService),以确保系统架构的完整性和一致性。
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.ecep.contract;
|
||||
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
public abstract class EntityService<T, ID> {
|
||||
|
||||
@@ -19,7 +19,6 @@ public abstract class EntityService<T, ID> {
|
||||
|
||||
public abstract T createNewEntity();
|
||||
|
||||
|
||||
public long count() {
|
||||
return getRepository().count();
|
||||
}
|
||||
@@ -36,14 +35,13 @@ public abstract class EntityService<T, ID> {
|
||||
|
||||
public Page<T> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<T> 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());
|
||||
}
|
||||
spec = SpecificationUtils.and(spec, buildParameterSpecification(paramsNode));
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
|
||||
public Page<T> findAll(Specification<T> spec, Pageable pageable) {
|
||||
return getRepository().findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.BlackReasonType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.cloud.CloudInfo;
|
||||
import com.ecep.contract.ds.company.repository.CompanyBlackReasonRepository;
|
||||
import com.ecep.contract.ds.company.repository.CompanyOldNameRepository;
|
||||
@@ -36,9 +37,11 @@ import com.ecep.contract.ds.other.service.SysConfService;
|
||||
import com.ecep.contract.model.CloudRk;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyBlackReason;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.HttpJsonUtils;
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import com.ecep.contract.vo.CloudRkVo;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
@@ -52,7 +55,7 @@ import lombok.Data;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "cloud-rk")
|
||||
public class CloudRkService implements IEntityService<CloudRk> {
|
||||
public class CloudRkService implements IEntityService<CloudRk>, VoableService<CloudRk, CloudRkVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CloudRkService.class);
|
||||
|
||||
public static final String KEY_PROXY = "cloud.rk.proxy";
|
||||
@@ -375,4 +378,68 @@ public class CloudRkService implements IEntityService<CloudRk> {
|
||||
}
|
||||
cloudRKRepository.saveAll(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CloudRk cloudRk, CloudRkVo vo) {
|
||||
if (cloudRk == null || vo == null) {
|
||||
throw new IllegalArgumentException("CloudRk and CloudRkVo cannot be null");
|
||||
}
|
||||
|
||||
// 更新基本属性
|
||||
if (vo.getCloudId() != null) {
|
||||
cloudRk.setCloudId(vo.getCloudId());
|
||||
}
|
||||
|
||||
cloudRk.setAutoUpdate(vo.isAutoUpdate());
|
||||
cloudRk.setUpdateDays(vo.getUpdateDays());
|
||||
|
||||
if (vo.getCustomerGrade() != null) {
|
||||
cloudRk.setCustomerGrade(vo.getCustomerGrade());
|
||||
}
|
||||
if (vo.getCustomerScore() != null) {
|
||||
cloudRk.setCustomerScore(vo.getCustomerScore());
|
||||
}
|
||||
if (vo.getCustomerDescription() != null) {
|
||||
cloudRk.setCustomerDescription(vo.getCustomerDescription());
|
||||
}
|
||||
if (vo.getVendorGrade() != null) {
|
||||
cloudRk.setVendorGrade(vo.getVendorGrade());
|
||||
}
|
||||
if (vo.getVendorScore() != null) {
|
||||
cloudRk.setVendorScore(vo.getVendorScore());
|
||||
}
|
||||
if (vo.getVendorDescription() != null) {
|
||||
cloudRk.setVendorDescription(vo.getVendorDescription());
|
||||
}
|
||||
if (vo.getRank() != null) {
|
||||
cloudRk.setRank(vo.getRank());
|
||||
}
|
||||
if (vo.getRankDescription() != null) {
|
||||
cloudRk.setRankDescription(vo.getRankDescription());
|
||||
}
|
||||
if (vo.getCloudLatest() != null) {
|
||||
cloudRk.setCloudLatest(vo.getCloudLatest());
|
||||
}
|
||||
if (vo.getCloudBlackListUpdated() != null) {
|
||||
cloudRk.setCloudBlackListUpdated(vo.getCloudBlackListUpdated());
|
||||
}
|
||||
if (vo.getCloudEntUpdate() != null) {
|
||||
cloudRk.setCloudEntUpdate(vo.getCloudEntUpdate());
|
||||
}
|
||||
if (vo.getDescription() != null) {
|
||||
cloudRk.setDescription(vo.getDescription());
|
||||
}
|
||||
if (vo.getLatestUpdate() != null) {
|
||||
cloudRk.setLatestUpdate(vo.getLatestUpdate());
|
||||
}
|
||||
|
||||
// 更新关联的公司
|
||||
if (vo.getCompanyId() != null) {
|
||||
CompanyService companyService = SpringApp.getBean(CompanyService.class);
|
||||
Company company = companyService.findById(vo.getCompanyId());
|
||||
if (company != null) {
|
||||
cloudRk.setCompany(company);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,19 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.cloud.CloudInfo;
|
||||
import com.ecep.contract.constant.CloudServiceConstant;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.model.CloudTyc;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import com.ecep.contract.vo.CloudTycVo;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class CloudTycService implements IEntityService<CloudTyc> {
|
||||
public class CloudTycService implements IEntityService<CloudTyc>, VoableService<CloudTyc, CloudTycVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CloudTycService.class);
|
||||
|
||||
/**
|
||||
@@ -121,7 +125,6 @@ public class CloudTycService implements IEntityService<CloudTyc> {
|
||||
cloudTycRepository.delete(entity);
|
||||
}
|
||||
|
||||
|
||||
public void deleteByCompany(Company company) {
|
||||
int deleted = cloudTycRepository.deleteAllByCompany(company);
|
||||
if (deleted > 0) {
|
||||
@@ -165,4 +168,34 @@ public class CloudTycService implements IEntityService<CloudTyc> {
|
||||
// TODO 从天眼查同步公司信息
|
||||
holder.warn("TODO 未实现");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CloudTyc cloudTyc, CloudTycVo vo) {
|
||||
if (cloudTyc == null || vo == null) {
|
||||
throw new IllegalArgumentException("CloudTyc and CloudTycVo cannot be null");
|
||||
}
|
||||
|
||||
// 更新基本属性
|
||||
if (vo.getScore() != null) {
|
||||
cloudTyc.setScore(vo.getScore());
|
||||
}
|
||||
if (vo.getCloudLatest() != null) {
|
||||
cloudTyc.setCloudLatest(vo.getCloudLatest());
|
||||
}
|
||||
if (vo.getCloudId() != null) {
|
||||
cloudTyc.setCloudId(vo.getCloudId());
|
||||
}
|
||||
if (vo.getLatestUpdate() != null) {
|
||||
cloudTyc.setLatestUpdate(vo.getLatestUpdate());
|
||||
}
|
||||
|
||||
// 更新关联的公司
|
||||
if (vo.getCompanyId() != null) {
|
||||
CompanyService companyService = SpringApp.getBean(CompanyService.class);
|
||||
Company company = companyService.findById(vo.getCompanyId());
|
||||
if (company != null) {
|
||||
cloudTyc.setCompany(company);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,21 +17,22 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.cloud.CloudInfo;
|
||||
import com.ecep.contract.cloud.CloudInfoRepository;
|
||||
import com.ecep.contract.cloud.u8.ctx.AbstractYongYouU8Ctx;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.ds.customer.service.CompanyCustomerService;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.vendor.service.VendorService;
|
||||
import com.ecep.contract.model.CloudYu;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.CloudYuVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
// @ConditionalOnProperty(name = "cloud.u8.enabled", havingValue = "true")
|
||||
public class YongYouU8Service implements IEntityService<CloudYu>, QueryService<CloudYu> {
|
||||
// @ConditionalOnProperty(name = "cloud.u8.enabled", havingValue = "true")
|
||||
public class YongYouU8Service
|
||||
implements IEntityService<CloudYu>, QueryService<CloudYu>, VoableService<CloudYu, CloudYuVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(YongYouU8Service.class);
|
||||
|
||||
public static final String KEY_HOST_IP = "u8.db.server.ip";
|
||||
@@ -47,19 +48,7 @@ public class YongYouU8Service implements IEntityService<CloudYu>, QueryService<C
|
||||
private CloudInfoRepository cloudInfoRepository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorService vendorService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CloudYuRepository cloudYuRepository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyCustomerService companyCustomerService;
|
||||
|
||||
public YongYouU8Service() {
|
||||
|
||||
@@ -210,4 +199,37 @@ public class YongYouU8Service implements IEntityService<CloudYu>, QueryService<C
|
||||
public Iterable<CloudInfo> findAllCloudYu() {
|
||||
return cloudInfoRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CloudYu cloudYu, CloudYuVo vo) {
|
||||
if (cloudYu == null || vo == null) {
|
||||
throw new IllegalArgumentException("CloudYu and CloudYuVo cannot be null");
|
||||
}
|
||||
|
||||
// 更新基本属性
|
||||
if (vo.getLatestUpdate() != null) {
|
||||
cloudYu.setLatestUpdate(vo.getLatestUpdate());
|
||||
}
|
||||
if (vo.getExceptionMessage() != null) {
|
||||
cloudYu.setExceptionMessage(vo.getExceptionMessage());
|
||||
}
|
||||
if (vo.getVendorUpdateDate() != null) {
|
||||
cloudYu.setVendorUpdateDate(vo.getVendorUpdateDate());
|
||||
}
|
||||
if (vo.getCustomerUpdateDate() != null) {
|
||||
cloudYu.setCustomerUpdateDate(vo.getCustomerUpdateDate());
|
||||
}
|
||||
if (vo.getCloudLatest() != null) {
|
||||
cloudYu.setCloudLatest(vo.getCloudLatest());
|
||||
}
|
||||
|
||||
// 更新关联的公司
|
||||
if (vo.getCompanyId() != null) {
|
||||
CompanyService companyService = SpringApp.getBean(CompanyService.class);
|
||||
Company company = companyService.findById(vo.getCompanyId());
|
||||
if (company != null) {
|
||||
cloudYu.setCompany(company);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,34 +133,6 @@ public class JacksonConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于处理集合类型的序列化器,避免懒加载集合在会话关闭时无法序列化的问题
|
||||
*/
|
||||
private static class CollectionSerializer extends StdSerializer<Collection<?>> {
|
||||
|
||||
protected CollectionSerializer() {
|
||||
super((Class<Collection<?>>) (Class<?>) Collection.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(Collection<?> value, JsonGenerator gen, SerializerProvider serializers)
|
||||
throws IOException {
|
||||
// 检查集合是否为Hibernate的持久化集合
|
||||
if (value instanceof PersistentCollection) {
|
||||
PersistentCollection persistentCollection = (PersistentCollection) value;
|
||||
// 如果集合未初始化,返回空集合
|
||||
if (!persistentCollection.wasInitialized()) {
|
||||
gen.writeStartArray();
|
||||
gen.writeEndArray();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果已初始化,使用默认序列化
|
||||
serializers.defaultSerializeValue(value, gen);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于处理IdentityEntity类型的序列化器包装器
|
||||
*/
|
||||
@@ -172,6 +144,7 @@ public class JacksonConfig {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers)
|
||||
throws IOException {
|
||||
|
||||
@@ -18,16 +18,22 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.repository.CompanyBankAccountRepository;
|
||||
import com.ecep.contract.ds.other.service.BankService;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-bank-account")
|
||||
public class CompanyBankAccountService implements IEntityService<CompanyBankAccount>, QueryService<CompanyBankAccount> {
|
||||
public class CompanyBankAccountService implements IEntityService<CompanyBankAccount>, QueryService<CompanyBankAccount>,
|
||||
VoableService<CompanyBankAccount, CompanyBankAccountVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyBankAccountService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -126,4 +132,35 @@ public class CompanyBankAccountService implements IEntityService<CompanyBankAcco
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CompanyBankAccount model, CompanyBankAccountVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("CompanyBankAccount cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("CompanyBankAccountVo cannot be null");
|
||||
}
|
||||
|
||||
// 基本属性映射
|
||||
model.setAccount(vo.getAccount());
|
||||
model.setOpeningBank(vo.getOpeningBank());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联关系 - 公司
|
||||
if (vo.getCompanyId() != null) {
|
||||
model.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
} else {
|
||||
model.setCompany(null);
|
||||
}
|
||||
|
||||
// 处理关联关系 - 银行
|
||||
if (vo.getBankId() != null) {
|
||||
model.setBank(SpringApp.getBean(BankService.class).findById(vo.getBankId()));
|
||||
} else {
|
||||
model.setBank(null);
|
||||
}
|
||||
|
||||
// 注意:CompanyBankAccount实体类中没有active字段,所以不需要设置
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,16 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.repository.CompanyContactRepository;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyContact;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.CompanyContactVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -29,7 +34,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-contact")
|
||||
public class CompanyContactService implements IEntityService<CompanyContact>, QueryService<CompanyContact> {
|
||||
public class CompanyContactService implements IEntityService<CompanyContact>, QueryService<CompanyContact>,
|
||||
VoableService<CompanyContact, CompanyContactVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyContactService.class);
|
||||
|
||||
@Autowired
|
||||
@@ -118,4 +124,36 @@ public class CompanyContactService implements IEntityService<CompanyContact>, Qu
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CompanyContact model, CompanyContactVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("CompanyContact cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("CompanyContactVo cannot be null");
|
||||
}
|
||||
|
||||
// 基本属性映射
|
||||
model.setName(vo.getName());
|
||||
model.setPhone(vo.getPhone());
|
||||
model.setEmail(vo.getEmail());
|
||||
model.setAddress(vo.getAddress());
|
||||
model.setPosition(vo.getPosition());
|
||||
model.setU8Code(vo.getU8Code());
|
||||
model.setMemo(vo.getMemo());
|
||||
model.setCreated(vo.getCreated());
|
||||
|
||||
// 处理关联关系 - 公司
|
||||
if (vo.getCompanyId() != null) {
|
||||
model.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
} else {
|
||||
model.setCompany(null);
|
||||
}
|
||||
|
||||
// 注意:
|
||||
// 1. CompanyContact实体类中没有primary字段,所以不需要设置
|
||||
// 2. CompanyContact实体类中没有active字段,所以不需要设置
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,6 @@ import java.util.function.Consumer;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.ecep.contract.*;
|
||||
import com.ecep.contract.constant.CompanyConstant;
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -25,22 +21,29 @@ 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.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.CompanyFileType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.constant.CloudServiceConstant;
|
||||
import com.ecep.contract.constant.CompanyConstant;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.company.repository.CompanyFileRepository;
|
||||
import com.ecep.contract.ds.company.repository.CompanyFileTypeLocalRepository;
|
||||
import com.ecep.contract.ds.company.repository.CompanyOldNameRepository;
|
||||
import com.ecep.contract.ds.contract.service.ContractService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorGroupRepository;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyFile;
|
||||
import com.ecep.contract.model.CompanyFileTypeLocal;
|
||||
import com.ecep.contract.model.CompanyOldName;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.CompanyFileVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -49,26 +52,17 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-file")
|
||||
public class CompanyFileService extends EntityService<CompanyFile, Integer> implements IEntityService<CompanyFile>, QueryService<CompanyFile> {
|
||||
public class CompanyFileService
|
||||
implements IEntityService<CompanyFile>, QueryService<CompanyFile>, VoableService<CompanyFile, CompanyFileVo> {
|
||||
|
||||
private final VendorGroupRepository vendorGroupRepository;
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyFileService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyFileRepository companyFileRepository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyOldNameRepository companyOldNameRepository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyFileTypeLocalRepository fileTypeLocalRepository;
|
||||
|
||||
@Override
|
||||
protected CompanyFileRepository getRepository() {
|
||||
return companyFileRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompanyFile createNewEntity() {
|
||||
return new CompanyFile();
|
||||
CompanyFileService(VendorGroupRepository vendorGroupRepository) {
|
||||
this.vendorGroupRepository = vendorGroupRepository;
|
||||
}
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@@ -76,20 +70,10 @@ public class CompanyFileService extends EntityService<CompanyFile, Integer> impl
|
||||
return companyFileRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
public List<CompanyFile> findFileByCompanyAndType(Company company, CompanyFileType type) {
|
||||
return companyFileRepository.findByCompanyAndType(company, type);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Specification<CompanyFile> buildSearchSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(builder.like(root.get("filePath"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Specification<CompanyFile> buildParameterSpecification(JsonNode paramsNode) {
|
||||
Specification<CompanyFile> spec = null;
|
||||
if (paramsNode.has("type")) {
|
||||
@@ -280,7 +264,7 @@ public class CompanyFileService extends EntityService<CompanyFile, Integer> impl
|
||||
}
|
||||
|
||||
// 获取所有曾用名
|
||||
for (CompanyOldName companyOldName : companyOldNameRepository.findAllByCompanyId(company.getId())) {
|
||||
for (CompanyOldName companyOldName : SpringApp.getBean(CompanyOldNameService.class).findAllByCompany(company)) {
|
||||
String path = companyOldName.getPath();
|
||||
if (StringUtils.hasText(path)) {
|
||||
File dir = new File(path);
|
||||
@@ -439,5 +423,62 @@ public class CompanyFileService extends EntityService<CompanyFile, Integer> impl
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyFile> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<CompanyFile> spec = null;
|
||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
||||
}
|
||||
spec = SpecificationUtils.and(spec, buildParameterSpecification(paramsNode));
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CompanyFile> findAll(Specification<CompanyFile> spec, Pageable pageable) {
|
||||
return companyFileRepository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<CompanyFile> getSpecification(String searchText) {
|
||||
if (!StringUtils.hasText(searchText)) {
|
||||
return null;
|
||||
}
|
||||
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
||||
}
|
||||
|
||||
protected Specification<CompanyFile> buildSearchSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(builder.like(root.get("filePath"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CompanyFile model, CompanyFileVo vo) {
|
||||
// 空值校验
|
||||
if (model == null) {
|
||||
throw new IllegalArgumentException("companyFile cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new IllegalArgumentException("companyFileVo cannot be null");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
model.setId(vo.getId());
|
||||
model.setType(vo.getType());
|
||||
model.setApplyDate(vo.getApplyDate());
|
||||
model.setExpiringDate(vo.getExpiringDate());
|
||||
model.setFilePath(vo.getFilePath());
|
||||
|
||||
// 处理公司关联
|
||||
if (vo.getCompanyId() == null) {
|
||||
model.setCompany(null);
|
||||
} else {
|
||||
CompanyService companyService = SpringApp.getBean(CompanyService.class);
|
||||
Company company = companyService.findById(vo.getCompanyId());
|
||||
model.setCompany(company);
|
||||
}
|
||||
|
||||
// 实体类中没有active字段,不需要映射
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,15 +18,21 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.repository.InvoiceRepository;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.model.Invoice;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.InvoiceVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "invoice")
|
||||
public class InvoiceService implements IEntityService<Invoice>, QueryService<Invoice> {
|
||||
public class InvoiceService implements IEntityService<Invoice>, QueryService<Invoice>,
|
||||
VoableService<Invoice, InvoiceVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(InvoiceService.class);
|
||||
|
||||
@Autowired
|
||||
@@ -80,9 +86,15 @@ public class InvoiceService implements IEntityService<Invoice>, QueryService<Inv
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
|
||||
|
||||
// field
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(Invoice model, InvoiceVo vo) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateByVo'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,22 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.ds.contract.repository.ContractBidVendorRepository;
|
||||
import com.ecep.contract.ds.contract.repository.ContractFileRepository;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.ContractBidVendor;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ContractBidVendorVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-ven-bid")
|
||||
public class ContractBidVendorService implements IEntityService<ContractBidVendor>, QueryService<ContractBidVendor> {
|
||||
public class ContractBidVendorService implements IEntityService<ContractBidVendor>, QueryService<ContractBidVendor>, VoableService<ContractBidVendor, ContractBidVendorVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ContractBidVendorRepository repository;
|
||||
@@ -99,9 +104,30 @@ public class ContractBidVendorService implements IEntityService<ContractBidVendo
|
||||
if (paramsNode.has("searchText")) {
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
|
||||
// field
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract", "company");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractBidVendor model, ContractBidVendorVo vo) {
|
||||
// 处理关联对象
|
||||
if (vo.getContractId() == null) {
|
||||
model.setContract(null);
|
||||
} else {
|
||||
model.setContract(SpringApp.getBean(ContractService.class).findById(vo.getContractId()));
|
||||
}
|
||||
|
||||
if (vo.getCompanyId() == null) {
|
||||
model.setCompany(null);
|
||||
} else {
|
||||
model.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
}
|
||||
|
||||
if (vo.getQuotationSheetFileId() == null) {
|
||||
model.setQuotationSheet(null);
|
||||
} else {
|
||||
model.setQuotationSheet(SpringApp.getBean(ContractFileRepository.class).findById(vo.getQuotationSheetFileId()).orElse(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.contract.repository.ContractCatalogRepository;
|
||||
import com.ecep.contract.model.ContractCatalog;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.ContractCatalogVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -26,7 +28,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-catalog")
|
||||
public class ContractCatalogService implements IEntityService<ContractCatalog>, QueryService<ContractCatalog> {
|
||||
public class ContractCatalogService implements IEntityService<ContractCatalog>, QueryService<ContractCatalog>,
|
||||
VoableService<ContractCatalog, ContractCatalogVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ContractCatalogRepository repository;
|
||||
@@ -99,4 +102,16 @@ public class ContractCatalogService implements IEntityService<ContractCatalog>,
|
||||
}
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractCatalog model, ContractCatalogVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
model.setCode(vo.getCode());
|
||||
model.setName(vo.getName());
|
||||
model.setPath(vo.getPath());
|
||||
model.setParent(vo.getParent());
|
||||
model.setUseYear(vo.isUseYear());
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,20 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.ContractFileType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.ContractFileRepository;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.ContractFile;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ContractFileVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-file")
|
||||
public class ContractFileService implements IEntityService<ContractFile>, QueryService<ContractFile> {
|
||||
public class ContractFileService implements IEntityService<ContractFile>, QueryService<ContractFile>,
|
||||
VoableService<ContractFile, ContractFileVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContractFileService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -166,4 +170,19 @@ public class ContractFileService implements IEntityService<ContractFile>, QueryS
|
||||
};
|
||||
return contractFileRepository.findAll(spec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractFile model, ContractFileVo vo) {
|
||||
// 更新基本属性
|
||||
if (vo.getContractId() == null) {
|
||||
model.setContract(null);
|
||||
} else {
|
||||
model.setContract(SpringApp.getBean(ContractService.class).findById(vo.getContractId()));
|
||||
}
|
||||
|
||||
model.setType(vo.getType());
|
||||
model.setFileName(vo.getFileName());
|
||||
model.setApplyDate(vo.getApplyDate());
|
||||
model.setDescription(vo.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.ecep.contract.ds.contract.service;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ecep.contract.VendorType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -22,14 +21,18 @@ 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.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ContractFileTypeLocalVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-file-type")
|
||||
public class ContractFileTypeService
|
||||
implements IEntityService<ContractFileTypeLocal>, QueryService<ContractFileTypeLocal> {
|
||||
implements IEntityService<ContractFileTypeLocal>, QueryService<ContractFileTypeLocal>,
|
||||
VoableService<ContractFileTypeLocal, ContractFileTypeLocalVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ContractFileTypeLocalRepository repository;
|
||||
@@ -42,7 +45,8 @@ public class ContractFileTypeService
|
||||
}
|
||||
|
||||
if (paramsNode.has("type")) {
|
||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"), ContractFileType.valueOf(paramsNode.get("type").asText())));
|
||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
||||
ContractFileType.valueOf(paramsNode.get("type").asText())));
|
||||
}
|
||||
|
||||
// field
|
||||
@@ -96,4 +100,21 @@ public class ContractFileTypeService
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractFileTypeLocal model, ContractFileTypeLocalVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
model.setId(vo.getId());
|
||||
model.setLang(vo.getLang());
|
||||
model.setType(vo.getType());
|
||||
model.setValue(vo.getValue());
|
||||
model.setDescription(vo.getDescription());
|
||||
model.setSuggestFileName(vo.getSuggestFileName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.contract.repository.ContractGroupRepository;
|
||||
import com.ecep.contract.model.ContractGroup;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.ContractGroupVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -27,7 +29,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-group")
|
||||
public class ContractGroupService implements IEntityService<ContractGroup>, QueryService<ContractGroup> {
|
||||
public class ContractGroupService implements IEntityService<ContractGroup>, QueryService<ContractGroup>,
|
||||
VoableService<ContractGroup, ContractGroupVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContractGroupService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -113,4 +116,14 @@ public class ContractGroupService implements IEntityService<ContractGroup>, Quer
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractGroup model, ContractGroupVo vo) {
|
||||
if (model != null && vo != null) {
|
||||
model.setId(vo.getId());
|
||||
model.setName(vo.getName());
|
||||
model.setCode(vo.getCode());
|
||||
model.setTitle(vo.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,11 +19,17 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.ContractItemRepository;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.other.service.InventoryService;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.ContractItem;
|
||||
import com.ecep.contract.model.Inventory;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ContractItemVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
@@ -31,7 +37,7 @@ import jakarta.persistence.criteria.Path;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-item")
|
||||
public class ContractItemService implements IEntityService<ContractItem>, QueryService<ContractItem> {
|
||||
public class ContractItemService implements IEntityService<ContractItem>, QueryService<ContractItem>, VoableService<ContractItem, ContractItemVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContractItemService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -98,6 +104,51 @@ public class ContractItemService implements IEntityService<ContractItem>, QueryS
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id")
|
||||
})
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractItem model, ContractItemVo vo) {
|
||||
// 更新基本属性
|
||||
model.setRefId(vo.getRefId());
|
||||
model.setItemCode(vo.getItemCode());
|
||||
model.setTitle(vo.getTitle());
|
||||
model.setSpecification(vo.getSpecification());
|
||||
model.setUnit(vo.getUnit());
|
||||
model.setExclusiveTaxPrice(vo.getExclusiveTaxPrice() != null ? vo.getExclusiveTaxPrice() : 0);
|
||||
model.setTaxRate(vo.getTaxRate() != null ? vo.getTaxRate() : 0);
|
||||
model.setTaxPrice(vo.getTaxPrice() != null ? vo.getTaxPrice() : 0);
|
||||
model.setQuantity(vo.getQuantity() != null ? vo.getQuantity() : 0);
|
||||
model.setStartDate(vo.getStartDate());
|
||||
model.setEndDate(vo.getEndDate());
|
||||
model.setRemark(vo.getRemark());
|
||||
|
||||
// 处理关联对象
|
||||
if (vo.getContractId() == null) {
|
||||
model.setContract(null);
|
||||
} else {
|
||||
model.setContract(SpringApp.getBean(ContractService.class).findById(vo.getContractId()));
|
||||
}
|
||||
|
||||
if (vo.getInventoryId() == null) {
|
||||
model.setInventory(null);
|
||||
} else {
|
||||
model.setInventory(SpringApp.getBean(InventoryService.class).findById(vo.getInventoryId()));
|
||||
}
|
||||
|
||||
if (vo.getCreatorId() == null) {
|
||||
model.setCreator(null);
|
||||
} else {
|
||||
model.setCreator(SpringApp.getBean(EmployeeService.class).findById(vo.getCreatorId()));
|
||||
}
|
||||
|
||||
if (vo.getUpdaterId() == null) {
|
||||
model.setUpdater(null);
|
||||
} else {
|
||||
model.setUpdater(SpringApp.getBean(EmployeeService.class).findById(vo.getUpdaterId()));
|
||||
}
|
||||
|
||||
// 创建日期和更新日期通常由系统自动维护,这里不设置
|
||||
}
|
||||
|
||||
public ContractItem save(ContractItem item) {
|
||||
return itemRepository.save(item);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.contract.repository.ContractKindRepository;
|
||||
import com.ecep.contract.model.ContractKind;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.ContractKindVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -27,7 +29,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-kind")
|
||||
public class ContractKindService implements IEntityService<ContractKind>, QueryService<ContractKind> {
|
||||
public class ContractKindService implements IEntityService<ContractKind>, QueryService<ContractKind>,
|
||||
VoableService<ContractKind, ContractKindVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContractKindService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -99,4 +102,15 @@ public class ContractKindService implements IEntityService<ContractKind>, QueryS
|
||||
public void delete(Integer id) {
|
||||
repository.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractKind model, ContractKindVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
model.setName(vo.getName());
|
||||
model.setCode(vo.getCode());
|
||||
model.setTitle(vo.getTitle());
|
||||
// model.setActive(vo.isActive());
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,13 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.ContractPayPlanRepository;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.ContractPayPlan;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ContractPayPlanVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -28,7 +31,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-pay-plan")
|
||||
public class ContractPayPlanService implements IEntityService<ContractPayPlan>, QueryService<ContractPayPlan> {
|
||||
public class ContractPayPlanService implements IEntityService<ContractPayPlan>, QueryService<ContractPayPlan>,
|
||||
VoableService<ContractPayPlan, ContractPayPlanVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ContractPayPlanRepository repository;
|
||||
@@ -85,4 +89,26 @@ public class ContractPayPlanService implements IEntityService<ContractPayPlan>,
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractPayPlan model, ContractPayPlanVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
model.setRefId(vo.getRefId());
|
||||
model.setPayRatio(vo.getPayRatio());
|
||||
model.setPayCurrency(vo.getPayCurrency() != null ? vo.getPayCurrency() : 0);
|
||||
model.setPayDate(vo.getPayDate());
|
||||
model.setPayTerm(vo.getPayTerm());
|
||||
|
||||
// 处理关联对象
|
||||
if (vo.getContractId() == null) {
|
||||
model.setContract(null);
|
||||
} else {
|
||||
model.setContract(SpringApp.getBean(ContractService.class).findById(vo.getContractId()));
|
||||
}
|
||||
|
||||
if (vo.getUpdateDate() != null) {
|
||||
model.setUpdateDate(vo.getUpdateDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,24 +373,86 @@ public class ContractService extends EntityService<Contract, Integer>
|
||||
|
||||
@Override
|
||||
public void updateByVo(Contract contract, ContractVo vo) {
|
||||
if (contract == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
contract.setCode(vo.getCode());
|
||||
contract.setName(vo.getName());
|
||||
contract.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
contract.setGroup(SpringApp.getBean(ContractGroupService.class).findById(vo.getGroupId()));
|
||||
contract.setType(SpringApp.getBean(ContractTypeService.class).findById(vo.getTypeId()));
|
||||
contract.setKind(SpringApp.getBean(ContractKindService.class).findById(vo.getKindId()));
|
||||
contract.setProject(SpringApp.getBean(ProjectService.class).findById(vo.getProject()));
|
||||
contract.setGuid(vo.getGuid());
|
||||
contract.setState(vo.getState());
|
||||
contract.setPath(vo.getPath());
|
||||
contract.setDescription(vo.getDescription());
|
||||
contract.setAmount(vo.getAmount());
|
||||
contract.setStandardPayWay(vo.isStandardPayWay());
|
||||
contract.setStandardPContractText(vo.isStandardPContractText());
|
||||
contract.setTotalQuantity(vo.getTotalQuantity());
|
||||
contract.setTotalAmount(vo.getTotalAmount());
|
||||
contract.setTotalUnTaxAmount(vo.getTotalUnTaxAmount());
|
||||
contract.setExecQuantity(vo.getExecQuantity());
|
||||
contract.setExecAmount(vo.getExecAmount());
|
||||
contract.setExecUnTaxAmount(vo.getExecUnTaxAmount());
|
||||
contract.setPayWay(vo.getPayWay());
|
||||
|
||||
if (vo.getCompanyId() == null) {
|
||||
contract.setCompany(null);
|
||||
} else {
|
||||
contract.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
}
|
||||
if (vo.getGroupId() == null) {
|
||||
contract.setGroup(null);
|
||||
} else {
|
||||
contract.setGroup(SpringApp.getBean(ContractGroupService.class).findById(vo.getGroupId()));
|
||||
}
|
||||
if (vo.getTypeId() == null) {
|
||||
contract.setType(null);
|
||||
} else {
|
||||
contract.setType(SpringApp.getBean(ContractTypeService.class).findById(vo.getTypeId()));
|
||||
}
|
||||
if (vo.getKindId() == null) {
|
||||
contract.setKind(null);
|
||||
} else {
|
||||
contract.setKind(SpringApp.getBean(ContractKindService.class).findById(vo.getKindId()));
|
||||
}
|
||||
if (vo.getProject() == null) {
|
||||
contract.setProject(null);
|
||||
} else {
|
||||
contract.setProject(SpringApp.getBean(ProjectService.class).findById(vo.getProject()));
|
||||
}
|
||||
contract.setParentCode(vo.getParentCode());
|
||||
contract.setOrderDate(vo.getOrderDate());
|
||||
contract.setStartDate(vo.getStartDate());
|
||||
contract.setEndDate(vo.getEndDate());
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
contract.setEmployee(employeeService.findById(vo.getEmployeeId()));
|
||||
contract.setHandler(employeeService.findById(vo.getHandlerId()));
|
||||
contract.setSetupPerson(employeeService.findById(vo.getSetupPersonId()));
|
||||
if (vo.getEmployeeId() == null) {
|
||||
contract.setEmployee(null);
|
||||
} else {
|
||||
contract.setEmployee(employeeService.findById(vo.getEmployeeId()));
|
||||
}
|
||||
if (vo.getHandlerId() == null) {
|
||||
contract.setHandler(null);
|
||||
} else {
|
||||
contract.setHandler(employeeService.findById(vo.getHandlerId()));
|
||||
}
|
||||
if (vo.getSetupPersonId() == null) {
|
||||
contract.setSetupPerson(null);
|
||||
} else {
|
||||
contract.setSetupPerson(employeeService.findById(vo.getSetupPersonId()));
|
||||
}
|
||||
contract.setSetupDate(vo.getSetupDate());
|
||||
contract.setInurePerson(employeeService.findById(vo.getInurePersonId()));
|
||||
if (vo.getInurePersonId() == null) {
|
||||
contract.setInurePerson(null);
|
||||
} else {
|
||||
contract.setInurePerson(employeeService.findById(vo.getInurePersonId()));
|
||||
}
|
||||
contract.setInureDate(vo.getInureDate());
|
||||
if (vo.getVaryPersonId() == null) {
|
||||
contract.setVaryPerson(null);
|
||||
} else {
|
||||
contract.setVaryPerson(employeeService.findById(vo.getVaryPersonId()));
|
||||
}
|
||||
contract.setVaryDate(vo.getVaryDate());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.contract.repository.ContractTypeRepository;
|
||||
import com.ecep.contract.model.ContractType;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.ContractTypeVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -27,7 +29,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-type")
|
||||
public class ContractTypeService implements IEntityService<ContractType>, QueryService<ContractType> {
|
||||
public class ContractTypeService implements IEntityService<ContractType>, QueryService<ContractType>,
|
||||
VoableService<ContractType, ContractTypeVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContractTypeService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -98,7 +101,21 @@ public class ContractTypeService implements IEntityService<ContractType>, QueryS
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||
builder.like(root.get("name"), "%" + searchText + "%"));
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("title"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ContractType model, ContractTypeVo vo) {
|
||||
// 更新基本属性
|
||||
model.setName(vo.getName());
|
||||
model.setCode(vo.getCode());
|
||||
model.setCatalog(vo.getCatalog());
|
||||
model.setTitle(vo.getTitle());
|
||||
model.setDirection(vo.getDirection());
|
||||
|
||||
// 注意:ContractType实体类中没有active字段,所以不设置
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,19 +23,25 @@ import com.ecep.contract.ds.contract.repository.ExtendVendorInfoRepository;
|
||||
import com.ecep.contract.ds.vendor.service.VendorGroupService;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.ExtendVendorInfo;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ExtendVendorInfoVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-ext-ven-info")
|
||||
public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>, QueryService<ExtendVendorInfo> {
|
||||
public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>, QueryService<ExtendVendorInfo>,
|
||||
VoableService<ExtendVendorInfo, ExtendVendorInfoVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ExtendVendorInfoRepository repository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorGroupService vendorGroupService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ContractService contractService;
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#p0")
|
||||
@@ -56,22 +62,20 @@ public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>
|
||||
return repository.save(bidVendor);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'bycontract-'+#p0.contract.id")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'bycontract-'+#p0.contract.id")
|
||||
})
|
||||
@Override
|
||||
public void delete(ExtendVendorInfo bidVendor) {
|
||||
repository.delete(bidVendor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ExtendVendorInfo> findAll(Specification<ExtendVendorInfo> spec, Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Specification<ExtendVendorInfo> getSpecification(String searchText) {
|
||||
if (!StringUtils.hasText(searchText)) {
|
||||
@@ -81,11 +85,10 @@ public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>
|
||||
return builder.or(
|
||||
builder.like(root.get("contract").get("code"), "%" + searchText + "%"),
|
||||
builder.like(root.get("contract").get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("codeSequenceNumber").as(String.class), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(root.get("codeSequenceNumber").as(String.class), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ExtendVendorInfo> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||
Specification<ExtendVendorInfo> spec = null;
|
||||
@@ -122,4 +125,29 @@ public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>
|
||||
info.setPrePurchase(false);
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ExtendVendorInfo entity, ExtendVendorInfoVo vo) {
|
||||
if (entity == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新基本属性
|
||||
entity.setCodeSequenceNumber(vo.getCodeSequenceNumber());
|
||||
entity.setAssignedProvider(vo.isAssignedProvider());
|
||||
entity.setPrePurchase(vo.isPrePurchase());
|
||||
|
||||
// 处理关联对象
|
||||
if (vo.getContractId() != null) {
|
||||
entity.setContract(contractService.findById(vo.getContractId()));
|
||||
} else {
|
||||
entity.setContract(null);
|
||||
}
|
||||
|
||||
if (vo.getGroupId() != null) {
|
||||
entity.setGroup(vendorGroupService.findById(vo.getGroupId()));
|
||||
} else {
|
||||
entity.setGroup(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,15 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.ds.company.service.InvoiceService;
|
||||
import com.ecep.contract.ds.contract.repository.PurchaseBillVoucherRepository;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.model.PurchaseBillVoucher;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.PurchaseBillVoucherVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -31,7 +37,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "purchase-bill-voucher")
|
||||
public class PurchaseBillVoucherService
|
||||
implements IEntityService<PurchaseBillVoucher>, QueryService<PurchaseBillVoucher> {
|
||||
implements IEntityService<PurchaseBillVoucher>, QueryService<PurchaseBillVoucher>,
|
||||
VoableService<PurchaseBillVoucher, PurchaseBillVoucherVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseBillVoucherService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -124,4 +131,50 @@ public class PurchaseBillVoucherService
|
||||
public List<PurchaseBillVoucher> search(String searchText) {
|
||||
return repository.findAll(getSpecification(searchText), Pageable.ofSize(10)).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(PurchaseBillVoucher model, PurchaseBillVoucherVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
model.setRefId(vo.getRefId());
|
||||
model.setCode(vo.getCode());
|
||||
model.setMakerDate(vo.getMakerDate());
|
||||
model.setModifyDate(vo.getModifyDate());
|
||||
model.setVerifierDate(vo.getVerifierDate());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联对象
|
||||
if (vo.getInvoiceId() == null) {
|
||||
model.setInvoice(null);
|
||||
} else {
|
||||
model.setInvoice(SpringApp.getBean(InvoiceService.class).findById(vo.getInvoiceId()));
|
||||
}
|
||||
|
||||
if (vo.getCompanyId() == null) {
|
||||
model.setCompany(null);
|
||||
} else {
|
||||
model.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
}
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getEmployeeId() == null) {
|
||||
model.setEmployee(null);
|
||||
} else {
|
||||
model.setEmployee(employeeService.findById(vo.getEmployeeId()));
|
||||
}
|
||||
|
||||
if (vo.getMakerId() == null) {
|
||||
model.setMaker(null);
|
||||
} else {
|
||||
model.setMaker(employeeService.findById(vo.getMakerId()));
|
||||
}
|
||||
|
||||
if (vo.getVerifierId() == null) {
|
||||
model.setVerifier(null);
|
||||
} else {
|
||||
model.setVerifier(employeeService.findById(vo.getVerifierId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,21 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.PurchaseOrderItemRepository;
|
||||
import com.ecep.contract.ds.other.service.InventoryService;
|
||||
import com.ecep.contract.model.PurchaseOrderItem;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.PurchaseOrderItemVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-purchase-order-item")
|
||||
public class PurchaseOrderItemService implements IEntityService<PurchaseOrderItem>, QueryService<PurchaseOrderItem> {
|
||||
public class PurchaseOrderItemService implements IEntityService<PurchaseOrderItem>, QueryService<PurchaseOrderItem>,
|
||||
VoableService<PurchaseOrderItem, PurchaseOrderItemVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseOrderItemService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -101,4 +107,34 @@ public class PurchaseOrderItemService implements IEntityService<PurchaseOrderIte
|
||||
public List<PurchaseOrderItem> findAll(Specification<PurchaseOrderItem> spec, Sort sort) {
|
||||
return repository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(PurchaseOrderItem model, PurchaseOrderItemVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
model.setRefId(vo.getRefId());
|
||||
model.setQuantity(vo.getQuantity());
|
||||
model.setPrice(vo.getPrice());
|
||||
model.setTaxRate(vo.getTaxRate());
|
||||
model.setExclusiveTaxPrice(vo.getExclusiveTaxPrice());
|
||||
model.setArriveDate(vo.getArriveDate());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
if (vo.getOrder() == null) {
|
||||
model.setOrder(null);
|
||||
} else {
|
||||
model.setOrder(SpringApp.getBean(PurchaseOrdersService.class).findById(vo.getOrder()));
|
||||
}
|
||||
|
||||
if(vo.getInventoryId() == null) {
|
||||
model.setInventory(null);
|
||||
} else {
|
||||
model.setInventory(SpringApp.getBean(InventoryService.class).findById(vo.getInventoryId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,16 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.PurchaseOrderRepository;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.model.PurchaseOrder;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.PurchaseOrderVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -30,13 +36,18 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-purchase-order")
|
||||
public class PurchaseOrdersService implements IEntityService<PurchaseOrder>, QueryService<PurchaseOrder> {
|
||||
public class PurchaseOrdersService implements IEntityService<PurchaseOrder>, QueryService<PurchaseOrder>,
|
||||
VoableService<PurchaseOrder, PurchaseOrderVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseOrdersService.class);
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private PurchaseOrderRepository purchaseOrderRepository;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#p0")
|
||||
public PurchaseOrder findById(Integer id) {
|
||||
@@ -126,4 +137,56 @@ public class PurchaseOrdersService implements IEntityService<PurchaseOrder>, Que
|
||||
};
|
||||
return purchaseOrderRepository.findAll(spec, Pageable.ofSize(10)).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(PurchaseOrder model, PurchaseOrderVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
throw new ServiceException("实体或VO对象不能为空");
|
||||
}
|
||||
|
||||
// 设置基础属性
|
||||
model.setCode(vo.getCode());
|
||||
model.setRefId(vo.getRefId());
|
||||
model.setVendorCode(vo.getVendorCode());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// 更新负责人信息
|
||||
if (vo.getContractId() == null) {
|
||||
model.setContract(null);
|
||||
} else {
|
||||
model.setContract(SpringApp.getBean(ContractService.class).findById(vo.getContractId()));
|
||||
}
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
// 更新采购人信息
|
||||
if (vo.getEmployeeId() == null) {
|
||||
model.setEmployee(null);
|
||||
} else {
|
||||
model.setEmployee(employeeService.findById(vo.getEmployeeId()));
|
||||
}
|
||||
// 更新制单人信息
|
||||
if (vo.getMakerId() == null) {
|
||||
model.setMaker(null);
|
||||
} else {
|
||||
model.setMaker(employeeService.findById(vo.getMakerId()));
|
||||
}
|
||||
model.setMakerDate(vo.getMakerDate());
|
||||
model.setModifyDate(vo.getModifyDate());
|
||||
|
||||
// 更新审核人信息
|
||||
if (vo.getVerifierId() == null) {
|
||||
model.setVerifier(null);
|
||||
} else {
|
||||
model.setVerifier(employeeService.findById(vo.getVerifierId()));
|
||||
}
|
||||
model.setVerifierDate(vo.getVerifierDate());
|
||||
|
||||
// 更新关闭人信息
|
||||
if (vo.getCloserId() == null) {
|
||||
model.setCloser(null);
|
||||
} else {
|
||||
model.setCloser(employeeService.findById(vo.getCloserId()));
|
||||
}
|
||||
model.setCloserDate(vo.getCloserDate());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
package com.ecep.contract.ds.contract.service;
|
||||
|
||||
import com.ecep.contract.EntityService;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.ds.contract.repository.SalesOrderRepository;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.PurchaseOrder;
|
||||
import com.ecep.contract.model.SalesOrder;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,14 +10,21 @@ 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.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import com.ecep.contract.EntityService;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.SalesOrderRepository;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.SalesOrder;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.SalesOrderVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
* 合同服务
|
||||
@@ -33,7 +32,8 @@ import java.util.List;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-sale-order")
|
||||
public class SaleOrdersService extends EntityService<SalesOrder, Integer> implements IEntityService<SalesOrder>, QueryService<SalesOrder> {
|
||||
public class SaleOrdersService extends EntityService<SalesOrder, Integer>
|
||||
implements IEntityService<SalesOrder>, QueryService<SalesOrder>, VoableService<SalesOrder, SalesOrderVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SaleOrdersService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -55,7 +55,6 @@ public class SaleOrdersService extends EntityService<SalesOrder, Integer> implem
|
||||
return salesOrderRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Specification<SalesOrder> buildParameterSpecification(JsonNode paramsNode) {
|
||||
Specification<SalesOrder> spec = null;
|
||||
@@ -100,6 +99,41 @@ public class SaleOrdersService extends EntityService<SalesOrder, Integer> implem
|
||||
salesOrderRepository.delete(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(SalesOrder model, SalesOrderVo vo) {
|
||||
// 更新基本属性
|
||||
model.setCode(vo.getCode());
|
||||
model.setMakerDate(vo.getMakerDate());
|
||||
model.setVerifierDate(vo.getVerifierDate());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联对象
|
||||
if (vo.getContractId() == null) {
|
||||
model.setContract(null);
|
||||
} else {
|
||||
model.setContract(SpringApp.getBean(ContractService.class).findById(vo.getContractId()));
|
||||
}
|
||||
|
||||
if (vo.getEmployeeId() == null) {
|
||||
model.setEmployee(null);
|
||||
} else {
|
||||
model.setEmployee(SpringApp.getBean(EmployeeService.class).findById(vo.getEmployeeId()));
|
||||
}
|
||||
|
||||
if (vo.getMakerId() == null) {
|
||||
model.setMaker(null);
|
||||
} else {
|
||||
model.setMaker(SpringApp.getBean(EmployeeService.class).findById(vo.getMakerId()));
|
||||
}
|
||||
|
||||
if (vo.getVerifierId() == null) {
|
||||
model.setVerifier(null);
|
||||
} else {
|
||||
model.setVerifier(SpringApp.getBean(EmployeeService.class).findById(vo.getVerifierId()));
|
||||
}
|
||||
|
||||
// active字段在SalesOrder实体类中不存在,不需要设置
|
||||
}
|
||||
|
||||
public List<SalesOrder> findAllByContract(Contract contract) {
|
||||
return salesOrderRepository.findAllByContract(contract);
|
||||
|
||||
@@ -2,12 +2,6 @@ package com.ecep.contract.ds.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.EntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.MyRepository;
|
||||
import com.ecep.contract.model.SalesOrder;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -21,13 +15,21 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.EntityService;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.ds.contract.repository.SalesBillVoucherItemRepository;
|
||||
import com.ecep.contract.ds.contract.repository.SalesBillVoucherRepository;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.model.SalesBillVoucher;
|
||||
import com.ecep.contract.model.SalesBillVoucherItem;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.SalesBillVoucherVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
* 采购账单凭证服务
|
||||
@@ -35,7 +37,9 @@ import com.ecep.contract.model.SalesBillVoucherItem;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "sales-bill-voucher")
|
||||
public class SalesBillVoucherService extends EntityService<SalesBillVoucher, Integer> implements IEntityService<SalesBillVoucher>, QueryService<SalesBillVoucher> {
|
||||
public class SalesBillVoucherService extends EntityService<SalesBillVoucher, Integer>
|
||||
implements IEntityService<SalesBillVoucher>, QueryService<SalesBillVoucher>,
|
||||
VoableService<SalesBillVoucher, SalesBillVoucherVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SalesBillVoucherService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -65,8 +69,7 @@ public class SalesBillVoucherService extends EntityService<SalesBillVoucher, Int
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("code"), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(root.get("code"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,27 +84,22 @@ public class SalesBillVoucherService extends EntityService<SalesBillVoucher, Int
|
||||
* @param voucher 要保存的实体对象
|
||||
* @return 返回异步调用
|
||||
*/
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public SalesBillVoucher save(SalesBillVoucher voucher) {
|
||||
return salesBillVoucherRepository.save(voucher);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public void delete(SalesBillVoucher order) {
|
||||
salesBillVoucherRepository.delete(order);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Specification<SalesBillVoucher> buildParameterSpecification(JsonNode paramsNode) {
|
||||
Specification<SalesBillVoucher> spec = null;
|
||||
@@ -121,20 +119,16 @@ public class SalesBillVoucherService extends EntityService<SalesBillVoucher, Int
|
||||
* @param item 要保存的实体对象
|
||||
* @return 返回异步调用
|
||||
*/
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "'item-'+#p0.id")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "'item-'+#p0.id")
|
||||
})
|
||||
public SalesBillVoucherItem save(SalesBillVoucherItem item) {
|
||||
return salesBillVoucherItemRepository.save(item);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "'item-'+#p0.id")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "'item-'+#p0.id")
|
||||
})
|
||||
public void delete(SalesBillVoucherItem order) {
|
||||
salesBillVoucherItemRepository.delete(order);
|
||||
}
|
||||
@@ -154,4 +148,47 @@ public class SalesBillVoucherService extends EntityService<SalesBillVoucher, Int
|
||||
public List<SalesBillVoucherItem> findAllItems(Specification<SalesBillVoucherItem> spec, Sort sort) {
|
||||
return salesBillVoucherItemRepository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(SalesBillVoucher model, SalesBillVoucherVo vo) {
|
||||
// 更新基本属性
|
||||
model.setRefId(vo.getRefId());
|
||||
model.setCode(vo.getCode());
|
||||
model.setMakerDate(vo.getMakerDate());
|
||||
model.setModifyDate(vo.getModifyDate());
|
||||
model.setVerifierDate(vo.getVerifierDate());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联对象
|
||||
if (vo.getCompanyId() == null) {
|
||||
model.setCompany(null);
|
||||
} else {
|
||||
model.setCompany(SpringApp.getBean(CompanyService.class).findById(vo.getCompanyId()));
|
||||
}
|
||||
|
||||
if (vo.getOrderId() == null) {
|
||||
model.setOrder(null);
|
||||
} else {
|
||||
model.setOrder(SpringApp.getBean(SaleOrdersService.class).findById(vo.getOrderId()));
|
||||
}
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getEmployeeId() == null) {
|
||||
model.setEmployee(null);
|
||||
} else {
|
||||
model.setEmployee(employeeService.findById(vo.getEmployeeId()));
|
||||
}
|
||||
|
||||
if (vo.getMakerId() == null) {
|
||||
model.setMaker(null);
|
||||
} else {
|
||||
model.setMaker(employeeService.findById(vo.getMakerId()));
|
||||
}
|
||||
|
||||
if (vo.getVerifierId() == null) {
|
||||
model.setVerifier(null);
|
||||
} else {
|
||||
model.setVerifier(employeeService.findById(vo.getVerifierId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
package com.ecep.contract.ds.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.EntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.SalesOrder;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
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.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.EntityService;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.repository.SalesOrderItemRepository;
|
||||
import com.ecep.contract.model.SalesOrderItem;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.SalesOrderItemVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-sale-order-item")
|
||||
public class SalesOrderItemService extends EntityService<SalesOrderItem, Integer> implements IEntityService<SalesOrderItem>, QueryService<SalesOrderItem> {
|
||||
public class SalesOrderItemService extends EntityService<SalesOrderItem, Integer>
|
||||
implements IEntityService<SalesOrderItem>, QueryService<SalesOrderItem>,
|
||||
VoableService<SalesOrderItem, SalesOrderItemVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private SalesOrderItemRepository repository;
|
||||
@@ -47,15 +47,13 @@ public class SalesOrderItemService extends EntityService<SalesOrderItem, Integer
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Specification<SalesOrderItem> buildSearchSpecification(String searchText) {
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("description"), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,23 +65,47 @@ public class SalesOrderItemService extends EntityService<SalesOrderItem, Integer
|
||||
return spec;
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
})
|
||||
@Override
|
||||
public void delete(SalesOrderItem entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
})
|
||||
@Override
|
||||
public SalesOrderItem save(SalesOrderItem entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(SalesOrderItem model, SalesOrderItemVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
model.setCode(vo.getCode());
|
||||
model.setName(vo.getName());
|
||||
model.setQuantity(vo.getQuantity());
|
||||
model.setPrice(vo.getPrice());
|
||||
model.setTaxRate(vo.getTaxRate());
|
||||
model.setExclusiveTaxPrice(vo.getExclusiveTaxPrice());
|
||||
|
||||
model.setStartDate(vo.getStartDate());
|
||||
model.setEndDate(vo.getEndDate());
|
||||
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
if (vo.getOrderId() == null) {
|
||||
model.setOrder(null);
|
||||
} else {
|
||||
model.setOrder(SpringApp.getBean(SaleOrdersService.class).findById(vo.getOrderId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,19 +17,24 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.customer.repository.CompanyCustomerEvaluationFormFileRepository;
|
||||
import com.ecep.contract.model.CompanyCustomer;
|
||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
||||
import com.ecep.contract.model.CompanyCustomerFile;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-customer-evaluation-form-file")
|
||||
public class CompanyCustomerEvaluationFormFileService
|
||||
implements IEntityService<CompanyCustomerEvaluationFormFile>, QueryService<CompanyCustomerEvaluationFormFile> {
|
||||
implements IEntityService<CompanyCustomerEvaluationFormFile>, QueryService<CompanyCustomerEvaluationFormFile>,
|
||||
VoableService<CompanyCustomerEvaluationFormFile, CompanyCustomerEvaluationFormFileVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormFileService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -127,4 +132,33 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
return repository.findByCustomerFile(customerFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CompanyCustomerEvaluationFormFile model, CompanyCustomerEvaluationFormFileVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
model.setCatalog(vo.getCatalog());
|
||||
model.setLevel(vo.getLevel());
|
||||
model.setCreditLevel(vo.getCreditLevel());
|
||||
|
||||
model.setScore1(vo.getScore1());
|
||||
model.setScore2(vo.getScore2());
|
||||
model.setScore3(vo.getScore3());
|
||||
model.setScore4(vo.getScore4());
|
||||
model.setScore5(vo.getScore5());
|
||||
|
||||
model.setScoreTemplateVersion(vo.getScoreTemplateVersion());
|
||||
|
||||
if (vo.getCustomerFile() != null) {
|
||||
CompanyCustomerFileService service = SpringApp.getBean(CompanyCustomerFileService.class);
|
||||
model.setCustomerFile(service.findById(vo.getCustomerFile()));
|
||||
} else {
|
||||
model.setCustomerFile(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,10 @@ import com.ecep.contract.model.CompanyCustomer;
|
||||
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
||||
import com.ecep.contract.model.CompanyCustomerFile;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
@@ -45,7 +48,8 @@ import jakarta.persistence.criteria.Path;
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-customer-file")
|
||||
public class CompanyCustomerFileService
|
||||
implements IEntityService<CompanyCustomerFile>, QueryService<CompanyCustomerFile> {
|
||||
implements IEntityService<CompanyCustomerFile>, QueryService<CompanyCustomerFile>,
|
||||
VoableService<CompanyCustomerFile, CompanyCustomerFileVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerFileService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -261,4 +265,30 @@ public class CompanyCustomerFileService
|
||||
return companyCustomerEvaluationFormFileRepository.findAll(spec, Pageable.ofSize(10)).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CompanyCustomerFile model, CompanyCustomerFileVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("companyCustomerFile is null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("companyCustomerFileVo is null");
|
||||
}
|
||||
|
||||
model.setFilePath(vo.getFilePath());
|
||||
model.setType(vo.getType());
|
||||
model.setFilePath(vo.getFilePath());
|
||||
model.setEditFilePath(vo.getEditFilePath());
|
||||
|
||||
model.setSignDate(vo.getSignDate());
|
||||
model.setValid(vo.isValid());
|
||||
|
||||
if (vo.getCustomer() != null) {
|
||||
CompanyCustomerService service = SpringApp.getBean(CompanyCustomerService.class);
|
||||
model.setCustomer(service.findById(vo.getCustomer()));
|
||||
} else {
|
||||
model.setCustomer(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
package com.ecep.contract.ds.customer.service;
|
||||
|
||||
import com.ecep.contract.CustomerFileType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.customer.repository.CompanyCustomerFileTypeLocalRepository;
|
||||
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
@@ -20,13 +14,25 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import com.ecep.contract.CustomerFileType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.customer.repository.CompanyCustomerFileTypeLocalRepository;
|
||||
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.CompanyCustomerFileTypeLocalVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "customer-file-type")
|
||||
public class CompanyCustomerFileTypeService implements IEntityService<CompanyCustomerFileTypeLocal>, QueryService<CompanyCustomerFileTypeLocal> {
|
||||
public class CompanyCustomerFileTypeService implements IEntityService<CompanyCustomerFileTypeLocal>, QueryService<CompanyCustomerFileTypeLocal>,
|
||||
VoableService<CompanyCustomerFileTypeLocal, CompanyCustomerFileTypeLocalVo> {
|
||||
@Resource
|
||||
private CompanyCustomerFileTypeLocalRepository repository;
|
||||
|
||||
@@ -91,4 +97,19 @@ public class CompanyCustomerFileTypeService implements IEntityService<CompanyCus
|
||||
public void delete(CompanyCustomerFileTypeLocal entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CompanyCustomerFileTypeLocal model, CompanyCustomerFileTypeLocalVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
model.setType(vo.getType());
|
||||
model.setLang(vo.getLang());
|
||||
model.setValue(vo.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import com.ecep.contract.ds.customer.repository.CustomerCatalogRepository;
|
||||
import com.ecep.contract.model.CustomerCatalog;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.CustomerCatalogVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -27,7 +30,8 @@ import java.util.List;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "customer-catalog")
|
||||
public class CustomerCatalogService implements IEntityService<CustomerCatalog>, QueryService<CustomerCatalog> {
|
||||
public class CustomerCatalogService implements IEntityService<CustomerCatalog>, QueryService<CustomerCatalog>,
|
||||
VoableService<CustomerCatalog, CustomerCatalogVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CustomerCatalogRepository repository;
|
||||
@@ -148,4 +152,18 @@ public class CustomerCatalogService implements IEntityService<CustomerCatalog>,
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CustomerCatalog model, CustomerCatalogVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
model.setCode(vo.getCode());
|
||||
model.setName(vo.getName());
|
||||
model.setDescription(vo.getDescription());
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,15 @@ import com.ecep.contract.model.CustomerFileTypeLocal;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.CustomerFileTypeLocalVo;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "customer-file-type")
|
||||
public class CustomerFileTypeService implements IEntityService<CustomerFileTypeLocal>, QueryService<CustomerFileTypeLocal> {
|
||||
public class CustomerFileTypeService implements IEntityService<CustomerFileTypeLocal>, QueryService<CustomerFileTypeLocal>,
|
||||
VoableService<CustomerFileTypeLocal, CustomerFileTypeLocalVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CustomerFileTypeLocalRepository repository;
|
||||
@@ -95,4 +100,19 @@ public class CustomerFileTypeService implements IEntityService<CustomerFileTypeL
|
||||
public CustomerFileTypeLocal save(CustomerFileTypeLocal entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(CustomerFileTypeLocal model, CustomerFileTypeLocalVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("实体对象不能为空");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VO对象不能为空");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
model.setType(vo.getType());
|
||||
model.setLang(vo.getLang());
|
||||
model.setValue(vo.getValue());
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.ecep.contract.ds.other.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@@ -15,15 +14,20 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.other.repository.EmployeeAuthBindRepository;
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.model.EmployeeAuthBind;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.EmployeeAuthBindVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "employee-auth-bind")
|
||||
public class EmployeeAuthBindService implements IEntityService<EmployeeAuthBind>, QueryService<EmployeeAuthBind> {
|
||||
public class EmployeeAuthBindService implements IEntityService<EmployeeAuthBind>, QueryService<EmployeeAuthBind>,
|
||||
VoableService<EmployeeAuthBind, EmployeeAuthBindVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EmployeeAuthBindRepository repository;
|
||||
@@ -75,4 +79,29 @@ public class EmployeeAuthBindService implements IEntityService<EmployeeAuthBind>
|
||||
public List<EmployeeAuthBind> findAllByEmployee(Employee employee, Sort sort) {
|
||||
return repository.findAllByEmployee(employee, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(EmployeeAuthBind model, EmployeeAuthBindVo vo) {
|
||||
// 从VO映射属性到实体
|
||||
model.setIp(vo.getIp());
|
||||
model.setMac(vo.getMac());
|
||||
model.setCreateTime(vo.getCreateTime());
|
||||
model.setUpdateTime(vo.getUpdateTime());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// employee和updater属性需要通过ID查找对应的实体
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getEmployeeId() != null) {
|
||||
Employee employee = employeeService.findById(vo.getEmployeeId());
|
||||
model.setEmployee(employee);
|
||||
} else {
|
||||
model.setEmployee(null);
|
||||
}
|
||||
if (vo.getUpdaterId() != null) {
|
||||
Employee updater = employeeService.findById(vo.getUpdaterId());
|
||||
model.setUpdater(updater);
|
||||
} else {
|
||||
model.setUpdater(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,16 +11,21 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.other.repository.EmployeeLoginHistoryRepository;
|
||||
import com.ecep.contract.model.EmployeeLoginHistory;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.EmployeeLoginHistoryVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "employee-login-history")
|
||||
public class EmployeeLoginHistoryService
|
||||
implements IEntityService<EmployeeLoginHistory>, QueryService<EmployeeLoginHistory> {
|
||||
implements IEntityService<EmployeeLoginHistory>, QueryService<EmployeeLoginHistory>,
|
||||
VoableService<EmployeeLoginHistory, EmployeeLoginHistoryVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EmployeeLoginHistoryRepository repository;
|
||||
@@ -68,4 +73,25 @@ public class EmployeeLoginHistoryService
|
||||
public EmployeeLoginHistory save(EmployeeLoginHistory entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(EmployeeLoginHistory model, EmployeeLoginHistoryVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("EmployeeLoginHistory cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("EmployeeLoginHistoryVo cannot be null");
|
||||
}
|
||||
|
||||
// Map properties from VO to entity (id属性不更新)
|
||||
if (vo.getEmployeeId() == null) {
|
||||
model.setEmployee(null);
|
||||
} else {
|
||||
model.setEmployee(SpringApp.getBean(EmployeeService.class).findById(vo.getEmployeeId()));
|
||||
}
|
||||
model.setIp(vo.getIp());
|
||||
model.setMac(vo.getMac());
|
||||
model.setLoginTime(vo.getLoginTime());
|
||||
model.setActiveTime(vo.getActiveTime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@ package com.ecep.contract.ds.project.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -19,14 +15,21 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.project.repository.ProductDeliverySignMethodRepository;
|
||||
import com.ecep.contract.model.DeliverySignMethod;
|
||||
import com.ecep.contract.model.ProjectSaleType;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.DeliverySignMethodVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "project-sign-method")
|
||||
public class DeliverySignMethodService implements IEntityService<DeliverySignMethod>, QueryService<DeliverySignMethod> {
|
||||
public class DeliverySignMethodService implements IEntityService<DeliverySignMethod>, QueryService<DeliverySignMethod>,
|
||||
VoableService<DeliverySignMethod, DeliverySignMethodVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProductDeliverySignMethodRepository deliverySignMethodRepository;
|
||||
@@ -48,7 +51,7 @@ public class DeliverySignMethodService implements IEntityService<DeliverySignMet
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
// field
|
||||
// spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||
// spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@@ -99,4 +102,25 @@ public class DeliverySignMethodService implements IEntityService<DeliverySignMet
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(DeliverySignMethod entity, DeliverySignMethodVo vo) {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("DeliverySignMethod is null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("DeliverySignMethodVo is null");
|
||||
}
|
||||
|
||||
entity.setName(vo.getName());
|
||||
entity.setCode(vo.getCode());
|
||||
entity.setDescription(vo.getDescription());
|
||||
|
||||
if (vo.getSaleTypeId() != null) {
|
||||
ProjectSaleTypeService saleTypeService = SpringApp.getBean(ProjectSaleTypeService.class);
|
||||
entity.setSaleType(saleTypeService.findById(vo.getSaleTypeId()));
|
||||
} else {
|
||||
entity.setSaleType(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,6 @@ package com.ecep.contract.ds.project.service;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,13 +14,21 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.customer.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.project.repository.ProjectBidRepository;
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.model.ProjectBid;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ProjectBidVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class ProjectBidService implements IEntityService<ProjectBid>, QueryService<ProjectBid> {
|
||||
public class ProjectBidService implements IEntityService<ProjectBid>, QueryService<ProjectBid>, VoableService<ProjectBid, ProjectBidVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectBidService.class);
|
||||
|
||||
@Lazy
|
||||
@@ -84,4 +88,55 @@ public class ProjectBidService implements IEntityService<ProjectBid>, QueryServi
|
||||
public List<ProjectBid> findAll(Specification<ProjectBid> spec, Sort sort) {
|
||||
return repository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectBid model, ProjectBidVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置基本属性
|
||||
model.setLevel(vo.getLevel());
|
||||
model.setAmount(vo.getAmount());
|
||||
model.setStandardPayWay(vo.isStandardPayWay());
|
||||
model.setNoStandardPayWayText(vo.getNoStandardPayWayText());
|
||||
model.setStandardContractText(vo.isStandardContractText());
|
||||
model.setNoStandardContractText(vo.getNoStandardContractText());
|
||||
model.setAuthorizationFile(vo.getAuthorizationFile());
|
||||
model.setBidAcceptanceLetterFile(vo.getBidAcceptanceLetterFile());
|
||||
model.setApplyTime(vo.getApplyTime());
|
||||
model.setAuthorizationTime(vo.getAuthorizationTime());
|
||||
model.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getProject() == null) {
|
||||
model.setProject(null);
|
||||
} else {
|
||||
model.setProject(SpringApp.getBean(ProjectService.class).findById(vo.getProject()));
|
||||
}
|
||||
|
||||
if (vo.getEvaluationFileId() == null) {
|
||||
model.setEvaluationFile(null);
|
||||
} else {
|
||||
model.setEvaluationFile(SpringApp.getBean(CompanyCustomerEvaluationFormFileService.class).findById(vo.getEvaluationFileId()));
|
||||
}
|
||||
|
||||
if (vo.getCostId() == null) {
|
||||
model.setCost(null);
|
||||
} else {
|
||||
model.setCost(SpringApp.getBean(ProjectCostService.class).findById(vo.getCostId()));
|
||||
}
|
||||
|
||||
if (vo.getApplicantId() == null) {
|
||||
model.setApplicant(null);
|
||||
} else {
|
||||
model.setApplicant(SpringApp.getBean(EmployeeService.class).findById(vo.getApplicantId()));
|
||||
}
|
||||
|
||||
if (vo.getAuthorizerId() == null) {
|
||||
model.setAuthorizer(null);
|
||||
} else {
|
||||
model.setAuthorizer(SpringApp.getBean(EmployeeService.class).findById(vo.getAuthorizerId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,21 @@ 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.security.authentication.AuthenticationManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.other.service.InventoryService;
|
||||
import com.ecep.contract.ds.project.repository.ProjectCostItemRepository;
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.model.Inventory;
|
||||
import com.ecep.contract.model.ProjectCost;
|
||||
import com.ecep.contract.model.ProjectCostItem;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ProjectCostItemVo;
|
||||
@@ -22,11 +29,18 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class ProjectCostItemService implements IEntityService<ProjectCostItem>, QueryService<ProjectCostItem>, VoableService<ProjectCostItem, ProjectCostItemVo> {
|
||||
public class ProjectCostItemService implements IEntityService<ProjectCostItem>, QueryService<ProjectCostItem>,
|
||||
VoableService<ProjectCostItem, ProjectCostItemVo> {
|
||||
|
||||
private final AuthenticationManager authenticationManager;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectCostItemRepository repository;
|
||||
|
||||
ProjectCostItemService(AuthenticationManager authenticationManager) {
|
||||
this.authenticationManager = authenticationManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectCostItem findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
@@ -76,8 +90,58 @@ public class ProjectCostItemService implements IEntityService<ProjectCostItem>,
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectCostItem item, ProjectCostItemVo vo) {
|
||||
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
if (item == null) {
|
||||
throw new ServiceException("ProjectCostItem is null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("ProjectCostItemVo is null");
|
||||
}
|
||||
|
||||
item.setTitle(vo.getTitle());
|
||||
item.setSpecification(vo.getSpecification());
|
||||
item.setUnit(vo.getUnit());
|
||||
|
||||
item.setInTaxRate(vo.getInTaxRate());
|
||||
item.setInExclusiveTaxPrice(vo.getInExclusiveTaxPrice());
|
||||
item.setInQuantity(vo.getInQuantity());
|
||||
|
||||
item.setOutTaxRate(vo.getOutTaxRate());
|
||||
item.setOutExclusiveTaxPrice(vo.getOutExclusiveTaxPrice());
|
||||
item.setOutQuantity(vo.getOutQuantity());
|
||||
|
||||
item.setCreateDate(vo.getCreateDate());
|
||||
item.setUpdateDate(vo.getUpdateDate());
|
||||
|
||||
item.setRemark(vo.getRemark());
|
||||
|
||||
if (vo.getCostId() == null) {
|
||||
item.setCost(null);
|
||||
} else {
|
||||
ProjectCostService costService = SpringApp.getBean(ProjectCostService.class);
|
||||
ProjectCost cost = costService.findById(vo.getCostId());
|
||||
item.setCost(cost);
|
||||
}
|
||||
|
||||
if (vo.getInventoryId() == null) {
|
||||
item.setInventory(null);
|
||||
} else {
|
||||
InventoryService inventoryService = SpringApp.getBean(InventoryService.class);
|
||||
Inventory inventory = inventoryService.findById(vo.getInventoryId());
|
||||
item.setInventory(inventory);
|
||||
}
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getCreatorId() == null) {
|
||||
item.setCreator(null);
|
||||
} else {
|
||||
Employee creator = employeeService.findById(vo.getCreatorId());
|
||||
item.setCreator(creator);
|
||||
}
|
||||
if (vo.getUpdaterId() == null) {
|
||||
item.setUpdater(null);
|
||||
} else {
|
||||
Employee updater = employeeService.findById(vo.getUpdaterId());
|
||||
item.setUpdater(updater);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,6 @@ package com.ecep.contract.ds.project.service;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,21 +15,31 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.contract.service.ContractService;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.project.repository.ProjectCostRepository;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.model.ProjectCost;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ProjectCostVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class ProjectCostService implements IEntityService<ProjectCost>, QueryService<ProjectCost> {
|
||||
public class ProjectCostService
|
||||
implements IEntityService<ProjectCost>, QueryService<ProjectCost>, VoableService<ProjectCost, ProjectCostVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectCostService.class);
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectCostRepository repository;
|
||||
|
||||
|
||||
public ProjectCost findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
@@ -84,7 +90,6 @@ public class ProjectCostService implements IEntityService<ProjectCost>, QuerySer
|
||||
return repository.findAllByProject(project);
|
||||
}
|
||||
|
||||
|
||||
public ProjectCost save(ProjectCost cost) {
|
||||
return repository.save(cost);
|
||||
}
|
||||
@@ -115,4 +120,89 @@ public class ProjectCostService implements IEntityService<ProjectCost>, QuerySer
|
||||
public List<ProjectCost> findAll(Specification<ProjectCost> spec, Sort sort) {
|
||||
return repository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectCost entity, ProjectCostVo vo) {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("ProjectCost is null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("ProjectCostVo is null");
|
||||
}
|
||||
|
||||
// 基本字段映射
|
||||
// 准付款方式 和 合同文本
|
||||
entity.setStandardPayWay(vo.isStandardPayWay());
|
||||
entity.setNoStandardPayWayText(vo.getNoStandardPayWayText());
|
||||
entity.setStandardContractText(vo.isStandardContractText());
|
||||
entity.setNoStandardContractText(vo.getNoStandardContractText());
|
||||
|
||||
// 印花税率和税费
|
||||
entity.setStampTax(vo.getStampTax());
|
||||
entity.setStampTaxFee(vo.getStampTaxFee());
|
||||
|
||||
// 其他服务费用和运费
|
||||
entity.setOnSiteServiceFee(vo.getOnSiteServiceFee());
|
||||
entity.setAssemblyServiceFee(vo.getAssemblyServiceFee());
|
||||
entity.setTechnicalServiceFee(vo.getTechnicalServiceFee());
|
||||
entity.setBidServiceFee(vo.getBidServiceFee());
|
||||
entity.setFreightCost(vo.getFreightCost());
|
||||
entity.setGuaranteeLetterFee(vo.getGuaranteeLetterFee());
|
||||
// 营业税及附加费
|
||||
entity.setTaxAndSurcharges(vo.getTaxAndSurcharges());
|
||||
entity.setTaxAndSurchargesFee(vo.getTaxAndSurchargesFee());
|
||||
|
||||
// 数量和金额
|
||||
entity.setInQuantities(vo.getInQuantities());
|
||||
entity.setInTaxAmount(vo.getInTaxAmount());
|
||||
entity.setInExclusiveTaxAmount(vo.getInExclusiveTaxAmount());
|
||||
entity.setOutQuantities(vo.getOutQuantities());
|
||||
entity.setOutTaxAmount(vo.getOutTaxAmount());
|
||||
entity.setOutExclusiveTaxAmount(vo.getOutExclusiveTaxAmount());
|
||||
|
||||
// 毛利率
|
||||
entity.setGrossProfitMargin(vo.getGrossProfitMargin());
|
||||
|
||||
//
|
||||
entity.setApplyTime(vo.getApplyTime());
|
||||
entity.setAuthorizationTime(vo.getAuthorizationTime());
|
||||
entity.setAuthorizationFile(vo.getAuthorizationFile());
|
||||
entity.setImportLock(vo.isImportLock());
|
||||
entity.setDescription(vo.getDescription());
|
||||
entity.setVersion(vo.getVersion());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getProject() != null) {
|
||||
Project project = SpringApp.getBean(ProjectService.class).findById(vo.getProject());
|
||||
entity.setProject(project);
|
||||
} else {
|
||||
entity.setProject(null);
|
||||
}
|
||||
|
||||
if (vo.getContractId() != null) {
|
||||
Contract contract = SpringApp.getBean(ContractService.class).findById(vo.getContractId());
|
||||
if (contract != null) {
|
||||
entity.setContract(contract);
|
||||
}
|
||||
} else {
|
||||
entity.setContract(null);
|
||||
}
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getApplicantId() != null) {
|
||||
Employee applicant = employeeService.findById(vo.getApplicantId());
|
||||
if (applicant != null) {
|
||||
entity.setApplicant(applicant);
|
||||
}
|
||||
} else {
|
||||
entity.setApplicant(null);
|
||||
}
|
||||
|
||||
if (vo.getAuthorizerId() != null) {
|
||||
Employee authorizer = employeeService.findById(vo.getAuthorizerId());
|
||||
if (authorizer != null) {
|
||||
entity.setAuthorizer(authorizer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -22,13 +18,20 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.ProjectFileType;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.project.repository.ProjectFileRepository;
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.model.ProjectFile;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ProjectFileVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class ProjectFileService implements IEntityService<ProjectFile>, QueryService<ProjectFile> {
|
||||
public class ProjectFileService
|
||||
implements IEntityService<ProjectFile>, QueryService<ProjectFile>, VoableService<ProjectFile, ProjectFileVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectFileService.class);
|
||||
|
||||
@Autowired
|
||||
@@ -98,9 +101,26 @@ public class ProjectFileService implements IEntityService<ProjectFile>, QuerySer
|
||||
return projectFileRepository.saveAll(files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectFile model, ProjectFileVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置基本属性
|
||||
model.setType(vo.getType());
|
||||
model.setFilePath(vo.getFilePath());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getProjectId() == null) {
|
||||
model.setProject(null);
|
||||
} else {
|
||||
model.setProject(SpringApp.getBean(ProjectService.class).findById(vo.getProjectId()));
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProjectFile> findAllByProjectAndType(Project project, ProjectFileType type) {
|
||||
return projectFileRepository.findByProjectAndType(project, type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,13 +20,18 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.ProjectFileTypeLocalVo;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "project-file-type")
|
||||
public class ProjectFileTypeService implements IEntityService<ProjectFileTypeLocal>, QueryService<ProjectFileTypeLocal> {
|
||||
public class ProjectFileTypeService implements IEntityService<ProjectFileTypeLocal>, QueryService<ProjectFileTypeLocal>,
|
||||
VoableService<ProjectFileTypeLocal, ProjectFileTypeLocalVo> {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -40,7 +45,8 @@ public class ProjectFileTypeService implements IEntityService<ProjectFileTypeLoc
|
||||
}
|
||||
|
||||
if (paramsNode.has("type")) {
|
||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"), ProjectFileType.valueOf(paramsNode.get("type").asText())));
|
||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
||||
ProjectFileType.valueOf(paramsNode.get("type").asText())));
|
||||
}
|
||||
|
||||
// field
|
||||
@@ -70,10 +76,10 @@ public class ProjectFileTypeService implements IEntityService<ProjectFileTypeLoc
|
||||
}
|
||||
return (root, query, builder) -> {
|
||||
return
|
||||
// builder.or(
|
||||
builder.like(root.get("type"), "%" + searchText + "%")
|
||||
// )
|
||||
;
|
||||
// builder.or(
|
||||
builder.like(root.get("type"), "%" + searchText + "%")
|
||||
// )
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -94,4 +100,18 @@ public class ProjectFileTypeService implements IEntityService<ProjectFileTypeLoc
|
||||
public void delete(ProjectFileTypeLocal entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectFileTypeLocal entity, ProjectFileTypeLocalVo vo) {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("ProjectFileTypeLocal is null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("ProjectFileTypeLocalVo is null");
|
||||
}
|
||||
|
||||
entity.setType(vo.getType());
|
||||
entity.setLang(vo.getLang());
|
||||
entity.setValue(vo.getValue());
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,6 @@ package com.ecep.contract.ds.project.service;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,21 +14,29 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.customer.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.project.repository.ProjectQuotationRepository;
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.model.ProjectQuotation;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ProjectQuotationVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class ProjectQuotationService implements IEntityService<ProjectQuotation>, QueryService<ProjectQuotation> {
|
||||
public class ProjectQuotationService implements IEntityService<ProjectQuotation>, QueryService<ProjectQuotation>,
|
||||
VoableService<ProjectQuotation, ProjectQuotationVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectQuotationService.class);
|
||||
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectQuotationRepository repository;
|
||||
|
||||
|
||||
public ProjectQuotation findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
}
|
||||
@@ -49,7 +53,7 @@ public class ProjectQuotationService implements IEntityService<ProjectQuotation>
|
||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
||||
}
|
||||
// field
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "project", "applicant","authorizer");
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "project", "applicant", "authorizer");
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@@ -70,7 +74,6 @@ public class ProjectQuotationService implements IEntityService<ProjectQuotation>
|
||||
repository.delete(approval);
|
||||
}
|
||||
|
||||
|
||||
public ProjectQuotation newInstanceByProject(Project project) {
|
||||
ProjectQuotation approval = new ProjectQuotation();
|
||||
approval.setProject(project);
|
||||
@@ -83,4 +86,49 @@ public class ProjectQuotationService implements IEntityService<ProjectQuotation>
|
||||
public List<ProjectQuotation> findAll(Specification<ProjectQuotation> spec, Sort sort) {
|
||||
return repository.findAll(spec, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectQuotation entity, ProjectQuotationVo vo) {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("ProjectQuotation is null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("ProjectQuotationVo is null");
|
||||
}
|
||||
|
||||
entity.setLevel(vo.getLevel());
|
||||
entity.setStandardPayWay(vo.isStandardPayWay());
|
||||
entity.setNoStandardPayWayText(vo.getNoStandardPayWayText());
|
||||
entity.setAmount(vo.getAmount());
|
||||
entity.setApplyTime(vo.getApplyTime());
|
||||
entity.setAuthorizationTime(vo.getAuthorizationTime());
|
||||
entity.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getProject() != null) {
|
||||
ProjectService projectService = SpringApp.getBean(ProjectService.class);
|
||||
entity.setProject(projectService.findById(vo.getProject()));
|
||||
} else {
|
||||
entity.setProject(null);
|
||||
}
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getApplicantId() != null) {
|
||||
entity.setApplicant(employeeService.findById(vo.getApplicantId()));
|
||||
} else {
|
||||
entity.setApplicant(null);
|
||||
}
|
||||
|
||||
if (vo.getAuthorizerId() != null) {
|
||||
entity.setAuthorizer(employeeService.findById(vo.getAuthorizerId()));
|
||||
} else {
|
||||
entity.setAuthorizer(null);
|
||||
}
|
||||
if(vo.getEvaluationFileId() != null){
|
||||
CompanyCustomerEvaluationFormFileService evaluationFileService = SpringApp.getBean(CompanyCustomerEvaluationFormFileService.class);
|
||||
entity.setEvaluationFile(evaluationFileService.findById(vo.getEvaluationFileId()));
|
||||
}else{
|
||||
entity.setEvaluationFile(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@ package com.ecep.contract.ds.project.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.model.CompanyBankAccount;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -17,14 +13,21 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.ContractFileType;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.project.repository.ProjectSaleTypeRequireFileTypeRepository;
|
||||
import com.ecep.contract.model.ProjectSaleTypeRequireFileType;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.ProjectSaleTypeRequireFileTypeVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "project-sale-type-require-file-type")
|
||||
public class ProjectSaleTypeRequireFileTypeService implements IEntityService<ProjectSaleTypeRequireFileType>, QueryService<ProjectSaleTypeRequireFileType> {
|
||||
public class ProjectSaleTypeRequireFileTypeService implements IEntityService<ProjectSaleTypeRequireFileType>, QueryService<ProjectSaleTypeRequireFileType>, VoableService<ProjectSaleTypeRequireFileType, ProjectSaleTypeRequireFileTypeVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectSaleTypeRequireFileTypeRepository repository;
|
||||
@@ -92,5 +95,29 @@ public class ProjectSaleTypeRequireFileTypeService implements IEntityService<Pro
|
||||
repository.delete(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectSaleTypeRequireFileType model, ProjectSaleTypeRequireFileTypeVo vo) {
|
||||
if (model == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置基本属性
|
||||
model.setFileType(vo.getFileType());
|
||||
|
||||
// 转换frequency从String到ContractFileType.Frequency枚举
|
||||
if (vo.getFrequency() != null) {
|
||||
try {
|
||||
model.setFrequency(ContractFileType.Frequency.valueOf(vo.getFrequency()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// 如果枚举值不存在,保持原来的值
|
||||
}
|
||||
}
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getSaleTypeId() == null) {
|
||||
model.setSaleType(null);
|
||||
} else {
|
||||
model.setSaleType(SpringApp.getBean(ProjectSaleTypeService.class).findById(vo.getSaleTypeId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ import com.ecep.contract.vo.ProjectSaleTypeVo;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "project-sale-type")
|
||||
public class ProjectSaleTypeService implements IEntityService<ProjectSaleType>, QueryService<ProjectSaleType>, VoableService<ProjectSaleType, ProjectSaleTypeVo> {
|
||||
public class ProjectSaleTypeService implements IEntityService<ProjectSaleType>, QueryService<ProjectSaleType>,
|
||||
VoableService<ProjectSaleType, ProjectSaleTypeVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectSaleTypeRepository saleTypeRepository;
|
||||
@@ -97,6 +98,10 @@ public class ProjectSaleTypeService implements IEntityService<ProjectSaleType>,
|
||||
|
||||
@Override
|
||||
public void updateByVo(ProjectSaleType saleType, ProjectSaleTypeVo vo) {
|
||||
if (saleType == null || vo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
saleType.setName(vo.getName());
|
||||
saleType.setCode(vo.getCode());
|
||||
@@ -104,14 +109,13 @@ public class ProjectSaleTypeService implements IEntityService<ProjectSaleType>,
|
||||
saleType.setDescription(vo.getDescription());
|
||||
saleType.setStoreByYear(vo.isStoreByYear());
|
||||
saleType.setCriticalProjectDecision(vo.isCriticalProjectDecision());
|
||||
|
||||
// 处理Double类型的criticalProjectLimit
|
||||
if (vo.getCriticalProjectLimit() != null) {
|
||||
saleType.setCriticalProjectLimit(vo.getCriticalProjectLimit());
|
||||
}
|
||||
|
||||
saleType.setCriticalProjectLimit(vo.getCriticalProjectLimit() != null ? vo.getCriticalProjectLimit() : 0);
|
||||
saleType.setActive(vo.isActive());
|
||||
|
||||
|
||||
saleType.setCriticalProjectLimit(vo.getCriticalProjectLimit());
|
||||
|
||||
saleType.setActive(vo.isActive());
|
||||
|
||||
// ProjectSaleTypeVo中的created和version字段在ProjectSaleType实体中不存在,这里不做处理
|
||||
// 如果需要处理,可以添加日志记录或者其他逻辑
|
||||
}
|
||||
|
||||
@@ -10,13 +10,18 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorApprovedFileRepository;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.VendorApprovedFileVo;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class VendorApprovedFileService implements IEntityService<VendorApprovedFile> {
|
||||
public class VendorApprovedFileService
|
||||
implements IEntityService<VendorApprovedFile>, VoableService<VendorApprovedFile, VendorApprovedFileVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorApprovedFileRepository repository;
|
||||
@@ -44,15 +49,14 @@ public class VendorApprovedFileService implements IEntityService<VendorApprovedF
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("fileName"), "%" + searchText + "%"),
|
||||
builder.like(root.get("description"), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据查询规格和分页参数获取供应商已批准文件列表
|
||||
*
|
||||
* @param spec 查询规格
|
||||
* @param spec 查询规格
|
||||
* @param pageable 分页参数
|
||||
* @return 分页的文件列表
|
||||
*/
|
||||
@@ -86,7 +90,7 @@ public class VendorApprovedFileService implements IEntityService<VendorApprovedF
|
||||
* 根据已批准列表和文件名查找特定文件
|
||||
*
|
||||
* @param approvedList 已批准列表
|
||||
* @param name 文件名
|
||||
* @param name 文件名
|
||||
* @return 找到的文件实体
|
||||
*/
|
||||
public VendorApprovedFile findByName(VendorApproved approvedList, String name) {
|
||||
@@ -102,4 +106,30 @@ public class VendorApprovedFileService implements IEntityService<VendorApprovedF
|
||||
public List<VendorApprovedFile> findAllByList(VendorApproved list) {
|
||||
return repository.findAllByListId(list.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorApprovedFile entity, VendorApprovedFileVo vo) throws ServiceException {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("VendorApprovedFile entity cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorApprovedFileVo cannot be null");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
entity.setFileName(vo.getFileName());
|
||||
entity.setSignDate(vo.getSignDate());
|
||||
entity.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getListId() != null) {
|
||||
VendorApprovedService vendorApprovedService = SpringApp.getBean(VendorApprovedService.class);
|
||||
VendorApproved vendorApproved = vendorApprovedService.findById(vo.getListId());
|
||||
if (vendorApproved != null) {
|
||||
entity.setList(vendorApproved);
|
||||
}
|
||||
} else {
|
||||
entity.setList(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,6 @@ package com.ecep.contract.ds.vendor.service;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -15,20 +12,30 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.company.service.CompanyOldNameService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorApprovedItemRepository;
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.model.CompanyOldName;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.VendorApprovedItem;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
import com.ecep.contract.model.VendorApprovedItem;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorApprovedItemVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class VendorApprovedItemService implements IEntityService<VendorApprovedItem>, QueryService<VendorApprovedItem> {
|
||||
public class VendorApprovedItemService implements IEntityService<VendorApprovedItem>, QueryService<VendorApprovedItem>,
|
||||
VoableService<VendorApprovedItem, VendorApprovedItemVo> {
|
||||
|
||||
private final VendorApprovedFileService vendorApprovedFileService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorApprovedItemRepository repository;
|
||||
@@ -36,6 +43,10 @@ public class VendorApprovedItemService implements IEntityService<VendorApprovedI
|
||||
@Autowired
|
||||
private CompanyOldNameService companyOldNameService;
|
||||
|
||||
VendorApprovedItemService(VendorApprovedFileService vendorApprovedFileService) {
|
||||
this.vendorApprovedFileService = vendorApprovedFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VendorApprovedItem findById(Integer id) {
|
||||
return repository.findById(id).orElse(null);
|
||||
@@ -48,20 +59,19 @@ public class VendorApprovedItemService implements IEntityService<VendorApprovedI
|
||||
Path<Company> company = vendor.get("company");
|
||||
|
||||
List<CompanyOldName> oldNames = companyOldNameService.search(searchText);
|
||||
Predicate companyPredicate = oldNames.isEmpty() ? builder.like(company.get("name"), "%" + searchText + "%") : builder.or(
|
||||
builder.like(company.get("name"), "%" + searchText + "%"),
|
||||
company.get("id").in(oldNames.stream().map(CompanyOldName::getCompanyId).collect(Collectors.toList()))
|
||||
);
|
||||
Predicate companyPredicate = oldNames.isEmpty() ? builder.like(company.get("name"), "%" + searchText + "%")
|
||||
: builder.or(
|
||||
builder.like(company.get("name"), "%" + searchText + "%"),
|
||||
company.get("id").in(
|
||||
oldNames.stream().map(CompanyOldName::getCompanyId).collect(Collectors.toList())));
|
||||
return builder.or(
|
||||
builder.and(
|
||||
vendor.isNotNull(),
|
||||
builder.and(
|
||||
company.isNotNull(),
|
||||
companyPredicate
|
||||
)),
|
||||
companyPredicate)),
|
||||
builder.like(root.get("vendorName"), "%" + searchText + "%"),
|
||||
builder.like(root.get("description"), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,4 +108,36 @@ public class VendorApprovedItemService implements IEntityService<VendorApprovedI
|
||||
public List<VendorApprovedItem> findAllByListAndVendor(VendorApproved approvedList, Vendor vendor) {
|
||||
return repository.findAllByListAndVendor(approvedList, vendor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorApprovedItem entity, VendorApprovedItemVo vo) throws ServiceException {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("VendorApprovedItem entity cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorApprovedItemVo cannot be null");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
entity.setVendorName(vo.getVendorName());
|
||||
entity.setType(vo.getType());
|
||||
entity.setDescription(vo.getDescription());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getListId() != null) {
|
||||
VendorApprovedService vendorApprovedService = SpringApp.getBean(VendorApprovedService.class);
|
||||
VendorApproved vendorApproved = vendorApprovedService.findById(vo.getListId());
|
||||
if (vendorApproved != null) {
|
||||
entity.setList(vendorApproved);
|
||||
}
|
||||
}
|
||||
|
||||
if (vo.getVendorId() != null) {
|
||||
VendorService vendorService = SpringApp.getBean(VendorService.class);
|
||||
Vendor vendor = vendorService.findById(vo.getVendorId());
|
||||
if (vendor != null) {
|
||||
entity.setVendor(vendor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package com.ecep.contract.ds.vendor.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||
import com.ecep.contract.ds.other.service.SysConfService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorApprovedRepository;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -23,17 +18,25 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||
import com.ecep.contract.ds.other.service.SysConfService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorApprovedRepository;
|
||||
import com.ecep.contract.model.VendorApproved;
|
||||
import com.ecep.contract.model.VendorApprovedFile;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorApprovedVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class VendorApprovedService implements IEntityService<VendorApproved>, QueryService<VendorApproved> {
|
||||
public class VendorApprovedService implements IEntityService<VendorApproved>, QueryService<VendorApproved>,
|
||||
VoableService<VendorApproved, VendorApprovedVo> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(VendorApprovedService.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
@@ -49,7 +52,6 @@ public class VendorApprovedService implements IEntityService<VendorApproved>, Qu
|
||||
@Autowired
|
||||
private SysConfService confService;
|
||||
|
||||
|
||||
public File getBasePath() {
|
||||
return new File(confService.getString(CompanyVendorConstant.KEY_APPROVED_LIST_BASE_PATH));
|
||||
}
|
||||
@@ -195,7 +197,7 @@ public class VendorApprovedService implements IEntityService<VendorApproved>, Qu
|
||||
return modfied;
|
||||
}
|
||||
|
||||
//update db
|
||||
// update db
|
||||
retrieveFiles.forEach(v -> {
|
||||
v.setList(list);
|
||||
fileService.save(v);
|
||||
@@ -212,4 +214,20 @@ public class VendorApprovedService implements IEntityService<VendorApproved>, Qu
|
||||
return vendorFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorApproved model, VendorApprovedVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("VendorApproved cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorApprovedVo cannot be null");
|
||||
}
|
||||
|
||||
// Map properties from VO to entity
|
||||
model.setTitle(vo.getTitle());
|
||||
model.setPublishDate(vo.getPublishDate());
|
||||
model.setPath(vo.getPath());
|
||||
model.setDescription(vo.getDescription());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@ import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorClassRepository;
|
||||
import com.ecep.contract.model.VendorCatalog;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorCatalogVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -27,7 +30,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-catalog")
|
||||
public class VendorCatalogService implements IEntityService<VendorCatalog>, QueryService<VendorCatalog> {
|
||||
public class VendorCatalogService implements IEntityService<VendorCatalog>, QueryService<VendorCatalog>,
|
||||
VoableService<VendorCatalog, VendorCatalogVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorClassRepository repository;
|
||||
@@ -82,4 +86,19 @@ public class VendorCatalogService implements IEntityService<VendorCatalog>, Quer
|
||||
public VendorCatalog save(VendorCatalog entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorCatalog model, VendorCatalogVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("VendorCatalog cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorCatalogVo cannot be null");
|
||||
}
|
||||
|
||||
// Map properties from VO to entity (id属性不更新)
|
||||
model.setName(vo.getName());
|
||||
model.setCode(vo.getCode());
|
||||
model.setType(vo.getType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.ecep.contract.ds.vendor.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.QueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -16,16 +15,22 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorEntityRepository;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.VendorEntity;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorEntityVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "company-vendor-entity")
|
||||
public class VendorEntityService implements IEntityService<VendorEntity>, QueryService<VendorEntity> {
|
||||
public class VendorEntityService implements IEntityService<VendorEntity>, QueryService<VendorEntity>,
|
||||
VoableService<VendorEntity, VendorEntityVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorEntityRepository repository;
|
||||
@@ -60,8 +65,7 @@ public class VendorEntityService implements IEntityService<VendorEntity>, QueryS
|
||||
return builder.or(
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("abbName"), "%" + searchText + "%"),
|
||||
builder.like(root.get("code"), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(root.get("code"), "%" + searchText + "%"));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,23 +91,19 @@ public class VendorEntityService implements IEntityService<VendorEntity>, QueryS
|
||||
return findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
@Override
|
||||
public void delete(VendorEntity entity) {
|
||||
repository.delete(entity);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
@Override
|
||||
public VendorEntity save(VendorEntity entity) {
|
||||
return repository.save(entity);
|
||||
@@ -112,4 +112,41 @@ public class VendorEntityService implements IEntityService<VendorEntity>, QueryS
|
||||
public List<VendorEntity> findAllByVendor(Vendor vendor) {
|
||||
return repository.findByVendor(vendor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorEntity model, VendorEntityVo vo) {
|
||||
// 处理关联对象
|
||||
if (vo.getVendorId() == null) {
|
||||
model.setVendor(null);
|
||||
} else {
|
||||
model.setVendor(SpringApp.getBean(VendorService.class).findById(vo.getVendorId()));
|
||||
}
|
||||
|
||||
// 更新基本属性
|
||||
model.setName(vo.getName());
|
||||
model.setAbbName(vo.getAbbName());
|
||||
model.setCode(vo.getCode());
|
||||
model.setModifyDate(vo.getModifyDate());
|
||||
model.setDevelopDate(vo.getDevelopDate());
|
||||
model.setUpdatedDate(vo.getUpdatedDate());
|
||||
model.setFetchedTime(vo.getFetchedTime());
|
||||
|
||||
if (vo.getCatalogId() == null) {
|
||||
model.setCatalog(null);
|
||||
} else {
|
||||
model.setCatalog(SpringApp.getBean(VendorCatalogService.class).findById(vo.getCatalogId()));
|
||||
}
|
||||
|
||||
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
|
||||
if (vo.getCreatorId() == null) {
|
||||
model.setCreator(null);
|
||||
} else {
|
||||
model.setCreator(employeeService.findById(vo.getCreatorId()));
|
||||
}
|
||||
if (vo.getModifierId() == null) {
|
||||
model.setModifier(null);
|
||||
} else {
|
||||
model.setModifier(employeeService.findById(vo.getModifierId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,6 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.ecep.contract.*;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,19 +16,29 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.MyDateTimeUtils;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.ds.company.service.CompanyBasicService;
|
||||
import com.ecep.contract.ds.contract.service.ContractFileService;
|
||||
import com.ecep.contract.ds.contract.service.ContractService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorFileRepository;
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.model.Vendor;
|
||||
import com.ecep.contract.model.VendorFile;
|
||||
import com.ecep.contract.model.Contract;
|
||||
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorFileVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
public class VendorFileService implements IEntityService<VendorFile>, QueryService<VendorFile> {
|
||||
|
||||
public class VendorFileService
|
||||
implements IEntityService<VendorFile>, QueryService<VendorFile>, VoableService<VendorFile, VendorFileVo> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(VendorFileService.class);
|
||||
|
||||
@@ -103,9 +110,9 @@ public class VendorFileService implements IEntityService<VendorFile>, QueryServi
|
||||
/**
|
||||
* 验证供应商文件
|
||||
*
|
||||
* @param vendor 供应商
|
||||
* @param verifyDate 验证日期
|
||||
* @param holder 状态输出
|
||||
* @param vendor 供应商
|
||||
* @param verifyDate 验证日期
|
||||
* @param holder 状态输出
|
||||
*/
|
||||
public void verify(Vendor vendor, LocalDate verifyDate, MessageHolder holder) {
|
||||
// 验证最早日期,之前属于历史问题,不做处理
|
||||
@@ -207,5 +214,30 @@ public class VendorFileService implements IEntityService<VendorFile>, QueryServi
|
||||
return CompanyBasicService.adjustToWorkDay(setupDate.plusDays(-7));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorFile model, VendorFileVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("VendorFile cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorFileVo cannot be null");
|
||||
}
|
||||
|
||||
// Map properties from VO to entity
|
||||
model.setType(vo.getType());
|
||||
model.setFilePath(vo.getFilePath());
|
||||
model.setEditFilePath(vo.getEditFilePath());
|
||||
model.setSignDate(vo.getSignDate());
|
||||
model.setValid(vo.isValid());
|
||||
|
||||
if (vo.getVendorId() == null) {
|
||||
model.setVendor(null);
|
||||
} else {
|
||||
VendorService vendorService = SpringApp.getBean(VendorService.class);
|
||||
model.setVendor(vendorService.findById(vo.getVendorId()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.ecep.contract.ds.vendor.service;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ecep.contract.VendorType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -19,10 +18,14 @@ import org.springframework.util.StringUtils;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.VendorFileType;
|
||||
import com.ecep.contract.VendorType;
|
||||
import com.ecep.contract.constant.ServiceConstant;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorFileTypeLocalRepository;
|
||||
import com.ecep.contract.model.VendorFileTypeLocal;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorFileTypeLocalVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
@@ -32,7 +35,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-file-type")
|
||||
public class VendorFileTypeService implements IEntityService<VendorFileTypeLocal>, QueryService<VendorFileTypeLocal> {
|
||||
public class VendorFileTypeService implements IEntityService<VendorFileTypeLocal>, QueryService<VendorFileTypeLocal>,
|
||||
VoableService<VendorFileTypeLocal, VendorFileTypeLocalVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorFileTypeLocalRepository repository;
|
||||
@@ -45,7 +49,8 @@ public class VendorFileTypeService implements IEntityService<VendorFileTypeLocal
|
||||
}
|
||||
|
||||
if (paramsNode.has("type")) {
|
||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"), VendorType.valueOf(paramsNode.get("type").asText())));
|
||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
||||
VendorType.valueOf(paramsNode.get("type").asText())));
|
||||
}
|
||||
|
||||
// field
|
||||
@@ -76,10 +81,10 @@ public class VendorFileTypeService implements IEntityService<VendorFileTypeLocal
|
||||
}
|
||||
return (root, query, builder) -> {
|
||||
return
|
||||
// builder.or(
|
||||
builder.like(root.get("type"), "%" + searchText + "%")
|
||||
// )
|
||||
;
|
||||
// builder.or(
|
||||
builder.like(root.get("type"), "%" + searchText + "%")
|
||||
// )
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,4 +105,19 @@ public class VendorFileTypeService implements IEntityService<VendorFileTypeLocal
|
||||
public VendorFileTypeLocal save(VendorFileTypeLocal entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorFileTypeLocal entity, VendorFileTypeLocalVo vo) throws ServiceException {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("VendorFileTypeLocal entity cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorFileTypeLocalVo cannot be null");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
entity.setLang(vo.getLang());
|
||||
entity.setValue(vo.getValue());
|
||||
entity.setType(vo.getType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@ package com.ecep.contract.ds.vendor.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -16,13 +13,23 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorGroupRequireFileTypeRepository;
|
||||
import com.ecep.contract.model.VendorGroup;
|
||||
import com.ecep.contract.model.VendorGroupRequireFileType;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.vo.VendorGroupRequireFileTypeVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-group-require-file-type")
|
||||
public class VendorGroupRequireFileTypeService implements IEntityService<VendorGroupRequireFileType>, QueryService<VendorGroupRequireFileType> {
|
||||
public class VendorGroupRequireFileTypeService
|
||||
implements IEntityService<VendorGroupRequireFileType>, QueryService<VendorGroupRequireFileType>,
|
||||
VoableService<VendorGroupRequireFileType, VendorGroupRequireFileTypeVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorGroupRequireFileTypeRepository repository;
|
||||
@@ -64,13 +71,11 @@ public class VendorGroupRequireFileTypeService implements IEntityService<VendorG
|
||||
}
|
||||
|
||||
// save
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'byGroup-'+#p0.group.id"),
|
||||
@CacheEvict(key = "'all'")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'byGroup-'+#p0.group.id"),
|
||||
@CacheEvict(key = "'all'")
|
||||
})
|
||||
public VendorGroupRequireFileType save(VendorGroupRequireFileType type) {
|
||||
return repository.save(type);
|
||||
}
|
||||
@@ -78,15 +83,35 @@ public class VendorGroupRequireFileTypeService implements IEntityService<VendorG
|
||||
/**
|
||||
* delete and evict cache
|
||||
*/
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'byGroup-'+#p0.group.id"),
|
||||
@CacheEvict(key = "'all'")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'byGroup-'+#p0.group.id"),
|
||||
@CacheEvict(key = "'all'")
|
||||
})
|
||||
public void delete(VendorGroupRequireFileType type) {
|
||||
repository.delete(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorGroupRequireFileType entity, VendorGroupRequireFileTypeVo vo) throws ServiceException {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("VendorGroupRequireFileType entity cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorGroupRequireFileTypeVo cannot be null");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
entity.setId(vo.getId());
|
||||
entity.setFileType(vo.getFileType());
|
||||
entity.setFrequency(vo.getFrequency());
|
||||
|
||||
// 处理关联实体
|
||||
if (vo.getGroupId() != null) {
|
||||
VendorGroupService vendorGroupService = SpringApp.getBean(VendorGroupService.class);
|
||||
VendorGroup vendorGroup = vendorGroupService.findById(vo.getGroupId());
|
||||
if (vendorGroup != null) {
|
||||
entity.setGroup(vendorGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.ecep.contract.ds.vendor.service;
|
||||
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorGroupRepository;
|
||||
import com.ecep.contract.model.VendorGroup;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -17,12 +13,21 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ecep.contract.IEntityService;
|
||||
import com.ecep.contract.QueryService;
|
||||
import com.ecep.contract.ds.vendor.repository.VendorGroupRepository;
|
||||
import com.ecep.contract.model.VendorGroup;
|
||||
import com.ecep.contract.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorGroupVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-group")
|
||||
public class VendorGroupService implements IEntityService<VendorGroup>, QueryService<VendorGroup> {
|
||||
public class VendorGroupService
|
||||
implements IEntityService<VendorGroup>, QueryService<VendorGroup>, VoableService<VendorGroup, VendorGroupVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorGroupRepository vendorGroupRepository;
|
||||
@@ -96,4 +101,22 @@ public class VendorGroupService implements IEntityService<VendorGroup>, QuerySer
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorGroup model, VendorGroupVo vo) {
|
||||
if (model == null) {
|
||||
throw new ServiceException("VendorGroup cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorGroupVo cannot be null");
|
||||
}
|
||||
// Map properties from VO to entity
|
||||
model.setName(vo.getName());
|
||||
model.setCode(vo.getCode());
|
||||
model.setDescription(vo.getDescription());
|
||||
model.setActive(vo.isActive());
|
||||
model.setPriceComparison(vo.isPriceComparison());
|
||||
model.setRequireQuotationSheetForBid(vo.isRequireQuotationSheetForBid());
|
||||
model.setCanPrePurchase(vo.isCanPrePurchase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,13 +21,16 @@ 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.service.ServiceException;
|
||||
import com.ecep.contract.service.VoableService;
|
||||
import com.ecep.contract.util.SpecificationUtils;
|
||||
import com.ecep.contract.vo.VendorTypeLocalVo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-type")
|
||||
public class VendorTypeService implements IEntityService<VendorTypeLocal>, QueryService<VendorTypeLocal> {
|
||||
public class VendorTypeService implements IEntityService<VendorTypeLocal>, QueryService<VendorTypeLocal>, VoableService<VendorTypeLocal, VendorTypeLocalVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorTypeLocalRepository repository;
|
||||
@@ -95,4 +98,19 @@ public class VendorTypeService implements IEntityService<VendorTypeLocal>, Query
|
||||
public VendorTypeLocal save(VendorTypeLocal entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByVo(VendorTypeLocal entity, VendorTypeLocalVo vo) throws ServiceException {
|
||||
if (entity == null) {
|
||||
throw new ServiceException("VendorTypeLocal entity cannot be null");
|
||||
}
|
||||
if (vo == null) {
|
||||
throw new ServiceException("VendorTypeLocalVo cannot be null");
|
||||
}
|
||||
|
||||
// 映射基本属性
|
||||
entity.setLang(vo.getLang());
|
||||
entity.setType(vo.getType());
|
||||
entity.setValue(vo.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user