Browse Source

收费站管制分析接口修改

develop
lau572 1 year ago
parent
commit
bc96cbd19e
  1. 8
      zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java
  2. 15
      zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java
  3. 4
      zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java
  4. 26
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java
  5. 35
      zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml

8
zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java

@ -162,6 +162,8 @@ public class DcTrafficIncidentsController {
* *
* @author liuwenge * @author liuwenge
* @date 2024/1/15 17:31 * @date 2024/1/15 17:31
* @param searchType 查询条件(1:站点,2:原因)
* @param facilityIdList 站点id
* @param controlType 类型(1:封闭,2:限行) * @param controlType 类型(1:封闭,2:限行)
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
@ -169,10 +171,12 @@ public class DcTrafficIncidentsController {
*/ */
@ApiOperation("收费站统计分析table") @ApiOperation("收费站统计分析table")
@PostMapping("/selectTollStationAnalysis") @PostMapping("/selectTollStationAnalysis")
public AjaxResult selectTollStationAnalysis(@ApiParam(value="类型(1:封闭,2:限行)", name="controlType", required=true) @RequestParam ("controlType") String controlType, public AjaxResult selectTollStationAnalysis(@ApiParam(value="查询条件(1:站点,2:原因)", name="searchType", required=true) @RequestParam ("searchType") String searchType,
@ApiParam(value="站点id", name="facilityId", required=false) @RequestParam (name="facilityId",required = false) String[] facilityIdList,
@ApiParam(value="类型(1:封闭,2:限行)", name="controlType", required=false) @RequestParam (name="controlType",required = false) String controlType,
@ApiParam(value="开始时间", name="startTime", required=true) @RequestParam ("startTime") String startTime, @ApiParam(value="开始时间", name="startTime", required=true) @RequestParam ("startTime") String startTime,
@ApiParam(value="结束时间", name="endTime", required=true) @RequestParam ("endTime") String endTime){ @ApiParam(value="结束时间", name="endTime", required=true) @RequestParam ("endTime") String endTime){
return trafficIncidentsService.selectTollStationAnalysis(controlType,startTime,endTime); return trafficIncidentsService.selectTollStationAnalysis(searchType,facilityIdList,controlType,startTime,endTime);
} }
/** /**

15
zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java

@ -181,12 +181,25 @@ public interface DcTrafficIncidentsMapper {
* *
* @author liuwenge * @author liuwenge
* @date 2024/1/16 14:18 * @date 2024/1/16 14:18
* @param facilityIdList 站点id
* @param controlType 类型(1:封闭,2:限行) * @param controlType 类型(1:封闭,2:限行)
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>> * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
*/ */
List<Map<String,Object>> selectTollStationAnalysis(@Param("controlType") String controlType,@Param("startTime") String startTime,@Param("endTime") String endTime); List<Map<String,Object>> selectTollStationAnalysis(@Param("facilityIdList") String[] facilityIdList,@Param("controlType") String controlType,@Param("startTime") String startTime,@Param("endTime") String endTime);
/**
* @Description 收费站统计分析table 根据站点
*
* @author liuwenge
* @date 2024/2/6 15:18
* @param facilityIdList 站点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
*/
List<Map<String,Object>> selectTollStationAnalysisByFacility(@Param("facilityIdList") String[] facilityIdList,@Param("startTime") String startTime,@Param("endTime") String endTime);
/** /**
* @Description 收费站统计分析echarts * @Description 收费站统计分析echarts

4
zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java

@ -103,12 +103,14 @@ public interface IDcTrafficIncidentsService {
* @return com.ruoyi.common.core.domain.AjaxResult * @return com.ruoyi.common.core.domain.AjaxResult
* @Description 路网管控-事件管控分析-收费站统计分析table * @Description 路网管控-事件管控分析-收费站统计分析table
* @author liuwenge * @author liuwenge
* @param searchType 查询条件
* @param facilityIdList 站点id
* @param controlType 类型(1:封闭,2:限行) * @param controlType 类型(1:封闭,2:限行)
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @date 2024/1/15 17:31 * @date 2024/1/15 17:31
*/ */
AjaxResult selectTollStationAnalysis(String controlType,String startTime,String endTime); AjaxResult selectTollStationAnalysis(String searchType,String[] facilityIdList,String controlType,String startTime,String endTime);
/** /**
* @Description 路网管控-事件管控分析-收费站统计分析echarts(当月) * @Description 路网管控-事件管控分析-收费站统计分析echarts(当月)

26
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java

@ -2,6 +2,7 @@ package com.zc.business.service.impl;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StakeMarkUtils; import com.ruoyi.common.utils.StakeMarkUtils;
import com.ruoyi.common.utils.StringUtils;
import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcEventType; import com.zc.business.domain.DcEventType;
import com.zc.business.mapper.DcTrafficIncidentsMapper; import com.zc.business.mapper.DcTrafficIncidentsMapper;
@ -15,6 +16,7 @@ import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Year; import java.time.Year;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @Description 交通事件统计Service业务层处理 * @Description 交通事件统计Service业务层处理
@ -352,16 +354,29 @@ public class DcTrafficIncidentsServiceImpl implements IDcTrafficIncidentsService
* @Description 路网管控-事件管控分析-收费站统计分析table * @Description 路网管控-事件管控分析-收费站统计分析table
* @return com.ruoyi.common.core.domain.AjaxResult * @return com.ruoyi.common.core.domain.AjaxResult
* @author liuwenge * @author liuwenge
* @param searchType 查询条件
* @param facilityIdList 站点id
* @param controlType 类型(1:封闭,2:限行) * @param controlType 类型(1:封闭,2:限行)
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @date 2024/1/15 17:31 * @date 2024/1/15 17:31
*/ */
@Override @Override
public AjaxResult selectTollStationAnalysis(String controlType,String startTime,String endTime){ public AjaxResult selectTollStationAnalysis(String searchType,String[] facilityIdList,String controlType,String startTime,String endTime){
//站点
if ("1".equals(searchType)){
List<Map<String,Object>> list = trafficIncidentsMapper.selectTollStationAnalysisByFacility(facilityIdList,startTime,endTime);
return AjaxResult.success(list);
} else {
//原因
if (StringUtils.isEmpty(controlType)){
return AjaxResult.error("请选择事件类型");
}
//目标时段 //目标时段
List<Map<String,Object>> list = trafficIncidentsMapper.selectTollStationAnalysis(controlType,startTime,endTime); List<Map<String,Object>> list = trafficIncidentsMapper.selectTollStationAnalysis(facilityIdList,controlType,startTime,endTime);
BigDecimal allNum = BigDecimal.ZERO; BigDecimal allNum = BigDecimal.ZERO;
BigDecimal allTime = BigDecimal.ZERO; BigDecimal allTime = BigDecimal.ZERO;
for (Map<String, Object> data : list) { for (Map<String, Object> data : list) {
@ -401,7 +416,7 @@ public class DcTrafficIncidentsServiceImpl implements IDcTrafficIncidentsService
cal.add(Calendar.YEAR,-1); cal.add(Calendar.YEAR,-1);
String lastEndTime = dateFormat.format(cal.getTime()); String lastEndTime = dateFormat.format(cal.getTime());
List<Map<String,Object>> lastList = trafficIncidentsMapper.selectTollStationAnalysis(controlType,lastStartTime,lastEndTime); List<Map<String,Object>> lastList = trafficIncidentsMapper.selectTollStationAnalysis(facilityIdList,controlType,lastStartTime,lastEndTime);
BigDecimal lastAllNum = BigDecimal.ZERO; BigDecimal lastAllNum = BigDecimal.ZERO;
BigDecimal lastAllTime = BigDecimal.ZERO; BigDecimal lastAllTime = BigDecimal.ZERO;
@ -458,6 +473,11 @@ public class DcTrafficIncidentsServiceImpl implements IDcTrafficIncidentsService
return AjaxResult.success(list); return AjaxResult.success(list);
} }
}
private String customKey(Map<String,Object> map){
return map.get("facilityId").toString();
}
/** /**
* @Description 路网管控-事件管控分析-收费站统计分析echarts(当月) * @Description 路网管控-事件管控分析-收费站统计分析echarts(当月)

35
zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml

@ -225,15 +225,46 @@
then TIMESTAMPDIFF(MINUTE,t1.start_time,t1.end_time) then TIMESTAMPDIFF(MINUTE,t1.start_time,t1.end_time)
else 0 end) minuteTime else 0 end) minuteTime
from dc_event t1 LEFT JOIN dc_event_traffic_control t2 on t1.id = t2.id from dc_event t1 LEFT JOIN dc_event_traffic_control t2 on t1.id = t2.id
where <where>
t1.event_type = '3' and t1.event_subclass = '3-2' and t2.control_type = #{controlType} t1.event_type = '3' and t1.event_subclass = '3-2'
<if test="facilityIdList != null and facilityIdList.length > 0">
AND t2.facility_id in
<foreach collection="facilityIdList" item="facilityId" open="(" separator="," close=")">
#{facilityId}
</foreach>
</if>
and date_format(t1.start_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s') and date_format(t1.start_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
and (date_format(t1.end_time,'%Y-%m-%d %H:%i:%s') > date_format(#{startTime},'%Y-%m-%d %H:%i:%s') or ISNULL(t1.end_time)) and (date_format(t1.end_time,'%Y-%m-%d %H:%i:%s') > date_format(#{startTime},'%Y-%m-%d %H:%i:%s') or ISNULL(t1.end_time))
</where>
GROUP BY t2.control_cause,t2.cause_type) t4 GROUP BY t2.control_cause,t2.cause_type) t4
on t3.control_cause = t4.control_cause and t3.cause_type = t4.cause_type on t3.control_cause = t4.control_cause and t3.cause_type = t4.cause_type
ORDER BY t3.control_cause, t3.cause_type ORDER BY t3.control_cause, t3.cause_type
</select> </select>
<select id="selectTollStationAnalysisByFacility" resultType="java.util.Map">
select
t2.facility_id facilityId,t3.facility_name,classify,
SUM(case when t2.classify = '6' then 1 else 0 end) facilityClose,
SUM(case when t2.classify = '7' then 1 else 0 end) facilityRestriction,
SUM(case when t2.classify = '9' then 1 else 0 end) facilityInterval
from dc_event t1
LEFT JOIN dc_event_traffic_control t2 on t1.id = t2.id
LEFT JOIN dc_facility t3 on t3.id = t2.facility_id
<where>
t1.event_type = '3' and t1.event_subclass = '3-2'
and date_format(t1.start_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
and (date_format(t1.end_time,'%Y-%m-%d %H:%i:%s') > date_format(#{startTime},'%Y-%m-%d %H:%i:%s') or ISNULL(t1.end_time))
and t2.classify in ('6','7','9')
<if test="facilityIdList != null and facilityIdList.length > 0">
AND t2.facility_id in
<foreach collection="facilityIdList" item="facilityId" open="(" separator="," close=")">
#{facilityId}
</foreach>
</if>
</where>
GROUP BY t2.facility_id
</select>
<select id="getTollStationAnalysis" resultType="java.util.Map"> <select id="getTollStationAnalysis" resultType="java.util.Map">
select t3.facility_name facilityName,ifNull(t4.trafficClose,0) trafficClose, ifnull(t4.trafficRestriction,0) trafficRestriction select t3.facility_name facilityName,ifNull(t4.trafficClose,0) trafficClose, ifnull(t4.trafficRestriction,0) trafficRestriction
from from

Loading…
Cancel
Save