From f3faaf0e700c819f6c6aee18066943efd3fe4a76 Mon Sep 17 00:00:00 2001
From: yangjieke <yangjieke@prec-tech.com>
Date: 星期五, 22 四月 2022 14:18:45 +0800
Subject: [PATCH] 事件延期时增加标识,防止opd延期循环触发事件延期

---
 force-app/main/default/classes/SimpleEventRegisterController.cls |   41 +++++++++++++++++++++++++++++++++++------
 1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/SimpleEventRegisterController.cls b/force-app/main/default/classes/SimpleEventRegisterController.cls
index 71263a9..3640e69 100644
--- a/force-app/main/default/classes/SimpleEventRegisterController.cls
+++ b/force-app/main/default/classes/SimpleEventRegisterController.cls
@@ -88,6 +88,12 @@
     //2021-10-20  mzy  浠诲姟绠$悊鏀瑰杽   start
     private Boolean IsGeneratePlan;  //鏄惁鐢熸垚璁″垝
     //2021-10-20  mzy  浠诲姟绠$悊鏀瑰杽   end
+    //Add By Li Jun 20220224 for PIPL start
+    public String idVisitor1PI{set;get;}
+    public String idVisitor2PI{set;get;}
+    public String staticResource {get; set;}
+    public String contactAWSIds{set;get;}
+    //Add By Li Jun 20220224 for PIPL end
     public SimpleEventRegisterController(ApexPages.StandardController controller) {
         this.isHospital = true;
         this.isAgent = false;
@@ -153,6 +159,11 @@
             System.debug('-----:inputDatetime=' + inputDatetime);
             this.targetEvent.StartDateTime = inputDatetime;
         }
+        //Add by Li Jun 20220303 for PIPL Start
+        PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Contact');
+        staticResource = JSON.serialize(piIntegration);
+        system.debug('static resource:'+JSON.serialize(staticResource));
+        //Add by Li Jun 20220303 for PIPL End
     }
 
     public void init() {
@@ -212,6 +223,22 @@
             //2021-07-28  mzy  SWAG-C4YB9J 浜嬩欢椤甸潰浼樺寲 浠婂ぉ鐨勪簨浠� 濡傛灉宸茬粡鐢熸垚鎶ュ憡涓�瑙�,鍒欎笉鍏佽杩涜鍙栨秷鍜屽欢鏈熸搷浣� end
                 allDisable = true;
             }
+            //Add By Li Jun for PIPL 20220303 Start
+            List<String> conAWSIds = new List<String>();
+            Set<String> contactIdsForReport = new Set<String>();
+            List<String> visitorList = new List<String>{'Visitor1_ID__c','Visitor2_ID__c','Visitor3_ID__c','Visitor4_ID__c','Visitor5_ID__c'};
+            for(String visitorValue:visitorList){
+                if(String.isNotEmpty((String)targetEvent.get(visitorValue))&&String.isNotBlank((String)targetEvent.get(visitorValue))){
+                    contactIdsForReport.add((String)targetEvent.get(visitorValue));
+                }
+            }
+            List<Contact> conListForReport = new List<Contact>([select id,AWS_Data_Id__c from Contact where id in:contactIdsForReport and AWS_Data_Id__c!='']);
+            for(Contact con:conListForReport){
+                conAWSIds.add(con.AWS_Data_Id__c);
+            }     
+            contactAWSIds = JSON.serialize(conAWSIds);
+            system.debug('Contact AWSIDs:'+contactAWSIds);
+            //Add By Li Jun for PIPL 20220303 End
         }
         //20210324 zh WLIG-BX3DQ5 銆愬鎵樸�慜utlook鏃ュ巻鍜孲FDC鏃ュ巻鍚屾 end
         if (targetEvent.OPDPlan_Flag__c) {
@@ -1011,9 +1038,11 @@
                 }
                 
             }
+
             //20201123 zh 鍒涘缓涓诲姩浠诲姟涓庣淮淇悎鍚屽叧鑱� end
             if (LoginUser.Job_Category__c.equals('閿�鍞帹骞�')) {
                 if (this.targetEvent.Activity_Type2__c == '鐥呴櫌') {
+                    
                    // 2021-06-11 mzy sla 娉ㄩ噴鎺変簡璇环3 鍥犱负鐜板湪鐨勯〉闈㈡病鏈夌粰璇环3璧嬪��,鎵�浠ヤ細鏄剧ず 璇环3涓嶇瓑浜庣┖瀛楃涓茶�屾槸绛変簬null ,瀵艰嚧鍚庨潰鐨勫垽鏂繘涓嶅幓
                    // if (this.targetEvent.Related_Opportunity1__c != '' || this.targetEvent.Related_Opportunity2__c != '' || this.targetEvent.Related_Opportunity3__c != '') {
                     System.debug('娴嬭瘯璇环浠诲姟:' +'璇环1:' +this.targetEvent.Related_Opportunity1__c +'---璇环2:'+this.targetEvent.Related_Opportunity2__c);
@@ -1021,16 +1050,16 @@
                         taskType = System.Label.OpportunityFollow; // 璇环璺熻繘浠诲姟
                     } else if (this.targetEvent.OPDPlan_Flag__c) {
                         taskType = System.Label.OPD; // OPD浠诲姟
-                    } else if (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account_Energy__c == 1 || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account__c == 1) {
-                        taskType = System.Label.TargetAccountVisit; // 鐩爣瀹㈡埛鎷滆浠诲姟
-                    }  else if (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H1' || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H0') {
-                        taskType = System.Label.visitHLevel; // H灞傛嫓璁夸换鍔�
+                    } else if (!accToNumTarget.isEmpty() && !accToDepMap.isEmpty() && (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account_Energy__c == 1 || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account__c == 1)) {
+                         taskType = System.Label.TargetAccountVisit; // 鐩爣瀹㈡埛鎷滆浠诲姟
+                    }  else if (!accToNumTarget.isEmpty() && !accToDepMap.isEmpty() && (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H1' || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H0')) {
+                         taskType = System.Label.visitHLevel; // H灞傛嫓璁夸换鍔�
                     } else {
                         taskType = System.Label.DailyVisit;// 鏃ョ▼鎷滆浠诲姟
                     }
                 }
                 if (this.targetEvent.Activity_Type2__c == '璨╁2搴�') {
-                    taskType = System.Label.AgencyVisit; // 缁忛攢鍟嗘嫓璁夸换鍔�
+                    taskType = System.Label.AgencyVisit; // 缁忛攢鍟嗘敮鎸佷换鍔�
                 }
                 if (this.targetEvent.Activity_Type2__c == '绀惧銈ゃ儥銉炽儓') {
                     taskType = System.Label.campaignFollow; // 瀛︽湳浼氳璺熻繘浠诲姟
@@ -1807,7 +1836,7 @@
         //2021-11-02  mzy  浠诲姟绠$悊鏀瑰杽寮�鍙戣鍒�  end
         //5.鐢宠绫诲瀷
         tempCancelPostponePlan.ApplyType__c = '寤舵湡';
-
+        tempCancelPostponePlan.isDailyReportDelay__c = true;//2022-4-22 yjk 浜嬩欢寤舵湡odp澧炲姞鏍囪瘑锛岄槻姝㈠惊鐜�
         insert tempCancelPostponePlan;
 
     }

--
Gitblit v1.9.1