From eeb7c0a2d6f037d515bb822d739036b69c4dc73a Mon Sep 17 00:00:00 2001 From: 沙世明 <shashiming@prec-tech.com> Date: 星期五, 08 四月 2022 17:14:12 +0800 Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG --- force-app/main/default/classes/NFM103Controller.cls | 103 +++++++++++++++++++++++++++++---------------------- 1 files changed, 59 insertions(+), 44 deletions(-) diff --git a/force-app/main/default/classes/NFM103Controller.cls b/force-app/main/default/classes/NFM103Controller.cls index 19abb6d..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 { @@ -108,7 +108,7 @@ //add pi 鍔犲瘑 sushanhu 20220222 end //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� start - public Datetime QuotationDate; + public String QuotationDate; //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� end @@ -217,6 +217,7 @@ */ @future (callout = true) public static void callout(String iflog_Id, List<Id> repairIds) { + if (repairIds == null || repairIds.size() == 0) { return; @@ -394,8 +395,7 @@ element.TradeType = NFMUtil.getMapValue(transferMap, 'Trade__c', rpr.Delivered_Product__r.Backorder__r.Opportunity__r.Trade__c, iflog); //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� start - //element.QuotationDate = NFMUtil.getMapValue(transferMap, 'SAP_Send_OK_Date__c', rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c, iflog); - element.QuotationDate = rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c; + element.QuotationDate = NFMUtil.formatDateTime2StrSprit(rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c).replaceAll('/', ''); //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� end // 澶氬勾淇濅慨 LHJ Start @@ -427,10 +427,6 @@ }*/ // 2021-01-07 mzy update 澶氬勾淇濅慨澶栬锤NFM103鎺ュ彛淇敼 start String tradeType = rpr.Delivered_Product__r.Backorder__r.Opportunity__r.Trade__c; - - //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� start - //Date QuotationDate = rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c; - //20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� end String NewProductGuaranteeObject = rpr.NewProductGuaranteeObject__c == null ? '': rpr.NewProductGuaranteeObject__c; @@ -601,22 +597,17 @@ // NFMUtil.response response = // NFMUtil.sendToSapStatusAndBody(rowDataStr, NFMUtil.NFM103_ENDPOINT); //update to aws 20220222 sushanhu start for PIPL - NFMUtil.response res = NFMUtil.getAwsToken(); - String token=res.responseBody; - if(String.isBlank(token)){ - iflog.ErrorLog__c='NFM103'+'鑾峰彇aws token 澶辫触'; - - } - NFMUtil.response response = NFMUtil.sendToPiAWS(rowDataStr, NFMUtil.NFM103_ENDPOINT,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 = @@ -626,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 = @@ -638,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