Commit 0305498e authored by zhoushiguang's avatar zhoushiguang

事件查询优化

parent 47c37a7a
......@@ -8,9 +8,11 @@ import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.databus.dao.entity.GreenwaveHistPO;
import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.dao.mapper.GreenwaveHistMapper;
import net.wanji.databus.dto.EventInfoTrafficStatusDTO;
import net.wanji.databus.po.EventInfoTrafficStatusPO;
import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.databus.vo.EventInfoTrafficStatusVO;
import net.wanji.opt.common.EsDateIndexUtil;
import net.wanji.opt.common.enums.EventInfoTypeEnum;
......@@ -43,6 +45,9 @@ public class EventServiceImpl implements EventService {
@Resource
BaseRidInfoMapper baseRidInfoMapper;
@Resource
BaseCrossInfoMapper baseCrossInfoMapper;
@Resource
GreenwaveHistMapper greenwaveHistMapper;
......@@ -322,10 +327,19 @@ public class EventServiceImpl implements EventService {
@Override
public List<EventAlarmInfo> findNotFinishAlarmInfo() throws DubboProviderException {
Map<String,Object> param = new HashMap<>();
param.put("is_signal",1);
List<TBaseCrossInfo> crossList = baseCrossInfoMapper.selectByMap(param);
List<EventAlarmInfo> list = holoEventMapper.findNotFinishAlarmInfo();
List<String> cidList = new ArrayList<>();
for (EventAlarmInfo info : list) {
String dir = info.getDir();
String turn = info.getTurn();
cidList.add(info.getCrossId());
if (Objects.nonNull(dir)) {
List<Integer> dirJsonArray = JSONArray.parseArray(dir, Integer.class);
......@@ -374,8 +388,26 @@ public class EventServiceImpl implements EventService {
}
info.setDirDesc(stringBuilder.toString());
}
}
for (TBaseCrossInfo info : crossList) {
String crossId = info.getId();
if (cidList.contains(crossId)) {
continue;
}
EventAlarmInfo emptyAlarm = new EventAlarmInfo();
emptyAlarm.setStatus(0);
emptyAlarm.setCrossId(crossId);
emptyAlarm.setCrossName(info.getName());
String wkt = info.getLocation();//.replaceAll(" ",",");
wkt = wkt.replaceAll("POINT\\(","");
wkt = wkt.replaceAll("\\)","");
emptyAlarm.setWkt(wkt);
list.add(emptyAlarm);
}
return list;
}
......
......@@ -130,8 +130,8 @@
dir,
if(turn='null',null,turn) turn
from t_base_cross_info c
left join (select * from t_event_info where dt = DATE_FORMAT(NOW(),'%Y%m%d') and type in (701,702,703,707) and alarm_status in (0,1,2)) a on a.cross_id = c.id
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
<!-- left --> join (select * from t_event_info where dt = DATE_FORMAT(NOW(),'%Y%m%d') and type in (701,702,703,707) and alarm_status in (0,1,2)) a on a.cross_id = c.id
<!-- left --> join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
where c.is_signal=1
</select>
......@@ -153,7 +153,7 @@
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
left join t_base_cross_info c on a.cross_id = c.id
where a.type in (701,702,703,707) and DATE(a.start_time) = CURDATE()
where a.dt=DATE_FORMAT(NOW(),'%Y%m%d') and a.type in (701,702,703,707)
union
<!-- 查询干线事件 -->
select a.type as event_type,a.green_id,a.cross_id,c.name as cross_name , a.start_time as issue_time, b.label as current_algo, c.wkt,a.alarm_status,a.opt_status
......@@ -161,7 +161,7 @@
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
left join t_greenwave_info c on a.green_id = c.id
where a.type in (705,706) and DATE(a.start_time) = CURDATE()
where dt=DATE_FORMAT(NOW(),'%Y%m%d') and a.type in (705,706)
) b where b.alarm_status in (0,1,2)
order by b.issue_time desc
)
......@@ -176,7 +176,7 @@
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
left join t_base_cross_info c on a.cross_id = c.id
where a.type in (701,702,703,707) and DATE(a.start_time) = CURDATE()
where dt=DATE_FORMAT(NOW(),'%Y%m%d') and a.type in (701,702,703,707)
union
<!-- 查询干线事件缓行、拥堵事件 -->
select a.type as event_type,a.green_id,a.cross_id,c.name as cross_name , DATE_FORMAT(a.start_time,'%H:%i') as issue_time, b.label as current_algo, c.wkt,a.alarm_status ,a.opt_status
......@@ -184,7 +184,7 @@
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4 ) b on a.type = b.event_type
left join t_greenwave_info c on a.green_id = c.id
where a.type in (705,706) and DATE(a.start_time) = CURDATE()
where dt=DATE_FORMAT(NOW(),'%Y%m%d') and a.type in (705,706)
) b
where b.alarm_status in (3,4)
order by b.issue_time desc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment