diff --git a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java index 0b426534..15b9f658 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java @@ -105,6 +105,7 @@ public class DCPerceivedEventsWarningController extends BaseController { if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||createTime==null||StringUtils.isBlank(direction)){ return AjaxResult.error("参数数据异常"); } + dcWarning.setWarningTime(createTime); return AjaxResult.success(perceivedEventsWarningService.selectWarningTrend(dcWarning)); } //某一路段某一时间段的感知事件类型占比 @@ -118,6 +119,7 @@ public class DCPerceivedEventsWarningController extends BaseController { if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||createTime==null||StringUtils.isBlank(direction)){ return AjaxResult.error("参数数据异常"); } + dcWarning.setWarningTime(createTime); if (type.equals("quarter")) { String total = perceivedEventsWarningService.selectWarningSectionTypeCountQuarter(dcWarning); map.put("total",total); @@ -140,6 +142,9 @@ public class DCPerceivedEventsWarningController extends BaseController { if (StringUtils.isBlank(direction)){ return AjaxResult.error("参数异常"); } + if (dcWarning.getCreateTime()!=null){ + dcWarning.setWarningTime(dcWarning.getCreateTime()); + } return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning)); } //查询某个路段下的全部桩号 diff --git a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java index ec4f5fd5..3d935316 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java @@ -94,6 +94,27 @@ public class DcWarning extends BaseEntity @Excel(name = "持续时长(秒)") private int duration; + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + private Date startTime; + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + private Date endTime; + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + public int getDuration() { return duration; } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java index 633c24e4..3f23fb6a 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java @@ -53,7 +53,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa public List> selectSectionPerceivedEventsList( ) { DcWarning dcWarning = new DcWarning(); Date nowDate = DateUtils.getNowDate(); - dcWarning.setCreateTime(nowDate); + dcWarning.setWarningTime(nowDate); List> dcWarnings = perceivedEventsWarningMapper.selectSectionPerceivedEventsList(dcWarning); return dcWarnings; } @@ -62,7 +62,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa public List> selectSectionPerceivedNumber( ) { DcWarning dcWarning = new DcWarning(); Date nowDate = DateUtils.getNowDate(); - dcWarning.setCreateTime(nowDate); + dcWarning.setWarningTime(nowDate); return perceivedEventsWarningMapper.selectSectionPerceivedNumber(dcWarning); } //查询当前日,日累计感知事件,按照小时进行分组 @@ -81,7 +81,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa public List> selectWarningSourceGroup() { DcWarning dcWarning = new DcWarning(); Date nowDate = DateUtils.getNowDate(); - dcWarning.setCreateTime(nowDate); + dcWarning.setWarningTime(nowDate); return perceivedEventsWarningMapper.selectWarningSourceGroup(dcWarning); } @@ -89,7 +89,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa public String selectWarningSourceGroupCount() { DcWarning dcWarning = new DcWarning(); Date nowDate = DateUtils.getNowDate(); - dcWarning.setCreateTime(nowDate); + dcWarning.setWarningTime(nowDate); return perceivedEventsWarningMapper.selectWarningSourceGroupCount(dcWarning); } diff --git a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml index 3cc81559..98627d4d 100644 --- a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml @@ -35,14 +35,19 @@ warning.`other_config` FROM dc_warning AS warning left JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark and mark.direction=warning.direction - and warning_type = #{warningType} - and warning_subclass = #{warningSubclass} + and warning.warning_type = #{warningType} + and warning.warning_subclass = #{warningSubclass} + and warning.warning_source = #{warningSource} + and warning.direction = #{direction} + and warning.stake_mark = #{stakeMark} + + and warning.warning_time between #{startTime} and #{endTime} select s.section_name sectionName, (select COUNT(1) FROM `dc_warning` as w where - DATE_FORMAT(w.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d') + DATE_FORMAT(w.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') and mark.stake_mark=w.stake_mark)number from dc_warning as w left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark and mark.direction=w.direction LEFT JOIN dc_road_section as s ON mark.section_id=s.id @@ -63,28 +68,28 @@ HAVING number !=0 @@ -105,19 +110,19 @@ ORDER BY number DESC SELECT CASE - WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度' - WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度' - WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度' + WHEN MONTH(warning.warning_time) BETWEEN 1 AND 3 THEN '第一季度' + WHEN MONTH(warning.warning_time) BETWEEN 4 AND 6 THEN '第二季度' + WHEN MONTH(warning.warning_time) BETWEEN 7 AND 9 THEN '第三季度' ELSE '第四季度' END AS QUARTER, - MONTH(warning.create_time) AS month, + MONTH(warning.warning_time) AS month, COUNT(*) AS number FROM dc_warning as warning LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark - WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y') + WHERE YEAR(warning.warning_time) =DATE_FORMAT(#{warningTime},'%Y') AND warning.direction=#{direction} and mark.direction=#{direction} and mark.`section_id`=#{sectionId} GROUP BY QUARTER, MONTH @@ -143,17 +148,17 @@ @@ -162,7 +167,7 @@ COUNT(*) AS number FROM dc_warning as warning LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark - where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d') + where DATE_FORMAT(warning.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') AND warning.direction=#{direction} and mark.direction=#{direction} and mark.`section_id`=#{sectionId} GROUP BY warning_type @@ -171,7 +176,7 @@ @@ -179,7 +184,7 @@ SELECT warning.warning_type warningType,COUNT(*) AS number FROM dc_warning as warning LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark - where DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m') + where DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m') AND warning.direction=#{direction} and mark.direction=#{direction} and mark.`section_id`=#{sectionId} GROUP BY warning_type @@ -190,23 +195,23 @@ COUNT(*) AS number FROM dc_warning as warning LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark - WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y') + WHERE YEAR(warning.warning_time) =DATE_FORMAT(#{warningTime},'%Y') AND warning.direction=#{direction} and mark.direction=#{direction} and mark.`section_id`=#{sectionId} @@ -236,7 +241,7 @@ select count(1) from dc_warning where stake_mark=#{stakeMark} - AND direction=#{direction} and DATE(create_time)=DATE_FORMAT(#{createTime},'%Y-%m-%d') + AND direction=#{direction} and DATE(warning_time)=DATE_FORMAT(#{warningTime},'%Y-%m-%d') SELECT count( 1 ) sectionNumber, CASE - WHEN MONTH ( w.create_time ) BETWEEN 1 AND 3 THEN '第一季度' - WHEN MONTH ( w.create_time ) BETWEEN 4 AND 6 THEN '第二季度' - WHEN MONTH ( w.create_time ) BETWEEN 7 AND 9 THEN '第三季度' + WHEN MONTH ( w.warning_time ) BETWEEN 1 AND 3 THEN '第一季度' + WHEN MONTH ( w.warning_time ) BETWEEN 4 AND 6 THEN '第二季度' + WHEN MONTH ( w.warning_time ) BETWEEN 7 AND 9 THEN '第三季度' ELSE '第四季度' END AS QUARTER FROM dc_warning w - LEFT JOIN dc_stake_mark m ON w.stake_mark = m.stake_mark and mark.direction=warning.direction + LEFT JOIN dc_stake_mark m ON w.stake_mark = m.stake_mark and m.direction=w.direction WHERE m.stake_mark IS NOT null and w.direction=#{direction} - and YEAR(w.create_time) =DATE_FORMAT(#{createTime},'%Y') + and YEAR(w.warning_time) =DATE_FORMAT(#{warningTime},'%Y') GROUP BY QUARTER ORDER BY QUARTER;