Commit 877f1d66 authored by “yiyousong”'s avatar “yiyousong”
parents 1848d909 b7b0349c
......@@ -155,6 +155,9 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
List<SkinEntity> oldSkinList = skinService.find(new SkinQuery());
Map<Long, SkinEntity> oldSkinMap = oldSkinList.stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
Map<Long, SkinEntity> newSkinMap = newSkinList.stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
List<SkinEntity> updateSkinLsit = newSkinList.stream().map(item -> {
if (oldSkinMap.containsKey(item.getId())) {
......@@ -176,6 +179,15 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
}).filter(f -> f != null).collect(Collectors.toList());
//做差集
List<Long> delSkinList = oldSkinList.stream().map(item -> {
if (!newSkinMap.containsKey(item.getId())) {
return item.getId();
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateSkinLsit)) {
log.info("皮肤更新,size:{}", updateSkinLsit.size());
skinService.update(updateSkinLsit);
......@@ -186,6 +198,11 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
skinService.save(saveSkinList);
}
if (!ObjectUtils.isEmpty(delSkinList)) {
log.info("皮肤删除,size:{}", delSkinList.size());
skinService.remove(delSkinList,null);
}
}
}
}
......
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