fix(产品管理): 产品启用时会重复触发DeviceProductDeployEvent事件 (#513)
Co-authored-by: XIXUANHAO <xi_xh@foxmail.com>
This commit is contained in:
parent
6dc16ce715
commit
9b9545ecca
|
|
@ -3,6 +3,7 @@ package org.jetlinks.community.device.service;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
|
import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
|
||||||
import org.hswebframework.web.bean.FastBeanCopier;
|
import org.hswebframework.web.bean.FastBeanCopier;
|
||||||
|
import org.hswebframework.web.crud.events.EntityEventHelper;
|
||||||
import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
||||||
import org.hswebframework.web.exception.BusinessException;
|
import org.hswebframework.web.exception.BusinessException;
|
||||||
import org.jetlinks.community.device.entity.DeviceInstanceEntity;
|
import org.jetlinks.community.device.entity.DeviceInstanceEntity;
|
||||||
|
|
@ -43,6 +44,7 @@ public class LocalDeviceProductService extends GenericReactiveCrudService<Device
|
||||||
.set(DeviceProductEntity::getState, DeviceProductState.registered.getValue())
|
.set(DeviceProductEntity::getState, DeviceProductState.registered.getValue())
|
||||||
.where(DeviceProductEntity::getId, id)
|
.where(DeviceProductEntity::getId, id)
|
||||||
.execute()
|
.execute()
|
||||||
|
.as(EntityEventHelper::setDoNotFireEvent)
|
||||||
)
|
)
|
||||||
.flatMap(i -> FastBeanCopier
|
.flatMap(i -> FastBeanCopier
|
||||||
.copy(product, new DeviceProductDeployEvent())
|
.copy(product, new DeviceProductDeployEvent())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue