|
|
|
@ -28,6 +28,7 @@ import java.time.LocalDateTime;
|
|
|
|
|
import java.time.LocalTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 接警信息表(MetaAlarmInfo)Controller
|
|
|
|
@ -209,8 +210,8 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
String startDateString = startDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
|
|
String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
|
|
|
|
|
|
|
QueryWrapper<MetaAlarmInfo> vehicleQueryWrapper = new QueryWrapper<>(metaAlarmInfo);
|
|
|
|
|
vehicleQueryWrapper.between("informant_time", startDateString, endDateString)
|
|
|
|
|
QueryWrapper<MetaAlarmInfo> QueryWrapper = new QueryWrapper<>(metaAlarmInfo);
|
|
|
|
|
QueryWrapper.between("informant_time", startDateString, endDateString)
|
|
|
|
|
.and(wrapper -> wrapper.like("alarm_response_unit", "射阳县公安局临海派出所")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临海派出所第一警务区")
|
|
|
|
@ -244,7 +245,7 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局交通警察大队临海中队"));
|
|
|
|
|
|
|
|
|
|
// 查询当前日期的记录数据总数
|
|
|
|
|
long vehicleCount = metaAlarmInfoService.count(vehicleQueryWrapper);
|
|
|
|
|
long vehicleCount = metaAlarmInfoService.count(QueryWrapper);
|
|
|
|
|
// 存储结果到 TreeMap 中
|
|
|
|
|
dailyCountsMap.put(date, vehicleCount);
|
|
|
|
|
}
|
|
|
|
@ -289,11 +290,72 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @PostMapping("/unit")
|
|
|
|
|
// @ApiOperation("根据单位查")
|
|
|
|
|
// public AjaxResult selectUnit(){
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
@GetMapping("filterByType")
|
|
|
|
|
@ApiOperation("根据类型来分类,查询每种类型的数量,将每天的类型和数量的格式给前端")
|
|
|
|
|
public AjaxResult filterByType(MetaAlarmInfo metaAlarmInfo) {
|
|
|
|
|
try {
|
|
|
|
|
// 获取当前日期
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
// 创建一个 TreeMap 用于存储每天的数据量
|
|
|
|
|
Map<LocalDate, Map<String, Long>> dailyCountsMap = new TreeMap<>();
|
|
|
|
|
// 循环迭代前7天
|
|
|
|
|
for (int i = 0; i < 7; i++) {
|
|
|
|
|
LocalDate date = currentDate.minusDays(i);
|
|
|
|
|
LocalDateTime startDateTime = date.atStartOfDay();
|
|
|
|
|
LocalDateTime endDateTime = date.atTime(LocalTime.MAX);
|
|
|
|
|
|
|
|
|
|
// 构造查询条件
|
|
|
|
|
String startDateString = startDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
|
|
String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
|
|
|
|
|
|
|
QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>(metaAlarmInfo);
|
|
|
|
|
queryWrapper.between("informant_time", startDateString, endDateString)
|
|
|
|
|
.and(wrapper -> wrapper.like("alarm_response_unit", "射阳县公安局临海派出所")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临海派出所第一警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临海派出所第二警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临海派出所第三警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临海派出所第四警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临港派出所")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临港派出所社区警务责任区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临港派出所第一警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临港派出所第二警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临港派出所第一警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局扁担港边防派出所")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局扁担港边防派出所第一警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局黄沙河边防派出所")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局黄沙河边防派出所第一警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局黄沙河边防派出所第三警务区")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局交通警察大队临海中队"));
|
|
|
|
|
List<MetaAlarmInfo> list = metaAlarmInfoService.list(queryWrapper);
|
|
|
|
|
|
|
|
|
|
Map<String, Long> typeCountsMap = list.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(MetaAlarmInfo::getAlarmResponseTypeName, Collectors.counting()));
|
|
|
|
|
|
|
|
|
|
// 存储结果到 TreeMap 中
|
|
|
|
|
dailyCountsMap.put(date, typeCountsMap);
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success(dailyCountsMap);
|
|
|
|
|
} catch (
|
|
|
|
|
Exception e) {
|
|
|
|
|
logger.info(StringKit.toString(e));
|
|
|
|
|
return AjaxResult.error("请求失败,请联系管理员");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
@ApiOperation("新增接警信息表")
|
|
|
|
|