修改基站配置修改同步到rtcm的bug
This commit is contained in:
parent
b02cf1e648
commit
75946d75c3
@ -275,8 +275,20 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
|||||||
logger.info("group paras changed");
|
logger.info("group paras changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshGroupCalc(String deviceId){
|
public void refreshDeviceCalc(String deviceId){
|
||||||
|
Device device = deviceService.findByDeviceId(deviceId);
|
||||||
|
if(device == null) return;
|
||||||
|
|
||||||
|
if(device.getDeviceType() == Device.DEVICE_BASE_STATION){
|
||||||
|
List<Device> deviceList = deviceService.findByParentId(deviceId);
|
||||||
|
for(Device d:deviceList){
|
||||||
|
calculatorMap.remove(d.getDeviceId());
|
||||||
|
}
|
||||||
|
logger.info("base station device paras changed");
|
||||||
|
}
|
||||||
|
else{
|
||||||
calculatorMap.remove(deviceId);
|
calculatorMap.remove(deviceId);
|
||||||
|
}
|
||||||
logger.info("device paras changed");
|
logger.info("device paras changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,23 @@
|
|||||||
package com.imdroid.sideslope.executor;
|
package com.imdroid.sideslope.executor;
|
||||||
|
|
||||||
|
import com.imdroid.common.util.HexUtil;
|
||||||
import com.imdroid.secapi.client.BeidouClient;
|
import com.imdroid.secapi.client.BeidouClient;
|
||||||
|
import com.imdroid.secapi.dto.GnssMsg;
|
||||||
|
import com.imdroid.secapi.dto.GnssMsgMapper;
|
||||||
import com.imdroid.secapi.dto.GnssStatus;
|
import com.imdroid.secapi.dto.GnssStatus;
|
||||||
import com.imdroid.sideslope.message.D3F0SelfCheckMessage;
|
import com.imdroid.sideslope.message.D3F0SelfCheckMessage;
|
||||||
import com.imdroid.sideslope.sal.DeviceService;
|
import com.imdroid.sideslope.sal.DeviceService;
|
||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
import com.imdroid.sideslope.service.DataPersistService;
|
import com.imdroid.sideslope.service.DataPersistService;
|
||||||
import com.imdroid.common.util.ThreadManager;
|
import com.imdroid.common.util.ThreadManager;
|
||||||
|
import com.imdroid.sideslope.web.ApiController;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Layton
|
* @author Layton
|
||||||
@ -24,11 +29,16 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataPersistService dataPersistService;
|
private DataPersistService dataPersistService;
|
||||||
|
@Autowired
|
||||||
|
GnssMsgMapper msgMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BeidouClient beidouClient;
|
private BeidouClient beidouClient;
|
||||||
// 由于消息数据大,从缓存查询设备信息效率更高
|
// 由于消息数据大,从缓存查询设备信息效率更高
|
||||||
@Resource(name = "local")
|
@Resource(name = "local")
|
||||||
private DeviceService deviceService;
|
private DeviceService deviceService;
|
||||||
|
@Autowired
|
||||||
|
ApiController apiController;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void execute(D3F0SelfCheckMessage message) {
|
public Void execute(D3F0SelfCheckMessage message) {
|
||||||
@ -56,6 +66,7 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
|
|||||||
|
|
||||||
}
|
}
|
||||||
dataPersistService.saveDeviceState(message);
|
dataPersistService.saveDeviceState(message);
|
||||||
|
checkAndSendF9PPowerOffCommand(device);
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -66,4 +77,50 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
|
|||||||
public Class<?> getMessageType() {
|
public Class<?> getMessageType() {
|
||||||
return D3F0SelfCheckMessage.class;
|
return D3F0SelfCheckMessage.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkAndSendF9PPowerOffCommand(Device device){
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 针对 2419 编号开头的测站设备,检查其 F9P 运行的时间,每隔48小时需要使其断电
|
||||||
|
if(device.getDeviceId().startsWith("2419") && device.getDeviceType() == 0){
|
||||||
|
// 缓存中若没有 F9P 最近一次断电时间的记录,则初始化它为当前时间
|
||||||
|
if(device.getLastF9PPowerOffTime() == null){
|
||||||
|
device.setLastF9PPowerOffTime(now);
|
||||||
|
logger.debug("设备" + device.getDeviceId() + ": F9P最近一次断电时间初始化为 " + device.getLastF9PPowerOffTime());
|
||||||
|
}
|
||||||
|
// 检查 F9P 最近一次断电时间是否超过 48 小时 ,若是,则发送断电指令
|
||||||
|
if(device.getLastF9PPowerOffTime().isBefore(now.minusHours(48))){
|
||||||
|
logger.debug("设备 "+device.getDeviceId()+" 的 F9P 距离上一次断电已超过48小时,发送F9P断电指令");
|
||||||
|
|
||||||
|
int flag = 0xD313;
|
||||||
|
String sendCmd = "2500";
|
||||||
|
short len = (short) (sendCmd.length()/2+4);
|
||||||
|
sendCmd = Integer.toHexString(flag)+
|
||||||
|
HexUtil.Short2HexString(len)+
|
||||||
|
HexUtil.Int2HexString(Integer.parseInt(device.getDeviceId()))+
|
||||||
|
sendCmd;
|
||||||
|
|
||||||
|
apiController.config(device.getDeviceId(), sendCmd);
|
||||||
|
saveMsg(device.getDeviceId(), device.getTenantId(),0xD313, sendCmd, true);
|
||||||
|
// 更新F9P断电时间,用于下一个48小时周期后的判断
|
||||||
|
device.setLastF9PPowerOffTime(now);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveMsg(String deviceId, int tenantId, int msgType, String content,boolean isTx){
|
||||||
|
GnssMsg gnssMsg = new GnssMsg();
|
||||||
|
gnssMsg.setCreatetime(LocalDateTime.now());
|
||||||
|
gnssMsg.setTenantid(tenantId);
|
||||||
|
gnssMsg.setDeviceid(deviceId);
|
||||||
|
gnssMsg.setMsgtype(msgType);
|
||||||
|
gnssMsg.setTx(isTx);
|
||||||
|
if(content==null) content="";
|
||||||
|
gnssMsg.setMsglen(content.length()/2);
|
||||||
|
int saveContentLen = content.length();
|
||||||
|
if(saveContentLen<=128)
|
||||||
|
gnssMsg.setContent(content);
|
||||||
|
else
|
||||||
|
gnssMsg.setContent(content.substring(0,128));
|
||||||
|
msgMapper.insert(gnssMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,8 @@ public class Device {
|
|||||||
|
|
||||||
LocalDateTime lastRxTime;
|
LocalDateTime lastRxTime;
|
||||||
LocalDateTime lastD3f0f2Time;
|
LocalDateTime lastD3f0f2Time;
|
||||||
|
LocalDateTime lastF9PPowerOffTime;
|
||||||
|
|
||||||
int lastRxHead = 0;
|
int lastRxHead = 0;
|
||||||
|
|
||||||
int fixedNum = 0;
|
int fixedNum = 0;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class ApiController {
|
|||||||
public HttpResp deviceParamChanged(String deviceId) {
|
public HttpResp deviceParamChanged(String deviceId) {
|
||||||
// 更新设备缓存
|
// 更新设备缓存
|
||||||
localDeviceService.refresh(deviceId);
|
localDeviceService.refresh(deviceId);
|
||||||
calcService.refreshGroupCalc(deviceId);
|
calcService.refreshDeviceCalc(deviceId);
|
||||||
|
|
||||||
HttpResp resp = new HttpResp();
|
HttpResp resp = new HttpResp();
|
||||||
resp.setResponseMessage("succeed");
|
resp.setResponseMessage("succeed");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user