1
0
chenendian преди 1 седмица
родител
ревизия
714cd4d149

+ 3 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java

@@ -178,14 +178,14 @@ public class StorageController extends BaseController {
     }
 
 
-
     @GetMapping("/report/progress")
-    public R<LandStorageReportDTO> getStroageProgress(@RequestParam String startTime, @RequestParam String endTime) {
+    public R<LandStorageReportDTO> getStroageProgress(@RequestParam String startYear, @RequestParam String endYear) {
         try {
             //todo 调用相关方法,获取数据,封装成LandStorageReportDTO对象
-            LandStorageReportDTO res =  storageServiceImpl.stroageProgress(startTime,endTime);
+            LandStorageReportDTO res =  storageServiceImpl.stroageProgress(startYear,endYear);
             return R.ok(res);
         } catch (Exception e) {
+            e.printStackTrace();
             return R.fail(e.getMessage());
         }
     }

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/res/TdgyStatisticsRes.java

@@ -33,6 +33,8 @@ public class TdgyStatisticsRes {
 
     private String bz;
 
+    private BigDecimal cost;
+
     private String geom;
 
 

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShijiShouchuMapper.java

@@ -30,7 +30,7 @@ public interface GjShijiShouchuMapper {
 
     List<GjShijiShouchu> getByGeomIntersects(@Param("ewkt") String ewkt);
 
-    List<TdgyStatisticsRes> gjShijiShouchuListByYear(@Param("year") String year, @Param("landTypeCode") String landTypeCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<TdgyStatisticsRes> gjShijiShouchuListByYear(@Param("year") String year,@Param("startYear") String startYear,@Param("endYear") String endYear,@Param("landTypeCode") String landTypeCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     Map<String, Object> getActualProject(@Param("gid") String gid);
 }

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShouchuJihuaMapper.java

@@ -16,7 +16,7 @@ public interface GjShouchuJihuaMapper {
 
     List<Map<String, Object>> getPlanStatsByMethod(@Param("year") String year);
 
-    List<TdgyStatisticsRes> getPlanListByYear(@Param("year") String year, @Param("keyWord") String keyWord);
+    List<TdgyStatisticsRes> getPlanListByYear(@Param("year") String year,@Param("startYear") String startYear,@Param("endYear") String endYear, @Param("keyWord") String keyWord);
 
     Map<String, Object> getPlanProject(@Param("gid") String gid);
 }

+ 112 - 27
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -7,11 +7,9 @@ import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.mapper.GjShijiShouchuMapper;
 import com.siwei.apply.mapper.GjShouchuJihuaMapper;
 import com.siwei.common.core.utils.StringUtils;
-import com.siwei.system.api.domain.SysDictData;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -28,20 +26,23 @@ public class StorageServiceImpl {
     private GjShouchuJihuaMapper gjShouchuJihuaMapper;
 
 
-
     //统计分析
-    public LandStorageReportDTO stroageProgress(String startTime,String endTime) {
+    public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
         LandStorageReportDTO report = new LandStorageReportDTO();
+
+        startYear = "2025";
+        endYear = "2026";
+
         report.setTitle("收储进度分析报表");
-        report.setStatTimeRange(startTime + " 至 " + endTime);
+        report.setStatTimeRange(startYear + " 至 " + endYear);
 
-        String year = "2025";
         List<LandStorageReportDTO.DetailDTO> details =  new ArrayList<>();
-        List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null);
+        List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(null, startYear,endYear,null, null, null);
         Map<String, List<TdgyStatisticsRes>> completeMap = completeList.stream().collect(Collectors.groupingBy(TdgyStatisticsRes::getTdyt));
         // 这里处理计划数据
-        List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(year, null);
-        Set<String> categorySet = completeMap.keySet();
+        List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(null,startYear,endYear, null);
+        Set<String> categorySet = new HashSet<>(completeMap.keySet());
+        categorySet.add("其它");
         Map<String, List<TdgyStatisticsRes>> groupedPlan = planList.stream()
                 .collect(Collectors.groupingBy(
                         s -> {
@@ -53,39 +54,123 @@ public class StorageServiceImpl {
                         }
                 ));
 
-
         for(String category  : categorySet){
             LandStorageReportDTO.DetailDTO tmpDetailDTO =  new LandStorageReportDTO.DetailDTO();
-            List<TdgyStatisticsRes>   categoryPlanList =  groupedPlan.get(category);
             LandStorageReportDTO.PlanDTO plan = new LandStorageReportDTO.PlanDTO();
-            plan.setCount(categoryPlanList.size());
-            double totalArea = categoryPlanList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
-            plan.setArea(totalArea);
+            plan.setCount(0);
+            plan.setArea(0D);
             plan.setCost(0F);
-            tmpDetailDTO.setPlan(plan);
+            plan.setMethod1(0);
+            plan.setMethod2(0);
+            plan.setOtherMethod(0);
+
+            List<TdgyStatisticsRes>   categoryPlanList =  groupedPlan.get(category);
+            if(CollectionUtils.isNotEmpty(categoryPlanList)){
+                plan.setCount(categoryPlanList.size());
+                double totalArea = categoryPlanList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
+                plan.setArea(totalArea);
+                float totalCost = (float) categoryPlanList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
+                plan.setCost(totalCost);
+
+                Map<String, List<TdgyStatisticsRes>> resultMap = categoryPlanList.stream()
+                        .collect(Collectors.groupingBy(item -> {
+                            String gyfs = item.getGyfs();
+                            //为空赋值“其它”
+                            if (StringUtils.isBlank(gyfs)) {
+                                return "其它";
+                            }
+                            return gyfs;
+                        }));
+                if(resultMap.containsKey("收购")){
+                    plan.setMethod1(resultMap.get("收购").size());
+                }
+                if(resultMap.containsKey("征收")){
+                    plan.setMethod2(resultMap.get("征收").size());
+                }
+                if(resultMap.containsKey("其它")){
+                    plan.setOtherMethod(resultMap.get("其它").size());
+                }
+            }
 
+            tmpDetailDTO.setPlan(plan);
             List<TdgyStatisticsRes>  categoryCompleteList = completeMap.get(category);
             LandStorageReportDTO.CompletedDTO complete = new LandStorageReportDTO.CompletedDTO();
-            complete.setCost(0f);
-            totalArea = categoryCompleteList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
-            complete.setArea(totalArea);
-            complete.setCount(categoryCompleteList.size());
-            complete.setMethod1(null);
+            complete.setCount(0);
+            complete.setArea(0D);
+            complete.setCost(0F);
+            complete.setMethod1(0);
+            complete.setMethod2(0);
+            complete.setOtherMethod(0);
+
+            if(CollectionUtils.isNotEmpty(categoryCompleteList)){
+                double totalArea = categoryCompleteList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
+                complete.setArea(totalArea);
+                complete.setCount(categoryCompleteList.size());
+                float totalCost = (float) categoryCompleteList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
+                complete.setCost(totalCost);
+
+                Map<String, List<TdgyStatisticsRes>> resultMap = categoryCompleteList.stream()
+                        .collect(Collectors.groupingBy(item -> {
+                            String gyfs = item.getGyfs();
+                            //为空赋值“其它”
+                            if (StringUtils.isBlank(gyfs)) {
+                                return "其它";
+                            }
+                            return gyfs;
+                        }));
+                if(resultMap.containsKey("收购")){
+                    complete.setMethod1(resultMap.get("收购").size());
+                }
+                if(resultMap.containsKey("征收")){
+                    complete.setMethod2(resultMap.get("征收").size());
+                }
+                if(resultMap.containsKey("其它")){
+                    complete.setOtherMethod(resultMap.get("其它").size());
+                }
+            }
+
             tmpDetailDTO.setCompleted(complete);
             tmpDetailDTO.setCategory(category);
-            tmpDetailDTO.setProgress(String.valueOf(categoryCompleteList.size()/categoryPlanList.size()));
+            tmpDetailDTO.setProgress("0");
+            if(plan.getCount()>0){
+                tmpDetailDTO.setProgress(String.format("%.2f%%", (complete.getCount()*100.0 / plan.getCount()) ));
+            }
             details.add(tmpDetailDTO);
         }
         report.setDetails(details);
 
-
-
-        return  null;
+        //这里处理加总数据
+        LandStorageReportDTO.SummaryDTO summary = new LandStorageReportDTO.SummaryDTO();
+        LandStorageReportDTO.TotalDTO total = new LandStorageReportDTO.TotalDTO();
+        LandStorageReportDTO.CompletedDTO totalCompleted = new LandStorageReportDTO.CompletedDTO();
+        totalCompleted.setCount(completeList.size());
+        float totalCost = (float) completeList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
+        totalCompleted.setCost(totalCost);
+        double totalArea = completeList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
+        totalCompleted.setArea(totalArea);
+
+        //这里处理计划的数据
+        LandStorageReportDTO.PlanDTO totalPlan = new LandStorageReportDTO.PlanDTO();
+        totalPlan.setCount(planList.size());
+        //这里计算成本
+        totalCost = (float) planList.stream().mapToDouble(item -> item.getCost().floatValue()).sum();
+        totalPlan.setCost(totalCost);
+        //这里计算面积
+        totalArea = planList.stream().mapToDouble(item -> item.getMjMu().doubleValue()).sum();
+        totalPlan.setArea(totalArea);
+        String progress = String.format("%.2f%%", (totalCompleted.getCount()*100.0 / totalPlan.getCount()));
+        total.setProgress(progress);
+        total.setCompleted(totalCompleted);
+        total.setPlan(totalPlan);
+        summary.setTotal(total);
+        report.setSummary(summary);
+        return  report;
     }
 
 
 
 
+
     //统计分析
     public List<TrendStatisticsData> getData1() {
         List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();
@@ -124,7 +209,7 @@ public class StorageServiceImpl {
         StorageYearStatisticsRes res = new StorageYearStatisticsRes();
 
         Map<String, Object> planSummary = gjShouchuJihuaMapper.getPlanSummaryByYear(year);
-        List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null);
+        List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null, null, null);
         BigDecimal planArea = toBigDecimal(planSummary == null ? null : planSummary.get("plan_area"));
         int planCount = toInteger(planSummary == null ? null : planSummary.get("plan_project_count"));
         BigDecimal completeArea = sumArea(completeList);
@@ -191,7 +276,7 @@ public class StorageServiceImpl {
     }
 
     private List<LandSupplyProjectVO> buildPlanProjectList(String year, String keyWord) {
-        List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(year, keyWord);
+        List<TdgyStatisticsRes> planList = gjShouchuJihuaMapper.getPlanListByYear(year,null,null, keyWord);
         if (CollectionUtils.isEmpty(planList)) {
             return new ArrayList<>();
         }
@@ -212,7 +297,7 @@ public class StorageServiceImpl {
     }
 
     private List<LandSupplyProjectVO> buildCompleteProjectList(String year) {
-        List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null);
+        List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null,null,null, null, null);
         if (CollectionUtils.isEmpty(completeList)) {
             return new ArrayList<>();
         }

+ 5 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/GjShijiShouchuMapper.xml

@@ -159,11 +159,12 @@
             "项目名" AS xmmc,
             yqsdw AS company,
             CAST(gid AS VARCHAR) AS nodeId,
-            COALESCE(ytdyt, '其它') AS tdyt,,
+            COALESCE(ytdyt, '其它') AS tdyt,
             scfs AS gyfs,
             to_timestamp(scsj, 'YYYY/MM/DD') AS gysj,
             ROUND("面积_亩", 2) AS mjMu,
             bz,
+            sccb AS cost,
             ST_AsEWKT(geom) AS geom
         FROM vector.gj_shiji_shouchu
         WHERE 1=1
@@ -179,6 +180,9 @@
         <if test="endTime != null and endTime != ''">
             AND scsj &lt;= #{endTime}
         </if>
+        <if test="(startYear != null and startYear != '') and (endYear != null and endYear != '')">
+            AND scnd::NUMERIC BETWEEN #{startYear}::NUMERIC AND #{endYear}::NUMERIC
+        </if>
         order BY "项目名"
     </select>
 

+ 4 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/GjShouchuJihuaMapper.xml

@@ -52,6 +52,7 @@
             tdyt,
             scfs AS gyfs,
             COALESCE(qdrq, TO_DATE(scnd || '-01-01', 'YYYY-MM-DD')) AS gysj,
+            sccb AS cost,
             bz,
             ST_AsEWKT(geom) AS geom
         FROM vector.gj_shouchu_jihua
@@ -69,6 +70,9 @@
                 OR COALESCE(scfs, '') LIKE CONCAT('%', #{keyWord}, '%')
             )
         </if>
+        <if test="(startYear != null and startYear != '') and (endYear != null and endYear != '')">
+            AND scnd::NUMERIC BETWEEN #{startYear}::NUMERIC AND #{endYear}::NUMERIC
+        </if>
         ORDER BY gid
     </select>