global class NFM606Batch implements Database.Batchable < sObject > , Database.AllowsCallouts { public String query; // public List < String > IdList; // public String executeType; // public String idStr; // global NFM606Batch() { // } // global NFM606Batch(String executeType) { // this.executeType = executeType; // } // global NFM606Batch(String executeType, List < String > IdList) { // this.IdList = IdList; // this.executeType = executeType; // } // global NFM606Batch(String executeType, String idStr) { // this.idStr = idStr; // this.executeType = executeType; // } global Database.QueryLocator start(Database.BatchableContext bc) { // if ('User'.equals(executeType)) { // // 用户接口 // return Database.getQueryLocator([ // SELECT Id, IsActive, Employee_No__c FROM User WHERE IsActive = true AND Employee_No__c != '' AND Stay_or_not__c = '在职' // ]); // } else if ('Contact'.equals(executeType)) { // // 联系人接口 // return Database.getQueryLocator([ // select Id, Isactive__c from Contact where Isactive__c = '有效' AND RecordTypeId != '01210000000QtkyAAC' AND MobilePhone != '' // ]); // } else if ('Inspection_Report'.equals(executeType)) { // // 点检报告接口 // return Database.getQueryLocator([ // select Id, Name, Status__c from Inspection_Report__c where Status__c = '批准' // AND RecordtypeId = '0121m000000m3Bi' // ]); // } else if ('NewMaintenanceReport_Task'.equals(executeType) && IdList != null && IdList.size() > 0) { // // 维修合同接口 // return Database.getQueryLocator([ // select Id, Name from NewMaintenanceReport_Task__c where Id IN: IdList // ]); // } else if ('NewMaintenanceReport_Task'.equals(executeType)) { // return Database.getQueryLocator([ // select Id, Name from NewMaintenanceReport_Task__c // ]); // } else if ('Repair'.equals(executeType) && IdList != null && IdList.size() > 0) { // // 修理接口 // return Database.getQueryLocator([ // select Id, Name from Repair__c where Id IN: IdList // ]); // } else if ('Repair'.equals(executeType) && String.isNotBlank(idStr)) { // // 修理接口 // return Database.getQueryLocator([ // select Id, Name from Repair__c where Id = :idStr // ]); // } else if ('Repair'.equals(executeType)) { // return Database.getQueryLocator([ // select Id, Name from Repair__c // ]); // } // // NewMaintenanceReport_Task__c return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, list < Sobject > scope) { // List < String > sobjectList = new List < String > (); // for (Sobject sobj: scope) { // sobjectList.add(sobj.Id); // } // if (sobjectList.size() > 0) { // if ('User'.equals(executeType)) { // // List < String > employeeNoList = new List < String > (); // // List < User > getUserList = [SELECT Id, IsActive, Employee_No__c FROM User WHERE Id In: sobjectList]; // // for (User user: getUserList) { // // employeeNoList.add(user.Employee_No__c); // // } // // if (employeeNoList.size() > 0) { // // NFM621Controller.executefuture('', employeeNoList); // // } // NFM621Controller.executefuture('', sobjectList); // } else if ('Contact'.equals(executeType)) { // NFM606Controller.executeNotFuture(null, sobjectList); // } else if ('Inspection_Report'.equals(executeType)) { // NFM602Controller.executeNotFuture(null, sobjectList); // } else if ('NewMaintenanceReport_Task'.equals(executeType)) { // NFM605Controller.executeNotFuture(null, sobjectList); // } else if ('Repair'.equals(executeType)) { // NFM603Controller.executefuture(null, sobjectList); // } // } } global void finish(Database.BatchableContext BC) { } }