From fb04e7c01d119c60632b4298d18fd93f3ccb3d79 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期三, 06 四月 2022 10:32:05 +0800
Subject: [PATCH] 20220405DeployProduction

---
 force-app/main/default/classes/NFM103Controller.cls |   99 +++++++++++++++++++++++++++++++------------------
 1 files changed, 62 insertions(+), 37 deletions(-)

diff --git a/force-app/main/default/classes/NFM103Controller.cls b/force-app/main/default/classes/NFM103Controller.cls
index 6bf6784..6e3fde5 100644
--- a/force-app/main/default/classes/NFM103Controller.cls
+++ b/force-app/main/default/classes/NFM103Controller.cls
@@ -11,7 +11,7 @@
     public static string ResponseBody;
     public static String SAPRepairNo;
     public class NFM103Response {
-        public RepairRequest_element RepairRequest;
+        // public RepairRequest_element RepairRequest;
         public response[] response;
     }
     public class response {
@@ -104,7 +104,7 @@
         public String UpdateStatus;//鐩磋繑淇敼鏍囪瘑
         //add by wangweipeng  2021/07/14   end
         //add pi 鍔犲瘑 sushanhu 20220222 start
-        //public String DataId;//AWS瀛樺偍鍑瘉
+        public String DataId;//AWS瀛樺偍鍑瘉
         //add pi 鍔犲瘑 sushanhu 20220222 end
 
         //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁�  start
@@ -217,6 +217,7 @@
      */
     @future (callout = true)
     public static void callout(String iflog_Id, List<Id> repairIds) {
+       
 
         if (repairIds == null || repairIds.size() == 0) {
             return;
@@ -336,7 +337,7 @@
                                          ,Returns_Product_way__c    //杩斿搧鏂瑰紡
                                          ,FSE_ApplyForRepair_time__c    //鐢宠淇悊鏃堕棿
                                          //add by wangweipeng  2021/07/14   start
-                                         //,AWS_Data_Id__c //add by sushanhu AWSDateID for PIPL
+                                         ,AWS_Data_Id__c //add by sushanhu AWSDateID for PIPL
                                          //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁�  start
                                          ,Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c
                                          //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁�  end
@@ -492,7 +493,7 @@
                  element.UpdateStatus               = rpr.Address_type__c;    //鐢宠淇悊鏃堕棿
                  //add by wangweipeng  2021/07/14   end
                  //add pi 瀵嗘枃 sushanhu 20220222 start
-                 //element.DataId                     =rpr.AWS_Data_Id__c;//aws瀛樺偍鍑瘉
+                 element.DataId                     =rpr.AWS_Data_Id__c;//aws瀛樺偍鍑瘉
                  //add pi 瀵嗘枃 sushanhu 20220222 end
 
             }
@@ -593,20 +594,20 @@
             // NFM103淇敼Rest end
 
             // WLIG-BXQBH6 start
-            NFMUtil.response response =
-                NFMUtil.sendToSapStatusAndBody(rowDataStr, NFMUtil.NFM103_ENDPOINT);
+            // NFMUtil.response response =
+            //     NFMUtil.sendToSapStatusAndBody(rowDataStr, NFMUtil.NFM103_ENDPOINT);
                 //update to aws 20220222 sushanhu start for PIPL
-            //    PIHelper.PIIntegration NFM103AWS =PIHelper.getPIIntegrationInfo('NFM103');
-            //    NFMUtil.response response =     NFMUtil.sendToPiAWS(rowDataStr, NFM103AWS.newUrl,NFM103AWS.token);
+               PIHelper.PIIntegration NFM103AWS =PIHelper.getPIIntegrationInfo('NFM103');
+               NFMUtil.response response =     NFMUtil.sendToPiAWS(rowDataStr, NFM103AWS.newUrl,NFM103AWS.token);
                 //update to aws 20220222 sushanhu end for PIPL
-                status = response.status;
-                system.debug('AWS Response status:'+status);
-            ResponseBody = response.responseBody;
+            status = response.status;
+            system.debug('AWS Response status:'+status);
+             system.System.debug('NGM103 AWS result--'+ response.ResponseBody);
+             ResponseBody = response.responseBody;
             //update to aws 20220302 sushanhu start for PIPL
-            // Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(ResponseBody);
-            // system.System.debug('NGM103 AWS result--'+ ResponseBody);
-            //update to aws 20220302 sushanhu end for PIPL
-            NFM103Response NFM103Response = new NFM103Response();
+            if ('200'.equals(status)) {
+                Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(ResponseBody);
+                NFM103Response NFM103Response = new NFM103Response();
             system.debug(ResponseBody);
             if (string.isNotEmpty(ResponseBody)) {
                 NFM103Response =
@@ -616,9 +617,33 @@
                     NFM103Response.response.size() > 0 &&
                     NFM103Response.response[0].LOG != null &&
                     string.isNotEmpty(NFM103Response.response[0].LOG.SAPRepairNo)) {
-                SAPRepairNo = NFM103Response.response[0].LOG.SAPRepairNo;
+                    SAPRepairNo = NFM103Response.response[0].LOG.SAPRepairNo;
 
             }
+            rowData.retry_cnt__c = 0;
+            //add           wangweipeng                       2022/02/18               start
+            //濡傛灉涓簍rue锛岃瘉鏄庢槸閲嶆柊鍙戦�佺殑鎺ュ彛锛岄渶瑕佹妸鏃ュ織璁板綍涓�
+            if(needUpdateIflog){
+                logstr += 'Status:' + status;
+                logstr += '\nResponse:' + ResponseBody;
+                logstr += '\nend';
+            }
+            //add           wangweipeng                       2022/02/18               start
+            } else {
+                if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
+                if (rowData.retry_cnt__c < batch_retry_max_cnt) {
+                    rowData.retry_cnt__c++;
+                    LogAutoSendSchedule.assignOneMinute();
+                }
+                if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
+                    rowData.ErrorLog__c = 'status:' + ResponseBody +
+                                          '\n閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
+                }
+            }
+            // Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(ResponseBody);
+           
+            //update to aws 20220302 sushanhu end for PIPL
+            
             // 鍘熶唬鐮侊細
             // NFM103淇敼Rest start
             //status =
@@ -628,27 +653,27 @@
             //  WLIG-BXQBH6 end
 
             // 鍘熷墖闈炲悓鏈熴仹銇欍伄銇с�乴ogs銈掔⒑瑾嶃仚銈嬪繀瑕併亴銇亜銇с仐銈囥亞銆�
-            if (status == 'OK') {
-                rowData.retry_cnt__c = 0;
-                //add           wangweipeng                       2022/02/18               start
-                //濡傛灉涓簍rue锛岃瘉鏄庢槸閲嶆柊鍙戦�佺殑鎺ュ彛锛岄渶瑕佹妸鏃ュ織璁板綍涓�
-                if(needUpdateIflog){
-                    logstr += 'Status:' + status;
-                    logstr += '\nResponse:' + responseBody;
-                    logstr += '\nend';
-                }
-                //add           wangweipeng                       2022/02/18               start
-            } else {
-                if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
-                if (rowData.retry_cnt__c < batch_retry_max_cnt) {
-                    rowData.retry_cnt__c++;
-                    LogAutoSendSchedule.assignOneMinute();
-                }
-                if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
-                    rowData.ErrorLog__c = 'status:' + status +
-                                          '\n閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
-                }
-            }
+            // if (status == 'OK') {
+            //     rowData.retry_cnt__c = 0;
+            //     //add           wangweipeng                       2022/02/18               start
+            //     //濡傛灉涓簍rue锛岃瘉鏄庢槸閲嶆柊鍙戦�佺殑鎺ュ彛锛岄渶瑕佹妸鏃ュ織璁板綍涓�
+            //     if(needUpdateIflog){
+            //         logstr += 'Status:' + status;
+            //         logstr += '\nResponse:' + responseBody;
+            //         logstr += '\nend';
+            //     }
+            //     //add           wangweipeng                       2022/02/18               start
+            // } else {
+            //     if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
+            //     if (rowData.retry_cnt__c < batch_retry_max_cnt) {
+            //         rowData.retry_cnt__c++;
+            //         LogAutoSendSchedule.assignOneMinute();
+            //     }
+            //     if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
+            //         rowData.ErrorLog__c = 'status:' + status +
+            //                               '\n閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
+            //     }
+            // }
         } catch (Exception ex) {
             // TODO IOException
             // 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎

--
Gitblit v1.9.1