global class NFM601Batch implements Database.Batchable<sObject>, Database.AllowsCallouts {
|
public String query;
|
public List < String > accountIdList;
|
global NFM601Batch() {
|
this.query = query;
|
}
|
global NFM601Batch(List < String > accountIdList) {
|
this.accountIdList = accountIdList;
|
}
|
|
global Database.QueryLocator start(Database.BatchableContext bc) {
|
return Database.getQueryLocator([select Id,NFM601Tag__c from Account where NFM601Tag__c = true]);
|
//return null;
|
// 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
|
// // [SELECT Id, RecordType_DeveloperName__c, RecordTypeId,
|
// // Sap2sfdcDealers_ModifycationLogo__c, Is_Active_Formula__c,
|
// // ContractSfdc2SapLog__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
|
// // FROM Account WHERE (RecordTypeId = '01210000000Qem1AAC') AND Is_Active_Formula__c = '有效'
|
// // ]);
|
// }
|
|
}
|
|
global void execute(Database.BatchableContext BC , List<Account> accList) {
|
List<String> accIdList = new List<String>();
|
if(accList.size()>0){
|
for(Account temp : accList){
|
accIdList.add(temp.Id);
|
}
|
NFM601Controller.executefuture('', accIdList);
|
for(Account temp : accList){
|
temp.NFM601Tag__c = false;
|
}
|
}
|
update accList;
|
// List < String > accIdList = new List < String > ();
|
// for (Account account: accountList) {
|
// account.AwaitToSendAWS__c = false;
|
// accIdList.add(account.Id);
|
// }
|
|
// if (accIdList.size() > 0) {
|
// // Datetime nowDT = Datetime.now();
|
// // String nowStr = nowDT.format('yyyyMMddHHmm');
|
// // BatchIF_Log__c iflog = new BatchIF_Log__c();
|
// // iflog.Type__c = 'NFM601'
|
// // iflog.Log__c = 'execute NFM_601 batch \n';
|
// // iflog.Name = nowStr;
|
// // iflog.MessageGroupNumber = nowStr;
|
// NFM601Controller.executefuture(null, accIdList);
|
|
// update accountList;
|
|
// }
|
|
}
|
|
global void finish(Database.BatchableContext BC) {
|
if(!Test.isRunningTest()){
|
Id execBTId = Database.executeBatch(new NFM606Batch(), 200);
|
}
|
}
|
}
|