|
|
|
@ -2,7 +2,6 @@ package com.ruoyi.database.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
@ -12,8 +11,10 @@ import com.ruoyi.common.utils.PageUtils;
|
|
|
|
|
import com.ruoyi.common.utils.StringKit;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.database.domain.MetaAlarmInfo;
|
|
|
|
|
import com.ruoyi.database.domain.MetaHandleAlarmInfo;
|
|
|
|
|
import com.ruoyi.database.domain.vo.alarmInfoVO;
|
|
|
|
|
import com.ruoyi.database.service.MetaAlarmInfoService;
|
|
|
|
|
import com.ruoyi.database.service.MetaHandleAlarmInfoService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@ -44,6 +45,8 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
private final MetaAlarmInfoService metaAlarmInfoService;
|
|
|
|
|
|
|
|
|
|
private final MetaHandleAlarmInfoService metaHandleAlarmInfoService;
|
|
|
|
|
|
|
|
|
|
@GetMapping
|
|
|
|
|
@ApiOperation("查询接警信息表")
|
|
|
|
|
public TableDataInfo<MetaAlarmInfo> list(MetaAlarmInfo metaAlarmInfo) {
|
|
|
|
@ -205,13 +208,11 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
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)
|
|
|
|
|
QueryWrapper.between("alarm_response_time", startDateString, endDateString)
|
|
|
|
|
.and(wrapper -> wrapper.like("alarm_response_unit", "射阳县公安局临海派出所")
|
|
|
|
|
.or()
|
|
|
|
|
.like("alarm_response_unit", "射阳县公安局临海派出所第一警务区")
|
|
|
|
@ -262,7 +263,6 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
try {
|
|
|
|
|
// 获取当前日期和时间
|
|
|
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
|
|
//获取当前小时数
|
|
|
|
|
int currentHour = currentDateTime.getHour();
|
|
|
|
|
//将分钟和秒数置为零,表示当前时间点的小时的开始
|
|
|
|
@ -290,7 +290,7 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("filterByType")
|
|
|
|
|
@GetMapping("/filterByType")
|
|
|
|
|
@ApiOperation("根据类型来分类,查询每种类型的数量,将每天的类型和数量的格式给前端")
|
|
|
|
|
public AjaxResult filterByType(MetaAlarmInfo metaAlarmInfo) {
|
|
|
|
|
try {
|
|
|
|
@ -357,6 +357,80 @@ public class MetaAlarmInfoController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/Resolve")
|
|
|
|
|
@ApiOperation("饼状图统计,关联接警表,按照接警类型统计其当天处警数量")
|
|
|
|
|
public AjaxResult ResolveNum(MetaAlarmInfo metaAlarmInfo) {
|
|
|
|
|
try {
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
Map<LocalDate, Map<String, Long>> dailyCountsMap = new TreeMap<>();
|
|
|
|
|
|
|
|
|
|
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> alarmInfoList = metaAlarmInfoService.list(queryWrapper);
|
|
|
|
|
List<String> alarmCodesList = alarmInfoList.stream()
|
|
|
|
|
.map(MetaAlarmInfo::getAlarmCode)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<MetaHandleAlarmInfo> alarmInfoList1 = metaHandleAlarmInfoService.list(new QueryWrapper<MetaHandleAlarmInfo>()
|
|
|
|
|
.in("alarm_code", alarmCodesList));
|
|
|
|
|
|
|
|
|
|
List<String> alarmCodesFromAlarmInfoList1 = alarmInfoList1.stream()
|
|
|
|
|
.map(MetaHandleAlarmInfo::getAlarmCode)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<MetaAlarmInfo> correspondingAlarmInfoList = metaAlarmInfoService.list(new QueryWrapper<MetaAlarmInfo>()
|
|
|
|
|
.in("alarm_code", alarmCodesFromAlarmInfoList1));
|
|
|
|
|
|
|
|
|
|
Map<String, Long> responseTypeCounts = correspondingAlarmInfoList.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(MetaAlarmInfo::getAlarmResponseTypeName, Collectors.counting()));
|
|
|
|
|
|
|
|
|
|
dailyCountsMap.put(date, responseTypeCounts);
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success(dailyCountsMap);
|
|
|
|
|
} catch (
|
|
|
|
|
Exception e) {
|
|
|
|
|
logger.info(StringKit.toString(e));
|
|
|
|
|
return AjaxResult.error("请求失败,看服务器报错没。");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
@ApiOperation("新增接警信息表")
|
|
|
|
|
@Log(title = "接警信息表", businessType = BusinessType.INSERT)
|
|
|
|
|