|
@@ -1764,7 +1764,7 @@ public class ScadaServiceImpl extends ServiceImpl<ScadaMapper, Scada> implements
|
|
|
List<DeviceArchiveManage> manages = deviceArchiveManageService.list();
|
|
|
|
|
|
List<Allocation> parameterList = new ArrayList<>();
|
|
|
- List<Allocation> parameters = allocationService.list();
|
|
|
+ List<Allocation> parameters = allocationMapper.selectList(new QueryWrapper<>());
|
|
|
for (DeviceArchiveManage deviceArchiveManage : manages) {
|
|
|
List<Allocation> parametersFinal = new ArrayList<>();
|
|
|
if (CollUtil.isNotEmpty(parameters)) {
|
|
@@ -1777,14 +1777,21 @@ public class ScadaServiceImpl extends ServiceImpl<ScadaMapper, Scada> implements
|
|
|
if (CollUtil.isNotEmpty(parameterList)) {
|
|
|
parameterList = parameterList.stream().collect(Collectors.collectingAndThen(Collectors
|
|
|
.toCollection(() -> new TreeSet<>(Comparator.comparing(Allocation::getVariableCode))), ArrayList::new));
|
|
|
- parameterList.forEach(allocationService::save);
|
|
|
+ List<String> codeFilterList = parameters.stream().map(Allocation::getVariableCode).collect(Collectors.toList());
|
|
|
+ parameterList.forEach(info -> {
|
|
|
+ if (codeFilterList.contains(info.getVariableCode())) {
|
|
|
+ allocationMapper.update(info, new QueryWrapper<Allocation>().lambda().eq(Allocation::getVariableCode, info.getVariableCode()));
|
|
|
+ } else {
|
|
|
+ allocationMapper.insert(info);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
List<String> monitorCodeList = scadaMonitorService.list().stream().map(ScadaMonitor::getCode).collect(Collectors.toList());
|
|
|
- List<Allocation> parameterAll = allocationService.list();
|
|
|
+ List<Allocation> parameterAll = allocationMapper.selectList(new QueryWrapper<>());
|
|
|
List<Allocation> parameterPart = parameterAll.stream().filter(e -> !monitorCodeList.contains(e.getVariableCode())).collect(Collectors.toList());
|
|
|
if (CollUtil.isNotEmpty(parameterPart)) {
|
|
|
if (parameterPart.size() <= 500) {
|
|
|
- allocationService.remove(new QueryWrapper<Allocation>().lambda().in(Allocation::getVariableCode, parameterPart.stream().map(Allocation::getVariableCode).collect(Collectors.toList())));
|
|
|
+ allocationMapper.delete(new QueryWrapper<Allocation>().lambda().in(Allocation::getVariableCode, parameterPart.stream().map(Allocation::getVariableCode).collect(Collectors.toList())));
|
|
|
} else {
|
|
|
int times = parameterPart.size() / 500;
|
|
|
for (int i = 0; i <= times; i++) {
|
|
@@ -1792,7 +1799,7 @@ public class ScadaServiceImpl extends ServiceImpl<ScadaMapper, Scada> implements
|
|
|
if (CollUtil.isEmpty(allocationListFinal)) {
|
|
|
continue;
|
|
|
}
|
|
|
- allocationService.remove(new QueryWrapper<Allocation>().lambda().in(Allocation::getVariableCode, allocationListFinal.stream().map(Allocation::getVariableCode).collect(Collectors.toList())));
|
|
|
+ allocationMapper.delete(new QueryWrapper<Allocation>().lambda().in(Allocation::getVariableCode, allocationListFinal.stream().map(Allocation::getVariableCode).collect(Collectors.toList())));
|
|
|
}
|
|
|
}
|
|
|
}
|