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/LogAutoSendSchedule.cls |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/force-app/main/default/classes/LogAutoSendSchedule.cls b/force-app/main/default/classes/LogAutoSendSchedule.cls
index 2a9e3be..567d608 100644
--- a/force-app/main/default/classes/LogAutoSendSchedule.cls
+++ b/force-app/main/default/classes/LogAutoSendSchedule.cls
@@ -1,9 +1,44 @@
 global class LogAutoSendSchedule implements Schedulable {
+    // 20230131 ljh start
+    // public static String logId;
+    // public static String messageGroupNumber;
+    // public static String type;
+ 
+    global final String logId;
+    global final String messageGroupNumber;
+    global final String type;
 
+    global LogAutoSendSchedule() {
+        this.logId = null;
+        this.messageGroupNumber = null;
+        this.type = null;
+    }
+    global LogAutoSendSchedule(String logId) {
+        this.logId = logId;
+    }
+    global LogAutoSendSchedule(String messageGroupNumber,String type) {
+        this.messageGroupNumber = messageGroupNumber;
+        this.type = type;
+    }
+    // 20230131 ljh end
     global void execute(SchedulableContext SC) {
-        Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 1);
+        System.debug('+++++logId+++++' + logId + '+++++messageGroupNumber+++++' + messageGroupNumber + '+++++type+++++' + type);
+
+        if(String.isNotEmpty(logId)){
+            Id execBTId = Database.executeBatch(new LogAutoSendBatch(logId), 1);
+        }
+        // 2023-01-19   zyh   add start
+        else if (String.isNotEmpty(messageGroupNumber) && String.isNotEmpty(type)) {
+            Id execBTId = Database.executeBatch(new LogAutoSendBatch(type , messageGroupNumber), 1);
+        }
+        // 2023-01-19   zyh   add end
+        else{
+
+            Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 1);
+        }
     }
 
+    
     public static void assignOneMinute() {
         // delete 瀹熻娓堛伩
         Datetime addOneM = System.now().addMinutes(2);
@@ -17,4 +52,25 @@
             System.abortJob(ct.id);
         }
     }
+    /**
+     * @fuction   [鍙戞帴鍙i敊璇殑鏃堕噸鍙戝彧鍙戦�佽嚜宸辫繖涓�鏉★紝閫氳繃messageGroupNumber鍜宼ype纭鍞竴涓�鏉
+     * @Author    lijinhuan
+     * @DateTime  2023-01-31T15:21:25+0800
+     */
+    public static void assignOneMinute(String messageGroupNumber,String type) {
+        // delete 瀹熻娓堛伩
+        Datetime addOneM = System.now().addMinutes(2);
+        String CRON_EXP = '0 ' + addOneM.minute() + ' ' + addOneM.hour() + ' ' + addOneM.day() + ' ' + addOneM.month() + ' ? ' + addOneM.year();
+        List<CronTrigger> oldcron = [select Id from CronTrigger where CronExpression = :CRON_EXP and CronJobDetail.Name like 'LogAutoSend%'];
+        // if (oldcron.size() == 0) {
+            Datetime nowTime = Datetime.now();
+            // System.schedule(+'LogAutoSend'+ CRON_EXP, CRON_EXP, new LogAutoSendSchedule( messageGroupNumber, type));
+            System.schedule(+'LogAutoSend'+nowTime+'And'+messageGroupNumber + CRON_EXP, CRON_EXP, new LogAutoSendSchedule( messageGroupNumber, type));
+        
+        // }
+        for (CronTrigger ct :
+                [SELECT Id FROM CronTrigger WHERE State = 'DELETED' and CronJobDetail.Name like 'LogAutoSend%']) {
+            System.abortJob(ct.id);
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1