| | |
| | | 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); |
| | | } |
| | |
| | | update oldTimeTran; |
| | | return; |
| | | } |
| | | |
| | | //update to aws sushanhu for pi 20220323 start |
| | | // aaaaaaaa 这里这个字段可以改名为NFM501Response 之类的,这样就有区分度了 |
| | | // 解析后的code报错处理 |
| | | String NFM501responseBody = response.responseBody; |
| | | System.debug('-------------NFM501responseBody------------' + NFM501responseBody); |
| | | //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')); |
| | |
| | | Map < string, Tender_information__c > TenderMap = new map < string, Tender_information__c > (); |
| | | |
| | | for (Tender_information__c TMap: updateTenderMap.values()) { |
| | | system.debug('TMap---'+JSON.serialize(TMap)); |
| | | TenderMap.put(TMap.ProjectId__c, TMap); |
| | | PIHelper.IdList il= new PIHelper.IdList(); |
| | | // add for pipl sushanhu 20220310 start |
| | |
| | | throw new ControllerUtil.myException('aaa'); |
| | | } |
| | | //确认事务 add for pi sushanhu 20220310 start |
| | | PIHelper.confirmTrans('NFM501',1,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | // PIHelper.confirmTrans('NFM501',1,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | PIHelper.insertConfirmTrans('NFM501',1,null,txId,1,NFM501AWS.transactionURL,idList); |
| | | //确认事务 add for pi sushanhu 20220310 end |
| | | } catch (Exception ex) { |
| | | // 如果数据获取过程中,有错误(同一游标,如果报错,是他重新获取一遍,如果三次都没能获取到,就发送邮件报错信息,然后手动进行获取) |
| | | Database.rollback(sp); |
| | | //确认事务 add for pi sushanhu 20220310 start |
| | | PIHelper.confirmTrans('NFM501',0,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | // PIHelper.confirmTrans('NFM501',0,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | PIHelper.insertConfirmTrans('NFM501',0,null,txId,1,NFM501AWS.transactionURL,idList); |
| | | //确认事务 add for pi sushanhu 20220310 end |
| | | System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage()); |
| | | System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString()); |
| | |
| | | public static String transUrl; |
| | | public static String transId; |
| | | public static String token; |
| | | public static List<String> sfRecordIds =new List<String>(); |
| | | //add staic sushanhu 20220302 end |
| | | public NFM502Controller(String rowData_id) { |
| | | this.rowData_id = rowData_id; |
| | |
| | | upsert fileList; |
| | | } |
| | | //确认事务 |
| | | List<String> sfRecordIds = new List<String>(); |
| | | |
| | | for (FileAddress__c file : fileList) { |
| | | system.debug('file--'+json.serialize(file)); |
| | | system.debug('file.id'+file.Id); |
| | | sfRecordIds.add(file.Id); |
| | | } |
| | | //update to aws pi sushanhu 20220301 end |
| | | PIHelper.confirmFileTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | // PIHelper.confirmFileTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | PIHelper.insertConfirmTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,0,transUrl,null); |
| | | // if (!confirm) { |
| | | // //回滚 |
| | | // } |
| | |
| | | // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString()); |
| | | // logstr += '\n' + ex.getMessage(); |
| | | //add 事务确认 sushanhu 20220302 satrt |
| | | PIHelper.confirmFileTrans('NFM502',0,'',transId,token,transUrl); |
| | | // PIHelper.confirmFileTrans('NFM502',0,'',transId,token,transUrl); |
| | | PIHelper.insertConfirmTrans('NFM502',0,JSON.serialize(sfRecordIds),transId,0,transUrl,null); |
| | | //add 事务确认 sushanhu 20220302 end |
| | | iflog502.ErrorLog__c = '502抛出异常:' + ex.getMessage() + '\n' |
| | | + ex.getStackTraceString() + '\n' + iflog502.ErrorLog__c; |
| | |
| | | public static String transId; |
| | | public static String token; |
| | | public static integer isSuccess=0; |
| | | public static List<String> sfRecordIds; |
| | | public static List<String> sfRecordIds =new List<String>(); |
| | | //add staic sushanhu 20220302 end |
| | | Boolean IsNeedExecute = false; //2021-06-28 mzy WLIG-BYHD79 SFDC环境batch合并调查 是否符合执行条件 |
| | | //add nfm 503 aws response start sushanhu 20220301 |
| | |
| | | |
| | | update bidInfoFileList; |
| | | // add 确认事务 sushanhu 20220302 start |
| | | isSuccess =1; |
| | | |
| | | if (fileList.size() > 0 ) { |
| | | for (FileAddress__c fileAddress : fileList) { |
| | | system.debug('fileAddress.Id---'+json.serialize(fileAddress)); |
| | | sfRecordIds.add(fileAddress.Id); |
| | | system.debug('fileAddress.Id---'+fileAddress.Id); |
| | | } |
| | | } |
| | | system.debug('成功的token'+token); |
| | | |
| | | // PIHelper.confirmFileTrans('NFM503',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | |
| | | isSuccess =1; |
| | | |
| | | // if (!confirm) { |
| | | // //回滚 |
| | | // if (sp != null) { |
| | |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | // add confirm transaction for pipl sushanhu 20220314 start |
| | | if (sfRecordIds==null) { |
| | | PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); |
| | | if (isSuccess==0) { |
| | | PIHelper.confirmFileTrans('NFM503',isSuccess,'',transId,token,transUrl); |
| | | }else { |
| | | PIHelper.confirmFileTrans('NFM503',isSuccess,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | } |
| | |
| | | traLog.Interface_URL__c = traLog.Module__c; |
| | | insert traLog; |
| | | } |
| | | //save qianlima log method add sushanhu 20220324 |
| | | // model 0 为文件 1为数据 |
| | | public static void insertConfirmTrans(String module,Integer isSuccess, String sfRecordId ,String transId ,Integer model,String transUrl,List<idList> idList){ |
| | | Boolean result =false; |
| | | Transaction_Log__c traLog = new Transaction_Log__c(); |
| | | if (model==0) { |
| | | traLog.Module__c = 'ConfirmFileTransaction '+module; |
| | | }else { |
| | | traLog.Module__c = 'Confirm Transaction '+module; |
| | | } |
| | | traLog.Interface_URL__c = transUrl; |
| | | traLog.TransId__c = transId; |
| | | Integer MaxLogColumnLength = 131072; |
| | | if (!String.isEmpty(sfRecordId)) { |
| | | traLog.SFRecordId__c=sfRecordId.substring(0, (sfRecordId.length() > MaxLogColumnLength ? MaxLogColumnLength : sfRecordId.length())); |
| | | }else { |
| | | String sfIds =JSON.serialize(idList); |
| | | traLog.SFRecordId__c=sfIds.substring(0, (sfIds.length() > MaxLogColumnLength ? MaxLogColumnLength : sfIds.length())); |
| | | } |
| | | if(isSuccess==0){ |
| | | traLog.Status__c = 'fail'; |
| | | } else { |
| | | traLog.Status__c='success'; |
| | | } |
| | | insert traLog; |
| | | } |
| | | public static PIIntegration getPIIntegrationInfo(String sobjectType){ |
| | | PIIntegration piIntegration = new PIIntegration(); |
| | | //查询url |
| | | PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType]; |
| | | System.debug('config = ' + config); |
| | | |
| | | |
| | | //获取appid和appsecret |
| | | AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Max_Query_Number__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; |
| | | if (awsConfiguration == null) { |