每日的人车修改---第二版

develop
Angel 10 months ago
parent a3bd93932d
commit 885cf99976

@ -103,19 +103,20 @@ public class PeopleVehicleHourFlowTask {
//构造查询条件 //构造查询条件
QueryWrapper<TStrhEntityInfoKs> queryWrapper = new QueryWrapper<>(); QueryWrapper<TStrhEntityInfoKs> queryWrapper = new QueryWrapper<>();
//减去i小时 //减去i小时
LocalDateTime targetHour = startOfDay.minusHours(i); LocalDateTime targetHour = startOfDay.plusHours(i);
LocalDateTime time = Hour.minusHours(i); LocalDateTime time = Hour.plusHours(i + 1);
//将日期部分格式化为数据库存储格式 //将日期部分格式化为数据库存储格式
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDate = targetHour.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); String formattedDate = targetHour.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
String format = time.format(formatter1);
queryWrapper.between("capturetime", formattedDate, targetHour.plusHours(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); queryWrapper.between("capturetime", formattedDate, targetHour.plusHours(i+1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
int count = tStrhEntityInfoKsService.count(queryWrapper); int count = tStrhEntityInfoKsService.count(queryWrapper);
PeopleVehicleHourFlow peopleVehicleHourFlow = new PeopleVehicleHourFlow(); PeopleVehicleHourFlow peopleVehicleHourFlow = new PeopleVehicleHourFlow();
peopleVehicleHourFlow.setStatistic_count(String.valueOf(count)); peopleVehicleHourFlow.setStatistic_count(String.valueOf(count));
peopleVehicleHourFlow.setStatistic_type(1); peopleVehicleHourFlow.setStatistic_type(1);
peopleVehicleHourFlow.setStatistic_time(time.toString()); peopleVehicleHourFlow.setStatistic_time(format);
PeopleVehicleHourFlow one = peopleVehicleHourFlowService.lambdaQuery().eq(PeopleVehicleHourFlow::getStatistic_time, time.toString()) PeopleVehicleHourFlow one = peopleVehicleHourFlowService.lambdaQuery().eq(PeopleVehicleHourFlow::getStatistic_time, time)
.eq(PeopleVehicleHourFlow::getStatistic_type, 1).one(); .eq(PeopleVehicleHourFlow::getStatistic_type, 1).one();
if (one == null) { if (one == null) {
boolean save = peopleVehicleHourFlowService.save(peopleVehicleHourFlow); boolean save = peopleVehicleHourFlowService.save(peopleVehicleHourFlow);

Loading…
Cancel
Save