车辆档案与人,车流量接口更新

develop
hanrenchun 11 months ago
parent 49261bf607
commit ca7acf1191

@ -9,16 +9,23 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringKit;
import com.ruoyi.database.domain.TransitImpUserRecord;
import com.ruoyi.database.domain.TransitImpVehicleRecord;
import com.ruoyi.database.domain.TransitUserRecord;
import com.ruoyi.database.domain.TransitVehicleRecord;
import com.ruoyi.database.service.TransitImpUserRecordService;
import com.ruoyi.database.service.TransitImpVehicleRecordService;
import com.ruoyi.database.service.TransitUserRecordService;
import com.ruoyi.database.service.TransitVehicleRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.TreeMap;
@ -36,6 +43,8 @@ public class PerceptionDeviceController extends BaseController {
private final TransitImpUserRecordService userRecordService;
private final TransitImpVehicleRecordService vehicleRecordService;
private final TransitVehicleRecordService transitVehicleRecordService;
private final TransitUserRecordService transitUserRecordService;
@PostMapping("/humanVehicleStatistics")
@ -63,9 +72,9 @@ public class PerceptionDeviceController extends BaseController {
}
}
@PostMapping("/humanTrafficStatistics")
@ApiOperation("人流量统计前7天")
public AjaxResult humanTrafficStatistics() {
@PostMapping("/allHumanTrafficStatistics")
@ApiOperation("人流量统计前7天(全数)")
public AjaxResult allHumanTrafficStatistics(@RequestBody TransitUserRecord transitUserRecord) {
try {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
@ -75,10 +84,10 @@ public class PerceptionDeviceController extends BaseController {
for (int i = 0; i < 7; i++) {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<TransitImpUserRecord> userQueryWrapper = new QueryWrapper<>();
QueryWrapper<TransitUserRecord> userQueryWrapper = new QueryWrapper<>(transitUserRecord);
userQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long userCount = userRecordService.count(userQueryWrapper);
long userCount = transitUserRecordService.count(userQueryWrapper);
// 存储结果到 TreeMap 中
dailyCountsMap.put(date, userCount);
}
@ -91,7 +100,7 @@ public class PerceptionDeviceController extends BaseController {
}
@PostMapping("/vehicleTrafficStatistics")
@ApiOperation("车流量统计前7天")
@ApiOperation("车流量统计前7天(重点人员)")
public AjaxResult vehicleTrafficStatistics() {
try {
// 获取当前日期
@ -117,5 +126,116 @@ public class PerceptionDeviceController extends BaseController {
}
}
@PostMapping("/humanTrafficStatistics")
@ApiOperation("人流量统计前7天(重点人员)")
public AjaxResult humanTrafficStatistics() {
try {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 创建一个 TreeMap 用于存储每天的数据量
Map<LocalDate, Long> dailyCountsMap = new TreeMap<>();
// 循环迭代前7天
for (int i = 0; i < 7; i++) {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<TransitImpUserRecord> userQueryWrapper = new QueryWrapper<>();
userQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long userCount = userRecordService.count(userQueryWrapper);
// 存储结果到 TreeMap 中
dailyCountsMap.put(date, userCount);
}
return AjaxResult.success(dailyCountsMap);
} catch (Exception e) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
}
}
@PostMapping("/allVehicleTrafficStatistics")
@ApiOperation("车流量统计前7天(全数)")
public AjaxResult allVehicleTrafficStatistics(@RequestBody TransitVehicleRecord transitVehicleRecord) {
try {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 创建一个 TreeMap 用于存储每天的数据量
Map<LocalDate, Long> dailyCountsMap = new TreeMap<>();
// 循环迭代前7天
for (int i = 0; i < 7; i++) {
LocalDate date = currentDate.minusDays(i);
// 构造查询条件
QueryWrapper<TransitVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>(transitVehicleRecord);
vehicleQueryWrapper.between("partition_field", date, date.plusDays(1));
// 查询当前日期的记录数据总数
long vehicleCount = transitVehicleRecordService.count(vehicleQueryWrapper);
// 存储结果到 TreeMap 中
dailyCountsMap.put(date, vehicleCount);
}
return AjaxResult.success(dailyCountsMap);
} catch (Exception e) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
}
}
@PostMapping("/allHumanTrafficStatisticsHour")
@ApiOperation("人流量统计(当天)(全数)")
public AjaxResult allHumanTrafficStatisticsHour(@RequestBody TransitUserRecord transitUserRecord) {
try {
// 获取当前日期
LocalDateTime currentDateTime = LocalDateTime.now();
LocalDateTime startOfDay = currentDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
String formattedDateTime = startOfDay.format(formatter);
// 创建一个 TreeMap 用于存储每天的数据量
Map<String, Long> dailyCountsMap = new TreeMap<>();
// 循环迭代前7天
for (int i = 0; i < 24; i++) {
// 构造查询条件
QueryWrapper<TransitUserRecord> userQueryWrapper = new QueryWrapper<>(transitUserRecord);
userQueryWrapper.between("partition_field", formattedDateTime, startOfDay.plusHours(1).format(formatter));
// 查询当前日期的记录数据总数
long userCount = transitUserRecordService.count(userQueryWrapper);
// 存储结果到 TreeMap 中
dailyCountsMap.put(startOfDay.plusHours(1).format(formatter), userCount);
}
return AjaxResult.success(dailyCountsMap);
} catch (Exception e) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
}
}
@PostMapping("/allVehicleTrafficStatisticsHour")
@ApiOperation("车流量统计(当天)(全数)")
public AjaxResult allVehicleTrafficStatisticsHour(@RequestBody TransitVehicleRecord transitVehicleRecord) {
try {
// 获取当前日期
LocalDateTime currentDateTime = LocalDateTime.now();
LocalDateTime startOfDay = currentDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
String formattedDateTime = startOfDay.format(formatter);
// 创建一个 TreeMap 用于存储每天的数据量
Map<String, Long> dailyCountsMap = new TreeMap<>();
// 循环迭代前7天
for (int i = 0; i < 24; i++) {
// 构造查询条件
QueryWrapper<TransitVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>(transitVehicleRecord);
vehicleQueryWrapper.between("partition_field", formattedDateTime, startOfDay.plusHours(1).format(formatter));
// 查询当前日期的记录数据总数
long vehicleCount = transitVehicleRecordService.count(vehicleQueryWrapper);
// 存储结果到 TreeMap 中
dailyCountsMap.put(startOfDay.plusHours(1).format(formatter), vehicleCount);
}
return AjaxResult.success(dailyCountsMap);
} catch (Exception e) {
logger.info(StringKit.toString(e));
return AjaxResult.error("请求失败,请联系管理员");
}
}
}

@ -1,14 +1,20 @@
package com.ruoyi.database.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.database.domain.BoneVehicle;
import com.ruoyi.database.domain.TransitUserRecord;
import com.ruoyi.database.domain.TransitVehicleRecord;
import com.ruoyi.database.service.BoneVehicleService;
import com.ruoyi.database.service.TransitVehicleRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -17,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
@ -96,4 +103,7 @@ public class TransitVehicleRecordController extends BaseController {
}
return AjaxResult.success(result);
}
}

