宿州交警记录仪修改

ds-suzhou
luyya 2025-08-28 09:48:57 +08:00
parent 3d59d61a04
commit fa72e2e1d9
7 changed files with 25 additions and 21 deletions

View File

@ -114,13 +114,13 @@ public class DeviceGPSController {
} }
EsGpsInfo gpsInfo = new EsGpsInfo(); EsGpsInfo gpsInfo = new EsGpsInfo();
gpsInfo.setGpsTime(DateUtil.parse(jlyUpdateTime)); gpsInfo.setGpsTime(DateUtil.parse(jlyUpdateTime));
logger.info("更新时间:"+jlyUpdateTime); logger.info("交警记录仪更新时间:"+jlyUpdateTime);
Instant start = Instant.now(); Instant start = Instant.now();
List<EsGpsInfo> list = deviceGpsService.selectJlyGPS(gpsInfo); List<EsGpsInfo> list = deviceGpsService.selectJlyGPS(gpsInfo);
Instant finish = Instant.now(); Instant finish = Instant.now();
long timeElapsed = Duration.between(start, finish).toMillis(); long timeElapsed = Duration.between(start, finish).toMillis();
logger.info("查询耗时:"+timeElapsed); logger.info("交警记录仪查询耗时:"+timeElapsed);
logger.info("数据大小size"+list.size()); logger.info("交警记录仪数据大小size"+list.size());
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
EsGpsInfo info = list.get(i); EsGpsInfo info = list.get(i);
if(i == 0){ if(i == 0){
@ -137,11 +137,11 @@ public class DeviceGPSController {
dataToEsService.saveDataBatch(BeanUtil.copyToList(collect,RemoteGpsInfo.class)); dataToEsService.saveDataBatch(BeanUtil.copyToList(collect,RemoteGpsInfo.class));
Instant end = Instant.now(); Instant end = Instant.now();
long timeEnd = Duration.between(finish, end).toMillis(); long timeEnd = Duration.between(finish, end).toMillis();
logger.info("方法执行逻辑耗时:"+timeEnd); logger.info("交警记录仪方法执行逻辑耗时:"+timeEnd);
} }
@Scheduled(cron = "0/30 * * * * ?") // @Scheduled(cron = "0/30 * * * * ?")
public void jlyGpsStatus(){ public void jlyGpsStatus(){
if(StringUtils.isBlank(jlyUpdateTime)){ if(StringUtils.isBlank(jlyUpdateTime)){
jlyUpdateTime = startUpdateTime; jlyUpdateTime = startUpdateTime;

View File

@ -25,10 +25,8 @@ public class Device implements Serializable {
private String remark1; private String remark1;
private String remark2; private String remark2;
private int valid; private int valid;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String createTime;
private Date createTime; private String updateTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Long getId() { public Long getId() {
return id; return id;
@ -126,19 +124,19 @@ public class Device implements Serializable {
this.valid = valid; this.valid = valid;
} }
public Date getCreateTime() { public String getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(String createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public Date getUpdateTime() { public String getUpdateTime() {
return updateTime; return updateTime;
} }
public void setUpdateTime(Date updateTime) { public void setUpdateTime(String updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
} }

View File

@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.PostConstruct;
import java.util.List; import java.util.List;
@Configuration @Configuration
@ -35,17 +36,18 @@ public class JJDeviceSchedule {
private String lastUpdateTime = ""; private String lastUpdateTime = "";
@Scheduled(cron = "0 0/10 * * * ?") // @Scheduled(cron = "0 0/3 * * * ?")
public void saveORUpdateJly(){ public void saveORUpdateJly(){
if(StringUtils.isBlank(lastUpdateTime)){ if(StringUtils.isBlank(lastUpdateTime)){
lastUpdateTime = startUpdateTime; lastUpdateTime = startUpdateTime;
} }
Device device = new Device(); Device device = new Device();
device.setUpdateTime(DateUtil.parse(lastUpdateTime)); device.setUpdateTime(lastUpdateTime);
List<Device> list = deviceService.selectJly(device); List<Device> list = deviceService.selectJly(device);
log.info("查询时间={},查询结果={}",lastUpdateTime,list.size());
remoteDeviceService.batchSaveDevice(BeanUtil.copyToList(list, RemoteDeviceBo.class)); remoteDeviceService.batchSaveDevice(BeanUtil.copyToList(list, RemoteDeviceBo.class));
if (list.size() != 0){ if (list.size() != 0){
lastUpdateTime = DateUtil.format(list.get(0).getUpdateTime(),"yyyy-MM-dd HH:mm:ss") ; lastUpdateTime = list.get(0).getUpdateTime();
} }
} }

View File

@ -49,15 +49,17 @@
</select> </select>
<select id="selectJlyGPS" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult"> <select id="selectJlyGPS" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
select zdbh deviceCode,'5' deviceType, longitude lng, latitude lat,gpstime gpsTime,speed from bas_police_gps select d.tmp_ly_gbt28181 deviceCode,'5' deviceType, longitude lng, latitude lat,gpstime gpsTime,speed from bas_police_gps g
INNER JOIN bas_device d on g.zdbh = d.zdbh
<where> <where>
d.tmp_ly_gbt28181 is not null
<if test="gpsTime != null "> and gpstime >= #{gpsTime}</if> <if test="gpsTime != null "> and gpstime >= #{gpsTime}</if>
</where> </where>
order by gpstime desc order by gpstime desc
</select> </select>
<select id="selectJlyStatus" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult"> <select id="selectJlyStatus" parameterType="org.dromara.extract.domain.EsGpsInfo" resultMap="DeviceResult">
select zdbh deviceCode,'5' deviceType,ifnull(zt,0) is_online,ztgxsj gpsTime from bas_device select tmp_ly_gbt28181 deviceCode,'5' deviceType,ifnull(zt,0) online,ztgxsj gpsTime from bas_device
<where> <where>
<if test="gpsTime != null "> and ztgxsj >= #{gpsTime}</if> <if test="gpsTime != null "> and ztgxsj >= #{gpsTime}</if>
</where> </where>

View File

@ -46,8 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectJly" parameterType="org.dromara.extract.domain.Device" resultMap="DeviceRes"> <select id="selectJly" parameterType="org.dromara.extract.domain.Device" resultMap="DeviceRes">
select zdbh device_code,'5' device_type,'341300250000' zzjgdm, '交通警察支队' zzjgmc,gxsj update_time, sbmc policeName,byzd4 policeNo from bas_device select tmp_ly_gbt28181 device_code,'5' device_type,'341300250000' zzjgdm, '交通警察支队' zzjgmc,gxsj update_time, sbmc police_name,byzd4 police_no,1 valid from bas_device
<where> <where>
byzd4 is not null AND tmp_ly_gbt28181 is not null
<if test="updateTime != null "> and gxsj >= #{updateTime}</if> <if test="updateTime != null "> and gxsj >= #{updateTime}</if>
</where> </where>
order by gxsj desc order by gxsj desc

View File

@ -139,6 +139,7 @@ public class TDeviceServiceImpl implements ITDeviceService {
LambdaQueryWrapper<TDevice> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TDevice> lqw = new LambdaQueryWrapper<>();
lqw.inSql(TDevice::getDeviceType,"'5','7','8'"); lqw.inSql(TDevice::getDeviceType,"'5','7','8'");
lqw.eq(TDevice::getValid,"1"); lqw.eq(TDevice::getValid,"1");
lqw.ne(TDevice::getZzjgdm,"341300250000");
lqw.le(TDevice::getUpdateTime,DateUtil.offsetDay(new Date(),Integer.getInteger(day))); lqw.le(TDevice::getUpdateTime,DateUtil.offsetDay(new Date(),Integer.getInteger(day)));
List<TDevice> list = baseMapper.selectList(lqw); List<TDevice> list = baseMapper.selectList(lqw);
for (TDevice device : list) { for (TDevice device : list) {

View File

@ -58,7 +58,7 @@ public class DeviceSchedule {
lqw.gt(OriginDevice::getUpdateTime,lastUpdateTime); lqw.gt(OriginDevice::getUpdateTime,lastUpdateTime);
lqw.orderByDesc(OriginDevice::getUpdateTime); lqw.orderByDesc(OriginDevice::getUpdateTime);
lqw.eq(OriginDevice::getResType,1); lqw.eq(OriginDevice::getResType,1);
lqw.likeRight(OriginDevice::getParentId,"341371");
lqw.ne(OriginDevice::getNickname,"BroadcastChannel"); lqw.ne(OriginDevice::getNickname,"BroadcastChannel");
List<OriginDevice> originDevices = originDeviceMapper.selectList(lqw); List<OriginDevice> originDevices = originDeviceMapper.selectList(lqw);
@ -73,7 +73,7 @@ public class DeviceSchedule {
String deviceCode = originDevice.getChanPubID(); String deviceCode = originDevice.getChanPubID();
if(StringUtils.isNotBlank(deviceCode)){ if(StringUtils.isNotBlank(deviceCode)){
newDevice.setDeviceCode(deviceCode); newDevice.setDeviceCode(deviceCode);
if (originDevice.getNickname().contains("皖")){ if (originDevice.getNickname().contains("皖L")){
newDevice.setDeviceType("8"); newDevice.setDeviceType("8");
}else if(originDevice.getNickname().contains("布控球")) { }else if(originDevice.getNickname().contains("布控球")) {
newDevice.setDeviceType("7"); newDevice.setDeviceType("7");