重点人车抓拍,统计接口更新

develop
hanrenchun 10 months ago
parent 7f40d24aea
commit 4561698ebc

@ -19,6 +19,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
*
@ -43,8 +44,14 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("人车统计")
public AjaxResult overviewResources() {
try {
Integer userCount = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getDeviceType, 1).count();
Integer vehicleCount = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getDeviceType, 2).count();
Integer userCount = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getDeviceType, 1)
.eq(DevopsDeviceInfo::getParentMonitoringType,1)
.count();
Integer vehicleCount = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getDeviceType, 2)
.eq(DevopsDeviceInfo::getParentMonitoringType,1)
.count();
Map<String, Integer> map = new HashMap<>();
map.put("userCount", userCount);
map.put("vehicleCount", vehicleCount);
@ -177,6 +184,8 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("车流量统计前7天(重点人员)")
public AjaxResult vehicleTrafficStatistics() {
try {
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 创建一个 TreeMap 用于存储每天的数据量
@ -186,6 +195,7 @@ public class PerceptionDeviceController extends BaseController {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<TransitImpVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>();
vehicleQueryWrapper.in("device_code",collect);
vehicleQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long vehicleCount = vehicleRecordService.count(vehicleQueryWrapper);
@ -204,6 +214,8 @@ public class PerceptionDeviceController extends BaseController {
@ApiOperation("人流量统计前7天(重点人员)")
public AjaxResult humanTrafficStatistics() {
try {
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 创建一个 TreeMap 用于存储每天的数据量
@ -213,6 +225,7 @@ public class PerceptionDeviceController extends BaseController {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<TransitImpUserRecord> userQueryWrapper = new QueryWrapper<>();
userQueryWrapper.in("device_code",collect);
userQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long userCount = userRecordService.count(userQueryWrapper);

@ -9,7 +9,9 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.database.domain.DevopsDeviceInfo;
import com.ruoyi.database.domain.TransitImpUserRecord;
import com.ruoyi.database.service.DevopsDeviceInfoService;
import com.ruoyi.database.service.TransitImpUserRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -20,10 +22,13 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* (TransitImpUserRecord)Controller
@ -38,21 +43,29 @@ import java.util.List;
public class TransitImpUserRecordController extends BaseController {
private final TransitImpUserRecordService transitImpUserRecordService;
private final DevopsDeviceInfoService devopsDeviceInfoService;
@GetMapping
@ApiOperation("查询涉稳列管人员人脸抓拍记录表")
public TableDataInfo<TransitImpUserRecord> list(TransitImpUserRecord transitImpUserRecord) throws Exception{
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
QueryWrapper<TransitImpUserRecord> queryWrapper = new QueryWrapper<>(transitImpUserRecord);
if (transitImpUserRecord.getFirstTime() != null && transitImpUserRecord.getEndTime() != null) {
queryWrapper.between("partition_field", transitImpUserRecord.getFirstTime(), transitImpUserRecord.getEndTime());
}
queryWrapper.in("device_code",collect);
if (transitImpUserRecord.getFirstTime() != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(simpleDateFormat.parse(transitImpUserRecord.getFirstTime()));
calendar.add(Calendar.DAY_OF_MONTH, 1);
queryWrapper.between("partition_field", transitImpUserRecord.getFirstTime(),simpleDateFormat.format(calendar.getTime()));
queryWrapper.orderByDesc("partition_field");
}else {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1);
queryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now));
queryWrapper.orderByDesc("partition_field");
}
int count = transitImpUserRecordService.count(queryWrapper);
PageUtils.startPage();

@ -9,8 +9,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.database.domain.DevopsDeviceInfo;
import com.ruoyi.database.domain.TransitImpUserRecord;
import com.ruoyi.database.domain.TransitImpVehicleRecord;
import com.ruoyi.database.service.DevopsDeviceInfoService;
import com.ruoyi.database.service.TransitImpVehicleRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -20,10 +22,13 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* (TransitImpVehicleRecord)Controller
@ -38,31 +43,41 @@ import java.util.List;
public class TransitImpVehicleRecordController extends BaseController {
private final TransitImpVehicleRecordService transitImpVehicleRecordService;
private final DevopsDeviceInfoService devopsDeviceInfoService;
@GetMapping
@ApiOperation("查询重点人车辆记录表")
public TableDataInfo<TransitImpVehicleRecord> list(TransitImpVehicleRecord transitImpVehicleRecord) throws Exception{
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list();
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
QueryWrapper<TransitImpVehicleRecord> queryWrapper = new QueryWrapper<>(transitImpVehicleRecord);
if (transitImpVehicleRecord.getFirstTime() != null && transitImpVehicleRecord.getEndTime() != null) {
queryWrapper.between("partition_field", transitImpVehicleRecord.getFirstTime(), transitImpVehicleRecord.getEndTime());
}
queryWrapper.in("device_code",collect);
if (transitImpVehicleRecord.getFirstTime() != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(simpleDateFormat.parse(transitImpVehicleRecord.getFirstTime()));
calendar.add(Calendar.DAY_OF_MONTH, 1);
queryWrapper.between("partition_field", transitImpVehicleRecord.getFirstTime(),simpleDateFormat.format(calendar.getTime()));
queryWrapper.orderByDesc("partition_field");
}else {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1);
queryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now));
queryWrapper.orderByDesc("partition_field");
}
int count = transitImpVehicleRecordService.count(queryWrapper);
PageUtils.startPage();
List<TransitImpVehicleRecord> list = transitImpVehicleRecordService.list(queryWrapper);
List<TransitImpVehicleRecord> impVehicleRecords = new ArrayList<>();
for (TransitImpVehicleRecord transitImpVehicleRecord1 : list){
Date partitionField = transitImpVehicleRecord1.getPartitionField();
String format = dateFormat.format(partitionField);
transitImpVehicleRecord1.setElapsedTime(format);
impVehicleRecords.add(transitImpVehicleRecord1);
if (!"unknown".equals(transitImpVehicleRecord1.getPlateNo())) {
Date partitionField = transitImpVehicleRecord1.getPartitionField();
String format = dateFormat.format(partitionField);
transitImpVehicleRecord1.setElapsedTime(format);
impVehicleRecords.add(transitImpVehicleRecord1);
}
}
TableDataInfo dataTable = getDataTable(impVehicleRecords);
dataTable.setTotal(count);

@ -1,6 +1,7 @@
package com.ruoyi.database.controller;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -15,11 +16,16 @@ import com.ruoyi.database.service.TransitImpUserRecordService;
import com.ruoyi.database.service.TransitUserRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
@ -42,21 +48,17 @@ public class TransitUserRecordController extends BaseController {
@ApiOperation("查询人脸记录表")
public TableDataInfo<TransitUserRecord> list(TransitUserRecord transitUserRecord) {
startPage();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1);
QueryWrapper<TransitUserRecord> queryWrapper = new QueryWrapper<>(transitUserRecord);
// List<TransitImpUserRecord> impUserRecords = transitImpUserRecordService.lambdaQuery().eq(TransitImpUserRecord::getDeviceCode, transitUserRecord.getDeviceCode()).list();
if (transitUserRecord.getFirstTime() != null && transitUserRecord.getEndTime() != null) {
queryWrapper.between("partition_field", transitUserRecord.getFirstTime(), transitUserRecord.getEndTime());
}
// if (impUserRecords != null && !impUserRecords.isEmpty()){
// for (TransitImpUserRecord transitImpUserRecord : impUserRecords){
// Date partitionField = transitImpUserRecord.getPartitionField();
// }
// return getDataTable(impUserRecords);
// }
queryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now));
queryWrapper.orderByDesc("partition_field");
List<TransitUserRecord> list = transitUserRecordService.list(queryWrapper);
return getDataTable(list);
}
@PostMapping
@ApiOperation("新增人脸记录表")
@Log(title = "人脸记录表", businessType = BusinessType.INSERT)

@ -26,6 +26,8 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -49,15 +51,12 @@ public class TransitVehicleRecordController extends BaseController {
@ApiOperation("查询车辆记录表")
public TableDataInfo<TransitVehicleRecord> list(TransitVehicleRecord transitVehicleRecord) {
startPage();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime minusDay = now.minusDays(1);
QueryWrapper<TransitVehicleRecord> queryWrapper = new QueryWrapper<>(transitVehicleRecord);
List<TransitImpVehicleRecord> vehicleRecords = transitImpVehicleRecordService.lambdaQuery().eq(TransitImpVehicleRecord::getDeviceCode, transitVehicleRecord.getDoorwayCode()).list();
if (transitVehicleRecord.getFirstTime() != null && transitVehicleRecord.getEndTime() != null) {
queryWrapper.between("partition_field", transitVehicleRecord.getFirstTime(), transitVehicleRecord.getEndTime());
}
if (vehicleRecords != null && !vehicleRecords.isEmpty()){
return getDataTable(vehicleRecords);
}
PageUtils.startPage();
queryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now));
queryWrapper.orderByDesc("partition_field");
List<TransitVehicleRecord> list = transitVehicleRecordService.list(queryWrapper);
return getDataTable(list);
}

Loading…
Cancel
Save