协议、IOT推送
This commit is contained in:
parent
d5b31fded3
commit
a5127cd50b
|
@ -6,8 +6,7 @@ import lombok.Data;
|
|||
@Data
|
||||
public class AgreementVO extends Agreement{
|
||||
|
||||
|
||||
@ApiModelProperty("商户ID")
|
||||
@ApiModelProperty("运营商ID")
|
||||
private Long storeId;
|
||||
|
||||
@ApiModelProperty("商户名")
|
||||
|
@ -19,7 +18,4 @@ public class AgreementVO extends Agreement{
|
|||
@ApiModelProperty("代理商ID")
|
||||
private Long agentId;
|
||||
|
||||
@ApiModelProperty("运营商ID")
|
||||
private Long storeId;
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="selectAgreementVo">
|
||||
select
|
||||
bag.id,
|
||||
bag.store_id,
|
||||
bag.area_id,
|
||||
bag.title,
|
||||
bag.brief,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi.iot.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -70,10 +69,6 @@ public class IotConverterImpl implements IotConverter {
|
|||
if (sys == null) {
|
||||
return;
|
||||
}
|
||||
// 旧版硬件BUG,电压超过100V的需要除以10
|
||||
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
||||
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
device.setSys(sys);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,12 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
|||
IotDeviceSysInfo sys = IotUtil.toSysInfo(msg.getValue());
|
||||
LocalDateTime at = DateUtils.toLocalDateTime(msg.getAt());
|
||||
|
||||
// 0,0定位不处理
|
||||
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
||||
log.info("设备{}定位异常:{},{},不处理", msg.getDevName(), sys.getLon(), sys.getLat());
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理设备定位BUG,若出现BUG则重启设备
|
||||
int handle = this.handleDeviceLocationBug(device, sys, at);
|
||||
if (handle == 1) {
|
||||
|
@ -136,10 +142,6 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
|||
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
||||
return 0;
|
||||
}
|
||||
// 0,0定位不处理
|
||||
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
||||
return 0;
|
||||
}
|
||||
// 相差一分钟以上的消息不做处理
|
||||
Duration duration = Duration.between(at, LocalDateTime.now());
|
||||
if (duration.getSeconds() > 60) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.iot.util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
|
@ -220,6 +221,13 @@ public class IotUtil {
|
|||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseObject(value.toString(), IotDeviceSysInfo.class);
|
||||
IotDeviceSysInfo sys = JSON.parseObject(value.toString(), IotDeviceSysInfo.class);
|
||||
|
||||
// 旧版硬件BUG,电压超过100V的需要除以10
|
||||
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
||||
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
|
||||
return sys;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user