Commit 33f20e7b authored by 赵啸非's avatar 赵啸非

添加设备在线离线修正任务

parent 812962b2
......@@ -4,11 +4,16 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -28,6 +33,10 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
private DeviceService deviceService;
@Autowired
private ICacheService cacheService;
@Autowired
private ProductService productService;
@Autowired
private PlatformService platformService;
@Override
public void excuteTask(ITask task) throws AppException {
......@@ -46,6 +55,16 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
if (!ObjectUtils.isEmpty(deviceOfflineList)) {
deviceService.update(deviceOfflineList);
deviceOfflineList.forEach(deviceEntity -> {
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//通知第三方平台
deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.OFFLINE);
}
});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment