Commit d6cfcb03 authored by duanruiming's avatar duanruiming

[update] 清空率

parent 5e842b97
......@@ -55,6 +55,12 @@
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
<!-- 自定义feign远程调用-->
<dependency>
<groupId>net.wanji</groupId>
<artifactId>signal-feign-service</artifactId>
<version>0.0.2</version>
</dependency>
<!--log4j2-->
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -152,11 +158,11 @@
<artifactId>javax.el-api</artifactId>
<version>${el.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.glassfish.web</groupId>-->
<!-- <artifactId>javax.el</artifactId>-->
<!-- <version>${el.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.glassfish.web</groupId>-->
<!-- <artifactId>javax.el</artifactId>-->
<!-- <version>${el.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
......
......@@ -23,6 +23,10 @@
</properties>
<dependencies>
<dependency>
<groupId>net.wanji</groupId>
<artifactId>signal-feign-service</artifactId>
</dependency>
<!-- 数据库驱动 -->
<dependency>
<groupId>mysql</groupId>
......
......@@ -8,10 +8,10 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication(scanBasePackages = {"net.wanji.datacenter"})
@SpringBootApplication(scanBasePackages = {"net.wanji.datacenter", "net.wanji.databus", "net.wanji.common"})
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EntityScan("net.wanji.datacenter.entity")
@MapperScan("net.wanji.datacenter.mapper")
@EntityScan(basePackages = {"net.wanji.datacenter.entity", "net.wanji.databus.dao.entity", "net.wanji.databus.dao.entity", "net.wanji.databus.po"})
@MapperScan(basePackages = {"net.wanji.datacenter.mapper", "net.wanji.databus.dao.mapper"})
@EnableTransactionManagement
@EnableScheduling
public class DataCenterApplication {
......
package net.wanji.datacenter.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
/**
* @author duanruiming
* @date 2023/08/07 19:05
*/
@Getter
@AllArgsConstructor
public enum DirTypeEnum {
ONE(1, 5, "北"),
THREE(3, 7, "东"),
FIVE(5, 1, "南"),
SEVEN(7, 3, "西");
private final Integer type;
private final Integer code;
private final String msg;
public static Integer getTypeByCode(Integer code) {
for (UTCWEBTurnParseEnum value : UTCWEBTurnParseEnum.values()) {
if (Objects.equals(value.getCode(), code)) {
return value.getType();
}
}
return null;
}
}
package net.wanji.datacenter.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
/**
* @author duanruiming
* @date 2023/08/07 10:57
*/
@Getter
@AllArgsConstructor
public enum TurnTypeParseEnum {
LEFT("l", 1, "左转"),
STRAIGHT("s", 3, "直行"),
RIGHT("r", 2, "右转"),
PERSON("", 20, "行人"),
UTURN("u", 4, "掉头");
private final String type;
private final Integer code;
private final String msg;
public static Integer getCodeByType(String type) {
for (TurnTypeParseEnum value : TurnTypeParseEnum.values()) {
if (Objects.equals(value.type, type)) {
return value.code;
}
}
return null;
}
}
package net.wanji.datacenter.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
/**
* @author Kent HAN
* @date 2023/1/29 9:35
*/
@AllArgsConstructor
@Getter
public enum UTCWEBTurnParseEnum {
LEFT(1, 1, "左转"),
STRAIGHT(2, 3, "直行"),
RIGHT(3, 2, "右转"),
PERSON(20, 20, "行人"),
UTURN(9, 4, "掉头");
private final Integer type;
private final Integer code;
private final String msg;
public static Integer getTypeByCode(Integer code) {
for (UTCWEBTurnParseEnum value : UTCWEBTurnParseEnum.values()) {
if (Objects.equals(value.getCode(), code)) {
return value.getType();
}
}
return null;
}
}
package net.wanji.datacenter.entity;
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 = "id",notes = "")
private String id;
/**
* 路口编号
*/
@ApiModelProperty(value = "路口编号", notes = "")
private String crossId;
/**
* 路口状态:0正常;1失衡;2拥堵;3溢出;4死锁
*/
@ApiModelProperty(value = "路口状态:0正常;1失衡;2拥堵;3溢出;4死锁", notes = "")
private Integer status;
/**
* 拥堵类型:1常规;2异常
*/
@ApiModelProperty(value = "拥堵类型:1常规;2异常", notes = "")
private Integer type;
/**
* 交通指数(1~10)
*/
@ApiModelProperty(value = "交通指数(1~10)", notes = "")
private Double trafficIndex;
/**
* 开始时间:yyyy-MM-dd HH;mm:ss
*/
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "")
private Date startTime;
@ApiModelProperty(value = "持续时间(单位:分钟)", notes = "")
private Integer duration;
/**
* 是否失衡:0否;1是
*/
@ApiModelProperty(value = "是否失衡:0否;1是", notes = "")
private Integer isUnbalance;
/**
* 是否溢出:0否;1是
*/
@ApiModelProperty(value = "是否溢出:0否;1是", notes = "")
private Integer isSpillover;
/**
* 是否拥堵:0否;1是
*/
@ApiModelProperty(value = "是否拥堵:0否;1是", notes = "")
private Integer isCongestion;
/**
* 失衡指数
*/
@ApiModelProperty(value = "失衡指数", notes = "")
private Double unbalanceIndex;
/**
* 溢出指数
*/
@ApiModelProperty(value = "溢出指数", notes = "")
private Double spilloverIndex;
/**
* 拥堵指数
*/
@ApiModelProperty(value = "拥堵指数", notes = "")
private Double congestionIndex;
/**
* 路口失衡方向:1,2,3...
*/
@ApiModelProperty(value = "路口失衡方向:1,2,3...", notes = "")
private String unbalanceDirs;
/**
* 路口溢出方向:1,2,3...
*/
@ApiModelProperty(value = "路口溢出方向:1,2,3...", notes = "")
private String spilloverDirs;
/**
* 路口拥堵方向:1,2,3...
*/
@ApiModelProperty(value = "路口拥堵方向:1,2,3...", notes = "")
private String congestionDirs;
/**
* 交通流量(辆)
*/
@ApiModelProperty(value = "交通流量(辆)", notes = "")
private Integer flow;
/**
* 交通流率/h
*/
@ApiModelProperty(value = "交通流率/h", notes = "")
private Double flowRate;
/**
* 平均速度(km/h)
*/
@ApiModelProperty(value = "平均速度(km/h)", notes = "")
private Double speed;
/**
* 最大排队(米)
*/
@ApiModelProperty(value = "最大排队(米)", notes = "")
private Double queueLength;
/**
* 停车次数(次)
*/
@ApiModelProperty(value = "停车次数(次)", notes = "")
private Double stopTimes;
/**
* 延误时间(秒)
*/
@ApiModelProperty(value = "延误时间(秒)", notes = "")
private Integer delayTime;
/**
* 饱和度
*/
@ApiModelProperty(value = "饱和度", notes = "")
private Double sturation;
/**
* 采集时间(10位时间戳)
*/
@ApiModelProperty(value = "采集时间(10位时间戳)", notes = "")
private Integer batchTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", notes = "")
private Date gmtCreate;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间", notes = "")
private Date gmtModified;
}
package net.wanji.datacenter.entity;
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:22
*/
@Data
@TableName("t_cross_dir_data_realtime")
@ApiModel(value = "CrossDirDataRealtimePO", description = "路口转向实时数据")
public class CrossDirDataRealtimePO {
@ApiModelProperty(name = "路口方向ID(路口ID_方向_进出口_主辅路序号)",notes = "")
private String id;
@ApiModelProperty(name = "路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dirType;
@ApiModelProperty(name = "进出口类型:1进口;2出口",notes = "")
private Integer inOutType;
@ApiModelProperty(name = "路口编号",notes = "")
private String crossId;
@ApiModelProperty(name = "路段长度",notes = "")
private Double length;
@ApiModelProperty(name = "交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知",notes = "")
private Integer status;
@ApiModelProperty(name = "交通指数",notes = "")
private Double trafficIndex;
@ApiModelProperty(name = "开始时间",notes = "")
private Date startTime;
@ApiModelProperty(name = "通行能力",notes = "")
private Integer capacity;
@ApiModelProperty(name = "持续时间",notes = "")
private Integer duration;
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow;
@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;
@ApiModelProperty(name = "不停车率",notes = "")
private Double noStopRate;
@ApiModelProperty(name = "一次停车率",notes = "")
private Double oneStopRate;
@ApiModelProperty(name = "二次停车率",notes = "")
private Double twoStopRate;
@ApiModelProperty(name = "三次停车率",notes = "")
private Double threeStopRate;
@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.datacenter.entity;
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:36
*/
@Data
@TableName("t_lane_data_realtime")
@ApiModel(value = "CrossLaneDataRealTimePO", description = "路口车道实时数据")
public class CrossLaneDataRealTimePO {
@ApiModelProperty(name = "车道编号",notes = "")
private String id;
@ApiModelProperty(name = "路口编号",notes = "")
private String crossId;
@ApiModelProperty(name = "交通流量(辆)",notes = "")
private Integer flow;
@ApiModelProperty(name = "平均速度(km/h)",notes = "")
private Double speed;
@ApiModelProperty(name = "驶入速度(km/h)",notes = "")
private Double inSpeed;
@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 Integer capacity;
@ApiModelProperty(name = "饱和度",notes = "")
private Double sturation;
@ApiModelProperty(name = "车头间距(米)",notes = "")
private Double vehheadDist;
@ApiModelProperty(name = "车头时距(秒)",notes = "")
private Double vehheadTime;
@ApiModelProperty(name = "可信度(0-1)",notes = "")
private Double quality;
@ApiModelProperty(name = "采集时间(10位时间戳)",notes = "")
private Integer batchTime;
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.datacenter.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author hfx
* @date 2023/1/10 16:36
* @desc CrossDataRealtimePO
*/
@Data
@TableName("t_cross_turn_data_realtime")
@ApiModel(value = "CrossTurnDataRealtimePO", description = "路口转向实时数据")
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 ;
@ApiModelProperty(name = "交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知",notes = "")
private Integer status;
@ApiModelProperty(name = "交通指数",notes = "")
private Double trafficIndex;
/** 平均速度(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 ;
@ApiModelProperty(name = "不停车率",notes = "")
private Double noStopRate;
@ApiModelProperty(name = "一次停车率",notes = "")
private Double oneStopRate;
@ApiModelProperty(name = "二次停车率",notes = "")
private Double twoStopRate;
@ApiModelProperty(name = "三次停车率",notes = "")
private Double threeStopRate;
/** 采集时间(10位时间戳) */
@ApiModelProperty(name = "采集时间(10位时间戳)",notes = "")
private Integer batchTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -53,8 +53,16 @@ public class ConsumerHandler implements KafkaListenerErrorHandler {
@KafkaListener(topics = {"JN040001LanePeriodicData"}, groupId = "group")
public void receiveLanePeriodicData(ConsumerRecord<Object, Object> record, Acknowledgment acknowledgment) {
log.info("收到kafka消息,消息主题:" + record.topic());
log.info("收到kafka消息,消息内容:" + record.value());
log.debug("收到kafka消息,消息主题:" + record.topic());
log.debug("收到kafka消息,消息内容:" + record.value());
lanePeriodicDataMap.put(record.topic(), String.valueOf(record.value()));
acknowledgment.acknowledge();
}
@KafkaListener(topics = {"JN040001CrossSnapshotData"}, groupId = "group")
public void receiveCrossSnapshotData(ConsumerRecord<Object, Object> record, Acknowledgment acknowledgment) {
log.debug("收到kafka消息,消息主题:" + record.topic());
log.debug("收到kafka消息,消息内容:" + record.value());
lanePeriodicDataMap.put(record.topic(), String.valueOf(record.value()));
acknowledgment.acknowledge();
}
......
package net.wanji.datacenter.kafka;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.extern.slf4j.Slf4j;
import net.wanji.datacenter.utils.JacksonUtils;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.Resource;
import java.util.concurrent.Future;
/**
* @author duanruiming
......@@ -24,10 +24,12 @@ public class ProducerHandler {
private KafkaTemplate<String, String> kafkaTemplate;
public void send(String topic, Object msg) {
Page<Object> objectPage = new Page<>();
try {
ListenableFuture<SendResult<String, String>> future = this.kafkaTemplate.send(topic, JacksonUtils.getInstance().writeValueAsString(msg));
future.addCallback(
success -> {},
success -> {
},
failure -> log.error("消息发送失败:", failure));
} catch (JsonProcessingException e) {
log.error("{}主题发送消息失败:", e);
......
package net.wanji.datacenter.mapper;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.datacenter.entity.CrossBaseLaneInfoPO;
import org.springframework.stereotype.Repository;
/**
* @author duanruiming
* @date 2023/03/10 20:32
*/
@Repository
public interface CrossBaseLaneInfoMapper extends BaseMapper<CrossBaseLaneInfoPO> {
}
package net.wanji.datacenter.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.datacenter.entity.CrossDataRealtimePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
/**
* @author duanruiming
* @date 2023/03/10 20:06
*/
@Repository
public interface CrossDataRealtimeMapper extends BaseMapper<CrossDataRealtimePO> {
void insertBatch(@Param("list") List<CrossDataRealtimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds);
CrossDataRealtimePO selectByCrossId(String crossId);
}
package net.wanji.datacenter.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.datacenter.entity.CrossDirDataRealtimePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
/**
* @author duanruiming
* @date 2023/03/10 21:09
*/
@Repository
public interface CrossDirDataRealtimeMapper extends BaseMapper<CrossDirDataRealtimePO> {
void insertBatch(@Param("list")List<CrossDirDataRealtimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds);
CrossDirDataRealtimePO selectByCrossIdAndDirType(String crossId, Integer key);
List<CrossDirDataRealtimePO> selectByCrossIdAndInOutType(String crossId, Integer inOutType);
Integer selectStatus(String secondId, Integer inDir, int inOutType);
List<CrossDirDataRealtimePO> selectBycrossId(String crossId);
CrossDirDataRealtimePO selectByInDir(String currentCrossId, Integer key);
}
package net.wanji.datacenter.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.datacenter.entity.CrossLaneDataRealTimePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
/**
* @author duanruiming
* @date 2023/03/10 21:11
*/
@Repository
public interface CrossLaneDataRealTimeMapper extends BaseMapper<CrossLaneDataRealTimePO> {
void insertBatch(@Param("list") List<CrossLaneDataRealTimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds);
}
package net.wanji.datacenter.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.datacenter.entity.CrossTurnDataRealtimePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
/**
* @author duanruiming
* @date 2023/03/10 21:11
*/
@Repository
public interface CrossTurnDataRealtimeMapper extends BaseMapper<CrossTurnDataRealtimePO> {
void insertBatch(@Param("list") List<CrossTurnDataRealtimePO> list);
void deleteBatch(@Param("list") Collection<String> crossIds);
List<CrossTurnDataRealtimePO> selectByCrossId(String crossId);
CrossTurnDataRealtimePO selectByLane(String crossId, Integer key, String turn);
}
package net.wanji.datacenter.pojo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author hfx
* @date 2023/1/13 19:11
* @desc LaneQuery
*/
@Data
public class LaneQuery {
@ApiModelProperty(name = "路段编号",notes = "")
private String rid;
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "灯组ID",notes = "")
private String lightsId;
}
package net.wanji.datacenter.pojo.convert;
import net.wanji.databus.po.*;
import net.wanji.datacenter.pojo.dto.LanePeriodicDataDTO;
import net.wanji.datacenter.entity.*;
import org.springframework.stereotype.Component;
import java.util.Date;
......
package net.wanji.datacenter.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author hfx
* @date 2023/01/12 13:29:39
* @desc 灯组信息
*/
@Data
public class CrossLightsDTO {
@ApiModelProperty(name = "灯组ID",notes = "")
private Integer id;
@ApiModelProperty(name = "灯组号",notes = "")
private String lightsNo;
@ApiModelProperty(name = "灯组类型:机动车(1圆饼灯;2左转灯;3直行灯;4右转灯;5掉头灯;);" +
"非机动车(10非机动车灯;11左转灯;12直行灯;13右转灯;14掉头灯);" +
"20行人灯;21行人进口灯;22行人出口灯;" +
"30公交专用灯",notes = "")
private Integer type;
@ApiModelProperty(name = "灯组放行方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dir;
@ApiModelProperty(name = "灯组序号",notes = "")
private Integer sort;
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "相位ID",notes = "")
private Integer phaseId;
@ApiModelProperty(name = "车道信息",notes = "")
private List<LaneInfoDTO> laneInfos;
}
package net.wanji.datacenter.pojo.dto;
import lombok.Data;
/**
* @author duanruiming
* @date 2023/08/02 17:27
* @description 路口周期指标
*/
@Data
public class CrossPeriodicIndicatorsDTO {
private double greenLightClearRate; // 路口绿灯清空率
}
package net.wanji.datacenter.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author hfx
* @date 2023/01/12 13:29:39
* @desc 路口相位基础信息
*/
@Data
public class CrossPhaseDTO {
@ApiModelProperty(name = "相位ID",notes = "")
private Integer id;
@ApiModelProperty(name = "相位号",notes = "")
private String phaseNo;
@ApiModelProperty(name = "相位名称",notes = "")
private String name;
@ApiModelProperty(name = "相位序号",notes = "")
private Integer sort;
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "路口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dirType;
@ApiModelProperty(name = "路口转向:u掉头;l左转;s直行;r右转",notes = "")
private String turnType;
@ApiModelProperty(name = "计划号",notes = "")
private String planNo;
@ApiModelProperty(name = "方案ID",notes = "")
private Integer schemeId;
@ApiModelProperty(name = "方案号",notes = "")
private String schemeNo;
@ApiModelProperty(name = "环号",notes = "")
private Integer ringNo;
@ApiModelProperty(name = "组号",notes = "")
private Integer groupNo;
@ApiModelProperty(name = "相位类型 1实相位 2虚相位 3伴随相位",notes = "")
private Integer type;
@ApiModelProperty(name = "控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪",notes = "")
private Integer controlMode;
@ApiModelProperty(name = "相位时间",notes = "")
private Integer phaseTime;
@ApiModelProperty(name = "绿灯时间",notes = "")
private Integer greenTime;
@ApiModelProperty(name = "绿闪时间",notes = "")
private Integer greenFlashTime;
@ApiModelProperty(name = "行闪时间",notes = "")
private Integer pedFlashTime;
@ApiModelProperty(name = "黄灯时间",notes = "")
private Integer yellowTime;
@ApiModelProperty(name = "红灯时间",notes = "")
private Integer redTime;
@ApiModelProperty(name = "最小绿灯时间",notes = "")
private Integer minGreenTime;
@ApiModelProperty(name = "最大绿灯时间",notes = "")
private Integer maxGreenTime;
@ApiModelProperty(name = "灯组信息",notes = "")
List<CrossLightsDTO> lightsInfos;
}
package net.wanji.datacenter.pojo.dto;
import lombok.Data;
/**
* @author duanruiming
* @date 2023/08/04 16:19
*/
@Data
public class CrossPhaseGreenTimeDTO {
private String phaseId;
private Integer passTime;
}
package net.wanji.datacenter.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author hfx
* @date 2023/1/17 16:21
* @desc 路口调度信息
*/
@Data
public class CrossSchedulesDTO {
@ApiModelProperty(name = "调度ID",notes = "")
private Integer schedulesId;
@ApiModelProperty(name = "调度名称",notes = "")
private String schedulesName;
@ApiModelProperty(name = "状态:1执行;0未执行",notes = "")
private Integer status;
@ApiModelProperty(name = "星期:1周一,2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期",notes = "")
private Integer week;
@ApiModelProperty(name = "特殊日期",notes = "")
private String specialDate;
@ApiModelProperty(name = "计划ID",notes = "")
private Integer planId;
@ApiModelProperty(name = "计划号",notes = "")
private String planNo;
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "时段信息",notes = "")
List<CrossSectionDTO> sectionInfos;
}
package net.wanji.datacenter.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author hfx
* @date 2023/01/12 13:29:39
* @desc 路口方案基础信息
*/
@Data
public class CrossSchemeDTO {
@ApiModelProperty(name = "方案ID", notes = "")
private Integer id;
@ApiModelProperty(name = "方案号", notes = "")
private String schemeNo;
@ApiModelProperty(name = "方案名称", notes = "")
private String name;
@ApiModelProperty(name = "路口ID", notes = "")
private String crossId;
@ApiModelProperty(name = "周期(秒)", notes = "")
private Integer cycle;
@ApiModelProperty(name = "协调相位ID", notes = "")
private Integer coordPhase;
@ApiModelProperty(name = "相位差", notes = "")
private Integer offset;
@ApiModelProperty(name = "相位信息", notes = "")
private List<CrossPhaseDTO> phaseInfos;
}
package net.wanji.datacenter.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author hfx
* @date 2023/1/17 16:14
* @desc CrossSectionDTO
*/
@Data
public class CrossSectionDTO {
@ApiModelProperty(name = "时段ID",notes = "")
private Integer id;
@ApiModelProperty(name = "时段号",notes = "")
private String sectionNo;
@ApiModelProperty(name = "开始时间",notes = "")
private String startTime;
@ApiModelProperty(name = "结束时间",notes = "")
private String endTime;
@ApiModelProperty(name = "计划ID",notes = "")
private Integer planId;
@ApiModelProperty(name = "计划号",notes = "")
private String planNo;
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "方案ID",notes = "")
private Integer schemeId;
@ApiModelProperty(name = "控制模式:1定周期;2绿波协调;3黄闪;4全红;5关灯;6单点自适应;7全感应;8半感应;",notes = "")
private Integer controlMode;
}
package net.wanji.datacenter.pojo.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
/**
* @author duanruiming
* @date 2023/08/04 10:20
* @description 路口指标-快照数据B8
*/
@Data
public class CrossSnapshotDataDTO {
/**
* 车道事件集合
*/
@JsonProperty("eventList")
private List<CrossSnapshotDataDTO.EventList> eventList;
/**
* 车道数量
*/
private Integer crossNum;
/**
* 全域编号
*/
private String orgCode;
/**
* 数据生成时间: yyyy-MM-dd HH:mm:ss:SSS
*/
private String timeStamp;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public static class EventList {
@JsonProperty("crossId")
private String crossId;
/**
* 路口车辆数(辆)
*/
@JsonProperty("carNums")
private Integer carNums;
/**
* 扩展字段,例如:{\"key1\":\"value1\",\"key2\":\"value2\"}
*/
@JsonProperty("expand")
private String expand;
}
}
package net.wanji.datacenter.entity;
package net.wanji.datacenter.pojo.dto;
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 20:17
* @author hfx
* @date 2023/1/13 19:03
* @desc 车道信息
*/
@Data
@TableName("t_base_lane_info")
@ApiModel(value = "CrossBaseLaneInfoPO", description = "路口基础车道数据")
public class CrossBaseLaneInfoPO {
@ApiModelProperty(name = "id",notes = "")
public class LaneInfoDTO {
@ApiModelProperty(name = "车道ID",notes = "")
private String id;
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(name = "车道代码",notes = "")
private String code;
@ApiModelProperty(name = "车道序号,从左车道开始编号11、12、13...",notes = "")
private Integer sort;
@ApiModelProperty(name = "车道类型:1路段车道;2进口车道;3出口车道;4左转弯待转区;6直行待行区",notes = "")
private Integer type;
@ApiModelProperty(name = "车道方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dir;
@ApiModelProperty(name = "车道转向:1左转;2直行;3右转;4掉头;5直左;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头",notes = "")
@ApiModelProperty(name = "车道转向",notes = "")
private Integer turn;
@ApiModelProperty(name = "车道类别:1机动车;2非机动车;3公交专用;4可变;5潮汐",notes = "")
private Integer category;
@ApiModelProperty(name = "路口编号",notes = "")
private String crossId;
@ApiModelProperty(name = "路段编号",notes = "")
private String rid;
@ApiModelProperty(name = "渠化编号",notes = "")
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId;
@ApiModelProperty(name = "灯组ID",notes = "")
private Integer lightsId;
@ApiModelProperty(name = "车道长度",notes = "")
private Double length;
@ApiModelProperty(name = "车道宽度",notes = "")
private Double width;
@ApiModelProperty(name = "空间对象",notes = "")
private String wkt;
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.datacenter.service.impl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.datacenter.kafka.ConsumerHandler;
import net.wanji.datacenter.kafka.ProducerHandler;
import net.wanji.datacenter.pojo.dto.CrossSnapshotDataDTO;
import net.wanji.datacenter.service.DataProcessService;
import net.wanji.datacenter.utils.JacksonUtils;
import org.springframework.stereotype.Service;
/**
* @author duanruiming
* @date 2023/08/04 10:24
*/
@Slf4j
@Service(value = "crossSnapshotDataProcessService")
@RequiredArgsConstructor
public class CrossSnapshotDataProcessService implements DataProcessService {
private final ConsumerHandler consumerHandler;
private final ProducerHandler producerHandler;
@Override
public String receive(String topic) {
return consumerHandler.getTopicMessage(topic);
}
@Override
public void send(String topic, Object convertData) {
producerHandler.send(topic, convertData);
}
@Override
public Object convert(String originalData) throws Exception {
return JacksonUtils.getInstance().readValue(originalData, CrossSnapshotDataDTO.class);
}
@Override
public void save(Object convertData) throws Exception {
}
}
......@@ -2,12 +2,12 @@ package net.wanji.datacenter.service.impl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.po.*;
import net.wanji.datacenter.kafka.ConsumerHandler;
import net.wanji.datacenter.kafka.ProducerHandler;
import net.wanji.datacenter.mapper.*;
import net.wanji.datacenter.pojo.convert.LanePeriodicDataEventListConvert;
import net.wanji.datacenter.pojo.dto.LanePeriodicDataDTO;
import net.wanji.datacenter.entity.*;
import net.wanji.datacenter.service.DataProcessService;
import net.wanji.datacenter.utils.JacksonUtils;
import org.springframework.beans.BeanUtils;
......@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
* @description: 车道周期实时数据加工处理服务,优化模块实时监控操作数据
*/
@Slf4j
@Service(value = "JN040001LanePeriodicData")
@Service(value = "lanePeriodicDataProcessService")
@RequiredArgsConstructor
@SuppressWarnings("all")
public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
......@@ -46,7 +46,7 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
@Override
public void send(String topic, Object convertData) {
consumerHandler.removeTopicMessage(topic);
producerHandler.send(topic, convertData);
}
@Override
......@@ -65,7 +65,6 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
@Transactional
public void save(Object convertData) throws Exception {
LanePeriodicDataDTO lanePeriodicDataDTO = (LanePeriodicDataDTO) convertData;
producerHandler.send("cross_real_time_data", lanePeriodicDataDTO);
int laneNum = lanePeriodicDataDTO.getLaneNum();
List<CrossDataRealtimePO> crossDataRealtimePOS = new ArrayList<>(laneNum);
......@@ -159,6 +158,8 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
if (!CollectionUtils.isEmpty(insertCrossDataRealtimePOS)) {
crossDataRealTimeMapper.insertBatch(insertCrossDataRealtimePOS);
}
// todo
producerHandler.send("cross_real_time_data", lanePeriodicDataDTO);
// 方向数据
List<CrossDirDataRealtimePO> insertCrossDirDataRealtimePOS = new ArrayList<>();
......
package net.wanji.datacenter.service.impl;
import net.wanji.datacenter.service.DataProcessService;
import org.springframework.stereotype.Service;
/**
* @author duanruiming
* @date 2023/03/10 14:17
*/
@Service(value = "test")
public class Test implements DataProcessService {
@Override
public String receive(String originalData) {
System.err.println("test receice successful");
return null;
}
@Override
public void send(String topic, Object convertData) {
System.err.println("test send successful");
}
@Override
public String convert(String originalData) {
System.err.println("test convert successful");
return null;
}
@Override
public void save(Object convertData) throws Exception{
System.err.println("test save successful");
}
}
package net.wanji.datacenter.utils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName BeanListUtils
* @Description
* @Author wanji
* @Date 2020/6/30 17:54
* @Version 1.0
*/
public class BeanListUtils {
public static <T> ArrayList beanToList(T bean) throws NoSuchFieldException, IllegalAccessException {
ArrayList<String> list = new ArrayList<String>();
if (bean == null)
return null;
Field[] fields = bean.getClass().getDeclaredFields();
for (Field field : fields) {
Field f = bean.getClass().getDeclaredField(field.getName());
f.setAccessible(true);
Object o = f.get(bean);
list.add(o.toString());
}
return list;
}
/**
*
* 将dto和entity之间的属性互相转换,dto中属性一般为String等基本类型,
* 但是entity中可能有复合主键等复杂类型,需要注意同名问题
* @param src
* @param target
*/
public static Object populate(Object src, Object target) {
Method[] srcMethods = src.getClass().getMethods();
Method[] targetMethods = target.getClass().getMethods();
for (Method m : srcMethods) {
String srcName = m.getName();
if (srcName.startsWith("get")) {
try {
Object result = m.invoke(src);
for (Method mm : targetMethods) {
String targetName = mm.getName();
if (targetName.startsWith("set")
&& targetName.substring(3, targetName.length())
.equals(srcName.substring(3, srcName.length()))) {
mm.invoke(target, result);
}
}
} catch (Exception e) {
}
}
}
return target;
}
/**
*
* dto集合和实体类集合间的互相属性映射
*
* @param src
* @param target
* @param targetClass
* @return
*/
@SuppressWarnings("unchecked")
public static <S, T> List<T> populateList(List<S> src, List<T> target, Class<?> targetClass) {
for (int i = 0; i < src.size(); i++) {
try {
Object object = targetClass.newInstance();
target.add((T) object);
populate(src.get(i), object);
} catch (Exception e) {
continue;// 某个方法反射异常
}
}
return target;
}
}
package net.wanji.datacenter.utils;
/**
* @author wanji
* @version 1.0
* @description [日期风格工具类]
*/
public enum DateStyle {
YYYY_MM("yyyy-MM", false),
YYYY_MM_DD("yyyy-MM-dd", false),
YYYY_MM_DD_HH_MM("yyyy-MM-dd HH:mm", false),
YYYY_MM_DD_HH_MM_SS("yyyy-MM-dd HH:mm:ss", false),
YYYYMMDDHHMMSS("yyyyMMddHHmmss", false),
YYYYMMDDHHMMSSSSS("yyyyMMddHHmmssSSS", false),
YYYYMMDD("yyyyMMdd", false),
YYYY_MM_EN("yyyy/MM", false),
YYYY_MM_DD_EN("yyyy/MM/dd", false),
YYYY_MM_DD_HH_MM_EN("yyyy/MM/dd HH:mm", false),
YYYY_MM_DD_HH_MM_SS_EN("yyyy/MM/dd HH:mm:ss", false),
DD_MM_YYYY_EN("dd/MM/yyyy", false),
YYYY_MM_CN("yyyy年MM月", false),
YYYY_MM_DD_CN("yyyy年MM月dd日", false),
YYYY_MM_DD_HH_MM_CN("yyyy年MM月dd日 HH:mm", false),
YYYY_MM_DD_HH_MM_SS_CN("yyyy年MM月dd日 HH:mm:ss", false),
HH_MM("HH:mm", true),
HH_MM_SS("HH:mm:ss", true),
MM_DD("MM-dd", true),
MM_DD_HH_MM("MM-dd HH:mm", true),
MM_DD_HH_MM_SS("MM-dd HH:mm:ss", true),
MM_DD_EN("MM/dd", true),
MM_DD_HH_MM_EN("MM/dd HH:mm", true),
MM_DD_HH_MM_SS_EN("MM/dd HH:mm:ss", true),
MM_DD_CN("MM月dd日", true),
MM_DD_HH_MM_CN("MM月dd日 HH:mm", true),
MM_DD_HH_MM_SS_CN("MM月dd日 HH:mm:ss", true);
private String value;
private boolean isShowOnly;
DateStyle(String value, boolean isShowOnly) {
this.value = value;
this.isShowOnly = isShowOnly;
}
public String getValue() {
return value;
}
public boolean isShowOnly() {
return isShowOnly;
}
}
\ No newline at end of file
......@@ -76,4 +76,13 @@ mybatis:
type-aliases-package: net.wanji.datacenter.*
mapper-locations: classpath*:mapper/*.xml,classpath:mapper/*/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#线程池配置
threadPoolConfig:
threadPoolName: ${spring.application.name}-threadPool-thread-%d
coreSize: 8
maxSize: 16
queueCapacity: 200
keepAliveTime: 6000
allowCoreTimeOut: false
\ No newline at end of file
spring:
application:
name: wj-datacenter-service
main:
allow-circular-references: true
cloud:
nacos:
config:
......
<?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.datacenter.mapper.CrossBaseLaneInfoMapper">
</mapper>
\ No newline at end of file
<?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.datacenter.mapper.CrossDataRealtimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.datacenter.entity.CrossDataRealtimePO">
<result column="cross_id" property="crossId"></result>
<result column="status" property="status"></result>
<result column="type" property="type"></result>
<result column="traffic_index" property="trafficIndex"></result>
<result column="start_time" property="startTime"></result>
<result column="duration" property="duration"></result>
<result column="is_unbalance" property="isUnbalance"></result>
<result column="is_spillover" property="isSpillover"></result>
<result column="is_congestion" property="isCongestion"></result>
<result column="unbalance_index" property="unbalanceIndex"></result>
<result column="spillover_index" property="spilloverIndex"></result>
<result column="congestion_index" property="congestionIndex"></result>
<result column="unbalance_dirs" property="unbalanceDirs"></result>
<result column="spillover_dirs" property="spilloverDirs"></result>
<result column="congestion_dirs" property="congestionDirs"></result>
<result column="flow" property="flow"></result>
<result column="flow_rate" property="flowRate"></result>
<result column="speed" property="speed"></result>
<result column="queue_length" property="queueLength"></result>
<result column="stop_times" property="stopTimes"></result>
<result column="delay_time" property="delayTime"></result>
<result column="sturation" property="sturation"></result>
<result column="batch_time" property="batchTime"></result>
<result column="gmt_create" property="gmtCreate"></result>
<result column="gmt_modified" property="gmtModified"></result>
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<insert id="insertBatch" parameterType="net.wanji.datacenter.entity.CrossDataRealtimePO">
insert into t_cross_data_realtime
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
(#{entity.crossId},#{entity.status},#{entity.type},#{entity.trafficIndex},#{entity.startTime},#{entity.duration},#{entity.isSpillover},#{entity.isSpillover},#{entity.isCongestion},
#{entity.unbalanceIndex},#{entity.spilloverIndex},#{entity.congestionIndex},#{entity.unbalanceDirs},#{entity.spilloverDirs},#{entity.congestionDirs},
#{entity.flow},#{entity.flowRate},#{entity.speed},#{entity.queueLength},#{entity.stopTimes},#{entity.delayTime},#{entity.sturation},#{entity.batchTime},#{entity.gmtCreate},#{entity.gmtModified})
</foreach>
</insert>
<delete id="deleteBatch" parameterType="String">
delete from t_cross_data_realtime
where cross_id in
<foreach collection="list" item="crossId" separator=",">
(#{crossId})
</foreach>
</delete>
<select id="selectByCrossId" resultType="net.wanji.datacenter.entity.CrossDataRealtimePO">
select <include refid="Base_Column_List"></include>
from t_cross_data_realtime
where cross_id = #{crossId}
</select>
</mapper>
\ No newline at end of file
<?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.datacenter.mapper.CrossDirDataRealtimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.datacenter.entity.CrossDirDataRealtimePO">
<result column="id" property="id"></result>
<result column="dir_type" property="dirType"></result>
<result column="in_out_type" property="inOutType"></result>
<result column="cross_id" property="crossId"></result>
<result column="length" property="length"></result>
<result column="status" property="status"></result>
<result column="traffic_index" property="trafficIndex"></result>
<result column="start_time" property="startTime"></result>
<result column="capacity" property="capacity"></result>
<result column="duration" property="duration"></result>
<result column="flow" property="flow"></result>
<result column="speed" property="speed"></result>
<result column="queue_length" property="queueLength"></result>
<result column="stop_times" property="stopTimes"></result>
<result column="delay_time" property="delayTime"></result>
<result column="sturation" property="sturation"></result>
<result column="batch_time" property="batchTime"></result>
<result column="gmt_create" property="gmtCreate"></result>
<result column="gmt_modified" property="gmtModified"></result>
<result column="effusion_time" property="effusionTime"></result>
</resultMap>
<sql id="Base_Column_List">
id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,flow,speed,queue_length,stop_times,
delay_time,sturation,no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,batch_time,gmt_create,gmt_modified,effusion_time
</sql>
<insert id="insertBatch" parameterType="net.wanji.datacenter.entity.CrossDirDataRealtimePO">
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.speed}, #{entity.queueLength}, #{entity.stopTimes}, #{entity.delayTime}, #{entity.sturation}, #{entity.batchTime}, #{entity.gmtCreate}, #{entity.gmtModified}, #{entity.effusionTime} )
</foreach>
</insert>
<delete id="deleteBatch" parameterType="String">
delete from t_cross_dir_data_realtime
where cross_id in
<foreach collection="list" item="crossId" separator=",">
(#{crossId})
</foreach>
</delete>
<select id="selectByCrossIdAndDirType" resultType="net.wanji.datacenter.entity.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 = 2
</select>
<select id="selectByCrossIdAndInOutType" resultType="net.wanji.datacenter.entity.CrossDirDataRealtimePO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_realtime
where cross_id = #{crossId} and in_out_type = #{inOutType}
</select>
<select id="selectStatus" resultType="java.lang.Integer">
select status
from t_cross_dir_data_realtime
where dir_type = #{inDir} and in_out_type = #{inOutType} and cross_id = #{secondId}
</select>
<select id="selectBycrossId" resultType="net.wanji.datacenter.entity.CrossDirDataRealtimePO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_realtime
where cross_id = #{crossId}
</select>
<select id="selectByInDir" resultType="net.wanji.datacenter.entity.CrossDirDataRealtimePO">
select <include refid="Base_Column_List"/>
from t_cross_dir_data_realtime
where cross_id = #{currentCrossId} and dir_type = #{key} and in_out_type = 1
</select>
</mapper>
\ No newline at end of file
<?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.datacenter.mapper.CrossLaneDataRealTimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.datacenter.entity.CrossLaneDataRealTimePO">
<result column="id" property="id"></result>
<result column="cross_id" property="crossId"></result>
<result column="flow" property="flow"></result>
<result column="speed" property="speed"></result>
<result column="in_speed" property="inSpeed"></result>
<result column="out_speed" property="outSpeed"></result>
<result column="queue_length" property="queueLength"></result>
<result column="stop_times" property="stopTimes"></result>
<result column="delay_time" property="delayTime"></result>
<result column="capacity" property="capacity"></result>
<result column="sturation" property="sturation"></result>
<result column="vehhead_dist" property="vehheadDist"></result>
<result column="vehhead_time" property="vehheadTime"></result>
<result column="quality" property="quality"></result>
<result column="batch_time" property="batchTime"></result>
<result column="gmt_create" property="gmtCreate"></result>
<result column="gmt_modified" property="gmtModified"></result>
</resultMap>
<sql id="Base_Column_List">
id, cross_id, flow, speed, in_speed, out_speed, queue_length, stop_times, delay_time, capacity, sturation,
vehhead_dist, vehhead_time, quality, batch_time, gmt_create, gmt_modified
</sql>
<insert id="insertBatch" parameterType="net.wanji.datacenter.entity.CrossLaneDataRealTimePO">
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.vehheadDist},#{entity.vehheadTime},#{entity.quality},#{entity.batchTime},#{entity.gmtCreate},#{entity.gmtModified})
</foreach>
</insert>
<delete id="deleteBatch" parameterType="String">
delete from t_lane_data_realtime
where cross_id in
<foreach collection="list" item="crossId" separator=",">
(#{crossId})
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.datacenter.mapper.CrossTurnDataRealtimeMapper">
<resultMap id="BaseResultMap" type="net.wanji.datacenter.entity.CrossTurnDataRealtimePO">
<result column="id" property="id"></result>
<result column="turn_type" property="turnType"></result>
<result column="in_dir" property="inDir"></result>
<result column="out_dir" property="outDir"></result>
<result column="cross_id" property="crossId"></result>
<result column="flow" property="flow"></result>
<result column="status" property="status"></result>
<result column="traffic_index" property="trafficIndex"></result>
<result column="speed" property="speed"></result>
<result column="in_speed" property="inSpeed"></result>
<result column="out_speed" property="outSpeed"></result>
<result column="queue_length" property="queueLength"></result>
<result column="stop_times" property="stopTimes"></result>
<result column="delay_time" property="delayTime"></result>
<result column="sturation" property="sturation"></result>
<result column="vehhead_dist" property="vehheadDist"></result>
<result column="vehhead_time" property="vehheadTime"></result>
<result column="quality" property="quality"></result>
<result column="batch_time" property="batchTime"></result>
<result column="gmt_create" property="gmtCreate"></result>
<result column="gmt_modified" property="gmtModified"></result>
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<insert id="insertBatch" parameterType="net.wanji.datacenter.entity.CrossTurnDataRealtimePO">
insert into t_cross_turn_data_realtime
(<include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="entity" separator=",">
(#{entity.id},#{entity.turnType},#{entity.inDir},#{entity.outDir},#{entity.crossId},#{entity.flow},#{entity.status},#{entity.trafficIndex},#{entity.speed},#{entity.inSpeed},#{entity.outSpeed},#{entity.queueLength},
#{entity.stopTimes},#{entity.delayTime},#{entity.sturation},#{entity.vehheadDist},#{entity.vehheadTime},#{entity.quality},#{entity.batchTime},#{entity.gmtCreate},#{entity.gmtModified})
</foreach>
</insert>
<delete id="deleteBatch" parameterType="String">
delete from t_cross_turn_data_realtime
where cross_id in
<foreach collection="list" item="crossId" separator=",">
(#{crossId})
</foreach>
</delete>
<select id="selectByCrossId" resultType="net.wanji.datacenter.entity.CrossTurnDataRealtimePO">
select <include refid="Base_Column_List"></include>
from t_cross_turn_data_realtime
where cross_id = #{crossId}
</select>
<select id="selectByLane" resultType="net.wanji.datacenter.entity.CrossTurnDataRealtimePO">
select <include refid="Base_Column_List"></include>
from t_cross_turn_data_realtime
where cross_id = #{crossId} and in_dir = #{key} and turn_type = #{turn}
</select>
</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