人脸,车辆抓拍时间接口修改

develop
hanrenchun 10 months ago
parent 07c2a8aa68
commit 985d1013b6

@ -21,6 +21,8 @@ import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -295,13 +297,35 @@ public class BigScreenController extends BaseController {
try { try {
List<MetaAlarmInfoAndHandleAlarmVo> metaAlarmInfos = alarmInfoService.listAlarmAndHandleAlarm(); List<MetaAlarmInfoAndHandleAlarmVo> metaAlarmInfos = alarmInfoService.listAlarmAndHandleAlarm();
return AjaxResult.success(metaAlarmInfos); ArrayList<MetaAlarmInfoAndHandleAlarmVo> alarmVos = new ArrayList<>();
for (MetaAlarmInfoAndHandleAlarmVo metaAlarmInfoAndHandleAlarmVo : metaAlarmInfos){
SimpleDateFormat outputSdf = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (metaAlarmInfoAndHandleAlarmVo.getCjxxHandleAlarmTime()!=null) {
String cjxxHandleAlarmTime = metaAlarmInfoAndHandleAlarmVo.getCjxxHandleAlarmTime();
Date cjxxHandleAlarm = outputSdf.parse(cjxxHandleAlarmTime);
metaAlarmInfoAndHandleAlarmVo.setCjxxHandleAlarmTime(dateFormat.format(cjxxHandleAlarm));
}
if (metaAlarmInfoAndHandleAlarmVo.getJjxxInformantTime()!=null) {
String jjxxInformantTime = metaAlarmInfoAndHandleAlarmVo.getJjxxInformantTime();
Date jjxxInformant = outputSdf.parse(jjxxInformantTime);
metaAlarmInfoAndHandleAlarmVo.setJjxxInformantTime(dateFormat.format(jjxxInformant));
}
if (metaAlarmInfoAndHandleAlarmVo.getJjxxAlarmResponseTime()!=null) {
String jjxxAlarmResponseTime = metaAlarmInfoAndHandleAlarmVo.getJjxxAlarmResponseTime();
Date jjxxAlarmResponse = outputSdf.parse(jjxxAlarmResponseTime);
metaAlarmInfoAndHandleAlarmVo.setJjxxAlarmResponseTime(dateFormat.format(jjxxAlarmResponse));
}
alarmVos.add(metaAlarmInfoAndHandleAlarmVo);
}
return AjaxResult.success(alarmVos);
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.toString(e)); logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员"); return AjaxResult.error("请求失败,请联系管理员");
} }
} }
@PostMapping("/realTimeAlarmSituation") @PostMapping("/realTimeAlarmSituation")
@ApiOperation("实时警情") @ApiOperation("实时警情")
public AjaxResult realTimeAlarmSituation(@ApiParam("时间") @RequestParam String time) { public AjaxResult realTimeAlarmSituation(@ApiParam("时间") @RequestParam String time) {

@ -116,6 +116,10 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("人流量统计前7天(全数)") @ApiOperation("人流量统计前7天(全数)")
public AjaxResult allHumanTrafficStatistics(TransitUserRecord transitUserRecord) { public AjaxResult allHumanTrafficStatistics(TransitUserRecord transitUserRecord) {
try { try {
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getParentMonitoringType, 1)
.eq(DevopsDeviceInfo::getDeviceType,1).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
// 获取当前日期 // 获取当前日期
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
// 创建一个 TreeMap 用于存储每天的数据量 // 创建一个 TreeMap 用于存储每天的数据量
@ -124,25 +128,22 @@ public class PerceptionDeviceController extends BaseController {
for (int i = 1; i <= 7; i++) { for (int i = 1; i <= 7; i++) {
LocalDate date = currentDate.minusDays(i); LocalDate date = currentDate.minusDays(i);
// 构造查询条件 // 构造查询条件
QueryWrapper<DevopsDeviceInfo> deviceInfoQueryWrapper = new QueryWrapper<>(); QueryWrapper<TransitUserRecord> userRecordQueryWrapper = new QueryWrapper<>();
deviceInfoQueryWrapper.eq("parent_monitoring_type", 1); userRecordQueryWrapper.in("device_code",collect);
List<DevopsDeviceInfo> list = devopsDeviceInfoService.list(deviceInfoQueryWrapper); userRecordQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long totalUserCount = transitUserRecordService.count(userRecordQueryWrapper);
long totalUserCount = 0;
for (DevopsDeviceInfo info : list) {
String channelNo = info.getGbsChannelNo();
QueryWrapper<TransitUserRecord> userQueryWrapper = new QueryWrapper<>(transitUserRecord);
userQueryWrapper.eq("device_code", channelNo)
.between("partition_field", date, date.plusDays(1));
long userCount = transitUserRecordService.count(userQueryWrapper);
// 累加到总数据量
totalUserCount += userCount;
}
dailyCountsMap.put(date, totalUserCount); dailyCountsMap.put(date, totalUserCount);
} }
return AjaxResult.success(dailyCountsMap); Optional<Map.Entry<LocalDate, Long>> max = dailyCountsMap.entrySet()
.stream()
.max(Comparator.comparing(Map.Entry::getValue));
Map.Entry<LocalDate, Long> localDateLongEntry = max.get();
Long value = localDateLongEntry.getValue();
value = value + value/4;
Map<Long, Map<LocalDate, Long>> map = new HashMap<>();
map.put(value,dailyCountsMap);
return AjaxResult.success(map);
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.toString(e)); logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员"); return AjaxResult.error("请求失败,请联系管理员");
@ -152,6 +153,10 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("车流量统计前7天(全数)") @ApiOperation("车流量统计前7天(全数)")
public AjaxResult allVehicleTrafficStatistics(TransitVehicleRecord transitVehicleRecord) { public AjaxResult allVehicleTrafficStatistics(TransitVehicleRecord transitVehicleRecord) {
try { try {
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getParentMonitoringType, 1)
.eq(DevopsDeviceInfo::getDeviceType,2).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
// 获取当前日期 // 获取当前日期
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
// 创建一个 TreeMap 用于存储每天的数据量 // 创建一个 TreeMap 用于存储每天的数据量
@ -160,35 +165,38 @@ public class PerceptionDeviceController extends BaseController {
for (int i = 1; i <= 7; i++) { for (int i = 1; i <= 7; i++) {
LocalDate date = currentDate.minusDays(i); LocalDate date = currentDate.minusDays(i);
// 构造查询条件 // 构造查询条件
QueryWrapper<DevopsDeviceInfo> deviceInfoQueryWrapper = new QueryWrapper<>(); QueryWrapper<TransitVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>();
deviceInfoQueryWrapper.eq("parent_monitoring_type", 1); vehicleQueryWrapper.in("doorway_code",collect);
List<DevopsDeviceInfo> list = devopsDeviceInfoService.list(deviceInfoQueryWrapper); vehicleQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long totalUserCount = 0; long vehicleCount = transitVehicleRecordService.count(vehicleQueryWrapper);
dailyCountsMap.put(date, vehicleCount);
for (DevopsDeviceInfo info:list) {
String channelNo = info.getGbsChannelNo();
QueryWrapper<TransitVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>(transitVehicleRecord);
vehicleQueryWrapper.eq("doorway_code",channelNo)
.between("partition_field", date, date.plusDays(1));
long userCount = transitVehicleRecordService.count(vehicleQueryWrapper);
totalUserCount += userCount;
}
dailyCountsMap.put(date, totalUserCount);
} }
Optional<Map.Entry<LocalDate, Long>> max = dailyCountsMap.entrySet()
return AjaxResult.success(dailyCountsMap); .stream()
.max(Comparator.comparing(Map.Entry::getValue));
Map.Entry<LocalDate, Long> localDateLongEntry = max.get();
Long value = localDateLongEntry.getValue();
value = value + value/4;
Map<Long, Map<LocalDate, Long>> map = new HashMap<>();
map.put(value,dailyCountsMap);
return AjaxResult.success(map);
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.toString(e)); logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员"); return AjaxResult.error("请求失败,请联系管理员");
} }
} }
@PostMapping("/vehicleTrafficStatistics") @PostMapping("/vehicleTrafficStatistics")
@ApiOperation("车流量统计前7天(重点人员)") @ApiOperation("车流量统计前7天(重点人员)")
public AjaxResult vehicleTrafficStatistics() { public AjaxResult vehicleTrafficStatistics() {
try { try {
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list(); List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getParentMonitoringType, 1)
.eq(DevopsDeviceInfo::getDeviceType,2).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList()); List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
// 获取当前日期 // 获取当前日期
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
@ -206,8 +214,16 @@ public class PerceptionDeviceController extends BaseController {
// 存储结果到 TreeMap 中 // 存储结果到 TreeMap 中
dailyCountsMap.put(date, vehicleCount); dailyCountsMap.put(date, vehicleCount);
} }
Optional<Map.Entry<LocalDate, Long>> max = dailyCountsMap.entrySet()
.stream()
.max(Comparator.comparing(Map.Entry::getValue));
Map.Entry<LocalDate, Long> localDateLongEntry = max.get();
Long value = localDateLongEntry.getValue();
value = value + value/4;
Map<Long, Map<LocalDate, Long>> map = new HashMap<>();
map.put(value,dailyCountsMap);
return AjaxResult.success(map);
return AjaxResult.success(dailyCountsMap);
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.toString(e)); logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员"); return AjaxResult.error("请求失败,请联系管理员");
@ -218,7 +234,9 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("人流量统计前7天(重点人员)") @ApiOperation("人流量统计前7天(重点人员)")
public AjaxResult humanTrafficStatistics() { public AjaxResult humanTrafficStatistics() {
try { try {
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list(); List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getParentMonitoringType, 1)
.eq(DevopsDeviceInfo::getDeviceType,1).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList()); List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
// 获取当前日期 // 获取当前日期
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
@ -236,8 +254,15 @@ public class PerceptionDeviceController extends BaseController {
// 存储结果到 TreeMap 中 // 存储结果到 TreeMap 中
dailyCountsMap.put(date, userCount); dailyCountsMap.put(date, userCount);
} }
Optional<Map.Entry<LocalDate, Long>> max = dailyCountsMap.entrySet()
return AjaxResult.success(dailyCountsMap); .stream()
.max(Comparator.comparing(Map.Entry::getValue));
Map.Entry<LocalDate, Long> localDateLongEntry = max.get();
Long value = localDateLongEntry.getValue();
value = value + value/4;
Map<Long, Map<LocalDate, Long>> map = new HashMap<>();
map.put(value,dailyCountsMap);
return AjaxResult.success(map);
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.toString(e)); logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员"); return AjaxResult.error("请求失败,请联系管理员");

@ -48,27 +48,17 @@ public class TransitUserRecordController extends BaseController {
@GetMapping @GetMapping
@ApiOperation("查询人脸记录表") @ApiOperation("查询人脸记录表")
public TableDataInfo<TransitUserRecord> list(TransitUserRecord transitUserRecord) throws Exception{ public TableDataInfo<TransitUserRecord> list(TransitUserRecord transitUserRecord) throws Exception {
startPage(); startPage();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1); LocalDateTime minusDay = now.minusDays(1);
QueryWrapper<TransitImpUserRecord> impUserRecordQueryWrapper = new QueryWrapper<>(); QueryWrapper<TransitUserRecord> queryWrapper = new QueryWrapper<>(transitUserRecord);
impUserRecordQueryWrapper.eq("device_code",transitUserRecord.getDeviceCode()); queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now));
impUserRecordQueryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); queryWrapper.orderByDesc("partition_field");
impUserRecordQueryWrapper.orderByDesc("partition_field"); List<TransitUserRecord> list = transitUserRecordService.list(queryWrapper);
List<TransitImpUserRecord> list1 = transitImpUserRecordService.list(impUserRecordQueryWrapper); return getDataTable(list);
if (list1.isEmpty()) {
PageUtils.startPage();
QueryWrapper<TransitUserRecord> queryWrapper = new QueryWrapper<>(transitUserRecord);
queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now));
queryWrapper.orderByDesc("partition_field");
List<TransitUserRecord> list = transitUserRecordService.list(queryWrapper);
return getDataTable(list);
}
return getDataTable(list1);
} }

