From 08a21f49f2eaf9cfc19ceb67b196cc36ba689305 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 13 五月 2022 20:52:25 +0800 Subject: [PATCH] FIxSWOPageIssue --- force-app/main/default/classes/SBG001TriggerHandler.cls | 63 ++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 11 deletions(-) diff --git a/force-app/main/default/classes/SBG001TriggerHandler.cls b/force-app/main/default/classes/SBG001TriggerHandler.cls index 8f43ef4..3ebc381 100644 --- a/force-app/main/default/classes/SBG001TriggerHandler.cls +++ b/force-app/main/default/classes/SBG001TriggerHandler.cls @@ -8,6 +8,7 @@ //001淇敼Rest gwy start 2021-04-06 //public class SBG001ResrException extends Exception {} public static String status; + public static String responseBody;//dennis update for pi 2022/3/9 public class SBG001 { public SSBDCustomerContacts_element SSBDCustomerContacts; } @@ -33,6 +34,7 @@ public String ContactCode; public String ContactEffectiveDateFrom; public String PurposeOfAdvice; + public String DataId;//dennis update for pi 2022/3/9 } //001淇敼Rest gwy end 2021-04-06 @@ -65,6 +67,7 @@ || acc.RecordTypeId == '01228000000TdFG' // NDT || acc.RecordTypeId == '01228000000TdFL' // ANI || acc.RecordTypeId == '01228000000TdF1' // BS + || acc.RecordTypeId == '0120T0000003Cxt' // IE鐩撮攢 ) && acc.stautesD__c == 'Pass') || acc.RecordTypeId == SBG001TriggerHandler.Account_Agency_Id //鍔炰簨澶� ) { @@ -85,6 +88,7 @@ || acc.RecordTypeId == '01228000000TdFG' // NDT || acc.RecordTypeId == '01228000000TdFL' // ANI || acc.RecordTypeId == '01228000000TdF1' // BS + || acc.RecordTypeId == '0120T0000003Cxt' // IE鐩撮攢 ) && acc.stautesD__c == 'Pass' && (acc.ManagementCode_Ext__c != old.ManagementCode_Ext__c @@ -159,6 +163,7 @@ || con.AccountRecordTypeId__c == '01228000000TdFB' // RVI || con.AccountRecordTypeId__c == '01228000000TdFG' // NDT || con.AccountRecordTypeId__c == '01228000000TdF1' // BS + || con.AccountRecordTypeId__c == '0120T0000003Cxt' // IE鐩撮攢 ) && con.StatusD__c == 'Pass') || con.AccountRecordTypeId__c == SBG001TriggerHandler.Account_Agency_Id// 鍔炰簨澶� ) { @@ -184,6 +189,7 @@ || con.AccountRecordTypeId__c == '01228000000TdFG' // NDT || con.AccountRecordTypeId__c == '01228000000TdF1' // BS || con.AccountRecordTypeId__c == SBG001TriggerHandler.Account_Agency_Id // 鍔炰簨澶� + || con.AccountRecordTypeId__c == '0120T0000003Cxt' // IE鐩撮攢 ) && con.StatusD__c == 'Pass' && (con.ManagementCode_Ext__c != old.ManagementCode_Ext__c @@ -324,7 +330,7 @@ SSBDCustomerContact.CustomerDescription = acc.FacilityName__c; SSBDCustomerContact.CustomerDescription2Description3 = (String.isBlank(acc.DivisionName__c) ? '' : (acc.DivisionName__c=='鏃�' ? '' : acc.DivisionName__c)); - if (acc.RecordTypeId == '01228000000TdF6' || acc.RecordTypeId == '01228000000TdFB' || acc.RecordTypeId == '01228000000TdFG' || acc.RecordTypeId == '01228000000TdFL') { // IE or RVI + if (acc.RecordTypeId == '01228000000TdF6' || acc.RecordTypeId == '01228000000TdFB' || acc.RecordTypeId == '01228000000TdFG' || acc.RecordTypeId == '01228000000TdFL' || acc.RecordTypeId == '0120T0000003Cxt') { // IE or RVI SSBDCustomerContact.CustomerDescription2Description3 += ',' + (String.isBlank(acc.EnglishName__c) ? '' : acc.EnglishName__c); } else { SSBDCustomerContact.CustomerDescription2Description3 += ',' + (String.isBlank(acc.DepartmentName__c) ? '' : acc.Departmentname__c); @@ -512,7 +518,8 @@ Phone, MobilePhone, Fax, Email, PostCode__c, Address1__c, CreatedDate, LastModifiedDate, - Account.UserType__c + Account.UserType__c, + AWS_Data_Id__c//dennis update for pi 2022/3/9 from Contact where Id IN :conIds]; // 鍓婇櫎銉囥兗銈裤倰妞滅储銇椼仾銇勩伅銇氥�丄ll ROWS 銇勩倝銇亜銇仛 // System.debug(Logginglevel.DEBUG, 'SBG001_' + iflog.Name + ' conList.size()=' + conList.size()); @@ -532,7 +539,7 @@ SSBDCustomerContact.CustomerDescription = con.Account.FacilityName__c; SSBDCustomerContact.CustomerDescription2Description3 = (String.isBlank(con.Account.DivisionName__c) ? '' : (con.Account.DivisionName__c=='鏃�' ? '' : con.Account.DivisionName__c)); - if (con.AccountRecordTypeId__c == '01228000000TdF6' || con.AccountRecordTypeId__c == '01228000000TdFB' || con.AccountRecordTypeId__c == '01228000000TdFG' || con.AccountRecordTypeId__c == '01228000000TdFL') { // IE or RVI + if (con.AccountRecordTypeId__c == '01228000000TdF6' || con.AccountRecordTypeId__c == '01228000000TdFB' || con.AccountRecordTypeId__c == '01228000000TdFG' || con.AccountRecordTypeId__c == '01228000000TdFL' || con.AccountRecordTypeId__c == '0120T0000003Cxt') { // IE or RVI SSBDCustomerContact.CustomerDescription2Description3 += ',' + (String.isBlank(con.Account.EnglishName__c) ? '' : con.Account.EnglishName__c); } else { SSBDCustomerContact.CustomerDescription2Description3 += ',' + (String.isBlank(con.Account.DepartmentName__c) ? '' : con.Account.Departmentname__c); @@ -545,6 +552,7 @@ + ',' + (String.isBlank(con.Email) ? '' : con.Email); SSBDCustomerContact.PostalCode = String.isBlank(con.PostCode__c) ? '' : con.PostCode__c; SSBDCustomerContact.Address = String.isBlank(con.Address1__c) ? '' : con.Address1__c; + SSBDCustomerContact.DataId = String.isBlank(con.AWS_Data_Id__c) ? '' : con.AWS_Data_Id__c; SSBDCustomerContact.CustomerCategory = GetCustomerCategory(null,con);//'瀹㈡埛' + (String.isBlank(con.Account.ProductSegment__c) ? '' : con.Account.ProductSegment__c); // JZHU-BPQBVK-IE鏈�缁堢敤鎴锋帴鍙d紶杈撻�昏緫鍙樻洿(update-Start-20200525) SSBDCustomerContact.UserType = ''; @@ -734,26 +742,59 @@ } else { logstr = iflog.Log__c; } + // 娣诲姞aws涓婄嚎寮�鍏� by sushanhu 20220419 + Boolean piOn =AWSServiceTool.getAWSServiceStatus(); try{ - - status = NFMUtil.sendToSapRet(rowDataStr, NFMUtil.SBG001_ENDPOINT); - system.debug('status--->'+status); - if (status == 'OK') { + if (piOn) { + //update to aws 2022/3/9 dennis + PIHelper.PIIntegration pi =PIHelper.getPIIntegrationInfo('SBG001'); + // NFMUtil.response result =NFMUtil.sendToPiAWS(rowDataStr,pi.newUrl,pi.token); + AWSServiceTool.response result = AWSServiceTool.sendToPiAWS(rowDataStr,pi.newUrl,pi.token); + system.debug('aws result---'+result); + status = result.status; + system.debug('aws status---'+status); + responseBody=result.responseBody; + // Map<String, Object> res = (Map<String, Object>)JSON.deserializeUntyped(responseBody); + // status=(String)res.get(status); + if ('200'.equals(status)) { logstr += '\nstatus='+status; rowData.retry_cnt__c = 0; - } else { + } 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 + + //add respomseBody 璁板綍閿欒淇℃伅 by sushanhu 20220406 start + rowData.ErrorLog__c = 'status:' + status +responseBody+ '\n閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊'; + //add respomseBody 璁板綍閿欒淇℃伅 by sushanhu 20220406 end } + } + //update to aws 2022/3/9 dennis + logstr += '\nend'; + }else { + status = NFMUtil.sendToSapRet(rowDataStr, NFMUtil.SBG001_ENDPOINT); + system.debug('status--->'+status); + if (status == 'OK') { + logstr += '\nstatus='+status; + rowData.retry_cnt__c = 0; + } 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閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊'; + } + } + logstr += '\nend'; + // rowData.retry_cnt__c=0; } - logstr += '\nend'; - // rowData.retry_cnt__c=0; + }catch(Exception ex) { // TODO IOException // 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎 -- Gitblit v1.9.1