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/NFM116Batch.cls |   42 +++++++++++++++++++++++++++++-------------
 1 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/classes/NFM116Batch.cls b/force-app/main/default/classes/NFM116Batch.cls
index e51bd4d..b817d8c 100644
--- a/force-app/main/default/classes/NFM116Batch.cls
+++ b/force-app/main/default/classes/NFM116Batch.cls
@@ -2,27 +2,42 @@
     // 璁惧畾鍙戦�佹寚瀹氱鏀跺崟鐨処D
     public String setId;
     // 璁惧畾鎵ц鏃ユ湡
-    public Date setDate;
-    // 鏄惁鍙戦�佹寚瀹氭棩鏈�30澶╀箣鍚庣殑绛炬敹鍗�
-    public Boolean isAfterDate = false;
+    public String setDate;
+    public String endDate;
     // 鏄惁鍙戦�佹寚瀹氱殑绛炬敹鍗�
     public Boolean isAppoint = false;
+    // 鏄惁鍙戦�佹寚瀹氭棩鏈熺殑绛炬敹鍗�
+    public Boolean isSpecifyDate = false;
     // 璁惧畾鍙戦�佺殑绛炬敹鍗曠殑IdList
     public List<String> setIdList;
 
     // Default 鍙戦�佸綋鏃ョ鍚堟潯浠剁殑绛炬敹鍗�
     global NFM116Batch() {
-        this.setDate = Date.today();
+        // String yesterday = Date.today().addDays(-1).format().replace('/', '-');
+        // String today = Date.today().format().replace('/', '-');
+        // this.setDate = yesterday + 'T00:00:00.000+0000';
+        // this.endDate = today + 'T00:00:00.000+0000';
+        this.setDate = 'and LastModifiedDate = LAST_N_DAYS:1 and LastModifiedDate != LAST_N_DAYS:0 ';
     }
     // 鍙戦�佹寚瀹氭棩鏈熺鍚堟潯浠剁殑绛炬敹鍗�, eg: testDate = Date.newInstance(2022, 05, 02),鍙戦��20220501瀹屾垚绛炬敹鐨勭鏀跺崟
     global NFM116Batch(Date testDate) {
-        this.setDate = testDate;
+        isAppoint = true;
+        isSpecifyDate = true;
+        String yesterday = testDate.addDays(-1).format().replace('/', '-');
+        String pointday = testDate.format().replace('/', '-');
+        this.setDate = yesterday + 'T00:00:00.000+0000';
+        this.endDate = pointday + 'T00:00:00.000+0000';
     }
-    // 鍙戦�佸湪鎸囧畾鏃ユ湡30澶╀箣鍚庣殑鎵�鏈夌鍚堟潯浠剁殑绛炬敹鍗�(isAfterDate涓簍rue鐨勬椂鍊�)
+    // 鍙戦�佸湪鎸囧畾鏃ユ湡30澶╀箣鍓嶇殑鎵�鏈夌鍚堟潯浠剁殑绛炬敹鍗�(isAfterDate涓簍rue鐨勬椂鍊�)
     global NFM116Batch(Date testDate, Boolean isAfterDate) {
-        this.setDate = testDate;
-        this.isAppoint = true;
-        this.isAfterDate = isAfterDate;
+        if(isAfterDate){
+            isAppoint = true;
+            isSpecifyDate = true;
+            String beforepointday = testDate.addDays(-30).format().replace('/', '-');
+            String pointday = testDate.format().replace('/', '-');
+            this.setDate = beforepointday + 'T00:00:00.000+0000';
+            this.endDate = pointday + 'T00:00:00.000+0000';
+        }
     }
     // 鍙戦�佹寚瀹欼d鐨勭鏀跺崟
     global NFM116Batch(String setId) {
@@ -36,15 +51,16 @@
     }
 
     global Database.QueryLocator start(Database.BatchableContext bc) {
-        String query = 'select Id from eSignForm__c where (agencyAcceptSAPResult__c != null or HPAcceptSAPResult__c != null) ';
+        String query = 'select Id from eSignForm__c where (agencyAcceptSAPResult__c != null or HPAcceptSAPResult__c != null) and SAPReportDate__c != null ';
         if(String.isNotBlank(setId)){
             query += ' and Id =: setId ';
         } else if (setIdList != null && setIdList.size() > 0) {
             query += ' and Id IN: setIdList ';
         } else if(!isAppoint){
-            query += ' and SAPReportDate__c = ' + setDate.addDays(-1).format().replace('/', '-') ;
-        } else if(isAfterDate){
-            query += ' and SAPReportDate__c > ' + setDate.addDays(-30).format().replace('/', '-') ;
+            query += setDate;
+        } else if(isSpecifyDate){
+            query += ' and LastModifiedDate > ' + setDate;
+            query += ' and LastModifiedDate < ' + endDate;
         }
         System.debug('thhquery:' + query);
         return Database.getQueryLocator(query);

--
Gitblit v1.9.1