| | |
| | | global class Sfdc2SapDealersContractBatch implements Database.Batchable<sObject>, Database.AllowsCallouts { |
| | | |
| | | Boolean IsNeedExecute = false; // 2021-03-10 mzy WLIG-BYHD79 SFDC环境batch合并调查 是否符合执行条件 |
| | | |
| | | //xinhonglu |
| | | global Sfdc2SapDealersContractBatch() { |
| | | |
| | | } |
| | | |
| | | // 2021-03-10 mzy WLIG-BYHD79 SFDC环境batch合并调查 start |
| | | global Sfdc2SapDealersContractBatch(Boolean NeedExecute) { |
| | | this.IsNeedExecute = NeedExecute; |
| | | } |
| | | // 2021-03-10 mzy WLIG-BYHD79 SFDC环境batch合并调查 end |
| | | |
| | | |
| | | global Database.QueryLocator start(Database.BatchableContext BC) { |
| | | System.debug('================================进入batch'); |
| | | |
| | | return Database.getQueryLocator( |
| | | [SELECT Id, RecordType_DeveloperName__c , RecordTypeId , |
| | | Sap2sfdcDealers_ModifycationLogo__c, Is_Active_Formula__c, |
| | |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, List<Account> accList) { |
| | | |
| | | String[] needSendTypes = new String[] {'契約', '販売店'}; |
| | | List<Account> updateAccountList = new List<Account>(); |
| | | Map<String, String> purposeOfAdviceMap = new Map<String, String>(); |
| | |
| | | //Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | List<String> accIds = new List<String>(); |
| | | List<String> accIdList2Applet = new List<String>(); |
| | | for (Account acc : accList) { |
| | | acc.Sap2sfdcDealers_ModifycationLogo__c = '0'; |
| | | if (needSendRectMap.get(acc.RecordTypeId) == '契約') { |
| | |
| | | |
| | | } |
| | | purposeOfAdviceMap.put(acc.Id, acc.ContractSfdc2SapLog__c); |
| | | if (needSendRectMap.get(acc.RecordTypeId) == '販売店'){ |
| | | accIdList2Applet.add(acc.Id); |
| | | } |
| | | //if (needSendRectMap.get(acc.RecordTypeId) == '販売店'){ |
| | | // //acc.Sap2sfdcDealers_ModifycationLogo__c = '0'; |
| | | // updateAccountList.add(acc); |
| | |
| | | // upsert updateAccountList; |
| | | //} |
| | | NFM001Controller.calloutNotFuture(null, accIds, purposeOfAdviceMap, needSendRectMap); |
| | | system.debug('accIdList2Applet--->'+accIdList2Applet); |
| | | if (accIdList2Applet.size() > 0) { |
| | | NFM601Controller.executefuture(null, accIdList2Applet); |
| | | } |
| | | if (updateAccountList.size() > 0) { |
| | | upsert updateAccountList; |
| | | } |
| | | // system.debug('accIdList2Applet--->'+accIdList2Applet); |
| | | // if (accIdList2Applet.size() > 0) { |
| | | // NFM601Controller.executefuture(null, accIdList2Applet); |
| | | // } |
| | | |
| | | iflog.Log__c = 'end\n'; |
| | | } catch (Exception ex) { |
| | | // エラーが発生した場合 |