From 5c01ebbfddb6b8674430b47c22977bea2e350084 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期三, 13 四月 2022 10:58:46 +0800
Subject: [PATCH] BackupPIPLFunction0413

---
 force-app/main/default/classes/PIHelper.cls |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/force-app/main/default/classes/PIHelper.cls b/force-app/main/default/classes/PIHelper.cls
index a6cc31f..f4bb2b0 100644
--- a/force-app/main/default/classes/PIHelper.cls
+++ b/force-app/main/default/classes/PIHelper.cls
@@ -58,8 +58,8 @@
         insert traLog;
     }
      // confirm tx transaction
-    @future(callout =true)
-     public static void confirmTrans(String module,Integer isSuccess, String   sfRecordId ,String transId ,String token,String transUrl,String idList){
+
+     public static void confirmTrans(String module,Integer isSuccess, String   sfRecordId ,String transId ,String token,String transUrl,List<idList> idList){
          Boolean result =false;
          Transaction_Log__c traLog = new Transaction_Log__c();
          traLog.Module__c = 'Confirm Transaction '+module;
@@ -82,11 +82,9 @@
              TransactionRequestBody requestBody =new TransactionRequestBody();
              requestBody.isSuccess=isSuccess;
              requestBody.sfRecordId=sfRecordId;
-            //  requestBody.idList=idList;
-             requestBody.idList=(List < idList >)JSON.deserialize(idList,List < idList > .class);
+             requestBody.idList=idList;
              requestBody.txId =transId;
              request.setBody(JSON.serialize(requestBody));
-             traLog.Request__c =JSON.serialize(requestBody);
              system.debug('request---'+request.tostring());
              HttpResponse response = http.send(request);
              system.debug('confirm result--'+response.getBody());
@@ -144,8 +142,9 @@
     public static PIIntegration getPIIntegrationInfo(String sobjectType){
         PIIntegration piIntegration = new PIIntegration();
         //鏌ヨurl
-        PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType];
-        System.debug('config = ' + config);
+        System.debug('thhsobjectType = ' + sobjectType);
+        PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_New_Encrypt_URL__c,Full_Update_Encrypt_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType];
+        System.debug('thhconfig = ' + config);
 
         //鑾峰彇appid鍜宎ppsecret
         AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Max_Query_Number__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt  WHERE DeveloperName = 'AWS_Default_Configuration'];
@@ -170,10 +169,14 @@
             request.setEndpoint(url);
             request.setMethod('GET');
             HttpResponse response = http.send(request);
+			system.debug('response.getBody()='+response.getBody());
             Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
             token = (String)results.get('object');
             System.debug('token = ' + token);
         }catch(Exception e){
+            system.debug(e.getMessage());
+            system.debug(e.getStackTraceString());
+            
             Transaction_Log__c traLog = new Transaction_Log__c();
             traLog.Module__c = 'Get Token';
             traLog.Status__c = 'fail';
@@ -185,9 +188,9 @@
         //Insert Get Token Log
 
         //鑾峰彇鏁忔劅瀛楁
-        piIntegration.PIDetails = [select id,PI_Policy_Configuration__r.Full_New_URL__c, Enable_Encrypt__c, SF_Field_API_Name__c,SF_Field_Encrypted_API__c, AWS_Field_API__c,AWS_Encrypted_Field_API__c,Field_Type__c from PI_Field_Policy_Detail__c  where PI_Policy_Configuration_Name__c =:sobjectType and Enable_Encrypt__c=true];
+        piIntegration.PIDetails = [select id,PI_Policy_Configuration__r.Full_New_URL__c,PI_Policy_Configuration__r.Full_New_Encrypt_URL__c,PI_Policy_Configuration__r.Full_Update_Encrypt_URL__c, Enable_Encrypt__c, SF_Field_API_Name__c,SF_Field_Encrypted_API__c, AWS_Field_API__c,AWS_Encrypted_Field_API__c,Field_Type__c from PI_Field_Policy_Detail__c  where PI_Policy_Configuration_Name__c =:sobjectType and Enable_Encrypt__c=true];
         if(displayByOrderNumberObject.contains(sobjectType)){
-            piIntegration.PIDetails = [select id,PI_Policy_Configuration__r.Full_New_URL__c, Enable_Encrypt__c, SF_Field_API_Name__c,SF_Field_Encrypted_API__c, AWS_Field_API__c,AWS_Encrypted_Field_API__c,Field_Type__c from PI_Field_Policy_Detail__c  where PI_Policy_Configuration_Name__c =:sobjectType and Enable_Encrypt__c=true order by Order_Number__c];
+            piIntegration.PIDetails = [select id,PI_Policy_Configuration__r.Full_New_URL__c,PI_Policy_Configuration__r.Full_New_Encrypt_URL__c,PI_Policy_Configuration__r.Full_Update_Encrypt_URL__c, Enable_Encrypt__c, SF_Field_API_Name__c,SF_Field_Encrypted_API__c, AWS_Field_API__c,AWS_Encrypted_Field_API__c,Field_Type__c from PI_Field_Policy_Detail__c  where PI_Policy_Configuration_Name__c =:sobjectType and Enable_Encrypt__c=true order by Order_Number__c];
         }
         List<String> vLookUpFields = new List<String>();
         List<String> PIFields = new List<String>();
@@ -209,6 +212,8 @@
         piIntegration.deleteUrl = config.Full_Delete_URL__c;
         piIntegration.undeleteUrl = config.Full_Undelete_URL__c;
         piIntegration.viewUnifiedContactUrl = config.Full_View_Unified_Contact_URL__c;
+        piIntegration.newEncryptUrl = config.Full_New_Encrypt_URL__c;
+        piIntegration.updateEncryptUrl = config.Full_Update_Encrypt_URL__c;
         piIntegration.transactionURL = config.TransactionURL__c;
         piIntegration.hostUrl = awsConfiguration.Host_URL__c;
         piIntegration.searchUrl = config.Full_Search_URL__c;
@@ -231,6 +236,8 @@
         public String deleteUrl{set;get;}
         public String undeleteUrl{set;get;}
         public String viewUnifiedContactUrl{set;get;}
+        public String newEncryptUrl{set;get;}
+        public String updateEncryptUrl{set;get;}
         public String hostUrl{set;get;}
         public String token{set;get;}
         public String awsAppId{set;get;}

--
Gitblit v1.9.1