Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-dc into develop

develop
xiepufeng 6 months ago
parent
commit
c2a47fc53d
  1. 14
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 2
      zc-business/src/main/java/com/zc/business/controller/DcMetricsController.java
  3. 61
      zc-business/src/main/java/com/zc/business/controller/WordController.java
  4. 2
      zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java
  5. 2
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  6. 10
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  7. 29
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  8. 3
      zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml
  9. 3
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  10. 3
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

14
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -227,4 +227,18 @@ public class DcEventController extends BaseController
public AjaxResult getLinkEvent(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){
return dcEventService.getLinkEvent(eventId);
}
/**
* @Description 获取事件数量
*
* @author liuwenge
* @date 2024/6/6 18:45
* @param type
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@ApiOperation("获取事件数量")
@GetMapping( "/getCountNum/{type}")
public AjaxResult getCountNum(@ApiParam(name = "type", value = "类型 1:告警 2:待确认 3:处置中", required = true) @PathVariable("type") String type){
return dcEventService.getCountNum(type);
}
}

2
zc-business/src/main/java/com/zc/business/controller/DcMetricsController.java

@ -148,7 +148,7 @@ public class DcMetricsController {
// 如果昨天或前天的数据为空,则返回错误信息
if (yesterdayData == null || beforeYesterdayData == null) {
return AjaxResult.error("暂无数据");
return AjaxResult.success(null);
}
// 将数据放入列表并返回

61
zc-business/src/main/java/com/zc/business/controller/WordController.java

@ -2,8 +2,11 @@ package com.zc.business.controller;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcTollStationStatisticsData;
import com.zc.business.domain.DcTrafficSectionData;
import com.zc.business.enums.TrafficDataPeriodTypeEnum;
import com.zc.business.mapper.DcTrafficIncidentsMapper;
import com.zc.business.service.IDcTollStationStatisticsDataService;
import com.zc.business.utils.PoiUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -45,6 +48,9 @@ public class WordController {
@Autowired
private DcTrafficIncidentsMapper dcTrafficIncidentsMapper;
@Autowired
private IDcTollStationStatisticsDataService dcTollStationStatisticsDataService;
@PostMapping("/trafficSituationReport")
@ApiOperation("导出通行情况快报")
@ -506,15 +512,60 @@ public class WordController {
List<Map<String,Object>> trafficFlowList = new ArrayList<>();
Map<String,Object> trafficFlow = new HashMap<>();
trafficFlow.put("label","入口");
trafficFlow.put("num","0");
DcTollStationStatisticsData dcTollStationStatisticsData = new DcTollStationStatisticsData();
dcTollStationStatisticsData.setPeriodType(TrafficDataPeriodTypeEnum.DAY);
Calendar startCalendar = Calendar.getInstance();
startCalendar.set(Calendar.HOUR_OF_DAY, 0);
startCalendar.set(Calendar.MINUTE, 0);
startCalendar.set(Calendar.SECOND, 0);
startCalendar.set(Calendar.MILLISECOND, 0);
Date startTime = startCalendar.getTime();
dcTollStationStatisticsData.setStartTime(startTime);
Calendar endCalendar = Calendar.getInstance();
endCalendar.set(Calendar.HOUR_OF_DAY, 23);
endCalendar.set(Calendar.MINUTE, 59);
endCalendar.set(Calendar.SECOND, 59);
endCalendar.set(Calendar.MILLISECOND, 999);
Date emdTime = endCalendar.getTime();
dcTollStationStatisticsData.setEndTime(emdTime);
List<DcTollStationStatisticsData> statisticsDataList = dcTollStationStatisticsDataService.tollStationData(dcTollStationStatisticsData);
if (statisticsDataList != null && statisticsDataList.size() > 0){
Integer entrance = 0; //入口
Integer export = 0; //出口
for (DcTollStationStatisticsData tollStationStatisticsData : statisticsDataList) {
if (tollStationStatisticsData.getAccessType() == 1){
entrance = entrance + tollStationStatisticsData.getTrafficVolume();
} else if (tollStationStatisticsData.getAccessType() == 2){
export = export + tollStationStatisticsData.getTrafficVolume();
}
}
Map<String, Object> trafficFlow = new HashMap<>();
trafficFlow.put("label", "入口");
trafficFlow.put("num", entrance);
trafficFlowList.add(trafficFlow);
trafficFlow = new HashMap<>();
trafficFlow.put("label", "出口");
trafficFlow.put("num", export);
trafficFlowList.add(trafficFlow);
} else {
Map<String, Object> trafficFlow = new HashMap<>();
trafficFlow.put("label", "入口");
trafficFlow.put("num", "0");
trafficFlowList.add(trafficFlow);
trafficFlow = new HashMap<>();
trafficFlow.put("label","出口");
trafficFlow.put("num","0");
trafficFlow.put("label", "出口");
trafficFlow.put("num", "0");
trafficFlowList.add(trafficFlow);
}
if (trafficFlowList != null && trafficFlowList.size() > 0) {

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

@ -121,6 +121,8 @@ public interface DcEventMapper extends BaseMapper<DcEvent>
int selectClearInfo(String eventId);
List<DcEvent> dispatchRecordEventList(DcEvent dcEvent);
Long selectEventNumByStatus(@Param("status") String status);
}

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

@ -150,4 +150,6 @@ public interface DcWarningMapper
public String organizationName(Long id);
//事件id查询调度记录id
public HashMap selectDispatchId(@Param("eventId")String eventId);
Long selectWarningNum();
}

10
zc-business/src/main/java/com/zc/business/service/IDcEventService.java

@ -139,4 +139,14 @@ public interface IDcEventService
AjaxResult getLinkEvent(String eventId);
List<DcEvent> dispatchRecordEventList(DcEvent dcEvent);
/**
* @Description 获取事件数量
*
* @author liuwenge
* @date 2024/6/6 18:45
* @param type 类型 1:告警 2:待确认 3:处置中
* @return com.ruoyi.common.core.domain.AjaxResult
*/
AjaxResult getCountNum(String type);
}

