/** * 通过NFM601ControllerTest进行测试 */ global class Sfdc2PoAccountBatch implements Database.Batchable, Database.AllowsCallouts { public String query; public List < String > accountIdList; global Sfdc2PoAccountBatch() { this.query = query; } // 指定 客户Id集合 global Sfdc2PoAccountBatch(List < String > accountIdList) { this.accountIdList = accountIdList; } global Database.QueryLocator start(Database.BatchableContext bc) { if (accountIdList != null && accountIdList.size() > 0) { return Database.getQueryLocator([SELECT Id, RecordTypeId, Is_Active_Formula__c,AwaitToSendAWS__c FROM Account WHERE Id IN:accountIdList ]); } else { // return Database.getQueryLocator( // [SELECT Id, RecordTypeId,Is_Active_Formula__c,AwaitToSendAWS__c // FROM Account WHERE AwaitToSendAWS__c = true OR (RecordTypeId= '01210000000Qem1AAC' AND Ban_On_Use_Date__c = :Date.today()-1) // ]); // 批量发送历史数据 Start return Database.getQueryLocator( [SELECT Id, RecordType_DeveloperName__c, RecordTypeId, Sap2sfdcDealers_ModifycationLogo__c, Is_Active_Formula__c, ContractSfdc2SapLog__c,AwaitToSendAWS__c FROM Account WHERE (RecordTypeId = '01210000000QemGAAS' OR RecordTypeId = '01210000000Qem1AAC') AND Is_Active_Formula__c = '有效' ]); // ); // 批量发送历史数据 End //临时 发送给 AWS // [SELECT Id, RecordType_DeveloperName__c, RecordTypeId, // Sap2sfdcDealers_ModifycationLogo__c, Is_Active_Formula__c, // ContractSfdc2SapLog__c,AwaitToSendAWS__c // FROM Account WHERE (RecordTypeId = '01210000000Qem1AAC') AND Is_Active_Formula__c = '有效' // ]); } } global void execute(Database.BatchableContext BC, List < Account > accountList) { List < String > accIdList = new List < String > (); for (Account account: accountList) { accIdList.add(account.Id); } if (accIdList.size() > 0) { NFM601Controller.executefuture(null, accIdList); } // List < String > accIdList = new List < String > (); // for (Account account: accountList) { // account.AwaitToSendAWS__c = false; // accIdList.add(account.Id); // } // if (accIdList.size() > 0) { // NFM601Controller.executefuture(null, accIdList); // update accountList; // } } global void finish(Database.BatchableContext BC) { } }