|
@@ -41,8 +41,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
-import javax.persistence.Id;
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -78,7 +78,7 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<ArchiveStatisticsRVO> selectStatisticsByType(StatisticsVO vo) {
|
|
public List<ArchiveStatisticsRVO> selectStatisticsByType(StatisticsVO vo) {
|
|
|
String key = String.format(DataGlobalVariable.CACHE_KEY_FOMAT, this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName(), JSONObject.toJSONString(vo));
|
|
String key = String.format(DataGlobalVariable.CACHE_KEY_FOMAT, this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName(), JSONObject.toJSONString(vo));
|
|
|
- if (false) {
|
|
|
|
|
|
|
+ if (stringRedisTemplate.hasKey(key)) {
|
|
|
return JSONArray.parseArray(stringRedisTemplate.opsForValue().get(key), ArchiveStatisticsRVO.class);
|
|
return JSONArray.parseArray(stringRedisTemplate.opsForValue().get(key), ArchiveStatisticsRVO.class);
|
|
|
} else {
|
|
} else {
|
|
|
if (vo.getMl() != null) {
|
|
if (vo.getMl() != null) {
|
|
@@ -97,7 +97,7 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
if (dto.getParentId() != -1) {
|
|
if (dto.getParentId() != -1) {
|
|
|
for (ArchivesTreeDTO dt : archivesTreeDTOS) {
|
|
for (ArchivesTreeDTO dt : archivesTreeDTOS) {
|
|
|
if (dto.getParentId() == dt.getId()) {
|
|
if (dto.getParentId() == dt.getId()) {
|
|
|
- list.add(dt.getTitle());
|
|
|
|
|
|
|
+ list.add(dt.getCode());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -117,6 +117,8 @@ 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())) {
|
|
if (list.contains(category.getName())) {
|
|
|
//二级分类
|
|
//二级分类
|
|
@@ -124,7 +126,11 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
if (ObjectUtil.isNotEmpty(category2)) {
|
|
if (ObjectUtil.isNotEmpty(category2)) {
|
|
|
Long s1 = this.getLinuxDirectorySize(category);
|
|
Long s1 = this.getLinuxDirectorySize(category);
|
|
|
hj+=s1;
|
|
hj+=s1;
|
|
|
- map.put(category.getName(), 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);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -138,10 +144,14 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ Map<String,String> map1=new HashMap<>();
|
|
|
//内存大小赋值
|
|
//内存大小赋值
|
|
|
for (Map.Entry<String, Long> entry : map.entrySet()) {
|
|
for (Map.Entry<String, Long> entry : map.entrySet()) {
|
|
|
|
|
+ map1.put(entry.getKey(),UnitUtils.storageUnitConvertStr(entry.getValue()));
|
|
|
|
|
+ }
|
|
|
|
|
+ for (Map.Entry<String, String> entry : map1.entrySet()) {
|
|
|
for (ArchiveStatisticsRVO li : tree) {
|
|
for (ArchiveStatisticsRVO li : tree) {
|
|
|
- if (li.getTitle().equals(entry.getKey())) {
|
|
|
|
|
|
|
+ if (li.getCode().equals(entry.getKey())) {
|
|
|
li.setSpace(entry.getValue());
|
|
li.setSpace(entry.getValue());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -197,7 +207,8 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
hj+=linuxDirectorySize;
|
|
hj+=linuxDirectorySize;
|
|
|
archiveYearStatisticsRVOS.forEach(statisticsRVO -> {
|
|
archiveYearStatisticsRVOS.forEach(statisticsRVO -> {
|
|
|
if (statisticsRVO.getGdnd().equals(year.getName())) {
|
|
if (statisticsRVO.getGdnd().equals(year.getName())) {
|
|
|
- statisticsRVO.setSpace(linuxDirectorySize);
|
|
|
|
|
|
|
+ String s = UnitUtils.storageUnitConvertStr(linuxDirectorySize);
|
|
|
|
|
+ statisticsRVO.setSpace(s);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -205,6 +216,7 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
archiveYearStatisticsRVOS.get(archiveYearStatisticsRVOS.size()-1).setSumSpace(UnitUtils.storageUnitConvertStr(hj));
|
|
archiveYearStatisticsRVOS.get(archiveYearStatisticsRVOS.size()-1).setSumSpace(UnitUtils.storageUnitConvertStr(hj));
|
|
|
stringRedisTemplate.opsForValue().set(key, JSONObject.toJSONString(archiveYearStatisticsRVOS), DataGlobalVariable.CACHE_EXPIRES, DataGlobalVariable.TIME_UNIT);
|
|
stringRedisTemplate.opsForValue().set(key, JSONObject.toJSONString(archiveYearStatisticsRVOS), DataGlobalVariable.CACHE_EXPIRES, DataGlobalVariable.TIME_UNIT);
|
|
|
return archiveYearStatisticsRVOS;
|
|
return archiveYearStatisticsRVOS;
|