映射表保存,链路绑定设备代码优化
This commit is contained in:
parent
fe615898e6
commit
b1a5b68c98
@ -43,6 +43,7 @@ import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -51,6 +52,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -398,17 +400,22 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
}
|
||||
}
|
||||
//批量更新
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start("绑定设备新增映射表关联开始");
|
||||
if (!CollectionUtils.isEmpty(addList)) {
|
||||
ListUtil.page(addList,COMMIT_COUNT, item -> {
|
||||
sysImptabmappingMapper.insertOrUpdateBatch(item);
|
||||
sysImptabmappingMapper.insertBatch(item);
|
||||
});
|
||||
|
||||
}
|
||||
stopWatch.stop();
|
||||
stopWatch.start("绑定设备更新映射表关联开始");
|
||||
if (!CollectionUtils.isEmpty(updateList)) {
|
||||
ListUtil.page(updateList,COMMIT_COUNT, item -> {
|
||||
sysImptabmappingMapper.insertOrUpdateBatch(item);
|
||||
sysImptabmappingMapper.updateBatchById(item);
|
||||
});
|
||||
}
|
||||
stopWatch.stop();
|
||||
stopWatch.start("绑定设备删除映射表关联开始");
|
||||
//删除为匹配的历史配置
|
||||
List<Long> deleteList = new ArrayList<>();
|
||||
for(SysTabMappingVo item : mappingVoMap.values()){
|
||||
@ -421,7 +428,8 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
sysImptabmappingMapper.deleteBatchIds(item);
|
||||
});
|
||||
}
|
||||
|
||||
stopWatch.stop();
|
||||
log.debug("绑定设备时间{}",stopWatch.prettyPrint(TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user