设备修改数据队列
This commit is contained in:
parent
a5909f4294
commit
76c43c0f45
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ifish.socketNew;
|
package com.ifish.socketNew;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
@ -237,7 +238,7 @@ public class SomeServer {
|
||||||
QueueEventEntity eventEntity1 = new QueueEventEntity();
|
QueueEventEntity eventEntity1 = new QueueEventEntity();
|
||||||
eventEntity1.setEventName("com.ifish7.mq.queues.event.DeviceInfoEvent");
|
eventEntity1.setEventName("com.ifish7.mq.queues.event.DeviceInfoEvent");
|
||||||
eventEntity1.setEventProcess("deviceLoginLogSave");
|
eventEntity1.setEventProcess("deviceLoginLogSave");
|
||||||
QueueEventBody eventBody1 = new QueueEventBody("com.ifish7.mq.business.device.entity.TblLoginRecord",data);
|
QueueEventBody eventBody1 = new QueueEventBody("com.ifish7.mq.business.device.entity.TblLoginRecord",data1);
|
||||||
eventEntity1.setEventBody(eventBody1);
|
eventEntity1.setEventBody(eventBody1);
|
||||||
//登录记录保存
|
//登录记录保存
|
||||||
sendDataQueueMessage(JSONObject.toJSONString(eventEntity1));
|
sendDataQueueMessage(JSONObject.toJSONString(eventEntity1));
|
||||||
|
|
@ -296,19 +297,34 @@ public class SomeServer {
|
||||||
//查找设备
|
//查找设备
|
||||||
Device device = this.deviceService.getUniqueByProperty("macAddress", strSrc);
|
Device device = this.deviceService.getUniqueByProperty("macAddress", strSrc);
|
||||||
if(device!=null){
|
if(device!=null){
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.put("macAddress",strSrc);
|
||||||
//是否升级
|
//是否升级
|
||||||
if(device.getIsUpgrade().equals(BooleanEnum.YES.getKey())){
|
if(device.getIsUpgrade().equals(BooleanEnum.YES.getKey())){
|
||||||
device.setIsUpgrade(BooleanEnum.NO.getKey());
|
data.put("isUpgrade",BooleanEnum.NO.getKey());
|
||||||
device.setUpgradeTime(new Date());
|
data.put("upgradeTime", LocalDateTime.now());
|
||||||
|
//
|
||||||
|
// device.setIsUpgrade(BooleanEnum.NO.getKey());
|
||||||
|
// device.setUpgradeTime(new Date());
|
||||||
//升级版本
|
//升级版本
|
||||||
int upgradeVersion = device.getUpgradeVersion();
|
int upgradeVersion = device.getUpgradeVersion();
|
||||||
OrderFunctionCode15 model = OrderModel.OrderFunctionCode15(macBytes,upgradeVersion);
|
OrderFunctionCode15 model = OrderModel.OrderFunctionCode15(macBytes,upgradeVersion);
|
||||||
session.write(model);
|
session.write(model);
|
||||||
}
|
}
|
||||||
|
data.put("sdkTime",IfishUtil.StrToDate(receive.getYear()+"-"+(receive.getMonth() & 0xff)+"-"+(receive.getDay() & 0xff)));
|
||||||
|
data.put("sdkVersion",receive.getVersion() & 0xff);
|
||||||
|
|
||||||
|
QueueEventEntity eventEntity = new QueueEventEntity();
|
||||||
|
eventEntity.setEventName("com.ifish7.mq.queues.event.DeviceInfoEvent");
|
||||||
|
eventEntity.setEventProcess("deviceSdkUpdate");
|
||||||
|
QueueEventBody eventBody = new QueueEventBody("com.ifish7.mq.business.device.entity.TblDevice",data);
|
||||||
|
eventEntity.setEventBody(eventBody);
|
||||||
|
//设备sdk更新
|
||||||
|
sendDataQueueMessage(JSONObject.toJSONString(eventEntity));
|
||||||
//记录参数
|
//记录参数
|
||||||
device.setSdkVersion(receive.getVersion() & 0xff);
|
// device.setSdkVersion(receive.getVersion() & 0xff);
|
||||||
device.setSdkTime(IfishUtil.StrToDate(receive.getYear()+"-"+(receive.getMonth() & 0xff)+"-"+(receive.getDay() & 0xff)));
|
// device.setSdkTime(IfishUtil.StrToDate(receive.getYear()+"-"+(receive.getMonth() & 0xff)+"-"+(receive.getDay() & 0xff)));
|
||||||
this.deviceService.update(device);
|
// this.deviceService.update(device);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("save device sdk version16 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
log.error("save device sdk version16 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
||||||
|
|
@ -322,25 +338,46 @@ public class SomeServer {
|
||||||
try {
|
try {
|
||||||
//查找设备
|
//查找设备
|
||||||
Device device = this.deviceService.getUniqueByProperty("macAddress", strSrc);
|
Device device = this.deviceService.getUniqueByProperty("macAddress", strSrc);
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.put("macAddress",strSrc);
|
||||||
if(device!=null){
|
if(device!=null){
|
||||||
//是否升级
|
//是否升级
|
||||||
if(device.getIsUpgrade().equals(BooleanEnum.YES.getKey())){
|
if(device.getIsUpgrade().equals(BooleanEnum.YES.getKey())){
|
||||||
device.setIsUpgrade(BooleanEnum.NO.getKey());
|
data.put("isUpgrade",BooleanEnum.NO.getKey());
|
||||||
device.setUpgradeTime(new Date());
|
data.put("upgradeTime", LocalDateTime.now());
|
||||||
|
// device.setIsUpgrade(BooleanEnum.NO.getKey());
|
||||||
|
// device.setUpgradeTime(new Date());
|
||||||
//升级版本
|
//升级版本
|
||||||
int upgradeVersion = device.getUpgradeVersion();
|
int upgradeVersion = device.getUpgradeVersion();
|
||||||
OrderFunctionCode15 model = OrderModel.OrderFunctionCode15(macBytes,upgradeVersion);
|
OrderFunctionCode15 model = OrderModel.OrderFunctionCode15(macBytes,upgradeVersion);
|
||||||
session.write(model);
|
session.write(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.put("sdkTime",IfishUtil.StrToDate(receive.getYear()+"-"+(receive.getMonth() & 0xff)+"-"+(receive.getDay() & 0xff)));
|
||||||
|
data.put("sdkVersion",receive.getVersion() & 0xff);
|
||||||
|
data.put("number1",receive.getNumber1());
|
||||||
|
data.put("number2",receive.getNumber2());
|
||||||
|
data.put("number3",receive.getNumber3());
|
||||||
|
data.put("number4",receive.getNumber4());
|
||||||
|
data.put("number5",receive.getNumber5());
|
||||||
|
|
||||||
|
QueueEventEntity eventEntity = new QueueEventEntity();
|
||||||
|
eventEntity.setEventName("com.ifish7.mq.queues.event.DeviceInfoEvent");
|
||||||
|
eventEntity.setEventProcess("deviceSdkUpdate");
|
||||||
|
QueueEventBody eventBody = new QueueEventBody("com.ifish7.mq.business.device.entity.TblDevice",data);
|
||||||
|
eventEntity.setEventBody(eventBody);
|
||||||
|
//设备sdk更新
|
||||||
|
sendDataQueueMessage(JSONObject.toJSONString(eventEntity));
|
||||||
|
|
||||||
//记录参数
|
//记录参数
|
||||||
device.setSdkVersion(receive.getVersion() & 0xff);
|
// device.setSdkVersion(receive.getVersion() & 0xff);
|
||||||
device.setSdkTime(IfishUtil.StrToDate(receive.getYear()+"-"+(receive.getMonth() & 0xff)+"-"+(receive.getDay() & 0xff)));
|
// device.setSdkTime(IfishUtil.StrToDate(receive.getYear()+"-"+(receive.getMonth() & 0xff)+"-"+(receive.getDay() & 0xff)));
|
||||||
device.setNumber1(receive.getNumber1());
|
// device.setNumber1(receive.getNumber1());
|
||||||
device.setNumber2(receive.getNumber2());
|
// device.setNumber2(receive.getNumber2());
|
||||||
device.setNumber3(receive.getNumber3());
|
// device.setNumber3(receive.getNumber3());
|
||||||
device.setNumber4(receive.getNumber4());
|
// device.setNumber4(receive.getNumber4());
|
||||||
device.setNumber5(receive.getNumber5());
|
// device.setNumber5(receive.getNumber5());
|
||||||
this.deviceService.update(device);
|
// this.deviceService.update(device);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("save device sdk version17 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
log.error("save device sdk version17 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue