develop
Angel 10 months ago
parent b58795da94
commit 5025947927

@ -1,25 +1,23 @@
package com.ruoyi.database.controller; package com.ruoyi.database.controller;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.PageUtils; import com.github.pagehelper.Page;
import com.ruoyi.common.utils.StringKit;
import com.ruoyi.database.domain.MetaAlarmInfo;
import com.ruoyi.database.domain.vo.alarmInfoVO;
import com.ruoyi.database.service.MetaAlarmInfoService;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringKit;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.database.domain.MetaAlarmInfo;
import com.ruoyi.database.domain.vo.alarmInfoVO;
import com.ruoyi.database.service.MetaAlarmInfoService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -29,7 +27,6 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
/** /**
@ -50,6 +47,7 @@ public class MetaAlarmInfoController extends BaseController {
@ApiOperation("查询接警信息表") @ApiOperation("查询接警信息表")
public TableDataInfo<MetaAlarmInfo> list(MetaAlarmInfo metaAlarmInfo) { public TableDataInfo<MetaAlarmInfo> list(MetaAlarmInfo metaAlarmInfo) {
startPage(); startPage();
// 获取当前日期
QueryWrapper<MetaAlarmInfo> wrapper = new QueryWrapper<>(metaAlarmInfo); QueryWrapper<MetaAlarmInfo> wrapper = new QueryWrapper<>(metaAlarmInfo);
wrapper.and(w -> w.like("alarm_response_unit", "射阳县公安局临海派出所").or() wrapper.and(w -> w.like("alarm_response_unit", "射阳县公安局临海派出所").or()
.like("alarm_response_unit", "射阳县公安局临海派出所第一警务区").or() .like("alarm_response_unit", "射阳县公安局临海派出所第一警务区").or()
@ -65,14 +63,16 @@ public class MetaAlarmInfoController extends BaseController {
.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", "射阳县公安局黄沙河边防派出所第三警务区")); .like("alarm_response_unit", "射阳县公安局黄沙河边防派出所第三警务区")
.or()
.like("alarm_response_unit", "射阳县公安局交通警察大队临海中队"));
List<MetaAlarmInfo> list = metaAlarmInfoService.list(wrapper); List<MetaAlarmInfo> list = metaAlarmInfoService.list(wrapper);
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/search") @GetMapping("/search")
@ApiOperation("根据条件查询接警信息") @ApiOperation("根据条件查询接警信息")
public AjaxResult searchAlarmInfo(alarmInfoVO alarmInfoVO) throws Exception { public AjaxResult searchAlarmInfo(alarmInfoVO alarmInfoVO) {
QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>();
@ -104,13 +104,13 @@ public class MetaAlarmInfoController extends BaseController {
@GetMapping("/time") @GetMapping("/time")
@ApiOperation("根据时间查询接警信息") @ApiOperation("根据时间查询接警信息")
public TableDataInfo<MetaAlarmInfo> timeList(MetaAlarmInfo metaAlarmInfo) throws Exception { public TableDataInfo<MetaAlarmInfo> timeList(MetaAlarmInfo metaAlarmInfo, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) throws Exception {
// startPage();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date parse = simpleDateFormat.parse(metaAlarmInfo.getInformantTime()); Date parse = simpleDateFormat.parse(metaAlarmInfo.getInformantTime());
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(parse); calendar.setTime(parse);
calendar.add(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.DAY_OF_MONTH, 1);
SimpleDateFormat outputSdf = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat outputSdf = new SimpleDateFormat("yyyyMMddHHmmss");
@ -118,10 +118,41 @@ public class MetaAlarmInfoController extends BaseController {
String format = outputSdf.format(parse); String format = outputSdf.format(parse);
QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.between("alarm_response_time", format, resultDateString); queryWrapper.between("informant_time", format, resultDateString);
queryWrapper.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", "射阳县公安局交通警察大队临海中队"));
int count = metaAlarmInfoService.count(queryWrapper); int count = metaAlarmInfoService.count(queryWrapper);
PageUtils.startPage(); PageUtils.startPage(pageNum, pageSize);
List<MetaAlarmInfo> list = metaAlarmInfoService.list(queryWrapper); List<MetaAlarmInfo> list = metaAlarmInfoService.list(queryWrapper);
List<MetaAlarmInfo> alarmInfos = new ArrayList<>(); List<MetaAlarmInfo> alarmInfos = new ArrayList<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -132,11 +163,14 @@ public class MetaAlarmInfoController extends BaseController {
metaAlarmInfo1.setInformantTime(format1); metaAlarmInfo1.setInformantTime(format1);
alarmInfos.add(metaAlarmInfo1); alarmInfos.add(metaAlarmInfo1);
} }
// 设置总数和返回数据
TableDataInfo dataTable = getDataTable(alarmInfos); TableDataInfo dataTable = getDataTable(alarmInfos);
dataTable.setTotal(count); dataTable.setTotal(count);
return dataTable; return dataTable;
} }
// dataTable.setTotal(((Page) list).getTotal());
// return dataTable;
// dataTable.setTotal(list.size()); // Set total manually without pagination
@GetMapping("/policeName") @GetMapping("/policeName")
@ApiOperation("查询") @ApiOperation("查询")
@ -176,7 +210,38 @@ public class MetaAlarmInfoController extends BaseController {
String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
QueryWrapper<MetaAlarmInfo> vehicleQueryWrapper = new QueryWrapper<>(metaAlarmInfo); QueryWrapper<MetaAlarmInfo> vehicleQueryWrapper = new QueryWrapper<>(metaAlarmInfo);
vehicleQueryWrapper.between("alarm_response_time", startDateString, endDateString); vehicleQueryWrapper.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", "射阳县公安局交通警察大队临海中队"));
// 查询当前日期的记录数据总数 // 查询当前日期的记录数据总数
long vehicleCount = metaAlarmInfoService.count(vehicleQueryWrapper); long vehicleCount = metaAlarmInfoService.count(vehicleQueryWrapper);
@ -209,7 +274,7 @@ public class MetaAlarmInfoController extends BaseController {
LocalDateTime startOfHour = startOfCurrentHour.minusHours(currentHour - i); LocalDateTime startOfHour = startOfCurrentHour.minusHours(currentHour - i);
LocalDateTime endOfHour = startOfHour.plusHours(1); LocalDateTime endOfHour = startOfHour.plusHours(1);
QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>(metaAlarmInfo); QueryWrapper<MetaAlarmInfo> queryWrapper = new QueryWrapper<>(metaAlarmInfo);
queryWrapper.between("alarm_response_time", startOfHour.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")), queryWrapper.between("informant_time", startOfHour.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")),
endOfHour.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); endOfHour.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
//查询当前小时的记录数据总数 //查询当前小时的记录数据总数
long HourCount = metaAlarmInfoService.count(queryWrapper); long HourCount = metaAlarmInfoService.count(queryWrapper);

@ -87,6 +87,7 @@ public interface MetaAlarmInfoMapper extends BaseMapper<MetaAlarmInfo> {
" alarm_response_unit LIKE '射阳县公安局扁担港边防派出所第一警务区' OR " + " alarm_response_unit LIKE '射阳县公安局扁担港边防派出所第一警务区' OR " +
" alarm_response_unit LIKE '射阳县公安局黄沙河边防派出所' OR " + " alarm_response_unit LIKE '射阳县公安局黄沙河边防派出所' OR " +
" alarm_response_unit LIKE '射阳县公安局黄沙河边防派出所第一警务区' OR " + " alarm_response_unit LIKE '射阳县公安局黄沙河边防派出所第一警务区' OR " +
"alarm_response_unit LIKE '射阳县公安局交通警察大队临海中队' OR " +
" alarm_response_unit LIKE '射阳县公安局黄沙河边防派出所第三警务区' " + " alarm_response_unit LIKE '射阳县公安局黄沙河边防派出所第三警务区' " +
") " + ") " +
" AND DATE(informant_time) = CURDATE() " + " AND DATE(informant_time) = CURDATE() " +

Loading…
Cancel
Save