浏览代码

mock数据增加

chenendian 5 月之前
父节点
当前提交
7bcfc9f631

+ 134 - 96
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/SupplyController.java

@@ -11,7 +11,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-
 /**
  * 地籍土地供应模块
  *
@@ -31,10 +30,10 @@ public class SupplyController extends BaseController {
     public R<SupplyYearStatisticsRes> getYearStatistics(@PathVariable String year) {
         try {
             SupplyYearStatisticsRes res = new SupplyYearStatisticsRes();
-            if(year.equalsIgnoreCase("2024")){
-                SupplyRateRes supplyRate= new SupplyRateRes();
-                List<LandUseRes> landUseStatisticsList = List.of(); //用途分析
-                List<ProjectSupplyRes> projectSupplyList = List.of(); //  供应方式
+            if (year.equalsIgnoreCase("2024")) {
+                SupplyRateRes supplyRate = new SupplyRateRes();
+                List<LandUseRes> landUseStatisticsList = new java.util.ArrayList<>(List.of()); // 用途分析
+                List<ProjectSupplyRes> projectSupplyList = new java.util.ArrayList<>(List.of()); // 供应方式
 
                 supplyRate.setCompleteRate(78);
                 supplyRate.setPlanProjectCount(15);
@@ -44,57 +43,95 @@ public class SupplyController extends BaseController {
                 supplyRate.setGdUnit("亩");
                 res.setSupplyRate(supplyRate);
 
-                //--------------土地用途分析----------------------
+                // --------------土地用途分析----------------------
 
-                LandUseRes   landUse1 = new LandUseRes();
+                LandUseRes landUse1 = new LandUseRes();
                 landUse1.setLandUseTypeName("城镇住宅用地");
                 landUse1.setPlanLandUseArea(700);
                 landUse1.setCompleteLandUseArea(300);
 
-                LandUseRes   landUse2 = new LandUseRes();
+                LandUseRes landUse2 = new LandUseRes();
                 landUse2.setLandUseTypeName("教育用地");
                 landUse2.setPlanLandUseArea(900);
                 landUse2.setCompleteLandUseArea(600);
 
-                landUseStatisticsList.addAll(List.of(landUse1,landUse2));
+                landUseStatisticsList.addAll(List.of(landUse1, landUse2));
                 res.setLandUseStatisticsList(landUseStatisticsList);
-                //--------------供应方式----------------------
+                // --------------供应方式----------------------
 
-                ProjectSupplyRes  projectSupply1 = new ProjectSupplyRes();
+                ProjectSupplyRes projectSupply1 = new ProjectSupplyRes();
                 projectSupply1.setGdArea(263.12f);
                 projectSupply1.setGdType("出让");
                 projectSupply1.setGdUnit("亩");
 
-                ProjectSupplyRes  projectSupply2 = new ProjectSupplyRes();
+                ProjectSupplyRes projectSupply2 = new ProjectSupplyRes();
                 projectSupply2.setGdArea(220.12f);
                 projectSupply2.setGdType("划拨");
                 projectSupply2.setGdUnit("亩");
 
-                ProjectSupplyRes  projectSupply3 = new ProjectSupplyRes();
-                projectSupply2.setGdArea(190.12f);
-                projectSupply2.setGdType("其它");
-                projectSupply2.setGdUnit("亩");
+                ProjectSupplyRes projectSupply3 = new ProjectSupplyRes();
+                projectSupply3.setGdArea(190.12f);
+                projectSupply3.setGdType("其它");
+                projectSupply3.setGdUnit("亩");
 
-                projectSupplyList.addAll(List.of(projectSupply1,projectSupply2,projectSupply3));
+                projectSupplyList.addAll(List.of(projectSupply1, projectSupply2, projectSupply3));
                 res.setProjectSupplyList(projectSupplyList);
 
-            }else  if(year.equalsIgnoreCase("2025")){
+            } else if (year.equalsIgnoreCase("2025") || year.equalsIgnoreCase("2026")) {
+                SupplyRateRes supplyRate = new SupplyRateRes();
+                List<LandUseRes> landUseStatisticsList = new java.util.ArrayList<>(List.of()); // 用途分析
+                List<ProjectSupplyRes> projectSupplyList = new java.util.ArrayList<>(List.of()); // 供应方式
 
+                supplyRate.setCompleteRate(78 + (int) (Math.random() * 10));
+                supplyRate.setPlanProjectCount(15 + (int) (Math.random() * 5));
+                supplyRate.setCompleteProjectCount(11 + (int) (Math.random() * 5));
+                supplyRate.setPlanArea(788.6f + (float) (Math.random() * 100));
+                supplyRate.setCompleteArea(548.2f + (float) (Math.random() * 100));
+                supplyRate.setGdUnit("亩");
+                res.setSupplyRate(supplyRate);
 
-            }else  if(year.equalsIgnoreCase("2026")){
+                // --------------土地用途分析----------------------
+                // 城镇住宅用地,教育用地,商业用地,工业用地,物流仓储用地,公路用地,工业绿地
+                String[] landTypes = { "城镇住宅用地", "教育用地", "商业用地", "工业用地", "物流仓储用地", "公路用地", "工业绿地" };
+                for (String type : landTypes) {
+                    LandUseRes landUse = new LandUseRes();
+                    landUse.setLandUseTypeName(type);
+                    // 随机生成面积
+                    landUse.setPlanLandUseArea(Integer.parseInt(String.valueOf(500 + (int) (Math.random() * 500))));
+                    landUse.setCompleteLandUseArea(Integer.parseInt(String.valueOf(300 + (int) (Math.random() * 300))));
+                    landUseStatisticsList.add(landUse);
+                }
+                res.setLandUseStatisticsList(landUseStatisticsList);
 
+                // --------------供应方式----------------------
 
-            }
+                ProjectSupplyRes projectSupply1 = new ProjectSupplyRes();
+                projectSupply1.setGdArea(263.12f + (float) (Math.random() * 100));
+                projectSupply1.setGdType("出让");
+                projectSupply1.setGdUnit("亩");
+
+                ProjectSupplyRes projectSupply2 = new ProjectSupplyRes();
+                projectSupply2.setGdArea(220.12f + (float) (Math.random() * 100));
+                projectSupply2.setGdType("划拨");
+                projectSupply2.setGdUnit("亩");
 
+                ProjectSupplyRes projectSupply3 = new ProjectSupplyRes();
+                projectSupply3.setGdArea(190.12f + (float) (Math.random() * 100));
+                projectSupply3.setGdType("其它");
+                projectSupply3.setGdUnit("亩");
+
+                projectSupplyList.addAll(List.of(projectSupply1, projectSupply2, projectSupply3));
+                res.setProjectSupplyList(projectSupplyList);
+
+            }
 
             return R.ok(res);
         } catch (Exception e) {
+            e.printStackTrace();
             return R.fail(e.getMessage());
         }
     }
 
-
-
     /**
      *
      * 趋势统计
@@ -104,103 +141,104 @@ public class SupplyController extends BaseController {
     public R<TrendStatisticsRes> getTrendStatistics(@PathVariable String landType) {
         try {
             TrendStatisticsRes res = new TrendStatisticsRes();
-            List<Map<String,Object>> areaTrendStatisticsList = List.of(); // 面积趋势分析list
-            List<Map<String,Object>>  supplyModeStatisticsList = List.of(); // 供应方式分析list
+            List<Map<String, Object>> areaTrendStatisticsList = new java.util.ArrayList<>(List.of()); // 面积趋势分析list
+            List<Map<String, Object>> supplyModeStatisticsList = new java.util.ArrayList<>(List.of()); // 供应方式分析list
 
-            Map<String,Object> map1 = new HashMap<>();
-            map1.put("year",2023);
-            map1.put("area",3365.22);
+            Map<String, Object> map1 = new HashMap<>();
+            map1.put("year", 2023);
+            map1.put("area", 3365.22);
 
-            Map<String,Object> map2 = new HashMap<>();
-            map1.put("year",2024);
-            map1.put("area",18900.35);
+            Map<String, Object> map2 = new HashMap<>();
+            map2.put("year", 2024);
+            map2.put("area", 18900.35);
 
-            Map<String,Object> map3 = new HashMap<>();
-            map1.put("year",2025);
-            map1.put("area",2000.35);
-            areaTrendStatisticsList.addAll(List.of(map1,map2,map3));
+            Map<String, Object> map3 = new HashMap<>();
+            map3.put("year", 2025);
+            map3.put("area", 2000.35);
+            areaTrendStatisticsList.addAll(List.of(map1, map2, map3));
             res.setAreaTrendStatisticsList(areaTrendStatisticsList);
 
-            //--------------下面为供地方式list----------------------
-            Map<String,Object> modeMap1 = new HashMap<>();
-            modeMap1.put("year",2023);
-            modeMap1.put("transferArea",587.7); //出让
-            modeMap1.put("allocateArea",500.5); // 划拨区域
-            modeMap1.put("otherArea",498.23); // 其它区域面积
+            // --------------下面为供地方式list----------------------
+            Map<String, Object> modeMap1 = new HashMap<>();
+            modeMap1.put("year", 2023);
+            modeMap1.put("transferArea", 587.7); // 出让
+            modeMap1.put("allocateArea", 500.5); // 划拨区域
+            modeMap1.put("otherArea", 498.23); // 其它区域面积
             supplyModeStatisticsList.add(modeMap1);
-            res.setSupplyModeStatisticsList(supplyModeStatisticsList);
 
+            Map<String, Object> modeMap2 = new HashMap<>();
+            modeMap2.put("year", 2024);
+            modeMap2.put("transferArea", 487.7); // 出让
+            modeMap2.put("allocateArea", 400.5); // 划拨区域
+            modeMap2.put("otherArea", 398.23); // 其它区域面积
+            supplyModeStatisticsList.add(modeMap2);
+
+            Map<String, Object> modeMap3 = new HashMap<>();
+            modeMap3.put("year", 2025);
+            modeMap3.put("transferArea", 487.7); // 出让
+            modeMap3.put("allocateArea", 400.5); // 划拨区域
+            modeMap3.put("otherArea", 398.23); // 其它区域面积
+            supplyModeStatisticsList.add(modeMap2);
+            res.setSupplyModeStatisticsList(supplyModeStatisticsList);
             return R.ok(res);
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
     }
 
-
-
-
-
-
-
-
-/*
+    /*
     */
