global class Sfdc2PoUserBatch implements Database.Batchable<sObject>, Database.AllowsCallouts {
    public String query;
    public List < String > userIdList = null;

    global Sfdc2PoUserBatch() {
        this.query = query;
    }
    // 指定 用户Id集合
    global Sfdc2PoUserBatch(List < String > userIdList) {
        this.userIdList = userIdList;
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        if (userIdList != null && userIdList.size() > 0) {
            return Database.getQueryLocator(
                [SELECT Id, Name, Employee_No__c,UserType__c,IsMEBG__c,Stay_or_not__c,IsActive,UserType
                    FROM User 
                    WHERE Id IN:userIdList
                ]);
        } else {
            return Database.getQueryLocator(
                [SELECT Id, Name, Employee_No__c,UserType__c,IsMEBG__c,Stay_or_not__c,IsActive,UserType
                    FROM User 
                    WHERE UserType__c = 'Standard' and IsMEBG__c = true and Stay_or_not__c = '在职' and IsActive = true 
                ]);
        }
    }

    global void execute(Database.BatchableContext BC, List < User > userList) {
        List < String > uIdList = new List < String > ();
        if (userList.size()>0) {
            for (User user: userList) {
                uIdList.add(user.Id);
            }
        }
        if (uIdList.size() > 0) {
            NFM621Controller.executefuture('', uIdList);
        }
        
    }

    global void finish(Database.BatchableContext BC) {

    }
}