|
@@ -1,6 +1,5 @@
|
|
|
package com.usky.alarm.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.usky.alarm.domain.BaseAlarm;
|
|
@@ -67,21 +66,29 @@ public class BaseAlarmStatisticServiceImpl extends AbstractCrudService<BaseAlarm
|
|
|
@Override
|
|
|
public List<Map<String, Object>> alarmStatistic(Integer deptId,Integer dateType) {
|
|
|
LocalDateTime currentDate = LocalDateTime.now();
|
|
|
- LocalDateTime firstDayOfMonth = LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth());
|
|
|
+ LocalDateTime firstDayOfMonth = LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
|
|
|
LocalDateTime halfYearAgo = currentDate.minus(6, ChronoUnit.MONTHS);
|
|
|
- LocalDateTime firstDayOfHalfYearAgo = halfYearAgo.withDayOfMonth(1);
|
|
|
+ LocalDateTime firstDayOfHalfYearAgo = halfYearAgo.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0);
|
|
|
+ LocalDateTime oneYearAgo = currentDate.minusYears(1);
|
|
|
+ LocalDateTime zeroTime = oneYearAgo.withHour(0).withMinute(0).withSecond(0);
|
|
|
QueryWrapper<BaseAlarmStatistic> queryWrapper = Wrappers.query();
|
|
|
if (dateType.equals(1)){
|
|
|
queryWrapper.select("alarm_num as alarmNum","pitfall_num as pitfallNum","DATE_FORMAT(statistic_time, '%m-%d') AS " +
|
|
|
"statisticTime")
|
|
|
.between("statistic_time",firstDayOfMonth,currentDate)
|
|
|
.eq("statistic_dimen",1);
|
|
|
- }else {
|
|
|
+ }else if (dateType.equals(2)){
|
|
|
queryWrapper.select("alarm_num as alarmNum","pitfall_num as pitfallNum","DATE_FORMAT(statistic_time, " +
|
|
|
"'%Y-%m') AS " +
|
|
|
"statisticTime")
|
|
|
.between("statistic_time",firstDayOfHalfYearAgo,currentDate)
|
|
|
.eq("statistic_dimen",2);
|
|
|
+ }else {
|
|
|
+ queryWrapper.select("alarm_num as alarmNum","pitfall_num as pitfallNum","DATE_FORMAT(statistic_time, " +
|
|
|
+ "'%Y-%m') AS " +
|
|
|
+ "statisticTime")
|
|
|
+ .between("statistic_time",zeroTime,currentDate)
|
|
|
+ .eq("statistic_dimen",2);
|
|
|
}
|
|
|
List<Map<String, Object>> list = this.listMaps(queryWrapper);
|
|
|
return list;
|