Browse Source

1.一类交调站数据优化平均车速

2.数据导出
develop
lau572 3 months ago
parent
commit
bc295a7ff3
  1. 16
      zc-business/src/main/java/com/zc/business/controller/DcTrafficSurveyDataController.java
  2. 46
      zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml

16
zc-business/src/main/java/com/zc/business/controller/DcTrafficSurveyDataController.java

@ -449,19 +449,35 @@ public class DcTrafficSurveyDataController extends BaseController
public AjaxResult selectComprehensiveData(@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams){
return dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams);
}
/**
* 导出综合查询
*/
@PostMapping("/exportComprehensiveData")
public void exportComprehensiveData(HttpServletResponse response,@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams)
{
AjaxResult ajaxResult = dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams);
if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) {
if (dcTrafficSurveyDataQueryParams.getDataType().equals("1")){
if (dcTrafficSurveyDataQueryParams.getDirection().equals("2")) {
List<DcTrafficVolumeData> dcTrafficVolumeData = (List<DcTrafficVolumeData>) ajaxResult.get("data");
ExcelUtil<DcTrafficVolumeData> util = new ExcelUtil<>(DcTrafficVolumeData.class);
util.exportExcel(response, dcTrafficVolumeData, "综合查询");
} else if (dcTrafficSurveyDataQueryParams.getDirection().equals("1")) {
List<DcTrafficVolumeDirectionData> dcTrafficVolumeData = (List<DcTrafficVolumeDirectionData>) ajaxResult.get("data");
ExcelUtil<DcTrafficVolumeDirectionData> util = new ExcelUtil<>(DcTrafficVolumeDirectionData.class);
util.exportExcel(response, dcTrafficVolumeData, "综合查询");
}
} else {
if (dcTrafficSurveyDataQueryParams.getDirection().equals("2")) {
List<DcTrafficSpeedData> dcTrafficSpeedData = (List<DcTrafficSpeedData>) ajaxResult.get("data");
ExcelUtil<DcTrafficSpeedData> util = new ExcelUtil<>(DcTrafficSpeedData.class);
util.exportExcel(response, dcTrafficSpeedData, "综合查询");
} else if (dcTrafficSurveyDataQueryParams.getDirection().equals("1")) {
List<DcTrafficSpeedDirectionData> dcTrafficSpeedData = (List<DcTrafficSpeedDirectionData>) ajaxResult.get("data");
ExcelUtil<DcTrafficSpeedDirectionData> util = new ExcelUtil<>(DcTrafficSpeedDirectionData.class);
util.exportExcel(response, dcTrafficSpeedData, "综合查询");
}
}
}
}

46
zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml

@ -107,9 +107,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSpeed" resultType="com.zc.business.domain.DcTrafficSpeedData">
select *,
round((t1.inAndSmallAverageVehicleSpeed + t1.averageSpeedOfBus + t1.smallTrucksAverageVehicleSpeed +
t1.averageSpeedOfMediumSizeTrucks + t1.averageSpeedOfLargeTrucks + t1.averageSpeedOfExtraLargeTrucks +
t1.averageSpeedOfContainerTruck + t1.averageSpeedOfMotorcycle + t1.averageSpeedOfTractor) / 9, 0) avgSpeed
ROUND(
(
t1.inAndSmallAverageVehicleSpeed +
t1.averageSpeedOfBus +
t1.smallTrucksAverageVehicleSpeed +
t1.averageSpeedOfMediumSizeTrucks +
t1.averageSpeedOfLargeTrucks +
t1.averageSpeedOfExtraLargeTrucks +
t1.averageSpeedOfContainerTruck +
t1.averageSpeedOfMotorcycle +
t1.averageSpeedOfTractor
) /
NULLIF(
CASE WHEN t1.inAndSmallAverageVehicleSpeed = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfBus = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.smallTrucksAverageVehicleSpeed = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfMediumSizeTrucks = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfLargeTrucks = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfExtraLargeTrucks = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfContainerTruck = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfMotorcycle = 0 THEN 0 ELSE 1 END +
CASE WHEN t1.averageSpeedOfTractor = 0 THEN 0 ELSE 1 END,
0
)
,0) AS avgSpeed
from
(select direction,
<choose>
@ -123,15 +145,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
date_format(`timestamp`, '%Y-%m')
</when>
</choose> time,
round(avg(in_and_small_average_vehicle_speed),0) inAndSmallAverageVehicleSpeed,
round(avg(average_speed_of_bus),0) averageSpeedOfBus,
round(avg(small_trucks_average_vehicle_speed),0) smallTrucksAverageVehicleSpeed,
round(avg(average_speed_of_medium_size_trucks),0) averageSpeedOfMediumSizeTrucks,
round(avg(average_speed_of_large_trucks),0) averageSpeedOfLargeTrucks,
round(avg(average_speed_of_extra_large_trucks),0) averageSpeedOfExtraLargeTrucks,
round(avg(average_speed_of_container_truck),0) averageSpeedOfContainerTruck,
round(avg(average_speed_of_motorcycle),0) averageSpeedOfMotorcycle,
round(avg(average_speed_of_tractor),0) averageSpeedOfTractor
ROUND(IFNULL(AVG(NULLIF(in_and_small_average_vehicle_speed, 0)),0), 0) AS inAndSmallAverageVehicleSpeed,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_bus, 0)),0), 0) AS averageSpeedOfBus,
ROUND(IFNULL(AVG(NULLIF(small_trucks_average_vehicle_speed, 0)),0), 0) AS smallTrucksAverageVehicleSpeed,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_medium_size_trucks, 0)),0), 0) AS averageSpeedOfMediumSizeTrucks,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_large_trucks, 0)),0), 0) AS averageSpeedOfLargeTrucks,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_extra_large_trucks, 0)),0), 0) AS averageSpeedOfExtraLargeTrucks,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_container_truck, 0)),0), 0) AS averageSpeedOfContainerTruck,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_motorcycle, 0)),0), 0) AS averageSpeedOfMotorcycle,
ROUND(IFNULL(AVG(NULLIF(average_speed_of_tractor, 0)),0), 0) AS averageSpeedOfTractor
FROM `dc_traffic_survey_data`
<where>
<if test="iotDeviceId != null and iotDeviceId != ''">

Loading…
Cancel
Save