修复流量统计数据为查询到的问题.
This commit is contained in:
@@ -286,7 +286,7 @@ public class DateUtil {
|
||||
public static Date getHourBegin(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR), 0, 0, 0);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR_OF_DAY), 0, 0, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class DateUtil {
|
||||
public static Date getHourEnd(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR), 59, 59, 999);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR_OF_DAY), 59, 59, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +84,14 @@
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>${project.basedir}/src/main/resources</directory>-->
|
||||
<!-- <filtering>false</filtering>-->
|
||||
|
||||
<excludes>
|
||||
<exclude>app-*.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<!-- <excludes>-->
|
||||
<!-- <exclude>app-*.yml</exclude>-->
|
||||
<!-- </excludes>-->
|
||||
<!-- </resource>-->
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
+14
-1
@@ -33,6 +33,7 @@ import fun.asgc.neutrino.proxy.server.service.FlowReportService;
|
||||
import fun.asgc.solon.extend.job.IJobHandler;
|
||||
import fun.asgc.solon.extend.job.annotation.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class FlowReportForDayJob implements IJobHandler {
|
||||
@Override
|
||||
public void execute(String param) throws Exception {
|
||||
Date now = new Date();
|
||||
String dateStr = DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -1), "yyyy-MM-dd");
|
||||
String dateStr = getDateStr(now, param); // DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -1), "yyyy-MM-dd");
|
||||
Date date = DateUtil.parse(dateStr, "yyyy-MM-dd");
|
||||
Date startHourDate = DateUtil.getDayBegin(date);
|
||||
Date endHourDate = DateUtil.getDayEnd(date);
|
||||
@@ -99,4 +100,16 @@ public class FlowReportForDayJob implements IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String getDateStr(Date now, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
try {
|
||||
// 参数格式错误则取当前时间
|
||||
DateUtil.parse(params, "yyyy-MM-dd");
|
||||
return params;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -1), "yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
+15
-1
@@ -11,6 +11,7 @@ import fun.asgc.neutrino.proxy.server.service.FlowReportService;
|
||||
import fun.asgc.solon.extend.job.IJobHandler;
|
||||
import fun.asgc.solon.extend.job.annotation.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class FlowReportForHourJob implements IJobHandler {
|
||||
@Override
|
||||
public void execute(String param) throws Exception {
|
||||
Date now = new Date();
|
||||
String dateStr = DateUtil.format(DateUtil.addDate(now, Calendar.HOUR, -1), "yyyy-MM-dd HH");
|
||||
String dateStr = getDateStr(now, param); // DateUtil.format(DateUtil.addDate(now, Calendar.HOUR, -1), "yyyy-MM-dd HH");
|
||||
Date date = DateUtil.parse(dateStr, "yyyy-MM-dd HH");
|
||||
Date startHourDate = DateUtil.getHourBegin(date);
|
||||
Date endHourDate = DateUtil.getHourEnd(date);
|
||||
@@ -75,4 +76,17 @@ public class FlowReportForHourJob implements IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String getDateStr(Date now, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
try {
|
||||
// 参数格式错误则取当前时间
|
||||
DateUtil.parse(params, "yyyy-MM-dd HH");
|
||||
return params;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return DateUtil.format(DateUtil.addDate(now, Calendar.HOUR, -1), "yyyy-MM-dd HH");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+14
-1
@@ -9,6 +9,7 @@ import fun.asgc.neutrino.proxy.server.service.FlowReportService;
|
||||
import fun.asgc.solon.extend.job.IJobHandler;
|
||||
import fun.asgc.solon.extend.job.annotation.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class FlowReportForMonthJob implements IJobHandler {
|
||||
@Override
|
||||
public void execute(String param) throws Exception {
|
||||
Date now = new Date();
|
||||
String dateStr = DateUtil.format(DateUtil.addDate(now, Calendar.MONTH, -1), "yyyy-MM");
|
||||
String dateStr = getDateStr(now, param); // DateUtil.format(DateUtil.addDate(now, Calendar.MONTH, -1), "yyyy-MM");
|
||||
Date date = DateUtil.parse(dateStr, "yyyy-MM");
|
||||
Date startDayDate = DateUtil.getMonthBegin(date);
|
||||
Date endEndDate = DateUtil.getMonthEnd(date);
|
||||
@@ -77,4 +78,16 @@ public class FlowReportForMonthJob implements IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String getDateStr(Date now, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
try {
|
||||
// 参数格式错误则取当前时间
|
||||
DateUtil.parse(params, "yyyy-MM");
|
||||
return params;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return DateUtil.format(DateUtil.addDate(now, Calendar.MONTH, -1), "yyyy-MM");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user