Commit edf2d95e authored by 赵啸非's avatar 赵啸非

添加皮肤相关

parent 621e95a3
Pipeline #2573 failed with stages
...@@ -85,6 +85,8 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService { ...@@ -85,6 +85,8 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
List<DeviceEntity> oldDeviceList = deviceService.find(new DeviceQuery().siteId(site.getId())); List<DeviceEntity> oldDeviceList = deviceService.find(new DeviceQuery().siteId(site.getId()));
Map<String, DeviceEntity> oldDeviceMap = oldDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n)); Map<String, DeviceEntity> oldDeviceMap = oldDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
Map<String, DeviceEntity> newDeviceMap = newDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
List<DeviceEntity> updateDeviceLsit = newDeviceList.stream().map(item -> { List<DeviceEntity> updateDeviceLsit = newDeviceList.stream().map(item -> {
if (oldDeviceMap.containsKey(item.getDeviceCode())) { if (oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setId(oldDeviceMap.get(item.getDeviceCode()).getId()); item.setId(oldDeviceMap.get(item.getDeviceCode()).getId());
...@@ -107,6 +109,16 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService { ...@@ -107,6 +109,16 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
return null; return null;
}).filter(f -> f != null).collect(Collectors.toList()); }).filter(f -> f != null).collect(Collectors.toList());
//做差集
List<Long> delDeviceList = oldDeviceList.stream().map(item -> {
if (!newDeviceMap.containsKey(item.getDeviceCode())) {
return item.getId();
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateDeviceLsit)) { if (!ObjectUtils.isEmpty(updateDeviceLsit)) {
log.info("设备更新,size:{}", updateDeviceLsit.size()); log.info("设备更新,size:{}", updateDeviceLsit.size());
deviceService.update(updateDeviceLsit); deviceService.update(updateDeviceLsit);
...@@ -116,6 +128,11 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService { ...@@ -116,6 +128,11 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
log.info("设备新增,size:{}", saveDeviceList.size()); log.info("设备新增,size:{}", saveDeviceList.size());
deviceService.save(saveDeviceList); deviceService.save(saveDeviceList);
} }
if (!ObjectUtils.isEmpty(delDeviceList)) {
log.info("设备删除,size:{}", delDeviceList.size());
deviceService.remove(delDeviceList,null);
}
} }
} else { } else {
log.info("设备列表查询异常,{}", JSON.toJSONString(deviceRest)); log.info("设备列表查询异常,{}", JSON.toJSONString(deviceRest));
......
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