From 3b43925ca3211c861a2818a089907d34b5480aa5 Mon Sep 17 00:00:00 2001
From: 张宇恒 <bxyun0@163.com>
Date: 星期五, 06 五月 2022 10:41:15 +0800
Subject: [PATCH] 批量数据拆分处理
---
force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls b/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls
index 9cfc17a..e5baedd 100644
--- a/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls
+++ b/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls
@@ -100,7 +100,9 @@
AccountDailyUpdateBatch.updateFromHosToContact(deptUpdateList, iflog);
updateFromHosToContact(deptUpdateList, iflog);
-
+ //20220415 you SWAG-CBUB2W start
+ updateFromHosToInquiryForm(deptUpdateList, iflog);
+ //20220415 you SWAG-CBUB2W end
}
//鍚屾鎵�灞炵殑璇环锛堜笟鍔℃満浼氾級鐨勬墍鏈変汉
public static void updateFromHosToContact(List<Account> deptUpdateList, BatchIF_Log__c iflog) {
@@ -128,6 +130,33 @@
}
}
+ //20220415 you SWAG-CBUB2W start
+ //鍚屾鎵�灞炵殑浜у搧鍜ㄨ鍗曠殑鎵�鏈変汉
+ public static void updateFromHosToInquiryForm(List<Account> deptUpdateList, BatchIF_Log__c iflog) {
+ List<Inquiry_form__c> updateInquiryFormList =
+ [select id, Ownerid, Hospital_Name__r.ownerId from Inquiry_form__c
+ where Hospital_Name__c in:deptUpdateList
+ and isOwnerDiffWithAccount__c = true ];
+ for (Inquiry_form__c ifo : updateInquiryFormList) {
+ if (ifo.Ownerid != ifo.Hospital_Name__r.ownerId) {
+ ifo.Ownerid = ifo.Hospital_Name__r.ownerId;
+ }
+ }
+ Integer indexCon = 0;
+ Database.SaveResult[] lsrUpdateInq = Database.update(updateInquiryFormList, false);
+ for (Database.SaveResult lsrChild : lsrUpdateInq) {
+ if (!lsrChild.isSuccess()) {
+ iflog.Is_Error__c = 3;
+ Database.Error emsg = lsrChild.getErrors()[0];
+ iflog.ErrorLog__c += 'ownerId: ' + updateInquiryFormList.get(indexCon).ownerId + ' \n'
+ + 'InquiryFormID: ' + updateInquiryFormList.get(indexCon).Id + '\n ConLog:' + emsg.getMessage() + '\n';
+
+ }
+ indexCon ++ ;
+ }
+
+ }
+ //20220415 you SWAG-CBUB2W end
global void finish(Database.BatchableContext BC) {
system.debug('=====iflog:' + iflog.id);
iflog.Log__c += 'OpportunityAndContactDailyUpdateBatch finish()\n';
--
Gitblit v1.9.1