|
|
@ -1,8 +1,6 @@ |
|
|
|
package com.zc.business.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ruoyi.common.annotation.Excel; |
|
|
|
import com.ruoyi.common.annotation.Log; |
|
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
@ -11,6 +9,7 @@ import com.ruoyi.common.enums.BusinessType; |
|
|
|
import com.ruoyi.common.utils.StakeMarkUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil; |
|
|
|
import com.ruoyi.common.utils.spring.SpringUtils; |
|
|
|
import com.zc.business.domain.*; |
|
|
|
import com.zc.business.domain.export.*; |
|
|
|
import com.zc.business.enums.LocationEnum; |
|
|
@ -19,6 +18,7 @@ import com.zc.business.enums.UniversalEnum; |
|
|
|
import com.zc.business.request.DcTrafficMetricsDataRequest; |
|
|
|
import com.zc.business.request.DcTrafficSectionDataRequest; |
|
|
|
import com.zc.business.service.*; |
|
|
|
import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl; |
|
|
|
import com.zc.common.core.httpclient.exception.HttpException; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
@ -26,19 +26,19 @@ import org.apache.poi.ss.usermodel.*; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -47,7 +47,7 @@ import java.util.stream.Collectors; |
|
|
|
* |
|
|
|
* @author xiepufeng |
|
|
|
*/ |
|
|
|
|
|
|
|
@Component |
|
|
|
@Api(tags = "交通数据统计") |
|
|
|
@RestController |
|
|
|
@RequestMapping("/business/traffic-statistics") |
|
|
@ -68,6 +68,63 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private IDcGantryMetricsStatisticsDataService dcGantryMetricsStatisticsDataService; |
|
|
|
|
|
|
|
public void TrafficFlowAnomalies() throws HttpException { |
|
|
|
IDcTrafficStatisticsService ben = SpringUtils.getBean(IDcTrafficStatisticsService.class); |
|
|
|
DcNoStakeWarningTableServiceImpl dcNoStakeWarningTableService = SpringUtils.getBean(DcNoStakeWarningTableServiceImpl.class); |
|
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
LocalDate date = LocalDate.now(); |
|
|
|
// 获取一天的开始时间
|
|
|
|
LocalDateTime startOfDay = LocalDateTime.of(date, LocalTime.MIN); |
|
|
|
// 获取一天的结束时间
|
|
|
|
LocalDateTime endOfDay = LocalDateTime.of(date, LocalTime.of(23, 59, 59)); |
|
|
|
|
|
|
|
// 格式化为字符串
|
|
|
|
String startOfDayStr = startOfDay.format(formatter); |
|
|
|
String endOfDayStr = endOfDay.format(formatter); |
|
|
|
JSONArray mapList = ben.exampleQueryTrafficFlowAnomalies(startOfDayStr, endOfDayStr); |
|
|
|
mapList.forEach(item -> { |
|
|
|
// 设置时区
|
|
|
|
ZoneId zoneId = ZoneId.of("Asia/Shanghai"); |
|
|
|
|
|
|
|
Map<String, Object> map = (Map<String, Object>) item; |
|
|
|
long occur_time = (long) map.get("occur_time"); |
|
|
|
long end_time = (long) map.get("end_time"); |
|
|
|
// 创建一个SimpleDateFormat对象,定义你想要的日期格式
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
// 使用Date对象将时间戳转换为日期
|
|
|
|
Date date2 = new Date(occur_time); |
|
|
|
Date date3 = new Date(end_time); |
|
|
|
// 将Date对象格式化为字符串
|
|
|
|
String occurTime = sdf.format(date2); |
|
|
|
String endTime = sdf.format(date3); |
|
|
|
|
|
|
|
|
|
|
|
String stakeNum = (String) map.get("opma_stake_num"); |
|
|
|
int direction = (int) map.get("direction"); |
|
|
|
DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable(); |
|
|
|
String description = direction == 1 ? "菏泽方向" : "济南方向"; |
|
|
|
dcNoStakeWarningTable.setWarningDescription(occurTime + " " + stakeNum + " " + description + "发生交通流异常事件"); |
|
|
|
dcNoStakeWarningTable.setWarningType("3"); |
|
|
|
Date warningTime = getDate(occurTime, formatter);// 获取开始时间
|
|
|
|
dcNoStakeWarningTable.setWarningTime(warningTime); |
|
|
|
List<DcNoStakeWarningTable> dcNoStakeWarningTables = dcNoStakeWarningTableService.listDcNoStakeWarningTable(dcNoStakeWarningTable, getDate(endOfDayStr, formatter), getDate(startOfDayStr, formatter)); |
|
|
|
if (dcNoStakeWarningTables.isEmpty()) { |
|
|
|
dcNoStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private static Date getDate(String occurTime, DateTimeFormatter formatter) { |
|
|
|
// 解析字符串为 LocalDateTime
|
|
|
|
LocalDateTime localDateTime = LocalDateTime.parse(occurTime, formatter); |
|
|
|
// 转换为 Date 对象
|
|
|
|
Date warningTime = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); |
|
|
|
return warningTime; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前交通截面数据 |
|
|
|
* |
|
|
@ -76,7 +133,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取当前交通截面数据") |
|
|
|
@GetMapping("/current/sections") |
|
|
|
public AjaxResult currentSections(DcTrafficSectionDataRequest request){ |
|
|
|
public AjaxResult currentSections(DcTrafficSectionDataRequest request) { |
|
|
|
// 调用服务层方法,查询当前交通截面数据
|
|
|
|
List<DcTrafficSectionData> dcTrafficMetricsData = dcTrafficSectionStatisticsService.currentSections(request); |
|
|
|
// 将查询结果封装为AjaxResult对象返回
|
|
|
@ -91,7 +148,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取历史交通截面数据") |
|
|
|
@GetMapping("/history/sections") |
|
|
|
public AjaxResult historySections(DcTrafficSectionDataRequest request){ |
|
|
|
public AjaxResult historySections(DcTrafficSectionDataRequest request) { |
|
|
|
// 调用服务层方法,获取历史交通截面的统计数据
|
|
|
|
List<DcTrafficSectionData> dcTrafficMetricsData = dcTrafficSectionStatisticsService.historySections(request); |
|
|
|
// 将获取到的历史交通截面数据封装成AjaxResult对象并返回
|
|
|
@ -107,7 +164,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取当前交通特征指数") |
|
|
|
@GetMapping("/current/metrics") |
|
|
|
public AjaxResult currentTrafficMetrics(DcTrafficMetricsDataRequest request){ |
|
|
|
public AjaxResult currentTrafficMetrics(DcTrafficMetricsDataRequest request) { |
|
|
|
// 调用服务层方法,获取当前交通指标数据
|
|
|
|
List<DcTrafficMetricsData> dcTrafficMetricsData = dcTrafficSectionStatisticsService.currentTrafficMetrics(request); |
|
|
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
|
|
@ -122,7 +179,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取历史交通特征指数") |
|
|
|
@GetMapping("/history/metrics") |
|
|
|
public AjaxResult historyTrafficMetrics(DcTrafficMetricsDataRequest request){ |
|
|
|
public AjaxResult historyTrafficMetrics(DcTrafficMetricsDataRequest request) { |
|
|
|
// 调用服务层方法,查询历史交通特征指数数据
|
|
|
|
List<DcTrafficMetricsData> dcTrafficMetricsDataList = dcTrafficSectionStatisticsService.historyTrafficMetrics(request); |
|
|
|
// 将查询结果封装成成功响应并返回
|
|
|
@ -137,7 +194,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取当前拥堵路段") |
|
|
|
@GetMapping("/current/congested") |
|
|
|
public AjaxResult currentCongestedSection(Byte direction){ |
|
|
|
public AjaxResult currentCongestedSection(Byte direction) { |
|
|
|
// 调用服务层方法,获取当前交通指标数据
|
|
|
|
List<DcCongestedSectionData> dcTrafficMetricsData = dcTrafficSectionStatisticsService.currentCongestedSection(direction); |
|
|
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
|
|
@ -153,7 +210,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取收费站统计数据") |
|
|
|
@GetMapping("/history/toll-station") |
|
|
|
public AjaxResult historyTollStation(DcTollStationStatisticsData request){ |
|
|
|
public AjaxResult historyTollStation(DcTollStationStatisticsData request) { |
|
|
|
// 调用服务层方法,根据请求条件查询历史车收费站数据
|
|
|
|
List<DcTollStationStatisticsData> dcStatisticsData = dcTollStationStatisticsDataService.tollStationData(request); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
@ -168,7 +225,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取累计车流量") |
|
|
|
@GetMapping("/history/accumulated-flow") |
|
|
|
public AjaxResult accumulatedFlow(DcTollStationStatisticsData request){ |
|
|
|
public AjaxResult accumulatedFlow(DcTollStationStatisticsData request) { |
|
|
|
// 调用服务层方法,根据请求条件查询历史车收费站数据
|
|
|
|
List<DcTollStationStatisticsData> dcStatisticsData = dcTollStationStatisticsDataService.accumulatedFlow(request); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
@ -183,7 +240,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("获取门架统计数据") |
|
|
|
@GetMapping("/history/gantry") |
|
|
|
public AjaxResult historyGantryData(DcGantryStatisticsData request){ |
|
|
|
public AjaxResult historyGantryData(DcGantryStatisticsData request) { |
|
|
|
// 调用服务层方法,根据请求条件查询历史车门架数据
|
|
|
|
List<DcGantryStatisticsData> dcStatisticsData = dcGantryStatisticsDataService.gantryData(request); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
@ -192,6 +249,7 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 交通流统计 列表 |
|
|
|
* |
|
|
|
* @param startDate |
|
|
|
* @param endDate |
|
|
|
* @param direction |
|
|
@ -200,49 +258,50 @@ public class DcTrafficStatisticsController extends BaseController { |
|
|
|
*/ |
|
|
|
@ApiOperation("交通流统计") |
|
|
|
@GetMapping("/history/trafficFlowStatistics") |
|
|
|
public TableDataInfo trafficFlowStatistics(String startDate, String endDate, String direction, String periodType){ |
|
|
|
public TableDataInfo trafficFlowStatistics(String startDate, String endDate, String direction, String periodType) { |
|
|
|
startPage(); |
|
|
|
List<Map<String,String>> mapList = dcGantryStatisticsDataService.trafficFlowStatistics(startDate,endDate,direction,periodType); |
|
|
|
List<Map<String, String>> mapList = dcGantryStatisticsDataService.trafficFlowStatistics(startDate, endDate, direction, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return getDataTable(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 全路段双向实时车流量 |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param direction 方向 |
|
|
|
* @param periodType 时间粒子 |
|
|
|
*/ |
|
|
|
@ApiOperation("全路段车流量状况分析") |
|
|
|
@GetMapping("/history/realTimeTrafficFlow") |
|
|
|
public AjaxResult realTimeTrafficFlow(String startDate, String direction,String periodType ){ |
|
|
|
List<Map<String,String>> mapList = dcGantryStatisticsDataService.realTimeTrafficFlow(startDate,direction,periodType); |
|
|
|
@ApiOperation("全路段车流量状况分析") |
|
|
|
@GetMapping("/history/realTimeTrafficFlow") |
|
|
|
public AjaxResult realTimeTrafficFlow(String startDate, String direction, String periodType) { |
|
|
|
List<Map<String, String>> mapList = dcGantryStatisticsDataService.realTimeTrafficFlow(startDate, direction, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出全路段双向实时车流量 |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param direction 方向 |
|
|
|
* @param periodType 时间粒子 |
|
|
|
*/ |
|
|
|
@ApiOperation(value="导出全路段车流量状况分析",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出全路段车流量状况分析", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportRealTimeTrafficFlow") |
|
|
|
public void exportRealTimeTrafficFlow(HttpServletResponse response,String startDate, String direction,String periodType ){ |
|
|
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(direction) || StringUtils.isEmpty(periodType)){ |
|
|
|
public void exportRealTimeTrafficFlow(HttpServletResponse response, String startDate, String direction, String periodType) { |
|
|
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(direction) || StringUtils.isEmpty(periodType)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
String endDate = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)){ |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)) { |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_YEARS_MONTH_DAY.getValue()); |
|
|
|
LocalDate inputDate = LocalDate.parse(startDate, formatter); |
|
|
|
// 获取一年前的日期
|
|
|
|
LocalDate end = inputDate.minusYears(UniversalEnum.ONE.getNumber()); |
|
|
|
endDate = end.format(formatter); |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)) { |
|
|
|
String[] parts = startDate.split(UniversalEnum.SHORT_BAR.getValue()); |
|
|
|
int year = Integer.parseInt(parts[UniversalEnum.ZERO.getNumber()]); |
|
|
|
int month = Integer.parseInt(parts[UniversalEnum.ONE.getNumber()]); |
|
|
@ -255,15 +314,15 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
month = UniversalEnum.TWELVE.getNumber(); |
|
|
|
} |
|
|
|
endDate = String.format("%04d-%02d", year, month); |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)) { |
|
|
|
int year = Integer.parseInt(startDate) - UniversalEnum.ONE.getNumber(); |
|
|
|
endDate = String.valueOf(year); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<RealTimeTrafficFlow> list = new ArrayList<>(); |
|
|
|
List<Map<String,String>> mapList = dcGantryStatisticsDataService.realTimeTrafficFlow(startDate,direction,periodType); |
|
|
|
List<Map<String,String>> lastList = dcGantryStatisticsDataService.realTimeTrafficFlow(endDate,direction,periodType); |
|
|
|
List<Map<String, String>> mapList = dcGantryStatisticsDataService.realTimeTrafficFlow(startDate, direction, periodType); |
|
|
|
List<Map<String, String>> lastList = dcGantryStatisticsDataService.realTimeTrafficFlow(endDate, direction, periodType); |
|
|
|
mapList = mapList.stream().sorted( |
|
|
|
Comparator.comparing(map -> { |
|
|
|
String stakeMark = map.get("stake_make"); |
|
|
@ -290,61 +349,67 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
util.exportExcel(response, list, UniversalEnum.THE_WHOLE_SECTION_TWO_WAY_REAL_TIME_TRAFFIC_FLOW.getValue()); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 车流量时段分析 |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param direction 方向 |
|
|
|
* @param periodType 时间粒子 |
|
|
|
*/ |
|
|
|
@ApiOperation("车流量时段分析") |
|
|
|
@GetMapping("/history/trafficPeriodAnalysis") |
|
|
|
public AjaxResult trafficPeriodAnalysis(String startDate, String direction,String periodType ){ |
|
|
|
List<Map<String,String>> mapList = dcGantryStatisticsDataService.trafficPeriodAnalysis(startDate,direction,periodType); |
|
|
|
public AjaxResult trafficPeriodAnalysis(String startDate, String direction, String periodType) { |
|
|
|
List<Map<String, String>> mapList = dcGantryStatisticsDataService.trafficPeriodAnalysis(startDate, direction, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 车流量异常事件流量查询 |
|
|
|
* |
|
|
|
* @param eventId 事件id |
|
|
|
*/ |
|
|
|
@ApiOperation("车流量异常事件流量查询") |
|
|
|
@GetMapping("/history/eventtrafficflowcnt") |
|
|
|
public AjaxResult eventtrafficflowcnt(String eventId ) throws HttpException { |
|
|
|
public AjaxResult eventtrafficflowcnt(String eventId) throws HttpException { |
|
|
|
JSONArray mapList = dcTrafficStatisticsService.eventtrafficflowcnt(eventId); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 交通流统计分析重点数据查询交通流异常信息 |
|
|
|
*/ |
|
|
|
@ApiOperation("交通流统计分析重点数据查询交通流异常信息") |
|
|
|
@GetMapping("/history/exampleQueryTrafficFlowAnomalies") |
|
|
|
public AjaxResult exampleQueryTrafficFlowAnomalies(String startTime,String endTime ) throws HttpException { |
|
|
|
JSONArray mapList = dcTrafficStatisticsService.exampleQueryTrafficFlowAnomalies(startTime,endTime); |
|
|
|
public AjaxResult exampleQueryTrafficFlowAnomalies(String startTime, String endTime) throws HttpException { |
|
|
|
JSONArray mapList = dcTrafficStatisticsService.exampleQueryTrafficFlowAnomalies(startTime, endTime); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出车流量时段分析 |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param direction 方向 |
|
|
|
* @param periodType 时间粒子 |
|
|
|
*/ |
|
|
|
@ApiOperation(value="导出车流量时段分析",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出车流量时段分析", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportTrafficPeriodAnalysis") |
|
|
|
public void exportTrafficPeriodAnalysis(HttpServletResponse response,String startDate, String direction,String periodType ){ |
|
|
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(direction) || StringUtils.isEmpty(periodType)){ |
|
|
|
public void exportTrafficPeriodAnalysis(HttpServletResponse response, String startDate, String direction, String periodType) { |
|
|
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(direction) || StringUtils.isEmpty(periodType)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
String endDate = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)){ |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)) { |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_YEARS_MONTH_DAY.getValue()); |
|
|
|
LocalDate inputDate = LocalDate.parse(startDate, formatter); |
|
|
|
// 获取一年前的日期
|
|
|
|
LocalDate end = inputDate.minusYears(1); |
|
|
|
endDate = end.format(formatter); |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)) { |
|
|
|
String[] parts = startDate.split(UniversalEnum.SHORT_BAR.getValue()); |
|
|
|
int year = Integer.parseInt(parts[UniversalEnum.ZERO.getNumber()]); |
|
|
|
int month = Integer.parseInt(parts[UniversalEnum.ONE.getNumber()]); |
|
|
@ -357,31 +422,31 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
month = UniversalEnum.TWELVE.getNumber(); |
|
|
|
} |
|
|
|
endDate = String.format("%04d-%02d", year, month); |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)) { |
|
|
|
int year = Integer.parseInt(startDate) - UniversalEnum.ONE.getNumber(); |
|
|
|
endDate = String.valueOf(year); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<TrafficPeriodAnalysis> list = new ArrayList<>(); |
|
|
|
List<Map<String,String>> mapList = dcGantryStatisticsDataService.trafficPeriodAnalysis(startDate,direction,periodType); |
|
|
|
Map<String,String> mapData = new HashMap<>(); |
|
|
|
if (mapList != null && mapList.size() > UniversalEnum.ZERO.getNumber()){ |
|
|
|
List<Map<String, String>> mapList = dcGantryStatisticsDataService.trafficPeriodAnalysis(startDate, direction, periodType); |
|
|
|
Map<String, String> mapData = new HashMap<>(); |
|
|
|
if (mapList != null && mapList.size() > UniversalEnum.ZERO.getNumber()) { |
|
|
|
for (Map<String, String> item : mapList) { |
|
|
|
mapData.put(item.get("statisticalHour"),item.get("trafficVolume")); |
|
|
|
mapData.put(item.get("statisticalHour"), item.get("trafficVolume")); |
|
|
|
} |
|
|
|
} |
|
|
|
List<Map<String,String>> lastList = dcGantryStatisticsDataService.trafficPeriodAnalysis(endDate,direction,periodType); |
|
|
|
Map<String,String> lastData = new HashMap<>(); |
|
|
|
if (lastList != null && lastList.size() > UniversalEnum.ZERO.getNumber()){ |
|
|
|
List<Map<String, String>> lastList = dcGantryStatisticsDataService.trafficPeriodAnalysis(endDate, direction, periodType); |
|
|
|
Map<String, String> lastData = new HashMap<>(); |
|
|
|
if (lastList != null && lastList.size() > UniversalEnum.ZERO.getNumber()) { |
|
|
|
for (Map<String, String> item : lastList) { |
|
|
|
lastData.put(item.get("statisticalHour"),item.get("trafficVolume")); |
|
|
|
lastData.put(item.get("statisticalHour"), item.get("trafficVolume")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < UniversalEnum.TWENTY_FOUR.getNumber(); i++) { |
|
|
|
TrafficPeriodAnalysis trafficPeriodAnalysis = new TrafficPeriodAnalysis(); |
|
|
|
trafficPeriodAnalysis.setTime(i + "点至" + (i+UniversalEnum.ONE.getNumber()) + "点"); |
|
|
|
trafficPeriodAnalysis.setTime(i + "点至" + (i + UniversalEnum.ONE.getNumber()) + "点"); |
|
|
|
trafficPeriodAnalysis.setCurrentData(mapData.getOrDefault(String.valueOf(i), UniversalEnum.ZERO.getValue())); |
|
|
|
|
|
|
|
trafficPeriodAnalysis.setContemporaneousData(lastData.getOrDefault(String.valueOf(i), UniversalEnum.ZERO.getValue())); |
|
|
@ -394,25 +459,25 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
@ApiOperation("断面车流量排名") |
|
|
|
@GetMapping("/history/sectionTrafficRanking") |
|
|
|
public AjaxResult sectionTrafficRanking(String startDate, String direction,String periodType ){ |
|
|
|
List<Map<String, String>> dcStatisticsData = dcGantryStatisticsDataService.sectionTrafficRanking(startDate,direction,periodType); |
|
|
|
public AjaxResult sectionTrafficRanking(String startDate, String direction, String periodType) { |
|
|
|
List<Map<String, String>> dcStatisticsData = dcGantryStatisticsDataService.sectionTrafficRanking(startDate, direction, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(dcStatisticsData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 导出断面车流量排名 |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param direction 方向 |
|
|
|
* @param periodType 时间粒子 |
|
|
|
*/ |
|
|
|
@ApiOperation(value="导出断面车流量排名",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出断面车流量排名", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportSectionTrafficRanking") |
|
|
|
public void exportSectionTrafficRanking(HttpServletResponse response,String startDate, String direction,String periodType ){ |
|
|
|
public void exportSectionTrafficRanking(HttpServletResponse response, String startDate, String direction, String periodType) { |
|
|
|
List<SectionTrafficRanking> list = new ArrayList<>(); |
|
|
|
List<Map<String, String>> dcStatisticsData = dcGantryStatisticsDataService.sectionTrafficRanking(startDate,direction,periodType); |
|
|
|
List<Map<String, String>> dcStatisticsData = dcGantryStatisticsDataService.sectionTrafficRanking(startDate, direction, periodType); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < dcStatisticsData.size(); i++) { |
|
|
|
SectionTrafficRanking sectionTrafficRanking = new SectionTrafficRanking(); |
|
|
|
sectionTrafficRanking.setRank(i + UniversalEnum.ONE.getNumber()); |
|
|
@ -428,33 +493,33 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
/** |
|
|
|
* sectionTrafficIndexAnalysis |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param direction 方向 |
|
|
|
* @param periodType 时间粒子 |
|
|
|
* @param ranking 排名 1 饱和度 2拥挤度 3交通特征指数 |
|
|
|
* |
|
|
|
*/ |
|
|
|
@ApiOperation("路段交通指标分析") |
|
|
|
@GetMapping("/history/sectionTrafficIndexAnalysis") |
|
|
|
public AjaxResult sectionTrafficIndexAnalysis(String startDate, String direction,String periodType,Long ranking ){ |
|
|
|
List<Map<String, Object>> mapList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(startDate,direction,periodType,ranking); |
|
|
|
public AjaxResult sectionTrafficIndexAnalysis(String startDate, String direction, String periodType, Long ranking) { |
|
|
|
List<Map<String, Object>> mapList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(startDate, direction, periodType, ranking); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value="导出路段交通指标分析",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出路段交通指标分析", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportSectionTrafficIndexAnalysis") |
|
|
|
public void exportSectionTrafficIndexAnalysis(HttpServletResponse response,String startDate, String direction,String periodType,Long ranking){ |
|
|
|
public void exportSectionTrafficIndexAnalysis(HttpServletResponse response, String startDate, String direction, String periodType, Long ranking) { |
|
|
|
List<SectionTrafficIndexAnalysis> list = new ArrayList<>(); |
|
|
|
|
|
|
|
String endDate = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)){ |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)) { |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_YEARS_MONTH_DAY.getValue()); |
|
|
|
LocalDate inputDate = LocalDate.parse(startDate, formatter); |
|
|
|
// 获取一年前的日期
|
|
|
|
LocalDate end = inputDate.minusYears(1); |
|
|
|
endDate = end.format(formatter); |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)) { |
|
|
|
String[] parts = startDate.split(UniversalEnum.SHORT_BAR.getValue()); |
|
|
|
int year = Integer.parseInt(parts[UniversalEnum.ZERO.getNumber()]); |
|
|
|
int month = Integer.parseInt(parts[UniversalEnum.ONE.getNumber()]); |
|
|
@ -467,20 +532,20 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
month = UniversalEnum.TWELVE.getNumber(); |
|
|
|
} |
|
|
|
endDate = String.format("%04d-%02d", year, month); |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)) { |
|
|
|
int year = Integer.parseInt(startDate) - UniversalEnum.ONE.getNumber(); |
|
|
|
endDate = String.valueOf(year); |
|
|
|
} |
|
|
|
List<Map<String, Object>> thisYearList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(startDate,direction,periodType,ranking); |
|
|
|
Map<String,List<Map<String, Object>>> thisYearData = thisYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupName").toString())); |
|
|
|
List<Map<String, Object>> lastYearList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(endDate,direction,periodType,ranking); |
|
|
|
Map<String,List<Map<String, Object>>> lastYearData = lastYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupName").toString())); |
|
|
|
List<Map<String, Object>> thisYearList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(startDate, direction, periodType, ranking); |
|
|
|
Map<String, List<Map<String, Object>>> thisYearData = thisYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupName").toString())); |
|
|
|
List<Map<String, Object>> lastYearList = dcGantryMetricsStatisticsDataService.sectionTrafficIndexAnalysis(endDate, direction, periodType, ranking); |
|
|
|
Map<String, List<Map<String, Object>>> lastYearData = lastYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupName").toString())); |
|
|
|
|
|
|
|
for (StakeMarkRange value : StakeMarkRange.values()) { |
|
|
|
String sectionName = value.getDescription(); |
|
|
|
SectionTrafficIndexAnalysis sectionTrafficIndexAnalysis = new SectionTrafficIndexAnalysis(); |
|
|
|
sectionTrafficIndexAnalysis.setName(value.getDescription()); |
|
|
|
if (thisYearData != null && thisYearData.containsKey(sectionName)){ |
|
|
|
if (thisYearData != null && thisYearData.containsKey(sectionName)) { |
|
|
|
Map<String, Object> sectionData = thisYearData.get(sectionName).get(UniversalEnum.ZERO.getNumber()); |
|
|
|
sectionTrafficIndexAnalysis.setCrowdingRate(sectionData.get("crowdingRate").toString()); |
|
|
|
sectionTrafficIndexAnalysis.setSaturationRate(sectionData.get("saturationRate").toString()); |
|
|
@ -491,7 +556,7 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
sectionTrafficIndexAnalysis.setTrafficCompositionRate(UniversalEnum.ZERO.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
if (lastYearData != null && lastYearData.containsKey(sectionName)){ |
|
|
|
if (lastYearData != null && lastYearData.containsKey(sectionName)) { |
|
|
|
Map<String, Object> sectionData = lastYearData.get(sectionName).get(UniversalEnum.ZERO.getNumber()); |
|
|
|
sectionTrafficIndexAnalysis.setCrowdingRateLastYear(sectionData.get("crowdingRate").toString()); |
|
|
|
sectionTrafficIndexAnalysis.setSaturationRateLastYear(sectionData.get("saturationRate").toString()); |
|
|
@ -512,25 +577,25 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
@ApiOperation("通指标时间分布") |
|
|
|
@GetMapping("/history/passIndicatorTimeDistribution") |
|
|
|
public AjaxResult passIndicatorTimeDistribution(String startDate, String direction,String periodType ){ |
|
|
|
List<Map<String, Object>> mapList = dcGantryMetricsStatisticsDataService.passIndicatorTimeDistribution(startDate,direction,periodType); |
|
|
|
public AjaxResult passIndicatorTimeDistribution(String startDate, String direction, String periodType) { |
|
|
|
List<Map<String, Object>> mapList = dcGantryMetricsStatisticsDataService.passIndicatorTimeDistribution(startDate, direction, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value="导出交通指标时间分布",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出交通指标时间分布", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportPassIndicatorTimeDistribution") |
|
|
|
public void exportPassIndicatorTimeDistribution(HttpServletResponse response,String startDate, String direction,String periodType){ |
|
|
|
public void exportPassIndicatorTimeDistribution(HttpServletResponse response, String startDate, String direction, String periodType) { |
|
|
|
List<PassIndicatorTimeDistribution> list = new ArrayList<>(); |
|
|
|
|
|
|
|
String endDate = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)){ |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)) { |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_YEARS_MONTH_DAY.getValue()); |
|
|
|
LocalDate inputDate = LocalDate.parse(startDate, formatter); |
|
|
|
// 获取一年前的日期
|
|
|
|
LocalDate end = inputDate.minusYears(1); |
|
|
|
endDate = end.format(formatter); |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)) { |
|
|
|
String[] parts = startDate.split(UniversalEnum.SHORT_BAR.getValue()); |
|
|
|
int year = Integer.parseInt(parts[UniversalEnum.ZERO.getNumber()]); |
|
|
|
int month = Integer.parseInt(parts[UniversalEnum.ONE.getNumber()]); |
|
|
@ -543,40 +608,40 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
month = UniversalEnum.TWELVE.getNumber(); |
|
|
|
} |
|
|
|
endDate = String.format("%04d-%02d", year, month); |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)) { |
|
|
|
int year = Integer.parseInt(startDate) - UniversalEnum.ONE.getNumber(); |
|
|
|
endDate = String.valueOf(year); |
|
|
|
} |
|
|
|
List<Map<String, Object>> thisYearList = dcGantryMetricsStatisticsDataService.passIndicatorTimeDistribution(startDate,direction,periodType); |
|
|
|
Map<String,List<Map<String, Object>>> thisYearData = new HashMap<>(); |
|
|
|
List<Map<String, Object>> thisYearList = dcGantryMetricsStatisticsDataService.passIndicatorTimeDistribution(startDate, direction, periodType); |
|
|
|
Map<String, List<Map<String, Object>>> thisYearData = new HashMap<>(); |
|
|
|
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm"); |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)){ |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)) { |
|
|
|
thisYearData = thisYearList.stream().collect(Collectors.groupingBy(item -> { |
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(item.get("groupTime").toString(), inputFormatter); |
|
|
|
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("HH时"); |
|
|
|
return outputFormatter.format(dateTime); |
|
|
|
})); |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)) { |
|
|
|
thisYearData = thisYearList.stream().collect(Collectors.groupingBy(item -> { |
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(item.get("groupTime").toString(), inputFormatter); |
|
|
|
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("M月d日"); |
|
|
|
return dateTime.format(outputFormatter); |
|
|
|
})); |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)) { |
|
|
|
thisYearData = thisYearList.stream().collect(Collectors.groupingBy(item -> { |
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(item.get("groupTime").toString(), inputFormatter); |
|
|
|
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("M月"); |
|
|
|
return dateTime.format(outputFormatter); |
|
|
|
})); |
|
|
|
} |
|
|
|
List<Map<String, Object>> lastYearList = dcGantryMetricsStatisticsDataService.passIndicatorTimeDistribution(endDate,direction,periodType); |
|
|
|
Map<String,List<Map<String, Object>>> lastYearData = lastYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupTime").toString())); |
|
|
|
List<Map<String, Object>> lastYearList = dcGantryMetricsStatisticsDataService.passIndicatorTimeDistribution(endDate, direction, periodType); |
|
|
|
Map<String, List<Map<String, Object>>> lastYearData = lastYearList.stream().collect(Collectors.groupingBy(item -> item.get("groupTime").toString())); |
|
|
|
|
|
|
|
Set<String> allKey = new HashSet<>(); |
|
|
|
if (thisYearData != null){ |
|
|
|
if (thisYearData != null) { |
|
|
|
allKey.addAll(thisYearData.keySet()); |
|
|
|
} |
|
|
|
if (lastYearData != null){ |
|
|
|
if (lastYearData != null) { |
|
|
|
allKey.addAll(lastYearData.keySet()); |
|
|
|
} |
|
|
|
|
|
|
@ -586,12 +651,12 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
for (String key : keyList) { |
|
|
|
PassIndicatorTimeDistribution passIndicatorTimeDistribution = new PassIndicatorTimeDistribution(); |
|
|
|
passIndicatorTimeDistribution.setTime(key); |
|
|
|
if (thisYearData != null && thisYearData.containsKey(key)){ |
|
|
|
if (thisYearData != null && thisYearData.containsKey(key)) { |
|
|
|
Map<String, Object> sectionData = thisYearData.get(key).get(UniversalEnum.ZERO.getNumber()); |
|
|
|
passIndicatorTimeDistribution.setCrowdingRate(sectionData.get("crowdingRate").toString()); |
|
|
|
|
|
|
|
if (sectionData.get("saturationRate") instanceof Double){ |
|
|
|
double saturationRate = (Double)sectionData.get("saturationRate"); |
|
|
|
if (sectionData.get("saturationRate") instanceof Double) { |
|
|
|
double saturationRate = (Double) sectionData.get("saturationRate"); |
|
|
|
passIndicatorTimeDistribution.setSaturationRate(String.format("%.4f", saturationRate)); |
|
|
|
} else { |
|
|
|
passIndicatorTimeDistribution.setSaturationRate("0"); |
|
|
@ -600,18 +665,18 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
passIndicatorTimeDistribution.setTrafficCompositionRate(sectionData.get("trafficCompositionRate").toString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (lastYearData != null && lastYearData.containsKey(key)){ |
|
|
|
if (lastYearData != null && lastYearData.containsKey(key)) { |
|
|
|
Map<String, Object> sectionData = lastYearData.get(key).get(UniversalEnum.ZERO.getNumber()); |
|
|
|
passIndicatorTimeDistribution.setCrowdingRateLastYear(sectionData.get("crowdingRate").toString()); |
|
|
|
// passIndicatorTimeDistribution.setSaturationRateLastYear(sectionData.get("saturationRate").toString());
|
|
|
|
if (sectionData.get("saturationRate") instanceof Double){ |
|
|
|
double saturationRate = (Double)sectionData.get("saturationRate"); |
|
|
|
if (sectionData.get("saturationRate") instanceof Double) { |
|
|
|
double saturationRate = (Double) sectionData.get("saturationRate"); |
|
|
|
passIndicatorTimeDistribution.setSaturationRateLastYear(String.format("%.4f", saturationRate)); |
|
|
|
} else { |
|
|
|
passIndicatorTimeDistribution.setSaturationRateLastYear("0"); |
|
|
|
} |
|
|
|
passIndicatorTimeDistribution.setTrafficCompositionRateLastYear(sectionData.get("trafficCompositionRate").toString()); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
// 如果 lastYearData 不存在或者不包含 key,将所有字段设置为 "0"
|
|
|
|
passIndicatorTimeDistribution.setCrowdingRateLastYear("0"); |
|
|
|
passIndicatorTimeDistribution.setSaturationRateLastYear("0"); |
|
|
@ -627,25 +692,25 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
@ApiOperation("交通指标雷达图") |
|
|
|
@GetMapping("/history/radarMapOfTrafficIndicators") |
|
|
|
public AjaxResult radarMapOfTrafficIndicators(String startDate, String direction,String periodType ){ |
|
|
|
Map<String, Object> map = dcGantryMetricsStatisticsDataService.radarMapOfTrafficIndicators(startDate,direction,periodType); |
|
|
|
public AjaxResult radarMapOfTrafficIndicators(String startDate, String direction, String periodType) { |
|
|
|
Map<String, Object> map = dcGantryMetricsStatisticsDataService.radarMapOfTrafficIndicators(startDate, direction, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value="导出交通指标雷达图",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出交通指标雷达图", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportRadarMapOfTrafficIndicators") |
|
|
|
public void exportRadarMapOfTrafficIndicators(HttpServletResponse response,String startDate, String direction,String periodType,Long ranking){ |
|
|
|
public void exportRadarMapOfTrafficIndicators(HttpServletResponse response, String startDate, String direction, String periodType, Long ranking) { |
|
|
|
List<RadarMapOfTrafficIndicators> list = new ArrayList<>(); |
|
|
|
|
|
|
|
String endDate = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)){ |
|
|
|
if (UniversalEnum.FOUR.getValue().equals(periodType)) { |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_YEARS_MONTH_DAY.getValue()); |
|
|
|
LocalDate inputDate = LocalDate.parse(startDate, formatter); |
|
|
|
// 获取一年前的日期
|
|
|
|
LocalDate end = inputDate.minusYears(1); |
|
|
|
endDate = end.format(formatter); |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(periodType)) { |
|
|
|
String[] parts = startDate.split(UniversalEnum.SHORT_BAR.getValue()); |
|
|
|
int year = Integer.parseInt(parts[UniversalEnum.ZERO.getNumber()]); |
|
|
|
int month = Integer.parseInt(parts[UniversalEnum.ONE.getNumber()]); |
|
|
@ -658,12 +723,12 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
month = UniversalEnum.TWELVE.getNumber(); |
|
|
|
} |
|
|
|
endDate = String.format("%04d-%02d", year, month); |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)){ |
|
|
|
} else if (UniversalEnum.ONE.getValue().equals(periodType)) { |
|
|
|
int year = Integer.parseInt(startDate) - UniversalEnum.ONE.getNumber(); |
|
|
|
endDate = String.valueOf(year); |
|
|
|
} |
|
|
|
Map<String, Object> map = dcGantryMetricsStatisticsDataService.radarMapOfTrafficIndicators(startDate,direction,periodType); |
|
|
|
Map<String, Object> mapLastYear = dcGantryMetricsStatisticsDataService.radarMapOfTrafficIndicators(endDate,direction,periodType); |
|
|
|
Map<String, Object> map = dcGantryMetricsStatisticsDataService.radarMapOfTrafficIndicators(startDate, direction, periodType); |
|
|
|
Map<String, Object> mapLastYear = dcGantryMetricsStatisticsDataService.radarMapOfTrafficIndicators(endDate, direction, periodType); |
|
|
|
|
|
|
|
RadarMapOfTrafficIndicators radarMapOfTrafficIndicators = new RadarMapOfTrafficIndicators(); |
|
|
|
radarMapOfTrafficIndicators.setName("拥挤度"); |
|
|
@ -673,15 +738,15 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
radarMapOfTrafficIndicators = new RadarMapOfTrafficIndicators(); |
|
|
|
radarMapOfTrafficIndicators.setName("饱和度"); |
|
|
|
if (map.get("saturationRate") instanceof Double){ |
|
|
|
double saturationRate = (Double)map.get("saturationRate"); |
|
|
|
if (map.get("saturationRate") instanceof Double) { |
|
|
|
double saturationRate = (Double) map.get("saturationRate"); |
|
|
|
radarMapOfTrafficIndicators.setCurrentData(String.format("%.4f", saturationRate)); |
|
|
|
} else { |
|
|
|
radarMapOfTrafficIndicators.setCurrentData("0"); |
|
|
|
} |
|
|
|
|
|
|
|
if (mapLastYear.get("saturationRate") instanceof Double){ |
|
|
|
double saturationRate = (Double)mapLastYear.get("saturationRate"); |
|
|
|
if (mapLastYear.get("saturationRate") instanceof Double) { |
|
|
|
double saturationRate = (Double) mapLastYear.get("saturationRate"); |
|
|
|
radarMapOfTrafficIndicators.setContemporaneousData(String.format("%.4f", saturationRate)); |
|
|
|
} else { |
|
|
|
radarMapOfTrafficIndicators.setContemporaneousData("0"); |
|
|
@ -701,7 +766,7 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
@ApiOperation("综合指标查询") |
|
|
|
@GetMapping("/history/comprehensiveIndexQuery") |
|
|
|
public TableDataInfo comprehensiveIndexQuery(ComprehensiveIndexQuery comprehensiveIndexQuery){ |
|
|
|
public TableDataInfo comprehensiveIndexQuery(ComprehensiveIndexQuery comprehensiveIndexQuery) { |
|
|
|
startPage(); |
|
|
|
List<ComprehensiveIndexQuery> mapList = dcGantryMetricsStatisticsDataService.comprehensiveIndexQuery(comprehensiveIndexQuery); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
@ -712,8 +777,7 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
//@PreAuthorize("@ss.hasPermi('system:event:export')")
|
|
|
|
@Log(title = "导出综合指标", businessType = BusinessType.EXPORT) |
|
|
|
@PostMapping("/export") |
|
|
|
public void export(HttpServletResponse response, @RequestBody ComprehensiveIndexQuery comprehensiveIndexQuery) |
|
|
|
{ |
|
|
|
public void export(HttpServletResponse response, @RequestBody ComprehensiveIndexQuery comprehensiveIndexQuery) { |
|
|
|
List<ComprehensiveIndexQuery> list = dcGantryMetricsStatisticsDataService.comprehensiveIndexQuery(comprehensiveIndexQuery); |
|
|
|
ExcelUtil<ComprehensiveIndexQuery> util = new ExcelUtil<ComprehensiveIndexQuery>(ComprehensiveIndexQuery.class); |
|
|
|
util.exportExcel(response, list, UniversalEnum.EVENT_INFORMATION_DATA.getValue()); |
|
|
@ -727,7 +791,7 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
*/ |
|
|
|
@ApiOperation("获取门架交通特指数数据") |
|
|
|
@GetMapping("/history/gantry-metrics") |
|
|
|
public AjaxResult historyGantryMetrics(DcGantryMetricsStatisticsData request){ |
|
|
|
public AjaxResult historyGantryMetrics(DcGantryMetricsStatisticsData request) { |
|
|
|
// 调用服务层方法,根据请求条件查询历史车门架数据
|
|
|
|
List<DcGantryMetricsStatisticsData> dcStatisticsData = dcGantryMetricsStatisticsDataService.gantryMetricsData(request); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
@ -798,7 +862,6 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取车道占有率信息 |
|
|
|
* |
|
|
|
*/ |
|
|
|
@ApiOperation("获取车道占有率信息") |
|
|
|
@GetMapping("/history/lane-occupancy") |
|
|
@ -808,28 +871,32 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String |
|
|
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
|
|
|
return AjaxResult.success(jsonArray); |
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
/** |
|
|
|
* 断面小时车流量分车型 |
|
|
|
*/ |
|
|
|
@ApiOperation("断面小时车流量分车型") |
|
|
|
@GetMapping("/history/sectionHourlyTrafficFlow") |
|
|
|
public AjaxResult sectionHourlyTrafficFlow(String startDate, String endDate) throws HttpException, IOException { |
|
|
|
@ApiOperation("断面小时车流量分车型") |
|
|
|
@GetMapping("/history/sectionHourlyTrafficFlow") |
|
|
|
public AjaxResult sectionHourlyTrafficFlow(String startDate, String endDate) throws HttpException, IOException { |
|
|
|
// 调用服务层方法,获取当前交通指标数据
|
|
|
|
JSONArray jsonArray = dcTrafficStatisticsService.sectionHourlyTrafficFlow(startDate, endDate); |
|
|
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
|
|
|
return AjaxResult.success(jsonArray); |
|
|
|
|
|
|
|
}/** |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 各收费站入口分车型车流量 |
|
|
|
*/ |
|
|
|
@ApiOperation("各收费站入口分车型小时车流量") |
|
|
|
@GetMapping("/history/trafficFlowAtTollStationEntranceHour") |
|
|
|
public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String endDate,String stationType) throws HttpException, IOException { |
|
|
|
@ApiOperation("各收费站入口分车型小时车流量") |
|
|
|
@GetMapping("/history/trafficFlowAtTollStationEntranceHour") |
|
|
|
public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String endDate, String stationType) throws HttpException, IOException { |
|
|
|
// 调用服务层方法,获取当前交通指标数据
|
|
|
|
List<Map<String, String>> jsonArray = dcTrafficStatisticsService.trafficFlowAtTollStationEntrance(startDate, endDate, stationType); |
|
|
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
|
|
|
return AjaxResult.success(jsonArray); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 各收费站入口分车型车流量 |
|
|
|
*/ |
|
|
@ -854,7 +921,7 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
/** |
|
|
|
* 导出收费站出入口实时车流量 |
|
|
|
*/ |
|
|
|
@ApiOperation(value = "导出收费站出入口实时车流量",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出收费站出入口实时车流量", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportTrafficFlowAtTollStationEntranceHour") |
|
|
|
public void exportTrafficFlowAtTollStationEntranceHour(HttpServletResponse response) throws IOException, HttpException { |
|
|
|
|
|
|
@ -875,16 +942,16 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
|
|
|
|
// 本期入口
|
|
|
|
List<Map<String, String>> thisYearEntrance = dcTrafficStatisticsService.trafficFlowAtTollStationEntrance(now, now, "1"); |
|
|
|
Map<String,List<Map<String, String>>> thisYearEntranceData = new HashMap<>(); |
|
|
|
if (thisYearEntrance != null && thisYearEntrance.size() > 0){ |
|
|
|
Map<String, List<Map<String, String>>> thisYearEntranceData = new HashMap<>(); |
|
|
|
if (thisYearEntrance != null && thisYearEntrance.size() > 0) { |
|
|
|
thisYearEntranceData = thisYearEntrance.stream().collect(Collectors.groupingBy(item -> item.get("name"))); |
|
|
|
stationList.addAll(thisYearEntranceData.keySet()); |
|
|
|
} |
|
|
|
|
|
|
|
// 本期出口
|
|
|
|
List<Map<String, String>> thisYearExport = dcTrafficStatisticsService.trafficFlowAtTollStationEntrance(now, now, "2"); |
|
|
|
Map<String,List<Map<String, String>>> thisYearExportData = new HashMap<>(); |
|
|
|
if (thisYearExport != null && thisYearExport.size() > 0){ |
|
|
|
Map<String, List<Map<String, String>>> thisYearExportData = new HashMap<>(); |
|
|
|
if (thisYearExport != null && thisYearExport.size() > 0) { |
|
|
|
thisYearExportData = thisYearExport.stream().collect(Collectors.groupingBy(item -> item.get("name"))); |
|
|
|
stationList.addAll(thisYearExportData.keySet()); |
|
|
|
} |
|
|
@ -948,7 +1015,8 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = row.createCell(UniversalEnum.TWO.getNumber()); |
|
|
|
cell.setCellValue(UniversalEnum.EMPTY_STRING.getValue()); |
|
|
|
cell.setCellStyle(headerStyle);; |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
; |
|
|
|
cell = row.createCell(UniversalEnum.THREE.getNumber()); |
|
|
|
cell.setCellValue(UniversalEnum.EXIT.getValue()); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
@ -992,7 +1060,7 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
cell.setCellValue(station); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
|
|
|
|
if (thisYearEntranceData.containsKey(station)){ |
|
|
|
if (thisYearEntranceData.containsKey(station)) { |
|
|
|
cell = subHeaderRow.createCell(UniversalEnum.ONE.getNumber()); |
|
|
|
cell.setCellValue(thisYearEntranceData.get(station).get(0).get("value")); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
@ -1002,7 +1070,7 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
} |
|
|
|
|
|
|
|
if (lastYearEntranceData.containsKey(station)){ |
|
|
|
if (lastYearEntranceData.containsKey(station)) { |
|
|
|
cell = subHeaderRow.createCell(UniversalEnum.TWO.getNumber()); |
|
|
|
cell.setCellValue(lastYearEntranceData.get(station).get(0).get("value")); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
@ -1012,7 +1080,7 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
} |
|
|
|
|
|
|
|
if (thisYearExportData.containsKey(station)){ |
|
|
|
if (thisYearExportData.containsKey(station)) { |
|
|
|
cell = subHeaderRow.createCell(UniversalEnum.THREE.getNumber()); |
|
|
|
cell.setCellValue(thisYearExportData.get(station).get(0).get("value")); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
@ -1022,7 +1090,7 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
|
} |
|
|
|
|
|
|
|
if (lastYearExportData.containsKey(station)){ |
|
|
|
if (lastYearExportData.containsKey(station)) { |
|
|
|
cell = subHeaderRow.createCell(UniversalEnum.FOUR.getNumber()); |
|
|
|
cell.setCellValue(lastYearExportData.get(station).get(0).get("value")); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
@ -1035,7 +1103,7 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
} |
|
|
|
|
|
|
|
// 写入文件
|
|
|
|
try (ServletOutputStream outputStream = response.getOutputStream()){ |
|
|
|
try (ServletOutputStream outputStream = response.getOutputStream()) { |
|
|
|
workbook.write(outputStream); |
|
|
|
} finally { |
|
|
|
workbook.close(); |
|
|
@ -1044,52 +1112,57 @@ public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 各收费站入口分车型小时车流量 |
|
|
|
*/ |
|
|
|
@ApiOperation("各收费站入口分车型车流量") |
|
|
|
@GetMapping("/history/trafficFlowAtTollStationEntrance") |
|
|
|
public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endDate,String stationType) throws HttpException, IOException { |
|
|
|
@ApiOperation("各收费站入口分车型车流量") |
|
|
|
@GetMapping("/history/trafficFlowAtTollStationEntrance") |
|
|
|
public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endDate, String stationType) throws HttpException, IOException { |
|
|
|
// 调用服务层方法,获取当前交通指标数据
|
|
|
|
JSONArray jsonArray = dcTrafficStatisticsService.trafficFlowAtTollStationEntranceHour(startDate, endDate, stationType); |
|
|
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
|
|
|
return AjaxResult.success(jsonArray); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 全路段双向实时车流量 |
|
|
|
*/ |
|
|
|
@ApiOperation("全路段双向实时车流量") |
|
|
|
@GetMapping("/history/realTimeTrafficFlowHour") |
|
|
|
public AjaxResult realTimeTrafficFlowHour() throws HttpException, IOException{ |
|
|
|
Map<String,List<Map<String, Object>>> mapList = dcTrafficStatisticsService.realTimeTrafficFlowHour(); |
|
|
|
public AjaxResult realTimeTrafficFlowHour() throws HttpException, IOException { |
|
|
|
Map<String, List<Map<String, Object>>> mapList = dcTrafficStatisticsService.realTimeTrafficFlowHour(); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("按照桩号查询门架数据 ") |
|
|
|
@GetMapping("/history/queryTheGantryDataByPileNumber") |
|
|
|
public AjaxResult queryTheGantryDataByPileNumber(String startDate,String stakeMark) throws HttpException, IOException{ |
|
|
|
List<Map<String,Object>> mapList = dcTrafficStatisticsService.queryTheGantryDataByPileNumber(startDate,stakeMark); |
|
|
|
public AjaxResult queryTheGantryDataByPileNumber(String startDate, String stakeMark) throws HttpException, IOException { |
|
|
|
List<Map<String, Object>> mapList = dcTrafficStatisticsService.queryTheGantryDataByPileNumber(startDate, stakeMark); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取据库中 收费站统计数据 |
|
|
|
* |
|
|
|
* @param startDate 时间 |
|
|
|
* @param accessType 出入口 1入 2出 |
|
|
|
* @param periodType 方向 |
|
|
|
*/ |
|
|
|
@ApiOperation("获取据库中收费站数数据") |
|
|
|
@GetMapping("/history/TollBoothStatistics") |
|
|
|
public AjaxResult TollBoothStatistics(String startDate,String accessType,String periodType) throws HttpException, IOException{ |
|
|
|
List<Map<String, String>> mapList = dcTollStationStatisticsDataService.TollBoothStatistics(startDate,accessType,periodType); |
|
|
|
public AjaxResult TollBoothStatistics(String startDate, String accessType, String periodType) throws HttpException, IOException { |
|
|
|
List<Map<String, String>> mapList = dcTollStationStatisticsDataService.TollBoothStatistics(startDate, accessType, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("获取据库中收费站数数据") |
|
|
|
@GetMapping("/history/TollBoothStatisticsList") |
|
|
|
public AjaxResult TollBoothStatisticsList(String startDate, String accessType,String periodType) throws HttpException, IOException{ |
|
|
|
List<DcTollStationStatisticsDataMap> mapList = dcTollStationStatisticsDataService.TollBoothStatisticsList(startDate,accessType,periodType); |
|
|
|
public AjaxResult TollBoothStatisticsList(String startDate, String accessType, String periodType) throws HttpException, IOException { |
|
|
|
List<DcTollStationStatisticsDataMap> mapList = dcTollStationStatisticsDataService.TollBoothStatisticsList(startDate, accessType, periodType); |
|
|
|
// 将查询结果封装为成功响应并返回
|
|
|
|
return AjaxResult.success(mapList); |
|
|
|
} |
|
|
@ -1097,7 +1170,7 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
/** |
|
|
|
* 导出全路段双向实时车流量 |
|
|
|
*/ |
|
|
|
@ApiOperation(value = "导出全路段双向实时车流量",tags = {"ECharts导出"}) |
|
|
|
@ApiOperation(value = "导出全路段双向实时车流量", tags = {"ECharts导出"}) |
|
|
|
@GetMapping("/history/exportRealTimeTrafficFlowHour") |
|
|
|
public void exportRealTimeTrafficFlowHour(HttpServletResponse response) throws IOException, HttpException { |
|
|
|
|
|
|
@ -1106,12 +1179,12 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
String fileName = UniversalEnum.REAL_TIME_TRAFFIC_FLOW_IN_BOTH_DIRECTIONS_XLSX.name(); |
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + fileName); |
|
|
|
|
|
|
|
Map<String,List<Map<String,Object>>> map = dcTrafficStatisticsService.realTimeTrafficFlowHour(); |
|
|
|
if (map != null){ |
|
|
|
List<Map<String,Object>> thisYearHZ = map.get(UniversalEnum.ONE.getValue()); |
|
|
|
List<Map<String,Object>> thisYearJN = map.get(UniversalEnum.TWO.getValue()); |
|
|
|
List<Map<String,Object>> lastYearHZ = map.get(UniversalEnum.THREE.getValue()); |
|
|
|
List<Map<String,Object>> lastYearJN = map.get(UniversalEnum.FOUR.getValue()); |
|
|
|
Map<String, List<Map<String, Object>>> map = dcTrafficStatisticsService.realTimeTrafficFlowHour(); |
|
|
|
if (map != null) { |
|
|
|
List<Map<String, Object>> thisYearHZ = map.get(UniversalEnum.ONE.getValue()); |
|
|
|
List<Map<String, Object>> thisYearJN = map.get(UniversalEnum.TWO.getValue()); |
|
|
|
List<Map<String, Object>> lastYearHZ = map.get(UniversalEnum.THREE.getValue()); |
|
|
|
List<Map<String, Object>> lastYearJN = map.get(UniversalEnum.FOUR.getValue()); |
|
|
|
|
|
|
|
XSSFWorkbook workbook = new XSSFWorkbook(); // 创建工作簿
|
|
|
|
Sheet sheet = workbook.createSheet(UniversalEnum.THE_WHOLE_SECTION_TWO_WAY_REAL_TIME_TRAFFIC_FLOW.getValue()); // 创建工作表
|
|
|
@ -1157,7 +1230,8 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
cell = row.createCell(UniversalEnum.TWO.getNumber()); |
|
|
|
cell.setCellValue(UniversalEnum.EMPTY_STRING.getValue()); |
|
|
|
cell.setCellStyle(headerStyle);; |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
|
; |
|
|
|
cell = row.createCell(UniversalEnum.THREE.getNumber()); |
|
|
|
cell.setCellValue(UniversalEnum.DIRECTION_OF_HEZE.getValue()); |
|
|
|
cell.setCellStyle(headerStyle); |
|
|
@ -1194,7 +1268,7 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
sheet.addMergedRegion(new CellRangeAddress(UniversalEnum.ZERO.getNumber(), UniversalEnum.ZERO.getNumber(), UniversalEnum.THREE.getNumber(), UniversalEnum.FOUR.getNumber())); |
|
|
|
|
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < thisYearHZ.size(); i++) { |
|
|
|
Row subHeaderRow = sheet.createRow(i+UniversalEnum.TWO.getNumber()); |
|
|
|
Row subHeaderRow = sheet.createRow(i + UniversalEnum.TWO.getNumber()); |
|
|
|
cell = subHeaderRow.createCell(UniversalEnum.ZERO.getNumber()); |
|
|
|
cell.setCellValue(thisYearJN.get(i).get("name").toString()); |
|
|
|
cell.setCellStyle(dataStyle); |
|
|
@ -1214,7 +1288,7 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD |
|
|
|
|
|
|
|
|
|
|
|
// 写入文件
|
|
|
|
try (ServletOutputStream outputStream = response.getOutputStream()){ |
|
|
|
try (ServletOutputStream outputStream = response.getOutputStream()) { |
|
|
|
workbook.write(outputStream); |
|
|
|
} finally { |
|
|
|
workbook.close(); |
|
|
|