Compare commits

...

2 Commits

Author SHA1 Message Date
0b45f6eef2 refactor: 优化上下文对象初始化方式
将InventoryCtx、VendorCtx和CustomerCtx的初始化方式改为直接通过构造函数传入上下文对象,简化代码并提高可读性
2025-10-16 23:53:35 +08:00
22ab2c7bdf refactor(u8上下文): 重构上下文类初始化方式,使用BeanContext传递依赖
移除from方法,改为通过构造函数注入BeanContext
统一使用getCachedBean获取服务实例
添加无参构造函数和带BeanContext参数的构造函数
优化代码结构,移除无用导入
2025-10-16 18:52:25 +08:00
15 changed files with 187 additions and 147 deletions

View File

@@ -40,16 +40,12 @@ public class AbstractYongYouU8Ctx extends AbstractCtx {
super(ctx); super(ctx);
} }
public void from(AbstractYongYouU8Ctx parent) {
repository = parent.repository;
}
public void initializeRepository(MessageHolder holder) { public void initializeRepository(MessageHolder holder) {
if (repository != null) { if (repository != null) {
return; return;
} }
try { try {
repository = getBean(YongYouU8Repository.class); repository = getCachedBean(YongYouU8Repository.class);
} catch (BeansException e) { } catch (BeansException e) {
holder.warn("未启用 " + CloudServiceConstant.U8_NAME + " 服务"); holder.warn("未启用 " + CloudServiceConstant.U8_NAME + " 服务");
} }

View File

@@ -1,22 +1,22 @@
package com.ecep.contract.cloud.u8.ctx; package com.ecep.contract.cloud.u8.ctx;
import static com.ecep.contract.SpringApp.getBean;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.ds.company.service.CompanyBankAccountService;
import com.ecep.contract.ds.company.model.Company; import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.company.service.CompanyBankAccountService;
import lombok.Setter; import com.ecep.contract.util.BeanContext;
public class CompanyBankAccountCtx extends AbstractYongYouU8Ctx { public class CompanyBankAccountCtx extends AbstractYongYouU8Ctx {
@Setter
private CompanyBankAccountService companyBankAccountService; public CompanyBankAccountCtx() {
super();
}
public CompanyBankAccountCtx(BeanContext ctx) {
super(ctx);
}
CompanyBankAccountService getCompanyBankAccountService() { CompanyBankAccountService getCompanyBankAccountService() {
if (companyBankAccountService == null) { return getCachedBean(CompanyBankAccountService.class);
companyBankAccountService = getBean(CompanyBankAccountService.class);
}
return companyBankAccountService;
} }
public void updateBankAccount(Company company, String bank, String bankAccount, MessageHolder holder) { public void updateBankAccount(Company company, String bank, String bankAccount, MessageHolder holder) {

View File

@@ -1,22 +1,29 @@
package com.ecep.contract.cloud.u8.ctx; package com.ecep.contract.cloud.u8.ctx;
import static com.ecep.contract.SpringApp.getBean;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import com.ecep.contract.ds.company.CompanyContext;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.constant.CloudServiceConstant; import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.constant.CloudYuConstant; import com.ecep.contract.constant.CloudYuConstant;
import com.ecep.contract.ds.company.service.CompanyService; import com.ecep.contract.ds.company.CompanyContext;
import com.ecep.contract.ds.company.model.Company; import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.company.model.CompanyOldName; import com.ecep.contract.ds.company.model.CompanyOldName;
import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.util.BeanContext;
public class CompanyCtx extends AbstractYongYouU8Ctx implements CompanyContext { public class CompanyCtx extends AbstractYongYouU8Ctx implements CompanyContext {
public CompanyCtx() {
super();
}
public CompanyCtx(BeanContext ctx) {
super(ctx);
}
public boolean updateCompanyNameIfAbsent(Company company, String name, MessageHolder holder) { public boolean updateCompanyNameIfAbsent(Company company, String name, MessageHolder holder) {
if (!StringUtils.hasText(name)) { if (!StringUtils.hasText(name)) {
return false; return false;

View File

@@ -14,13 +14,9 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.ecep.contract.cloud.old.OldVersionService;
import com.ecep.contract.vo.*;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@@ -28,8 +24,14 @@ import com.ecep.contract.ContractFileType;
import com.ecep.contract.ContractPayWay; import com.ecep.contract.ContractPayWay;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.MyDateTimeUtils; import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.cloud.old.OldVersionService;
import com.ecep.contract.constant.CloudServiceConstant; import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.ds.company.CompanyFileUtils; import com.ecep.contract.ds.company.CompanyFileUtils;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.ds.contract.model.ContractFile;
import com.ecep.contract.ds.contract.model.ContractItem;
import com.ecep.contract.ds.contract.model.ContractPayPlan;
import com.ecep.contract.ds.contract.service.ContractFileService; import com.ecep.contract.ds.contract.service.ContractFileService;
import com.ecep.contract.ds.contract.service.ContractFileTypeService; import com.ecep.contract.ds.contract.service.ContractFileTypeService;
import com.ecep.contract.ds.contract.service.ContractGroupService; import com.ecep.contract.ds.contract.service.ContractGroupService;
@@ -38,30 +40,29 @@ import com.ecep.contract.ds.contract.service.ContractKindService;
import com.ecep.contract.ds.contract.service.ContractPayPlanService; import com.ecep.contract.ds.contract.service.ContractPayPlanService;
import com.ecep.contract.ds.contract.service.ContractService; import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.contract.service.ContractTypeService; import com.ecep.contract.ds.contract.service.ContractTypeService;
import com.ecep.contract.ds.customer.model.CompanyCustomer;
import com.ecep.contract.ds.customer.model.CompanyCustomerEntity;
import com.ecep.contract.ds.customer.service.CompanyCustomerEntityService; import com.ecep.contract.ds.customer.service.CompanyCustomerEntityService;
import com.ecep.contract.ds.customer.service.CustomerService; import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.ds.project.ProjectCtx; import com.ecep.contract.ds.project.ProjectCtx;
import com.ecep.contract.ds.project.service.ProjectSaleTypeService; import com.ecep.contract.ds.project.service.ProjectSaleTypeService;
import com.ecep.contract.ds.vendor.service.VendorEntityService;
import com.ecep.contract.ds.vendor.service.VendorService;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.customer.model.CompanyCustomer;
import com.ecep.contract.ds.customer.model.CompanyCustomerEntity;
import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.model.ContractCatalog;
import com.ecep.contract.ds.contract.model.ContractFile;
import com.ecep.contract.ds.contract.model.ContractItem;
import com.ecep.contract.model.ContractKind;
import com.ecep.contract.ds.contract.model.ContractPayPlan;
import com.ecep.contract.model.ContractType;
import com.ecep.contract.model.Employee;
import com.ecep.contract.ds.project.model.Project;
import com.ecep.contract.model.ProjectSaleType;
import com.ecep.contract.ds.vendor.model.Vendor; import com.ecep.contract.ds.vendor.model.Vendor;
import com.ecep.contract.ds.vendor.model.VendorEntity; import com.ecep.contract.ds.vendor.model.VendorEntity;
import com.ecep.contract.ds.vendor.service.VendorEntityService;
import com.ecep.contract.ds.vendor.service.VendorService;
import com.ecep.contract.util.BeanContext;
import com.ecep.contract.util.FileUtils; import com.ecep.contract.util.FileUtils;
import com.ecep.contract.util.NumberUtils; import com.ecep.contract.util.NumberUtils;
import com.ecep.contract.util.TaxRateUtils; import com.ecep.contract.util.TaxRateUtils;
import com.ecep.contract.vo.CompanyCustomerEntityVo;
import com.ecep.contract.vo.ContractCatalogVo;
import com.ecep.contract.vo.ContractFileTypeLocalVo;
import com.ecep.contract.vo.ContractFileVo;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.CustomerVo;
import com.ecep.contract.vo.ProjectSaleTypeVo;
import com.ecep.contract.vo.ProjectVo;
import com.ecep.contract.vo.VendorEntityVo;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -87,6 +88,15 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
@Setter @Setter
private int customerEntityUpdateDelayDays = 1; private int customerEntityUpdateDelayDays = 1;
public ContractCtx() {
super();
}
public ContractCtx(BeanContext ctx) {
super(ctx);
}
public ContractService getContractService() { public ContractService getContractService() {
return getCachedBean(ContractService.class); return getCachedBean(ContractService.class);
} }
@@ -109,39 +119,35 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
VendorCtx getVendorCtx() { VendorCtx getVendorCtx() {
if (vendorCtx == null) { if (vendorCtx == null) {
vendorCtx = new VendorCtx(); vendorCtx = new VendorCtx(this);
vendorCtx.from(this);
} }
return vendorCtx; return vendorCtx;
} }
CompanyCtx getCompanyCtx() { CompanyCtx getCompanyCtx() {
if (companyCtx == null) { if (companyCtx == null) {
companyCtx = new CompanyCtx(); companyCtx = new CompanyCtx(this);
companyCtx.from(this);
} }
return companyCtx; return companyCtx;
} }
CustomerCtx getCustomerCtx() { CustomerCtx getCustomerCtx() {
if (customerCtx == null) { if (customerCtx == null) {
customerCtx = new CustomerCtx(); customerCtx = new CustomerCtx(this);
customerCtx.from(this);
} }
return customerCtx; return customerCtx;
} }
InventoryCtx getInventoryCtx() { InventoryCtx getInventoryCtx() {
if (inventoryCtx == null) { if (inventoryCtx == null) {
inventoryCtx = new InventoryCtx(); inventoryCtx = new InventoryCtx(this);
inventoryCtx.from(this);
} }
return inventoryCtx; return inventoryCtx;
} }
ProjectCtx getProjectCtx() { ProjectCtx getProjectCtx() {
if (projectCtx == null) { if (projectCtx == null) {
projectCtx = new ProjectCtx(); projectCtx = new ProjectCtx(this);
} }
return projectCtx; return projectCtx;
} }
@@ -262,15 +268,18 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
"变更日期")) { "变更日期")) {
modified = true; modified = true;
} }
if (updateEmployeeIdByName(contract::getSetupPersonId, contract::setSetupPersonId, (String) rs.get("strSetupPerson"), if (updateEmployeeIdByName(contract::getSetupPersonId, contract::setSetupPersonId,
(String) rs.get("strSetupPerson"),
holder, "提交人")) { holder, "提交人")) {
modified = true; modified = true;
} }
if (updateEmployeeIdByName(contract::getInurePersonId, contract::setInurePersonId, (String) rs.get("strInurePerson"), if (updateEmployeeIdByName(contract::getInurePersonId, contract::setInurePersonId,
(String) rs.get("strInurePerson"),
holder, "生效人")) { holder, "生效人")) {
modified = true; modified = true;
} }
if (updateEmployeeIdByName(contract::getVaryPersonId, contract::setVaryPersonId, (String) rs.get("strVaryPerson"), if (updateEmployeeIdByName(contract::getVaryPersonId, contract::setVaryPersonId,
(String) rs.get("strVaryPerson"),
holder, "修改人")) { holder, "修改人")) {
modified = true; modified = true;
} }
@@ -364,7 +373,8 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
var contractCompany = getCompanyService().findById(companyId); var contractCompany = getCompanyService().findById(companyId);
var vendorCompany = getCompanyService().findById(vendor.getCompanyId()); var vendorCompany = getCompanyService().findById(vendor.getCompanyId());
holder.error( holder.error(
"供应商的企业和合同的企业不一致, 供应商的企业:" + vendorCompany.getName() + ",合同的企业:" + contractCompany.getName()); "供应商的企业和合同的企业不一致, 供应商的企业:" + vendorCompany.getName() + ",合同的企业:"
+ contractCompany.getName());
} }
} }
} }
@@ -435,7 +445,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
} }
private VendorEntityVo updateVendorEntityDetailByCode(VendorEntityVo entity, String unitCode, private VendorEntityVo updateVendorEntityDetailByCode(VendorEntityVo entity, String unitCode,
MessageHolder holder) { MessageHolder holder) {
if (vendorEntityUpdateDelayDays > 0) { if (vendorEntityUpdateDelayDays > 0) {
LocalDateTime today = LocalDateTime.now(); LocalDateTime today = LocalDateTime.now();
if (entity.getFetchedTime() != null) { if (entity.getFetchedTime() != null) {
@@ -627,7 +637,6 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
return updated; return updated;
} }
public ContractVo findContractByCode(String contractCode) { public ContractVo findContractByCode(String contractCode) {
var service = getContractService(); var service = getContractService();
return service.findByCode(contractCode); return service.findByCode(contractCode);
@@ -660,7 +669,7 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
* 客户数据要通过 CompanyCustomerEntity 表关联来从用友数据库中读取 * 客户数据要通过 CompanyCustomerEntity 表关联来从用友数据库中读取
*/ */
public boolean syncByCustomerEntity(CompanyCustomer companyCustomer, CompanyCustomerEntity entity, public boolean syncByCustomerEntity(CompanyCustomer companyCustomer, CompanyCustomerEntity entity,
MessageHolder holder) { MessageHolder holder) {
String code = entity.getCode(); String code = entity.getCode();
holder.debug("同步客户相关项 " + code + "," + entity.getName() + " 的合同"); holder.debug("同步客户相关项 " + code + "," + entity.getName() + " 的合同");
if (!StringUtils.hasText(code)) { if (!StringUtils.hasText(code)) {
@@ -1318,7 +1327,6 @@ public class ContractCtx extends AbstractYongYouU8Ctx {
return Math.max(suggestFileName.length(), value.length()); return Math.max(suggestFileName.length(), value.length());
} }
public boolean syncContractPayPlan(ContractVo contract, MessageHolder holder) { public boolean syncContractPayPlan(ContractVo contract, MessageHolder holder) {
if (repository == null) { if (repository == null) {
return false; return false;

View File

@@ -9,6 +9,7 @@ import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.customer.model.CompanyCustomer; import com.ecep.contract.ds.customer.model.CompanyCustomer;
import com.ecep.contract.ds.customer.model.CompanyCustomerEntity; import com.ecep.contract.ds.customer.model.CompanyCustomerEntity;
import com.ecep.contract.model.CustomerCatalog; import com.ecep.contract.model.CustomerCatalog;
import com.ecep.contract.util.BeanContext;
import com.ecep.contract.vo.CompanyCustomerEntityVo; import com.ecep.contract.vo.CompanyCustomerEntityVo;
import com.ecep.contract.vo.CustomerCatalogVo; import com.ecep.contract.vo.CustomerCatalogVo;
import lombok.Setter; import lombok.Setter;
@@ -25,6 +26,7 @@ import java.util.function.Supplier;
public class CustomerCtx extends AbstractYongYouU8Ctx { public class CustomerCtx extends AbstractYongYouU8Ctx {
private static final String AUTO_CREATE_CUSTOMER_AFTER = "cloud.u8.auto-create-customer-after"; private static final String AUTO_CREATE_CUSTOMER_AFTER = "cloud.u8.auto-create-customer-after";
@Setter @Setter
private CompanyCtx companyCtx; private CompanyCtx companyCtx;
@Setter @Setter
@@ -34,18 +36,24 @@ public class CustomerCtx extends AbstractYongYouU8Ctx {
@Setter @Setter
private CompanyCustomerEntityService customerEntityService; private CompanyCustomerEntityService customerEntityService;
public CustomerCtx() {
super();
}
public CustomerCtx(BeanContext ctx) {
super(ctx);
}
public CompanyCtx getCompanyCtx() { public CompanyCtx getCompanyCtx() {
if (companyCtx == null) { if (companyCtx == null) {
companyCtx = new CompanyCtx(); companyCtx = new CompanyCtx(this);
companyCtx.from(this);
} }
return companyCtx; return companyCtx;
} }
ContractCtx getContractCtx() { ContractCtx getContractCtx() {
if (contractCtx == null) { if (contractCtx == null) {
contractCtx = new ContractCtx(); contractCtx = new ContractCtx(this);
contractCtx.from(this);
} }
return contractCtx; return contractCtx;
} }
@@ -53,7 +61,6 @@ public class CustomerCtx extends AbstractYongYouU8Ctx {
CompanyBankAccountCtx getCompanyBankAccountCtx() { CompanyBankAccountCtx getCompanyBankAccountCtx() {
if (companyBankAccountCtx == null) { if (companyBankAccountCtx == null) {
companyBankAccountCtx = new CompanyBankAccountCtx(); companyBankAccountCtx = new CompanyBankAccountCtx();
companyBankAccountCtx.from(this);
} }
return companyBankAccountCtx; return companyBankAccountCtx;
} }

View File

@@ -1,7 +1,5 @@
package com.ecep.contract.cloud.u8.ctx; package com.ecep.contract.cloud.u8.ctx;
import static com.ecep.contract.SpringApp.getBean;
import java.util.Objects; import java.util.Objects;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
@@ -11,18 +9,19 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.ds.company.service.InvoiceService; import com.ecep.contract.ds.company.service.InvoiceService;
import com.ecep.contract.ds.other.model.Invoice; import com.ecep.contract.ds.other.model.Invoice;
import com.ecep.contract.util.BeanContext;
import lombok.Setter;
public class InvoiceCtx extends AbstractYongYouU8Ctx { public class InvoiceCtx extends AbstractYongYouU8Ctx {
@Setter public InvoiceCtx() {
private InvoiceService invoiceService; super();
}
public InvoiceCtx(BeanContext ctx) {
super(ctx);
}
InvoiceService getInvoiceService() { InvoiceService getInvoiceService() {
if (invoiceService == null) { return getCachedBean(InvoiceService.class);
invoiceService = getBean(InvoiceService.class);
}
return invoiceService;
} }
public boolean updateInvoiceByNumber(Supplier<Invoice> getter, Consumer<Invoice> setter, String invoiceNumber, public boolean updateInvoiceByNumber(Supplier<Invoice> getter, Consumer<Invoice> setter, String invoiceNumber,

View File

@@ -27,6 +27,7 @@ import com.ecep.contract.ds.vendor.model.Vendor;
import com.ecep.contract.ds.vendor.model.VendorEntity; import com.ecep.contract.ds.vendor.model.VendorEntity;
import com.ecep.contract.ds.contract.model.Contract; import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.model.Inventory; import com.ecep.contract.model.Inventory;
import com.ecep.contract.util.BeanContext;
import com.ecep.contract.ds.other.model.Invoice; import com.ecep.contract.ds.other.model.Invoice;
import com.ecep.contract.ds.vendor.model.PurchaseBillVoucher; import com.ecep.contract.ds.vendor.model.PurchaseBillVoucher;
import com.ecep.contract.ds.vendor.model.PurchaseBillVoucherItem; import com.ecep.contract.ds.vendor.model.PurchaseBillVoucherItem;
@@ -50,6 +51,14 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
InvoiceCtx invoiceCtx; InvoiceCtx invoiceCtx;
ContractCtx contractCtx; ContractCtx contractCtx;
public PurchaseBillVoucherCtx() {
super();
}
public PurchaseBillVoucherCtx(BeanContext ctx) {
super(ctx);
}
PurchaseOrdersService getPurchaseOrdersService() { PurchaseOrdersService getPurchaseOrdersService() {
if (purchaseOrdersService == null) { if (purchaseOrdersService == null) {
purchaseOrdersService = getBean(PurchaseOrdersService.class); purchaseOrdersService = getBean(PurchaseOrdersService.class);
@@ -80,24 +89,21 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
InventoryCtx getInventoryCtx() { InventoryCtx getInventoryCtx() {
if (inventoryCtx == null) { if (inventoryCtx == null) {
inventoryCtx = new InventoryCtx(); inventoryCtx = new InventoryCtx(this);
inventoryCtx.from(this);
} }
return inventoryCtx; return inventoryCtx;
} }
InvoiceCtx getInvoiceCtx() { InvoiceCtx getInvoiceCtx() {
if (invoiceCtx == null) { if (invoiceCtx == null) {
invoiceCtx = new InvoiceCtx(); invoiceCtx = new InvoiceCtx(this);
invoiceCtx.from(this);
} }
return invoiceCtx; return invoiceCtx;
} }
ContractCtx getContractCtx() { ContractCtx getContractCtx() {
if (contractCtx == null) { if (contractCtx == null) {
contractCtx = new ContractCtx(); contractCtx = new ContractCtx(this);
contractCtx.from(this);
} }
return contractCtx; return contractCtx;
} }
@@ -121,7 +127,8 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
// 查询 U8 数据库 // 查询 U8 数据库
List<Map<String, Object>> ds = repository.findAllPurchaseBillVoucherByVendorCode(entity.getCode()); List<Map<String, Object>> ds = repository.findAllPurchaseBillVoucherByVendorCode(entity.getCode());
holder.debug( holder.debug(
"供应商关联项: " + entity.getCode() + " 查找到 " + ds.size() + " 条专用发票记录在 " + CloudServiceConstant.U8_NAME); "供应商关联项: " + entity.getCode() + " 查找到 " + ds.size() + " 条专用发票记录在 "
+ CloudServiceConstant.U8_NAME);
for (Map<String, Object> map : ds) { for (Map<String, Object> map : ds) {
Integer pbvid = (Integer) map.get("PBVID"); Integer pbvid = (Integer) map.get("PBVID");
@@ -252,7 +259,7 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
} }
private boolean applyPurchaseBillVoucherDetail(PurchaseBillVoucher voucher, Map<String, Object> map, private boolean applyPurchaseBillVoucherDetail(PurchaseBillVoucher voucher, Map<String, Object> map,
MessageHolder holder) { MessageHolder holder) {
String code = String.valueOf(map.get("PBVID")); String code = String.valueOf(map.get("PBVID"));
String vendorCode = (String) map.get("cVenCode"); String vendorCode = (String) map.get("cVenCode");
String invoiceNumber = (String) map.get("cPBVCode"); String invoiceNumber = (String) map.get("cPBVCode");
@@ -314,7 +321,7 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
} }
private boolean applyPurchaseBillVoucherItemDetail(PurchaseBillVoucherItem item, Map<String, Object> map, private boolean applyPurchaseBillVoucherItemDetail(PurchaseBillVoucherItem item, Map<String, Object> map,
MessageHolder holder) { MessageHolder holder) {
String code = String.valueOf(map.get("ID")); String code = String.valueOf(map.get("ID"));
String inventoryCode = (String) map.get("cInvCode"); String inventoryCode = (String) map.get("cInvCode");
String contractCode = (String) map.get("ContractCode"); String contractCode = (String) map.get("ContractCode");
@@ -359,7 +366,7 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
} }
boolean updatePurchaseOrderItem(Supplier<PurchaseOrderItem> getter, Consumer<PurchaseOrderItem> setter, boolean updatePurchaseOrderItem(Supplier<PurchaseOrderItem> getter, Consumer<PurchaseOrderItem> setter,
Integer orderItemRefId, MessageHolder holder, String topic) { Integer orderItemRefId, MessageHolder holder, String topic) {
PurchaseOrderItemVo item = null; PurchaseOrderItemVo item = null;
if (orderItemRefId != null) { if (orderItemRefId != null) {
item = getPurchaseOrderItemService().findByRefId(orderItemRefId); item = getPurchaseOrderItemService().findByRefId(orderItemRefId);
@@ -387,7 +394,7 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
} }
boolean updatePurchaseOrder(Supplier<PurchaseOrder> getter, Consumer<PurchaseOrder> setter, Integer orderRefId, boolean updatePurchaseOrder(Supplier<PurchaseOrder> getter, Consumer<PurchaseOrder> setter, Integer orderRefId,
MessageHolder holder, String topic) { MessageHolder holder, String topic) {
PurchaseOrder order = null; PurchaseOrder order = null;
if (orderRefId != null) { if (orderRefId != null) {
order = getPurchaseOrdersService().getByRefId(orderRefId); order = getPurchaseOrdersService().getByRefId(orderRefId);
@@ -407,7 +414,7 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
} }
boolean updateContractByContractCode(Supplier<Contract> getter, Consumer<Contract> setter, String contractCode, boolean updateContractByContractCode(Supplier<Contract> getter, Consumer<Contract> setter, String contractCode,
MessageHolder holder, String topic) { MessageHolder holder, String topic) {
ContractVo contract = null; ContractVo contract = null;
if (StringUtils.hasText(contractCode)) { if (StringUtils.hasText(contractCode)) {
contract = getContractCtx().findContractByCode(contractCode); contract = getContractCtx().findContractByCode(contractCode);
@@ -434,12 +441,12 @@ public class PurchaseBillVoucherCtx extends AbstractYongYouU8Ctx {
} }
boolean updateInventory(Supplier<Inventory> getter, Consumer<Inventory> setter, String inventoryCode, boolean updateInventory(Supplier<Inventory> getter, Consumer<Inventory> setter, String inventoryCode,
MessageHolder holder, String topic) { MessageHolder holder, String topic) {
return getInventoryCtx().syncInventoryDetailByCode(getter, setter, inventoryCode, holder, topic); return getInventoryCtx().syncInventoryDetailByCode(getter, setter, inventoryCode, holder, topic);
} }
private boolean updateInvoice(Supplier<Invoice> getter, Consumer<Invoice> setter, String invoiceNumber, private boolean updateInvoice(Supplier<Invoice> getter, Consumer<Invoice> setter, String invoiceNumber,
MessageHolder holder, String topic) { MessageHolder holder, String topic) {
return getInvoiceCtx().updateInvoiceByNumber(getter, setter, invoiceNumber, holder, topic); return getInvoiceCtx().updateInvoiceByNumber(getter, setter, invoiceNumber, holder, topic);
} }

View File

@@ -28,6 +28,7 @@ import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.model.Inventory; import com.ecep.contract.model.Inventory;
import com.ecep.contract.ds.vendor.model.PurchaseOrder; import com.ecep.contract.ds.vendor.model.PurchaseOrder;
import com.ecep.contract.ds.vendor.model.PurchaseOrderItem; import com.ecep.contract.ds.vendor.model.PurchaseOrderItem;
import com.ecep.contract.util.BeanContext;
import com.ecep.contract.util.NumberUtils; import com.ecep.contract.util.NumberUtils;
import lombok.Setter; import lombok.Setter;
@@ -44,18 +45,24 @@ public class PurchaseOrderCtx extends AbstractYongYouU8Ctx {
InventoryCtx inventoryCtx; InventoryCtx inventoryCtx;
CompanyBankAccountCtx companyBankAccountCtx; CompanyBankAccountCtx companyBankAccountCtx;
public PurchaseOrderCtx() {
super();
}
public PurchaseOrderCtx(BeanContext ctx) {
super(ctx);
}
InventoryCtx getInventoryCtx() { InventoryCtx getInventoryCtx() {
if (inventoryCtx == null) { if (inventoryCtx == null) {
inventoryCtx = new InventoryCtx(); inventoryCtx = new InventoryCtx(this);
inventoryCtx.from(this);
} }
return inventoryCtx; return inventoryCtx;
} }
CompanyBankAccountCtx getCompanyBankAccountCtx() { CompanyBankAccountCtx getCompanyBankAccountCtx() {
if (companyBankAccountCtx == null) { if (companyBankAccountCtx == null) {
companyBankAccountCtx = new CompanyBankAccountCtx(); companyBankAccountCtx = new CompanyBankAccountCtx(this);
companyBankAccountCtx.from(this);
} }
return companyBankAccountCtx; return companyBankAccountCtx;
} }

View File

@@ -15,8 +15,7 @@ public class PurchaseSettlementVoucherCtx extends AbstractYongYouU8Ctx {
InventoryCtx getInventoryCtx() { InventoryCtx getInventoryCtx() {
if (inventoryCtx == null) { if (inventoryCtx == null) {
inventoryCtx = new InventoryCtx(); inventoryCtx = new InventoryCtx(this);
inventoryCtx.from(this);
} }
return inventoryCtx; return inventoryCtx;
} }

View File

@@ -1,7 +1,5 @@
package com.ecep.contract.cloud.u8.ctx; package com.ecep.contract.cloud.u8.ctx;
import static com.ecep.contract.SpringApp.getBean;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.HashMap; import java.util.HashMap;
@@ -18,24 +16,33 @@ import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.constant.CloudServiceConstant; import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.ds.contract.service.ContractService; import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.contract.service.SaleOrdersService; import com.ecep.contract.ds.contract.service.SaleOrdersService;
import com.ecep.contract.ds.contract.service.SalesBillVoucherItemService; import com.ecep.contract.ds.contract.service.SalesBillVoucherItemService;
import com.ecep.contract.ds.contract.service.SalesBillVoucherService; import com.ecep.contract.ds.contract.service.SalesBillVoucherService;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.customer.model.CompanyCustomer; import com.ecep.contract.ds.customer.model.CompanyCustomer;
import com.ecep.contract.ds.customer.model.CompanyCustomerEntity; import com.ecep.contract.ds.customer.model.CompanyCustomerEntity;
import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.model.Inventory;
import com.ecep.contract.ds.customer.model.SalesBillVoucher; import com.ecep.contract.ds.customer.model.SalesBillVoucher;
import com.ecep.contract.ds.customer.model.SalesBillVoucherItem; import com.ecep.contract.ds.customer.model.SalesBillVoucherItem;
import com.ecep.contract.ds.customer.model.SalesOrder; import com.ecep.contract.ds.customer.model.SalesOrder;
import com.ecep.contract.model.Inventory;
import com.ecep.contract.util.BeanContext;
import com.ecep.contract.util.NumberUtils; import com.ecep.contract.util.NumberUtils;
import com.ecep.contract.vo.SalesOrderVo; import com.ecep.contract.vo.SalesOrderVo;
public class SalesBillVoucherCtx extends AbstractYongYouU8Ctx { public class SalesBillVoucherCtx extends AbstractYongYouU8Ctx {
InventoryCtx inventoryCtx; InventoryCtx inventoryCtx;
public SalesBillVoucherCtx() {
super();
}
public SalesBillVoucherCtx(BeanContext ctx) {
super(ctx);
}
ContractService getContractService() { ContractService getContractService() {
return getCachedBean(ContractService.class); return getCachedBean(ContractService.class);
} }
@@ -54,8 +61,7 @@ public class SalesBillVoucherCtx extends AbstractYongYouU8Ctx {
InventoryCtx getInventoryCtx() { InventoryCtx getInventoryCtx() {
if (inventoryCtx == null) { if (inventoryCtx == null) {
inventoryCtx = new InventoryCtx(); inventoryCtx = new InventoryCtx(this);
inventoryCtx.from(this);
} }
return inventoryCtx; return inventoryCtx;
} }

View File

@@ -1,7 +1,5 @@
package com.ecep.contract.cloud.u8.ctx; package com.ecep.contract.cloud.u8.ctx;
import static com.ecep.contract.SpringApp.getBean;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
@@ -14,24 +12,23 @@ import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.ds.contract.service.ContractItemService;
import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.vo.ContractVo;
import org.springframework.data.domain.Sort;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.constant.CloudServiceConstant; import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.company.service.CompanyService;
import com.ecep.contract.ds.contract.service.ContractItemService;
import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.contract.service.SaleOrdersService; import com.ecep.contract.ds.contract.service.SaleOrdersService;
import com.ecep.contract.ds.contract.service.SalesOrderItemService; import com.ecep.contract.ds.contract.service.SalesOrderItemService;
import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.ds.customer.model.SalesOrder; import com.ecep.contract.ds.customer.model.SalesOrder;
import com.ecep.contract.ds.customer.model.SalesOrderItem; import com.ecep.contract.ds.customer.model.SalesOrderItem;
import com.ecep.contract.ds.customer.service.CompanyCustomerEntityService; import com.ecep.contract.ds.customer.service.CompanyCustomerEntityService;
import com.ecep.contract.ds.customer.service.CustomerService; import com.ecep.contract.ds.customer.service.CustomerService;
import com.ecep.contract.util.BeanContext;
import com.ecep.contract.util.NumberUtils; import com.ecep.contract.util.NumberUtils;
import com.ecep.contract.vo.ContractVo;
import lombok.Setter; import lombok.Setter;
@@ -42,11 +39,16 @@ public class SalesOrderCtx extends AbstractYongYouU8Ctx {
@Setter @Setter
private SalesOrderItemService orderItemService; private SalesOrderItemService orderItemService;
public SalesOrderCtx() {
super();
}
public SalesOrderCtx(BeanContext ctx) {
super(ctx);
}
SaleOrdersService getSaleOrdersService() { SaleOrdersService getSaleOrdersService() {
if (saleOrdersService == null) { return getCachedBean(SaleOrdersService.class);
saleOrdersService = getBean(SaleOrdersService.class);
}
return saleOrdersService;
} }
/** /**

View File

@@ -25,6 +25,7 @@ import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.vendor.model.Vendor; import com.ecep.contract.ds.vendor.model.Vendor;
import com.ecep.contract.ds.vendor.model.VendorEntity; import com.ecep.contract.ds.vendor.model.VendorEntity;
import com.ecep.contract.model.VendorCatalog; import com.ecep.contract.model.VendorCatalog;
import com.ecep.contract.util.BeanContext;
import lombok.Setter; import lombok.Setter;
@@ -39,26 +40,31 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
@Setter @Setter
private CompanyBankAccountCtx companyBankAccountCtx; private CompanyBankAccountCtx companyBankAccountCtx;
public VendorCtx() {
super();
}
public VendorCtx(BeanContext ctx) {
super(ctx);
}
public CompanyCtx getCompanyCtx() { public CompanyCtx getCompanyCtx() {
if (companyCtx == null) { if (companyCtx == null) {
companyCtx = new CompanyCtx(); companyCtx = new CompanyCtx(this);
companyCtx.from(this);
} }
return companyCtx; return companyCtx;
} }
ContractCtx getContractCtx() { ContractCtx getContractCtx() {
if (contractCtx == null) { if (contractCtx == null) {
contractCtx = new ContractCtx(); contractCtx = new ContractCtx(this);
contractCtx.from(this);
} }
return contractCtx; return contractCtx;
} }
CompanyBankAccountCtx getCompanyBankAccountCtx() { CompanyBankAccountCtx getCompanyBankAccountCtx() {
if (companyBankAccountCtx == null) { if (companyBankAccountCtx == null) {
companyBankAccountCtx = new CompanyBankAccountCtx(); companyBankAccountCtx = new CompanyBankAccountCtx(this);
companyBankAccountCtx.from(this);
} }
return companyBankAccountCtx; return companyBankAccountCtx;
} }
@@ -100,7 +106,6 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
String phone = (String) map.get("cVenPhone"); String phone = (String) map.get("cVenPhone");
String person = (String) map.get("cVenPerson"); String person = (String) map.get("cVenPerson");
boolean modified = false; boolean modified = false;
if (updateText(item::getName, item::setName, name, holder, "名称")) { if (updateText(item::getName, item::setName, name, holder, "名称")) {
modified = true; modified = true;
@@ -135,7 +140,6 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
} }
} }
Vendor vendor = item.getVendor(); Vendor vendor = item.getVendor();
if (vendor == null) { if (vendor == null) {
// 如果没有关联供应商,则根据供应商名称或别名查找公司 // 如果没有关联供应商,则根据供应商名称或别名查找公司
@@ -167,7 +171,8 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return modified; return modified;
} }
private boolean updateVendorCatalog(Supplier<VendorCatalog> getter, Consumer<VendorCatalog> setter, String catalogCode, MessageHolder holder, String topic) { private boolean updateVendorCatalog(Supplier<VendorCatalog> getter, Consumer<VendorCatalog> setter,
String catalogCode, MessageHolder holder, String topic) {
VendorCatalogVo catalog = null; VendorCatalogVo catalog = null;
if (StringUtils.hasText(catalogCode)) { if (StringUtils.hasText(catalogCode)) {
catalog = getCompanyVendorService().findCatalogByCode(catalogCode); catalog = getCompanyVendorService().findCatalogByCode(catalogCode);
@@ -251,7 +256,8 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return updated; return updated;
} }
private boolean updateCompanyNameAndAbbNameByVendorEntity(Company company, VendorEntity entity, MessageHolder holder) { private boolean updateCompanyNameAndAbbNameByVendorEntity(Company company, VendorEntity entity,
MessageHolder holder) {
CompanyService companyService = getCompanyService(); CompanyService companyService = getCompanyService();
if (company == null) { if (company == null) {
return false; return false;
@@ -321,7 +327,6 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return vendor; return vendor;
} }
private Company findOrCreateCompanyByVendorEntity(VendorEntity entity, MessageHolder holder) { private Company findOrCreateCompanyByVendorEntity(VendorEntity entity, MessageHolder holder) {
String name = entity.getName(); String name = entity.getName();
String abbName = entity.getAbbName(); String abbName = entity.getAbbName();
@@ -332,7 +337,6 @@ public class VendorCtx extends AbstractYongYouU8Ctx {
return getCompanyVendorEntityService().save(entity); return getCompanyVendorEntityService().save(entity);
} }
public VendorVo save(VendorVo vendor) { public VendorVo save(VendorVo vendor) {
VendorService service = getCompanyVendorService(); VendorService service = getCompanyVendorService();
Vendor v0 = service.getById(vendor.getId()); Vendor v0 = service.getById(vendor.getId());

View File

@@ -6,16 +6,12 @@ import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.ecep.contract.ds.project.service.ProjectService;
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
import org.hibernate.Hibernate;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.jdbc.CannotGetJdbcConnectionException; import org.springframework.jdbc.CannotGetJdbcConnectionException;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.ecep.contract.ContractPayWay; import com.ecep.contract.ContractPayWay;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.SpringApp;
import com.ecep.contract.cloud.u8.YongYouU8Service; import com.ecep.contract.cloud.u8.YongYouU8Service;
import com.ecep.contract.cloud.u8.ctx.ContractCtx; import com.ecep.contract.cloud.u8.ctx.ContractCtx;
import com.ecep.contract.cloud.u8.ctx.PurchaseBillVoucherCtx; import com.ecep.contract.cloud.u8.ctx.PurchaseBillVoucherCtx;
@@ -23,10 +19,11 @@ import com.ecep.contract.cloud.u8.ctx.PurchaseOrderCtx;
import com.ecep.contract.cloud.u8.ctx.SalesBillVoucherCtx; import com.ecep.contract.cloud.u8.ctx.SalesBillVoucherCtx;
import com.ecep.contract.cloud.u8.ctx.SalesOrderCtx; import com.ecep.contract.cloud.u8.ctx.SalesOrderCtx;
import com.ecep.contract.constant.CloudServiceConstant; import com.ecep.contract.constant.CloudServiceConstant;
import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.contract.model.Contract; import com.ecep.contract.ds.contract.model.Contract;
import com.ecep.contract.ds.project.model.Project; import com.ecep.contract.ds.contract.service.ContractService;
import com.ecep.contract.ds.customer.model.SalesOrder; import com.ecep.contract.ds.customer.model.SalesOrder;
import com.ecep.contract.ds.project.service.ProjectService;
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
import com.ecep.contract.ui.Tasker; import com.ecep.contract.ui.Tasker;
import com.ecep.contract.vo.ContractVo; import com.ecep.contract.vo.ContractVo;
@@ -42,7 +39,7 @@ public abstract class AbstContractRepairTasker extends Tasker<Object> {
@Getter @Getter
protected boolean saleOrderUpdated = false; protected boolean saleOrderUpdated = false;
protected final ContractCtx contractCtx = new ContractCtx(); protected final ContractCtx contractCtx = new ContractCtx(this);
protected SalesOrderCtx salesOrderCtx = null; protected SalesOrderCtx salesOrderCtx = null;
protected SalesBillVoucherCtx salesBillVoucherCtx = null; protected SalesBillVoucherCtx salesBillVoucherCtx = null;
protected PurchaseOrderCtx purchaseOrderCtx = null; protected PurchaseOrderCtx purchaseOrderCtx = null;
@@ -50,32 +47,28 @@ public abstract class AbstContractRepairTasker extends Tasker<Object> {
SalesOrderCtx getSalesOrderCtx() { SalesOrderCtx getSalesOrderCtx() {
if (salesOrderCtx == null) { if (salesOrderCtx == null) {
salesOrderCtx = new SalesOrderCtx(); salesOrderCtx = new SalesOrderCtx(this);
salesOrderCtx.from(contractCtx);
} }
return salesOrderCtx; return salesOrderCtx;
} }
SalesBillVoucherCtx getSalesBillVoucherCtx() { SalesBillVoucherCtx getSalesBillVoucherCtx() {
if (salesBillVoucherCtx == null) { if (salesBillVoucherCtx == null) {
salesBillVoucherCtx = new SalesBillVoucherCtx(); salesBillVoucherCtx = new SalesBillVoucherCtx(this);
salesBillVoucherCtx.from(contractCtx);
} }
return salesBillVoucherCtx; return salesBillVoucherCtx;
} }
PurchaseOrderCtx getPurchaseOrderCtx() { PurchaseOrderCtx getPurchaseOrderCtx() {
if (purchaseOrderCtx == null) { if (purchaseOrderCtx == null) {
purchaseOrderCtx = new PurchaseOrderCtx(); purchaseOrderCtx = new PurchaseOrderCtx(this);
purchaseOrderCtx.from(contractCtx);
} }
return purchaseOrderCtx; return purchaseOrderCtx;
} }
PurchaseBillVoucherCtx getPurchaseBillVoucherCtx() { PurchaseBillVoucherCtx getPurchaseBillVoucherCtx() {
if (purchaseBillVoucherCtx == null) { if (purchaseBillVoucherCtx == null) {
purchaseBillVoucherCtx = new PurchaseBillVoucherCtx(); purchaseBillVoucherCtx = new PurchaseBillVoucherCtx(this);
purchaseBillVoucherCtx.from(contractCtx);
} }
return purchaseBillVoucherCtx; return purchaseBillVoucherCtx;
} }
@@ -83,7 +76,7 @@ public abstract class AbstContractRepairTasker extends Tasker<Object> {
@Override @Override
protected Object execute(MessageHolder holder) throws Exception { protected Object execute(MessageHolder holder) throws Exception {
try { try {
YongYouU8Service u8Service = SpringApp.getBean(YongYouU8Service.class); YongYouU8Service u8Service = getBean(YongYouU8Service.class);
u8Service.initialize(contractCtx); u8Service.initialize(contractCtx);
} catch (NoSuchBeanDefinitionException ignored) { } catch (NoSuchBeanDefinitionException ignored) {
holder.warn("无法使用 " + CloudServiceConstant.U8_NAME + " 服务"); holder.warn("无法使用 " + CloudServiceConstant.U8_NAME + " 服务");

View File

@@ -44,15 +44,13 @@ public class ContractRepairByCompanyTask extends AbstContractRepairTasker {
} }
try { try {
VendorCtx vendorCtx = new VendorCtx(); VendorCtx vendorCtx = new VendorCtx(this);
vendorCtx.from(contractCtx);
if (vendorCtx.syncVendor(company, holder)) { if (vendorCtx.syncVendor(company, holder)) {
cloudYu.setVendorUpdateDate(LocalDate.now()); cloudYu.setVendorUpdateDate(LocalDate.now());
repaired = true; repaired = true;
} }
CustomerCtx customerCtx = new CustomerCtx(); CustomerCtx customerCtx = new CustomerCtx(this);
customerCtx.from(contractCtx);
if (customerCtx.syncCustomer(company, holder)) { if (customerCtx.syncCustomer(company, holder)) {
cloudYu.setCustomerUpdateDate(LocalDate.now()); cloudYu.setCustomerUpdateDate(LocalDate.now());
repaired = true; repaired = true;

View File

@@ -2,19 +2,26 @@ package com.ecep.contract.ds.project;
import java.util.Objects; import java.util.Objects;
import com.ecep.contract.vo.ProjectVo;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import com.ecep.contract.MessageHolder; import com.ecep.contract.MessageHolder;
import com.ecep.contract.cloud.AbstractCtx; import com.ecep.contract.cloud.AbstractCtx;
import com.ecep.contract.ds.project.service.ProjectService;
import com.ecep.contract.ds.company.model.Company; import com.ecep.contract.ds.company.model.Company;
import com.ecep.contract.ds.project.model.Project; import com.ecep.contract.ds.project.model.Project;
import com.ecep.contract.ds.project.service.ProjectService;
import lombok.Setter; import com.ecep.contract.util.BeanContext;
import com.ecep.contract.vo.ProjectVo;
public class ProjectCtx extends AbstractCtx { public class ProjectCtx extends AbstractCtx {
public ProjectCtx() {
super();
}
public ProjectCtx(BeanContext ctx) {
super(ctx);
}
public ProjectService getProjectService() { public ProjectService getProjectService() {
return getCachedBean(ProjectService.class); return getCachedBean(ProjectService.class);
} }