|
|
@@ -1,5 +1,6 @@
|
|
|
package com.siwei.apply.service.cadastre.impl;
|
|
|
|
|
|
+import com.siwei.apply.domain.Tdgy;
|
|
|
import com.siwei.apply.domain.cadastre.LandStorageInOutReportDTO;
|
|
|
import com.siwei.apply.domain.cadastre.LandStorageReportDTO;
|
|
|
import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
|
|
|
@@ -451,20 +452,75 @@ public class StorageServiceImpl {
|
|
|
|
|
|
//统计分析
|
|
|
public List<TrendStatisticsData> getData1() {
|
|
|
- List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();
|
|
|
List<TrendStatisticsData> res = new ArrayList<>();
|
|
|
+ //第一部,合并两部分供地数据,把相关的年份和面积计算出来
|
|
|
+ List<TdgyStatisticsRes> completeSjgdList = tdgyMapper.getSjgdListByYear(null, null, null, null);
|
|
|
+ List<Tdgy> tdgyList = tdgyMapper.getTdgyList(null,null);
|
|
|
+ Map<String,Double> outDataAreaMap = new TreeMap<>();
|
|
|
+ //这里获取实际供地数据:根据年份进行分组:
|
|
|
+ if(CollectionUtils.isNotEmpty(completeSjgdList)){
|
|
|
+ for (TdgyStatisticsRes item : completeSjgdList) {
|
|
|
+ String year = item.getNf();
|
|
|
+ Double area = item.getMjMu() == null ? 0D : item.getMjMu().doubleValue();
|
|
|
+ outDataAreaMap.merge(year, area, Double::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isNotEmpty(tdgyList)){
|
|
|
+ for (Tdgy item : tdgyList) {
|
|
|
+ String year = item.getNf();
|
|
|
+ Double area = item.getGdArea() == null ? 0D : item.getGdArea().doubleValue();
|
|
|
+ outDataAreaMap.merge(year, area, Double::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //第二部分,计算供地
|
|
|
+ List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();
|
|
|
if (CollectionUtils.isNotEmpty(statsList)) {
|
|
|
for (Map<String, Object> stat : statsList) {
|
|
|
TrendStatisticsData data = new TrendStatisticsData();
|
|
|
- data.setYear(String.valueOf(stat.get("year")));
|
|
|
- data.setInDataArea(String.valueOf(stat.get("in_data_area")));
|
|
|
+ String year = stat.get("year").toString();
|
|
|
+ data.setYear(year);
|
|
|
+ data.setInDataArea(String.format("%.2f", stat.get("in_data_area")));
|
|
|
data.setOutDataArea("0");
|
|
|
+ if(outDataAreaMap.containsKey(year)) {
|
|
|
+ data.setOutDataArea(String.format("%.2f",outDataAreaMap.remove(year)));
|
|
|
+ }
|
|
|
res.add(data);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //如果年份交差情况,剩余的补全
|
|
|
+ if(MapUtils.isNotEmpty(outDataAreaMap)){
|
|
|
+ for (Map.Entry<String, Double> entry : outDataAreaMap.entrySet()) {
|
|
|
+ TrendStatisticsData data = new TrendStatisticsData();
|
|
|
+ String year = entry.getKey();
|
|
|
+ data.setYear(year);
|
|
|
+ data.setOutDataArea(String.format("%.2f",entry.getValue()));
|
|
|
+ data.setInDataArea("0");
|
|
|
+ res.add(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //年份排序
|
|
|
+ res = res.stream()
|
|
|
+ .sorted((d1,d2)->{
|
|
|
+ String y1 = d1.getYear();
|
|
|
+ String y2 = d2.getYear();
|
|
|
+ if("其它".equals(y1)) return 1;
|
|
|
+ if("其它".equals(y2)) return -1;
|
|
|
+ return Integer.parseInt(y1)-Integer.parseInt(y2);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
public List<TrendUseStatisticsData> getData2(String year) {
|
|
|
if ("0".equals(year)) {
|
|
|
year = null;
|