修改监测数据时间统计维度
This commit is contained in:
+6
-4
@@ -1390,18 +1390,20 @@ public class WatchDataServiceImpl extends ServiceImpl<WatchDataMapper, WatchData
|
||||
|
||||
private Date dateByType(String type,boolean isEnd){
|
||||
Date date;
|
||||
Date now = new Date();
|
||||
// PS : 之前的业务中是按自然周 ,自然月,自然年统计查询 ,20251217新疆项目改为近一周,近一月,近一年
|
||||
switch (type){
|
||||
case "week":
|
||||
date = isEnd? DateUtil.endOfWeek(new Date()).offset(DateField.MILLISECOND,-999) : DateUtil.beginOfWeek(new Date());
|
||||
date = isEnd? now : DateUtil.beginOfDay(DateUtil.offsetWeek(now,-1));
|
||||
break;
|
||||
case "month":
|
||||
date = isEnd? DateUtil.endOfMonth(new Date()).offset(DateField.MILLISECOND,-999) : DateUtil.beginOfMonth(new Date());
|
||||
date = isEnd? now : DateUtil.beginOfDay(DateUtil.offsetMonth(now,-1));
|
||||
break;
|
||||
case "year":
|
||||
date = isEnd? DateUtil.endOfYear(new Date()).offset(DateField.MILLISECOND,-999) : DateUtil.beginOfYear(new Date());
|
||||
date = isEnd? now : DateUtil.beginOfDay(DateUtil.offset(now,DateField.YEAR,-1));
|
||||
break;
|
||||
default:
|
||||
date = isEnd? DateUtil.endOfDay(new Date()).offset(DateField.MILLISECOND,-999) : DateUtil.beginOfDay(new Date());
|
||||
date = isEnd? now : DateUtil.beginOfDay(new Date());
|
||||
break;
|
||||
}
|
||||
return date;
|
||||
|
||||
Reference in New Issue
Block a user