Commit b2acedd9 authored by duanruiming's avatar duanruiming

[add] 数据中心版本databus0.0.databus-0.0.3-CH

parent 2bc5f717
package net.wanji.databus.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
......@@ -14,8 +13,6 @@ public class CrossLightsStatusHistPO {
private String crossId;
private Integer batchTime;
private String lightsStatusJson;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
......@@ -39,7 +39,6 @@ public class CrossSchedulesPO {
private String weeks;
/** 特殊日期 */
@ApiModelProperty(value = "特殊日期",notes = "")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date specialDate ;
/** 创建时间 */
@ApiModelProperty(value = "创建时间",notes = "")
......
......@@ -30,8 +30,6 @@ public interface BaseCrossLaneLightsMapper {
Integer selectLightsIdByLaneId(@Param("crossId") String crossId, @Param("laneId") String laneId);
List<CrossLaneLightsPO> selectByCrossId(@Param("crossId") String crossId);
List<CrossLaneLightsPO> selectLanesByLightId(@Param("crossId") String crossId,
@Param("lightId") Integer lightId);
......
......@@ -21,8 +21,6 @@ public interface LaneInfoMapper {
List<LaneInfoPO> selectBycrossId(@Param("crossId") String crossId);
List<LaneInfoPO> selectBycrossIdAll(@Param("crossId") String crossId);
LaneInfoPO selectByCrossIdDirCode(@Param("crossId") String crossId,
@Param("dir") Integer dir,
@Param("code") String code);
......
......@@ -15,4 +15,7 @@ import java.util.Date;
@ApiModel(value = "CrossDataHistPO", description = "路口实时数据历史")
public class CrossDataHistPO extends CrossDataRealtimePO {
private Integer dt;
private Integer dt_15min;
private Integer dt_30min;
private Integer dt_60min;
}
......@@ -13,4 +13,7 @@ import lombok.Data;
@ApiModel(value = "CrossDirDataHistPO", description = "路口转向实时数据历史")
public class CrossDirDataHistPO extends CrossDirDataRealtimePO {
private Integer dt;
private Integer dt_15min;
private Integer dt_30min;
private Integer dt_60min;
}
......@@ -13,4 +13,7 @@ import lombok.Data;
@ApiModel(value = "CrossLaneDataHistPO", description = "路口车道实时数据历史")
public class CrossLaneDataHistPO extends CrossLaneDataRealTimePO{
private Integer dt;
private Integer dt_15min;
private Integer dt_30min;
private Integer dt_60min;
}
......@@ -13,4 +13,7 @@ import lombok.Data;
@ApiModel(value = "CrossTurnDataHistPO", description = "路口转向实时数据历史")
public class CrossTurnDataHistPO extends CrossTurnDataRealtimePO {
private Integer dt;
private Integer dt_15min;
private Integer dt_30min;
private Integer dt_60min;
}
......@@ -38,8 +38,6 @@ public class LightsStatusVO2 extends BaseCrossInfo {
private String schemeId;
@ApiModelProperty(value = "灯组状态")
private List<DirInfo> dirLampGroupMapList;
@ApiModelProperty(value = "当前相位灯组状态")
private List<DirInfo> curPhaseLampGroupMapList;
@ApiModelProperty(value = "数据上报时间戳")
@Field(type = FieldType.Keyword, name = "timeStamp")
private String timeStamp;
......
......@@ -74,13 +74,6 @@
where cross_id = #{crossId} and lights_id = #{lightId}
</select>
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,lights_id,lane_id,cross_id,gmt_create,gmt_modified
from t_base_cross_lane_lights
where cross_id = #{crossId}
</select>
<select id="selectByLightsId" resultMap="BaseResultMap">
select
id,lights_id,lane_id,cross_id,gmt_create,gmt_modified
......
......@@ -238,20 +238,10 @@
AND section.scheme_id = scheme.id
WHERE
schedules.cross_id = #{crossId}
AND (
DATE_FORMAT(schedules.special_date, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
OR
(
schedules.week = #{week}
AND (
DATE_FORMAT(schedules.special_date, '%Y-%m-%d') != DATE_FORMAT(NOW(), '%Y-%m-%d')
OR schedules.special_date IS NULL
)
)
)
AND schedules.`week` = #{week}
AND DATE_FORMAT( NOW(), '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' )
AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' )
ORDER BY schedules.special_date, DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ),schedules.special_date DESC LIMIT 1
ORDER BY schedules.special_date, DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) DESC LIMIT 1
</select>
<select id="selectSchemeByParams" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
......@@ -265,21 +255,10 @@
AND section.scheme_id = scheme.id
WHERE
schedules.cross_id = #{crossId}
AND (
DATE_FORMAT(schedules.special_date, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
OR
(
schedules.week = #{week}
AND (
DATE_FORMAT(schedules.special_date, '%Y-%m-%d') != DATE_FORMAT(NOW(), '%Y-%m-%d')
OR schedules.special_date IS NULL
)
)
)
AND schedules.`week` = #{week}
AND DATE_FORMAT( #{queryTime}, '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' )
AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' )
ORDER BY schedules.special_date, DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ),schedules.special_date DESC LIMIT 1
ORDER BY schedules.special_date, DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) DESC LIMIT 1
</select>
......
......@@ -65,11 +65,11 @@
no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,non_motor_flow,v_85,
traffic_flow_A,traffic_flow_B,traffic_flow_C,vehicle_length_ratio_mean,time_occupancy,
strategy, strategy_duration, optimize_count, optimize_seconds, empty_pass, service_level,
direction, turn,dt
direction, turn, dt, dt_15min, dt_30min, dt_60min
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDataHistPO">
insert ignore into t_cross_data_hist
insert into t_cross_data_hist
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
......@@ -82,9 +82,18 @@
#{entity.nonMotorFlow},#{entity.v85},#{entity.trafficFlowA},#{entity.trafficFlowB},
#{entity.trafficFlowC},#{entity.vehicleLengthRatioMean},#{entity.timeOccupancy},
#{entity.strategy}, #{entity.strategyDuration}, #{entity.optimizeCount}, #{entity.optimizeSeconds},
#{entity.emptyPass}, #{entity.serviceLevel}, #{entity.direction}, #{entity.turn}, DATE_FORMAT(#{entity.startTime}, '%Y%m%d')
#{entity.emptyPass}, #{entity.serviceLevel}, #{entity.direction}, #{entity.turn},
cast(to_char(cast(#{entity.startTime} as DATE), 'YYYYMMDD') as INTEGER),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 15) * 15 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 30) * 30 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 60) * 60 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP)
)
</foreach>
on conflict(cross_id, batch_time, dt)
do update set batch_time = excluded.batch_time
</insert>
<delete id="deleteBatch" parameterType="String">
......
......@@ -69,7 +69,7 @@
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDataRealtimePO">
insert ignore into t_cross_data_realtime
insert into t_cross_data_realtime
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
......
......@@ -37,11 +37,11 @@
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataRealtimePO">
insert ignore into t_cross_dir_data_realtime
insert into t_cross_dir_data_realtime
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
( #{entity.id}, #{entity.dirType}, #{entity.inOutType}, #{entity.crossId}, #{entity.length}, #{entity.status}, #{entity.trafficIndex}, #{entity.startTime}, #{entity.capacity}, #{entity.duration}, #{entity.flow},
(#{entity.id}, #{entity.dirType}, #{entity.inOutType}, #{entity.crossId}, #{entity.length}, #{entity.status}, #{entity.trafficIndex}, #{entity.startTime}, #{entity.capacity}, #{entity.duration}, #{entity.flow},
#{entity.speed}, #{entity.queueLength}, #{entity.stopTimes}, #{entity.delayTime}, #{entity.sturation},
#{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.batchTime},
now(), now(),#{entity.effusionRate}, #{entity.greenLightEfficiency} )
......
......@@ -42,11 +42,11 @@
vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified,
no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,start_time,effusion_rate,green_light_efficiency,
vehicle_nums_ratio_mean,vehicle_length_ratio_mean,time_occupancy,non_motor_flow,v_85,
traffic_flow_A,traffic_flow_B,traffic_flow_C,dt
traffic_flow_A,traffic_flow_B,traffic_flow_C, dt, dt_15min, dt_30min, dt_60min
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossLaneDataHistPO">
insert ignore into t_lane_data_hist
insert into t_lane_data_hist
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
......@@ -55,9 +55,18 @@
now(),now(),
#{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.startTime},
#{entity.effusionRate},#{entity.greenLightEfficiency},#{entity.vehicleNumsRatioMean},#{entity.vehicleLengthRatioMean},#{entity.timeOccupancy},
#{entity.nonMotorFlow},#{entity.v85},#{entity.trafficFlowA},#{entity.trafficFlowB},#{entity.trafficFlowC}, DATE_FORMAT(#{entity.startTime}, '%Y%m%d')
#{entity.nonMotorFlow},#{entity.v85},#{entity.trafficFlowA},#{entity.trafficFlowB},#{entity.trafficFlowC},
cast(to_char(cast(#{entity.startTime} as DATE), 'YYYYMMDD') as INTEGER),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 15) * 15 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 30) * 30 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 60) * 60 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP)
)
</foreach>
on conflict(id, batch_time, dt)
do update set batch_time = excluded.batch_time
</insert>
<delete id="deleteBatch" parameterType="String">
......
......@@ -44,11 +44,11 @@
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossLaneDataRealTimePO">
insert ignore into t_lane_data_realtime
insert into t_lane_data_realtime
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
(#{entity.id},#{entity.crossId},#{entity.flow},#{entity.speed},#{entity.inSpeed},#{entity.outSpeed},#{entity.queueLength},#{entity.stopTimes},#{entity.delayTime},#{entity.capacity},#{entity.sturation},
(#{entity.id}, #{entity.crossId},#{entity.flow},#{entity.speed},#{entity.inSpeed},#{entity.outSpeed},#{entity.queueLength},#{entity.stopTimes},#{entity.delayTime},#{entity.capacity},#{entity.sturation},
#{entity.vehheadDist},#{entity.vehheadTime},#{entity.quality},#{entity.batchTime},
now(), now(),
#{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.startTime},
......
......@@ -42,7 +42,7 @@
</select>
<insert id="insertOne" parameterType="net.wanji.databus.dao.entity.CrossLightsStatusHistPO">
insert ignore into t_cross_lights_status_hist (cross_id, batch_time, lights_status_json)
insert into t_cross_lights_status_hist (cross_id, batch_time, lights_status_json)
values (#{entity.crossId}, #{entity.batchTime}, #{entity.lightsStatusJson})
</insert>
......
......@@ -37,11 +37,11 @@
id, turn_type, in_dir, out_dir, cross_id, flow, status, traffic_index, speed, in_speed, out_speed, queue_length,
stop_times, delay_time, sturation, vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified,
no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,start_time,
green_light_efficiency,effusion_rate,dt
green_light_efficiency,effusion_rate,dt, dt_15min, dt_30min, dt_60min
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossTurnDataHistPO">
insert ignore into t_cross_turn_data_hist
insert into t_cross_turn_data_hist
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
......@@ -50,9 +50,18 @@
#{entity.queueLength},#{entity.stopTimes},#{entity.delayTime},#{entity.sturation},#{entity.vehheadDist},#{entity.vehheadTime},
#{entity.quality},#{entity.batchTime},now(),now(),
#{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.startTime},
#{entity.greenLightEfficiency},#{entity.effusionRate}, DATE_FORMAT(#{entity.startTime}, '%Y%m%d')
#{entity.greenLightEfficiency},#{entity.effusionRate},
cast(to_char(cast(#{entity.startTime} as DATE), 'YYYYMMDD') as INTEGER),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 15) * 15 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 30) * 30 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP),
cast(to_char(date_trunc('hour', cast(#{entity.startTime} as TIMESTAMP)) +
(floor(extract(minute from cast(#{entity.startTime} as TIMESTAMP)) / 60) * 60 * interval '1 minute'), 'YYYY-MM-DD HH24:MI:00') as TIMESTAMP)
)
</foreach>
on conflict(id, batch_time, dt)
do update set batch_time = excluded.batch_time
</insert>
<delete id="deleteBatch" parameterType="String">
......
......@@ -42,7 +42,7 @@
</sql>
<insert id="insertBatch" parameterType="net.wanji.databus.po.CrossTurnDataRealtimePO">
insert ignore into t_cross_turn_data_realtime
insert into t_cross_turn_data_realtime
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
......
......@@ -106,8 +106,6 @@
#{entity.speedFactor}
)
</foreach>
ON DUPLICATE KEY UPDATE
gmt_modified = values(gmt_modified)
</insert>
<select id="selectByIdAndType" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO">
......
......@@ -51,13 +51,6 @@
where cross_id = #{crossId} and type = 2
</select>
<select id="selectBycrossIdAll" resultMap="BaseResultMap">
select
id,code,sort,type,dir,turn,category,cross_id,rid,length,width,wkt,gmt_create,gmt_modified
from t_base_lane_info
where cross_id = #{crossId}
</select>
<select id="selectByCrossIdDirCode" resultMap="BaseResultMap">
select
id,code,sort,type,dir,turn,category,cross_id,rid,length,width,wkt,gmt_create,gmt_modified
......
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