-/**
+    /**
      * 获取资源目录列表
      *
      * @param param 预留
      * @return
      *//*
-
-    @GetMapping("/GetList")
-    public R GetList(String param) {
-        R list = zymlService.GetList(param);
-        return list;
-    }
-
-    */
-/**
+        * 
+        * @GetMapping("/GetList")
+        * public R GetList(String param) {
+        * R list = zymlService.GetList(param);
+        * return list;
+        * }
+        * 
+        */
+    /**
      * 获取资源目录列表
      *
      * @param param 预留
      * @return
      *//*
-
-    @GetMapping("/GetTree")
-    public R GetTree(String param) {
-        R list = zymlService.GetTree(param);
-        return list;
-    }
-
-*/
-
-
-
-
-
-//    /**
-//     * 根据标识码获取资源详情
-//     *
-//     * @param bsm
-//     * @return
-//     */
-//    @RequestMapping("/GetByBsm")
-//    public R GetByBsm(String bsm) {
-//        R list = zymlService.GetByBsm(bsm);
-//        return list;
-//    }
-//
-//    /**
-//     * 获取我收藏的资源列表
-//     *
-//     * @param param 预留
-//     * @return
-//     */
-//    @GetMapping("/GetMyCollect")
-//    public R GetMyCollect(String param) {
-//        R list = zymlService.GetMyCollect(param);
-//        return list;
-//    }
-
+        * 
+        * @GetMapping("/GetTree")
+        * public R GetTree(String param) {
+        * R list = zymlService.GetTree(param);
+        * return list;
+        * }
+        * 
+        */
+
+    // /**
+    // * 根据标识码获取资源详情
+    // *
+    // * @param bsm
+    // * @return
+    // */
+    // @RequestMapping("/GetByBsm")
+    // public R GetByBsm(String bsm) {
+    // R list = zymlService.GetByBsm(bsm);
+    // return list;
+    // }
+    //
+    // /**
+    // * 获取我收藏的资源列表
+    // *
+    // * @param param 预留
+    // * @return
+    // */
+    // @GetMapping("/GetMyCollect")
+    // public R GetMyCollect(String param) {
+    // R list = zymlService.GetMyCollect(param);
+    // return list;
+    // }
 
 }