@ -0,0 +1,34 @@
package com.ruoyi.database.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* @TableName bone_vehicle
*/
@TableName(value ="bone_vehicle")
@Data
public class BoneVehicle implements Serializable {
private Long id;
@TableField(value = "no")
private String no;
@TableField(value = "owner_person_name")
private String ownerPersonName;
@TableField(value = "owner_person_idcard")
private String ownerPersonIdcard;
@TableField(value = "owner_person_phone")
private String ownerPersonPhone;
private static final long serialVersionUID = 1L;
}

@ -66,6 +66,14 @@ public class DevopsDeviceInfo extends BaseEntity {
@TableField(condition = SqlCondition.LIKE)
private String gbsChannelNo;
/**
*
*/
@ApiModelProperty("监控大类")
@Excel(name = "监控大类")
private Integer parentMonitoringType;
/**
*
*/

@ -0,0 +1,22 @@
package com.ruoyi.database.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.database.domain.BoneVehicle;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 28758
* @description bone_vehicle( )Mapper
* @createDate 2023-12-26 21:35:05
* @Entity generator.domain.BoneVehicle
*/
@Mapper
public interface BoneVehicleMapper extends BaseMapper<BoneVehicle> {
}

@ -0,0 +1,14 @@
package com.ruoyi.database.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.database.domain.BoneVehicle;
/**
* @author 28758
* @description bone_vehicle( )Service
* @createDate 2023-12-26 21:35:05
*/
public interface BoneVehicleService extends IService<BoneVehicle> {
}

@ -0,0 +1,23 @@
package com.ruoyi.database.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.database.domain.BoneVehicle;
import com.ruoyi.database.mapper.BoneVehicleMapper;
import com.ruoyi.database.service.BoneVehicleService;
import org.springframework.stereotype.Service;
/**
* @author 28758
* @description bone_vehicle( )Service
* @createDate 2023-12-26 21:35:05
*/
@Service
public class BoneVehicleServiceImpl extends ServiceImpl<BoneVehicleMapper, BoneVehicle>
implements BoneVehicleService {
}
Loading…
Cancel
Save