Commit 1d58e920 by 毛树良

增加同步数据

1 parent e092c22e
...@@ -11,6 +11,14 @@ public class RedisConstants { ...@@ -11,6 +11,14 @@ public class RedisConstants {
*/ */
public static final String FANXING_TO_GB1400_LASTTIME = "fanxing:to:gb1400:lasttime"; public static final String FANXING_TO_GB1400_LASTTIME = "fanxing:to:gb1400:lasttime";
/** /**
* 设备数据上次同步到的时间点
*/
public static final String FANXING_TO_GB1400_DEVICE_LASTTIME = "fanxing:to:gb1400:device:lasttime";
/**
* 卡口数据上次同步到的时间点
*/
public static final String FANXING_TO_GB1400_KAKOU_LASTTIME = "fanxing:to:gb1400:kakou:lasttime";
/**
* 车道数据上次同步到的时间点 * 车道数据上次同步到的时间点
*/ */
public static final String FANXING_TO_GB1400_LANE_LASTTIME = "fanxing:to:gb1400:lane:lasttime"; public static final String FANXING_TO_GB1400_LANE_LASTTIME = "fanxing:to:gb1400:lane:lasttime";
......
...@@ -5,9 +5,13 @@ import com.viontech.constant.RedisConstants; ...@@ -5,9 +5,13 @@ import com.viontech.constant.RedisConstants;
import com.viontech.utils.DateUtil; import com.viontech.utils.DateUtil;
import com.viontech.utils.Gb1400GenerateIDUtil; import com.viontech.utils.Gb1400GenerateIDUtil;
import com.viontech.vo.gb1400.*; import com.viontech.vo.gb1400.*;
import com.viontech.vo.traffic.DeviceModel;
import com.viontech.vo.traffic.LaneModel;
import com.viontech.vo.traffic.TollgateModel;
import com.viontech.vo.traffic.TrafficMongoModel; import com.viontech.vo.traffic.TrafficMongoModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -87,9 +91,9 @@ public class TrafficDataConvertHandler { ...@@ -87,9 +91,9 @@ public class TrafficDataConvertHandler {
return result; return result;
} }
public SubscribeNotificationsObj deviceToSubscribeNotifications(List<TrafficMongoModel> trafficMongoModels) { public SubscribeNotificationsObj deviceToSubscribeNotifications(List<DeviceModel> deviceModels) {
if (CollectionUtils.isEmpty(trafficMongoModels)) { if (CollectionUtils.isEmpty(deviceModels)) {
log.warn("trafficMongoModels isEmpty"); log.warn("deviceModels isEmpty");
return null; return null;
} }
SubscribeNotificationsObj result = new SubscribeNotificationsObj(); SubscribeNotificationsObj result = new SubscribeNotificationsObj();
...@@ -111,8 +115,9 @@ public class TrafficDataConvertHandler { ...@@ -111,8 +115,9 @@ public class TrafficDataConvertHandler {
List<APEList.APE> apeList = new ArrayList<>(); List<APEList.APE> apeList = new ArrayList<>();
StringBuilder infoIds = new StringBuilder(); StringBuilder infoIds = new StringBuilder();
//设置设备数据 //设置设备数据
for (TrafficMongoModel trafficMongoModel : trafficMongoModels) { for (DeviceModel deviceModel : deviceModels) {
APEList.APE ape = null; APEList.APE ape = new APEList.APE();
BeanUtils.copyProperties(deviceModel, ape);
apeList.add(ape); apeList.add(ape);
if ("".equals(infoIds.toString())) { if ("".equals(infoIds.toString())) {
...@@ -132,9 +137,9 @@ public class TrafficDataConvertHandler { ...@@ -132,9 +137,9 @@ public class TrafficDataConvertHandler {
return result; return result;
} }
public SubscribeNotificationsObj tollgateToSubscribeNotifications(List<TrafficMongoModel> trafficMongoModels) { public SubscribeNotificationsObj tollgateToSubscribeNotifications(List<TollgateModel> tollgateModels) {
if (CollectionUtils.isEmpty(trafficMongoModels)) { if (CollectionUtils.isEmpty(tollgateModels)) {
log.warn("trafficMongoModels isEmpty"); log.warn("tollgateModels isEmpty");
return null; return null;
} }
SubscribeNotificationsObj result = new SubscribeNotificationsObj(); SubscribeNotificationsObj result = new SubscribeNotificationsObj();
...@@ -156,8 +161,9 @@ public class TrafficDataConvertHandler { ...@@ -156,8 +161,9 @@ public class TrafficDataConvertHandler {
List<TollgateList.Tollgate> tollgateList = new ArrayList<>(); List<TollgateList.Tollgate> tollgateList = new ArrayList<>();
StringBuilder infoIds = new StringBuilder(); StringBuilder infoIds = new StringBuilder();
//设置卡口数据 //设置卡口数据
for (TrafficMongoModel trafficMongoModel : trafficMongoModels) { for (TollgateModel tollgateModel : tollgateModels) {
TollgateList.Tollgate tollgate = null; TollgateList.Tollgate tollgate = new TollgateList.Tollgate();
BeanUtils.copyProperties(tollgateModel, tollgate);
tollgateList.add(tollgate); tollgateList.add(tollgate);
if ("".equals(infoIds.toString())) { if ("".equals(infoIds.toString())) {
...@@ -177,9 +183,9 @@ public class TrafficDataConvertHandler { ...@@ -177,9 +183,9 @@ public class TrafficDataConvertHandler {
return result; return result;
} }
public SubscribeNotificationsObj laneToSubscribeNotifications(List<TrafficMongoModel> trafficMongoModels) { public SubscribeNotificationsObj laneToSubscribeNotifications(List<LaneModel> laneModels) {
if (CollectionUtils.isEmpty(trafficMongoModels)) { if (CollectionUtils.isEmpty(laneModels)) {
log.warn("trafficMongoModels isEmpty"); log.warn("laneModels isEmpty");
return null; return null;
} }
SubscribeNotificationsObj result = new SubscribeNotificationsObj(); SubscribeNotificationsObj result = new SubscribeNotificationsObj();
...@@ -201,8 +207,9 @@ public class TrafficDataConvertHandler { ...@@ -201,8 +207,9 @@ public class TrafficDataConvertHandler {
List<LaneList.Lane> laneList = new ArrayList<>(); List<LaneList.Lane> laneList = new ArrayList<>();
StringBuilder infoIds = new StringBuilder(); StringBuilder infoIds = new StringBuilder();
//设置车道数据 //设置车道数据
for (TrafficMongoModel trafficMongoModel : trafficMongoModels) { for (LaneModel laneModel : laneModels) {
LaneList.Lane lane = null; LaneList.Lane lane = new LaneList.Lane();
BeanUtils.copyProperties(laneModel, lane);
laneList.add(lane); laneList.add(lane);
StringBuilder laneSb = new StringBuilder(); StringBuilder laneSb = new StringBuilder();
......
package com.viontech.mapper; package com.viontech.mapper;
import com.viontech.vo.traffic.DeviceModel;
import com.viontech.vo.traffic.LaneModel; import com.viontech.vo.traffic.LaneModel;
import com.viontech.vo.traffic.TollgateModel;
import com.viontech.vo.traffic.TrafficModel; import com.viontech.vo.traffic.TrafficModel;
import java.util.List; import java.util.List;
public interface TrafficEventMapper { public interface TrafficEventMapper {
List<Object> selectJsonDatas(TrafficModel trafficModel); List<Object> selectJsonDatas(TrafficModel trafficModel);
List<DeviceModel> selectDeviceDatas(DeviceModel deviceModel);
List<TollgateModel> selectTollgateDatas(TollgateModel tollgateModel);
List<LaneModel> selectLaneDatas(LaneModel laneModel); List<LaneModel> selectLaneDatas(LaneModel laneModel);
} }
...@@ -11,6 +11,31 @@ ...@@ -11,6 +11,31 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/> <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
</resultMap> </resultMap>
<resultMap id="DeviceResultMap" type="com.viontech.vo.traffic.DeviceModel">
<result column="ape_id" jdbcType="VARCHAR" property="apeID"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="ip_addr" jdbcType="VARCHAR" property="ipAddr"/>
<result column="port" jdbcType="INTEGER" property="port"/>
<result column="longitude" jdbcType="DECIMAL" property="longitude"/>
<result column="latitude" jdbcType="DECIMAL" property="latitude"/>
<result column="place_code" jdbcType="VARCHAR" property="placeCode"/>
<result column="is_online" jdbcType="VARCHAR" property="isOnline"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
</resultMap>
<resultMap id="TollgateResultMap" type="com.viontech.vo.traffic.TollgateModel">
<result column="tollgate_id" jdbcType="VARCHAR" property="tollgateID"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="longitude" jdbcType="DECIMAL" property="longitude"/>
<result column="latitude" jdbcType="DECIMAL" property="latitude"/>
<result column="place_code" jdbcType="VARCHAR" property="placeCode"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="tollgate_cat" jdbcType="VARCHAR" property="tollgateCat"/>
<result column="tollgate_usage" jdbcType="INTEGER" property="tollgateUsage"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
</resultMap>
<!-- fetchSize="5000" --> <!-- fetchSize="5000" -->
<select id="selectJsonDatas" parameterType="com.viontech.vo.traffic.TrafficModel" <select id="selectJsonDatas" parameterType="com.viontech.vo.traffic.TrafficModel"
resultType="java.lang.String" fetchSize="5000"> resultType="java.lang.String" fetchSize="5000">
...@@ -173,6 +198,46 @@ ...@@ -173,6 +198,46 @@
</if> </if>
</select> </select>
<select id="selectDeviceDatas" parameterType="com.viontech.vo.traffic.DeviceModel"
resultMap="DeviceResultMap" fetchSize="5000">
select ape_id,name,model,ip_addr,port,longitude,latitude,place_code,is_online,create_time,modify_time
from tb_device
<where>
<if test="modifyTime_gte != null and modifyTime_gte != ''">
and modify_time > #{modifyTime_gte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime >= #{modifyTime_gte}-->
</if>
<if test="modifyTime_lte != null and modifyTime_lte != ''">
and modify_time <![CDATA[<=]]> #{modifyTime_lte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime <![CDATA[<]]> #{modifyTime_lte}-->
</if>
</where>
order by modify_time asc
<if test="limit != null and offset != null">
LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<select id="selectTollgateDatas" parameterType="com.viontech.vo.traffic.TollgateModel"
resultMap="TollgateResultMap" fetchSize="5000">
select tollgate_id,name,longitude,latitude,place_code,status,tollgate_cat,tollgate_usage,create_time,modify_time
from tb_tollgate
<where>
<if test="modifyTime_gte != null and modifyTime_gte != ''">
and modify_time > #{modifyTime_gte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime >= #{modifyTime_gte}-->
</if>
<if test="modifyTime_lte != null and modifyTime_lte != ''">
and modify_time <![CDATA[<=]]> #{modifyTime_lte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime <![CDATA[<]]> #{modifyTime_lte}-->
</if>
</where>
order by modify_time asc
<if test="limit != null and offset != null">
LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<select id="selectLaneDatas" parameterType="com.viontech.vo.traffic.LaneModel" <select id="selectLaneDatas" parameterType="com.viontech.vo.traffic.LaneModel"
resultMap="LaneResultMap" fetchSize="5000"> resultMap="LaneResultMap" fetchSize="5000">
select tollgate_id,lane_id,lane_no,name,direction,ape_id,create_time,modify_time select tollgate_id,lane_id,lane_no,name,direction,ape_id,create_time,modify_time
......
package com.viontech.scheduled;
import com.viontech.constant.Gb1400Constants;
import com.viontech.constant.RedisConstants;
import com.viontech.constant.SystemConstants;
import com.viontech.handler.TrafficDataConvertHandler;
import com.viontech.service.Gb1400Service;
import com.viontech.service.TrafficEventService;
import com.viontech.utils.DateUtil;
import com.viontech.utils.JsonMessage;
import com.viontech.vo.gb1400.SubscribeNotificationsObj;
import com.viontech.vo.traffic.DeviceModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @author msl
* @date 2022/5/7
*/
@Slf4j
@Component
public class DeviceSyncScheduled {
@Resource
private TrafficEventService trafficEventService;
@Resource
private Gb1400Service gb1400Service;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private TrafficDataConvertHandler trafficDataConvertHandler;
@Scheduled(cron = "0 */2 * * * ?")
public void handleIllegal() {
log.info("开始处理设备数据");
if (!Gb1400Constants.LinkStatus) {
return;
}
Object o = redisTemplate.opsForValue().get(RedisConstants.FANXING_TO_GB1400_DEVICE_LASTTIME);
//上次对接到的设备记录时间
String lastTimeUtc = "";
if (o == null) {
//初次查询一小时前的数据,-12,-8:转UTC时间,总-20
lastTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -20), DateUtil.TIMESTAMP_FORMAT);
} else {
lastTimeUtc = (String) o;
}
String currentTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -8), DateUtil.TIMESTAMP_FORMAT);
if (StringUtils.isBlank(lastTimeUtc) || StringUtils.isBlank(currentTimeUtc)) {
log.warn("lastTimeUtc or currentTimeUtc isBlank");
return;
}
//查询
DeviceModel deviceQry = new DeviceModel();
deviceQry.setModifyTime_gte(lastTimeUtc);
deviceQry.setModifyTime_lte(currentTimeUtc);
deviceQry.setOffset(0);
deviceQry.setLimit(10);
List<DeviceModel> deviceModels = trafficEventService.selectDeviceDatas(deviceQry);
log.info("查询范围(lastTimeUtc,currentTimeUtc]=({},{}],本批次设备待同步数据总{}条。", lastTimeUtc, currentTimeUtc, deviceModels.size());
if (!CollectionUtils.isEmpty(deviceModels)) {
//List<DeviceModel> 转 SubscribeNotificationsObj
SubscribeNotificationsObj subscribeNotificationsObj = trafficDataConvertHandler.deviceToSubscribeNotifications(deviceModels);
//将设备数据同步gb1400
if (subscribeNotificationsObj != null) {
JsonMessage resultVo = gb1400Service.subscribeNotifications(subscribeNotificationsObj);
if (SystemConstants.APP_CODE_SUCCESS == resultVo.getCode()) {
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_DEVICE_LASTTIME, DateUtil.formatDate(deviceModels.get(deviceModels.size() - 1).getModifyTime(), DateUtil.TIMESTAMP_FORMAT));
}
} else {
log.error("trafficDataConvertHandler.deviceToSubscribeNotifications is null");
}
}
log.info("结束处理设备数据");
}
}
...@@ -2,12 +2,17 @@ package com.viontech.scheduled; ...@@ -2,12 +2,17 @@ package com.viontech.scheduled;
import com.viontech.constant.Gb1400Constants; import com.viontech.constant.Gb1400Constants;
import com.viontech.constant.RedisConstants; import com.viontech.constant.RedisConstants;
import com.viontech.constant.SystemConstants;
import com.viontech.handler.TrafficDataConvertHandler; import com.viontech.handler.TrafficDataConvertHandler;
import com.viontech.service.Gb1400Service; import com.viontech.service.Gb1400Service;
import com.viontech.service.TrafficEventService; import com.viontech.service.TrafficEventService;
import com.viontech.utils.DateUtil; import com.viontech.utils.DateUtil;
import com.viontech.utils.JsonMessage;
import com.viontech.vo.gb1400.SubscribeNotificationsObj;
import com.viontech.vo.traffic.LaneModel; import com.viontech.vo.traffic.LaneModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -43,16 +48,37 @@ public class LaneSyncScheduled { ...@@ -43,16 +48,37 @@ public class LaneSyncScheduled {
//上次对接到的车道记录时间 //上次对接到的车道记录时间
String lastTimeUtc = ""; String lastTimeUtc = "";
if (o == null) { if (o == null) {
//初次查询12小时前的数据 //初次查询一小时前的数据,-12,-8:转UTC时间,总-20
lastTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -12), DateUtil.TIMESTAMP_FORMAT); lastTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -20), DateUtil.TIMESTAMP_FORMAT);
} else { } else {
lastTimeUtc = (String) o; lastTimeUtc = (String) o;
} }
String currentTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -8), DateUtil.TIMESTAMP_FORMAT);
if (StringUtils.isBlank(lastTimeUtc) || StringUtils.isBlank(currentTimeUtc)) {
log.warn("lastTimeUtc or currentTimeUtc isBlank");
return;
}
//查询 //查询
LaneModel laneQry = new LaneModel(); LaneModel laneQry = new LaneModel();
laneQry.setModifyTime_gte(lastTimeUtc);
laneQry.setModifyTime_lte(currentTimeUtc);
laneQry.setOffset(0); laneQry.setOffset(0);
laneQry.setLimit(10); laneQry.setLimit(10);
List<LaneModel> laneModels = trafficEventService.selectLaneDatas(laneQry); List<LaneModel> laneModels = trafficEventService.selectLaneDatas(laneQry);
log.info("查询范围(lastTimeUtc,currentTimeUtc]=({},{}],本批次车道待同步数据总{}条。", lastTimeUtc, currentTimeUtc, laneModels.size());
if (!CollectionUtils.isEmpty(laneModels)) {
//List<LaneModel> 转 SubscribeNotificationsObj
SubscribeNotificationsObj subscribeNotificationsObj = trafficDataConvertHandler.laneToSubscribeNotifications(laneModels);
//将车道数据同步gb1400
if (subscribeNotificationsObj != null) {
JsonMessage resultVo = gb1400Service.subscribeNotifications(subscribeNotificationsObj);
if (SystemConstants.APP_CODE_SUCCESS == resultVo.getCode()) {
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_LANE_LASTTIME, DateUtil.formatDate(laneModels.get(laneModels.size() - 1).getModifyTime(), DateUtil.TIMESTAMP_FORMAT));
}
} else {
log.error("trafficDataConvertHandler.laneToSubscribeNotifications is null");
}
}
log.info("结束处理车道数据"); log.info("结束处理车道数据");
} }
} }
package com.viontech.scheduled;
import com.viontech.constant.Gb1400Constants;
import com.viontech.constant.RedisConstants;
import com.viontech.constant.SystemConstants;
import com.viontech.handler.TrafficDataConvertHandler;
import com.viontech.service.Gb1400Service;
import com.viontech.service.TrafficEventService;
import com.viontech.utils.DateUtil;
import com.viontech.utils.JsonMessage;
import com.viontech.vo.gb1400.SubscribeNotificationsObj;
import com.viontech.vo.traffic.LaneModel;
import com.viontech.vo.traffic.TollgateModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @author msl
* @date 2022/5/7
*/
@Slf4j
@Component
public class TollgateSyncScheduled {
@Resource
private TrafficEventService trafficEventService;
@Resource
private Gb1400Service gb1400Service;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private TrafficDataConvertHandler trafficDataConvertHandler;
@Scheduled(cron = "0 */2 * * * ?")
public void handleIllegal() {
log.info("开始处理卡口数据");
if (!Gb1400Constants.LinkStatus) {
return;
}
Object o = redisTemplate.opsForValue().get(RedisConstants.FANXING_TO_GB1400_KAKOU_LASTTIME);
//上次对接到的卡口记录时间
String lastTimeUtc = "";
if (o == null) {
//初次查询一小时前的数据,-12,-8:转UTC时间,总-20
lastTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -20), DateUtil.TIMESTAMP_FORMAT);
} else {
lastTimeUtc = (String) o;
}
String currentTimeUtc = DateUtil.formatDate(DateUtil.addHours(new Date(), -8), DateUtil.TIMESTAMP_FORMAT);
if (StringUtils.isBlank(lastTimeUtc) || StringUtils.isBlank(currentTimeUtc)) {
log.warn("lastTimeUtc or currentTimeUtc isBlank");
return;
}
//查询
TollgateModel tollgateQry = new TollgateModel();
tollgateQry.setModifyTime_gte(lastTimeUtc);
tollgateQry.setModifyTime_lte(currentTimeUtc);
tollgateQry.setOffset(0);
tollgateQry.setLimit(10);
List<TollgateModel> tollgateModels = trafficEventService.selectTollgateDatas(tollgateQry);
log.info("查询范围(lastTimeUtc,currentTimeUtc]=({},{}],本批次卡口待同步数据总{}条。", lastTimeUtc, currentTimeUtc, tollgateModels.size());
if (!CollectionUtils.isEmpty(tollgateModels)) {
//List<TollgateModel> 转 SubscribeNotificationsObj
SubscribeNotificationsObj subscribeNotificationsObj = trafficDataConvertHandler.tollgateToSubscribeNotifications(tollgateModels);
//将卡口数据同步gb1400
if (subscribeNotificationsObj != null) {
JsonMessage resultVo = gb1400Service.subscribeNotifications(subscribeNotificationsObj);
if (SystemConstants.APP_CODE_SUCCESS == resultVo.getCode()) {
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_KAKOU_LASTTIME, DateUtil.formatDate(tollgateModels.get(tollgateModels.size() - 1).getModifyTime(), DateUtil.TIMESTAMP_FORMAT));
}
} else {
log.error("trafficDataConvertHandler.tollgateToSubscribeNotifications is null");
}
}
log.info("结束处理卡口数据");
}
}
package com.viontech.service; package com.viontech.service;
import com.viontech.vo.traffic.DeviceModel;
import com.viontech.vo.traffic.LaneModel; import com.viontech.vo.traffic.LaneModel;
import com.viontech.vo.traffic.TollgateModel;
import com.viontech.vo.traffic.TrafficModel; import com.viontech.vo.traffic.TrafficModel;
import java.util.List; import java.util.List;
public interface TrafficEventService { public interface TrafficEventService {
List<Object> selectJsonDatas(TrafficModel trafficModel); List<Object> selectJsonDatas(TrafficModel trafficModel);
List<DeviceModel> selectDeviceDatas(DeviceModel deviceModel);
List<TollgateModel> selectTollgateDatas(TollgateModel tollgateModel);
List<LaneModel> selectLaneDatas(LaneModel laneModel); List<LaneModel> selectLaneDatas(LaneModel laneModel);
} }
...@@ -2,7 +2,9 @@ package com.viontech.service.impl; ...@@ -2,7 +2,9 @@ package com.viontech.service.impl;
import com.viontech.mapper.TrafficEventMapper; import com.viontech.mapper.TrafficEventMapper;
import com.viontech.service.TrafficEventService; import com.viontech.service.TrafficEventService;
import com.viontech.vo.traffic.DeviceModel;
import com.viontech.vo.traffic.LaneModel; import com.viontech.vo.traffic.LaneModel;
import com.viontech.vo.traffic.TollgateModel;
import com.viontech.vo.traffic.TrafficModel; import com.viontech.vo.traffic.TrafficModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -21,6 +23,16 @@ public class TrafficEventServiceImpl implements TrafficEventService { ...@@ -21,6 +23,16 @@ public class TrafficEventServiceImpl implements TrafficEventService {
} }
@Override @Override
public List<DeviceModel> selectDeviceDatas(DeviceModel deviceModel) {
return trafficEventMapper.selectDeviceDatas(deviceModel);
}
@Override
public List<TollgateModel> selectTollgateDatas(TollgateModel tollgateModel) {
return trafficEventMapper.selectTollgateDatas(tollgateModel);
}
@Override
public List<LaneModel> selectLaneDatas(LaneModel laneModel) { public List<LaneModel> selectLaneDatas(LaneModel laneModel) {
return trafficEventMapper.selectLaneDatas(laneModel); return trafficEventMapper.selectLaneDatas(laneModel);
} }
......
...@@ -3,6 +3,7 @@ package com.viontech.vo.gb1400; ...@@ -3,6 +3,7 @@ package com.viontech.vo.gb1400;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -16,22 +17,22 @@ public class APEList { ...@@ -16,22 +17,22 @@ public class APEList {
@Data @Data
public static class APE { public static class APE {
@JSONField(name = "ApeID") @JSONField(name = "ApeID")
private String ApeID; private String apeID;
@JSONField(name = "Name") @JSONField(name = "Name")
private String Name; private String name;
@JSONField(name = "Model") @JSONField(name = "Model")
private String Model; private String model;
@JSONField(name = "IPAddr") @JSONField(name = "IPAddr")
private String IPAddr; private String ipAddr;
@JSONField(name = "Port") @JSONField(name = "Port")
private Integer Port; private Integer port;
@JSONField(name = "Longtitude") @JSONField(name = "Longitude")
private Double Longtitude; private BigDecimal longitude;
@JSONField(name = "Latitude") @JSONField(name = "Latitude")
private Double Latitude; private BigDecimal latitude;
@JSONField(name = "PlaceCode") @JSONField(name = "PlaceCode")
private String PlaceCode; private String placeCode;
@JSONField(name = "IsOnline") @JSONField(name = "IsOnline")
private String IsOnline; private String isOnline;
} }
} }
...@@ -16,16 +16,16 @@ public class LaneList { ...@@ -16,16 +16,16 @@ public class LaneList {
@Data @Data
public static class Lane { public static class Lane {
@JSONField(name = "TollgateID") @JSONField(name = "TollgateID")
private String TollgateID; private String tollgateID;
@JSONField(name = "LaneId") @JSONField(name = "LaneId")
private Integer LaneId; private Integer laneId;
@JSONField(name = "LaneNo") @JSONField(name = "LaneNo")
private Integer LaneNo; private Integer laneNo;
@JSONField(name = "Name") @JSONField(name = "Name")
private String Name; private String name;
@JSONField(name = "Direction") @JSONField(name = "Direction")
private String Direction; private String direction;
@JSONField(name = "ApeID") @JSONField(name = "ApeID")
private String ApeID; private String apeID;
} }
} }
...@@ -3,6 +3,7 @@ package com.viontech.vo.gb1400; ...@@ -3,6 +3,7 @@ package com.viontech.vo.gb1400;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -16,20 +17,20 @@ public class TollgateList { ...@@ -16,20 +17,20 @@ public class TollgateList {
@Data @Data
public static class Tollgate { public static class Tollgate {
@JSONField(name = "TollgateID") @JSONField(name = "TollgateID")
private String TollgateID; private String tollgateID;
@JSONField(name = "Name") @JSONField(name = "Name")
private String Name; private String name;
@JSONField(name = "Longtitude") @JSONField(name = "Longitude")
private Double Longtitude; private BigDecimal longitude;
@JSONField(name = "Latitue") @JSONField(name = "Latitude")
private Double Latitue; private BigDecimal latitude;
@JSONField(name = "PlaceCode") @JSONField(name = "PlaceCode")
private String PlaceCode; private String placeCode;
@JSONField(name = "Status") @JSONField(name = "Status")
private String Status; private String status;
@JSONField(name = "TollgateCat") @JSONField(name = "TollgateCat")
private String TollgateCat; private String tollgateCat;
@JSONField(name = "TollgateUsage") @JSONField(name = "TollgateUsage")
private Integer TollgateUsage; private Integer tollgateUsage;
} }
} }
package com.viontech.vo.traffic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author msl
* @date 2022/5/7
*/
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class DeviceModel {
private String apeID;
private String name;
private String model;
private String ipAddr;
private Integer port;
private BigDecimal longitude;
private BigDecimal latitude;
private String placeCode;
private String isOnline;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
//
private String modifyTime_gte;
private String modifyTime_lte;
private Integer offset;
private Integer limit;
}
...@@ -22,12 +22,10 @@ public class LaneModel { ...@@ -22,12 +22,10 @@ public class LaneModel {
/** /**
* 创建时间 * 创建时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
private Date createTime; private Date createTime;
/** /**
* 修改时间 * 修改时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
private Date modifyTime; private Date modifyTime;
// //
private String modifyTime_gte; private String modifyTime_gte;
......
package com.viontech.vo.traffic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author msl
* @date 2022/5/7
*/
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class TollgateModel {
private String tollgateID;
private String name;
private BigDecimal longitude;
private BigDecimal latitude;
private String placeCode;
private String status;
private String tollgateCat;
private Integer tollgateUsage;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
//
private String modifyTime_gte;
private String modifyTime_lte;
private Integer offset;
private Integer limit;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!