From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/rollupToRepairBatch.cls |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/rollupToRepairBatch.cls b/force-app/main/default/classes/rollupToRepairBatch.cls
index 27032cd..5cfceb4 100644
--- a/force-app/main/default/classes/rollupToRepairBatch.cls
+++ b/force-app/main/default/classes/rollupToRepairBatch.cls
@@ -1,4 +1,5 @@
 global class rollupToRepairBatch implements Database.Batchable<sObject>, Database.Stateful {
+
     public String query;
 
     global Integer totalCount = 0; // 鎬讳欢鏁�
@@ -25,7 +26,10 @@
 
 
     global Database.QueryLocator start(Database.BatchableContext bc) {
-
+        // 20221110 ljh 浼樺寲 start
+        Date st = Date.today().addMonths(-36);
+        Datetime startDatetime = Datetime.newInstance(st.year(), st.month(), st.day(), 8, 0, 0);
+        // 20221110 ljh 浼樺寲 end
         if (repairId != null && repairId.size() > 0) {
             return Database.getQueryLocator(
                        [select Id,
@@ -45,6 +49,18 @@
                         from repair__c
                        ]);
         } else {
+            // 20221110 ljh 浼樺寲 start
+            // return Database.getQueryLocator(
+            //            [select Id ,
+            //             if_Rental_Apply__c ,
+            //             Offer_Rental_New__c,
+            //             Request_approval_day__c,
+            //             Bollow_Date__c
+            //             from repair__c
+            //             where Repair_Completed_Date__c = null Or
+            //                     Repair_Completed_Date__c >= :
+            //                     Date.today().addMonths(-12)
+            //            ]);
             return Database.getQueryLocator(
                        [select Id ,
                         if_Rental_Apply__c ,
@@ -52,10 +68,15 @@
                         Request_approval_day__c,
                         Bollow_Date__c
                         from repair__c
-                        where Repair_Completed_Date__c = null Or
-                                Repair_Completed_Date__c >= :
-                                Date.today().addMonths(-12)
+                        where Status1__c  != '0.鍙栨秷' 
+                        and Status1__c   != '0.鍒犻櫎' 
+                        and Status1__c != '5.瀹屾瘯'
+                        and (
+                        (Repair_Completed_Date__c = null and CreatedDate > :startDatetime)
+                         Or Repair_Completed_Date__c >= :Date.today().addMonths(-12)
+                        )
                        ]);
+            // 20221110 ljh 浼樺寲 end
         }
     }
 
@@ -129,7 +150,6 @@
                 updateRepairMap.remove(newRepair.id);
             }
         }
-
         // 鏇存柊鍙戠敓鍙樺寲鐨勪慨鐞�
         Database.SaveResult[] updateRepairResult = Database.update(updateRepairMap.values(), false);
         for (Database.SaveResult lsrChild : updateRepairResult ) {

--
Gitblit v1.9.1