This is an automated email from the ASF dual-hosted git repository.

jinyleechina pushed a commit to branch 2.0.7-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/2.0.7-prepare by this push:
     new 7db0ad56c1 fix complement data bug (#12162)
7db0ad56c1 is described below

commit 7db0ad56c1287d6703035539a7f453eadeec1824
Author: JinYong Li <[email protected]>
AuthorDate: Tue Sep 27 15:22:36 2022 +0800

    fix complement data bug (#12162)
    
    Co-authored-by: JinyLeeChina <[email protected]>
---
 .../common/utils/placeholder/BusinessTimeUtils.java            | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java
index 7c2d2318a8..f5bced3e91 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java
@@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.common.utils.placeholder;
 
 import org.apache.dolphinscheduler.common.Constants;
 import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.spi.utils.DateUtils;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -46,13 +47,11 @@ public class BusinessTimeUtils {
      * @return business time
      */
     public static Map<String, String> getBusinessTime(CommandType commandType, 
Date runTime) {
-        Date businessDate = runTime;
-        Map<String, String> result = new HashMap<>();
+        Date businessDate;
         switch (commandType) {
             case COMPLEMENT_DATA:
-                if (runTime == null) {
-                    return result;
-                }
+                businessDate = DateUtils.addDays(runTime, -1);
+                break;
             case START_PROCESS:
             case START_CURRENT_TASK_PROCESS:
             case RECOVER_TOLERANCE_FAULT_PROCESS:
@@ -71,6 +70,7 @@ public class BusinessTimeUtils {
                 break;
         }
         Date businessCurrentDate = addDays(businessDate, 1);
+        Map<String, String> result = new HashMap<>();
         result.put(Constants.PARAMETER_CURRENT_DATE, 
format(businessCurrentDate, PARAMETER_FORMAT_DATE));
         result.put(Constants.PARAMETER_BUSINESS_DATE, format(businessDate, 
PARAMETER_FORMAT_DATE));
         result.put(Constants.PARAMETER_DATETIME, format(businessCurrentDate, 
PARAMETER_FORMAT_TIME));

Reply via email to