高章伟
2023-03-03 d8dc84a3d56df839895f1c417a4d9cbee763d262
force-app/main/default/classes/SpareIsLoanBatch.cls
@@ -6,6 +6,8 @@
   Boolean IsNeedExecute = false; // 2021-06-07  mzy  WLIG-BYHD79  SFDC环境batch合并调查  是否符合执行条件
   Integer daysBefore = 2; // 2023-01-05 ssm 报告太多了,需要增加限制
   //默认执行为无参
   global SpareIsLoanBatch() {
      
@@ -20,6 +22,12 @@
      this.IsNeedExecute = needExecute; 
   }
   // 2021-06-07  mzy  WLIG-BYHD79  SFDC环境batch合并调查   end
   // 2023-01-05 ssm 为报告增加限制,处理历史数据 start
   global SpareIsLoanBatch(Integer days) {
      this.daysBefore = days;
   }
   // 2023-01-05 ssm 为报告增加限制,处理历史数据 end
   global Database.QueryLocator start(Database.BatchableContext BC) {
      if (oppIdListBatch == null || oppIdListBatch.size() == 0 ) {
@@ -174,9 +182,11 @@
         }
      }
      
      // 2023-01-05 ssm 增加限制,报告要审批通过的,最后更新日在2天内的
      // 为处理历史数据,设置成可以调整的样子
      Datetime start_at = this.daysBefore != null && this.daysBefore > 0 ? Datetime.now().addDays(0 - this.daysBefore) : Datetime.now().addDays(-2);
      List<Report__c> raLists = [Select Id,Loaner_request_no1__c,Loaner_request_no1__r.OPDAmount__c 
         from Report__c where Loaner_request_no1__c != null ];
         from Report__c where Loaner_request_no1__c != null and Status__c = '批准' and LastModifiedDate >= :start_at];
      
      for (Report__c ra: raLists) {