|
|
@ -2,7 +2,9 @@ package com.zc.business.controller; |
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil; |
|
|
|
import com.zc.business.domain.DcEvent; |
|
|
|
import com.zc.business.domain.DcEventListQuery; |
|
|
|
import com.zc.business.domain.DcWarning; |
|
|
|
import com.zc.business.domain.export.*; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
|
import com.zc.business.service.IDcTrafficIncidentsService; |
|
|
@ -10,6 +12,7 @@ import com.zc.common.core.httpclient.exception.HttpException; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddress; |
|
|
@ -20,8 +23,10 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -670,4 +675,26 @@ public class DcTrafficIncidentsController { |
|
|
|
ExcelUtil<EventTypeAnalysis> util = new ExcelUtil<>(EventTypeAnalysis.class); |
|
|
|
util.exportExcel(response, list, "事故类型分析"); |
|
|
|
} |
|
|
|
|
|
|
|
//事件时间数量占比
|
|
|
|
@PostMapping("/selectEventTimeProportion") |
|
|
|
public AjaxResult selectEventTimeProportion(@RequestBody DcWarning dcWarning){ |
|
|
|
if (dcWarning==null|| StringUtils.isBlank(dcWarning.getDirection())||StringUtils.isBlank(dcWarning.getType())|| |
|
|
|
dcWarning.getCurrently()==null||dcWarning.getLastYear()==null){ |
|
|
|
return AjaxResult.success("参数存在异常"); |
|
|
|
} |
|
|
|
Date currently = dcWarning.getCurrently(); |
|
|
|
Date lastYear = dcWarning.getLastYear(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String formattedDate = sdf.format(currently); |
|
|
|
String format = sdf.format(lastYear); |
|
|
|
List<HashMap<String, Object>> currentlyMap = trafficIncidentsService.selectEventTimeProportion(dcWarning.getDirection(), |
|
|
|
dcWarning.getType(), formattedDate); |
|
|
|
List<HashMap<String, Object>> lastYearMap = trafficIncidentsService.selectEventTimeProportion(dcWarning.getDirection(), |
|
|
|
dcWarning.getType(), format); |
|
|
|
HashMap<Object, Object> hashMap = new HashMap<>(); |
|
|
|
hashMap.put("currentlyMap",currentlyMap); |
|
|
|
hashMap.put("lastYearMap",lastYearMap); |
|
|
|
return AjaxResult.success(hashMap); |
|
|
|
} |
|
|
|
} |
|
|
|