机库注册适配蛙跳机库
This commit is contained in:
parent
388cfd2845
commit
139e2eff46
|
|
@ -76,7 +76,7 @@ public class RequestsHandler implements MessageHandler {
|
|||
}
|
||||
String sn = deviceJson.getStr("sn");
|
||||
DockDeviceEntity dockDevice = dockDeviceDao.selectOne(
|
||||
new QueryWrapper<DockDeviceEntity>().eq("sn", sn));
|
||||
new QueryWrapper<DockDeviceEntity>().eq("sn", sn));
|
||||
if (dockDevice == null) {
|
||||
data.set("result", 1);
|
||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||
|
|
@ -103,7 +103,7 @@ public class RequestsHandler implements MessageHandler {
|
|||
String deviceBindingCode = data.getStr("device_binding_code");
|
||||
String organizationId = data.getStr("organization_id");
|
||||
if (!djiConfig.getDeviceBindCode().equals(deviceBindingCode) || !djiConfig.getOrganizationId()
|
||||
.equals(organizationId)) {
|
||||
.equals(organizationId)) {
|
||||
data.set("result", 2);
|
||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||
log.debug("requests step3--> 查询设备绑定对应的组织信息失败,设备绑定码或组织id不匹配");
|
||||
|
|
@ -117,7 +117,7 @@ public class RequestsHandler implements MessageHandler {
|
|||
log.debug("requests step3--> 查询设备绑定对应的组织信息成功");
|
||||
} else if (BusinessConstant.AIRPORT_ORGANIZATION_BIND.equals(method)) {//第四步 设备绑定组织信息
|
||||
JSONArray bindDevices = data.getJSONArray("bind_devices");
|
||||
if (bindDevices.size() == 2) {
|
||||
if (bindDevices.size() == 2 || bindDevices.size() == 1) {//1 为了适配蛙跳机库,蛙跳机库注册没有飞机
|
||||
List<DockDeviceEntity> bindDeviceList = new ArrayList<>();
|
||||
for (Object bindDevice : bindDevices) {
|
||||
JSONObject deviceJson = (JSONObject) bindDevice;
|
||||
|
|
@ -146,20 +146,20 @@ public class RequestsHandler implements MessageHandler {
|
|||
device.setDeviceType(Integer.parseInt(split[1]));
|
||||
device.setSubType(Integer.parseInt(split[2]));
|
||||
DeviceDicEntity deviceDicEntity = deviceDicDao.selectOne(new QueryWrapper<DeviceDicEntity>()
|
||||
.eq("domain", device.getDomain())
|
||||
.eq("device_type", device.getDeviceType())
|
||||
.eq("sub_type", device.getSubType()));
|
||||
.eq("domain", device.getDomain())
|
||||
.eq("device_type", device.getDeviceType())
|
||||
.eq("sub_type", device.getSubType()));
|
||||
device.setDeviceName(deviceDicEntity != null ? deviceDicEntity.getDeviceName() : "unknown");
|
||||
bindDeviceList.add(device);
|
||||
}
|
||||
if (CollUtil.isEmpty(bindDeviceList) || bindDeviceList.size() != 2) {
|
||||
if (CollUtil.isEmpty(bindDeviceList) /*|| bindDeviceList.size() != 2*/) {
|
||||
data.set("result", 3);
|
||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||
log.debug("requests step4--> 设备绑定组织信息失败,设备绑定数量不为2");
|
||||
return;
|
||||
}
|
||||
dockDeviceDao.delete(new QueryWrapper<DockDeviceEntity>().eq("sn", gateway).or()
|
||||
.eq("parent_sn", gateway));
|
||||
.eq("parent_sn", gateway));
|
||||
dockDeviceDao.insert(bindDeviceList);
|
||||
data.set("result", 0);
|
||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||
|
|
@ -223,7 +223,7 @@ public class RequestsHandler implements MessageHandler {
|
|||
message.remove("need_reply");
|
||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||
log.debug("requests private_get_multi_miaosuan_psdk_status--> 检查妙算设备是否上线:{}-> status: {}",
|
||||
psdkSn, status);
|
||||
psdkSn, status);
|
||||
}
|
||||
} else {
|
||||
log.debug("requests --> payload解析失败,解析后为null");
|
||||
|
|
|
|||
Loading…
Reference in New Issue