|
@@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.boot.autoconfigure.condition.SearchStrategy;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -90,22 +91,31 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
}
|
|
}
|
|
|
// 统计结果
|
|
// 统计结果
|
|
|
List<ArchiveStatisticsRVO> tree = selectStatisticsMapper.selectArchiveStatistics(vo);
|
|
List<ArchiveStatisticsRVO> tree = selectStatisticsMapper.selectArchiveStatistics(vo);
|
|
|
- //二级分类集合
|
|
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
|
|
- List<ArchivesTreeDTO> archivesTreeDTOS = archivesTreeService.selectByOrder();
|
|
|
|
|
- archivesTreeDTOS.forEach(dto -> {
|
|
|
|
|
- if (dto.getParentId() != -1) {
|
|
|
|
|
- for (ArchivesTreeDTO dt : archivesTreeDTOS) {
|
|
|
|
|
- if (dto.getParentId() == dt.getId()) {
|
|
|
|
|
- list.add(dt.getCode());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+// //二级分类集合
|
|
|
|
|
+// List<String> list = new ArrayList<>();
|
|
|
|
|
+// List<ArchivesTreeDTO> archivesTreeDTOS = archivesTreeService.selectByOrder();
|
|
|
|
|
+// archivesTreeDTOS.forEach(dto -> {
|
|
|
|
|
+// if (dto.getParentId() != -1) {
|
|
|
|
|
+// for (ArchivesTreeDTO dt : archivesTreeDTOS) {
|
|
|
|
|
+// if (dto.getParentId() == dt.getId()) {
|
|
|
|
|
+// list.add(dt.getCode());
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// });
|
|
|
//占用磁盘大小临时存储到map
|
|
//占用磁盘大小临时存储到map
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
Map<String, Long> map = new HashMap<>();
|
|
|
|
|
+ List<ArchivesTreeDTO> archiveTrees = archivesTreeService.selectAll();
|
|
|
|
|
+ archiveTrees.forEach(i -> {
|
|
|
|
|
+ map.put(i.getCode(), 0L);
|
|
|
|
|
+ });
|
|
|
// 档案文件根目录
|
|
// 档案文件根目录
|
|
|
File baseDir = FileUtil.file(this.baseDir);
|
|
File baseDir = FileUtil.file(this.baseDir);
|
|
|
|
|
+ // 统计总数的一级档案数
|
|
|
|
|
+ List<String> calcSumType = new ArrayList<String>(){{
|
|
|
|
|
+ add("WS");
|
|
|
|
|
+ add("SJ");
|
|
|
|
|
+ }};
|
|
|
//占用磁盘的总大小
|
|
//占用磁盘的总大小
|
|
|
Long hj=0l;
|
|
Long hj=0l;
|
|
|
if (FileUtil.exist(baseDir) && FileUtil.isDirectory(baseDir)) {
|
|
if (FileUtil.exist(baseDir) && FileUtil.isDirectory(baseDir)) {
|
|
@@ -117,26 +127,27 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
if (ObjectUtil.isNotEmpty(year)) {
|
|
if (ObjectUtil.isNotEmpty(year)) {
|
|
|
//分类
|
|
//分类
|
|
|
for (File category : year.listFiles()) {
|
|
for (File category : year.listFiles()) {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
if (ObjectUtil.isNotEmpty(category)) {
|
|
if (ObjectUtil.isNotEmpty(category)) {
|
|
|
- if (list.contains(category.getName())) {
|
|
|
|
|
- //二级分类
|
|
|
|
|
- for (File category2 : category.listFiles()) {
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(category2)) {
|
|
|
|
|
- Long s1 = this.getLinuxDirectorySize(category);
|
|
|
|
|
- hj+=s1;
|
|
|
|
|
- if (map.keySet().stream().anyMatch(i -> i.equals(category2.getName()))){
|
|
|
|
|
- map.put(category2.getName(),map.get(category2.getName()) + s1);
|
|
|
|
|
- }else {
|
|
|
|
|
- map.put(category2.getName(),s1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 一级档案数分类
|
|
|
|
|
+ if (map.keySet().stream().anyMatch(i -> i.equals(category.getName()))){
|
|
|
|
|
+ long histryFileSize = Long.parseLong(map.get(category.getName()).toString());
|
|
|
|
|
+ Long currFileSize = this.getLinuxDirectorySize(category);
|
|
|
|
|
+ histryFileSize += currFileSize;
|
|
|
|
|
+ map.put(category.getName(), histryFileSize );
|
|
|
|
|
+ if (calcSumType.contains(category.getName())){
|
|
|
|
|
+ hj +=currFileSize;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 二级档案数
|
|
|
|
|
+ for (File category2 : category.listFiles()) {
|
|
|
|
|
+ if (map.keySet().stream().anyMatch(i -> i.equals(category2.getName()))){
|
|
|
|
|
+ long histryFileSize = Long.parseLong(map.get(category2.getName()).toString());
|
|
|
|
|
+ Long currFileSize = this.getLinuxDirectorySize(category2);
|
|
|
|
|
+ histryFileSize += currFileSize;
|
|
|
|
|
+ map.put(category2.getName(), histryFileSize );
|
|
|
|
|
+ hj +=currFileSize;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- Long s2 = this.getLinuxDirectorySize(category);
|
|
|
|
|
- hj+=s2;
|
|
|
|
|
- map.put(category.getName(), s2);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|