refactor: 优化上下文对象初始化方式
将InventoryCtx、VendorCtx和CustomerCtx的初始化方式改为直接通过构造函数传入上下文对象,简化代码并提高可读性
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user