liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
//刷新数据:9月重复性检查项目合并
//一批一条数据
global class RepeatProMergeBtach implements Database.Batchable<SObject> , Database.AllowsCallouts,Database.Stateful{
    
    private final List<String> proIdList = null;
 
    private Boolean sendToQLM = false; //lt 20240115 DB202401099582 add
    
    global RepeatProMergeBtach(){
    }
 
    //lt 20240115 DB202401099582 update
    global RepeatProMergeBtach(List<String> str, Boolean apiSend){
        this.proIdList = str;
        this.sendToQLM = apiSend;
    }
 
    //lt 20240115 DB202401099582 add
    global RepeatProMergeBtach(Boolean apiSend) {
        this.sendToQLM = apiSend;
    }
 
    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(this.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);
                //lt 20240115 DB202401099582 update NFM504Controller.sendRequestNotFuture(ten.Id);
                if (this.sendToQLM) {
                    System.debug('20240115---ten.Id:'+ten.Id);
                    NFM504Controller.sendRequestNotFuture(ten.Id);
                } else {
                    TenderDeleteLwcController.saveData(tenJson);
                }
            }
        }
    }
 
    global void finish(Database.BatchableContext BC){
        
    }
 
    
}