Commit 5beecdd9 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents 3170984a ec7a762a
...@@ -97,7 +97,7 @@ public class EventController { ...@@ -97,7 +97,7 @@ public class EventController {
@GetMapping("/getAlarmInfo") @GetMapping("/getAlarmInfo")
@ApiOperation(hidden = false, value = "事件报警", notes = "", produces = "application/json") @ApiOperation(hidden = false, value = "实时/历史事件报警获取", notes = "", produces = "application/json")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "realtimeType", value = "查询类型:1为实时 2为历史", required = false, dataType = "String"), @ApiImplicitParam(name = "realtimeType", value = "查询类型:1为实时 2为历史", required = false, dataType = "String"),
@ApiImplicitParam(name = "eventType", value = "事件类型,701:空放 702:失衡 703:溢出 705:干线缓行 706:干线拥堵 707:路口拥堵", required = false, dataType = "String"), @ApiImplicitParam(name = "eventType", value = "事件类型,701:空放 702:失衡 703:溢出 705:干线缓行 706:干线拥堵 707:路口拥堵", required = false, dataType = "String"),
...@@ -121,4 +121,25 @@ public class EventController { ...@@ -121,4 +121,25 @@ public class EventController {
} }
@GetMapping("/getCrossCurrentStatus")
@ApiOperation(hidden = false, value = "路口实时状态接口", notes = "", produces = "application/json")
@ApiImplicitParams({
}
)
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventAlarmInfo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject getCrossNowStatus() {
try {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
List<EventAlarmInfo> eventAlarmInfo = eventService.findNotFinishAlarmInfo();
return jsonViewObject.success(eventAlarmInfo);
} catch (Exception e) {
log.error("", e);
return JsonViewObject.newInstance().fail("请求失败");
}
}
} }
\ No newline at end of file
...@@ -34,6 +34,22 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> { ...@@ -34,6 +34,22 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
List<EventInfoTrafficStatusPO> trafficStatus(EventInfoTrafficStatusDTO eventInfoTrafficStatusDTO); List<EventInfoTrafficStatusPO> trafficStatus(EventInfoTrafficStatusDTO eventInfoTrafficStatusDTO);
/**
* 查询实时、历史报警记录
* @param realtimeType
* @param eventType
* @param name
* @return
*/
List<EventAlarmInfo> findEventAlarmInfo(String realtimeType, String eventType, String name); List<EventAlarmInfo> findEventAlarmInfo(String realtimeType, String eventType, String name);
/**
* 查看路口为结束的报警状态
* @param realtimeType
* @param eventType
* @param name
* @return
*/
List<EventAlarmInfo> findNotFinishAlarmInfo();
} }
...@@ -17,7 +17,6 @@ import lombok.Data; ...@@ -17,7 +17,6 @@ import lombok.Data;
public class EventAlarmInfo { public class EventAlarmInfo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "绿波ID") @ApiModelProperty(value = "绿波ID")
private Integer greenId; private Integer greenId;
...@@ -36,6 +35,9 @@ public class EventAlarmInfo { ...@@ -36,6 +35,9 @@ public class EventAlarmInfo {
@ApiModelProperty(value = "状态类型") @ApiModelProperty(value = "状态类型")
private String type; private String type;
@ApiModelProperty(value = "事件类型码")
private String eventType;
@ApiModelProperty(value = "是否新记录,0否,1是") @ApiModelProperty(value = "是否新记录,0否,1是")
private String newRecoder; private String newRecoder;
...@@ -48,4 +50,7 @@ public class EventAlarmInfo { ...@@ -48,4 +50,7 @@ public class EventAlarmInfo {
@ApiModelProperty(value = "持续时间,单位秒") @ApiModelProperty(value = "持续时间,单位秒")
private Integer duration; private Integer duration;
@ApiModelProperty(value = "路口状态 0正常 1失衡 2拥堵 3溢出 5空放")
private Integer status;
} }
...@@ -43,11 +43,15 @@ public interface EventService { ...@@ -43,11 +43,15 @@ public interface EventService {
/** /**
* 当时事件报警数据监测 * 当时事件报警数据监测
* @param greenId
* @param crossId
* @param type 为1时查询当天最近30条,为空时查询当天所有
* @return * @return
* @throws DubboProviderException * @throws DubboProviderException
*/ */
List<EventAlarmInfo> findEventAlarmInfo(String realtimeType, String eventType, String name) throws DubboProviderException; List<EventAlarmInfo> findEventAlarmInfo(String realtimeType, String eventType, String name) throws DubboProviderException;
/**
* 查询当前未结束事件
* @return
* @throws DubboProviderException
*/
List<EventAlarmInfo> findNotFinishAlarmInfo() throws DubboProviderException;
} }
...@@ -260,6 +260,10 @@ public class EventServiceImpl implements EventService { ...@@ -260,6 +260,10 @@ public class EventServiceImpl implements EventService {
return eventAlarmInfo; return eventAlarmInfo;
} }
@Override
public List<EventAlarmInfo> findNotFinishAlarmInfo() throws DubboProviderException {
return holoEventMapper.findNotFinishAlarmInfo();
}
public static Set<String> getTimeScopeList(DateTime start, DateTime end, String dateFormat) { public static Set<String> getTimeScopeList(DateTime start, DateTime end, String dateFormat) {
......
...@@ -116,6 +116,22 @@ ...@@ -116,6 +116,22 @@
where t1.is_signal = 1 where t1.is_signal = 1
order by t2.duration desc order by t2.duration desc
</select> </select>
<!-- 查询路口未结束的报警状态 -->
<select id="findNotFinishAlarmInfo" parameterType="String" resultMap="eventAlarm">
select
DISTINCT
case when a.type=701 then 5 when a.type=702 then 1 when a.type=703 then 3 when a.type=707 then 2 else ifnull(a.type,0) end as status,
c.id as cross_id,
c.name as cross_name ,
b.label as current_algo,
SUBSTRING(c.location FROM 7 FOR 20) as wkt,
ifnull(a.alarm_status,-1) alarm_status,
a.opt_status
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
where c.is_signal=1
</select>
<select id="findEventAlarmInfo" parameterType="String" resultMap="eventAlarm"> <select id="findEventAlarmInfo" parameterType="String" resultMap="eventAlarm">
......
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