From 2d4a8d2dcad5a17127d2c73c48ddc4b67ec79448 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期三, 06 四月 2022 11:51:58 +0800
Subject: [PATCH] PIPLDeploy0405

---
 force-app/main/default/classes/NFM501Controller.cls |   69 +++++++++++++++++++++++++++++-----
 1 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/classes/NFM501Controller.cls b/force-app/main/default/classes/NFM501Controller.cls
index 9e05b9c..51c00ed 100644
--- a/force-app/main/default/classes/NFM501Controller.cls
+++ b/force-app/main/default/classes/NFM501Controller.cls
@@ -1,5 +1,6 @@
 public with sharing class NFM501Controller implements Queueable {
     //鍏堝畾涔�
+    //add aws response
     public class AllData {
         public String code;
         public QLMData data;
@@ -45,6 +46,17 @@
         public String[] ZhaoRelationName;
         public String[] ZhongRelationName;
         public String infoTypeSegment;
+        //add aws pi start sushanhu 20220223 start
+        public String[] AgentRelationWayEncrypted;//浠g悊鏈烘瀯鑱旂郴鏂瑰紡瀵嗘枃
+        public String[] AgentRelationNameEncrypted;//浠g悊鏈烘瀯鑱旂郴鏂瑰紡浜哄瘑鏂�
+        public String[] ZhongRelationWayEncrypted;//涓爣鍗曚綅鑱旂郴鏂瑰紡瀵嗘枃
+        public String[] ZhongRelationNameEncrypted;//涓爣鍗曚綅鑱旂郴浜哄瘑鏂�
+        public String[] ZhaoRelationNameEncrypted;//鎷涙爣鍗曚綅鑱旂郴浜哄瘑鏂�
+        public String[] ZhaoRelationWayEncrypted;//鎷涙爣鍗曚綅鑱旂郴鏂瑰紡瀵嗘枃
+        public String DataId;// AWS 瀛樺偍鍑嵁
+
+        //add aws pi start sushanhu 20220223 start
+
     }
     public class AmountItem {
         public String Amount;
@@ -166,7 +178,10 @@
             System.debug('++++1++++' + token + '  : ' + timeslot);
             if (string.isblank(token) || timeslot > 1800000) {
                 System.debug('++++2++++' + token + '  : ' + timeslot);
-                NFMUtil.response response = NFMUtil.receiveToken();
+                // NFMUtil.response response = NFMUtil.receiveToken();
+                //update to aws token sushanhu start 20220223
+                NFMUtil.response response=NFMUtil.getAwsToken();
+                //update to aws token sushanhu end 20220223
                 System.debug('++++response++++' + response);
                 //鍒ゆ柇rowdata涓暟鎹幏鍙栨垚鍔熶笌鍚︼紝濡傛灉澶辫触閲嶅彂涓夋锛屽鏋滃ぇ浜庝笁娆″垯鎵嬪姩鎿嶄綔
                 if (String.isBlank(response.responseBody)) {
@@ -188,15 +203,37 @@
                 oldTimeTran.NFM501_Gain_End_Time__c = oldTime;
 
             }
-            //鏇挎崲鑾峰彇鍒版暟鎹腑鐨勫叧閿瓧
-            NFMUtil.response response = NFMUtil.getQLMData(NFMUtil.NFM501_ENDPOINT
-                                        + oldMark.Internal_Value__c + '/10', token);
-            // aaaaaaaa 杩欓噷椤哄簭閿欎簡锛岃偗瀹氭槸搴旇鍏堝垽鏂槸涓嶆槸鍥犱负http 鎶ラ敊锛岀劧鍚庢墠鏄崈閲岄┈鐨刢ode瑙f瀽
+            
+
+            // //鏇挎崲鑾峰彇鍒版暟鎹腑鐨勫叧閿瓧
+            // NFMUtil.response response = NFMUtil.getQLMData(NFMUtil.NFM501_ENDPOINT
+            //                             + oldMark.Internal_Value__c + '/10', token);
+            // // aaaaaaaa 杩欓噷椤哄簭閿欎簡锛岃偗瀹氭槸搴旇鍏堝垽鏂槸涓嶆槸鍥犱负http 鎶ラ敊锛岀劧鍚庢墠鏄崈閲岄┈鐨刢ode瑙f瀽
+            //update to aws start sushanhu 20220223
+            PIHelper.PIIntegration NFM501AWS =PIHelper.getPIIntegrationInfo('QLMNFM501');
+            NFMUtil.response response = NFMUtil.getAWSQLMData(NFM501AWS.newUrl+'cursorMark='
+                                         + oldMark.Internal_Value__c + '&pageSize=10', token);
+            system.debug('aws response---'+response.responseBody);                             
+            //update to aws  sushanhu end 20220223
             //http鐨勬姤閿欏鐞嗭紙閲嶅彂涓夐亶锛�
-            if (String.isBlank(response.responseBody)) {
+            //update to aws sushanhu for pi 20220323 start
+            // if (String.isBlank(response.responseBody)) {
+            //     System.debug('-------7-------');
+            //     // aaaaaaaa 鎶ラ敊鍘熷洜鍐欑殑涓嶅
+            //     iflog.ErrorLog__c = '501Http鎶ラ敊淇℃伅锛�' + response.status;
+            //     if (!Manual_execution501) {
+            //         NFM501Controller.againSendRequest(iflog, 'retry_cnt__c', rowData);
+            //     }
+            //     update tokenTran;
+            //     update oldTimeTran;
+            //     return;
+            // }
+                system.debug('statuscode---'+response.status);
+                
+            if ('200'!=(response.status)) {
                 System.debug('-------7-------');
                 // aaaaaaaa 鎶ラ敊鍘熷洜鍐欑殑涓嶅
-                iflog.ErrorLog__c = '501Http鎶ラ敊淇℃伅锛�' + response.status;
+                iflog.ErrorLog__c = '501Http鎶ラ敊淇℃伅锛�' + response.status+response.responseBody;
                 if (!Manual_execution501) {
                     NFM501Controller.againSendRequest(iflog, 'retry_cnt__c', rowData);
                 }
@@ -204,12 +241,20 @@
                 update oldTimeTran;
                 return;
             }
-
+            //update to aws sushanhu for pi 20220323 start
             // aaaaaaaa 杩欓噷杩欎釜瀛楁鍙互鏀瑰悕涓篘FM501Response 涔嬬被鐨勶紝杩欐牱灏辨湁鍖哄垎搴︿簡
             // 瑙f瀽鍚庣殑code鎶ラ敊澶勭悊
             String NFM501responseBody = response.responseBody;
             System.debug('-------------NFM501responseBody------------' + NFM501responseBody);
-            NFM501responseBody = NFM501responseBody.replaceAll('"list"', '"list1"').replaceAll('"number":', '"number1":');
+            //update to aws response sushanhu 20220223 start
+            
+            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(NFM501responseBody);
+            //String qlmResult =(String)results.get('object');
+            String qlmResult =JSON.serialize(results.get('object'));
+            System.debug('-------------NFM501responseBody qlmResult------------' + qlmResult);
+            // NFM501responseBody = NFM501responseBody.replaceAll('"list"', '"list1"').replaceAll('"number":', '"number1":');
+            NFM501responseBody = qlmResult.replaceAll('"list"', '"list1"').replaceAll('"number":', '"number1":');
+            //update to aws response sushanhu 20220223 end
             AllData getQLMData =  (AllData) JSON.deserializeStrict(NFM501responseBody, AllData.class);
             System.debug('-------------8------------' + getQLMData);
             if (!getQLMData.code.equals('0')) {
@@ -223,6 +268,9 @@
                 return;
             }
             rowData = NFMUtil.QLMmakeRowData(NFM501responseBody, rowData);
+            rowData.AWS_Transaction_Id__c = (String)results.get('txId');// add for pi susanhu 20220310 
+            update rowData;
+            system.debug('rowData---'+rowData);
             System.debug('======2221234======');
 
             update tokenTran;
@@ -244,7 +292,7 @@
                 // 12鐐硅嚜鍔ㄦ姄鍙栨嫑鎶曟爣鏁版嵁
                 // NFM501Controller.TwoMarkEqualAgainSend();
             }
-
+            
             rowData.retry_cnt__c = 0;
             if (System.Test.isRunningTest()) {
                 throw new ControllerUtil.myException('aaa');
@@ -252,6 +300,7 @@
         } catch (Exception ex) {
             // Database.rollback(sp);
             System.debug('rollback');
+            System.debug('ex.getlinenumber()------'+ex.getlinenumber());
             // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage());
             // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString());
             // logstr += '\n' + ex.getMessage();

--
Gitblit v1.9.1