1、统计列表增加固定解浮点解
2、增加算法3,用于博通测试 3、组参数增加说明 4、删除原始数据表
This commit is contained in:
parent
730e1483c9
commit
6da8c91105
@ -1,13 +1,9 @@
|
||||
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 FwdRecordMapper extends BaseMapper<FwdRecord> {
|
||||
@Delete({"delete from fwdrecords where createtime <= #{t}"})
|
||||
int deleteTimeBefore(Timestamp t);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ public class GnssGroup implements Serializable {
|
||||
public final static short NORMAL_POWER_MODE = 1;
|
||||
Integer id;
|
||||
|
||||
String name;
|
||||
Integer work_cycle;
|
||||
Integer active_time;
|
||||
Integer active_offset;
|
||||
|
||||
@ -7,6 +7,7 @@ import lombok.Data;
|
||||
@TableName(value = "gnssgroupcalc")
|
||||
public class GnssGroupCalc {
|
||||
Integer id;
|
||||
String name;
|
||||
Integer filter_hour;
|
||||
Float xy_threshold;
|
||||
Float z_threshold;
|
||||
|
||||
@ -1,14 +1,9 @@
|
||||
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 GnssMsgMapper extends BaseMapper<GnssMsg> {
|
||||
@Delete({"delete from gnssmsg where createtime <= #{t}"})
|
||||
int deleteTimeBefore(Timestamp t);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -1,14 +1,10 @@
|
||||
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 GnssStatusMsgMapper extends BaseMapper<GnssStatusMsg> {
|
||||
@Delete({"delete from gnssstatusmsg where createtime <= #{t}"})
|
||||
int deleteTimeBefore(Timestamp t);
|
||||
|
||||
}
|
||||
|
||||
@ -61,4 +61,10 @@ public class GnssTrxMsg {
|
||||
Integer d3xxbytes;
|
||||
@ExcelProperty("使用卫星数")
|
||||
Integer satelliteinuse;
|
||||
|
||||
@ExcelProperty("固定解")
|
||||
Integer fixnum;
|
||||
|
||||
@ExcelProperty("浮点解")
|
||||
Integer floatnum;
|
||||
}
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
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 GnssTrxMsgMapper extends BaseMapper<GnssTrxMsg> {
|
||||
@Delete({"delete from gnsstrxmsg where createtime <= #{t}"})
|
||||
int deleteTimeBefore(Timestamp t);
|
||||
}
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
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 ResendRecordMapper extends BaseMapper<ResendRecord> {
|
||||
@Delete({"delete from resendrecords where createtime <= #{t}"})
|
||||
int deleteTimeBefore(Timestamp t);
|
||||
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ public interface FocusCalculator {
|
||||
void addXyz(double[] xyz, LocalDateTime dataTime);
|
||||
void addTilt(Tilt tilt);
|
||||
void addDelayMs(int ms);
|
||||
void addGGA(Gga gga);
|
||||
|
||||
// 解算:b562位置、惯导位置、融合位置
|
||||
void setReferPoint(double[] point);
|
||||
|
||||
@ -381,6 +381,12 @@ public class FocusCalculator1 implements FocusCalculator{
|
||||
delay_ms += ms;
|
||||
delay_counter ++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGGA(Gga gga) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvgDelayMs(){
|
||||
if(delay_counter==0) return -1;
|
||||
|
||||
@ -22,21 +22,21 @@ public class FocusCalculator2 extends FocusCalculator1{
|
||||
int originalReferPointFlag= INIT_REFER_POINT_NOT_SET; // 0:not set; 1:in use; 2:expired
|
||||
LocalDateTime originalReferPointTime;
|
||||
|
||||
class EComparator implements Comparator<double[]>{
|
||||
static class EComparator implements Comparator<double[]>{
|
||||
@Override
|
||||
public int compare(double[] point1, double[] point2) {
|
||||
return (int) ((point1[0] - point2[0])*100);
|
||||
}
|
||||
}
|
||||
|
||||
class NComparator implements Comparator<double[]>{
|
||||
static class NComparator implements Comparator<double[]>{
|
||||
@Override
|
||||
public int compare(double[] point1, double[] point2) {
|
||||
return (int) ((point1[1] - point2[1])*100);
|
||||
}
|
||||
}
|
||||
|
||||
class DComparator implements Comparator<double[]>{
|
||||
static class DComparator implements Comparator<double[]>{
|
||||
@Override
|
||||
public int compare(double[] point1, double[] point2) {
|
||||
return (int) ((point1[2] - point2[2])*100);
|
||||
@ -89,6 +89,7 @@ public class FocusCalculator2 extends FocusCalculator1{
|
||||
return sum/(end-begin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] resultB562(){
|
||||
// 把本轮的固定解添加到pointList一起解算
|
||||
if(counterFixedResult<30) return null;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -42,7 +42,7 @@ public class UBXUtil {
|
||||
return new double[]{relPosE*10,relPosN*10,relPosD*10,FLOAT_RESULT};
|
||||
}
|
||||
else{
|
||||
return new double[]{0,0,0,FLOAT_RESULT};
|
||||
return new double[]{0,0,0,NO_B562};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,9 +12,8 @@ public interface GNSSDataCalcService {
|
||||
*
|
||||
* @param message GNSS数据
|
||||
* @param completeWhenIdle 是否根据空闲时间判断本轮结束
|
||||
* @return x,y,z三轴数据
|
||||
*/
|
||||
double[] calcSingle(D341LocationMessage message, boolean completeWhenIdle);
|
||||
void calcSingle(D341LocationMessage message, boolean completeWhenIdle);
|
||||
|
||||
/**
|
||||
* 单轮解算结束,计算平滑值
|
||||
|
||||
@ -64,21 +64,23 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
||||
* 处理本轮的固定解,求出重心位置。多线程调用,访问成员变量要考虑多线程安全
|
||||
* @param message d341报文
|
||||
* @param completeWhenIdle 是否根据空闲时间判断本轮结束。是则启动30s定时器;否则需显示调用SingleDone函数
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public double[] calcSingle(D341LocationMessage message, boolean completeWhenIdle) {
|
||||
public void calcSingle(D341LocationMessage message, boolean completeWhenIdle) {
|
||||
String deviceId = message.getId();
|
||||
Device device = deviceService.findByDeviceId(deviceId);
|
||||
if(device == null) return null;
|
||||
if(device == null) return;
|
||||
GnssGroupCalc groupCalc = getGroupCalc(device.getCalcGroupId());
|
||||
|
||||
if(completeWhenIdle) resultOutputTimer(device, groupCalc, message.getCreateTime());
|
||||
|
||||
//todo 创建FocusCalculator对象需获取该测站的杆长度,上一小时的Tilt平均值,上一小时的测站相对坐标融合值ekfResult
|
||||
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());
|
||||
}
|
||||
else {
|
||||
@ -101,7 +103,16 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
||||
if (logger.isDebugEnabled()) {
|
||||
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
|
||||
@ -202,7 +213,7 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
||||
// 记录本次位置,作为下次的参考
|
||||
// 算法1:以上轮位置作为参考,跟随变化速度快
|
||||
// 算法2:以滤波后的位置作为参考,跟随变化速度慢;如果倾角大于某一门限,则跟随上轮位置
|
||||
if(focusCalculator.getVer()==1 || focusCalculator.isShocked()) {
|
||||
if(focusCalculator.getVer()==1 || focusCalculator.getVer()==3 || focusCalculator.isShocked()) {
|
||||
focusCalculator.setReferPoint(b562Result);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -41,6 +41,9 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
||||
if(device == null) return null;
|
||||
message.setTenantId(device.getTenantId());
|
||||
device.updateRx(message.getHeader(), message.getLen(), 1);
|
||||
double[] pos = message.getB562_loc();
|
||||
device.updateB562Quality((int) pos[3]);
|
||||
|
||||
Gga gga = message.getGga();
|
||||
if(gga != null) {
|
||||
device.updateSatelitesNum(gga.getSatellitesInUsed());
|
||||
|
||||
@ -54,6 +54,8 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
||||
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
|
||||
gnssTrxMsg.setB562bytes(device.getD341bytes());
|
||||
gnssTrxMsg.setSatelliteinuse(device.getSatelitesInUse());
|
||||
gnssTrxMsg.setFixnum(device.getFixedNum());
|
||||
gnssTrxMsg.setFloatnum(device.getFloatNum());
|
||||
|
||||
// 储设备收发字节数统计信息
|
||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||
|
||||
@ -93,12 +93,7 @@ public class DataPersistServiceImpl implements DataPersistService {
|
||||
// 添加到trxmsg里
|
||||
GnssTrxMsg trxMsg = message.getTrxMsg();
|
||||
trxMsgMapper.insert(trxMsg);
|
||||
if(device.getDeviceType() == GnssDevice.TYPE_ROVER) {
|
||||
saveMsg(message, "d341 num: "+device.getD341Count()+","+message.getOtherInfo());
|
||||
}
|
||||
else{
|
||||
saveMsg(message, "d331 num: "+device.getD3xxCount()+","+message.getOtherInfo());
|
||||
}
|
||||
saveMsg(message, message.getOtherInfo());
|
||||
|
||||
// 检测该对象是否已存在
|
||||
GnssStatus deviceState = deviceStateRepository.getByDeviceId(message.getId());
|
||||
|
||||
@ -66,7 +66,7 @@ public class GnssGroupController extends BasicController {
|
||||
GnssGroup oldGroup = gnssGroupMapper.selectById(group.getId());
|
||||
|
||||
// no changed
|
||||
if(oldGroup != null && oldGroup.equals(group)) return HttpResult.ok();
|
||||
//if(oldGroup != null && oldGroup.equals(group)) return HttpResult.ok();
|
||||
|
||||
if(null != oldGroup) {
|
||||
num = gnssGroupMapper.updateById(group);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -38,6 +38,7 @@ public class IndexController extends BasicController{
|
||||
int warning1Num=0;//一般告警
|
||||
int warning2Num=0;//严重告警
|
||||
int noGGA = 0;
|
||||
int noFix = 0;
|
||||
|
||||
List<GnssStatusJoin> deviceList;
|
||||
if(tenantId == Tenant.SAAS_PROVIDER_ID){
|
||||
@ -53,6 +54,8 @@ public class IndexController extends BasicController{
|
||||
while(iterator.hasNext()){
|
||||
GnssStatusJoin status=iterator.next();
|
||||
if(status.getState() == GnssStatus.STATE_OFFLINE) deviceOfflineNum++;
|
||||
if((status.getWarningcode()&WarningCfg.TYPE_NO_FIXED_RESULT) != 0) noFix++;
|
||||
|
||||
if(status.getWarning() == WarningCfg.LEVEL_1) warning1Num++;
|
||||
else if(status.getWarning() == WarningCfg.LEVEL_2) warning2Num++;
|
||||
|
||||
@ -81,6 +84,7 @@ public class IndexController extends BasicController{
|
||||
m.addAttribute("warning2Num", warning2Num);
|
||||
m.addAttribute("warningTotalNum", warning1Num+warning2Num);
|
||||
m.addAttribute("noGGA", noGGA);
|
||||
m.addAttribute("noFix", noFix);
|
||||
m.addAttribute("deviceList", deviceList);
|
||||
|
||||
return "/page/device_overview";
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.imdroid.beidou.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.imdroid.secapi.dto.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.Scheduled;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/***
|
||||
* 定时任务:
|
||||
@ -22,6 +24,8 @@ import java.sql.Timestamp;
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class DatasetCleaner {
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Autowired
|
||||
GnssMsgMapper gnssMsgMapper;
|
||||
@Autowired
|
||||
@ -29,12 +33,13 @@ public class DatasetCleaner {
|
||||
@Autowired
|
||||
GnssTrxMsgMapper trxMsgMapper;
|
||||
@Autowired
|
||||
GnssRawDataMapper rawDataMapper;
|
||||
@Autowired
|
||||
ResendRecordMapper resendRecordMapper;
|
||||
@Autowired
|
||||
FwdRecordMapper fwdRecordMapper;
|
||||
|
||||
@Autowired
|
||||
GnssCalcDataMapper calcDataMapper;
|
||||
|
||||
//cron表达式格式:
|
||||
//{秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}
|
||||
|
||||
@ -43,44 +48,52 @@ public class DatasetCleaner {
|
||||
//@Scheduled(cron = "*/5 * * * * ?") // 每5秒执行一次
|
||||
public void dayTask() {
|
||||
checkMsgDataset();
|
||||
checkRawDataset();
|
||||
checkFwdDataset();
|
||||
checkStatusDataset();
|
||||
checkGnssDataDataset();
|
||||
}
|
||||
|
||||
void checkMsgDataset(){
|
||||
long before = System.currentTimeMillis() -
|
||||
(long)30 * 24 * 3600 * 1000;
|
||||
Timestamp t = new Timestamp(before);
|
||||
int count = gnssMsgMapper.deleteTimeBefore(t);
|
||||
long before = 30;
|
||||
QueryWrapper<GnssMsg> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
|
||||
int count = gnssMsgMapper.delete(queryWrapper);
|
||||
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(){
|
||||
long before = System.currentTimeMillis() -
|
||||
(long)90 * 24 * 3600 * 1000;
|
||||
Timestamp t = new Timestamp(before);
|
||||
int count = statusMsgMapper.deleteTimeBefore(t);
|
||||
long before = 90;
|
||||
|
||||
QueryWrapper<GnssStatusMsg> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
|
||||
int count = statusMsgMapper.delete(queryWrapper);
|
||||
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);
|
||||
}
|
||||
|
||||
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(){
|
||||
long before = System.currentTimeMillis() -
|
||||
(long)180 * 24 * 3600 * 1000;
|
||||
Timestamp t = new Timestamp(before);
|
||||
int count = fwdRecordMapper.deleteTimeBefore(t);
|
||||
long before = 180;
|
||||
|
||||
QueryWrapper<FwdRecord> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.le("createtime", LocalDateTime.now().minusDays(before).format(dateFormatter));
|
||||
int count = fwdRecordMapper.delete(queryWrapper);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -65,6 +65,7 @@ CREATE TABLE IF NOT EXISTS `gnssdevices` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `gnssgroup` (
|
||||
`id` int NOT NULL,
|
||||
`name` varchar(64) DEFAULT NULL,
|
||||
`work_cycle` int DEFAULT 30,
|
||||
`active_time` int DEFAULT 6,
|
||||
`active_offset` int DEFAULT 0,
|
||||
@ -76,6 +77,7 @@ CREATE TABLE IF NOT EXISTS `gnssgroup` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `gnssgroupcalc` (
|
||||
`id` int NOT NULL,
|
||||
`name` varchar(64) DEFAULT NULL,
|
||||
`filter_hour` int DEFAULT NULL COMMENT '平滑窗口',
|
||||
`xy_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
|
||||
) 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` (
|
||||
`id` bigint AUTO_INCREMENT,
|
||||
`tenantid` int NOT NULL,
|
||||
@ -217,6 +204,8 @@ CREATE TABLE IF NOT EXISTS `gnsstrxmsg` (
|
||||
`b562bytes` int DEFAULT NULL,
|
||||
`d3xxbytes` int DEFAULT NULL,
|
||||
`satelliteinuse` int DEFAULT 0,
|
||||
`fixnum` int DEFAULT NULL,
|
||||
`floatnum` int DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
</div>
|
||||
<div class="layui-col-xs3 layui-col-md4">
|
||||
掉线数 <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>
|
||||
</div>
|
||||
</div>
|
||||
@ -96,6 +96,7 @@
|
||||
<div class="layui-col-xs3 layui-col-md4">
|
||||
严重 <a style="color: #bd3004" th:text="${warning2Num}">5</a><br>
|
||||
一般 <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>
|
||||
|
||||
@ -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>
|
||||
@ -49,6 +49,7 @@
|
||||
|
||||
var cfg_cols = [
|
||||
{field: 'id', title: '组号', sort: true},
|
||||
{field: 'name', title: '描述'},
|
||||
{field: 'work_cycle', title: '工作周期(分钟)'},
|
||||
{field: 'active_time', title: '激活时长(分钟)'},
|
||||
{field: 'active_offset', title: '偏置(分钟)'},
|
||||
@ -58,9 +59,9 @@
|
||||
{title: '操作', toolbar: '#currentTableBar', align: "center"}
|
||||
];
|
||||
if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") {
|
||||
cfg_cols[3].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 = [
|
||||
{field: 'id', title: '组号', sort: true},
|
||||
{field: 'name', title: '描述'},
|
||||
{field: 'ver', title: '算法版本'},
|
||||
{field: 'filter_hour', title: '滤波周期(小时)'},
|
||||
{field: 'xy_threshold', title: '水平异常门限(mm)'},
|
||||
@ -156,7 +158,7 @@
|
||||
{title: '操作', toolbar: '#currentTableBar', align: "center"}
|
||||
];
|
||||
if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") {
|
||||
cfg2_cols[9].hide = true;
|
||||
cfg2_cols[12].hide = true;
|
||||
}
|
||||
table.render({
|
||||
elem: '#calcParaTableId',
|
||||
|
||||
@ -78,6 +78,8 @@
|
||||
{field: 'devicetime', title: '设备时间'},
|
||||
{field: 'd3xxbytes', title: 'D3XX'},
|
||||
{field: 'b562bytes', title: 'B562'},
|
||||
{field: 'fixnum', title: '固定解'},
|
||||
{field: 'floatnum', title: '浮点解'},
|
||||
{field: 'uart1txbytes', title: '串口1发'},
|
||||
{field: 'uart1rxbytes', title: '串口1收'},
|
||||
{field: 'uart1unknown', title: '串口1未知'},
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<label class="layui-form-label required">基本参数组</label>
|
||||
<div class="layui-input-inline">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@ -63,7 +63,7 @@
|
||||
<label class="layui-form-label required">解算参数组</label>
|
||||
<div class="layui-input-inline">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -23,6 +23,12 @@
|
||||
<input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input">
|
||||
</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">
|
||||
<label class="layui-form-label required">工作周期(分钟)</label>
|
||||
<div class="layui-input-block">
|
||||
@ -104,6 +110,7 @@
|
||||
$('#active_offset').val(data.active_offset);
|
||||
$('#rs_adv').val(data.rs_adv);
|
||||
$('#power_mode').val(data.power_mode);
|
||||
$('#name').val(data.name);
|
||||
form.render();
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -23,12 +23,19 @@
|
||||
<input type="number" name="id" id="id" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入组号" value="" class="layui-input">
|
||||
</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">
|
||||
<label class="layui-form-label">算法版本</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="ver" id="ver" lay-filter="ver">
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -141,6 +148,7 @@
|
||||
$('#auto_threshold').val(data.auto_threshold);
|
||||
$('#auto_upload').val(data.auto_upload?'1':'0');
|
||||
$('#ver').val(data.ver);
|
||||
$('#name').val(data.name);
|
||||
form.render();
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -43,7 +43,7 @@ public class BeidouDevice {
|
||||
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_3xx.log");
|
||||
executeAsD342("C:\\Users\\wd\\Desktop\\log\\b562_2412254_4xx.log");
|
||||
@ -66,9 +66,11 @@ public class BeidouDevice {
|
||||
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_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_2xx.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_1xx.log");
|
||||
@ -117,6 +119,10 @@ public class BeidouDevice {
|
||||
Thread.sleep(30 * 1000);
|
||||
cycleCount++;
|
||||
}
|
||||
if(arrs[2].contains("24474e47")){
|
||||
System.out.println(time+" 24474e47");
|
||||
}
|
||||
|
||||
udpClient.sendData(ByteUtil.hexStringTobyte(arrs[2]));
|
||||
b562Count++;
|
||||
lastTime = time.getTime();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user