29
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -1924,4 +1924,33 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
/**
* @Description 获取事件数量
*
* @author liuwenge
* @date 2024/6/6 18:45
* @param type 类型 1:告警 2:待确认 3:处置中
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@Override
public AjaxResult getCountNum(String type){
if (StringUtils.isEmpty(type)){
return AjaxResult.error("类型不能为空");
}
Long num = 0L;
//告警
if (type.equals("1")){
num = dcWarningMapper.selectWarningNum();
} else if (type.equals("2")){
num = dcEventMapper.selectEventNumByStatus("0");
} else if (type.equals("3")){
num = dcEventMapper.selectEventNumByStatus("1");
}
return AjaxResult.success(num);
}
}

3
zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml

@ -116,6 +116,9 @@
<where>
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
<if test="eventType != 0 "> and event_type = #{eventType}</if>
<if test="triggerMechanism != null and triggerMechanism != ''">
and trigger_mechanism =#{triggerMechanism}
</if>
</where>
order by t1.id desc
</select>

3
zc-business/src/main/resources/mapper/business/DcEventMapper.xml

@ -850,4 +850,7 @@
</otherwise>
</choose>
</select>
<select id="selectEventNumByStatus" resultType="java.lang.Long">
select count(*) from dc_event where event_state = #{status}
</select>
</mapper>

3
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -433,5 +433,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDispatchId" resultType="java.util.HashMap">
select id dispatchId from dc_dispatch where event_id=#{eventId}
</select>
<select id="selectWarningNum" resultType="java.lang.Long">
select count(*) from dc_warning where warning_state = 1 and warning_source != 6
</select>
</mapper>

Loading…
Cancel
Save