@ -54,20 +54,11 @@ public class TransitVehicleRecordController extends BaseController {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1); LocalDateTime minusDay = now.minusDays(1);
QueryWrapper<TransitImpVehicleRecord> vehicleRecordQueryWrapper = new QueryWrapper<>(); QueryWrapper<TransitVehicleRecord> queryWrapper = new QueryWrapper<>(transitVehicleRecord);
vehicleRecordQueryWrapper.eq("device_code",transitVehicleRecord.getDoorwayCode()); queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now));
vehicleRecordQueryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now)); queryWrapper.orderByDesc("partition_field");
vehicleRecordQueryWrapper.orderByDesc("partition_field"); List<TransitVehicleRecord> list = transitVehicleRecordService.list(queryWrapper);
List<TransitImpVehicleRecord> list1 = transitImpVehicleRecordService.list(vehicleRecordQueryWrapper); return getDataTable(list);
if (list1.isEmpty()) {
PageUtils.startPage();
QueryWrapper<TransitVehicleRecord> queryWrapper = new QueryWrapper<>(transitVehicleRecord);
queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now));
queryWrapper.orderByDesc("partition_field");
List<TransitVehicleRecord> list = transitVehicleRecordService.list(queryWrapper);
return getDataTable(list);
}
return getDataTable(list1);
} }
@PostMapping @PostMapping
@ -123,5 +114,4 @@ public class TransitVehicleRecordController extends BaseController {
} }
} }

Loading…
Cancel
Save