| | |
| | | //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; |
| | | } |
| | |
| | | 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 |
| | |
| | | || 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 //办事处 |
| | | ) { |
| | |
| | | || 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 |
| | |
| | | || 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// 办事处 |
| | | ) { |
| | |
| | | || 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 |
| | |
| | | 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' || acc.RecordTypeId == '0120T0000003Cxt') { // IE or RVI |
| | | if (acc.RecordTypeId == '01228000000TdF6' || acc.RecordTypeId == '01228000000TdFB' || acc.RecordTypeId == '01228000000TdFG' || acc.RecordTypeId == '01228000000TdFL') { // IE or RVI |
| | | SSBDCustomerContact.CustomerDescription2Description3 += ',' + (String.isBlank(acc.EnglishName__c) ? '' : acc.EnglishName__c); |
| | | } else { |
| | | SSBDCustomerContact.CustomerDescription2Description3 += ',' + (String.isBlank(acc.DepartmentName__c) ? '' : acc.Departmentname__c); |
| | |
| | | Phone, MobilePhone, |
| | | Fax, Email, PostCode__c, Address1__c, |
| | | CreatedDate, LastModifiedDate, |
| | | Account.UserType__c, |
| | | AWS_Data_Id__c//dennis update for pi 2022/3/9 |
| | | Account.UserType__c |
| | | from Contact where Id IN :conIds]; // 削除データを検索しないはず、All ROWS いらないはず |
| | | // System.debug(Logginglevel.DEBUG, 'SBG001_' + iflog.Name + ' conList.size()=' + conList.size()); |
| | | |
| | |
| | | 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' || con.AccountRecordTypeId__c == '0120T0000003Cxt') { // IE or RVI |
| | | if (con.AccountRecordTypeId__c == '01228000000TdF6' || con.AccountRecordTypeId__c == '01228000000TdFB' || con.AccountRecordTypeId__c == '01228000000TdFG' || con.AccountRecordTypeId__c == '01228000000TdFL') { // 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); |
| | |
| | | + ',' + (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最终用户接口传输逻辑变更(update-Start-20200525) |
| | | SSBDCustomerContact.UserType = ''; |
| | |
| | | logstr = iflog.Log__c; |
| | | } |
| | | try{ |
| | | |
| | | //update to aws 2022/3/9 dennis |
| | | PIHelper.PIIntegration pi =PIHelper.getPIIntegrationInfo('SBG001'); |
| | | NFMUtil.response result =NFMUtil.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)) { |
| | | |
| | | status = NFMUtil.sendToSapRet(rowDataStr, NFMUtil.SBG001_ENDPOINT); |
| | | system.debug('status--->'+status); |
| | | if (status == 'OK') { |
| | | 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) { |
| | | //add respomseBody 记录错误信息 by sushanhu 20220406 start |
| | | rowData.ErrorLog__c = 'status:' + status +responseBody+ |
| | | rowData.ErrorLog__c = 'status:' + status + |
| | | '\n错误次数已经超过自动送信设定的最大次数,请手动送信'; |
| | | //add respomseBody 记录错误信息 by sushanhu 20220406 end |
| | | } |
| | | } |
| | | //update to aws 2022/3/9 dennis |
| | | logstr += '\nend'; |
| | | // rowData.retry_cnt__c=0; |
| | | |
| | | // 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 |
| | | // エラーが発生した場合 |