|
|
@@ -7,6 +7,7 @@ import com.siwei.apply.domain.res.*;
|
|
|
import com.siwei.apply.domain.vo.LandSupplyProjectVO;
|
|
|
import com.siwei.apply.mapper.GjShijiShouchuMapper;
|
|
|
import com.siwei.apply.mapper.GjShouchuJihuaMapper;
|
|
|
+import com.siwei.apply.mapper.TdgyMapper;
|
|
|
import com.siwei.common.core.utils.StringUtils;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -26,6 +27,10 @@ public class StorageServiceImpl {
|
|
|
@Autowired
|
|
|
private GjShouchuJihuaMapper gjShouchuJihuaMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TdgyMapper tdgyMapper;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
public LandStorageInOutReportDTO inOutDetails() {
|
|
|
LandStorageInOutReportDTO report = new LandStorageInOutReportDTO();
|
|
|
@@ -33,6 +38,9 @@ public class StorageServiceImpl {
|
|
|
List<LandStorageInOutReportDTO.CategoryDTO> categoryList = new ArrayList();
|
|
|
|
|
|
List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(null, null,null,null, null, null);
|
|
|
+ //出库数据
|
|
|
+ List<TdgyStatisticsRes> completeSjgdList = tdgyMapper.getSjgdListByNf("2021", "2026");
|
|
|
+
|
|
|
|
|
|
String [] yearArr = {"all","2021","2022","2023","2024","2025","2026","other"};
|
|
|
|
|
|
@@ -51,8 +59,25 @@ public class StorageServiceImpl {
|
|
|
Set<String> categorySet = new HashSet<>(groupedCompleteMap.keySet());
|
|
|
categorySet.add("其它");
|
|
|
|
|
|
+ //实际供地数据需要根据其情况进行统计
|
|
|
+ Map<String, List<TdgyStatisticsRes>> groupedCompleteSjgdMap = completeSjgdList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ s -> {
|
|
|
+ String tdyt = s.getTdyt();
|
|
|
+ if (StringUtils.isNotBlank(tdyt) && categorySet.contains(tdyt)) {
|
|
|
+ return tdyt;
|
|
|
+ }
|
|
|
+ return "其它";
|
|
|
+ }
|
|
|
+ ));
|
|
|
+
|
|
|
for(String category : categorySet){
|
|
|
List<TdgyStatisticsRes> categoryCompleteList = groupedCompleteMap.get(category);
|
|
|
+ List<TdgyStatisticsRes> groupedCompleteSjgdList = groupedCompleteSjgdMap.get(category);
|
|
|
+
|
|
|
+ List<LandStorageInOutReportDTO.ItemDTO> inList = new ArrayList<>();
|
|
|
+ List<LandStorageInOutReportDTO.ItemDTO> outList = new ArrayList<>();
|
|
|
+
|
|
|
if(CollectionUtils.isNotEmpty(categoryCompleteList)){
|
|
|
// 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
|
|
|
Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
|
|
|
@@ -68,7 +93,6 @@ public class StorageServiceImpl {
|
|
|
Collectors.counting()
|
|
|
));
|
|
|
|
|
|
- List<LandStorageInOutReportDTO.ItemDTO> inList = new ArrayList<>();
|
|
|
for (String year : yearArr) {
|
|
|
LandStorageInOutReportDTO.ItemDTO item = new LandStorageInOutReportDTO.ItemDTO();
|
|
|
item.setYear(year);
|
|
|
@@ -80,24 +104,47 @@ public class StorageServiceImpl {
|
|
|
}
|
|
|
inList.add(item);
|
|
|
}
|
|
|
+ }
|
|
|
+ //这里解析out数据
|
|
|
+ if(CollectionUtils.isNotEmpty(groupedCompleteSjgdList)){
|
|
|
+ // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
|
|
|
+ Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
|
|
|
+ Map<String, Long> yearCountMap = categoryCompleteList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ s -> {
|
|
|
+ String nf = s.getNf();
|
|
|
+ if (StringUtils.isNotBlank(nf) && definedYears.contains(nf)) {
|
|
|
+ return nf;
|
|
|
+ }
|
|
|
+ return "other";
|
|
|
+ },
|
|
|
+ Collectors.counting()
|
|
|
+ ));
|
|
|
|
|
|
- LandStorageInOutReportDTO.CategoryDTO categoryDTO = new LandStorageInOutReportDTO.CategoryDTO();
|
|
|
- LandStorageInOutReportDTO.DetailDTO inOut = new LandStorageInOutReportDTO.DetailDTO();
|
|
|
- inOut.setIn(inList);
|
|
|
- inOut.setOut(null); //这里暂时为空
|
|
|
- categoryDTO.setCategory(category);
|
|
|
- categoryDTO.setDetail(inOut);
|
|
|
- categoryList.add(categoryDTO);
|
|
|
+ for (String year : yearArr) {
|
|
|
+ LandStorageInOutReportDTO.ItemDTO item = new LandStorageInOutReportDTO.ItemDTO();
|
|
|
+ item.setYear(year);
|
|
|
+ if ("all".equals(year)) {
|
|
|
+ // all 统计当前分类下不区分 nf 的所有数据加总
|
|
|
+ item.setCount(String.valueOf(categoryCompleteList.size()));
|
|
|
+ } else {
|
|
|
+ item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
|
|
|
+ }
|
|
|
+ outList.add(item);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ LandStorageInOutReportDTO.CategoryDTO categoryDTO = new LandStorageInOutReportDTO.CategoryDTO();
|
|
|
+ LandStorageInOutReportDTO.DetailDTO inOut = new LandStorageInOutReportDTO.DetailDTO();
|
|
|
+ inOut.setIn(inList);
|
|
|
+ inOut.setOut(outList);
|
|
|
+ categoryDTO.setCategory(category);
|
|
|
+ categoryDTO.setDetail(inOut);
|
|
|
+ categoryList.add(categoryDTO);
|
|
|
}
|
|
|
report.setCategoryList(categoryList);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // -----------------第二部分计算----------------------------
|
|
|
+ // -----------------第二部分合计行的计算----------------------------
|
|
|
//todo 这里计算加总,合计的一行,使用completeList 直接算每一年的值,
|
|
|
LandStorageInOutReportDTO.CategoryDTO summary = new LandStorageInOutReportDTO.CategoryDTO();
|
|
|
summary.setCategory("合计");
|