Browse Source

高速云事件改版

develop
lau572 1 month ago
parent
commit
2b3bd6b07c
  1. 87
      zc-business/src/main/java/com/zc/business/controller/DcSdhsEventController.java
  2. 4
      zc-business/src/main/java/com/zc/business/mapper/DcSdhsEventMapper.java
  3. 20
      zc-business/src/main/java/com/zc/business/service/IDcSdhsEventService.java
  4. 956
      zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java
  5. 15
      zc-business/src/main/java/com/zc/business/utils/PoiUtil.java
  6. 84
      zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml

87
zc-business/src/main/java/com/zc/business/controller/DcSdhsEventController.java

@ -73,9 +73,18 @@ public class DcSdhsEventController extends BaseController {
//事故多发路段分析
@ApiOperation("查询事多发路段分析")
@ApiOperation("查询事多发路段分析")
@PostMapping("/sectionAnalysis")
public AjaxResult sectionAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (dcSdhsEventQuery.getType()==null||dcSdhsEventQuery.getThisTime()==null||dcSdhsEventQuery.getLastTime()==null){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(dcSdhsEventService.sectionAnalysis(dcSdhsEventQuery));
}
//事故多发路段分析
@ApiOperation("查询事故多发路段分析")
@PostMapping("/accidentSectionAnalysis")
public AjaxResult accidentSectionAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (dcSdhsEventQuery.getType()==null||dcSdhsEventQuery.getThisTime()==null||dcSdhsEventQuery.getLastTime()==null){
return AjaxResult.error("参数异常");
}
@ -152,65 +161,74 @@ public class DcSdhsEventController extends BaseController {
if (exportKey != null && exportKey.size() > 0){
//交通事件
if (exportKey.contains("1") || exportKey.contains("2") || exportKey.contains("3")
|| exportKey.contains("4") || exportKey.contains("5") || exportKey.contains("6")){
|| exportKey.contains("4") || exportKey.contains("5")){
PoiUtil.createHeading1(newDoc,"交通事件");
for (String trafficIncidentType : exportKey) {
if ("1".equals(trafficIncidentType)){
//事多发路段
//事多发路段
dcSdhsEventService.sectionAnalysisExport(newDoc,dcSdhsEventQuery);
} else if ("2".equals(trafficIncidentType)){
//事件类型分析
dcSdhsEventService.accidentTypeAnalysisExport(newDoc,dcSdhsEventQuery);
} else if ("3".equals(trafficIncidentType)){
//事故车型分析
//事故车型
dcSdhsEventService.exportAccidentModelAnalysis(newDoc, dcSdhsEventQuery);
//事件时间分析
dcSdhsEventService.exportEventTimeAnalysis(newDoc, dcSdhsEventQuery);
} else if ("4".equals(trafficIncidentType)){
//事故时间分析
//事故时间
dcSdhsEventService.exportAccidentTimeAnalysis(newDoc, dcSdhsEventQuery);
//事件地市分布
dcSdhsEventService.exportEventRegionAnalysis(newDoc,dcSdhsEventQuery);
} else if ("5".equals(trafficIncidentType)){
//事故地市分布
dcSdhsEventService.exportRegionAnalysis(newDoc,dcSdhsEventQuery);
} else if ("6".equals(trafficIncidentType)){
//交通管制情况统计
dcSdhsEventService.exportStationAnalysis(newDoc,dcSdhsEventQuery);
}
}
}
if (exportKey.contains("7")){
if (exportKey.contains("6")){
PoiUtil.createHeading1(newDoc,"天气情况统计");
wordController.weather(newDoc);
}
if (exportKey.contains("8") || exportKey.contains("9")){
if (exportKey.contains("7") || exportKey.contains("8")){
PoiUtil.createHeading1(newDoc,"交通量统计");
for (String trafficIncidentType : exportKey) {
if ("8".equals(trafficIncidentType)){
if ("7".equals(trafficIncidentType)){
//门架车流量
dcSdhsEventService.exporFrameDataAnalysis(newDoc,dcSdhsEventQuery);
} else if ("9".equals(trafficIncidentType)){
} else if ("8".equals(trafficIncidentType)){
//收费站车流量
dcSdhsEventService.exporttollGateEntrance(newDoc,dcSdhsEventQuery);
}
}
}
if (exportKey.contains("10")){
if (exportKey.contains("9") || exportKey.contains("10") || exportKey.contains("11") || exportKey.contains("12") || exportKey.contains("13")){
PoiUtil.createHeading1(newDoc,"交通事故情况");
//交通事故类型统计
dcSdhsEventService.exportAccidentType(newDoc,dcSdhsEventQuery);
for (String trafficIncidentType : exportKey) {
if ("9".equals(trafficIncidentType)){
//事故类型统计
dcSdhsEventService.exportAccidentType(newDoc, dcSdhsEventQuery);
} else if ("10".equals(trafficIncidentType)){
//事故车型分析
dcSdhsEventService.exportAccidentModelAnalysis(newDoc, dcSdhsEventQuery);
} else if ("11".equals(trafficIncidentType)){
//事故时间分析
dcSdhsEventService.exportAccidentTimeAnalysis(newDoc, dcSdhsEventQuery);
} else if ("12".equals(trafficIncidentType)){
//事故地市分布
dcSdhsEventService.exportRegionAnalysis(newDoc,dcSdhsEventQuery);
} else if ("13".equals(trafficIncidentType)){
//事故路段分布
dcSdhsEventService.accidentSectionAnalysisExport(newDoc,dcSdhsEventQuery);
}
}
}
if (exportKey.contains("11") || exportKey.contains("12")){
if (exportKey.contains("14") || exportKey.contains("15")){
PoiUtil.createHeading1(newDoc,"拥堵情况");
for (String trafficIncidentType : exportKey) {
if ("11".equals(trafficIncidentType)){
if ("14".equals(trafficIncidentType)){
//拥堵地点统计
dcSdhsEventService.accidentCongestedLocationExport(newDoc,dcSdhsEventQuery);
} else if ("12".equals(trafficIncidentType)){
} else if ("15".equals(trafficIncidentType)){
//路段平均拥堵时长
dcSdhsEventService.accidentCongestedTimeExport(newDoc,dcSdhsEventQuery);
}
@ -251,6 +269,13 @@ public class DcSdhsEventController extends BaseController {
return dcSdhsEventService.selectRegionAnalysis(dcSdhsEventQuery);
}
@ApiOperation("查询事件地市分布")
@PostMapping("/selectEventRegionAnalysis")
public AjaxResult selectEventRegionAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery)
{
return dcSdhsEventService.selectEventRegionAnalysis(dcSdhsEventQuery);
}
/**
* 事故时间分析
* @param dcSdhsEventQuery
@ -401,4 +426,18 @@ public class DcSdhsEventController extends BaseController {
return dcSdhsEventService.getDataCalendar(month);
}
/**
* 事件时间分析
* @param dcSdhsEventQuery
* @return
*/
@PostMapping("/eventTimeAnalysis")
@ApiOperation("事故时间分析")
public AjaxResult eventTimeAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (StringUtils.isEmpty(dcSdhsEventQuery.getType()) || StringUtils.isEmpty(dcSdhsEventQuery.getThisTime()) || StringUtils.isEmpty(dcSdhsEventQuery.getLastTime())){
return AjaxResult.error("参数错误");
}
return AjaxResult.success( dcSdhsEventService.eventTimeAnalysis(dcSdhsEventQuery));
}
}

4
zc-business/src/main/java/com/zc/business/mapper/DcSdhsEventMapper.java

@ -77,6 +77,7 @@ public interface DcSdhsEventMapper
boolean deleteByTimeRange(@Param("startTime") String startTime,@Param("endTime") String endTime);
List<Map<String,Object>> selectRegionAnalysis(@Param("type") String type,@Param("thisTime") String thisTime, @Param("lastTime") String lastTime);
List<Map<String,Object>> selectEventRegionAnalysis(@Param("type") String type,@Param("thisTime") String thisTime, @Param("lastTime") String lastTime);
List<DcSdhsEvent> selectStationAnalysis(@Param("type") String type,@Param("time") String time);
@ -94,8 +95,11 @@ public interface DcSdhsEventMapper
*/
List<DcSdhsEvent> selectAccidentModelAnalysis(@Param("type") String type, @Param("time") String time);
List<DcSdhsEvent> selectEventModelAnalysis(@Param("type") String type, @Param("time") String time);
//事故多发路段分析
List<HashMap<String,Object>> sectionAnalysis(@Param("type") String type,@Param("thisTime") String thisTime);
List<HashMap<String,Object>> accidentSectionAnalysis(@Param("type") String type,@Param("thisTime") String thisTime);
//事件类型分析
List<HashMap<String,Object>> accidentTypeAnalysis(@Param("type") String type,@Param("thisTime") String thisTime, @Param("lastTime") String lastTime);

20
zc-business/src/main/java/com/zc/business/service/IDcSdhsEventService.java

@ -27,6 +27,10 @@ public interface IDcSdhsEventService
AjaxResult getFileInfo();
//事件多发路段分析
public List<Map<String, Object>> sectionAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
//事故多发路段分析
public List<Map<String, Object>> accidentSectionAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
//事件类型分析
@ -35,8 +39,9 @@ public interface IDcSdhsEventService
public List<HashMap<String, Object>> accidentCongestedLocation(DcSdhsEventQuery dcSdhsEventQuery);
//事故拥堵时间
public List<Map<String, Object>> accidentCongestedTime(DcSdhsEventQuery dcSdhsEventQuery);
//事多发路段分析导出
//事多发路段分析导出
public void sectionAnalysisExport(XWPFDocument doc,DcSdhsEventQuery dcSdhsEventQuery);
public void accidentSectionAnalysisExport(XWPFDocument doc,DcSdhsEventQuery dcSdhsEventQuery);
//事故类型分析导出
public void accidentTypeAnalysisExport(XWPFDocument doc,DcSdhsEventQuery dcSdhsEventQuery);
//事故拥堵时长导出
@ -45,9 +50,12 @@ public interface IDcSdhsEventService
void accidentCongestedLocationExport(XWPFDocument doc,DcSdhsEventQuery dcSdhsEventQuery);
AjaxResult selectRegionAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
AjaxResult selectEventRegionAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
void exportRegionAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery);
void exportEventRegionAnalysis(XWPFDocument doc, DcSdhsEventQuery dcSdhsEventQuery);
/**
* 事故车型
* @param newDoc
@ -69,6 +77,16 @@ public interface IDcSdhsEventService
*/
Map<String, Map<String, Long>> accidentTimeAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
/**
* 事件时间分析
* @param dcSdhsEventQuery
* @return
*/
Map<String, Map<String, Long>> eventTimeAnalysis(DcSdhsEventQuery dcSdhsEventQuery);
void exportEventTimeAnalysis(XWPFDocument newDoc,DcSdhsEventQuery dcSdhsEventQuery);
/**
* 事故时间
* @param newDoc

956
zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java

File diff suppressed because it is too large

15
zc-business/src/main/java/com/zc/business/utils/PoiUtil.java

@ -263,6 +263,21 @@ public class PoiUtil {
}
public static void addText(XWPFDocument doc, String description) {
if (StringUtils.isEmpty(description)) {
return;
}
XWPFParagraph title = doc.createParagraph();
XWPFRun run = title.createRun();
run.setFontSize(UniversalEnum.SIXTEEN.getNumber());
run.setText(description);
CTRPr rpr = run.getCTR().isSetRPr() ? run.getCTR().getRPr() : run.getCTR().addNewRPr();
CTFonts fonts = rpr.isSetRFonts() ? rpr.getRFonts() : rpr.addNewRFonts();
fonts.setAscii(UniversalEnum.IMITATION_SONG_DYNASTY.getValue());
fonts.setEastAsia(UniversalEnum.IMITATION_SONG_DYNASTY.getValue());
fonts.setHAnsi(UniversalEnum.IMITATION_SONG_DYNASTY.getValue());
}
// word跨列合并单元格
public static void mergeCellsHorizontal(XWPFTable table, int row, int fromCell, int toCell) {
for (int cellIndex = fromCell; cellIndex <= toCell; cellIndex++) {

84
zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml

@ -108,6 +108,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY city order by mileage asc) t3
on t1.city = t3.city
</select>
<select id="selectEventRegionAnalysis" resultType="java.util.Map">
select t1.city,IFNULL(t2.num,0) as #{thisTime}, IFNULL(t3.num,0) as #{lastTime}
from
(select '济南' city
union all select '泰安' city
union all select '济宁' city
union all select '菏泽' city) t1
left join
(SELECT
case when mileage >= 0 and mileage &lt;= 132469 then '济南'
when mileage > 132469 and mileage &lt;= 160708 then '泰安'
when mileage > 160708 and mileage &lt;= 200752 then '济宁'
when mileage > 200752 then '菏泽' else '其他' end city,
count(*) num
FROM `dc_sdhs_event`
<where>
<if test="type != null and type == '0'.toString">
and DATE_FORMAT(start_time,'%Y') = #{thisTime}
</if>
<if test="type != null and type == '1'.toString">
and DATE_FORMAT(start_time,'%Y-%m') = #{thisTime}
</if>
<if test="type != null and type == '2'.toString">
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{thisTime}
</if>
</where>
GROUP BY city order by mileage asc) t2
on t1.city = t2.city
left join
(SELECT
case when mileage >= 0 and mileage &lt;= 132469 then '济南'
when mileage > 132469 and mileage &lt;= 160708 then '泰安'
when mileage > 160708 and mileage &lt;= 200752 then '济宁'
when mileage > 200752 then '菏泽' else '其他' end city,
count(*) num
FROM `dc_sdhs_event`
<where>
<if test="type != null and type == '0'.toString">
and DATE_FORMAT(start_time,'%Y') = #{lastTime}
</if>
<if test="type != null and type == '1'.toString">
and DATE_FORMAT(start_time,'%Y-%m') = #{lastTime}
</if>
<if test="type != null and type == '2'.toString">
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{lastTime}
</if>
</where>
GROUP BY city order by mileage asc) t3
on t1.city = t3.city
</select>
<select id="selectStationAnalysis" resultType="com.zc.business.domain.DcSdhsEvent">
SELECT * FROM `dc_sdhs_event`
@ -172,6 +225,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on t1.event_subclass = t3.event_subclass
</select>
<select id="accidentSectionAnalysis" resultType="java.util.HashMap">
SELECT stake_mark stakeMark FROM `dc_sdhs_event`
<where>
event_type = '交通事故'
<if test="type != null and type == '0'.toString">
and DATE_FORMAT(start_time,'%Y') = #{thisTime}
</if>
<if test="type != null and type == '1'.toString">
and DATE_FORMAT(start_time,'%Y-%m') = #{thisTime}
</if>
<if test="type != null and type == '2'.toString">
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{thisTime}
</if>
</where>
</select>
<select id="sectionAnalysis" resultType="java.util.HashMap">
SELECT stake_mark stakeMark FROM `dc_sdhs_event`
<where>
<if test="type != null and type == '0'.toString">
@ -382,4 +450,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectEventModelAnalysis" resultType="com.zc.business.domain.DcSdhsEvent">
SELECT * FROM `dc_sdhs_event`
<where>
<if test="type != null and type == '0'.toString">
and DATE_FORMAT(start_time,'%Y') = #{time}
</if>
<if test="type != null and type == '1'.toString">
and DATE_FORMAT(start_time,'%Y-%m') = #{time}
</if>
<if test="type != null and type == '2'.toString">
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{time}
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save