From bfca7a84bec815da594f1d12558535ed06d2490b Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 13 九月 2022 09:57:32 +0800
Subject: [PATCH] 本地提交备份
---
force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls | 123 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 122 insertions(+), 1 deletions(-)
diff --git a/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls b/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls
index e5baedd..10b9b86 100644
--- a/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls
+++ b/force-app/main/default/classes/OpportunityAndContactDailyUpdateBatch.cls
@@ -89,6 +89,7 @@
' Salesdepartment_HP__c = \'' + salesdepartment + '\'';
}
system.debug('=====query:' + query);
+ //Id=\'0011000000V9OGP\' and 娴嬭瘯鐢� 缁欎竴鏉″鎴穒d
return Database.getQueryLocator(query);
}
@@ -103,6 +104,10 @@
//20220415 you SWAG-CBUB2W start
updateFromHosToInquiryForm(deptUpdateList, iflog);
//20220415 you SWAG-CBUB2W end
+
+ //20220509 you SWAG-CBUB2W start
+ updateFromHosToInquiryFormFSEMain(hpList, iflog);
+ //20220509 you SWAG-CBUB2W end
}
//鍚屾鎵�灞炵殑璇环锛堜笟鍔℃満浼氾級鐨勬墍鏈変汉
public static void updateFromHosToContact(List<Account> deptUpdateList, BatchIF_Log__c iflog) {
@@ -134,11 +139,12 @@
//鍚屾鎵�灞炵殑浜у搧鍜ㄨ鍗曠殑鎵�鏈変汉
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
+ [select id, Ownerid,Depart_Owner__c, 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.Depart_Owner__c = ifo.Hospital_Name__r.ownerId;
ifo.Ownerid = ifo.Hospital_Name__r.ownerId;
}
}
@@ -156,7 +162,40 @@
}
}
+
//20220415 you SWAG-CBUB2W end
+ //20220509 you SWAG-CBUB2W start
+ //FSE涓绘媴褰撳彉鍖�
+ public static void updateFromHosToInquiryFormFSEMain(List<SObject> hpList, BatchIF_Log__c iflog) {
+ List<Inquiry_form__c> updateInquiryFormFSEList =
+ [select id, Ownerid,Hospital_Name__c,Hospital_Name__r.Name, Hospital_Name__r.ownerId,FSE_Owner__c,
+ Hospital_Name__r.Parent.Parent.FSE_GI_Main_Leader__c,Hospital_Name__r.Parent.Parent.FSE_SP_Main_Leader__c from Inquiry_form__c
+ where Hospital__c in:hpList
+ and isFSEDiffWithAccount__c = true ];
+ for (Inquiry_form__c ifo : updateInquiryFormFSEList) {
+ if (String.isNotBlank(ifo.Hospital_Name__r.Name) && (ifo.Hospital_Name__r.Name.contains('娑堝寲') || ifo.Hospital_Name__r.Name.contains('鍛煎惛') || ifo.Hospital_Name__r.Name.contains('ET')) && ifo.FSE_Owner__c != ifo.Hospital_Name__r.Parent.Parent.FSE_GI_Main_Leader__c) {
+ ifo.FSE_Owner__c = ifo.Hospital_Name__r.Parent.Parent.FSE_GI_Main_Leader__c;
+
+ }
+ if(String.isNotBlank(ifo.Hospital_Name__r.Name) && !ifo.Hospital_Name__r.Name.contains('娑堝寲') && !ifo.Hospital_Name__r.Name.contains('鍛煎惛') && !ifo.Hospital_Name__r.Name.contains('ET') && ifo.FSE_Owner__c != ifo.Hospital_Name__r.Parent.Parent.FSE_SP_Main_Leader__c){
+ ifo.FSE_Owner__c = ifo.Hospital_Name__r.Parent.Parent.FSE_SP_Main_Leader__c;
+ }
+ }
+ Integer indexCon = 0;
+ Database.SaveResult[] lsrUpdateInq = Database.update(updateInquiryFormFSEList, false);
+ for (Database.SaveResult lsrChild : lsrUpdateInq) {
+ if (!lsrChild.isSuccess()) {
+ iflog.Is_Error__c = 3;
+ Database.Error emsg = lsrChild.getErrors()[0];
+ iflog.ErrorLog__c += 'ownerId: ' + updateInquiryFormFSEList.get(indexCon).ownerId + ' \n'
+ + 'InquiryFormID: ' + updateInquiryFormFSEList.get(indexCon).Id + '\n ConLog:' + emsg.getMessage() + '\n';
+
+ }
+ indexCon ++ ;
+ }
+
+ }
+ //20220509 you SWAG-CBUB2W end
global void finish(Database.BatchableContext BC) {
system.debug('=====iflog:' + iflog.id);
iflog.Log__c += 'OpportunityAndContactDailyUpdateBatch finish()\n';
@@ -191,4 +230,86 @@
//Database.executeBatch(new ConsumablesApplyOrLendBatch(), 50);
//20200819 ljh add end
}
+
+ @TestVisible private static void test() {
+ Integer i = 0;
+
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;//鍙互澶氬啓鐐�
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1