From b24fb982e09f05e39f1803b305773618f850c914 Mon Sep 17 00:00:00 2001 From: hanrenchun Date: Mon, 29 Jan 2024 00:26:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransitUserRecordController.java | 21 ++++++++++++--- .../TransitVehicleRecordController.java | 26 ++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java b/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java index a64f46f..aeefa7e 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java @@ -10,9 +10,11 @@ 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.TransitUserRecord; import com.ruoyi.database.domain.vo.TransitUserRecordVO; +import com.ruoyi.database.service.DevopsDeviceInfoService; import com.ruoyi.database.service.TransitImpUserRecordService; import com.ruoyi.database.service.TransitUserRecordService; import io.swagger.annotations.Api; @@ -30,6 +32,7 @@ import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 人脸记录表(TransitUserRecord)Controller @@ -45,16 +48,28 @@ public class TransitUserRecordController extends BaseController { private final TransitUserRecordService transitUserRecordService; private final TransitImpUserRecordService transitImpUserRecordService; + private final DevopsDeviceInfoService devopsDeviceInfoService; @GetMapping @ApiOperation("查询人脸记录表") public TableDataInfo 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); + DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + List deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list(); + List collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList()); QueryWrapper queryWrapper = new QueryWrapper<>(transitUserRecord); - queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); + queryWrapper.in("device_code",collect); + if (transitUserRecord.getFirstTime() == null) { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime minusDay = now.minusDays(1); + queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); + }else { + LocalDate date = LocalDate.parse(transitUserRecord.getFirstTime(), formatter1); + LocalDate nextDay = date.plusDays(1); + String nextDayString = nextDay.format(formatter1); + queryWrapper.between("partition_field", transitUserRecord.getFirstTime(), nextDayString); + } queryWrapper.orderByDesc("partition_field"); List list = transitUserRecordService.list(queryWrapper); return getDataTable(list); diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java b/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java index b1f96cd..d3f9455 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java @@ -12,11 +12,9 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.PageUtils; 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.TransitImpVehicleRecord; -import com.ruoyi.database.domain.TransitUserRecord; -import com.ruoyi.database.domain.TransitVehicleRecord; +import com.ruoyi.database.domain.*; import com.ruoyi.database.service.BoneVehicleService; +import com.ruoyi.database.service.DevopsDeviceInfoService; import com.ruoyi.database.service.TransitImpVehicleRecordService; import com.ruoyi.database.service.TransitVehicleRecordService; import io.swagger.annotations.Api; @@ -26,11 +24,13 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 车辆记录表(TransitVehicleRecord)Controller @@ -46,16 +46,28 @@ public class TransitVehicleRecordController extends BaseController { private final TransitVehicleRecordService transitVehicleRecordService; private final TransitImpVehicleRecordService transitImpVehicleRecordService; + private final DevopsDeviceInfoService devopsDeviceInfoService; @GetMapping @ApiOperation("查询车辆记录表") public TableDataInfo list(TransitVehicleRecord transitVehicleRecord) { startPage(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - LocalDateTime now = LocalDateTime.now(); - LocalDateTime minusDay = now.minusDays(1); + DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + List deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list(); + List collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList()); QueryWrapper queryWrapper = new QueryWrapper<>(transitVehicleRecord); - queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); + queryWrapper.in("doorway_code",collect); + if (transitVehicleRecord.getFirstTime() == null) { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime minusDay = now.minusDays(1); + queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); + }else { + LocalDate date = LocalDate.parse(transitVehicleRecord.getFirstTime(), formatter1); + LocalDate nextDay = date.plusDays(1); + String nextDayString = nextDay.format(formatter1); + queryWrapper.between("partition_field", transitVehicleRecord.getFirstTime(), nextDayString); + } queryWrapper.orderByDesc("partition_field"); List list = transitVehicleRecordService.list(queryWrapper); return getDataTable(list);