|
@@ -1,6 +1,5 @@
|
|
|
package com.siwei.apply.service.cadastre.impl;
|
|
package com.siwei.apply.service.cadastre.impl;
|
|
|
|
|
|
|
|
-import com.siwei.apply.common.Constant;
|
|
|
|
|
import com.siwei.apply.domain.GongdiJihua;
|
|
import com.siwei.apply.domain.GongdiJihua;
|
|
|
import com.siwei.apply.domain.LandType;
|
|
import com.siwei.apply.domain.LandType;
|
|
|
import com.siwei.apply.domain.cadastre.*;
|
|
import com.siwei.apply.domain.cadastre.*;
|
|
@@ -15,8 +14,6 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
-import java.math.RoundingMode;
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -56,8 +53,11 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
filterVo.setYear(year);
|
|
filterVo.setYear(year);
|
|
|
filterVo.setPageSize(100000);
|
|
filterVo.setPageSize(100000);
|
|
|
List<GongdiJihua> list = gongdiJihuaMapper.getList(filterVo);
|
|
List<GongdiJihua> list = gongdiJihuaMapper.getList(filterVo);
|
|
|
|
|
+ List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(year,null);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(year);
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(list)) {
|
|
if(CollectionUtils.isNotEmpty(list)) {
|
|
|
double completeRate =0;
|
|
double completeRate =0;
|
|
@@ -120,7 +120,6 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
Set<String> allCategories = new HashSet<>(planAreaMap.keySet());
|
|
Set<String> allCategories = new HashSet<>(planAreaMap.keySet());
|
|
|
allCategories.addAll(completeAreaMap.keySet());
|
|
allCategories.addAll(completeAreaMap.keySet());
|
|
|
|
|
|
|
@@ -133,86 +132,120 @@ public class SupplyServiceImpl implements ISupplyService {
|
|
|
}
|
|
}
|
|
|
res.setLandUseStatisticsList(landUseStatisticsList);
|
|
res.setLandUseStatisticsList(landUseStatisticsList);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // 根据当前list中的字段,统计不同供应方式(gyfs)进行分组,如果是 gyfs=划拨或出让分别分组,其它为一组,然后分别计算每个供应方式的计划供应面积(mjMu)和完成供应面积(0填充),最后封装成 ProjectSupplyRes 对象添加到 projectSupplyList 中
|
|
|
|
|
List<ProjectSupplyRes> projectSupplyList = new ArrayList<>(); // 供应方式
|
|
List<ProjectSupplyRes> projectSupplyList = new ArrayList<>(); // 供应方式
|
|
|
|
|
|
|
|
- // 预先按供应方式对已完成列表进行分组求和
|
|
|
|
|
- Map<String, Double> completeModeAreaMap = new HashMap<>();
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(completeList)) {
|
|
|
|
|
- for (TdgyStatisticsRes g : completeList) {
|
|
|
|
|
- String mode = g.getGyfs();
|
|
|
|
|
- String category = ("划拨".equals(mode) || "出让".equals(mode)) ? mode : "其它";
|
|
|
|
|
- double area = g.getMjMu() != null ? g.getMjMu().doubleValue() : 0.0;
|
|
|
|
|
- completeModeAreaMap.put(category, completeModeAreaMap.getOrDefault(category, 0.0) + area);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 1. 划拨
|
|
// 1. 划拨
|
|
|
- List<GongdiJihua> hbList = list.stream()
|
|
|
|
|
|
|
+ List<TdgyStatisticsRes> hbList = completeList.stream()
|
|
|
.filter(g -> "划拨".equals(g.getGyfs()))
|
|
.filter(g -> "划拨".equals(g.getGyfs()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(hbList)) {
|
|
|
|
|
- ProjectSupplyRes resHb = new ProjectSupplyRes();
|
|
|
|
|
- resHb.setGdType("划拨");
|
|
|
|
|
- resHb.setGdUnit("亩");
|
|
|
|
|
- resHb.setCount(hbList.size());
|
|
|
|
|
- float hbPlanArea = (float) hbList.stream()
|
|
|
|
|
- .filter(g -> g.getMjMu() != null)
|
|
|
|
|
- .mapToDouble(g -> g.getMjMu().doubleValue())
|
|
|
|
|
- .sum();
|
|
|
|
|
- resHb.setPlanArea(hbPlanArea);
|
|
|
|
|
- resHb.setGdArea(hbPlanArea);
|
|
|
|
|
- resHb.setCompleteArea(completeModeAreaMap.getOrDefault("划拨", 0.0).floatValue());
|
|
|
|
|
- projectSupplyList.add(resHb);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ProjectSupplyRes resHb = new ProjectSupplyRes();
|
|
|
|
|
+ resHb.setGdType("划拨");
|
|
|
|
|
+ resHb.setGdUnit("亩");
|
|
|
|
|
+ resHb.setCount(hbList.size());
|
|
|
|
|
+ float hbPlanArea = (float) hbList.stream()
|
|
|
|
|
+ .filter(g -> g.getMjMu() != null)
|
|
|
|
|
+ .mapToDouble(g -> g.getMjMu().doubleValue())
|
|
|
|
|
+ .sum();
|
|
|
|
|
+ resHb.setGdArea(hbPlanArea);
|
|
|
|
|
+ projectSupplyList.add(resHb);
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 2. 出让
|
|
// 2. 出让
|
|
|
- List<GongdiJihua> crList = list.stream()
|
|
|
|
|
|
|
+ List<TdgyStatisticsRes> crList = completeList.stream()
|
|
|
.filter(g -> "出让".equals(g.getGyfs()))
|
|
.filter(g -> "出让".equals(g.getGyfs()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(crList)) {
|
|
|
|
|
- ProjectSupplyRes resCr = new ProjectSupplyRes();
|
|
|
|
|
- resCr.setGdType("出让");
|
|
|
|
|
- resCr.setGdUnit("亩");
|
|
|
|
|
- resCr.setCount(crList.size());
|
|
|
|
|
- float crPlanArea = (float) crList.stream()
|
|
|
|
|
- .filter(g -> g.getMjMu() != null)
|
|
|
|
|
- .mapToDouble(g -> g.getMjMu().doubleValue())
|
|
|
|
|
- .sum();
|
|
|
|
|
- resCr.setPlanArea(crPlanArea);
|
|
|
|
|
- resCr.setGdArea(crPlanArea);
|
|
|
|
|
- resCr.setCompleteArea(completeModeAreaMap.getOrDefault("出让", 0.0).floatValue());
|
|
|
|
|
- projectSupplyList.add(resCr);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ProjectSupplyRes resCr = new ProjectSupplyRes();
|
|
|
|
|
+ resCr.setGdType("出让");
|
|
|
|
|
+ resCr.setGdUnit("亩");
|
|
|
|
|
+ resCr.setCount(crList.size());
|
|
|
|
|
+ float crPlanArea = (float) crList.stream()
|
|
|
|
|
+ .filter(g -> g.getMjMu() != null)
|
|
|
|
|
+ .mapToDouble(g -> g.getMjMu().doubleValue())
|
|
|
|
|
+ .sum();
|
|
|
|
|
+ resCr.setGdArea(crPlanArea);
|
|
|
|
|
+ projectSupplyList.add(resCr);
|
|
|
|
|
|
|
|
// 3. 其它
|
|
// 3. 其它
|
|
|
- List<GongdiJihua> qtList = list.stream()
|
|
|
|
|
|
|
+ List<TdgyStatisticsRes> qtList = completeList.stream()
|
|
|
.filter(g -> !"划拨".equals(g.getGyfs()) && !"出让".equals(g.getGyfs()))
|
|
.filter(g -> !"划拨".equals(g.getGyfs()) && !"出让".equals(g.getGyfs()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(qtList)) {
|
|
|
|
|
- ProjectSupplyRes resQt = new ProjectSupplyRes();
|
|
|
|
|
- resQt.setGdType("其它");
|
|
|
|
|
- resQt.setGdUnit("亩");
|
|
|
|
|
- resQt.setCount(qtList.size());
|
|
|
|
|
- float qtPlanArea = (float) qtList.stream()
|
|
|
|
|
- .filter(g -> g.getMjMu() != null)
|
|
|
|
|
- .mapToDouble(g -> g.getMjMu().doubleValue())
|
|
|
|
|
- .sum();
|
|
|
|
|
- resQt.setPlanArea(qtPlanArea);
|
|
|
|
|
- resQt.setGdArea(qtPlanArea);
|
|
|
|
|
- resQt.setCompleteArea(completeModeAreaMap.getOrDefault("其它", 0.0).floatValue());
|
|
|
|
|
- projectSupplyList.add(resQt);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ProjectSupplyRes resQt = new ProjectSupplyRes();
|
|
|
|
|
+ resQt.setGdType("其它");
|
|
|
|
|
+ resQt.setGdUnit("亩");
|
|
|
|
|
+ resQt.setCount(qtList.size());
|
|
|
|
|
+ float qtPlanArea = (float) qtList.stream()
|
|
|
|
|
+ .filter(g -> g.getMjMu() != null)
|
|
|
|
|
+ .mapToDouble(g -> g.getMjMu().doubleValue())
|
|
|
|
|
+ .sum();
|
|
|
|
|
+ resQt.setGdArea(qtPlanArea);
|
|
|
|
|
+ projectSupplyList.add(resQt);
|
|
|
res.setProjectSupplyList(projectSupplyList);
|
|
res.setProjectSupplyList(projectSupplyList);
|
|
|
}
|
|
}
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param landType
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TrendStatisticsRes trendStatistics(String landType) {
|
|
|
|
|
+
|
|
|
|
|
+ List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(null, landType);
|
|
|
|
|
+
|
|
|
|
|
+ TrendStatisticsRes res = new TrendStatisticsRes();
|
|
|
|
|
+ List<Map<String, Object>> areaTrendStatisticsList = new ArrayList<>();
|
|
|
|
|
+ List<Map<String, Object>> supplyModeStatisticsList = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(completeList)) {
|
|
|
|
|
+ Map<Integer, Double> areaByYear = new LinkedHashMap<>();
|
|
|
|
|
+ Map<Integer, Map<String, Double>> modeAreaByYear = new LinkedHashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ for (TdgyStatisticsRes item : completeList) {
|
|
|
|
|
+ if (item.getGysj() != null) {
|
|
|
|
|
+ int year = item.getGysj().getYear() + 1900;
|
|
|
|
|
+ double area = item.getMjMu() != null ? item.getMjMu().doubleValue() : 0.0;
|
|
|
|
|
+ String gyfs = item.getGyfs();
|
|
|
|
|
+
|
|
|
|
|
+ areaByYear.merge(year, area, Double::sum);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Double> yearModeMap = modeAreaByYear.computeIfAbsent(year, k -> new HashMap<>());
|
|
|
|
|
+ if ("划拨".equals(gyfs)) {
|
|
|
|
|
+ yearModeMap.merge("allocate", area, Double::sum);
|
|
|
|
|
+ } else if ("出让".equals(gyfs)) {
|
|
|
|
|
+ yearModeMap.merge("transfer", area, Double::sum);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ yearModeMap.merge("other", area, Double::sum);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ areaByYear.forEach((year, area) -> {
|
|
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
+ map.put("year", year);
|
|
|
|
|
+ map.put("area", area);
|
|
|
|
|
+ areaTrendStatisticsList.add(map);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ modeAreaByYear.forEach((year, modeAreas) -> {
|
|
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
+ map.put("year", year);
|
|
|
|
|
+ map.put("transferArea", modeAreas.getOrDefault("transfer", 0.0));
|
|
|
|
|
+ map.put("allocateArea", modeAreas.getOrDefault("allocate", 0.0));
|
|
|
|
|
+ map.put("otherArea", modeAreas.getOrDefault("other", 0.0));
|
|
|
|
|
+ supplyModeStatisticsList.add(map);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ res.setAreaTrendStatisticsList(areaTrendStatisticsList);
|
|
|
|
|
+ res.setSupplyModeStatisticsList(supplyModeStatisticsList);
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public LandSupplyReportDTO getTdgyReport(String startTime, String endTime) {
|
|
public LandSupplyReportDTO getTdgyReport(String startTime, String endTime) {
|