设备开关修改
This commit is contained in:
parent
e1f40c02fa
commit
f411d81a63
|
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.ifish7.mq.business.device.entity.TblDevice;
|
||||
import com.ifish7.mq.business.device.service.ITblDeviceService;
|
||||
import com.ifish7.mq.business.device.service.impl.TblDeviceServiceImpl;
|
||||
import com.ifish7.mq.queues.event.support.EventSupport;
|
||||
import com.ifish7.mq.utils.AppBeans;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
|
|
@ -15,12 +14,25 @@ import lombok.extern.log4j.Log4j;
|
|||
* @Modified by:
|
||||
*/
|
||||
@Log4j
|
||||
public class DeviceInfoEvent extends EventSupport {
|
||||
public class DeviceInfoEvent {
|
||||
|
||||
|
||||
public void updateWarnOnoff() {
|
||||
log.info("DeviceInfoEvent eventBody : " + eventBody);
|
||||
TblDevice device = (TblDevice) this.eventEntity;
|
||||
/**
|
||||
* {
|
||||
* "eventProcess": "updateWarnOnoff",
|
||||
* "eventName": "com.ifish7.mq.queues.event.DeviceInfoEvent",
|
||||
* "eventBody": {
|
||||
* "entity" : "com.ifish7.mq.business.device.entity.TblDevice",
|
||||
* "data" : {
|
||||
* "macAddress" : "5ccf7f006686",
|
||||
* "onOff" : "0"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* @param eventEntity 事件体
|
||||
*/
|
||||
private void updateWarnOnoff(Object eventEntity) {
|
||||
log.info("DeviceInfoEvent eventEntity : " + eventEntity);
|
||||
TblDevice device = (TblDevice) eventEntity;
|
||||
ITblDeviceService deviceService = AppBeans.getBean(TblDeviceServiceImpl.class);
|
||||
TblDevice tblDevice = deviceService.getOne(new QueryWrapper<TblDevice>().lambda().eq(TblDevice::getMacAddress, device.getMacAddress()));
|
||||
tblDevice.setOnOff(device.getOnOff());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.ifish7.mq.business.device.entity.TblDeviceHeater;
|
||||
import com.ifish7.mq.business.device.service.ITblDeviceHeaterService;
|
||||
import com.ifish7.mq.business.device.service.impl.TblDeviceHeaterServiceImpl;
|
||||
import com.ifish7.mq.queues.event.support.EventSupport;
|
||||
import com.ifish7.mq.utils.AppBeans;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
|
|
@ -14,7 +13,7 @@ import lombok.extern.log4j.Log4j;
|
|||
* @Date: Created in 22:13 2019/4/9
|
||||
*/
|
||||
@Log4j
|
||||
public class IntelligentHeatingRodEvent extends EventSupport {
|
||||
public class IntelligentHeatingRodEvent {
|
||||
|
||||
/**
|
||||
* 智能加热棒新增或修改
|
||||
|
|
@ -32,11 +31,12 @@ public class IntelligentHeatingRodEvent extends EventSupport {
|
|||
* }
|
||||
* }
|
||||
* }
|
||||
* @param eventEntity 事件体
|
||||
*/
|
||||
public void intelligentHeatingRodSaveOrUpdate(){
|
||||
log.info("intelligentHeatingRodSaveOrUpdate eventBody : " + eventBody);
|
||||
private void intelligentHeatingRodSaveOrUpdate(Object eventEntity){
|
||||
log.info("intelligentHeatingRodSaveOrUpdate eventEntity : " + eventEntity);
|
||||
try {
|
||||
TblDeviceHeater deviceHeater = (TblDeviceHeater) super.eventEntity;
|
||||
TblDeviceHeater deviceHeater = (TblDeviceHeater) eventEntity;
|
||||
//获取service
|
||||
ITblDeviceHeaterService deviceHeaterService = AppBeans.getBean(TblDeviceHeaterServiceImpl.class);
|
||||
//查询
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ public class EventSupport {
|
|||
try {
|
||||
parseEventEntity();
|
||||
Class<?> eventClazz = Class.forName(this.eventName);
|
||||
Method method = eventClazz.getMethod(this.eventProcess);
|
||||
Method method = eventClazz.getDeclaredMethod(this.eventProcess,Object.class);
|
||||
method.setAccessible(true);
|
||||
method.invoke(eventClazz.newInstance());
|
||||
method.invoke(eventClazz.newInstance(),this.eventEntity);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage(),e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue