|
|
|
package com.zc.business.controller;
|
|
|
|
|
|
|
|
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.utils.poi.ExcelUtil;
|
|
|
|
import com.zc.business.domain.DcWarning;
|
|
|
|
import com.zc.business.domain.export.*;
|
|
|
|
import com.zc.business.enums.UniversalEnum;
|
|
|
|
import com.zc.business.service.IDCPerceivedEventsWarningService;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author 王思祥
|
|
|
|
* @ClassName DCPerceivedEventsWarningController
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/perceivedEvents/warning")
|
|
|
|
|
|
|
|
public class DCPerceivedEventsWarningController extends BaseController {
|
|
|
|
@Autowired
|
|
|
|
private IDCPerceivedEventsWarningService perceivedEventsWarningService;
|
|
|
|
//查询预警表与历史表所有感知事件的数量
|
|
|
|
@PostMapping("/warningTotal")
|
|
|
|
public AjaxResult getPerceivedEventsWarning(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.perceivedEventsWarningNum());
|
|
|
|
}
|
|
|
|
|
|
|
|
//感知事件类型
|
|
|
|
@PostMapping("/evenType")
|
|
|
|
public AjaxResult getEvenTypeList(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectEventTypeList());
|
|
|
|
}
|
|
|
|
//感知事件详情
|
|
|
|
@PostMapping("/getWarningById")
|
|
|
|
public AjaxResult getWarningById(@RequestBody DcWarning dcWarning){
|
|
|
|
String id = dcWarning.getId();
|
|
|
|
if (id==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectWarningById(id));
|
|
|
|
}
|
|
|
|
//告警事件列表
|
|
|
|
@PostMapping("/perceivedEventsList")
|
|
|
|
public TableDataInfo getPerceivedEventsList(@RequestBody DcWarning dcWarning){
|
|
|
|
startPage();
|
|
|
|
List<DcWarning> list = perceivedEventsWarningService.selectPerceivedEventsList(dcWarning);
|
|
|
|
return getDataTable(list);
|
|
|
|
}
|
|
|
|
//非机预警列表
|
|
|
|
@PostMapping("/nonAutomaticWarningList")
|
|
|
|
public TableDataInfo nonAutomaticWarningList(@RequestBody DcWarning dcWarning){
|
|
|
|
startPage();
|
|
|
|
List<DcWarning> list = perceivedEventsWarningService.selectNonAutomaticWarningList(dcWarning);
|
|
|
|
return getDataTable(list);
|
|
|
|
}
|
|
|
|
//首页感知事件列表
|
|
|
|
@PostMapping("/warningList")
|
|
|
|
public AjaxResult getWarningList(@RequestBody DcWarning dcWarning){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectWarningList(dcWarning));
|
|
|
|
}
|
|
|
|
//首页感知事件列表分页
|
|
|
|
@PostMapping("/warningListPage")
|
|
|
|
public TableDataInfo getWarningListPage(@RequestBody DcWarning dcWarning){
|
|
|
|
startPage();
|
|
|
|
return getDataTable(perceivedEventsWarningService.selectWarningList(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询感知数量按照路段进行区分
|
|
|
|
@PostMapping("/sectionPerceivedNumber")
|
|
|
|
public AjaxResult getSectionPerceivedNumber(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectSectionPerceivedNumber());
|
|
|
|
}
|
|
|
|
//查询当前日,日累计感知事件,按照小时进行分组
|
|
|
|
@PostMapping("/dailyCumulative")
|
|
|
|
public AjaxResult getDailyCumulative(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectDailyCumulative());
|
|
|
|
}
|
|
|
|
//查询当前月,月累计感知事件,按照小时段进行分组
|
|
|
|
@PostMapping("/dailyCumulativeMonth")
|
|
|
|
public AjaxResult getDailyCumulativeMonth(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectDailyCumulativeMonth());
|
|
|
|
}
|
|
|
|
//按事件源统计感知事件统计信息
|
|
|
|
@PostMapping("/warningSourceGroup")
|
|
|
|
public AjaxResult getWarningSourceGroup(){
|
|
|
|
HashMap<Object, Object> map = new HashMap<>();
|
|
|
|
List<HashMap<String, Object>> mapList = perceivedEventsWarningService.selectWarningSourceGroup();
|
|
|
|
String total = perceivedEventsWarningService.selectWarningSourceGroupCount();
|
|
|
|
map.put("warningSourceList", mapList);
|
|
|
|
map.put("total", total);
|
|
|
|
return AjaxResult.success(map);
|
|
|
|
}
|
|
|
|
//当日感知事件的处置情况占比
|
|
|
|
@PostMapping("/warningStateDay")
|
|
|
|
public AjaxResult getWarningStateDay(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectWarningStateDay());
|
|
|
|
}
|
|
|
|
//感知事件类型占比
|
|
|
|
@PostMapping("/warningTypeDay")
|
|
|
|
public AjaxResult getWarningTypeDay(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectWarningTypeDay());
|
|
|
|
}
|
|
|
|
|
|
|
|
//某一路段某一时间段的感知事件趋势
|
|
|
|
@PostMapping("/warningTrend")
|
|
|
|
public AjaxResult getWarningTrend(@RequestBody DcWarning dcWarning){
|
|
|
|
String type = dcWarning.getType();//类型
|
|
|
|
String sectionId = dcWarning.getSectionId();//路段辖区id
|
|
|
|
String direction = dcWarning.getDirection();//方向
|
|
|
|
if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||StringUtils.isBlank(direction)){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_DATA_EXCEPTION.getValue());
|
|
|
|
}
|
|
|
|
if (!UniversalEnum.LOWERCASE_DAY.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_MONTH.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_YEAR.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_QUARTER.getValue().equals(type)) {
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (type.equals(UniversalEnum.LOWERCASE_QUARTER.getValue())&&dcWarning.getQuarter()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (!UniversalEnum.LOWERCASE_QUARTER.getValue().equals(type)&&dcWarning.getCreateTime()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (dcWarning.getCreateTime()!=null){
|
|
|
|
dcWarning.setWarningTime(dcWarning.getCreateTime());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectWarningTrend(dcWarning));
|
|
|
|
}
|
|
|
|
//某一路段某一时间段的感知事件类型占比
|
|
|
|
@PostMapping("/warningSectionType")
|
|
|
|
public AjaxResult getWarningSectionType(@RequestBody DcWarning dcWarning){
|
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
|
String type = dcWarning.getType();//类型
|
|
|
|
String sectionId = dcWarning.getSectionId();//路段辖区id
|
|
|
|
String direction = dcWarning.getDirection();//方向
|
|
|
|
if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||StringUtils.isBlank(direction)){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_DATA_EXCEPTION.getValue());
|
|
|
|
}
|
|
|
|
if (!UniversalEnum.LOWERCASE_DAY.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_MONTH.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_YEAR.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_QUARTER.getValue().equals(type)) {
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (type.equals(UniversalEnum.LOWERCASE_QUARTER.getValue())&&dcWarning.getQuarter()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (!UniversalEnum.LOWERCASE_QUARTER.getValue().equals(type)&&dcWarning.getCreateTime()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (dcWarning.getCreateTime()!=null){
|
|
|
|
dcWarning.setWarningTime(dcWarning.getCreateTime());
|
|
|
|
}
|
|
|
|
if (type.equals(UniversalEnum.LOWERCASE_QUARTER.getValue())) {
|
|
|
|
String total = perceivedEventsWarningService.selectWarningSectionTypeCountQuarter(dcWarning);
|
|
|
|
map.put("total",total);
|
|
|
|
} else {
|
|
|
|
String total = perceivedEventsWarningService.selectWarningSectionTypeCount(dcWarning);
|
|
|
|
map.put("total",total);
|
|
|
|
}
|
|
|
|
List<HashMap<String, Object>> mapList = perceivedEventsWarningService.selectWarningSectionType(dcWarning);
|
|
|
|
map.put("warningTypeList",mapList);
|
|
|
|
return AjaxResult.success(map);
|
|
|
|
}
|
|
|
|
//查询某个路段下的全部桩号
|
|
|
|
@PostMapping("/sectionMarkNumber")
|
|
|
|
public AjaxResult getSectionMark(@RequestBody DcWarning dcWarning){
|
|
|
|
String sectionId = dcWarning.getSectionId();
|
|
|
|
if (StringUtils.isBlank(sectionId)){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_DATA_EXCEPTION.getValue());
|
|
|
|
}
|
|
|
|
String direction = dcWarning.getDirection();
|
|
|
|
if (StringUtils.isBlank(direction)){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_DATA_EXCEPTION.getValue());
|
|
|
|
}
|
|
|
|
if (dcWarning.getCreateTime()!=null){
|
|
|
|
dcWarning.setWarningTime(dcWarning.getCreateTime());
|
|
|
|
}
|
|
|
|
String type = dcWarning.getType();
|
|
|
|
if (!UniversalEnum.LOWERCASE_DAY.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_MONTH.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_YEAR.getValue().equals(type)
|
|
|
|
&& !UniversalEnum.LOWERCASE_QUARTER.getValue().equals(type)) {
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (!UniversalEnum.LOWERCASE_QUARTER.getValue().equals(type)&&dcWarning.getCreateTime()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
if (type.equals(UniversalEnum.LOWERCASE_QUARTER.getValue())&&dcWarning.getQuarter()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning));
|
|
|
|
}
|
|
|
|
//查询某个路段下的全部桩号
|
|
|
|
// @PostMapping("/sectionMarkNumberOptimize")
|
|
|
|
// public AjaxResult getSectionMarkOptimize(@RequestBody DcWarning dcWarning){
|
|
|
|
// String sectionId = dcWarning.getSectionId();
|
|
|
|
// if (StringUtils.isBlank(sectionId)){
|
|
|
|
// return AjaxResult.error("参数异常");
|
|
|
|
// }
|
|
|
|
// String direction = dcWarning.getDirection();
|
|
|
|
// if (StringUtils.isBlank(direction)){
|
|
|
|
// return AjaxResult.error("参数异常");
|
|
|
|
// }
|
|
|
|
// return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning));
|
|
|
|
// }
|
|
|
|
|
|
|
|
//预警事件,事件列表 查询状态为上报的感知事件
|
|
|
|
@PostMapping("/warningEscalation")
|
|
|
|
public TableDataInfo getWarningEscalation(@RequestBody DcWarning dcWarning){
|
|
|
|
startPage();
|
|
|
|
List<HashMap<String, Object>> list = perceivedEventsWarningService.selectWarningEscalation(dcWarning);
|
|
|
|
return getDataTable(list);
|
|
|
|
}
|
|
|
|
//修改感知事件信息
|
|
|
|
@PostMapping("/updateWarning")
|
|
|
|
public AjaxResult updateWarning(@RequestBody DcWarning dcWarning){
|
|
|
|
return toAjax(perceivedEventsWarningService.updateWarning(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询非机预警类型,按照时间与类型查询(传入时间类型type与时间warningTime)
|
|
|
|
@PostMapping("/nonAutomaticWarningType")
|
|
|
|
public AjaxResult nonAutomaticWarningType(@RequestBody DcWarning dcWarning){
|
|
|
|
if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectTypeNonAutomaticWarning(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出非机预警统计分析(按事件分类)",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportNonAutomaticWarningType")
|
|
|
|
public void exportNonAutomaticWarningType(HttpServletResponse response, DcWarning dcWarning){
|
|
|
|
List<NonAutomaticWarningType> list = new ArrayList<>();
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){
|
|
|
|
|
|
|
|
} else {
|
|
|
|
List<HashMap<String,Object>> data = perceivedEventsWarningService.selectTypeNonAutomaticWarning(dcWarning);
|
|
|
|
Long total = data.stream().mapToLong(item -> (long) item.get("number")).sum();
|
|
|
|
for (Map<String, Object> datum : data) {
|
|
|
|
NonAutomaticWarningType nonAutomaticWarningType = new NonAutomaticWarningType();
|
|
|
|
nonAutomaticWarningType.setSubclass(datum.get("subclass").toString());
|
|
|
|
nonAutomaticWarningType.setNumber(datum.get("number").toString());
|
|
|
|
//计算百分比
|
|
|
|
double ratio = (double) Long.parseLong(datum.get("number").toString()) / total * 100;
|
|
|
|
ratio = Math.round(ratio * 100.0) / 100.0;
|
|
|
|
nonAutomaticWarningType.setRatio(ratio + "%");
|
|
|
|
list.add(nonAutomaticWarningType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ExcelUtil<NonAutomaticWarningType> util = new ExcelUtil<>(NonAutomaticWarningType.class);
|
|
|
|
util.exportExcel(response, list, "统计分析");
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询非机预警,按照时间查询(传入时间类型type与时间warningTime)
|
|
|
|
@PostMapping("/nonAutomaticWarningTimeType")
|
|
|
|
public AjaxResult nonAutomaticWarningTimeType(@RequestBody DcWarning dcWarning){
|
|
|
|
if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectNonAutomaticWarningTimeType(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出非机预警统计分析(按日期)",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportNonAutomaticWarningTimeType")
|
|
|
|
public void exportNonAutomaticWarningTimeType(HttpServletResponse response, DcWarning dcWarning){
|
|
|
|
List<NonAutomaticWarningTimeType> list = new ArrayList<>();
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){
|
|
|
|
|
|
|
|
} else {
|
|
|
|
List<HashMap<String,Object>> data = perceivedEventsWarningService.selectNonAutomaticWarningTimeType(dcWarning);
|
|
|
|
for (Map<String, Object> datum : data) {
|
|
|
|
NonAutomaticWarningTimeType nonAutomaticWarningTimeType = new NonAutomaticWarningTimeType();
|
|
|
|
if (Objects.equals(dcWarning.getType(), UniversalEnum.LOWERCASE_YEAR.getValue())) {
|
|
|
|
nonAutomaticWarningTimeType.setTime(datum.get("month").toString());
|
|
|
|
} else if (Objects.equals(dcWarning.getType(), UniversalEnum.LOWERCASE_MONTH.getValue())) {
|
|
|
|
nonAutomaticWarningTimeType.setTime(datum.get("day").toString());
|
|
|
|
} else {
|
|
|
|
nonAutomaticWarningTimeType.setTime(datum.get("time").toString());
|
|
|
|
}
|
|
|
|
nonAutomaticWarningTimeType.setNumber(datum.get("number").toString());
|
|
|
|
list.add(nonAutomaticWarningTimeType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ExcelUtil<NonAutomaticWarningTimeType> util = new ExcelUtil<>(NonAutomaticWarningTimeType.class);
|
|
|
|
util.exportExcel(response, list, "统计分析");
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询非机预警,按照时间查询收费站分组(传入时间类型type与时间warningTime)
|
|
|
|
@PostMapping("/nonAutomaticWarningFacility")
|
|
|
|
public AjaxResult nonAutomaticWarningFacility(@RequestBody DcWarning dcWarning){
|
|
|
|
if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectNonAutomaticWarningFacility(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出非机预警统计分析(按事件分类)",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportNonAutomaticWarningFacility")
|
|
|
|
public void exportNonAutomaticWarningFacility(HttpServletResponse response, DcWarning dcWarning){
|
|
|
|
List<NonAutomaticWarningFacility> list = new ArrayList<>();
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){
|
|
|
|
|
|
|
|
} else {
|
|
|
|
List<HashMap<String,Object>> data = perceivedEventsWarningService.selectNonAutomaticWarningFacility(dcWarning);
|
|
|
|
Long total = data.stream().mapToLong(item -> (long) item.get("number")).sum();
|
|
|
|
for (Map<String, Object> datum : data) {
|
|
|
|
NonAutomaticWarningFacility nonAutomaticWarningFacility = new NonAutomaticWarningFacility();
|
|
|
|
nonAutomaticWarningFacility.setFacilityName(datum.get("facilityName").toString());
|
|
|
|
nonAutomaticWarningFacility.setNumber(datum.get("number").toString());
|
|
|
|
//计算百分比
|
|
|
|
double ratio = (double) Long.parseLong(datum.get("number").toString()) / total * 100;
|
|
|
|
ratio = Math.round(ratio * 100.0) / 100.0;
|
|
|
|
nonAutomaticWarningFacility.setRatio(ratio + "%");
|
|
|
|
list.add(nonAutomaticWarningFacility);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ExcelUtil<NonAutomaticWarningFacility> util = new ExcelUtil<>(NonAutomaticWarningFacility.class);
|
|
|
|
util.exportExcel(response, list, "统计分析");
|
|
|
|
}
|
|
|
|
|
|
|
|
//新-感知事件多发时段
|
|
|
|
@PostMapping("/manyTimesInterval")
|
|
|
|
public AjaxResult manyTimesInterval(@RequestBody DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null
|
|
|
|
||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark())
|
|
|
|
||StringUtils.isBlank(dcWarning.getDirection())){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectManyTimesInterval(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Description 导出感知事件多发时段
|
|
|
|
*
|
|
|
|
* @author liuwenge
|
|
|
|
* @date 2024/6/25 10:34
|
|
|
|
* @param response
|
|
|
|
* @param dcWarning
|
|
|
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "导出感知事件多发时段",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportManyTimesInterval")
|
|
|
|
public void exportManyTimesInterval(HttpServletResponse response,DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null
|
|
|
|
||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark())
|
|
|
|
||StringUtils.isBlank(dcWarning.getDirection())){
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
HashMap<String,Object> map = perceivedEventsWarningService.selectManyTimesInterval(dcWarning);
|
|
|
|
List<ManyTimesInterval> list = new ArrayList<>();
|
|
|
|
if (map != null){
|
|
|
|
List<HashMap<String,Object>> currentlyMap = (List<HashMap<String, Object>>) map.get("currentlyMap");
|
|
|
|
List<HashMap<String,Object>> lastYearMap = (List<HashMap<String, Object>>) map.get("lastYearMap");
|
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < currentlyMap.size(); i++) {
|
|
|
|
ManyTimesInterval manyTimesInterval = new ManyTimesInterval();
|
|
|
|
manyTimesInterval.setTime(i + "点至" + (i +UniversalEnum.ONE.getNumber()) + "点");
|
|
|
|
manyTimesInterval.setCurrentData(currentlyMap.get(i).get("number").toString());
|
|
|
|
manyTimesInterval.setContemporaneousData(lastYearMap.get(i).get("number").toString());
|
|
|
|
list.add(manyTimesInterval);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExcelUtil<ManyTimesInterval> util = new ExcelUtil<>(ManyTimesInterval.class);
|
|
|
|
util.exportExcel(response, list, UniversalEnum.PERCEIVED_EVENT_OCCURRENCE_PERIOD.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新-感知事件类型分析
|
|
|
|
@PostMapping("/selectWarningType")
|
|
|
|
public AjaxResult selectWarningType(@RequestBody DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null
|
|
|
|
||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark())
|
|
|
|
||StringUtils.isBlank(dcWarning.getDirection())){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.newSelectWarningType(dcWarning));
|
|
|
|
}
|
|
|
|
@ApiOperation(value = "导出感知事件类型分析",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportSelectWarningType")
|
|
|
|
public void exportSelectWarningType(HttpServletResponse response,DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null
|
|
|
|
||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark())
|
|
|
|
||StringUtils.isBlank(dcWarning.getDirection())){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
HashMap<String,Object> map = perceivedEventsWarningService.newSelectWarningType(dcWarning);
|
|
|
|
List<SelectWarningType> list = new ArrayList<>();
|
|
|
|
if (map != null){
|
|
|
|
List<HashMap<String,Object>> currentlyMap = (List<HashMap<String, Object>>) map.get("currentlyMap");
|
|
|
|
Integer total = UniversalEnum.ZERO.getNumber();
|
|
|
|
for (HashMap<String, Object> stringObjectHashMap : currentlyMap) {
|
|
|
|
total += Integer.parseInt(stringObjectHashMap.get("number").toString());
|
|
|
|
}
|
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < currentlyMap.size(); i++) {
|
|
|
|
SelectWarningType selectWarningType = new SelectWarningType();
|
|
|
|
selectWarningType.setWarningType(currentlyMap.get(i).get("warningType").toString());
|
|
|
|
selectWarningType.setNumber(currentlyMap.get(i).get("number").toString());
|
|
|
|
double ratio = Double.parseDouble(currentlyMap.get(i).get("number").toString()) / total * UniversalEnum.ONE_HUNDRED.getNumber();
|
|
|
|
selectWarningType.setRatio(String.format("%.2f", ratio) + "%");
|
|
|
|
list.add(selectWarningType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExcelUtil<SelectWarningType> util = new ExcelUtil<>(SelectWarningType.class);
|
|
|
|
util.exportExcel(response, list, UniversalEnum.PERCEPTUAL_EVENT_TYPE_ANALYSIS.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
//新-感知事件桩号范围内事件分析
|
|
|
|
@PostMapping("/selectSection")
|
|
|
|
public AjaxResult selectSection(@RequestBody DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null
|
|
|
|
||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark())
|
|
|
|
||StringUtils.isBlank(dcWarning.getDirection())){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.newSelectSection(dcWarning));
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出桩号范围内事件分析",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportSelectSection")
|
|
|
|
public void exportSelectSection(HttpServletResponse response,DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null
|
|
|
|
||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark())
|
|
|
|
||StringUtils.isBlank(dcWarning.getDirection())){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
HashMap<String,Object> map = perceivedEventsWarningService.newSelectSection(dcWarning);
|
|
|
|
List<SelectSection> list = new ArrayList<>();
|
|
|
|
if (map != null){
|
|
|
|
HashMap<String,Object> currentlyMap = (HashMap<String, Object>) map.get("currentlyMap");
|
|
|
|
HashMap<String,Object> lastYearMap = (HashMap<String, Object>) map.get("lastYearMap");
|
|
|
|
|
|
|
|
Set<String> allKeys = new HashSet<>(currentlyMap.keySet());
|
|
|
|
allKeys.addAll(lastYearMap.keySet());
|
|
|
|
List<String> stakeMarkList = allKeys.stream().sorted(Comparator.comparing(item -> item)).collect(Collectors.toList());
|
|
|
|
for (String key : stakeMarkList) {
|
|
|
|
SelectSection selectSection = new SelectSection();
|
|
|
|
selectSection.setStakeMark(key);
|
|
|
|
if (currentlyMap.containsKey(key)){
|
|
|
|
selectSection.setCurrentData(currentlyMap.get(key).toString());
|
|
|
|
}
|
|
|
|
if (lastYearMap.containsKey(key)){
|
|
|
|
selectSection.setContemporaneousData(lastYearMap.get(key).toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
list.add(selectSection);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
ExcelUtil<SelectSection> util = new ExcelUtil<>(SelectSection.class);
|
|
|
|
util.exportExcel(response, list, UniversalEnum.EVENT_ANALYSIS_WITHIN_THE_RANGE_OF_STAKE_NUMBER.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
//新-感知事件路段处置类型分析
|
|
|
|
@PostMapping("/selectStateType")
|
|
|
|
public AjaxResult selectStateType(@RequestBody DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null){
|
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue());
|
|
|
|
}
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.newSelectStateType(dcWarning));
|
|
|
|
}
|
|
|
|
@ApiOperation(value = "导出感知事件路段分析",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportSelectStateType")
|
|
|
|
public void exportSelectStateType(HttpServletResponse response, DcWarning dcWarning){
|
|
|
|
if (dcWarning==null||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
List<SelectStateType> list = new ArrayList<>();
|
|
|
|
|
|
|
|
HashMap<String,Object> map = perceivedEventsWarningService.newSelectStateType(dcWarning);
|
|
|
|
List<Map<String,Object>> currentlyMap = (List<Map<String, Object>>) map.get("currentlyMap");
|
|
|
|
List<HashMap<String,Object>> lastYearMap = (List<HashMap<String, Object>>) map.get("lastYearMap");
|
|
|
|
List<HashMap<String,Object>> stateDuration = (List<HashMap<String, Object>>) map.get("stateDuration");
|
|
|
|
|
|
|
|
Map<String,List<Map<String,Object>>> currentlyData = currentlyMap.stream().collect(Collectors.groupingBy(item -> item.get("startStakeMark").toString()));
|
|
|
|
Map<String,List<Map<String,Object>>> lastYearData = lastYearMap.stream().collect(Collectors.groupingBy(item -> item.get("startStakeMark").toString()));
|
|
|
|
Map<String,List<Map<String,Object>>> stateDurationData = stateDuration.stream().collect(Collectors.groupingBy(item -> item.get("startStakeMark").toString()));
|
|
|
|
|
|
|
|
Set<String> allKeys = new HashSet<>(currentlyData.keySet());
|
|
|
|
allKeys.addAll(lastYearData.keySet());
|
|
|
|
allKeys.addAll(stateDurationData.keySet());
|
|
|
|
|
|
|
|
List<String> stakeMarkList = allKeys.stream().sorted(Comparator.comparing(stakeMark -> stakeMark)).collect(Collectors.toList());
|
|
|
|
for (String key : stakeMarkList) {
|
|
|
|
SelectStateType selectStateType = new SelectStateType();
|
|
|
|
if (currentlyData.containsKey(key)){
|
|
|
|
List<Map<String,Object>> sectionData = currentlyData.get(key);
|
|
|
|
selectStateType.setSectionName(sectionData.get(0).get("sectionName").toString());
|
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < sectionData.size(); i++) {
|
|
|
|
if (UniversalEnum.ONE.getValue().equals(sectionData.get(i).get("warningState").toString())){
|
|
|
|
selectStateType.setReporting(sectionData.get(i).get("num").toString());
|
|
|
|
} else if (UniversalEnum.TWO.getValue().equals(sectionData.get(i).get("warningState").toString())){
|
|
|
|
selectStateType.setCompleted(sectionData.get(i).get("num").toString());
|
|
|
|
} else if (UniversalEnum.THREE.getValue().equals(sectionData.get(i).get("warningState").toString())){
|
|
|
|
selectStateType.setTerminated(sectionData.get(i).get("num").toString());
|
|
|
|
} else if (UniversalEnum.FOUR.getValue().equals(sectionData.get(i).get("warningState").toString())){
|
|
|
|
selectStateType.setAutomaticTermination(sectionData.get(i).get("num").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (lastYearData.containsKey(key)){
|
|
|
|
List<Map<String,Object>> sectionData = lastYearData.get(key);
|
|
|
|
selectStateType.setSectionName(sectionData.get(0).get("sectionName").toString());
|
|
|
|
Integer total = UniversalEnum.ZERO.getNumber();
|
|
|
|
for (Map<String, Object> sectionDatum : sectionData) {
|
|
|
|
total += Integer.parseInt(sectionDatum.get("num").toString());
|
|
|
|
}
|
|
|
|
selectStateType.setContemporaneousData(total.toString());
|
|
|
|
}
|
|
|
|
if (stateDurationData.containsKey(key)){
|
|
|
|
List<Map<String,Object>> sectionData = stateDurationData.get(key);
|
|
|
|
selectStateType.setSectionName(sectionData.get(0).get("sectionName").toString());
|
|
|
|
selectStateType.setAverageDuration(sectionData.get(UniversalEnum.ZERO.getNumber()).get("avg").toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
list.add(selectStateType);
|
|
|
|
}
|
|
|
|
|
|
|
|
ExcelUtil<SelectStateType> util = new ExcelUtil<>(SelectStateType.class);
|
|
|
|
util.exportExcel(response, list, UniversalEnum.PERCEPTUAL_EVENT_SECTION_ANALYSIS.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
//查询感知数量按照路段数量进行排名
|
|
|
|
@PostMapping("/sectionPerceivedList")
|
|
|
|
public AjaxResult getSectionPerceivedEventsList(){
|
|
|
|
return AjaxResult.success(perceivedEventsWarningService.selectSectionPerceivedEventsList());
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出感知事件路段排名",tags = {"ECharts导出"})
|
|
|
|
@GetMapping("/exportSectionPerceivedList")
|
|
|
|
public void exportSectionPerceivedList(HttpServletResponse response){
|
|
|
|
List<HashMap<String,Object>> dataList = perceivedEventsWarningService.selectSectionPerceivedEventsList();
|
|
|
|
List<SectionPerceivedList> list = new ArrayList<>();
|
|
|
|
if (dataList != null && dataList.size() > UniversalEnum.ZERO.getNumber()){
|
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < dataList.size(); i++) {
|
|
|
|
SectionPerceivedList sectionPerceivedList = new SectionPerceivedList();
|
|
|
|
sectionPerceivedList.setRank(i+UniversalEnum.ONE.getNumber());
|
|
|
|
sectionPerceivedList.setSectionName(dataList.get(i).get("sectionName").toString());
|
|
|
|
sectionPerceivedList.setNumber(dataList.get(i).get("number").toString());
|
|
|
|
list.add(sectionPerceivedList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ExcelUtil<SectionPerceivedList> util = new ExcelUtil<>(SectionPerceivedList.class);
|
|
|
|
util.exportExcel(response, list, UniversalEnum.PERCEIVED_EVENT_ROAD_RANK.getValue());
|
|
|
|
}
|
|
|
|
}
|