1、统计列表增加固定解浮点解

2、增加算法3,用于博通测试
3、组参数增加说明
4、删除原始数据表
This commit is contained in:
weidong 2024-05-02 13:11:16 +08:00
parent 730e1483c9
commit 6da8c91105
33 changed files with 218 additions and 326 deletions

View File

@ -1,13 +1,9 @@
package com.imdroid.secapi.dto; package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.sql.Timestamp;
@Mapper @Mapper
public interface FwdRecordMapper extends BaseMapper<FwdRecord> { public interface FwdRecordMapper extends BaseMapper<FwdRecord> {
@Delete({"delete from fwdrecords where createtime <= #{t}"})
int deleteTimeBefore(Timestamp t);
} }

View File

@ -18,6 +18,7 @@ public class GnssGroup implements Serializable {
public final static short NORMAL_POWER_MODE = 1; public final static short NORMAL_POWER_MODE = 1;
Integer id; Integer id;
String name;
Integer work_cycle; Integer work_cycle;
Integer active_time; Integer active_time;
Integer active_offset; Integer active_offset;

View File

@ -7,6 +7,7 @@ import lombok.Data;
@TableName(value = "gnssgroupcalc") @TableName(value = "gnssgroupcalc")
public class GnssGroupCalc { public class GnssGroupCalc {
Integer id; Integer id;
String name;
Integer filter_hour; Integer filter_hour;
Float xy_threshold; Float xy_threshold;
Float z_threshold; Float z_threshold;

View File

@ -1,14 +1,9 @@
package com.imdroid.secapi.dto; package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.sql.Timestamp;
@Mapper @Mapper
public interface GnssMsgMapper extends BaseMapper<GnssMsg> { public interface GnssMsgMapper extends BaseMapper<GnssMsg> {
@Delete({"delete from gnssmsg where createtime <= #{t}"})
int deleteTimeBefore(Timestamp t);
} }

View File

@ -1,31 +0,0 @@
package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
/**
* GNSS解算结果每个工作周期解算一次
*
* @author LiGang
*/
@Data
@TableName(value = "gnssrawdata")
public class GnssRawData {
@TableId(value = "id", type = IdType.AUTO)
Long id;
Integer tenantid;
LocalDateTime createtime;
String deviceid;
Double b562e;
Double b562n;
Double b562d;
Double roll;
Double pitch;
Double yaw;
Double shock;
}

View File

@ -1,13 +0,0 @@
package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import java.sql.Timestamp;
@Mapper
public interface GnssRawDataMapper extends BaseMapper<GnssRawData> {
@Delete({"delete from gnssrawdata where createtime <= #{t}"})
int deleteTimeBefore(Timestamp t);
}

View File

@ -1,14 +1,10 @@
package com.imdroid.secapi.dto; package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.sql.Timestamp;
@Mapper @Mapper
public interface GnssStatusMsgMapper extends BaseMapper<GnssStatusMsg> { public interface GnssStatusMsgMapper extends BaseMapper<GnssStatusMsg> {
@Delete({"delete from gnssstatusmsg where createtime <= #{t}"})
int deleteTimeBefore(Timestamp t);
} }

View File

@ -61,4 +61,10 @@ public class GnssTrxMsg {
Integer d3xxbytes; Integer d3xxbytes;
@ExcelProperty("使用卫星数") @ExcelProperty("使用卫星数")
Integer satelliteinuse; Integer satelliteinuse;
@ExcelProperty("固定解")
Integer fixnum;
@ExcelProperty("浮点解")
Integer floatnum;
} }

View File

@ -1,14 +1,10 @@
package com.imdroid.secapi.dto; package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.sql.Timestamp;
@Mapper @Mapper
public interface GnssTrxMsgMapper extends BaseMapper<GnssTrxMsg> { public interface GnssTrxMsgMapper extends BaseMapper<GnssTrxMsg> {
@Delete({"delete from gnsstrxmsg where createtime <= #{t}"})
int deleteTimeBefore(Timestamp t);
} }

View File

@ -1,13 +1,10 @@
package com.imdroid.secapi.dto; package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.sql.Timestamp;
@Mapper @Mapper
public interface ResendRecordMapper extends BaseMapper<ResendRecord> { public interface ResendRecordMapper extends BaseMapper<ResendRecord> {
@Delete({"delete from resendrecords where createtime <= #{t}"})
int deleteTimeBefore(Timestamp t);
} }

View File

@ -10,6 +10,7 @@ public interface FocusCalculator {
void addXyz(double[] xyz, LocalDateTime dataTime); void addXyz(double[] xyz, LocalDateTime dataTime);
void addTilt(Tilt tilt); void addTilt(Tilt tilt);
void addDelayMs(int ms); void addDelayMs(int ms);
void addGGA(Gga gga);
// 解算b562位置惯导位置融合位置 // 解算b562位置惯导位置融合位置
void setReferPoint(double[] point); void setReferPoint(double[] point);

View File

@ -381,6 +381,12 @@ public class FocusCalculator1 implements FocusCalculator{
delay_ms += ms; delay_ms += ms;
delay_counter ++; delay_counter ++;
} }
@Override
public void addGGA(Gga gga) {
}
@Override @Override
public int getAvgDelayMs(){ public int getAvgDelayMs(){
if(delay_counter==0) return -1; if(delay_counter==0) return -1;

View File

@ -22,21 +22,21 @@ public class FocusCalculator2 extends FocusCalculator1{
int originalReferPointFlag= INIT_REFER_POINT_NOT_SET; // 0:not set; 1:in use; 2:expired int originalReferPointFlag= INIT_REFER_POINT_NOT_SET; // 0:not set; 1:in use; 2:expired
LocalDateTime originalReferPointTime; LocalDateTime originalReferPointTime;
class EComparator implements Comparator<double[]>{ static class EComparator implements Comparator<double[]>{
@Override @Override
public int compare(double[] point1, double[] point2) { public int compare(double[] point1, double[] point2) {
return (int) ((point1[0] - point2[0])*100); return (int) ((point1[0] - point2[0])*100);
} }
} }
class NComparator implements Comparator<double[]>{ static class NComparator implements Comparator<double[]>{
@Override @Override
public int compare(double[] point1, double[] point2) { public int compare(double[] point1, double[] point2) {
return (int) ((point1[1] - point2[1])*100); return (int) ((point1[1] - point2[1])*100);
} }
} }
class DComparator implements Comparator<double[]>{ static class DComparator implements Comparator<double[]>{
@Override @Override
public int compare(double[] point1, double[] point2) { public int compare(double[] point1, double[] point2) {
return (int) ((point1[2] - point2[2])*100); return (int) ((point1[2] - point2[2])*100);
@ -89,6 +89,7 @@ public class FocusCalculator2 extends FocusCalculator1{
return sum/(end-begin); return sum/(end-begin);
} }
@Override
public double[] resultB562(){ public double[] resultB562(){
// 把本轮的固定解添加到pointList一起解算 // 把本轮的固定解添加到pointList一起解算
if(counterFixedResult<30) return null; if(counterFixedResult<30) return null;

View File

@ -0,0 +1,88 @@
package com.imdroid.sideslope.bd;
import java.time.LocalDateTime;
import java.util.*;
/**
* 博通用GGA绝对坐标代替相对位置
*/
public class FocusCalculator3 extends FocusCalculator1{
final static long scale = 100000000L;//地球1°111km放大到mm乘以100,000,000
static class EComparator implements Comparator<double[]>{
@Override
public int compare(double[] point1, double[] point2) {
return (int) ((point1[0] - point2[0])*100);
}
}
static class NComparator implements Comparator<double[]>{
@Override
public int compare(double[] point1, double[] point2) {
return (int) ((point1[1] - point2[1])*100);
}
}
static class DComparator implements Comparator<double[]>{
@Override
public int compare(double[] point1, double[] point2) {
return (int) ((point1[2] - point2[2])*100);
}
}
@Override
public void addGGA(Gga gga) {
if(gga == null) return;
double[] xyz = new double[]{gga.getLongitude()*scale, gga.getLatitude()*scale, gga.getAltitude()*1000, gga.getQuality()};
if(gga.getQuality() == 4) {
counterFixedResult++;
pointList.add(xyz);
}
else if(gga.getQuality() == 5) counterNoFixed++;
else counterNoB562 ++;
}
/**
* 加入pointList
* @param xyz
*/
@Override
public void addXyz(double[] xyz, LocalDateTime dataTime){
}
double calcGravity(List<double[]> list , int index){
double sum = 0;
int begin = (int) (list.size() * 0.25);
int end = (int) (list.size() * 0.75);
if(end-begin == 0) return 0;
for(int i=begin; i<end; i++){
sum += list.get(i)[index];
}
return sum/(end-begin);
}
@Override
public double[] resultB562(){
if(pointList.size() >= 3){
Collections.sort(pointList, new EComparator());
double e = calcGravity(pointList,0);
Collections.sort(pointList, new NComparator());
double n = calcGravity(pointList,1);
Collections.sort(pointList, new DComparator());
double d = calcGravity(pointList,2);
return new double[]{e,n,d};
}
return null;
}
@Override
public int getVer() {
return 3;
}
}

View File

@ -42,7 +42,7 @@ public class UBXUtil {
return new double[]{relPosE*10,relPosN*10,relPosD*10,FLOAT_RESULT}; return new double[]{relPosE*10,relPosN*10,relPosD*10,FLOAT_RESULT};
} }
else{ else{
return new double[]{0,0,0,FLOAT_RESULT}; return new double[]{0,0,0,NO_B562};
} }
} }
} }

View File

@ -12,9 +12,8 @@ public interface GNSSDataCalcService {
* *
* @param message GNSS数据 * @param message GNSS数据
* @param completeWhenIdle 是否根据空闲时间判断本轮结束 * @param completeWhenIdle 是否根据空闲时间判断本轮结束
* @return x,y,z三轴数据
*/ */
double[] calcSingle(D341LocationMessage message, boolean completeWhenIdle); void calcSingle(D341LocationMessage message, boolean completeWhenIdle);
/** /**
* 单轮解算结束计算平滑值 * 单轮解算结束计算平滑值

View File

@ -64,21 +64,23 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
* 处理本轮的固定解求出重心位置多线程调用访问成员变量要考虑多线程安全 * 处理本轮的固定解求出重心位置多线程调用访问成员变量要考虑多线程安全
* @param message d341报文 * @param message d341报文
* @param completeWhenIdle 是否根据空闲时间判断本轮结束是则启动30s定时器否则需显示调用SingleDone函数 * @param completeWhenIdle 是否根据空闲时间判断本轮结束是则启动30s定时器否则需显示调用SingleDone函数
* @return
*/ */
@Override @Override
public double[] calcSingle(D341LocationMessage message, boolean completeWhenIdle) { public void calcSingle(D341LocationMessage message, boolean completeWhenIdle) {
String deviceId = message.getId(); String deviceId = message.getId();
Device device = deviceService.findByDeviceId(deviceId); Device device = deviceService.findByDeviceId(deviceId);
if(device == null) return null; if(device == null) return;
GnssGroupCalc groupCalc = getGroupCalc(device.getCalcGroupId()); GnssGroupCalc groupCalc = getGroupCalc(device.getCalcGroupId());
if(completeWhenIdle) resultOutputTimer(device, groupCalc, message.getCreateTime()); if(completeWhenIdle) resultOutputTimer(device, groupCalc, message.getCreateTime());
//todo 创建FocusCalculator对象需获取该测站的杆长度上一小时的Tilt平均值上一小时的测站相对坐标融合值ekfResult //todo 创建FocusCalculator对象需获取该测站的杆长度上一小时的Tilt平均值上一小时的测站相对坐标融合值ekfResult
FocusCalculator focusCalculator; FocusCalculator focusCalculator;
if(groupCalc!=null && groupCalc.getVer() == 2){ if(groupCalc!=null && groupCalc.getVer() == 3){
focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator3());
}
else if(groupCalc!=null && groupCalc.getVer() == 2){
focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator2()); focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator2());
} }
else { else {
@ -101,7 +103,16 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("测站" + deviceId + "的b562单次解析结果:{}", Arrays.toString(doubles)); logger.debug("测站" + deviceId + "的b562单次解析结果:{}", Arrays.toString(doubles));
} }
return doubles;
// 单次GGA
Gga gga = message.getGga();
if(gga != null) {
focusCalculator.addGGA(message.getGga());
if (logger.isDebugEnabled()) {
logger.debug("测站" + deviceId + "的gga单次解析结果:{},{},{},{}",
gga.getLongitude(), gga.getLatitude(), gga.getAltitude(), gga.getQuality());
}
}
} }
@Override @Override
@ -202,7 +213,7 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
// 记录本次位置作为下次的参考 // 记录本次位置作为下次的参考
// 算法1以上轮位置作为参考跟随变化速度快 // 算法1以上轮位置作为参考跟随变化速度快
// 算法2以滤波后的位置作为参考跟随变化速度慢如果倾角大于某一门限则跟随上轮位置 // 算法2以滤波后的位置作为参考跟随变化速度慢如果倾角大于某一门限则跟随上轮位置
if(focusCalculator.getVer()==1 || focusCalculator.isShocked()) { if(focusCalculator.getVer()==1 || focusCalculator.getVer()==3 || focusCalculator.isShocked()) {
focusCalculator.setReferPoint(b562Result); focusCalculator.setReferPoint(b562Result);
} }
else { else {

View File

@ -41,6 +41,9 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
if(device == null) return null; if(device == null) return null;
message.setTenantId(device.getTenantId()); message.setTenantId(device.getTenantId());
device.updateRx(message.getHeader(), message.getLen(), 1); device.updateRx(message.getHeader(), message.getLen(), 1);
double[] pos = message.getB562_loc();
device.updateB562Quality((int) pos[3]);
Gga gga = message.getGga(); Gga gga = message.getGga();
if(gga != null) { if(gga != null) {
device.updateSatelitesNum(gga.getSatellitesInUsed()); device.updateSatelitesNum(gga.getSatellitesInUsed());

View File

@ -54,6 +54,8 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes()); gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
gnssTrxMsg.setB562bytes(device.getD341bytes()); gnssTrxMsg.setB562bytes(device.getD341bytes());
gnssTrxMsg.setSatelliteinuse(device.getSatelitesInUse()); gnssTrxMsg.setSatelliteinuse(device.getSatelitesInUse());
gnssTrxMsg.setFixnum(device.getFixedNum());
gnssTrxMsg.setFloatnum(device.getFloatNum());
// 储设备收发字节数统计信息 // 储设备收发字节数统计信息
ThreadManager.getFixedThreadPool().submit(() -> { ThreadManager.getFixedThreadPool().submit(() -> {

View File

@ -93,12 +93,7 @@ public class DataPersistServiceImpl implements DataPersistService {
// 添加到trxmsg里 // 添加到trxmsg里
GnssTrxMsg trxMsg = message.getTrxMsg(); GnssTrxMsg trxMsg = message.getTrxMsg();
trxMsgMapper.insert(trxMsg); trxMsgMapper.insert(trxMsg);
if(device.getDeviceType() == GnssDevice.TYPE_ROVER) { saveMsg(message, message.getOtherInfo());
saveMsg(message, "d341 num: "+device.getD341Count()+","+message.getOtherInfo());
}
else{
saveMsg(message, "d331 num: "+device.getD3xxCount()+","+message.getOtherInfo());
}
// 检测该对象是否已存在 // 检测该对象是否已存在
GnssStatus deviceState = deviceStateRepository.getByDeviceId(message.getId()); GnssStatus deviceState = deviceStateRepository.getByDeviceId(message.getId());

View File

@ -66,7 +66,7 @@ public class GnssGroupController extends BasicController {
GnssGroup oldGroup = gnssGroupMapper.selectById(group.getId()); GnssGroup oldGroup = gnssGroupMapper.selectById(group.getId());
// no changed // no changed
if(oldGroup != null && oldGroup.equals(group)) return HttpResult.ok(); //if(oldGroup != null && oldGroup.equals(group)) return HttpResult.ok();
if(null != oldGroup) { if(null != oldGroup) {
num = gnssGroupMapper.updateById(group); num = gnssGroupMapper.updateById(group);

View File

@ -1,67 +0,0 @@
package com.imdroid.beidou.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.imdroid.beidou.entity.Tenant;
import com.imdroid.secapi.dto.GnssRawData;
import com.imdroid.secapi.dto.GnssRawDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
@Controller
public class GnssRawDataController extends BasicController{
@Autowired
GnssRawDataMapper dataMapper;
@RequestMapping("/page/gnss_data_raw")
public String gnssDataRaw(Model m, HttpSession session) {
initModel(m, session);
return "/page/gnss_data_raw";
}
/**** 推送数据 *****/
@RequestMapping("/gnss/data/list_raw")
@ResponseBody
public JSONObject list(HttpSession session, int page, int limit, String searchParams) {
Page<GnssRawData> pageable = new Page<>(page, limit);
QueryWrapper<GnssRawData> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("createtime");
Integer tenantId = getTenantId(session);
if(tenantId != null && tenantId != Tenant.SAAS_PROVIDER_ID) {
queryWrapper.eq("tenantid", tenantId);
}
// 条件查询
if(searchParams != null) {
JSONObject search = (JSONObject) JSONObject.parse(searchParams);
//设备号
String deviceid = search.getString("deviceid");
if (!StringUtils.isEmpty(deviceid)) {
queryWrapper.like("deviceid", deviceid);
}
//时间范围
String q_start = search.getString("q_start");
if (!StringUtils.isEmpty(q_start)) {
queryWrapper.ge("createtime", q_start);
}
String q_end = search.getString("q_end");
if (!StringUtils.isEmpty(q_end)) {
queryWrapper.le("createtime", q_end+" 23:59:59");
}
}
IPage<GnssRawData> cs = dataMapper.selectPage(pageable, queryWrapper);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 0);
jsonObject.put("msg", "");
jsonObject.put("count", cs.getTotal());
jsonObject.put("data", cs.getRecords());
return jsonObject;
}
}

View File

@ -38,6 +38,7 @@ public class IndexController extends BasicController{
int warning1Num=0;//一般告警 int warning1Num=0;//一般告警
int warning2Num=0;//严重告警 int warning2Num=0;//严重告警
int noGGA = 0; int noGGA = 0;
int noFix = 0;
List<GnssStatusJoin> deviceList; List<GnssStatusJoin> deviceList;
if(tenantId == Tenant.SAAS_PROVIDER_ID){ if(tenantId == Tenant.SAAS_PROVIDER_ID){
@ -53,6 +54,8 @@ public class IndexController extends BasicController{
while(iterator.hasNext()){ while(iterator.hasNext()){
GnssStatusJoin status=iterator.next(); GnssStatusJoin status=iterator.next();
if(status.getState() == GnssStatus.STATE_OFFLINE) deviceOfflineNum++; if(status.getState() == GnssStatus.STATE_OFFLINE) deviceOfflineNum++;
if((status.getWarningcode()&WarningCfg.TYPE_NO_FIXED_RESULT) != 0) noFix++;
if(status.getWarning() == WarningCfg.LEVEL_1) warning1Num++; if(status.getWarning() == WarningCfg.LEVEL_1) warning1Num++;
else if(status.getWarning() == WarningCfg.LEVEL_2) warning2Num++; else if(status.getWarning() == WarningCfg.LEVEL_2) warning2Num++;
@ -81,6 +84,7 @@ public class IndexController extends BasicController{
m.addAttribute("warning2Num", warning2Num); m.addAttribute("warning2Num", warning2Num);
m.addAttribute("warningTotalNum", warning1Num+warning2Num); m.addAttribute("warningTotalNum", warning1Num+warning2Num);
m.addAttribute("noGGA", noGGA); m.addAttribute("noGGA", noGGA);
m.addAttribute("noFix", noFix);
m.addAttribute("deviceList", deviceList); m.addAttribute("deviceList", deviceList);
return "/page/device_overview"; return "/page/device_overview";

View File

@ -1,5 +1,6 @@
package com.imdroid.beidou.task; package com.imdroid.beidou.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.imdroid.secapi.dto.*; import com.imdroid.secapi.dto.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -7,7 +8,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import java.sql.Timestamp; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/*** /***
* 定时任务 * 定时任务
@ -22,19 +24,22 @@ import java.sql.Timestamp;
@Configuration @Configuration
@EnableScheduling @EnableScheduling
public class DatasetCleaner { public class DatasetCleaner {
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Autowired @Autowired
GnssMsgMapper gnssMsgMapper; GnssMsgMapper gnssMsgMapper;
@Autowired @Autowired
GnssStatusMsgMapper statusMsgMapper; GnssStatusMsgMapper statusMsgMapper;
@Autowired @Autowired
GnssTrxMsgMapper trxMsgMapper; GnssTrxMsgMapper trxMsgMapper;
@Autowired @Autowired
GnssRawDataMapper rawDataMapper;
@Autowired
ResendRecordMapper resendRecordMapper; ResendRecordMapper resendRecordMapper;
@Autowired @Autowired
FwdRecordMapper fwdRecordMapper; FwdRecordMapper fwdRecordMapper;
@Autowired
GnssCalcDataMapper calcDataMapper;
//cron表达式格式 //cron表达式格式
//{秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)} //{秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
@ -43,44 +48,52 @@ public class DatasetCleaner {
//@Scheduled(cron = "*/5 * * * * ?") // 每5秒执行一次 //@Scheduled(cron = "*/5 * * * * ?") // 每5秒执行一次
public void dayTask() { public void dayTask() {
checkMsgDataset(); checkMsgDataset();
checkRawDataset();
checkFwdDataset(); checkFwdDataset();
checkStatusDataset(); checkStatusDataset();
checkGnssDataDataset();
} }
void checkMsgDataset(){ void checkMsgDataset(){
long before = System.currentTimeMillis() - long before = 30;
(long)30 * 24 * 3600 * 1000; QueryWrapper<GnssMsg> queryWrapper = new QueryWrapper<>();
Timestamp t = new Timestamp(before); queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
int count = gnssMsgMapper.deleteTimeBefore(t); int count = gnssMsgMapper.delete(queryWrapper);
log.info("clean msg dataset num: "+count); log.info("clean msg dataset num: "+count);
} }
void checkGnssDataDataset(){
long before = 180;
QueryWrapper<GnssCalcData> queryWrapper = new QueryWrapper<>();
queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
int count = calcDataMapper.delete(queryWrapper);
log.info("clean gnss dataset num: "+count);
}
void checkStatusDataset(){ void checkStatusDataset(){
long before = System.currentTimeMillis() - long before = 90;
(long)90 * 24 * 3600 * 1000;
Timestamp t = new Timestamp(before); QueryWrapper<GnssStatusMsg> queryWrapper = new QueryWrapper<>();
int count = statusMsgMapper.deleteTimeBefore(t); queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
int count = statusMsgMapper.delete(queryWrapper);
log.info("clean status msg dataset num: "+count); log.info("clean status msg dataset num: "+count);
count = trxMsgMapper.deleteTimeBefore(t);
QueryWrapper<GnssTrxMsg> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
count = trxMsgMapper.delete(queryWrapper1);
log.info("clean trx msg dataset num: "+count); log.info("clean trx msg dataset num: "+count);
} }
void checkRawDataset(){
long before = System.currentTimeMillis() -
(long)30 * 24 * 3600 * 1000;
Timestamp t = new Timestamp(before);
int count = rawDataMapper.deleteTimeBefore(t);
log.info("clean raw dataset num: "+count);
}
void checkFwdDataset(){ void checkFwdDataset(){
long before = System.currentTimeMillis() - long before = 180;
(long)180 * 24 * 3600 * 1000;
Timestamp t = new Timestamp(before); QueryWrapper<FwdRecord> queryWrapper = new QueryWrapper<>();
int count = fwdRecordMapper.deleteTimeBefore(t); queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
int count = fwdRecordMapper.delete(queryWrapper);
log.info("clean fwd dataset num: "+count); log.info("clean fwd dataset num: "+count);
count = resendRecordMapper.deleteTimeBefore(t);
QueryWrapper<ResendRecord> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
count = resendRecordMapper.delete(queryWrapper1);
log.info("clean resend dataset num: "+count); log.info("clean resend dataset num: "+count);
} }
} }

View File

@ -65,6 +65,7 @@ CREATE TABLE IF NOT EXISTS `gnssdevices` (
CREATE TABLE IF NOT EXISTS `gnssgroup` ( CREATE TABLE IF NOT EXISTS `gnssgroup` (
`id` int NOT NULL, `id` int NOT NULL,
`name` varchar(64) DEFAULT NULL,
`work_cycle` int DEFAULT 30, `work_cycle` int DEFAULT 30,
`active_time` int DEFAULT 6, `active_time` int DEFAULT 6,
`active_offset` int DEFAULT 0, `active_offset` int DEFAULT 0,
@ -76,6 +77,7 @@ CREATE TABLE IF NOT EXISTS `gnssgroup` (
CREATE TABLE IF NOT EXISTS `gnssgroupcalc` ( CREATE TABLE IF NOT EXISTS `gnssgroupcalc` (
`id` int NOT NULL, `id` int NOT NULL,
`name` varchar(64) DEFAULT NULL,
`filter_hour` int DEFAULT NULL COMMENT '平滑窗口', `filter_hour` int DEFAULT NULL COMMENT '平滑窗口',
`xy_threshold` float DEFAULT NULL COMMENT '坏点水平门限', `xy_threshold` float DEFAULT NULL COMMENT '坏点水平门限',
`z_threshold` float DEFAULT NULL COMMENT '坏点垂直门限', `z_threshold` float DEFAULT NULL COMMENT '坏点垂直门限',
@ -158,21 +160,6 @@ CREATE TABLE IF NOT EXISTS `gnssdevicelocationrecords` (
KEY `idx_deviceid_time` (`deviceid`,`createtime`) USING BTREE KEY `idx_deviceid_time` (`deviceid`,`createtime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gnssrawdata` (
`id` bigint AUTO_INCREMENT,
`tenantid` int NOT NULL,
`createtime` datetime DEFAULT NULL,
`deviceid` varchar(20) CHARACTER SET utf8 NOT NULL,
`b562e` double DEFAULT NULL COMMENT '原始北斗位置东E',
`b562n` double DEFAULT NULL COMMENT '原始北斗位置北N',
`b562d` double DEFAULT NULL COMMENT '原始北斗位置天D',
`roll` double DEFAULT NULL,
`pitch` double DEFAULT NULL,
`yaw` double DEFAULT NULL,
`shock` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gnssmsg` ( CREATE TABLE IF NOT EXISTS `gnssmsg` (
`id` bigint AUTO_INCREMENT, `id` bigint AUTO_INCREMENT,
`tenantid` int NOT NULL, `tenantid` int NOT NULL,
@ -217,6 +204,8 @@ CREATE TABLE IF NOT EXISTS `gnsstrxmsg` (
`b562bytes` int DEFAULT NULL, `b562bytes` int DEFAULT NULL,
`d3xxbytes` int DEFAULT NULL, `d3xxbytes` int DEFAULT NULL,
`satelliteinuse` int DEFAULT 0, `satelliteinuse` int DEFAULT 0,
`fixnum` int DEFAULT NULL,
`floatnum` int DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -78,7 +78,7 @@
</div> </div>
<div class="layui-col-xs3 layui-col-md4"> <div class="layui-col-xs3 layui-col-md4">
掉线数 <a style="color: #bd3004" th:text="${deviceOfflineNum}">0</a><br> 掉线数 <a style="color: #bd3004" th:text="${deviceOfflineNum}">0</a><br>
<div th:if="${noGGA>0}">无GGA <a style="color: #e7be1d" th:text="${noGGA}">0</a><br></div> <div th:if="${noFix>0}">长期无解 <a style="color: #bd3004" th:text="${noFix}">0</a><br></div>
装机量 <a style="color: #000000" th:text="${deviceDeployedNum}">2020</a> 装机量 <a style="color: #000000" th:text="${deviceDeployedNum}">2020</a>
</div> </div>
</div> </div>
@ -96,6 +96,7 @@
<div class="layui-col-xs3 layui-col-md4"> <div class="layui-col-xs3 layui-col-md4">
严重 <a style="color: #bd3004" th:text="${warning2Num}">5</a><br> 严重 <a style="color: #bd3004" th:text="${warning2Num}">5</a><br>
一般 <a style="color: #f6c102" th:text="${warning1Num}">20</a> 一般 <a style="color: #f6c102" th:text="${warning1Num}">20</a>
<div th:if="${noGGA>0}">无GGA <a style="color: #e7be1d" th:text="${noGGA}">0</a><br></div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,123 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>原始数据</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
<link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
<div class="layuimini-main">
<fieldset class="table-search-fieldset">
<legend>搜索信息</legend>
<div style="margin: 10px 10px 10px 10px">
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">设备号</label>
<div class="layui-input-inline">
<input type="text" name="deviceid" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">范围</label>
<div class="layui-input-inline">
<input type="text" name="q_start" autocomplete="off" id="ID-laydate-start-date" class="layui-input" placeholder="开始日期">
</div>
<div class="layui-input-inline">
<input type="text" name="q_end" autocomplete="off" id="ID-laydate-end-date" class="layui-input" placeholder="结束日期">
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
</div>
</div>
</form>
</div>
</fieldset>
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
<script type="text/html" id="currentTableBar">
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="cmd">命令行</a>
</script>
</div>
</div>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script th:inline="none">
layui.use(['form', 'table','laydate','element'], function () {
var form = layui.form,
table = layui.table,
laydate = layui.laydate;
/**
* 初始化表单,要加上,不然刷新部分组件可能会不加载
*/
form.render();
laydate.render({
elem: '#ID-laydate-start-date',
type: 'datetime'
});
laydate.render({
elem: '#ID-laydate-end-date',
type: 'datetime'
});
table.render({
elem: '#currentTableId',
url: '/gnss/data/list_raw',
defaultToolbar: ['filter', 'exports', 'print', {
title: '提示',
layEvent: 'LAYTABLE_TIPS',
icon: 'layui-icon-tips'
}],
cols: [[
{field: 'deviceid', title: '设备号'},
{field: 'createtime', title: '上报时间', templet: "<div>{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
{field: 'b562e', title: '原始东'},
{field: 'b562n', title: '原始北'},
{field: 'b562d', title: '原始天'},
{field: 'roll', title: 'roll'},
{field: 'pitch', title: 'pitch'},
{field: 'yaw', title: 'yaw'},
{field: 'shock', title: 'shock'}
]],
limits: [10, 15, 20, 25, 50, 100],
limit: 15,
page: true,
skin: 'line',
done: function (result, curr, count) {
//回调渲染折线图
}
});
// 监听搜索操作
form.on('submit(data-search-btn)', function (data) {
var result = JSON.stringify(data.field);
//执行搜索重载
table.reload('currentTableId', {
page: {
curr: 1
}
, where: {
searchParams: result
}
}, 'data');
return false;
});
});
</script>
</body>
</html>

View File

@ -49,6 +49,7 @@
var cfg_cols = [ var cfg_cols = [
{field: 'id', title: '组号', sort: true}, {field: 'id', title: '组号', sort: true},
{field: 'name', title: '描述'},
{field: 'work_cycle', title: '工作周期(分钟)'}, {field: 'work_cycle', title: '工作周期(分钟)'},
{field: 'active_time', title: '激活时长(分钟)'}, {field: 'active_time', title: '激活时长(分钟)'},
{field: 'active_offset', title: '偏置(分钟)'}, {field: 'active_offset', title: '偏置(分钟)'},
@ -58,9 +59,9 @@
{title: '操作', toolbar: '#currentTableBar', align: "center"} {title: '操作', toolbar: '#currentTableBar', align: "center"}
]; ];
if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") { if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") {
cfg_cols[3].hide = true;
cfg_cols[4].hide = true; cfg_cols[4].hide = true;
cfg_cols[7].hide = true; cfg_cols[5].hide = true;
cfg_cols[8].hide = true;
} }
@ -143,6 +144,7 @@
**/ **/
var cfg2_cols = [ var cfg2_cols = [
{field: 'id', title: '组号', sort: true}, {field: 'id', title: '组号', sort: true},
{field: 'name', title: '描述'},
{field: 'ver', title: '算法版本'}, {field: 'ver', title: '算法版本'},
{field: 'filter_hour', title: '滤波周期(小时)'}, {field: 'filter_hour', title: '滤波周期(小时)'},
{field: 'xy_threshold', title: '水平异常门限(mm)'}, {field: 'xy_threshold', title: '水平异常门限(mm)'},
@ -156,7 +158,7 @@
{title: '操作', toolbar: '#currentTableBar', align: "center"} {title: '操作', toolbar: '#currentTableBar', align: "center"}
]; ];
if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") { if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") {
cfg2_cols[9].hide = true; cfg2_cols[12].hide = true;
} }
table.render({ table.render({
elem: '#calcParaTableId', elem: '#calcParaTableId',

View File

@ -78,6 +78,8 @@
{field: 'devicetime', title: '设备时间'}, {field: 'devicetime', title: '设备时间'},
{field: 'd3xxbytes', title: 'D3XX'}, {field: 'd3xxbytes', title: 'D3XX'},
{field: 'b562bytes', title: 'B562'}, {field: 'b562bytes', title: 'B562'},
{field: 'fixnum', title: '固定解'},
{field: 'floatnum', title: '浮点解'},
{field: 'uart1txbytes', title: '串口1发'}, {field: 'uart1txbytes', title: '串口1发'},
{field: 'uart1rxbytes', title: '串口1收'}, {field: 'uart1rxbytes', title: '串口1收'},
{field: 'uart1unknown', title: '串口1未知'}, {field: 'uart1unknown', title: '串口1未知'},

View File

@ -55,7 +55,7 @@
<label class="layui-form-label required">基本参数组</label> <label class="layui-form-label required">基本参数组</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="group_id" id="group_id" lay-verify="required" lay-search=""> <select name="group_id" id="group_id" lay-verify="required" lay-search="">
<option th:each="item : ${gnss_group_list}" th:text="${item.id}" th:value="${item.id}"></option> <option th:each="item : ${gnss_group_list}" th:text="${item.name}" th:value="${item.id}"></option>
</select> </select>
</div> </div>
</div> </div>
@ -63,7 +63,7 @@
<label class="layui-form-label required">解算参数组</label> <label class="layui-form-label required">解算参数组</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="calc_group_id" id="calc_group_id" lay-verify="required" lay-search=""> <select name="calc_group_id" id="calc_group_id" lay-verify="required" lay-search="">
<option th:each="item : ${gnss_group_calc_list}" th:text="${item.id}" th:value="${item.id}"></option> <option th:each="item : ${gnss_group_calc_list}" th:text="${item.name}" th:value="${item.id}"></option>
</select> </select>
</div> </div>
</div> </div>

View File

@ -23,6 +23,12 @@
<input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input"> <input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label required">描述</label>
<div class="layui-input-block">
<input type="text" name="name" id="name" lay-verify="required" lay-reqtext="不能为空" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label required">工作周期(分钟)</label> <label class="layui-form-label required">工作周期(分钟)</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -104,6 +110,7 @@
$('#active_offset').val(data.active_offset); $('#active_offset').val(data.active_offset);
$('#rs_adv').val(data.rs_adv); $('#rs_adv').val(data.rs_adv);
$('#power_mode').val(data.power_mode); $('#power_mode').val(data.power_mode);
$('#name').val(data.name);
form.render(); form.render();
} }
</script> </script>

View File

@ -23,12 +23,19 @@
<input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input"> <input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label required">描述</label>
<div class="layui-input-block">
<input type="text" name="name" id="name" lay-verify="required" lay-reqtext="不能为空" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">算法版本</label> <label class="layui-form-label">算法版本</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="ver" id="ver" lay-filter="ver"> <select name="ver" id="ver" lay-filter="ver">
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="3">3</option>
</select> </select>
</div> </div>
</div> </div>
@ -141,6 +148,7 @@
$('#auto_threshold').val(data.auto_threshold); $('#auto_threshold').val(data.auto_threshold);
$('#auto_upload').val(data.auto_upload?'1':'0'); $('#auto_upload').val(data.auto_upload?'1':'0');
$('#ver').val(data.ver); $('#ver').val(data.ver);
$('#name').val(data.name);
form.render(); form.render();
} }
</script> </script>

View File

@ -43,7 +43,7 @@ public class BeidouDevice {
execute("C:\\Users\\wd\\Desktop\\log\\b562_2412254_0416_6xx.log"); execute("C:\\Users\\wd\\Desktop\\log\\b562_2412254_0416_6xx.log");
*/ */
executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_1xx.log"); /* executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_1xx.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_2xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_2xx.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_3xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_3xx.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_4xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_4xx.log");
@ -66,10 +66,12 @@ public class BeidouDevice {
executeAsD342("C:\\Users\\wd\\Desktop\\log\\2412254_0424_3xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\2412254_0424_3xx.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\2412254_0424_4xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\2412254_0424_4xx.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\2412254_0424_5xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\2412254_0424_5xx.log");
//execute("C:\\Users\\wd\\Desktop\\log\\b562_2412270_1.log"); */
execute("C:\\Users\\wd\\Desktop\\log\\2345076_0424_5xx.log");
//executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412270_1xx.log"); //executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412270_1xx.log");
//executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412270_2xx.log"); //executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412270_2xx.log");
/* executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_1.log");
/* executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_1.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_2.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_2.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_1xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_1xx.log");
executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_2xx.log"); executeAsD342("C:\\Users\\wd\\Desktop\\log\\2345076_0424_2xx.log");
@ -117,6 +119,10 @@ public class BeidouDevice {
Thread.sleep(30 * 1000); Thread.sleep(30 * 1000);
cycleCount++; cycleCount++;
} }
if(arrs[2].contains("24474e47")){
System.out.println(time+" 24474e47");
}
udpClient.sendData(ByteUtil.hexStringTobyte(arrs[2])); udpClient.sendData(ByteUtil.hexStringTobyte(arrs[2]));
b562Count++; b562Count++;
lastTime = time.getTime(); lastTime = time.getTime();