1、广西交科推送数据增加设备经纬度
This commit is contained in:
parent
e8861d16e0
commit
3d766c4b18
@ -0,0 +1,50 @@
|
||||
package com.imdroid.secapi.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* GNSS设备配置数据
|
||||
*
|
||||
* @author LiGang
|
||||
*/
|
||||
@Data
|
||||
public class GnssDeviceJoin {
|
||||
private Long id;
|
||||
private Integer tenantid;
|
||||
private Short opmode;
|
||||
private LocalDateTime createtime;
|
||||
private String createuser;
|
||||
private LocalDateTime updatetime;
|
||||
private String updateuser;
|
||||
private String deviceid;
|
||||
private String fwddeviceid; //推送的设备名
|
||||
private String name;
|
||||
private String parentid;
|
||||
private Integer devicetype;
|
||||
private String tenantname;
|
||||
private String project_id;
|
||||
private String project2_id;
|
||||
private Integer group_id = 1; //组参数,缓存自动下发
|
||||
private Integer calc_group_id = 1;
|
||||
private String fwd_group_id;
|
||||
private String fwd_group_id2;
|
||||
private Boolean syn; //组参数是否同步
|
||||
private String pictures;
|
||||
private Double ipose; //初始位置
|
||||
private Double iposn; //初始位置
|
||||
private Double iposd; //初始位置
|
||||
|
||||
private Double ecefx;
|
||||
private Double ecefy;
|
||||
private Double ecefz;
|
||||
|
||||
private String sector;//桩号
|
||||
private String appver;
|
||||
private String imei;
|
||||
private Short model;
|
||||
|
||||
Double latitude;
|
||||
Double longitude;
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
package com.imdroid.secapi.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
public interface GnssDeviceMapper extends BaseMapper<GnssDevice> {
|
||||
public interface GnssDeviceMapper extends MPJBaseMapper<GnssDevice> {
|
||||
@Select({"select * from gnssdevices where deviceid = #{deviceId} limit 1"})
|
||||
GnssDevice queryByDeviceId(String deviceId);
|
||||
|
||||
|
||||
@ -22,15 +22,15 @@ public class GXJKData {
|
||||
|
||||
private String Devtype;
|
||||
|
||||
private String DevLng = "0";//设备经度
|
||||
private Double DevLng;//设备经度
|
||||
|
||||
private String DevLat = "0";
|
||||
private Double DevLat;
|
||||
|
||||
private double x;
|
||||
private Double x;
|
||||
|
||||
private double y;
|
||||
private Double y;
|
||||
|
||||
private double z;
|
||||
private Double z;
|
||||
|
||||
private String DataTime;
|
||||
|
||||
@ -38,7 +38,7 @@ public class GXJKData {
|
||||
|
||||
}
|
||||
|
||||
public Data(String devNum, String devtype, String devLng, String devLat, double x, double y, double z, String dataTime) {
|
||||
public Data(String devNum, String devtype, Double devLng, Double devLat, Double x, Double y, Double z, String dataTime) {
|
||||
DevNum = devNum;
|
||||
Devtype = devtype;
|
||||
DevLng = devLng;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.imdroid.beidou_fwd.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.imdroid.common.util.ThreadManager;
|
||||
import com.imdroid.secapi.dto.*;
|
||||
import org.slf4j.Logger;
|
||||
@ -94,7 +95,7 @@ public class Forwarder {
|
||||
String beginTime = sendTime.minusMinutes(fwdCycleMinutes).format(formatter);
|
||||
|
||||
// 查找属于指定推送组的设备列表
|
||||
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||
/* QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||
if(deviceId != null){
|
||||
queryWrapper.eq("deviceid", deviceId);
|
||||
}
|
||||
@ -102,6 +103,16 @@ public class Forwarder {
|
||||
.or()
|
||||
.eq("fwd_group_id2", fwdGroupId);
|
||||
List<GnssDevice> gnssDeviceList = deviceMapper.selectList(queryWrapper);
|
||||
*/
|
||||
MPJQueryWrapper jquery = new MPJQueryWrapper<GnssDevice> ()
|
||||
.selectAll(GnssDevice.class)
|
||||
.select("d.latitude as latitude")
|
||||
.select("d.longitude as longitude")
|
||||
.leftJoin("gnssstatus d on t.deviceid = d.deviceid")
|
||||
.eq("fwd_group_id", fwdGroupId)
|
||||
.or()
|
||||
.eq("fwd_group_id2", fwdGroupId);
|
||||
List<GnssDeviceJoin> gnssDeviceList = deviceMapper.selectJoinList(GnssDeviceJoin.class, jquery);
|
||||
|
||||
// 查询最近半小时的GNSS记录
|
||||
QueryWrapper<GnssCalcData> gnssQueryWrapper = new QueryWrapper<>();
|
||||
@ -118,7 +129,7 @@ public class Forwarder {
|
||||
|
||||
// 构造按项目id分类的GNSS记录
|
||||
ConcurrentHashMap<String, List<GnssCalcData>> projects = new ConcurrentHashMap<>();
|
||||
for(GnssDevice device:gnssDeviceList){
|
||||
for(GnssDeviceJoin device:gnssDeviceList){
|
||||
if(device.getOpmode() != GnssDevice.OP_MODE_USE) continue;
|
||||
String projectId = device.getProject_id();
|
||||
if(device.getProject2_id()!=null && !device.getProject2_id().isBlank()) {
|
||||
@ -159,6 +170,10 @@ public class Forwarder {
|
||||
record.setDeviceid(devName);
|
||||
}
|
||||
}
|
||||
// 用r9250来传设备经纬度
|
||||
record.setR9250e(device.getLongitude());
|
||||
record.setR9250n(device.getLatitude());
|
||||
// 用aux来传基站经纬度
|
||||
recordsToSend.add(record);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public class GXJKForwarder extends Forwarder {
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
*/
|
||||
@Scheduled(cron = "0 0/60 * * * ?") // 每30分钟执行一次
|
||||
@Scheduled(cron = "0 0 0/1 * * ?") // 每30分钟执行一次
|
||||
private void forwardGnss() {
|
||||
logger.info("gxjk forwardGnss");
|
||||
forwardCurrentGnss();
|
||||
@ -70,6 +70,9 @@ public class GXJKForwarder extends Forwarder {
|
||||
data.setX(NumberUtils.scale(locationRecord.getRpose() * 0.001, 5));
|
||||
data.setY(NumberUtils.scale(locationRecord.getRposn() * 0.001, 5));
|
||||
data.setZ(NumberUtils.scale(locationRecord.getRposd() * 0.001, 5));
|
||||
// 经纬度
|
||||
data.setDevLng(locationRecord.getB562e());
|
||||
data.setDevLat(locationRecord.getB562n());
|
||||
sendNum++;
|
||||
}
|
||||
String json = "#" + GsonUtil.toJson(sendData) + "!";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user