DDDDD---jjtyp

develop
Angel 10 months ago
parent ccffb1cf1c
commit 0e3ac45849

@ -757,11 +757,10 @@ public class BigScreenController extends BaseController {
@ApiOperation("警车数据") @ApiOperation("警车数据")
public AjaxResult policeVehicleList() { public AjaxResult policeVehicleList() {
try { try {
// QueryWrapper<DevopsVideoInfo> queryWrapper = new QueryWrapper<>();
// queryWrapper.like("devops_video_info.device_name", "苏J")
// .eq("devops_video_status.is_online", 1);
List<DevopsVideoInfoVo> videoInfos = videoInfoService.listPoliceVehicle(new DevopsVideoInfo()); List<DevopsVideoInfoVo> videoInfos = videoInfoService.listPoliceVehicle(new DevopsVideoInfo());
return AjaxResult.success(videoInfos); return AjaxResult.success(videoInfos);
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.toString(e)); logger.info(StringKit.toString(e));

@ -90,11 +90,6 @@ public class PoachingController extends BaseController {
ffslaMap.put("value", ffslaCount + ffslbsCount); ffslaMap.put("value", ffslaCount + ffslbsCount);
ffslaMap.put("percentage", ffslaPerceStr); ffslaMap.put("percentage", ffslaPerceStr);
bean.setFfsla(ffslaMap); bean.setFfsla(ffslaMap);
// Map ffslbsMap = new HashMap();
// ffslbsMap.put("name", "非法猎捕杀害珍贵、濒危野生动物案");
// ffslbsMap.put("value", ffslbsCount);
// ffslbsMap.put("percentage", ffslbsPerceStr);
// bean.setFfslbs(ffslbsMap);
return AjaxResult.success(bean); return AjaxResult.success(bean);
} catch (Exception e) { } catch (Exception e) {

@ -28,6 +28,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* (MetaAlarmInfo)Controller * (MetaAlarmInfo)Controller
@ -209,8 +210,8 @@ public class MetaAlarmInfoController extends BaseController {
String startDateString = startDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); String startDateString = startDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
QueryWrapper<MetaAlarmInfo> vehicleQueryWrapper = new QueryWrapper<>(metaAlarmInfo); QueryWrapper<MetaAlarmInfo> QueryWrapper = new QueryWrapper<>(metaAlarmInfo);
vehicleQueryWrapper.between("informant_time", startDateString, endDateString) QueryWrapper.between("informant_time", startDateString, endDateString)
.and(wrapper -> wrapper.like("alarm_response_unit", "射阳县公安局临海派出所") .and(wrapper -> wrapper.like("alarm_response_unit", "射阳县公安局临海派出所")
.or() .or()
.like("alarm_response_unit", "射阳县公安局临海派出所第一警务区") .like("alarm_response_unit", "射阳县公安局临海派出所第一警务区")
@ -244,7 +245,7 @@ public class MetaAlarmInfoController extends BaseController {
.like("alarm_response_unit", "射阳县公安局交通警察大队临海中队")); .like("alarm_response_unit", "射阳县公安局交通警察大队临海中队"));
// 查询当前日期的记录数据总数 // 查询当前日期的记录数据总数
long vehicleCount = metaAlarmInfoService.count(vehicleQueryWrapper); long vehicleCount = metaAlarmInfoService.count(QueryWrapper);
// 存储结果到 TreeMap 中 // 存储结果到 TreeMap 中
dailyCountsMap.put(date, vehicleCount); dailyCountsMap.put(date, vehicleCount);
} }
@ -289,11 +290,72 @@ public class MetaAlarmInfoController extends BaseController {
} }
} }
// @PostMapping("/unit") @GetMapping("filterByType")
// @ApiOperation("根据单位查") @ApiOperation("根据类型来分类,查询每种类型的数量,将每天的类型和数量的格式给前端")
// public AjaxResult selectUnit(){ 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 @PostMapping
@ApiOperation("新增接警信息表") @ApiOperation("新增接警信息表")

@ -17,10 +17,16 @@ import java.util.List;
@Mapper @Mapper
public interface DevopsVideoInfoMapper extends BaseMapper<DevopsVideoInfo> { public interface DevopsVideoInfoMapper extends BaseMapper<DevopsVideoInfo> {
@Select(" select " +
" *, " +
" CONCAT('苏',SUBSTRING_INDEX(SUBSTRING_INDEX(device_name, '苏', -1), ' ', 1) ) AS plate_no " +
" from devops_video_info where device_name like '%苏J%' ")
public List<DevopsVideoInfoVo> listPoliceVehicle(DevopsVideoInfo bean) ;
// @Select(" select " +
// " *, " +
// " CONCAT('苏',SUBSTRING_INDEX(SUBSTRING_INDEX(device_name, '苏', -1), ' ', 1) ) AS plate_no " +
// " from devops_video_info where device_name like '%苏J%' ")
// public List<DevopsVideoInfoVo> listPoliceVehicle(DevopsVideoInfo bean) ;
@Select("SELECT devops_video_info.*, " +
"CONCAT('苏', SUBSTRING_INDEX(SUBSTRING_INDEX(devops_video_info.device_name, '苏', -1), ' ', 1)) AS plate_no " +
"FROM devops_video_info " +
"JOIN devops_video_status ON devops_video_info.gbs_channel_no = devops_video_status.gbs_channel_no " +
"WHERE devops_video_info.device_name LIKE '%苏J%' AND devops_video_status.is_online = 1")
public List<DevopsVideoInfoVo> listPoliceVehicle(DevopsVideoInfo bean) ;
} }

Loading…
Cancel
Save