|
|
@ -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("请求失败,请联系管理员");
|
|
|
|