You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2022/10/19 03:46:10 UTC
[dolphinscheduler] branch 3.1.1-prepare updated: [Fix][Task] Fix dependent task can not predicate the status of the corresponding task correctly (#12253)
This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch 3.1.1-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/3.1.1-prepare by this push:
new 3a14fd07b3 [Fix][Task] Fix dependent task can not predicate the status of the corresponding task correctly (#12253)
3a14fd07b3 is described below
commit 3a14fd07b3088a0d6e0f3d63c1b68c37f247b1ea
Author: insist777 <84...@users.noreply.github.com>
AuthorDate: Wed Oct 19 10:47:08 2022 +0800
[Fix][Task] Fix dependent task can not predicate the status of the corresponding task correctly (#12253)
* [Fix][Task] dependent task can not predicate the status of the corresponding task correctly
---
.../plugin/task/api/utils/DependentDateUtils.java | 9 +++++----
.../dolphinscheduler/plugin/task/api/utils/DependentUtils.java | 10 ++++++++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentDateUtils.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentDateUtils.java
index a1ca404161..abecf94a34 100644
--- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentDateUtils.java
+++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentDateUtils.java
@@ -128,16 +128,17 @@ public class DependentDateUtils {
}
/**
- * get interval on first/last day of the last month
+ * get interval on first/last day of the needed month
* @param businessDate businessDate
* @param isBeginDay isBeginDay
* @return DateInterval list
*/
- public static List<DateInterval> getLastMonthBeginInterval(Date businessDate,
- boolean isBeginDay) {
+ public static List<DateInterval> getNeededMonthBeginInterval(Date businessDate,
+ boolean isBeginDay,
+ int neededMonth) {
Date firstDayThisMonth = DateUtils.getFirstDayOfMonth(businessDate);
- Date lastDay = DateUtils.getSomeDay(firstDayThisMonth, -1);
+ Date lastDay = DateUtils.getSomeDay(firstDayThisMonth, neededMonth);
Date firstDay = DateUtils.getFirstDayOfMonth(lastDay);
if (isBeginDay) {
return getDateIntervalListBetweenTwoDates(firstDay, firstDay);
diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentUtils.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentUtils.java
index b79e8b4830..3a34634752 100644
--- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentUtils.java
+++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/DependentUtils.java
@@ -130,14 +130,20 @@ public class DependentUtils {
case "thisMonth":
result = DependentDateUtils.getThisMonthInterval(businessDate);
break;
+ case "thisMonthBegin":
+ result = DependentDateUtils.getNeededMonthBeginInterval(businessDate, true, 0);
+ break;
+ case "thisMonthEnd":
+ result = DependentDateUtils.getNeededMonthBeginInterval(businessDate, false, 0);
+ break;
case "lastMonth":
result = DependentDateUtils.getLastMonthInterval(businessDate);
break;
case "lastMonthBegin":
- result = DependentDateUtils.getLastMonthBeginInterval(businessDate, true);
+ result = DependentDateUtils.getNeededMonthBeginInterval(businessDate, true, -1);
break;
case "lastMonthEnd":
- result = DependentDateUtils.getLastMonthBeginInterval(businessDate, false);
+ result = DependentDateUtils.getNeededMonthBeginInterval(businessDate, false, -1);
break;
default:
break;