| | |
| | | global class AccAssumeChangeBatch implements Database.Batchable<sObject> , Database.AllowsCallouts, Database.Stateful { |
| | | public List<Account> HospitalIdList;//执行失败手动录入医院 |
| | | global class AccAssumeChangeBatch implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful { |
| | | public List<Account> HospitalIdList; //执行失败手动录入医院 |
| | | Boolean a = true; |
| | | //执行失败手动录入医院 |
| | | global AccAssumeChangeBatch(List<Account> HospitalIdList) { |
| | | this.HospitalIdList = HospitalIdList; |
| | | } |
| | | global AccAssumeChangeBatch( boolean a) { |
| | | global AccAssumeChangeBatch(boolean a) { |
| | | this.a = a; |
| | | } |
| | | // 执行靶器 |
| | | global AccAssumeChangeBatch() { |
| | | |
| | | } |
| | | |
| | | global Database.QueryLocator start(Database.BatchableContext bc) { |
| | |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, list<Account> HosinfoList) { |
| | | List<Tender_information__c> TenInfoList = [Select Id, Hospital__c, Hospital1__c, Hospital2__c, Hospital3__c, |
| | | Hospital4__c from Tender_information__c |
| | | Where Hospital__c in: HosinfoList or Hospital1__c in: HosinfoList |
| | | or Hospital2__c in: HosinfoList or Hospital3__c in: HosinfoList |
| | | or Hospital4__c in: HosinfoList ]; |
| | | List<Tender_information__c> TenInfoList = [ |
| | | SELECT Id, Hospital__c, Hospital1__c, Hospital2__c, Hospital3__c, Hospital4__c |
| | | FROM Tender_information__c |
| | | WHERE |
| | | Hospital__c IN :HosinfoList |
| | | OR Hospital1__c IN :HosinfoList |
| | | OR Hospital2__c IN :HosinfoList |
| | | OR Hospital3__c IN :HosinfoList |
| | | OR Hospital4__c IN :HosinfoList |
| | | ]; |
| | | |
| | | if (TenInfoList.size() > 0) { |
| | | // List<Tender_information__c> failedTenderList = new List<Tender_information__c>(); |
| | | Map<String, String> failedAccountMap = new Map<String, String>();//如果招投标更新失败,用来存更新失败的招投标所关联的医院 |
| | | Map<String, String> failedAccountMap = new Map<String, String>(); //如果招投标更新失败,用来存更新失败的招投标所关联的医院 |
| | | // 空更新招投标 |
| | | Database.SaveResult[] saveTenderResults = Database.update(TenInfoList, false); |
| | | // 循环更新结果,取出空更新失败的招投标所对应的医院 |
| | |
| | | failedAccountMap.put(Hospital4Id, Hospital4Id); |
| | | } |
| | | } |
| | | List<Account> accsList = new List<Account>();// 用来更新客户信息(担当发生变化) |
| | | List<Account> accsList = new List<Account>(); // 用来更新客户信息(担当发生变化) |
| | | for (Account accs : HosinfoList) { |
| | | if (!failedAccountMap.containsKey(accs.Id) ) { |
| | | if (!failedAccountMap.containsKey(accs.Id)) { |
| | | accs.Assume_Change__c = false; |
| | | accsList.add(accs); |
| | | } |
| | |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | |
| | | } |
| | | } |
| | | } |