refactor: 优化上下文对象初始化方式

将InventoryCtx、VendorCtx和CustomerCtx的初始化方式改为直接通过构造函数传入上下文对象,简化代码并提高可读性
This commit is contained in:
2025-10-16 23:53:35 +08:00
parent 22ab2c7bdf
commit 0b45f6eef2
2 changed files with 3 additions and 6 deletions

View File

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

View File

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