Commit 0a2b6316 authored by hanbing's avatar hanbing

[update] opt模块DAO层迁移至databus模块

parent b021a150
package net.wanji.web.mapper.scheme; package net.wanji.web.mapper.scheme;
import net.wanji.common.po.CrossDirDataRealtimePO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
......
...@@ -18,7 +18,6 @@ import net.wanji.web.mapper.scheme.CrossPhaseLightsMapper; ...@@ -18,7 +18,6 @@ import net.wanji.web.mapper.scheme.CrossPhaseLightsMapper;
import net.wanji.web.mapper.scheme.CrossTurnDataHistMapper; import net.wanji.web.mapper.scheme.CrossTurnDataHistMapper;
import net.wanji.web.mapper.scheme.LaneInfoMapper; import net.wanji.web.mapper.scheme.LaneInfoMapper;
import net.wanji.web.mapper.scheme.LaneSegmentMapper; import net.wanji.web.mapper.scheme.LaneSegmentMapper;
import net.wanji.common.po.CrossDirDataRealtimePO;
import net.wanji.web.po.scheme.CrossDirInfoPO; import net.wanji.web.po.scheme.CrossDirInfoPO;
import net.wanji.web.po.scheme.CrossLaneLightsPO; import net.wanji.web.po.scheme.CrossLaneLightsPO;
import net.wanji.web.po.scheme.CrossLightsPO; import net.wanji.web.po.scheme.CrossLightsPO;
......
...@@ -14,7 +14,7 @@ import java.util.Date; ...@@ -14,7 +14,7 @@ import java.util.Date;
@Component @Component
public class LanePeriodicDataEventListConvert { public class LanePeriodicDataEventListConvert {
public CrossDataRealTimePO convert2CrossDataRealTimePO(LanePeriodicDataDTO.EventList eventList, CrossBaseLaneInfoPO laneInfoPO) { public CrossDataRealtimePO convert2CrossDataRealTimePO(LanePeriodicDataDTO.EventList eventList, CrossBaseLaneInfoPO laneInfoPO) {
String id = laneInfoPO.getId(); String id = laneInfoPO.getId();
String crossId = laneInfoPO.getCrossId(); String crossId = laneInfoPO.getCrossId();
// todo 路口状态 // todo 路口状态
...@@ -29,7 +29,7 @@ public class LanePeriodicDataEventListConvert { ...@@ -29,7 +29,7 @@ public class LanePeriodicDataEventListConvert {
int batchTime = (int)now.getTime(); int batchTime = (int)now.getTime();
String dir = String.valueOf(laneInfoPO.getDir()); String dir = String.valueOf(laneInfoPO.getDir());
CrossDataRealTimePO crossDataRealTimePO = new CrossDataRealTimePO(); CrossDataRealtimePO crossDataRealTimePO = new CrossDataRealtimePO();
crossDataRealTimePO.setCrossId(crossId); crossDataRealTimePO.setCrossId(crossId);
crossDataRealTimePO.setStatus(0000); // 路口状态 crossDataRealTimePO.setStatus(0000); // 路口状态
crossDataRealTimePO.setType(1); // 1常规 2异常 crossDataRealTimePO.setType(1); // 1常规 2异常
...@@ -60,7 +60,7 @@ public class LanePeriodicDataEventListConvert { ...@@ -60,7 +60,7 @@ public class LanePeriodicDataEventListConvert {
return crossDataRealTimePO; return crossDataRealTimePO;
} }
public CrossDirDataRealTimePO convert2CrossDirDataRealTimePO(LanePeriodicDataDTO.EventList eventList, CrossBaseLaneInfoPO laneInfoPO) { public CrossDirDataRealtimePO convert2CrossDirDataRealTimePO(LanePeriodicDataDTO.EventList eventList, CrossBaseLaneInfoPO laneInfoPO) {
String crossId = laneInfoPO.getCrossId(); String crossId = laneInfoPO.getCrossId();
// todo 路口状态 // todo 路口状态
int trafficFlow = eventList.getTrafficFlow(); int trafficFlow = eventList.getTrafficFlow();
...@@ -75,7 +75,7 @@ public class LanePeriodicDataEventListConvert { ...@@ -75,7 +75,7 @@ public class LanePeriodicDataEventListConvert {
Integer dir = laneInfoPO.getDir(); Integer dir = laneInfoPO.getDir();
Integer type = laneInfoPO.getType(); Integer type = laneInfoPO.getType();
CrossDirDataRealTimePO crossDirDataRealTimePO = new CrossDirDataRealTimePO(); CrossDirDataRealtimePO crossDirDataRealTimePO = new CrossDirDataRealtimePO();
// 路口方向ID(路口ID_方向_进出口_主辅路序号) // 路口方向ID(路口ID_方向_进出口_主辅路序号)
crossDirDataRealTimePO.setId(String.valueOf(dir).concat(String.valueOf(type))); crossDirDataRealTimePO.setId(String.valueOf(dir).concat(String.valueOf(type)));
crossDirDataRealTimePO.setDirType(dir); crossDirDataRealTimePO.setDirType(dir);
...@@ -100,7 +100,7 @@ public class LanePeriodicDataEventListConvert { ...@@ -100,7 +100,7 @@ public class LanePeriodicDataEventListConvert {
return crossDirDataRealTimePO; return crossDirDataRealTimePO;
} }
public CrossTurnDataRealTimePO convert2CrossTurnDataRealtimePO(LanePeriodicDataDTO.EventList eventList, CrossBaseLaneInfoPO laneInfoPO) { public CrossTurnDataRealtimePO convert2CrossTurnDataRealtimePO(LanePeriodicDataDTO.EventList eventList, CrossBaseLaneInfoPO laneInfoPO) {
String crossId = laneInfoPO.getCrossId(); String crossId = laneInfoPO.getCrossId();
// todo 路口状态 // todo 路口状态
int trafficFlow = eventList.getTrafficFlow(); int trafficFlow = eventList.getTrafficFlow();
...@@ -116,7 +116,7 @@ public class LanePeriodicDataEventListConvert { ...@@ -116,7 +116,7 @@ public class LanePeriodicDataEventListConvert {
Integer type = laneInfoPO.getType(); Integer type = laneInfoPO.getType();
Integer turn = laneInfoPO.getTurn(); Integer turn = laneInfoPO.getTurn();
CrossTurnDataRealTimePO crossTurnDataRealtimePO = new CrossTurnDataRealTimePO(); CrossTurnDataRealtimePO crossTurnDataRealtimePO = new CrossTurnDataRealtimePO();
crossTurnDataRealtimePO.setId( crossId.concat("").concat(String.valueOf(turn))); crossTurnDataRealtimePO.setId( crossId.concat("").concat(String.valueOf(turn)));
crossTurnDataRealtimePO.setTurnType(""); crossTurnDataRealtimePO.setTurnType("");
crossTurnDataRealtimePO.setInDir(0000); crossTurnDataRealtimePO.setInDir(0000);
......
package net.wanji.opt.dao.mapper;
import net.wanji.opt.po.CrossDataHistPO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author hanbing
* @date 2023/1/12 13:24
* @desc CrossInfoMapper
*/
@Repository
public interface CrossDataHistMapper {
List<CrossDataHistPO> selectByCrossIdAndTimestamp(String crossId, long preSeconds);
}
package net.wanji.opt.dao.mapper;
import net.wanji.common.po.CrossDirDataRealtimePO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2023/1/11 17:25
*/
@Repository
public interface CrossDirDataRealtimeMapper {
CrossDirDataRealtimePO selectByCrossIdAndDirType(String crossId, Integer key);
List<CrossDirDataRealtimePO> selectByCrossIdAndInOutType(String crossId, Integer inOutType);
}
package net.wanji.opt.dao.mapper.trend;
import net.wanji.opt.po.trend.CrossDataRealtimePO;
import net.wanji.opt.vo.AbnormalCrossListVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 态势监测-问题路口基础信息
*
* @author Kent HAN
* @date 2023/2/8 9:22
*/
@Repository
public interface CrossDataRealtimeMapper {
List<AbnormalCrossListVO> selectAbnormalCross(Integer status, String name, Integer type);
CrossDataRealtimePO selectByCrossId(String crossId);
}
package net.wanji.opt.dao.mapper.trend;
import net.wanji.opt.bo.CrossDirDataHistAvgBO;
import net.wanji.opt.po.trend.CrossDirDataHistPO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 路口方向历史数据
*
* @author Kent HAN
* @date 2023/2/8 9:22
*/
@Repository
public interface CrossDirDataHistMapper {
List<CrossDirDataHistPO> selectByCrossIdAndTimestamp(String crossId, long preSeconds);
List<CrossDirDataHistPO> selectByCrossIdDirAndTimestamp(String crossId, Integer dir, long preSeconds);
List<CrossDirDataHistAvgBO> selectByCrossIdInOutTimestamp(String crossId, Integer inOutType, long preSeconds);
}
package net.wanji.opt.dao.mapper.trend;
import net.wanji.opt.po.trend.CrossTurnDataRealtimePO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 路口转向实时数据
*
* @author Kent HAN
* @date 2023/2/8 9:22
*/
@Repository
public interface CrossTurnDataRealtimeMapper {
List<CrossTurnDataRealtimePO> selectByCrossId(String crossId);
}
...@@ -3,6 +3,8 @@ package net.wanji.opt.dto; ...@@ -3,6 +3,8 @@ package net.wanji.opt.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.wanji.databus.dto.CrossDirInfoDTO;
import net.wanji.databus.dto.CrossTurnInfoDTO;
import java.util.List; import java.util.List;
......
package net.wanji.opt.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author hanbing
* @date 2023/1/10 16:36
*/
@Data
public class CrossDataHistPO {
/** 路口编号 */
@ApiModelProperty(name = "路口编号",notes = "")
private String crossId ;
/** 路口状态:0正常;1失衡;2拥堵;3溢出;4死锁 */
@ApiModelProperty(name = "路口状态:0正常;1失衡;2拥堵;3溢出;4死锁",notes = "")
private Integer status ;
/** 拥堵类型:1常规;2异常 */
@ApiModelProperty(name = "拥堵类型:1常规;2异常",notes = "")
private Integer type ;
/** 交通指数(1~10) */
@ApiModelProperty(name = "交通指数(1~10)",notes = "")
private Double trafficIndex ;
/** 开始时间:yyyy-MM-dd HH;mm:ss */
@ApiModelProperty(name = "开始时间:yyyy-MM-dd HH",notes = "mm:ss")
private Date startTime ;
/** 持续时间(单位:分钟) */
@ApiModelProperty(name = "持续时间(单位:分钟)",notes = "")
private Integer duration ;
/** 是否失衡:0否;1是 */
@ApiModelProperty(name = "是否失衡:0否;1是",notes = "")
private Integer isUnbalance ;
/** 是否溢出:0否;1是 */
@ApiModelProperty(name = "是否溢出:0否;1是",notes = "")
private Integer isSpillover ;
/** 是否拥堵:0否;1是 */
@ApiModelProperty(name = "是否拥堵:0否;1是",notes = "")
private Integer isCongestion ;
/** 失衡指数 */
@ApiModelProperty(name = "失衡指数",notes = "")
private Double unbalanceIndex ;
/** 溢出指数 */
@ApiModelProperty(name = "溢出指数",notes = "")
private Double spilloverIndex ;
/** 拥堵指数 */
@ApiModelProperty(name = "拥堵指数",notes = "")
private Double congestionIndex ;
/** 路口失衡方向:1,2,3... */
@ApiModelProperty(name = "路口失衡方向:1,2,3...",notes = "")
private String unbalanceDirs ;
/** 路口溢出方向:1,2,3... */
@ApiModelProperty(name = "路口溢出方向:1,2,3...",notes = "")
private String spilloverDirs ;
/** 路口拥堵方向:1,2,3... */
@ApiModelProperty(name = "路口拥堵方向:1,2,3...",notes = "")
private String congestionDirs ;
/** 交通流量(辆) */
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow ;
/** 交通流率/h */
@ApiModelProperty(name = "交通流率/h",notes = "")
private Double flowRate ;
/** 平均速度(km/h) */
@ApiModelProperty(name = "平均速度(km/h)",notes = "")
private Double speed ;
/** 最大排队(米) */
@ApiModelProperty(name = "最大排队(米)",notes = "")
private Double queueLength ;
/** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "")
private Double stopTimes ;
/** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "")
private Integer delayTime ;
/** 饱和度 */
@ApiModelProperty(name = "饱和度",notes = "")
private Double sturation ;
/** 采集时间(10位时间戳) */
@ApiModelProperty(name = "采集时间(10位时间戳)",notes = "")
private Integer batchTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.opt.po.trend;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author hfx
* @date 2023/1/10 16:36
*/
@Data
public class CrossDirDataHistPO {
/** 路口方向ID(路口ID_方向_进出口_主辅路序号) */
@ApiModelProperty(name = "路口方向ID(路口ID_方向_进出口_主辅路序号)",notes = "")
private String id ;
/** 路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dirType ;
/** 进出口类型:1进口;2出口 */
@ApiModelProperty(name = "进出口类型:1进口;2出口",notes = "")
private Integer inOutType ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId ;
/** 路段长度 */
@ApiModelProperty(name = "路段长度",notes = "")
private Double length ;
/** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */
@ApiModelProperty(name = "交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知",notes = "")
private Integer status ;
/** 交通指数 */
@ApiModelProperty(name = "交通指数",notes = "")
private Double trafficIndex ;
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss",notes = "")
private Date startTime ;
@ApiModelProperty(value = "通行能力(辆/某一时段内最大过车数),通行能力=自然流量",notes = "")
private Integer capacity ;
@ApiModelProperty(value = "持续时间(单位:分钟)",notes = "")
private Integer duration ;
/** 交通流量(辆) */
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow ;
/** 平均速度(km/h) */
@ApiModelProperty(name = "平均速度(km/h)",notes = "")
private Double speed ;
/** 排队长度(米) */
@ApiModelProperty(name = "排队长度(米)",notes = "")
private Double queueLength ;
/** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "")
private Double stopTimes ;
/** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "")
private Integer delayTime ;
/** 饱和度 */
@ApiModelProperty(name = "饱和度",notes = "")
private Double sturation ;
/** 采集时间(10位时间戳) */
@ApiModelProperty(name = "采集时间(10位时间戳)",notes = "")
private Integer batchTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
@ApiModelProperty(name = "溢流时长,计算溢流率提供;溢流率:交叉口间路段车辆排队长度超出可容纳空间的时长与观测总时长的百分比",notes = "")
private Double effusionTime ;
}
package net.wanji.opt.po.trend;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author hfx
* @date 2023/1/10 16:36
*/
@Data
public class CrossTurnDataRealtimePO {
/** 转向ID(路口ID_驶入方向_转向类型) */
@ApiModelProperty(name = "转向ID(路口ID_驶入方向_转向类型)",notes = "")
private String id ;
/** 转向类型:u掉头;l左转;s直行;r右转; */
@ApiModelProperty(name = "转向类型:u掉头;l左转;s直行;r右转;",notes = "")
private String turnType ;
/** 驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer inDir ;
/** 驶出方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "驶出方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer outDir ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId ;
/** 交通流量(辆) */
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow ;
/** 平均速度(km/h) */
@ApiModelProperty(name = "平均速度(km/h)",notes = "")
private Double speed ;
/** 驶入速度(km/h) */
@ApiModelProperty(name = "驶入速度(km/h)",notes = "")
private Double inSpeed ;
/** 驶出速度(km/h) */
@ApiModelProperty(name = "驶出速度(km/h)",notes = "")
private Double outSpeed ;
/** 排队长度(米) */
@ApiModelProperty(name = "排队长度(米)",notes = "")
private Double queueLength ;
/** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "")
private Double stopTimes ;
/** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "")
private Integer delayTime ;
/** 饱和度 */
@ApiModelProperty(name = "饱和度",notes = "")
private Double sturation ;
/** 车头间距(米) */
@ApiModelProperty(name = "车头间距(米)",notes = "")
private Double vehheadDist ;
/** 车头时距(秒) */
@ApiModelProperty(name = "车头时距(秒)",notes = "")
private Double vehheadTime ;
/** 可信度:0~1 */
@ApiModelProperty(name = "可信度:0~1",notes = "")
private Double quality ;
/** 采集时间(10位时间戳) */
@ApiModelProperty(name = "采集时间(10位时间戳)",notes = "")
private Integer batchTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.opt.service; package net.wanji.opt.service;
import net.wanji.opt.po.trend.CrossDataRealtimePO; import net.wanji.databus.po.CrossDataRealtimePO;
import java.util.List; import java.util.List;
......
...@@ -5,7 +5,10 @@ import net.wanji.common.enums.CrossStatusEnum; ...@@ -5,7 +5,10 @@ import net.wanji.common.enums.CrossStatusEnum;
import net.wanji.common.framework.Constants; import net.wanji.common.framework.Constants;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dao.entity.RidInfoEntity; import net.wanji.databus.dao.entity.RidInfoEntity;
import net.wanji.databus.dto.CrossDirInfoDTO;
import net.wanji.databus.dto.CrossTurnInfoDTO;
import net.wanji.databus.entity.develop.servicedevelop.develop.StatusCodeEnum; import net.wanji.databus.entity.develop.servicedevelop.develop.StatusCodeEnum;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.feign.pojo.vo.SchemeSendVO; import net.wanji.feign.pojo.vo.SchemeSendVO;
import net.wanji.feign.pojo.vo.SignalStatusVO; import net.wanji.feign.pojo.vo.SignalStatusVO;
import net.wanji.feign.service.UtcFeignClients; import net.wanji.feign.service.UtcFeignClients;
...@@ -13,15 +16,12 @@ import net.wanji.opt.cache.CrossDirTurnPhaseCache; ...@@ -13,15 +16,12 @@ import net.wanji.opt.cache.CrossDirTurnPhaseCache;
import net.wanji.opt.cache.CrossRidInfoCache; import net.wanji.opt.cache.CrossRidInfoCache;
import net.wanji.opt.common.exception.OptServiceException; import net.wanji.opt.common.exception.OptServiceException;
import net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper; import net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper;
import net.wanji.opt.dto.CrossDirInfoDTO;
import net.wanji.opt.dto.CrossPhaseDTO; import net.wanji.opt.dto.CrossPhaseDTO;
import net.wanji.opt.dto.CrossTurnDataRealtimeDTO; import net.wanji.opt.dto.CrossTurnDataRealtimeDTO;
import net.wanji.opt.dto.CrossTurnInfoDTO;
import net.wanji.opt.po.base.CrossPhasePO; import net.wanji.opt.po.base.CrossPhasePO;
import net.wanji.opt.po.base.CrossSchemeOptLogPO; import net.wanji.opt.po.base.CrossSchemeOptLogPO;
import net.wanji.opt.po.base.CrossSchemePO; import net.wanji.opt.po.base.CrossSchemePO;
import net.wanji.opt.po.strategy.SceneStrategyIdeaPO; import net.wanji.opt.po.strategy.SceneStrategyIdeaPO;
import net.wanji.opt.po.trend.CrossDataRealtimePO;
import net.wanji.opt.service.CrossOptimizeService; import net.wanji.opt.service.CrossOptimizeService;
import net.wanji.opt.service.strategy.SceneService; import net.wanji.opt.service.strategy.SceneService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -34,7 +34,15 @@ import org.springframework.util.CollectionUtils; ...@@ -34,7 +34,15 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static net.wanji.opt.cache.CrossPhaseInfoCache.getCrossPhaseCacheByCrossId; import static net.wanji.opt.cache.CrossPhaseInfoCache.getCrossPhaseCacheByCrossId;
......
...@@ -10,31 +10,31 @@ import lombok.extern.slf4j.Slf4j; ...@@ -10,31 +10,31 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.dto.CrossIdDTO; import net.wanji.common.dto.CrossIdDTO;
import net.wanji.common.utils.tool.CrossUtil; import net.wanji.common.utils.tool.CrossUtil;
import net.wanji.databus.dao.entity.RidInfoEntity; import net.wanji.databus.dao.entity.RidInfoEntity;
import net.wanji.databus.dao.mapper.CrossDataHistMapper;
import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.dao.mapper.CrossDirDataHistMapper;
import net.wanji.databus.dao.mapper.RidInfoMapper; import net.wanji.databus.dao.mapper.RidInfoMapper;
import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.po.CrossDirDataHistPO;
import net.wanji.feign.pojo.vo.SchemeSendVO; import net.wanji.feign.pojo.vo.SchemeSendVO;
import net.wanji.opt.dao.mapper.CrossDataHistMapper;
import net.wanji.opt.dao.mapper.CrossDirInfoMapper; import net.wanji.opt.dao.mapper.CrossDirInfoMapper;
import net.wanji.opt.dao.mapper.CrossInfoMapper; import net.wanji.opt.dao.mapper.CrossInfoMapper;
import net.wanji.opt.dao.mapper.CrossPhaseMapper; import net.wanji.opt.dao.mapper.CrossPhaseMapper;
import net.wanji.opt.dao.mapper.CrossSchemeMapper; import net.wanji.opt.dao.mapper.CrossSchemeMapper;
import net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper; import net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper;
import net.wanji.opt.dao.mapper.strategy.SceneMapper; import net.wanji.opt.dao.mapper.strategy.SceneMapper;
import net.wanji.opt.dao.mapper.trend.CrossDataRealtimeMapper;
import net.wanji.opt.dao.mapper.trend.CrossDirDataHistMapper;
import net.wanji.opt.dto.CrossIdAndDirDTO; import net.wanji.opt.dto.CrossIdAndDirDTO;
import net.wanji.opt.dto.CrossIdAndSchemeIdDTO; import net.wanji.opt.dto.CrossIdAndSchemeIdDTO;
import net.wanji.opt.dto.OptDataExtend; import net.wanji.opt.dto.OptDataExtend;
import net.wanji.opt.dto.SendManualDTO; import net.wanji.opt.dto.SendManualDTO;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO; import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.dto.strategy.QuerySceneDTO; import net.wanji.opt.dto.strategy.QuerySceneDTO;
import net.wanji.opt.po.CrossDataHistPO;
import net.wanji.opt.po.base.CrossInfoPO; import net.wanji.opt.po.base.CrossInfoPO;
import net.wanji.opt.po.base.CrossPhasePO; import net.wanji.opt.po.base.CrossPhasePO;
import net.wanji.opt.po.base.CrossSchemeOptLogPO; import net.wanji.opt.po.base.CrossSchemeOptLogPO;
import net.wanji.opt.po.base.CrossSchemePO; import net.wanji.opt.po.base.CrossSchemePO;
import net.wanji.opt.po.strategy.ScenePO; import net.wanji.opt.po.strategy.ScenePO;
import net.wanji.opt.po.trend.CrossDataRealtimePO;
import net.wanji.opt.po.trend.CrossDirDataHistPO;
import net.wanji.opt.service.DiagnoService; import net.wanji.opt.service.DiagnoService;
import net.wanji.opt.service.signalcontrol.FeignProxyService; import net.wanji.opt.service.signalcontrol.FeignProxyService;
import net.wanji.opt.service.strategy.SceneService; import net.wanji.opt.service.strategy.SceneService;
......
...@@ -8,19 +8,19 @@ import com.google.gson.GsonBuilder; ...@@ -8,19 +8,19 @@ import com.google.gson.GsonBuilder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.dto.CrossIdDTO; import net.wanji.common.dto.CrossIdDTO;
import net.wanji.common.enums.CrossInOutEnum; import net.wanji.common.enums.CrossInOutEnum;
import net.wanji.common.po.CrossDirDataRealtimePO;
import net.wanji.common.utils.tool.CrossUtil; import net.wanji.common.utils.tool.CrossUtil;
import net.wanji.opt.bo.CrossDirDataHistAvgBO; import net.wanji.databus.bo.CrossDirDataHistAvgBO;
import net.wanji.opt.dao.mapper.CrossDirDataRealtimeMapper; import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.dao.mapper.CrossDirDataHistMapper;
import net.wanji.databus.dao.mapper.CrossDirDataRealtimeMapper;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.opt.dao.mapper.CrossInfoMapper; import net.wanji.opt.dao.mapper.CrossInfoMapper;
import net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper; import net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper;
import net.wanji.opt.dao.mapper.trend.CrossDataRealtimeMapper;
import net.wanji.opt.dao.mapper.trend.CrossDirDataHistMapper;
import net.wanji.opt.dto.CrossIdAndMinutesDTO; import net.wanji.opt.dto.CrossIdAndMinutesDTO;
import net.wanji.opt.dto.OptDataExtend; import net.wanji.opt.dto.OptDataExtend;
import net.wanji.opt.po.base.CrossInfoPO; import net.wanji.opt.po.base.CrossInfoPO;
import net.wanji.opt.po.base.CrossSchemeOptLogPO; import net.wanji.opt.po.base.CrossSchemeOptLogPO;
import net.wanji.opt.po.trend.CrossDataRealtimePO;
import net.wanji.opt.service.EvaluateService; import net.wanji.opt.service.EvaluateService;
import net.wanji.opt.vo.EvaluateCrossDetailVO; import net.wanji.opt.vo.EvaluateCrossDetailVO;
import net.wanji.opt.vo.EvaluateMetricsVO; import net.wanji.opt.vo.EvaluateMetricsVO;
...@@ -48,7 +48,10 @@ public class EvaluateServiceImpl implements EvaluateService { ...@@ -48,7 +48,10 @@ public class EvaluateServiceImpl implements EvaluateService {
private Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); private Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
public EvaluateServiceImpl(CrossInfoMapper crossInfoMapper, CrossSchemeOptLogMapper crossSchemeOptLogMapper, CrossDataRealtimeMapper crossDataRealtimeMapper, CrossDirDataRealtimeMapper crossDirDataRealtimeMapper, CrossDirDataHistMapper crossDirDataHistMapper) { public EvaluateServiceImpl(CrossInfoMapper crossInfoMapper, CrossSchemeOptLogMapper crossSchemeOptLogMapper,
CrossDataRealtimeMapper crossDataRealtimeMapper,
CrossDirDataRealtimeMapper crossDirDataRealtimeMapper,
CrossDirDataHistMapper crossDirDataHistMapper) {
this.crossInfoMapper = crossInfoMapper; this.crossInfoMapper = crossInfoMapper;
this.crossSchemeOptLogMapper = crossSchemeOptLogMapper; this.crossSchemeOptLogMapper = crossSchemeOptLogMapper;
this.crossDataRealtimeMapper = crossDataRealtimeMapper; this.crossDataRealtimeMapper = crossDataRealtimeMapper;
......
...@@ -9,24 +9,24 @@ import net.wanji.common.enums.EventAlarmEnum; ...@@ -9,24 +9,24 @@ import net.wanji.common.enums.EventAlarmEnum;
import net.wanji.common.enums.EventAlarmSourceEnum; import net.wanji.common.enums.EventAlarmSourceEnum;
import net.wanji.common.utils.tool.CrossUtil; import net.wanji.common.utils.tool.CrossUtil;
import net.wanji.databus.dao.entity.RidInfoEntity; import net.wanji.databus.dao.entity.RidInfoEntity;
import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.dao.mapper.CrossDirDataHistMapper;
import net.wanji.databus.dao.mapper.CrossTurnDataRealtimeMapper;
import net.wanji.databus.dao.mapper.RidInfoMapper; import net.wanji.databus.dao.mapper.RidInfoMapper;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.po.CrossDirDataHistPO;
import net.wanji.databus.po.CrossTurnDataRealtimePO;
import net.wanji.databus.vo.AbnormalCrossListVO;
import net.wanji.opt.dao.mapper.CrossDirInfoMapper; import net.wanji.opt.dao.mapper.CrossDirInfoMapper;
import net.wanji.opt.dao.mapper.CrossInfoMapper; import net.wanji.opt.dao.mapper.CrossInfoMapper;
import net.wanji.opt.dao.mapper.trend.CrossDataRealtimeMapper;
import net.wanji.opt.dao.mapper.trend.CrossDirDataHistMapper;
import net.wanji.opt.dao.mapper.trend.CrossTurnDataRealtimeMapper;
import net.wanji.opt.dao.mapper.trend.EventAlarmMapper; import net.wanji.opt.dao.mapper.trend.EventAlarmMapper;
import net.wanji.opt.dao.mapper.trend.GreenwaveInfoMapper; import net.wanji.opt.dao.mapper.trend.GreenwaveInfoMapper;
import net.wanji.opt.dto.trend.AbnormalCrossListDTO; import net.wanji.opt.dto.trend.AbnormalCrossListDTO;
import net.wanji.opt.dto.trend.GreenwaveListDTO; import net.wanji.opt.dto.trend.GreenwaveListDTO;
import net.wanji.opt.po.base.CrossInfoPO; import net.wanji.opt.po.base.CrossInfoPO;
import net.wanji.opt.po.trend.CrossDataRealtimePO;
import net.wanji.opt.po.trend.CrossDirDataHistPO;
import net.wanji.opt.po.trend.CrossTurnDataRealtimePO;
import net.wanji.opt.po.trend.EventAlarmPO; import net.wanji.opt.po.trend.EventAlarmPO;
import net.wanji.opt.service.TrendService; import net.wanji.opt.service.TrendService;
import net.wanji.opt.vo.AbnormalCrossDetailVO; import net.wanji.opt.vo.AbnormalCrossDetailVO;
import net.wanji.opt.vo.AbnormalCrossListVO;
import net.wanji.opt.vo.AbnormalCrossStats; import net.wanji.opt.vo.AbnormalCrossStats;
import net.wanji.opt.vo.AbnormalCrossVO; import net.wanji.opt.vo.AbnormalCrossVO;
import net.wanji.opt.vo.EventAlarmVO; import net.wanji.opt.vo.EventAlarmVO;
...@@ -64,7 +64,8 @@ public class TrendServiceImpl implements TrendService { ...@@ -64,7 +64,8 @@ public class TrendServiceImpl implements TrendService {
public TrendServiceImpl(GreenwaveInfoMapper greenwaveInfoMapper, CrossInfoMapper crossInfoMapper, public TrendServiceImpl(GreenwaveInfoMapper greenwaveInfoMapper, CrossInfoMapper crossInfoMapper,
CrossDataRealtimeMapper crossDataRealtimeMapper, CrossDataRealtimeMapper crossDataRealtimeMapper,
CrossTurnDataRealtimeMapper crossTurnDataRealtimeMapper, CrossTurnDataRealtimeMapper crossTurnDataRealtimeMapper,
CrossDirDataHistMapper crossDirDataHistMapper, EventAlarmMapper eventAlarmMapper, RidInfoMapper ridInfoMapper, CrossDirInfoMapper crossDirInfoMapper) { CrossDirDataHistMapper crossDirDataHistMapper, EventAlarmMapper eventAlarmMapper,
RidInfoMapper ridInfoMapper, CrossDirInfoMapper crossDirInfoMapper) {
this.greenwaveInfoMapper = greenwaveInfoMapper; this.greenwaveInfoMapper = greenwaveInfoMapper;
this.crossInfoMapper = crossInfoMapper; this.crossInfoMapper = crossInfoMapper;
this.crossDataRealtimeMapper = crossDataRealtimeMapper; this.crossDataRealtimeMapper = crossDataRealtimeMapper;
......
...@@ -5,12 +5,12 @@ import lombok.RequiredArgsConstructor; ...@@ -5,12 +5,12 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.CrossStatusEnum; import net.wanji.common.enums.CrossStatusEnum;
import net.wanji.common.framework.Constants; import net.wanji.common.framework.Constants;
import net.wanji.opt.dao.mapper.trend.CrossDataRealtimeMapper; import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.opt.dto.CrossTurnDataRealtimeDTO; import net.wanji.opt.dto.CrossTurnDataRealtimeDTO;
import net.wanji.opt.dto.LaneInfoDTO; import net.wanji.opt.dto.LaneInfoDTO;
import net.wanji.opt.kafka.ConsumerHandler; import net.wanji.opt.kafka.ConsumerHandler;
import net.wanji.opt.po.kafka.LanePeriodicDataPO; import net.wanji.opt.po.kafka.LanePeriodicDataPO;
import net.wanji.opt.po.trend.CrossDataRealtimePO;
import net.wanji.opt.query.LaneQuery; import net.wanji.opt.query.LaneQuery;
import net.wanji.opt.service.CrossOptimizeService; import net.wanji.opt.service.CrossOptimizeService;
import net.wanji.opt.service.impl.LaneInfoServiceImpl; import net.wanji.opt.service.impl.LaneInfoServiceImpl;
......
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.wanji.databus.vo.AbnormalCrossListVO;
import java.util.List; import java.util.List;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.CrossDataHistMapper">
<select id="selectByCrossIdAndTimestamp" resultType="net.wanji.opt.po.CrossDataHistPO">
select
cross_id,status,type,traffic_index,start_time,duration,is_unbalance,is_spillover,is_congestion,unbalance_index,spillover_index,congestion_index,unbalance_dirs,spillover_dirs,congestion_dirs,flow,flow_rate,speed,queue_length,stop_times,delay_time,sturation,batch_time,gmt_create,gmt_modified
from t_cross_data_hist
where cross_id = #{crossId}
and batch_time <![CDATA[ >= ]]> #{preSeconds}
order by batch_time
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.CrossDirDataRealtimeMapper">
<sql id="baseColumnList">
id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,duration,flow,speed,queue_length,
stop_times,delay_time,sturation,batch_time,gmt_create,gmt_modified,effusion_time
</sql>
<select id="selectByCrossIdAndDirType" resultType="net.wanji.common.po.CrossDirDataRealtimePO">
select <include refid="baseColumnList"/>
from t_cross_dir_data_realtime
where cross_id = #{crossId} and dir_type = #{key} and in_out_type = 1
</select>
<select id="selectByCrossIdAndInOutType" resultType="net.wanji.common.po.CrossDirDataRealtimePO">
select <include refid="baseColumnList"/>
from t_cross_dir_data_realtime
where cross_id = #{crossId} and in_out_type = #{inOutType}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.trend.CrossDataRealtimeMapper">
<select id="selectAbnormalCross" resultType="net.wanji.opt.vo.AbnormalCrossListVO">
select
t2.id, t2.name, t1.unbalance_dirs, t1.congestion_dirs, t1.spillover_dirs, t1.status as realtimeStatus,
t1.start_time, t1.duration, t2.location as locationStr, t1.is_unbalance, t1.is_spillover, t1.is_congestion
from t_cross_data_realtime t1 JOIN t_base_cross_info t2
ON t1.cross_id = t2.id
<where>
<if test="status != null">
and (t1.status = #{status}
<if test="status == 1"> or t1.is_unbalance = 1 </if>
<if test="status == 2"> or t1.is_congestion = 1 </if>
<if test="status == 3"> or t1.is_spillover = 1 </if>)
</if>
<if test="name != null and name != ''">
and t2.name like concat('%',#{name},'%')
</if>
<if test="type != null">
and t1.type = #{type}
</if>
<if test="status == null">
and t1.status in (0, 1, 2, 3)
</if>
and t2.is_signal = 1
</where>
</select>
<select id="selectByCrossId" resultType="net.wanji.opt.po.trend.CrossDataRealtimePO">
select
cross_id,status,type,traffic_index,start_time,duration,is_unbalance,is_spillover,is_congestion,unbalance_index,spillover_index,congestion_index,unbalance_dirs,spillover_dirs,congestion_dirs,flow,flow_rate,speed,queue_length,stop_times,delay_time,sturation,batch_time,gmt_create,gmt_modified
from t_cross_data_realtime
where cross_id = #{crossId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.trend.CrossDirDataHistMapper">
<sql id="baseColumnList">
id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,flow,speed,queue_length,stop_times,
delay_time,sturation,batch_time,gmt_create,gmt_modified,effusion_time
</sql>
<select id="selectByCrossIdAndTimestamp" resultType="net.wanji.opt.po.trend.CrossDirDataHistPO">
select <include refid="baseColumnList"/>
from t_cross_dir_data_hist
where cross_id = #{crossId} and in_out_type = 1
and batch_time <![CDATA[ >= ]]> #{preSeconds}
order by batch_time
</select>
<select id="selectByCrossIdDirAndTimestamp" resultType="net.wanji.opt.po.trend.CrossDirDataHistPO">
select <include refid="baseColumnList"/>
from t_cross_dir_data_hist
where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir}
and batch_time <![CDATA[ >= ]]> #{preSeconds}
order by batch_time
</select>
<select id="selectByCrossIdInOutTimestamp" resultType="net.wanji.opt.bo.CrossDirDataHistAvgBO">
SELECT dir_type as dirType, avg(capacity) as avgCapacity, avg(flow) as avgFlow,
avg(queue_length) as avgQueueLength, avg(traffic_index) as avgIndex,
avg(effusion_time) as avgEffusionTime
FROM t_cross_dir_data_hist
WHERE cross_id = #{crossId}
AND in_out_type = #{inOutType}
AND batch_time <![CDATA[ >= ]]> #{preSeconds}
GROUP BY dir_type
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.trend.CrossTurnDataRealtimeMapper">
<select id="selectByCrossId" resultType="net.wanji.opt.po.trend.CrossTurnDataRealtimePO">
select
id,turn_type,in_dir,out_dir,cross_id,flow,speed,in_speed,out_speed,queue_length,stop_times,delay_time,sturation,vehhead_dist,vehhead_time,quality,batch_time,gmt_create,gmt_modified
from t_cross_turn_data_realtime
where cross_id = #{crossId}
</select>
</mapper>
package net.wanji.common.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2023/1/11 17:27
*/
@Data
public class CrossDirDataRealtimePO {
/** 路口方向ID(路口ID_方向_进出口_主辅路序号) */
@ApiModelProperty(name = "路口方向ID(路口ID_方向_进出口_主辅路序号)",notes = "")
private String id ;
/** 路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dirType ;
/** 进出口类型:1进口;2出口 */
@ApiModelProperty(name = "进出口类型:1进口;2出口",notes = "")
private Integer inOutType ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId ;
/** 路段长度 */
@ApiModelProperty(name = "路段长度",notes = "")
private Double length ;
/** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */
@ApiModelProperty(name = "交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知",notes = "")
private Integer status ;
/** 交通指数 */
@ApiModelProperty(name = "交通指数",notes = "")
private Double trafficIndex ;
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss",notes = "")
private Date startTime ;
@ApiModelProperty(value = "通行能力(辆/某一时段内最大过车数),通行能力=自然流量",notes = "")
private Integer capacity ;
@ApiModelProperty(value = "持续时间(单位:分钟)",notes = "")
private Integer duration ;
/** 交通流量(辆) */
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow ;
/** 平均速度(km/h) */
@ApiModelProperty(name = "平均速度(km/h)",notes = "")
private Double speed ;
/** 排队长度(米) */
@ApiModelProperty(name = "排队长度(米)",notes = "")
private Double queueLength ;
/** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "")
private Double stopTimes ;
/** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "")
private Integer delayTime ;
/** 饱和度 */
@ApiModelProperty(name = "饱和度",notes = "")
private Double sturation ;
/** 采集时间(10位时间戳) */
@ApiModelProperty(name = "采集时间(10位时间戳)",notes = "")
private Integer batchTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
@ApiModelProperty(name = "溢流时长,计算溢流率提供;溢流率:交叉口间路段车辆排队长度超出可容纳空间的时长与观测总时长的百分比",notes = "")
private Double effusionTime ;
}
...@@ -17,4 +17,7 @@ import java.util.List; ...@@ -17,4 +17,7 @@ import java.util.List;
public interface CrossDataHistMapper extends BaseMapper<CrossDataHistPO> { public interface CrossDataHistMapper extends BaseMapper<CrossDataHistPO> {
void insertBatch(@Param("list") List<CrossDataHistPO> list); void insertBatch(@Param("list") List<CrossDataHistPO> list);
void deleteBatch(@Param("list") Collection<String> crossIds); void deleteBatch(@Param("list") Collection<String> crossIds);
List<CrossDataHistPO> selectByCrossIdAndTimestamp(String crossId, long preSeconds);
} }
package net.wanji.databus.dao.mapper; package net.wanji.databus.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.po.CrossDataRealTimePO; import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.vo.AbnormalCrossListVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -13,8 +14,12 @@ import java.util.List; ...@@ -13,8 +14,12 @@ import java.util.List;
* @date 2023/03/10 20:06 * @date 2023/03/10 20:06
*/ */
@Mapper @Mapper
public interface CrossDataRealTimeMapper extends BaseMapper<CrossDataRealTimePO> { public interface CrossDataRealtimeMapper extends BaseMapper<CrossDataRealtimePO> {
void insertBatch(@Param("list") List<CrossDataRealTimePO> list); void insertBatch(@Param("list") List<CrossDataRealtimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds); void deleteBatch(@Param("list") Collection<String> crossIds);
List<AbnormalCrossListVO> selectAbnormalCross(Integer status, String name, Integer type);
CrossDataRealtimePO selectByCrossId(String crossId);
} }
package net.wanji.databus.dao.mapper; package net.wanji.databus.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.bo.CrossDirDataHistAvgBO;
import net.wanji.databus.po.CrossDirDataHistPO; import net.wanji.databus.po.CrossDirDataHistPO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -17,4 +18,9 @@ public interface CrossDirDataHistMapper extends BaseMapper<CrossDirDataHistPO> { ...@@ -17,4 +18,9 @@ public interface CrossDirDataHistMapper extends BaseMapper<CrossDirDataHistPO> {
void insertBatch(@Param("list")List<CrossDirDataHistPO> list); void insertBatch(@Param("list")List<CrossDirDataHistPO> list);
void deleteBatch(@Param("list") Collection<String> crossIds); void deleteBatch(@Param("list") Collection<String> crossIds);
List<CrossDirDataHistPO> selectByCrossIdAndTimestamp(String crossId, long preSeconds);
List<CrossDirDataHistPO> selectByCrossIdDirAndTimestamp(String crossId, Integer dir, long preSeconds);
List<CrossDirDataHistAvgBO> selectByCrossIdInOutTimestamp(String crossId, Integer inOutType, long preSeconds);
} }
package net.wanji.databus.dao.mapper; package net.wanji.databus.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.po.CrossDirDataRealTimePO; import net.wanji.databus.po.CrossDirDataRealtimePO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -13,8 +13,12 @@ import java.util.List; ...@@ -13,8 +13,12 @@ import java.util.List;
* @date 2023/03/10 21:09 * @date 2023/03/10 21:09
*/ */
@Mapper @Mapper
public interface CrossDirDataRealTimeMapper extends BaseMapper<CrossDirDataRealTimePO> { public interface CrossDirDataRealtimeMapper extends BaseMapper<CrossDirDataRealtimePO> {
void insertBatch(@Param("list")List<CrossDirDataRealTimePO> list); void insertBatch(@Param("list")List<CrossDirDataRealtimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds); void deleteBatch(@Param("list") Collection<String> crossIds);
CrossDirDataRealtimePO selectByCrossIdAndDirType(String crossId, Integer key);
List<CrossDirDataRealtimePO> selectByCrossIdAndInOutType(String crossId, Integer inOutType);
} }
package net.wanji.databus.dao.mapper; package net.wanji.databus.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.po.CrossTurnDataRealTimePO; import net.wanji.databus.po.CrossTurnDataRealtimePO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -13,8 +13,10 @@ import java.util.List; ...@@ -13,8 +13,10 @@ import java.util.List;
* @date 2023/03/10 21:11 * @date 2023/03/10 21:11
*/ */
@Mapper @Mapper
public interface CrossTurnDataRealTimeMapper extends BaseMapper<CrossTurnDataRealTimePO> { public interface CrossTurnDataRealtimeMapper extends BaseMapper<CrossTurnDataRealtimePO> {
void insertBatch(@Param("list") List<CrossTurnDataRealTimePO> list); void insertBatch(@Param("list") List<CrossTurnDataRealtimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds); void deleteBatch(@Param("list") Collection<String> crossIds);
List<CrossTurnDataRealtimePO> selectByCrossId(String crossId);
} }
package net.wanji.opt.dto; package net.wanji.databus.dto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package net.wanji.opt.dto; package net.wanji.databus.dto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
...@@ -11,5 +11,5 @@ import lombok.Data; ...@@ -11,5 +11,5 @@ import lombok.Data;
@Data @Data
@TableName("t_cross_data_hist") @TableName("t_cross_data_hist")
@ApiModel(value = "CrossDataHistPO", description = "路口实时数据历史") @ApiModel(value = "CrossDataHistPO", description = "路口实时数据历史")
public class CrossDataHistPO extends CrossDataRealTimePO{ public class CrossDataHistPO extends CrossDataRealtimePO {
} }
package net.wanji.databus.po;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author duanruiming
* @date 2023/03/10 19:02
*/
@Data
@TableName("t_cross_data_realtime")
@ApiModel(value = "CrossDataRealTimePO", description = "路口实时数据")
public class CrossDataRealTimePO {
@ApiModelProperty(name = "路口编号",notes = "")
private String crossId;
@ApiModelProperty(name = "路口状态:0正常 1失衡 2拥堵 3溢出 4死锁",notes = "")
private Integer status;
@ApiModelProperty(name = "拥堵类型 1常规 2异常",notes = "")
private Integer type;
@ApiModelProperty(name = "交通指数(1-10)",notes = "")
private Double trafficIndex;
@ApiModelProperty(name = "开始时间 yyyy-MM-dd HH:mm:sss",notes = "")
private Date startTime;
@ApiModelProperty(name = "持续时间(分钟)",notes = "")
private Integer duration;
@ApiModelProperty(name = "是否失衡 0否 1是",notes = "")
private Integer unbalanceStatus;
@ApiModelProperty(name = "是否溢出 0否 1是",notes = "")
private Integer spilloverStatus;
@ApiModelProperty(name = "是否拥堵 0否 1是",notes = "")
private Integer congestionStatus;
@ApiModelProperty(name = "失衡指数",notes = "")
private Double unbalanceIndex;
@ApiModelProperty(name = "溢出指数",notes = "")
private Double spilloverIndex;
@ApiModelProperty(name = "拥堵指数",notes = "")
private Double congestionIndex;
@ApiModelProperty(name = "路口失衡方向:1,2,3...",notes = "")
private String unbalanceDirs;
@ApiModelProperty(name = "溢出方向",notes = "")
private String spilloverDirs;
@ApiModelProperty(name = "拥堵方向",notes = "")
private String congestionDirs;
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow;
@ApiModelProperty(name = "交通流率/h",notes = "")
private Double flowRate;
@ApiModelProperty(name = "平均速度",notes = "")
private Double speed;
@ApiModelProperty(name = "最大排队长度",notes = "")
private Double queueLength;
@ApiModelProperty(name = "停车次数",notes = "")
private Integer stopTimes;
@ApiModelProperty(name = "延误时间",notes = "")
private Integer delayTime;
@ApiModelProperty(name = "饱和度:欠饱和:<0.6;近饱和:>=0.6 & < 0.8;过饱和:>0.8",notes = "")
private Double sturation;
@ApiModelProperty(name = "数据批次 十位日期int",notes = "")
private Integer batchTime;
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.opt.po.trend; package net.wanji.databus.po;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.wanji.opt.dto.CrossDirInfoDTO; import net.wanji.databus.dto.CrossDirInfoDTO;
import net.wanji.opt.dto.CrossTurnInfoDTO; import net.wanji.databus.dto.CrossTurnInfoDTO;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @author hfx * @author duanruiming
* @date 2023/1/10 16:36 * @date 2023/03/10 19:02
*/ */
@Data @Data
@TableName("t_cross_data_realtime")
@ApiModel(value = "CrossDataRealtimePO", description = "路口实时数据")
public class CrossDataRealtimePO { public class CrossDataRealtimePO {
/** 路口编号 */ /** 路口编号 */
@ApiModelProperty(value = "路口编号",notes = "") @ApiModelProperty(value = "路口编号",notes = "")
......
...@@ -11,5 +11,5 @@ import lombok.Data; ...@@ -11,5 +11,5 @@ import lombok.Data;
@Data @Data
@TableName("t_cross_dir_data_hist") @TableName("t_cross_dir_data_hist")
@ApiModel(value = "CrossDirDataHistPO", description = "路口转向实时数据历史") @ApiModel(value = "CrossDirDataHistPO", description = "路口转向实时数据历史")
public class CrossDirDataHistPO extends CrossDirDataRealTimePO{ public class CrossDirDataHistPO extends CrossDirDataRealtimePO {
} }
...@@ -13,8 +13,8 @@ import java.util.Date; ...@@ -13,8 +13,8 @@ import java.util.Date;
*/ */
@Data @Data
@TableName("t_cross_dir_data_realtime") @TableName("t_cross_dir_data_realtime")
@ApiModel(value = "CrossDirDataRealTimePO", description = "路口转向实时数据") @ApiModel(value = "CrossDirDataRealtimePO", description = "路口转向实时数据")
public class CrossDirDataRealTimePO { public class CrossDirDataRealtimePO {
@ApiModelProperty(name = "路口方向ID(路口ID_方向_进出口_主辅路序号)",notes = "") @ApiModelProperty(name = "路口方向ID(路口ID_方向_进出口_主辅路序号)",notes = "")
private String id; private String id;
@ApiModelProperty(name = "路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "") @ApiModelProperty(name = "路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
...@@ -42,7 +42,7 @@ public class CrossDirDataRealTimePO { ...@@ -42,7 +42,7 @@ public class CrossDirDataRealTimePO {
@ApiModelProperty(name = "排队长(米)",notes = "") @ApiModelProperty(name = "排队长(米)",notes = "")
private Double queueLength; private Double queueLength;
@ApiModelProperty(name = "停车次数",notes = "") @ApiModelProperty(name = "停车次数",notes = "")
private Integer stopTimes; private Double stopTimes;
@ApiModelProperty(name = "延误时间",notes = "") @ApiModelProperty(name = "延误时间",notes = "")
private Integer delayTime; private Integer delayTime;
@ApiModelProperty(name = "饱和度",notes = "") @ApiModelProperty(name = "饱和度",notes = "")
......
...@@ -11,5 +11,5 @@ import lombok.Data; ...@@ -11,5 +11,5 @@ import lombok.Data;
@Data @Data
@TableName("t_lane_data_hist") @TableName("t_lane_data_hist")
@ApiModel(value = "CrossTurnDataHistPO", description = "路口转向实时数据历史") @ApiModel(value = "CrossTurnDataHistPO", description = "路口转向实时数据历史")
public class CrossTurnDataHistPO extends CrossTurnDataRealTimePO{ public class CrossTurnDataHistPO extends CrossTurnDataRealtimePO {
} }
...@@ -15,7 +15,7 @@ import java.util.Date; ...@@ -15,7 +15,7 @@ import java.util.Date;
@Data @Data
@TableName("t_lane_data_realtime") @TableName("t_lane_data_realtime")
@ApiModel(value = "CrossTurnDataRealtimePO", description = "路口转向实时数据") @ApiModel(value = "CrossTurnDataRealtimePO", description = "路口转向实时数据")
public class CrossTurnDataRealTimePO { public class CrossTurnDataRealtimePO {
/** 转向ID(路口ID_驶入方向_转向类型) */ /** 转向ID(路口ID_驶入方向_转向类型) */
@ApiModelProperty(name = "转向ID(路口ID_驶入方向_转向类型)",notes = "") @ApiModelProperty(name = "转向ID(路口ID_驶入方向_转向类型)",notes = "")
private String id ; private String id ;
...@@ -52,7 +52,7 @@ public class CrossTurnDataRealTimePO { ...@@ -52,7 +52,7 @@ public class CrossTurnDataRealTimePO {
private Double queueLength ; private Double queueLength ;
/** 停车次数(次) */ /** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "") @ApiModelProperty(name = "停车次数(次)",notes = "")
private Integer stopTimes ; private Double stopTimes ;
/** 延误时间(秒) */ /** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "") @ApiModelProperty(name = "延误时间(秒)",notes = "")
private Integer delayTime ; private Integer delayTime ;
......
package net.wanji.opt.vo; package net.wanji.databus.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
<result column="traffic_index" property="trafficIndex"></result> <result column="traffic_index" property="trafficIndex"></result>
<result column="start_time" property="startTime"></result> <result column="start_time" property="startTime"></result>
<result column="duration" property="duration"></result> <result column="duration" property="duration"></result>
<result column="is_unbalance" property="unbalanceStatus"></result> <result column="is_unbalance" property="isUnbalance"></result>
<result column="is_spillover" property="spilloverStatus"></result> <result column="is_spillover" property="isSpillover"></result>
<result column="is_congestion" property="congestionStatus"></result> <result column="is_congestion" property="isCongestion"></result>
<result column="unbalance_index" property="unbalanceIndex"></result> <result column="unbalance_index" property="unbalanceIndex"></result>
<result column="spillover_index" property="spilloverIndex"></result> <result column="spillover_index" property="spilloverIndex"></result>
<result column="congestion_index" property="congestionIndex"></result> <result column="congestion_index" property="congestionIndex"></result>
...@@ -54,4 +54,12 @@ ...@@ -54,4 +54,12 @@
(#{crossId}) (#{crossId})
</foreach> </foreach>
</delete> </delete>
<select id="selectByCrossIdAndTimestamp" resultType="net.wanji.databus.po.CrossDataHistPO">
select <include refid="Base_Column_List"></include>
from t_cross_data_hist
where cross_id = #{crossId}
and batch_time <![CDATA[ >= ]]> #{preSeconds}
order by batch_time
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.CrossDataRealTimeMapper"> <mapper namespace="net.wanji.databus.dao.mapper.CrossDataRealtimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDataRealTimePO"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDataRealtimePO">
<result column="cross_id" property="crossId"></result> <result column="cross_id" property="crossId"></result>
<result column="status" property="status"></result> <result column="status" property="status"></result>
<result column="type" property="type"></result> <result column="type" property="type"></result>
<result column="traffic_index" property="trafficIndex"></result> <result column="traffic_index" property="trafficIndex"></result>
<result column="start_time" property="startTime"></result> <result column="start_time" property="startTime"></result>
<result column="duration" property="duration"></result> <result column="duration" property="duration"></result>
<result column="is_unbalance" property="unbalanceStatus"></result> <result column="is_unbalance" property="isUnbalance"></result>
<result column="is_spillover" property="spilloverStatus"></result> <result column="is_spillover" property="isSpillover"></result>
<result column="is_congestion" property="congestionStatus"></result> <result column="is_congestion" property="isCongestion"></result>
<result column="unbalance_index" property="unbalanceIndex"></result> <result column="unbalance_index" property="unbalanceIndex"></result>
<result column="spillover_index" property="spilloverIndex"></result> <result column="spillover_index" property="spilloverIndex"></result>
<result column="congestion_index" property="congestionIndex"></result> <result column="congestion_index" property="congestionIndex"></result>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
flow, flow_rate, speed, queue_length, stop_times, delay_time, sturation, batch_time, gmt_create, gmt_modified flow, flow_rate, speed, queue_length, stop_times, delay_time, sturation, batch_time, gmt_create, gmt_modified
</sql> </sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDataRealTimePO"> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDataRealtimePO">
insert into t_cross_data_realtime insert into t_cross_data_realtime
(<include refid="Base_Column_List"></include>) (<include refid="Base_Column_List"></include>)
values values
...@@ -54,4 +54,37 @@ ...@@ -54,4 +54,37 @@
(#{crossId}) (#{crossId})
</foreach> </foreach>
</delete> </delete>
<select id="selectAbnormalCross" resultType="net.wanji.databus.vo.AbnormalCrossListVO">
select
t2.id, t2.name, t1.unbalance_dirs, t1.congestion_dirs, t1.spillover_dirs, t1.status as realtimeStatus,
t1.start_time, t1.duration, t2.location as locationStr, t1.is_unbalance, t1.is_spillover, t1.is_congestion
from t_cross_data_realtime t1 JOIN t_base_cross_info t2
ON t1.cross_id = t2.id
<where>
<if test="status != null">
and (t1.status = #{status}
<if test="status == 1"> or t1.is_unbalance = 1 </if>
<if test="status == 2"> or t1.is_congestion = 1 </if>
<if test="status == 3"> or t1.is_spillover = 1 </if>)
</if>
<if test="name != null and name != ''">
and t2.name like concat('%',#{name},'%')
</if>
<if test="type != null">
and t1.type = #{type}
</if>
<if test="status == null">
and t1.status in (0, 1, 2, 3)
</if>
and t2.is_signal = 1
</where>
</select>
<select id="selectByCrossId" resultType="net.wanji.databus.po.CrossDataRealtimePO">
select <include refid="Base_Column_List"></include>
from t_cross_data_realtime
where cross_id = #{crossId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, dir_type, in_out_type, cross_id, length, status, traffic_index, start_time, capacity, duration, flow, id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,flow,speed,queue_length,stop_times,
speed, queue_length, stop_times, delay_time, sturation, batch_time, gmt_create, gmt_modified, effusion_time delay_time,sturation,batch_time,gmt_create,gmt_modified,effusion_time
</sql> </sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataHistPO"> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataHistPO">
...@@ -47,4 +47,31 @@ ...@@ -47,4 +47,31 @@
(#{crossId}) (#{crossId})
</foreach> </foreach>
</delete> </delete>
<select id="selectByCrossIdAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_hist
where cross_id = #{crossId} and in_out_type = 1
and batch_time <![CDATA[ >= ]]> #{preSeconds}
order by batch_time
</select>
<select id="selectByCrossIdDirAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_hist
where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir}
and batch_time <![CDATA[ >= ]]> #{preSeconds}
order by batch_time
</select>
<select id="selectByCrossIdInOutTimestamp" resultType="net.wanji.databus.bo.CrossDirDataHistAvgBO">
SELECT dir_type as dirType, avg(capacity) as avgCapacity, avg(flow) as avgFlow,
avg(queue_length) as avgQueueLength, avg(traffic_index) as avgIndex,
avg(effusion_time) as avgEffusionTime
FROM t_cross_dir_data_hist
WHERE cross_id = #{crossId}
AND in_out_type = #{inOutType}
AND batch_time <![CDATA[ >= ]]> #{preSeconds}
GROUP BY dir_type
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.CrossDirDataRealTimeMapper"> <mapper namespace="net.wanji.databus.dao.mapper.CrossDirDataRealtimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDirDataRealTimePO"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDirDataRealtimePO">
<result column="id" property="id"></result> <result column="id" property="id"></result>
<result column="dir_type" property="dirType"></result> <result column="dir_type" property="dirType"></result>
<result column="in_out_type" property="inOutType"></result> <result column="in_out_type" property="inOutType"></result>
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, dir_type, in_out_type, cross_id, length, status, traffic_index, start_time, capacity, duration, flow, id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,duration,flow,speed,queue_length,
speed, queue_length, stop_times, delay_time, sturation, batch_time, gmt_create, gmt_modified, effusion_time stop_times,delay_time,sturation,batch_time,gmt_create,gmt_modified,effusion_time
</sql> </sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataRealTimePO"> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataRealtimePO">
insert into t_cross_dir_data_realtime insert into t_cross_dir_data_realtime
(<include refid="Base_Column_List"></include>) (<include refid="Base_Column_List"></include>)
values values
...@@ -47,4 +47,17 @@ ...@@ -47,4 +47,17 @@
(#{crossId}) (#{crossId})
</foreach> </foreach>
</delete> </delete>
<select id="selectByCrossIdAndDirType" resultType="net.wanji.databus.po.CrossDirDataRealtimePO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_realtime
where cross_id = #{crossId} and dir_type = #{key} and in_out_type = 1
</select>
<select id="selectByCrossIdAndInOutType" resultType="net.wanji.databus.po.CrossDirDataRealtimePO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_realtime
where cross_id = #{crossId} and in_out_type = #{inOutType}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.CrossTurnDataHistMapper"> <mapper namespace="net.wanji.databus.dao.mapper.CrossTurnDataHistMapper">
<resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossTurnDataRealTimePO"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossTurnDataRealtimePO">
<result column="id" property="id"></result> <result column="id" property="id"></result>
<result column="turn_type" property="turnType"></result> <result column="turn_type" property="turnType"></result>
<result column="in_dir" property="inDir"></result> <result column="in_dir" property="inDir"></result>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
stop_times, delay_time, sturation, vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified stop_times, delay_time, sturation, vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified
</sql> </sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossTurnDataRealTimePO"> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossTurnDataRealtimePO">
insert into t_cross_turn_data_hist insert into t_cross_turn_data_hist
(<include refid="Base_Column_List"></include>) (<include refid="Base_Column_List"></include>)
values values
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.CrossTurnDataRealTimeMapper"> <mapper namespace="net.wanji.databus.dao.mapper.CrossTurnDataRealtimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossTurnDataRealTimePO"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossTurnDataRealtimePO">
<result column="id" property="id"></result> <result column="id" property="id"></result>
<result column="turn_type" property="turnType"></result> <result column="turn_type" property="turnType"></result>
<result column="in_dir" property="inDir"></result> <result column="in_dir" property="inDir"></result>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
stop_times, delay_time, sturation, vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified stop_times, delay_time, sturation, vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified
</sql> </sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossTurnDataRealTimePO"> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossTurnDataRealtimePO">
insert into t_cross_turn_data_realtime insert into t_cross_turn_data_realtime
(<include refid="Base_Column_List"></include>) (<include refid="Base_Column_List"></include>)
values values
...@@ -48,4 +48,10 @@ ...@@ -48,4 +48,10 @@
(#{crossId}) (#{crossId})
</foreach> </foreach>
</delete> </delete>
<select id="selectByCrossId" resultType="net.wanji.databus.po.CrossTurnDataRealtimePO">
select <include refid="Base_Column_List"></include>
from t_cross_turn_data_realtime
where cross_id = #{crossId}
</select>
</mapper> </mapper>
\ No newline at end of file
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