Browse Source

综合指标查询

develop
王兴琳 5 months ago
parent
commit
54d63e8789
  1. 23
      zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java
  2. 36
      zc-business/src/main/java/com/zc/business/domain/ComprehensiveIndexQuery.java
  3. 2
      zc-business/src/main/java/com/zc/business/mapper/DcGantryMetricsStatisticsDataMapper.java
  4. 3
      zc-business/src/main/java/com/zc/business/service/IDcGantryMetricsStatisticsDataService.java
  5. 69
      zc-business/src/main/resources/mapper/business/DcGantryMetricsStatisticsDataMapper.xml

23
zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java

@ -1,9 +1,12 @@
package com.zc.business.controller;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.*;
import com.zc.business.request.DcTrafficMetricsDataRequest;
import com.zc.business.request.DcTrafficSectionDataRequest;
@ -14,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -248,8 +252,25 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String
// 将查询结果封装为成功响应并返回
return AjaxResult.success(map);
}
@ApiOperation("综合指标查询")
@GetMapping("/history/comprehensiveIndexQuery")
public TableDataInfo comprehensiveIndexQuery(ComprehensiveIndexQuery comprehensiveIndexQuery){
startPage();
List<ComprehensiveIndexQuery> mapList = dcGantryMetricsStatisticsDataService.comprehensiveIndexQuery(comprehensiveIndexQuery);
// 将查询结果封装为成功响应并返回
return getDataTable(mapList);
}
@ApiOperation("导出综合指标")
//@PreAuthorize("@ss.hasPermi('system:event:export')")
@Log(title = "导出综合指标", businessType = BusinessType.EXPORT)
@PostMapping("/export")
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, "事件信息数据");
}
/**
* 获取门架指标统计数据

36
zc-business/src/main/java/com/zc/business/domain/ComprehensiveIndexQuery.java

@ -0,0 +1,36 @@
package com.zc.business.domain;
import com.ruoyi.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ComprehensiveIndexQuery {
@Excel(name = "路段名称")
private String intervalName;
private String stakeMake;
private String endMake;
private String facilityCode;
private String facilityName;
private String direction;
@Excel(name = "饱和度")
private Float saturationRate;
@Excel(name = "交通组成特征指数(大车占比", readConverterExp = "1=低,2=中,3=高")
private Integer trafficCompositionRate;
@Excel(name = "统计时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date statisticalDate;
@Excel(name = "拥堵度", readConverterExp = "1=畅通,2=基本畅通,3=轻度拥堵 ,4=中度拥堵,5=重度拥堵")
private Integer crowdingRate;
private Integer periodType;
private String startDate;
}

2
zc-business/src/main/java/com/zc/business/mapper/DcGantryMetricsStatisticsDataMapper.java

@ -1,6 +1,7 @@
package com.zc.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zc.business.domain.ComprehensiveIndexQuery;
import com.zc.business.domain.DcGantryMetricsStatisticsData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -35,4 +36,5 @@ public interface DcGantryMetricsStatisticsDataMapper extends BaseMapper<DcGantry
List<Map<String, Object>> sectionTrafficIndexAnalysis(@Param("startDate") String startDate, @Param("direction") String direction,@Param("periodType") String periodType);
List<Map<String, Object>> radarMapOfTrafficIndicators(@Param("startDate") String startDate, @Param("direction") String direction,@Param("periodType") String periodType);
List<ComprehensiveIndexQuery> comprehensiveIndexQuery(ComprehensiveIndexQuery comprehensiveIndexQuery);
}

3
zc-business/src/main/java/com/zc/business/service/IDcGantryMetricsStatisticsDataService.java

@ -1,6 +1,7 @@
package com.zc.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zc.business.domain.ComprehensiveIndexQuery;
import com.zc.business.domain.DcGantryMetricsStatisticsData;
import com.zc.business.domain.DcGantryMetricsStatisticsData;
import com.zc.business.domain.DcGantryMetricsStatisticsData;
@ -46,4 +47,6 @@ public interface IDcGantryMetricsStatisticsDataService extends IService<DcGantry
List<Map<String, Object>> passIndicatorTimeDistribution(String startDate, String direction, String periodType);
Map<String, Object> radarMapOfTrafficIndicators(String startDate, String direction, String periodType);
List<ComprehensiveIndexQuery> comprehensiveIndexQuery(ComprehensiveIndexQuery comprehensiveIndexQuery);
}

69
zc-business/src/main/resources/mapper/business/DcGantryMetricsStatisticsDataMapper.xml

@ -14,6 +14,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="saturationRate" column="saturation_rate"/>
<result property="statisticalDate" column="statistical_date"/>
</resultMap>
<resultMap type="com.zc.business.domain.ComprehensiveIndexQuery" id="ComprehensiveIndexQuery" >
<result property="facilityName" column="facility_name"/>
<result property="intervalName" column="interval_name"/>
<result property="direction" column="direction"/>
<result property="stakeMake" column="stake_make"/>
<result property="trafficCompositionRate" column="traffic_composition_rate"/>
<result property="facilityName" column="facility_name"/>
<result property="saturationRate" column="saturation_rate"/>
<result property="statisticalDate" column="statistical_date"/>
<result property="crowdingRate" column="crowding_rate"/>
<result property="facilityCode" column="facility_code"/>
</resultMap>
<!-- 插入或更新门架指标数据 -->
<insert id="insertOrUpdate" parameterType="com.zc.business.domain.DcGantryMetricsStatisticsData">
INSERT INTO
@ -145,5 +157,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND fa.direction = #{direction}
AND dg.period_type = #{periodType}
</select>
<select id="comprehensiveIndexQuery" resultMap="ComprehensiveIndexQuery" parameterType="com.zc.business.domain.ComprehensiveIndexQuery" >
SELECT
i.interval_name,
i.stake_make ,
i.end_make,
ps.facility_code ,
ps.facility_name ,
ps.direction ,
dgsd.saturation_rate as saturation_rate,
dgsd.traffic_composition_rate as traffic_composition_rate,
dgsd.statistical_date as statistical_date,
dgsd.crowding_rate
FROM
(
SELECT 'K054+394' AS stake_make, 'K059+289' AS end_make, '殷家林枢纽-大学城立交' AS interval_name UNION ALL
SELECT 'K059+289', 'K072+847', '大学城立交-长清立交' UNION ALL
SELECT 'K072+847', 'K083+835', '长清立交-松竹枢纽' UNION ALL
SELECT 'K083+835', 'K086+499', '松竹枢纽-孝里立交' UNION ALL
SELECT 'K086+499', 'K099+750', '孝里立交-平阴北立交' UNION ALL
SELECT 'K099+750', 'K105+904', '平阴北立交-平阴立交' UNION ALL
SELECT 'K105+904', 'K117+878', '平阴立交-孔村枢纽' UNION ALL
SELECT 'K117+878', 'K126+233', '孔村枢纽-平阴南立交' UNION ALL
SELECT 'K126+233', 'K145+933', '平阴南立交-东平立交' UNION ALL
SELECT 'K145+933', 'K155+652', '东平立交-东平湖枢纽' UNION ALL
SELECT 'K155+652', 'K173+950', '东平湖枢纽-梁山东立交' UNION ALL
SELECT 'K173+950', 'K179+396', '梁山东立交-梁山立交' UNION ALL
SELECT 'K179+396', 'K190+495', '梁山立交-嘉祥西立交' UNION ALL
SELECT 'K190+495', 'K202+979', '嘉祥西立交-王官屯枢纽'
) AS i
JOIN dc_facility AS ps
ON ps.stake_mark BETWEEN CONCAT(i.stake_make, '+0') AND CONCAT(i.end_make, '+0')
<if test="direction !=null">
AND ps.direction = #{direction}
</if>
<if test="intervalName !=null">
AND i.interval_name=#{intervalName}
</if>
JOIN dc_gantry_metrics_statistics_data AS dgsd
ON ps.facility_code = dgsd.gantry_code
AND
<if test="periodType == 1">
YEAR(dgsd.statistical_date) = #{startDate}
</if>
<if test="periodType == 3">
DATE_FORMAT(dgsd.statistical_date, '%Y-%m') = #{startDate}
</if>
<if test="periodType == 4">
DATE(dgsd.statistical_date) = DATE(#{startDate})
</if>
<if test="periodType == 5">
DATE(dgsd.statistical_date) = DATE(#{startDate})
</if>
AND dgsd.period_type = #{periodType}
ORDER BY
dgsd.statistical_date DESC
</select>
</mapper>

Loading…
Cancel
Save