From dbddbfecbf28fa97a5fcc73cfb8526d7490f62c9 Mon Sep 17 00:00:00 2001 From: 李金换 <lijinhuan@prec-tech.com> Date: 星期三, 30 十一月 2022 16:59:04 +0800 Subject: [PATCH] DB202211258553 SFDC服务相关Batch批处理优化 --- force-app/main/default/classes/rollupToRepairBatch.cls | 28 ++++++++++++++++++++++++---- force-app/main/default/classes/AssetUpdateLastContractbatch.cls | 5 ++++- force-app/main/default/classes/RollupToMaintenanceContractBatch.cls | 5 ++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/force-app/main/default/classes/AssetUpdateLastContractbatch.cls b/force-app/main/default/classes/AssetUpdateLastContractbatch.cls index 2d73c38..d6a5458 100644 --- a/force-app/main/default/classes/AssetUpdateLastContractbatch.cls +++ b/force-app/main/default/classes/AssetUpdateLastContractbatch.cls @@ -35,7 +35,10 @@ if (TestIDList != null && TestIDList.size() > 0) { return Database.getQueryLocator([select id from asset where Id in : TestIDList]); }else{ - return Database.getQueryLocator([select id from asset]); + // 20221117 ljh DB202211258553 start + // return Database.getQueryLocator([select id from asset]); + return Database.getQueryLocator([select id from asset where IsCompetitorProduct = false AND ( AssetMark__c != '鑰楁潗' OR Product2.Family != 'ET')]); + // 20221117 ljh DB202211258553 end // return Database.getQueryLocator([select id from asset where Id in : assetList]); } } diff --git a/force-app/main/default/classes/RollupToMaintenanceContractBatch.cls b/force-app/main/default/classes/RollupToMaintenanceContractBatch.cls index 73aadd0..86ab742 100644 --- a/force-app/main/default/classes/RollupToMaintenanceContractBatch.cls +++ b/force-app/main/default/classes/RollupToMaintenanceContractBatch.cls @@ -40,7 +40,10 @@ if(ConId != null && ConId.size() > 0) { return Database.getQueryLocator([select Id from Maintenance_Contract__c where Id in :ConId]); } else { - return Database.getQueryLocator([select Id from Maintenance_Contract__c]); + // 20221117 ljh DB202211258553 start + // return Database.getQueryLocator([select Id from Maintenance_Contract__c]); + return Database.getQueryLocator([select Id from Maintenance_Contract__c where Status__c = '濂戠磩' OR (Status__c = '濂戠磩婧�浜�' and Contract_End_Date__c >= :Date.today().addMonths(-6))]); + // 20221117 ljh DB202211258553 end } diff --git a/force-app/main/default/classes/rollupToRepairBatch.cls b/force-app/main/default/classes/rollupToRepairBatch.cls index 27032cd..1d16bf7 100644 --- a/force-app/main/default/classes/rollupToRepairBatch.cls +++ b/force-app/main/default/classes/rollupToRepairBatch.cls @@ -25,7 +25,10 @@ global Database.QueryLocator start(Database.BatchableContext bc) { - + // 20221110 ljh 浼樺寲 start + Date st = Date.today().addMonths(-36); + Datetime startDatetime = Datetime.newInstance(st.year(), st.month(), st.day(), 8, 0, 0); + // 20221110 ljh 浼樺寲 end if (repairId != null && repairId.size() > 0) { return Database.getQueryLocator( [select Id, @@ -45,6 +48,18 @@ from repair__c ]); } else { + // 20221110 ljh 浼樺寲 start + // return Database.getQueryLocator( + // [select Id , + // if_Rental_Apply__c , + // Offer_Rental_New__c, + // Request_approval_day__c, + // Bollow_Date__c + // from repair__c + // where Repair_Completed_Date__c = null Or + // Repair_Completed_Date__c >= : + // Date.today().addMonths(-12) + // ]); return Database.getQueryLocator( [select Id , if_Rental_Apply__c , @@ -52,10 +67,15 @@ Request_approval_day__c, Bollow_Date__c from repair__c - where Repair_Completed_Date__c = null Or - Repair_Completed_Date__c >= : - Date.today().addMonths(-12) + where Status1__c != '0.鍙栨秷' + and Status1__c != '0.鍒犻櫎' + and Status1__c != '5.瀹屾瘯' + and ( + (Repair_Completed_Date__c = null and CreatedDate > :startDatetime) + Or Repair_Completed_Date__c >= :Date.today().addMonths(-12) + ) ]); + // 20221110 ljh 浼樺寲 end } } -- Gitblit v1.9.1