Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
王兴琳 9 months ago
parent
commit
0e2d6c72ef
  1. 15
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  2. 2
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  3. 12
      zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java
  4. 18
      zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java

15
zc-business/src/main/java/com/zc/business/controller/VideoController.java

@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.domain.DcDevice;
import com.zc.business.service.IDcDeviceService;
import com.zc.business.service.IMiddleDatabaseService;
import com.zc.common.core.httpclient.OkHttp;
import com.zc.common.core.httpclient.exception.HttpException;
import com.zc.common.core.httpclient.request.RequestParams;
@ -59,6 +60,9 @@ public class VideoController extends BaseController {
@Resource
private IDcDeviceService iDcDeviceService;
@Resource
private IMiddleDatabaseService middleDatabaseService;
/**
* 查询附近相机
*/
@ -137,6 +141,10 @@ public class VideoController extends BaseController {
}
iDcDeviceService.batchUpdate(list);
//更新中间库的设备状态
middleDatabaseService.updateMiddleDatabaseDeviceByList(list);
logger.debug("执行:同步数据平台视频设备的设备状态成功!!");
}
@ -153,6 +161,10 @@ public class VideoController extends BaseController {
dcDevices.add(dcDevice);
}
iDcDeviceService.batchUpdate(dcDevices);
//更新中间库的设备状态
middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices);
logger.debug("执行:同步物联平台设备的设备状态成功!!");
}
@ -168,6 +180,9 @@ public class VideoController extends BaseController {
LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DcDevice::getIotDeviceId, dcDevice.getIotDeviceId());
iDcDeviceService.update(dcDevice, queryWrapper);
//更新中间库的设备状态
middleDatabaseService.updateMiddleDatabaseDevice(dcDevice);
}
logger.debug("执行:同步广播设备的设备状态成功!!");

2
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -71,7 +71,7 @@ public class DeviceMessageHandler {
dcDeviceService.batchUpdate(dcDevices);
// 批量更新中间库设备状态
middleDatabaseService.updateMiddleDatabaseDevice(dcDevices);
middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices);
}
/**

12
zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java

@ -25,11 +25,19 @@ public interface IMiddleDatabaseService
boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData);
/**
* 更新中间库设备
* 批量更新中间库设备
*
* @param listDevice 设备列表
* @return 结果
*/
boolean updateMiddleDatabaseDevice(List<DcDevice> listDevice);
boolean updateMiddleDatabaseDeviceByList(List<DcDevice> listDevice);
/**
* 更新中间库设备
*
* @param device 设备
* @return 结果
*/
boolean updateMiddleDatabaseDevice(DcDevice device);
}

18
zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java

@ -40,18 +40,32 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService {
/**
* 更新中间库设备
* 批量更新中间库设备
*
* @param listDevice 设备列表
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean updateMiddleDatabaseDevice(List<DcDevice> listDevice)
public boolean updateMiddleDatabaseDeviceByList(List<DcDevice> listDevice)
{
for (DcDevice dcDevice : listDevice) {
middleDatabaseMapper.updateMiddleDatabaseDevice(dcDevice);
}
return true;
}
/**
* 更新中间库设备
*
* @param device 设备
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean updateMiddleDatabaseDevice(DcDevice device)
{
return middleDatabaseMapper.updateMiddleDatabaseDevice(device);
}
}

Loading…
Cancel
Save