|
|
@ -3,7 +3,6 @@ package com.ruoyi.database.controller;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.StringKit;
|
|
|
|
import com.ruoyi.common.utils.StringKit;
|
|
|
|
import com.ruoyi.database.domain.PeopleVehicleFlow;
|
|
|
|
import com.ruoyi.database.domain.PeopleVehicleFlow;
|
|
|
|
import com.ruoyi.database.service.PeopleVehicleFlowService;
|
|
|
|
import com.ruoyi.database.service.PeopleVehicleFlowService;
|
|
|
@ -12,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDate;
|
|
|
@ -30,11 +30,23 @@ public class PeopleVehicleFlowController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping
|
|
|
|
@GetMapping
|
|
|
|
@ApiOperation("查询人车记录表")
|
|
|
|
@ApiOperation("查询人车记录表")
|
|
|
|
public AjaxResult list(PeopleVehicleFlow peopleVehicleFlow) {
|
|
|
|
public AjaxResult list(@RequestParam int statistictype) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 创建一个 TreeMap 用于存储每天的数据量
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前日期和计算日期范围
|
|
|
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
|
|
|
LocalDate startDate = currentDate.minusDays(6); // 包括今天在内的前6天
|
|
|
|
|
|
|
|
LocalDate endDate = currentDate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理查询结果
|
|
|
|
Map<LocalDate, Long> dailyCountsMap = new TreeMap<>();
|
|
|
|
Map<LocalDate, Long> dailyCountsMap = new TreeMap<>();
|
|
|
|
List<PeopleVehicleFlow> list = peopleVehicleFlowService.list(new QueryWrapper<>(peopleVehicleFlow));
|
|
|
|
|
|
|
|
|
|
|
|
// 查询数据库
|
|
|
|
|
|
|
|
List<PeopleVehicleFlow> list = peopleVehicleFlowService.list(new QueryWrapper<>(new PeopleVehicleFlow())
|
|
|
|
|
|
|
|
.between("statistic_time", startDate.toString(), endDate.toString())
|
|
|
|
|
|
|
|
.eq("statistic_type", statistictype));
|
|
|
|
|
|
|
|
|
|
|
|
for (PeopleVehicleFlow flow : list) {
|
|
|
|
for (PeopleVehicleFlow flow : list) {
|
|
|
|
String countString = flow.getStatisticCount();
|
|
|
|
String countString = flow.getStatisticCount();
|
|
|
|
String timeString = flow.getStatisticTime();
|
|
|
|
String timeString = flow.getStatisticTime();
|
|
|
|