Commit cfe0acba authored by 赵啸非's avatar 赵啸非

添加首页统计模块 统计近一周

parent 811e808f
package com.mortals.xhx.daemon.task;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -40,10 +42,19 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
@Override
public void excuteTask(ITask task) throws AppException {
log.info("站点评价统计任务");
//统计最近一周
int year = DateUtil.date().year();
for (int i = 1; i < 7; i++) {
DateTime beforeDate = DateUtil.offsetDay(new Date(), -i);
int year = beforeDate.year();
int month = beforeDate.month() + 1;
int day = beforeDate.dayOfMonth();
/* int year = DateUtil.date().year();
int month = DateUtil.date().month() + 1;
int day = DateUtil.date().dayOfMonth();
int day = DateUtil.date().dayOfMonth();*/
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
......@@ -79,7 +90,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
});
}
}
}
......@@ -95,7 +106,11 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
int month = DateUtil.date().month() + 1;
int day = DateUtil.date().dayOfMonth();
System.out.println(year + "年" + month + "月" + day + "日");
// System.out.println(year + "年" + month + "月" + day + "日");
System.out.println(DateUtil.offsetDay(new Date(), -0).toString("yyyy-MM-dd"));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment