高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 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 > accountList) {
 
        // 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) {
 
    }
}