From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/NewAndEditReportController.cls |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/NewAndEditReportController.cls b/force-app/main/default/classes/NewAndEditReportController.cls
index 756d2dd..81d5453 100644
--- a/force-app/main/default/classes/NewAndEditReportController.cls
+++ b/force-app/main/default/classes/NewAndEditReportController.cls
@@ -38,6 +38,11 @@
     public String contactName4{set;get;}
     public String contactName5{set;get;}
     public String sfRecordIdForEdit{set;get;}//Add By LiJun for Edit Record from NFM609, 20220510
+    public String VLookUpFieldsJson{get;private set;}
+    //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+    public String staticResourceV2 {get; set;}
+    //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
+
     public NewAndEditReportController(ApexPages.StandardController controller) {
         ApiPrefix = 'PIBackApi';
         layoutEncryptedAPIList = new List<String>();
@@ -191,10 +196,23 @@
                 }
             }
         }
+        //鑾峰彇lookup瀛楁
+        List<String> VLookUpFields = new List<String>();
+        for (LayoutDescriberHelper.LayoutSection ls : layoutSections) {
+            for (LayoutDescriberHelper.LayoutField lf : ls.layoutFields) {
+                if (lf.fieldAPI != '' && lf.fieldType == 'reference') {
+                    VLookUpFields.add(lf.fieldAPI);
+                }
+            }
+        }
+        VLookUpFieldsJson = Json.serialize(VLookUpFields);
         for (PI_Field_Policy_Detail__c PIDetail : piIntegration.PIDetails) {
             AWSToSobjectEncryptedMap.put(PIDetail.AWS_Field_API__c, PIDetail.SF_Field_API_Name__c);
         }
         System.debug('AWSToSobjectEncryptedMap = ' + AWSToSobjectEncryptedMap);
+        //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start
+        staticResourceV2 = JSON.serialize(PIHelper.getPIIntegrationInfo('Report__cV2'));
+        //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end
     }
 
     global class Response{
@@ -260,16 +278,27 @@
             String awsDataId = (String)reportInfo.get('AWS_Data_Id__c');
             String sfRecordId =  (String)reportInfo.get('Id');
             System.debug('awsDataId = ' + awsDataId);
-            report__c[] reports = [select id from report__c where AWS_Data_Id__c =:awsDataId or id =:sfRecordId];
+            System.debug('sfRecordId = ' + sfRecordId);
+            report__c[] reports = [select id from report__c where AWS_Data_Id__c =:awsDataId or id=:sfRecordId];
+            //report__c[] reportsFromDaily = [select id from report__c where AWS_Data_Id__c =:awsDataId or id=:sfRecordId];
             
             if(!isNew){
                 isClone = reports.size() == 0;
             }
             system.debug('isClone'+isClone + ' isNew'+isNew);
-            if(isNew){
+            if(isNew || isClone){
                 System.debug('reportInfo = ' + reportInfo);               
                 if(!Test.isRunningTest()){
-                	insert reportInfo;
+                    // if(isClone){
+                    //     Report__c[] r = [select Practitioner4__c,Practitioner5__c from Report__c where id=:sfRecordId];
+                    //     if(r.size()>0){
+                    //         reportInfo.Practitioner4__c = r[0].Practitioner4__c;
+                    //         reportInfo.Practitioner5__c = r[0].Practitioner5__c;
+                    //     }
+                    //     reportInfo.Id = null;
+                    // }
+                    reportInfo.Status__c = '鑽夋涓�';
+                    insert reportInfo;
                 } else {
                     Report__c reportTest = new Report__c();
                     insert reportTest;
@@ -282,7 +311,7 @@
                 System.debug('reports[0].id = ' + reports[0].id);
                 reportInfo.put('Id',reports[0].id);//For testing;                
                 if(!Test.isRunningTest()){
-                	update reportInfo;
+                    update reportInfo;
                 }
             }
             rid=reportInfo.Id;
@@ -302,7 +331,7 @@
             System.debug(e.getDmlMessage(index));
             System.debug(e.getDmlStatusCode(index));
             System.debug(e.getDmlType(index));
-			system.debug(e.getMessage());
+            system.debug(e.getMessage());
             system.debug(e.getStackTraceString());
 
             System.debug('into catch'+e.getMessage());

--
Gitblit v1.9.1