Browse Source

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

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

28
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){ public AjaxResult selectComprehensiveData(@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams){
return dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams); return dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams);
} }
/**
* 导出综合查询
*/
@PostMapping("/exportComprehensiveData") @PostMapping("/exportComprehensiveData")
public void exportComprehensiveData(HttpServletResponse response,@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams) public void exportComprehensiveData(HttpServletResponse response,@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams)
{ {
AjaxResult ajaxResult = dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams); AjaxResult ajaxResult = dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams);
if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) {
if (dcTrafficSurveyDataQueryParams.getDataType().equals("1")){ if (dcTrafficSurveyDataQueryParams.getDataType().equals("1")){
List<DcTrafficVolumeData> dcTrafficVolumeData = (List<DcTrafficVolumeData>) ajaxResult.get("data"); if (dcTrafficSurveyDataQueryParams.getDirection().equals("2")) {
ExcelUtil<DcTrafficVolumeData> util = new ExcelUtil<>(DcTrafficVolumeData.class); List<DcTrafficVolumeData> dcTrafficVolumeData = (List<DcTrafficVolumeData>) ajaxResult.get("data");
util.exportExcel(response, dcTrafficVolumeData, "综合查询"); 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 { } else {
List<DcTrafficSpeedData> dcTrafficSpeedData = (List<DcTrafficSpeedData>) ajaxResult.get("data"); if (dcTrafficSurveyDataQueryParams.getDirection().equals("2")) {
ExcelUtil<DcTrafficSpeedData> util = new ExcelUtil<>(DcTrafficSpeedData.class); List<DcTrafficSpeedData> dcTrafficSpeedData = (List<DcTrafficSpeedData>) ajaxResult.get("data");
util.exportExcel(response, dcTrafficSpeedData, "综合查询"); 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 id="selectSpeed" resultType="com.zc.business.domain.DcTrafficSpeedData">
select *, select *,
round((t1.inAndSmallAverageVehicleSpeed + t1.averageSpeedOfBus + t1.smallTrucksAverageVehicleSpeed + ROUND(
t1.averageSpeedOfMediumSizeTrucks + t1.averageSpeedOfLargeTrucks + t1.averageSpeedOfExtraLargeTrucks + (
t1.averageSpeedOfContainerTruck + t1.averageSpeedOfMotorcycle + t1.averageSpeedOfTractor) / 9, 0) avgSpeed 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 from
(select direction, (select direction,
<choose> <choose>
@ -123,15 +145,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
date_format(`timestamp`, '%Y-%m') date_format(`timestamp`, '%Y-%m')
</when> </when>
</choose> time, </choose> time,
round(avg(in_and_small_average_vehicle_speed),0) inAndSmallAverageVehicleSpeed, ROUND(IFNULL(AVG(NULLIF(in_and_small_average_vehicle_speed, 0)),0), 0) AS inAndSmallAverageVehicleSpeed,
round(avg(average_speed_of_bus),0) averageSpeedOfBus, ROUND(IFNULL(AVG(NULLIF(average_speed_of_bus, 0)),0), 0) AS averageSpeedOfBus,
round(avg(small_trucks_average_vehicle_speed),0) smallTrucksAverageVehicleSpeed, ROUND(IFNULL(AVG(NULLIF(small_trucks_average_vehicle_speed, 0)),0), 0) AS smallTrucksAverageVehicleSpeed,
round(avg(average_speed_of_medium_size_trucks),0) averageSpeedOfMediumSizeTrucks, ROUND(IFNULL(AVG(NULLIF(average_speed_of_medium_size_trucks, 0)),0), 0) AS averageSpeedOfMediumSizeTrucks,
round(avg(average_speed_of_large_trucks),0) averageSpeedOfLargeTrucks, ROUND(IFNULL(AVG(NULLIF(average_speed_of_large_trucks, 0)),0), 0) AS averageSpeedOfLargeTrucks,
round(avg(average_speed_of_extra_large_trucks),0) averageSpeedOfExtraLargeTrucks, ROUND(IFNULL(AVG(NULLIF(average_speed_of_extra_large_trucks, 0)),0), 0) AS averageSpeedOfExtraLargeTrucks,
round(avg(average_speed_of_container_truck),0) averageSpeedOfContainerTruck, ROUND(IFNULL(AVG(NULLIF(average_speed_of_container_truck, 0)),0), 0) AS averageSpeedOfContainerTruck,
round(avg(average_speed_of_motorcycle),0) averageSpeedOfMotorcycle, ROUND(IFNULL(AVG(NULLIF(average_speed_of_motorcycle, 0)),0), 0) AS averageSpeedOfMotorcycle,
round(avg(average_speed_of_tractor),0) averageSpeedOfTractor ROUND(IFNULL(AVG(NULLIF(average_speed_of_tractor, 0)),0), 0) AS averageSpeedOfTractor
FROM `dc_traffic_survey_data` FROM `dc_traffic_survey_data`
<where> <where>
<if test="iotDeviceId != null and iotDeviceId != ''"> <if test="iotDeviceId != null and iotDeviceId != ''">

Loading…
Cancel
Save