未验证 提交 de76f810 编写于 作者: M Molin Wang 提交者: GitHub

[Bugfix-12603] Dependency conditions for the last 24 hours of the dependent...

[Bugfix-12603] Dependency conditions for the last 24 hours of the dependent task did not take effect (#12862)
上级 ddfdc5dc
...@@ -84,7 +84,7 @@ public class DependentUtils { ...@@ -84,7 +84,7 @@ public class DependentUtils {
result = DependentDateUtils.getLastHoursInterval(businessDate, 3); result = DependentDateUtils.getLastHoursInterval(businessDate, 3);
break; break;
case "last24Hours": case "last24Hours":
result = DependentDateUtils.getSpecialLastDayInterval(businessDate); result = DependentDateUtils.getLastHoursInterval(businessDate, 24);
break; break;
case "today": case "today":
result = DependentDateUtils.getTodayInterval(businessDate); result = DependentDateUtils.getTodayInterval(businessDate);
......
...@@ -360,13 +360,13 @@ public class DependentUtilsTest { ...@@ -360,13 +360,13 @@ public class DependentUtilsTest {
@Test @Test
public void testGetLast24Hour() { public void testGetLast24Hour() {
Date curDay = DateUtils.stringToDate("2020-05-15 12:10:00"); Date curDay = DateUtils.stringToDate("2020-05-15 02:10:00");
String dateValue = "last24Hours"; String dateValue = "last24Hours";
List<DateInterval> dateIntervals = DependentUtils.getDateIntervalList(curDay, dateValue); List<DateInterval> dateIntervals = DependentUtils.getDateIntervalList(curDay, dateValue);
List<DateInterval> expect = Lists.newArrayList(); List<DateInterval> expect = Lists.newArrayList();
for (int a = 1; a < 24; a++) { for (int a = 2; a < 24; a++) {
String i = a + ""; String i = a + "";
if (a < 10) { if (a < 10) {
i = "0" + i; i = "0" + i;
...@@ -374,8 +374,8 @@ public class DependentUtilsTest { ...@@ -374,8 +374,8 @@ public class DependentUtilsTest {
DateInterval dateInterval = new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-14 " + i + ":00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-14 " + i + ":59:59"))); DateInterval dateInterval = new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-14 " + i + ":00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-14 " + i + ":59:59")));
expect.add(dateInterval); expect.add(dateInterval);
} }
DateInterval dateInterval = new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-15 00:00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-15 00:59:59"))); expect.add(new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-15 00:00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-15 00:59:59"))));
expect.add(dateInterval); expect.add(new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-15 01:00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-15 01:59:59"))));
Assert.assertEquals(24, dateIntervals.size()); Assert.assertEquals(24, dateIntervals.size());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册