chenendian пре 1 дан
родитељ
комит
20726b98b4

+ 22 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/SupplyController.java

@@ -271,6 +271,28 @@ public class SupplyController extends BaseController {
     }
 
 
+
+    /**
+     * 根据年份和供地类型查询土地供应统计报表数据
+     * @param year
+     * @param supplyType (1-计划,2-完成)
+     * @return
+     */
+    @GetMapping("/useMethodList")
+    public R<List<LandSupplyProjectVO>> useTypeAndMethodList(@RequestParam String year, @RequestParam(required = false) String useType, @RequestParam(required = false) String supplyType) {
+        try {
+            List<LandSupplyProjectVO> resList =  supplyService.useTypeAndMethodList(year,useType,supplyType);
+            return R.ok(resList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
+
+
     /**
      * 根据年份和供地类型查询土地供应统计报表数据
      * @param year

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/LandSupplyProjectVO.java

@@ -13,6 +13,7 @@ public class LandSupplyProjectVO {
     private String supplyMethod;
     private String supplyType;
     private String dateType;
+    private String useType;
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date year;
     private String area;

+ 3 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/ISupplyService.java

@@ -36,4 +36,7 @@ public interface ISupplyService {
 
     List<Map<String, Object>> supplyList(String tableName,String sourceType,String year);
 
+    List<LandSupplyProjectVO> useTypeAndMethodList(String year,String useType,String  supplyType);
+
+
 }

+ 21 - 6
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -490,7 +490,6 @@ public class StorageServiceImpl {
         }
 
 
-
         //如果年份交差情况,剩余的补全
         if(MapUtils.isNotEmpty(outDataAreaMap)){
             for (Map.Entry<String, Double> entry : outDataAreaMap.entrySet()) {
@@ -503,7 +502,27 @@ public class StorageServiceImpl {
             }
         }
 
-
+        //整合2015年前的数据合并到一起
+        List<TrendStatisticsData> tmpRes = new ArrayList<>();
+        int tmpYear = 2015;
+        double  tmpInDataArea = 0d;
+        double  tmpOutDataArea = 0d;
+        for(TrendStatisticsData obj:res){
+            if(Integer.parseInt(obj.getYear())>tmpYear){
+                tmpRes.add(obj);
+            }else {
+                tmpInDataArea += Double.parseDouble(obj.getInDataArea());
+                tmpOutDataArea += Double.parseDouble(obj.getOutDataArea());
+            }
+        }
+        if(tmpInDataArea>0d || tmpOutDataArea>0d){
+            TrendStatisticsData data = new TrendStatisticsData();
+            data.setYear("2026年前");
+            data.setInDataArea(String.format("%.2f",tmpInDataArea));
+            data.setOutDataArea(String.format("%.2f",tmpOutDataArea));
+            tmpRes.add(data);
+        }
+        res = tmpRes;
         //年份排序
         res = res.stream()
                 .sorted((d1,d2)->{
@@ -513,14 +532,10 @@ public class StorageServiceImpl {
                     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;

+ 122 - 12
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/SupplyServiceImpl.java

@@ -18,6 +18,7 @@ import com.siwei.common.core.domain.R;
 import com.siwei.common.core.exception.ServiceException;
 import com.siwei.common.core.utils.StringUtils;
 import com.siwei.spatial.api.RemoteSpatialFilesDbService;
+import com.siwei.system.api.domain.SysDictData;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
@@ -29,6 +30,8 @@ import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.siwei.apply.service.third.impl.DealExcelServiceImpl.allLandTypeList;
+
 
 @Slf4j
 @Service
@@ -59,6 +62,95 @@ public class SupplyServiceImpl implements ISupplyService {
     }
 
 
+    @Override
+    public List<LandSupplyProjectVO> useTypeAndMethodList(String year,String useType,String  supplyType) {
+        List<LandSupplyProjectVO> resList = new ArrayList<>();
+        {
+            GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
+            filterVo.setYear(year);
+            filterVo.setPageSize(100000);
+
+            List<GongdiJihua> planList = gongdiJihuaMapper.getList(filterVo);
+            List<LandSupplyProjectVO> resList1 = planList.stream().map(item -> {
+                LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                vo.setProjectPropertyId(String.valueOf(item.getGid()));
+                vo.setProjectName(item.getXmmc());
+                vo.setCompanyName("暂无");
+                vo.setSupplyMethod(item.getGyfs());
+                vo.setUseType(item.getTdyt());
+                vo.setSupplyType("1");
+                vo.setDateType("1");
+                vo.setGeom(item.getGeom());
+                return vo;
+            }).collect(Collectors.toList());
+
+            //这里合并两部分数据
+            List<TdgyStatisticsRes> completeList = new ArrayList<>();
+            List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(year, null, null, null);
+            List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(year, null, null, null);
+            if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+                completeList.addAll(completeBusinessStatusList);
+            }
+            if(CollectionUtils.isNotEmpty(completeSjgdList)){
+                completeList.addAll(completeSjgdList);
+            }
+            List<LandSupplyProjectVO> resList2 = completeList.stream().map(item -> {
+                LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                vo.setProjectPropertyId(item.getProjectId());
+                vo.setProjectName(item.getXmmc());
+                vo.setCompanyName(item.getCompany());
+                vo.setSupplyMethod(item.getGyfs());
+                vo.setUseType(item.getTdyt());
+                vo.setSupplyType("2");
+                vo.setDateType("2");
+                if(StringUtils.isBlank(item.getProjectId())){
+                    vo.setDateType("3");
+                }
+                vo.setNodeId(item.getNodeId());
+                vo.setGeom(item.getGeom());
+                return vo;
+            }).collect(Collectors.toList());
+            if(CollectionUtils.isNotEmpty(resList1)) {
+                resList.addAll(resList1);
+            }
+            if(CollectionUtils.isNotEmpty(resList2)) {
+                resList.addAll(resList2);
+            }
+        }
+
+        if(StringUtils.isNotBlank(supplyType)){
+            if("出让".equals(supplyType)||"划拨".equals(supplyType)){
+                resList = resList.stream().filter(o->o.getSupplyMethod().equals(supplyType)).collect(Collectors.toList());
+            }else {
+                resList = resList.stream().filter(o->!o.getSupplyMethod().equals("出让")).filter(o->!o.getSupplyMethod().equals("划拨")).collect(Collectors.toList());
+            }
+        } else if (StringUtils.isNotBlank(useType)) {
+            String code = getTdytCodeByName(useType);
+            if(StringUtils.isNotBlank(code)){
+                resList = resList.stream().filter(o->o.getUseType().equals(code)).collect(Collectors.toList());
+            }
+        }
+        return resList;
+    }
+
+
+
+
+    public String getTdytCodeByName(String useName) {
+        if (allLandTypeList.isEmpty()) {
+            List<LandType> all = landTypeMapper.selectAll();
+            allLandTypeList.addAll(all);
+        }
+        String code = "";
+        // 转换为节点
+        Optional<LandType> filterRes = allLandTypeList.stream().filter(s -> s.getName().equalsIgnoreCase(useName)).findFirst();
+        if (filterRes.isPresent()) {
+            code = filterRes.get().getCode();
+        }
+        return code;
+    }
+
+
     /**
      * 年度统计
      * @param year
@@ -86,11 +178,18 @@ public class SupplyServiceImpl implements ISupplyService {
             completeList.addAll(completeSjgdList);
         }
 
-        if(CollectionUtils.isNotEmpty(list)) {
-            double completeRate =0;
-            if(CollectionUtils.isNotEmpty(completeList)) {
-                completeRate = (double) completeList.size() / list.size() * 100;
+        {
+
+
+            int size = 1;
+            if(CollectionUtils.isEmpty(list)){
+                list = new ArrayList<>();
+            }else {
+                size = list.size();
             }
+            double completeRate =0;
+            completeRate = (double) completeList.size() / size * 100;
+
             SupplyRateRes supplyRate = new SupplyRateRes();
             //这里先计算一个供应率,后续可以根据实际需求计算其他数据
             supplyRate.setCompleteRate((int) completeRate);
@@ -103,7 +202,6 @@ public class SupplyServiceImpl implements ISupplyService {
                 .mapToDouble(g -> g.getMjM().doubleValue())
                 .sum();
             supplyRate.setPlanArea((float) planArea);
-
             //完成的计算加总值
             double completeArea = completeList.stream()
                     .filter(g -> g.getMjMu() != null)
@@ -247,9 +345,7 @@ public class SupplyServiceImpl implements ISupplyService {
                     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);
@@ -261,13 +357,27 @@ public class SupplyServiceImpl implements ISupplyService {
                 }
             }
 
-            areaByYear.forEach((year, area) -> {
+            int tmpYear = 2015;
+            double  tmpArea = 0d;
+            for (Map.Entry<Integer, Double> entry : areaByYear.entrySet()){
+                Integer year = entry.getKey();
+                Double area = entry.getValue();
+                if(year>tmpYear){
+                    Map<String, Object> map = new LinkedHashMap<>();
+                    map.put("year", year);
+                    map.put("area", area);
+                    areaTrendStatisticsList.add(map);
+                }else{
+                    tmpArea+=area;
+                }
+            }
+            //2015年之前的数据折合到一个年份中
+            if(tmpArea>0d){
                 Map<String, Object> map = new LinkedHashMap<>();
-                map.put("year", year);
-                map.put("area", area);
+                map.put("year", "2026年前");
+                map.put("area", tmpArea);
                 areaTrendStatisticsList.add(map);
-            });
-
+            }
             modeAreaByYear.forEach((year, modeAreas) -> {
                 Map<String, Object> map = new LinkedHashMap<>();
                 map.put("year", year);