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

develop
hanrenchun 10 months ago
parent 07c2a8aa68
commit 985d1013b6

@ -21,6 +21,8 @@ import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -295,13 +297,35 @@ public class BigScreenController extends BaseController {
try {
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) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
}
}
@PostMapping("/realTimeAlarmSituation")
@ApiOperation("实时警情")
public AjaxResult realTimeAlarmSituation(@ApiParam("时间") @RequestParam String time) {

@ -116,6 +116,10 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("人流量统计前7天(全数)")
public AjaxResult allHumanTrafficStatistics(TransitUserRecord transitUserRecord) {
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();
// 创建一个 TreeMap 用于存储每天的数据量
@ -124,25 +128,22 @@ public class PerceptionDeviceController extends BaseController {
for (int i = 1; i <= 7; i++) {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<DevopsDeviceInfo> deviceInfoQueryWrapper = new QueryWrapper<>();
deviceInfoQueryWrapper.eq("parent_monitoring_type", 1);
List<DevopsDeviceInfo> list = devopsDeviceInfoService.list(deviceInfoQueryWrapper);
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;
}
QueryWrapper<TransitUserRecord> userRecordQueryWrapper = new QueryWrapper<>();
userRecordQueryWrapper.in("device_code",collect);
userRecordQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long totalUserCount = transitUserRecordService.count(userRecordQueryWrapper);
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) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
@ -152,6 +153,10 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("车流量统计前7天(全数)")
public AjaxResult allVehicleTrafficStatistics(TransitVehicleRecord transitVehicleRecord) {
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();
// 创建一个 TreeMap 用于存储每天的数据量
@ -160,35 +165,38 @@ public class PerceptionDeviceController extends BaseController {
for (int i = 1; i <= 7; i++) {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<DevopsDeviceInfo> deviceInfoQueryWrapper = new QueryWrapper<>();
deviceInfoQueryWrapper.eq("parent_monitoring_type", 1);
List<DevopsDeviceInfo> list = devopsDeviceInfoService.list(deviceInfoQueryWrapper);
long totalUserCount = 0;
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);
QueryWrapper<TransitVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>();
vehicleQueryWrapper.in("doorway_code",collect);
vehicleQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long vehicleCount = transitVehicleRecordService.count(vehicleQueryWrapper);
dailyCountsMap.put(date, vehicleCount);
}
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) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
}
}
@PostMapping("/vehicleTrafficStatistics")
@ApiOperation("车流量统计前7天(重点人员)")
public AjaxResult vehicleTrafficStatistics() {
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());
// 获取当前日期
LocalDate currentDate = LocalDate.now();
@ -206,8 +214,16 @@ public class PerceptionDeviceController extends BaseController {
// 存储结果到 TreeMap 中
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) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
@ -218,7 +234,9 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("人流量统计前7天(重点人员)")
public AjaxResult humanTrafficStatistics() {
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());
// 获取当前日期
LocalDate currentDate = LocalDate.now();
@ -236,8 +254,15 @@ public class PerceptionDeviceController extends BaseController {
// 存储结果到 TreeMap 中
dailyCountsMap.put(date, userCount);
}
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) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");

@ -48,27 +48,17 @@ public class TransitUserRecordController extends BaseController {
@GetMapping
@ApiOperation("查询人脸记录表")
public TableDataInfo<TransitUserRecord> list(TransitUserRecord transitUserRecord) throws Exception{
public TableDataInfo<TransitUserRecord> list(TransitUserRecord transitUserRecord) throws Exception {
startPage();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1);
QueryWrapper<TransitImpUserRecord> impUserRecordQueryWrapper = new QueryWrapper<>();
impUserRecordQueryWrapper.eq("device_code",transitUserRecord.getDeviceCode());
impUserRecordQueryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now));
impUserRecordQueryWrapper.orderByDesc("partition_field");
List<TransitImpUserRecord> list1 = transitImpUserRecordService.list(impUserRecordQueryWrapper);
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);
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");
LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1);
QueryWrapper<TransitImpVehicleRecord> vehicleRecordQueryWrapper = new QueryWrapper<>();
vehicleRecordQueryWrapper.eq("device_code",transitVehicleRecord.getDoorwayCode());
vehicleRecordQueryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now));
vehicleRecordQueryWrapper.orderByDesc("partition_field");
List<TransitImpVehicleRecord> list1 = transitImpVehicleRecordService.list(vehicleRecordQueryWrapper);
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);
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);
}
@PostMapping
@ -123,5 +114,4 @@ public class TransitVehicleRecordController extends BaseController {
}
}

Loading…
Cancel
Save