Commit 58641b49 authored by 黄伟铭's avatar 黄伟铭

Merge remote-tracking branch 'origin/master'

parents 90b4ba98 014f27c1
package net.wanji.opt.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -31,5 +29,6 @@ public class SchemeGreenDirGreenTimeDTO {
private Integer end;
private Integer dir;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField(value = "query_date")
private Date date;
}
......@@ -20,7 +20,7 @@ public class AnalysisGreenCongestionPeriodWeekTask {
@Autowired
private AnalysisGreenCongestionPeriodService analysisGreenCongestionPeriodService;
@Scheduled(cron = "0 0 2 ? * 1")
@Scheduled(cron = "0 30 2 ? * 1")
public void task() throws ParseException {
analysisGreenCongestionPeriodService.selectCountByCongestionPeriod();
......
......@@ -31,7 +31,7 @@ public class GreenWaveWeekDataTask implements ApplicationRunner {
/**
* 每周一凌晨 0:30 执行的任务
*/
@Scheduled(cron = "0 30 0 ? * MON")
@Scheduled(cron = "0 45 0 ? * MON")
public void executeWeeklyTask() {
//周总体拥堵概况更新
log.info("定时任务--周总体拥堵概况更新--执行开始时间:" + LocalDateTime.now());
......
package net.wanji.opt.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.CrossStatusEnum;
import net.wanji.common.framework.Constants;
import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.opt.kafka.ConsumerHandler;
import net.wanji.opt.service.CrossOptimizeService;
import net.wanji.opt.service.impl.LaneInfoServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* 路口、干线事件问题趋势统计
*/
@Component
@Configurable
@EnableScheduling
@Slf4j
@Profile("!dev")
public class ProblemTrendMonitorTask {
@Scheduled(cron = "0 1/5 * * * * ")
public void task(){
}
}
\ No newline at end of file
......@@ -64,7 +64,7 @@ import java.util.stream.Collectors;
@EnableScheduling
@Slf4j
@Profile("!dev")
public class OptimizeStatisticTask {
public class ReportGreenAndCrossOptimizeStatisticTask {
@Resource
StrategyGreenOptHistMapper strategyGreenOptHistMapper;
......
......@@ -2,12 +2,8 @@
*
*/
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import net.wanji.opt.SignalOptimizeApplication;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper;
import net.wanji.opt.task.AnalysisProblemDayTask;
import net.wanji.opt.task.OptimizeStatisticTask;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -16,8 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
/**
* @author fengyi
* @date
......
......@@ -5,8 +5,7 @@
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import net.wanji.opt.SignalOptimizeApplication;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService;
import net.wanji.opt.task.OptimizeStatisticTask;
import net.wanji.opt.task.ReportGreenAndCrossOptimizeStatisticTask;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -26,7 +25,7 @@ import javax.annotation.Resource;
public class OptimizeStatisticTaskTest {
@Resource
OptimizeStatisticTask optimizeStatisticTask;
ReportGreenAndCrossOptimizeStatisticTask optimizeStatisticTask;
@Test
public void testProducerTrack() {
DateTime dateTime = DateUtil.lastWeek();
......
......@@ -9,6 +9,10 @@ public class CrossRunStateDetailAnalysisDataDTO {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)",position =1)
private String crossName;
@ApiModelProperty(value = "本周流量排名", example = "1",position = 2)
private Integer flowSort;
@ApiModelProperty(value = "本周交通指数排名", example = "1",position = 2)
private Integer trafficIndexSort;
@ApiModelProperty(value = "本周高峰最大小时流量", example = "8900",position = 2)
private Integer thisWeekPeakMaxFlow;
@ApiModelProperty(value = "上周高峰最大小时流量", example = "8900",position =3)
......
......@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Service
......@@ -378,6 +379,15 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
crossRunStateDetailAnalysisDataDTOS.add(crossRunStateDetailAnalysisDataDTO);
}
}
// 排序并设置排序序号
AtomicInteger flowSort = new AtomicInteger(1); // 使用原子整数作为计数器
crossRunStateDetailAnalysisDataDTOS.stream().sorted(Comparator.comparingInt(CrossRunStateDetailAnalysisDataDTO::getThisWeekPeakMaxFlow)).forEach(x->{
x.setFlowSort(flowSort.getAndIncrement());
});
AtomicInteger indexSort = new AtomicInteger(1); // 使用原子整数作为计数器
crossRunStateDetailAnalysisDataDTOS.stream().sorted(Comparator.comparingDouble(CrossRunStateDetailAnalysisDataDTO::getThisWeekWorkDayAmTrafficIndex)).forEach(x->{
x.setTrafficIndexSort(indexSort.getAndIncrement());
});
crossRunStateAnalysisResultResponseDTO.setDataList(crossRunStateDetailAnalysisDataDTOS);
return crossRunStateAnalysisResultResponseDTO;
......@@ -635,12 +645,14 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
//本周早高峰集中时段持续时长,45分钟
String[] timeSpans = timeString.split("~");
String[] timeSpansLast = timeStringLast.split("~");
Long thisWeekAmPeakDuration = getTimeSum(timeSpans[0], timeSpans[1]);
Long thisWeekAmPeakDuration = 0L;
if(ObjectUtil.isNotEmpty(timeString)){
thisWeekAmPeakDuration = getTimeSum(timeSpans[0], timeSpans[1]);
}
Long thisWeekAmPeakDurationLast = 0L;
if (ObjectUtil.isNotEmpty(timeStringLast)) {
thisWeekAmPeakDurationLast = getTimeSum(timeSpansLast[0], timeSpansLast[1]);
}
peakResultResponseVO.setThisWeekAmPeakDuration(thisWeekAmPeakDuration + "分钟");
//本周早高峰时段开始时间上周比较情况提前【延后】20分钟
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment