binxie
2024-01-16 1b08402678deb31bba4a347bfd388eba8360cbc1
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
//刷新数据:9月重复性检查项目合并
//一批一条数据
global class RepeatProMergeBtach implements Database.Batchable<SObject> , Database.Stateful{
    
    private final List<String> proIdList = null;
    
    global RepeatProMergeBtach(){
    }
 
    global RepeatProMergeBtach(List<String> str){
        proIdList = str;
    }
 
    global Database.QueryLocator start(Database.BatchableContext BC){
 
        String soql = 'Select Id,Name,InfoId__c,Logical_delete__c,ProjectId__c,Retain_Tender__c '
                    + 'From Tender_information__c '
                    + 'Where Retain_Tender__c != null '
                    + 'And RepeatProMergeFLG__c = true ' ;
        if(proIdList <> null){
            soql += 'And Id in:proIdList';
        }
        System.debug('20231008---soql:'+soql);
        return Database.getQueryLocator(soql);
    }
 
    global void execute(Database.BatchableContext BC, List<Tender_information__c> tenList){
        System.debug('20231008---execute---');
        System.debug('20231008---tenList---'+tenList);
        if(tenList.Size() > 0 ){
            for(Tender_information__c ten : tenList){
                String tenJson = JSON.serialize(ten);
                System.debug('20231008---tenJson:'+tenJson);
                TenderDeleteLwcController.saveData(tenJson);
            }
        }
    }
 
    global void finish(Database.BatchableContext BC){
        
    }
}