Commit 73add64c authored by duanruiming's avatar duanruiming

[add] 路口检测-路口列表来源事件表

parent cd277937
package net.wanji.opt.controller.signalopt;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.*;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.po.CrossDataRealtimePO;
......@@ -11,6 +9,7 @@ import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.databus.po.CrossDirStatusDataPO;
import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.trend.HoloEventInfoPO;
import net.wanji.opt.service.CrossIndexService;
import net.wanji.opt.vo.AIOptResultVO;
......@@ -153,4 +152,23 @@ public class CrossIndexController {
return JsonViewObject.newInstance().success(result);
}
@GetMapping("/selectCrossEventList")
@ApiOperation(httpMethod="GET",value="路口监测左下角路口事件列表", notes="")
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveCrossTurnIndex() {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<HoloEventInfoPO> list = crossIndexService.selectCrossEventList();
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
}
return jsonView;
}
}
......@@ -24,6 +24,7 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
List<HoloEventInfoPO> selectAIList(Date startTime);
List<HoloEventInfoPO> selectAIGreenList(Date startTime);
List<HoloEventInfoPO> selectCrossEventList();
EventStatisticPo findCrossEventCount(Map<String,Object> params);
......
......@@ -105,7 +105,7 @@ public class HoloEventInfoPO implements Serializable {
private String remark;
@ApiModelProperty(value = "拓展字段")
private String extend;
@ApiModelProperty(value = "拓展字段")
@ApiModelProperty(value = "告警状态 告警状态 0未处理 1分析中 2优化中 3优化完 4已结束")
private Integer alarmStatus;
@ApiModelProperty(value = "时间轴", notes = "")
......
......@@ -30,6 +30,7 @@ public interface CrossIndexService {
List<CrossStatusCountVO> crossStatusCount(String crossId) throws Exception;
HoloEventInfoPO crossEventDirTurn(String crossId) throws Exception;
List<HoloEventInfoPO> selectCrossEventList() throws Exception;
/**
* @Description 查询据当前时间某小时的数据
......@@ -38,4 +39,5 @@ public interface CrossIndexService {
* @return java.util.List<net.wanji.databus.po.CrossDirDataHistPO>
**/
CrossDirStatusDataPO selectByCrossIdAndHour(String crossId,int hour);
}
......@@ -248,4 +248,10 @@ public class CrossIndexServiceImpl implements CrossIndexService {
throw new Exception(e);
}
}
@Override
public List<HoloEventInfoPO> selectCrossEventList() throws Exception {
List<HoloEventInfoPO> holoEventInfoPOS = holoEventMapper.selectCrossEventList();
return holoEventInfoPOS;
}
}
......@@ -209,7 +209,7 @@ public class TrendServiceImpl implements TrendService {
}
if (Objects.equals(2, value.size())) {
Double speed = 0.0;
Double trafficIndex = 1.0;
Double trafficIndex = 0.0;
int travelTime = 0;
Integer stopTimes = 0;
GreenwaveListVO wDirVo = new GreenwaveListVO();
......
package net.wanji.opt.vo;
import lombok.Data;
/**
* @author duanruiming
* @date 2025/01/14 15:32
* @description 路口监测左下角路口事件列表
*/
@Data
public class CrossEventListPO {
private String crossId;
private String name;
private Integer count;
private Integer duration;
private String type;
private String typeName;
}
......@@ -84,6 +84,28 @@
</if>
GROUP BY cross_id,type
</select>
<!-- 路口监测左下角路口事件列表 -->
<select id = "selectCrossEventList" resultType="net.wanji.opt.vo.CrossEventListPO">
select t1.id crossId, t2.type, ifnull(t2.place_desc, "畅通") typeName,
ifnull(t2.count, 0) count, ifnull(t2.duration, 0) duration, t1.`name` name
from t_base_cross_info t1
left join
(select t1.cross_id, t1.type, t1.place_desc,
count(*) count,
sum(TIMESTAMPDIFF(SECOND, t1.start_time, ifnull(t1.end_time,now()))) duration
from t_event_info t1
left join (
select t2.cross_id, MAX(t2.start_time) start_time
from t_event_info t2
where t2.type in (701, 702, 703, 707) and t2.start_time > DATE_FORMAT(now(),'%Y-%m-%d 00:00:00')
group by t2.cross_id
) t2 on t1.cross_id = t2.cross_id and t1.start_time and t2.start_time
where t1.start_time > DATE_FORMAT(now(),'%Y-%m-%d 00:00:00')
group by t1.cross_id) t2
on t2.cross_id = t1.id
where t1.is_signal = 1
order by t2.duration desc
</select>
......
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