| | |
| | | public static String transUrl; |
| | | public static String transId; |
| | | public static String token; |
| | | public static integer isSuccess=0; |
| | | public static List<String> sfRecordIds; |
| | | //add staic sushanhu 20220302 end |
| | | Boolean IsNeedExecute = false; //2021-06-28 mzy WLIG-BYHD79 SFDC环境batch合并调查 是否符合执行条件 |
| | | //add nfm 503 aws response start sushanhu 20220301 |
| | |
| | | |
| | | global Database.QueryLocator start(Database.BatchableContext bc) { |
| | | String query = 'select Id, Tender_information__c, infoAddress__c, ' + |
| | | 'Tender_information__r.InfoType__c, isProcessed__c, ' + |
| | | ' ErrorMessage__c from bidInfoFile__c where isProcessed__c = false '; |
| | | 'Tender_information__r.InfoType__c, isProcessed__c, ' + |
| | | ' ErrorMessage__c from bidInfoFile__c where isProcessed__c = false '; |
| | | if (String.isNotBlank(TenId)) { |
| | | query += 'and Tender_information__r.Id =: TenId'; |
| | | } |
| | |
| | | transUrl =pi.searchUrl; |
| | | NFMUtil.response response = NFMUtil.getAWSQLMData(pi.newUrl ,JSON.serialize(queryfileList), token); |
| | | system.debug('aws result'+response.responseBody); |
| | | |
| | | Map<String, Object> result = (Map<String, Object>)JSON.deserializeUntyped(response.responseBody); |
| | | system.debug('NFM503 aws result--'+response.responseBody+'status'+response.status); |
| | | transId =(String)result.get('txId'); |
| | |
| | | |
| | | update bidInfoFileList; |
| | | // add 确认事务 sushanhu 20220302 start |
| | | List<String> sfRecordIds = new List<String>(); |
| | | isSuccess =1; |
| | | if (fileList.size() > 0 ) { |
| | | for (FileAddress__c fileAddress : fileList) { |
| | | sfRecordIds.add(fileAddress.Id); |
| | | system.debug('fileAddress.Id---'+fileAddress.Id); |
| | | } |
| | | } |
| | | system.debug('成功的token'+token); |
| | | |
| | | PIHelper.confirmFileTrans('NFM503',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | // PIHelper.confirmFileTrans('NFM503',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | |
| | | // if (!confirm) { |
| | | // //回滚 |
| | |
| | | if (sp != null) { |
| | | Database.rollback(sp); |
| | | } |
| | | //add 确认事务 20220302 sushanhu start |
| | | system.debug('失败的token'+token); |
| | | PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); |
| | | // //add 确认事务 20220302 sushanhu start |
| | | // system.debug('失败的token'+token); |
| | | // PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); |
| | | //add 确认事务 20220302 sushanhu end |
| | | bidInfoFile.ErrorMessage__c = '503抛出异常:' + ex.getMessage() + '\n' + ex.getStackTraceString(); |
| | | system.debug('ErrorMessage'+bidInfoFile.ErrorMessage__c); |
| | |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | |
| | | // add confirm transaction for pipl sushanhu 20220314 start |
| | | if (sfRecordIds==null) { |
| | | PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); |
| | | }else { |
| | | PIHelper.confirmFileTrans('NFM503',isSuccess,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | } |
| | | |
| | | // add confirm transaction for pipl sushanhu 20220314 end |
| | | } |
| | | } |