buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
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
/*2022-04-29  ljh
* 更新招标信息的所有人(有询价时)
*/
global class UpdateTenderInformation01Batch implements Database.Batchable<sObject> {
    public String query;
 
    global UpdateTenderInformation01Batch() {
        this.query = query;
    }
 
    global Database.QueryLocator start(Database.BatchableContext bc) {
        query = 'select Opportunity__c,Tender_information__c from Tender_Opportunity_Link__c where OwnerIsChange__c = true';
        return Database.getQueryLocator(query);
    }
 
    global void execute(Database.BatchableContext BC, list<Tender_Opportunity_Link__c> tolList) {
        //定义List封装需要空更新的招投标项目
        List<Tender_information__c> EmptyUpdateTenderList = new List<Tender_information__c>();
        Map<String,String> TenderIdMap = new Map<String,String>();
        for(Tender_Opportunity_Link__c tol:tolList){
            if(!TenderIdMap.containsKey(tol.Tender_information__c)){
                Tender_information__c temp = new Tender_information__c();
                temp.Id = tol.Tender_information__c;
                EmptyUpdateTenderList.add(temp);
            }
            TenderIdMap.put(tol.Tender_information__c,tol.Tender_information__c);
        }
        if(EmptyUpdateTenderList.size()>0){
            //空更新招投标
            StaticParameter.EscapeOtherUpdateTenOwner = false;
            Database.SaveResult[] EmptySaveTenderResult = Database.update(EmptyUpdateTenderList,false);
            StaticParameter.EscapeOtherUpdateTenOwner = true;
        }
    }
    global void finish(Database.BatchableContext BC) {
        Id execBTId = Database.executeBatch(new UpdateInquiryFormConfirmationBatch(), 100); 
        //询价流程改善 fy start
        Id execBTId2 = Database.executeBatch(new UpdateTenderInformationBatch2(),100);
        //询价流程改善 fy end
    }
     public static void justForTest() {
        Integer i = 0;
        
    }
}