Browse Source

感知事件日处置占比接口优化

develop
wangsixiang 10 months ago
parent
commit
370fccff39
  1. 2
      zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java
  2. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java
  3. 14
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

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

@ -35,7 +35,7 @@ public interface DcPerceivedEventsWarningMapper {
List<HashMap<String,Object>> selectWarningSourceGroup(DcWarning dcWarning);
String selectWarningSourceGroupCount(DcWarning dcWarning);
//当日感知事件的处置情况占比
List<HashMap<String,Object>> selectWarningStateDay(DcWarning dcWarning);
List<HashMap<String,Object>> selectWarningStateDay();
//感知事件类型占比
List<HashMap<String,Object>> selectWarningTypeDay(DcWarning dcWarning);
//事件总数量

5
zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java

@ -96,10 +96,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa
//当日感知事件的处置情况占比
@Override
public List<HashMap<String, Object>> selectWarningStateDay() {
DcWarning dcWarning = new DcWarning();
Date nowDate = DateUtils.getNowDate();
dcWarning.setCreateTime(nowDate);
return perceivedEventsWarningMapper.selectWarningStateDay(dcWarning);
return perceivedEventsWarningMapper.selectWarningStateDay();
}
//感知事件类型占比
@Override

14
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -87,9 +87,17 @@
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
</select>
<select id="selectWarningStateDay" resultType="java.util.HashMap">
SELECT warning_state warningState,COUNT(*) AS number FROM dc_warning
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
GROUP BY warning_state
select t1.warningState,t1.warningStateName,IFNULL(t2.num,0)number from
(select '1' as warningState,'上报' as warningStateName
UNION ALL select '2' as warningState,'已完成' as warningStateName
UNION ALL select '3' as warningState,'已终止' as warningStateName
UNION ALL select '4' as warningState,'自动结束' as warningStateName) t1
LEFT JOIN
(SELECT warning_state warningState,count(*) num
from dc_warning
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')
GROUP BY warning_state)t2
on t1.warningState=t2.warningState
</select>
<select id="selectWarningTypeDay" resultType="java.util.HashMap">
SELECT warning_type warningType,COUNT(*) AS number FROM dc_warning

Loading…
Cancel
Save