|
|
@@ -31,7 +31,6 @@ public class StorageServiceImpl {
|
|
|
private TdgyMapper tdgyMapper;
|
|
|
|
|
|
|
|
|
-
|
|
|
public LandStorageInOutReportDTO inOutDetails() {
|
|
|
LandStorageInOutReportDTO report = new LandStorageInOutReportDTO();
|
|
|
report.setTitle("收储出入库分析报表");
|
|
|
@@ -74,11 +73,17 @@ public class StorageServiceImpl {
|
|
|
for(String category : categorySet){
|
|
|
List<TdgyStatisticsRes> categoryCompleteList = groupedCompleteMap.get(category);
|
|
|
List<TdgyStatisticsRes> groupedCompleteSjgdList = groupedCompleteSjgdMap.get(category);
|
|
|
+ if(Objects.isNull(categoryCompleteList)){
|
|
|
+ categoryCompleteList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ if(Objects.isNull(groupedCompleteSjgdList)){
|
|
|
+ groupedCompleteSjgdList = new ArrayList<>();
|
|
|
+ }
|
|
|
|
|
|
List<LandStorageInOutReportDTO.ItemDTO> inList = new ArrayList<>();
|
|
|
List<LandStorageInOutReportDTO.ItemDTO> outList = new ArrayList<>();
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(categoryCompleteList)){
|
|
|
+ if(Objects.nonNull(categoryCompleteList)){
|
|
|
// 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
|
|
|
Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
|
|
|
Map<String, Long> yearCountMap = categoryCompleteList.stream()
|
|
|
@@ -106,10 +111,10 @@ public class StorageServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
//这里解析out数据
|
|
|
- if(CollectionUtils.isNotEmpty(groupedCompleteSjgdList)){
|
|
|
+ if(Objects.nonNull(groupedCompleteSjgdList)){
|
|
|
// 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
|
|
|
Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
|
|
|
- Map<String, Long> yearCountMap = categoryCompleteList.stream()
|
|
|
+ Map<String, Long> yearCountMap = groupedCompleteSjgdList.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
|
s -> {
|
|
|
String nf = s.getNf();
|
|
|
@@ -126,7 +131,7 @@ public class StorageServiceImpl {
|
|
|
item.setYear(year);
|
|
|
if ("all".equals(year)) {
|
|
|
// all 统计当前分类下不区分 nf 的所有数据加总
|
|
|
- item.setCount(String.valueOf(categoryCompleteList.size()));
|
|
|
+ item.setCount(String.valueOf(groupedCompleteSjgdList.size()));
|
|
|
} else {
|
|
|
item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
|
|
|
}
|
|
|
@@ -151,20 +156,74 @@ public class StorageServiceImpl {
|
|
|
LandStorageInOutReportDTO.DetailDTO totalDetail = new LandStorageInOutReportDTO.DetailDTO();
|
|
|
//todo 这里计算 totalInList
|
|
|
List<LandStorageInOutReportDTO.ItemDTO> totalInList = new ArrayList<>();
|
|
|
+
|
|
|
+ //这里计算总量的入库
|
|
|
+ if(Objects.nonNull(completeList)){
|
|
|
+ // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
|
|
|
+ Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
|
|
|
+ Map<String, Long> yearCountMap = completeList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ s -> {
|
|
|
+ String nf = s.getNf();
|
|
|
+ if (StringUtils.isNotBlank(nf) && definedYears.contains(nf)) {
|
|
|
+ return nf;
|
|
|
+ }
|
|
|
+ return "other";
|
|
|
+ },
|
|
|
+ Collectors.counting()
|
|
|
+ ));
|
|
|
+
|
|
|
+ for (String year : yearArr) {
|
|
|
+ LandStorageInOutReportDTO.ItemDTO item = new LandStorageInOutReportDTO.ItemDTO();
|
|
|
+ item.setYear(year);
|
|
|
+ if ("all".equals(year)) {
|
|
|
+ // all 统计当前分类下不区分 nf 的所有数据加总
|
|
|
+ item.setCount(String.valueOf(completeList.size()));
|
|
|
+ } else {
|
|
|
+ item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
|
|
|
+ }
|
|
|
+ totalInList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 这里计算 totalInList
|
|
|
+ List<LandStorageInOutReportDTO.ItemDTO> totalOutList = new ArrayList<>();
|
|
|
+ //这里计算总量的出库
|
|
|
+ if(Objects.nonNull(completeSjgdList)){
|
|
|
+ // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
|
|
|
+ Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
|
|
|
+ Map<String, Long> yearCountMap = completeSjgdList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ s -> {
|
|
|
+ String nf = s.getNf();
|
|
|
+ if (StringUtils.isNotBlank(nf) && definedYears.contains(nf)) {
|
|
|
+ return nf;
|
|
|
+ }
|
|
|
+ return "other";
|
|
|
+ },
|
|
|
+ Collectors.counting()
|
|
|
+ ));
|
|
|
+ for (String year : yearArr) {
|
|
|
+ LandStorageInOutReportDTO.ItemDTO item = new LandStorageInOutReportDTO.ItemDTO();
|
|
|
+ item.setYear(year);
|
|
|
+ if ("all".equals(year)) {
|
|
|
+ // all 统计当前分类下不区分 nf 的所有数据加总
|
|
|
+ item.setCount(String.valueOf(completeSjgdList.size()));
|
|
|
+ } else {
|
|
|
+ item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
|
|
|
+ }
|
|
|
+ totalOutList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
totalDetail.setIn(totalInList);
|
|
|
- totalDetail.setOut(null);
|
|
|
+ totalDetail.setOut(totalOutList);
|
|
|
summary.setDetail(totalDetail);
|
|
|
report.setSummary(summary);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return report;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
//统计分析
|
|
|
public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
|
|
|
LandStorageReportDTO report = new LandStorageReportDTO();
|