1
0
chenendian 1 день назад
Родитель
Сommit
772b7e5c1e

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

@@ -10,7 +10,6 @@ import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.service.cadastre.impl.StorageServiceImpl;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.web.controller.BaseController;
-import com.siwei.common.core.web.page.TableDataInfo;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
@@ -196,7 +195,6 @@ public class StorageController extends BaseController {
 
 
 
-
     /**
      * 收储进度报表导出
      * @param response

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

@@ -16,6 +16,8 @@ public interface GjShijiShouchuMapper {
 
     List<Map<String, Object>> getStatsByYearAndUse(@Param("year") String year);
 
+    List<Map<String, Object>> getCompleteStatsByMethod(@Param("year") String year);
+
     void add(GjShijiShouchu gjShijiShouchu);
 
     GjShijiShouchu get(@Param("gid") Integer gid);

+ 40 - 15
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -17,6 +17,7 @@ import com.siwei.spatial.api.domain.file.TGeomDb;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -251,14 +252,10 @@ public class StorageServiceImpl {
     }
 
 
-
     //统计分析
     public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
         LandStorageReportDTO report = new LandStorageReportDTO();
 
-        startYear = "2025";
-        endYear = "2026";
-
         report.setTitle("收储进度分析报表");
         report.setStatTimeRange(startYear + " 至 " + endYear);
 
@@ -487,6 +484,7 @@ public class StorageServiceImpl {
         Map<String, Object> planSummary = gjShouchuJihuaMapper.getPlanSummaryByYear(year);
         List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null, null, null);
         BigDecimal planArea = toBigDecimal(planSummary == null ? null : planSummary.get("plan_area"));
+        BigDecimal planCost = toBigDecimal(planSummary == null ? null : planSummary.get("plan_cost"));
         int planCount = toInteger(planSummary == null ? null : planSummary.get("plan_project_count"));
         BigDecimal completeArea = sumArea(completeList);
         int completeCount = CollectionUtils.isEmpty(completeList) ? 0 : completeList.size();
@@ -499,9 +497,10 @@ public class StorageServiceImpl {
         storageRate.setPlanArea(planArea.floatValue());
         storageRate.setCompleteArea(completeArea.floatValue());
         storageRate.setGdUnit("亩");
-        storageRate.setEstimatedCost(0f);
-        storageRate.setExpenditureCost(0f);
-
+        storageRate.setEstimatedCost(planCost.floatValue());
+        //完成成本
+        BigDecimal completeCost = sumCost(completeList);
+        storageRate.setExpenditureCost(completeCost.floatValue());
         res.setStorageRate(storageRate);
         res.setLandUseStatisticsList(buildLandUseStatistics(year));
         res.setProjectSupplyList(buildMethodStatistics(year));
@@ -617,16 +616,29 @@ public class StorageServiceImpl {
 
     private List<ProjectSupplyRes> buildMethodStatistics(String year) {
         List<Map<String, Object>> planStats = gjShouchuJihuaMapper.getPlanStatsByMethod(year);
+        List<Map<String, Object>> completeStats = gjShijiShouchuMapper.getCompleteStatsByMethod(year);
+        String[]  category = {"征收","收回","收购","其他"};
         List<ProjectSupplyRes> res = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(planStats)) {
+        for(String cate : category){
+            ProjectSupplyRes item = new ProjectSupplyRes();
+            item.setGdUnit("亩");
+            item.setGdType(cate);
+            item.setPlanArea(0f);
+            item.setCompleteArea(0f);
+
             for (Map<String, Object> stat : planStats) {
-                ProjectSupplyRes item = new ProjectSupplyRes();
-                item.setGdType(convertCategory(String.valueOf(stat.get("category"))));
-                item.setGdUnit("亩");
-                Float area = toBigDecimal(stat.get("plan_area")).floatValue();
-                item.setGdArea(area);
-                item.setPlanArea(area);
-                item.setCompleteArea(0f);
+                if(String.valueOf(stat.get("category")).equals(cate)){
+                    Float area = toBigDecimal(stat.get("plan_area")).floatValue();
+                    item.setPlanArea(area);
+                }
+            }
+            for (Map<String, Object> stat : completeStats) {
+                if(String.valueOf(stat.get("category")).equals(cate)){
+                    Float area = toBigDecimal(stat.get("complate_area")).floatValue();
+                    item.setCompleteArea(area);
+                }
+            }
+            if(item.getPlanArea()>0 || item.getCompleteArea()>0){
                 res.add(item);
             }
         }
@@ -651,6 +663,19 @@ public class StorageServiceImpl {
         return sum.setScale(2, RoundingMode.HALF_UP);
     }
 
+    private BigDecimal sumCost(List<TdgyStatisticsRes> list) {
+        BigDecimal sum = BigDecimal.ZERO;
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (TdgyStatisticsRes item : list) {
+                sum = sum.add(item.getCost() == null ? BigDecimal.ZERO : item.getCost());
+            }
+        }
+        return sum.setScale(2, RoundingMode.HALF_UP);
+    }
+
+
+
+
     private Integer toRoundedInt(Object value) {
         return toBigDecimal(value).setScale(0, RoundingMode.HALF_UP).intValue();
     }

+ 16 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/GjShijiShouchuMapper.xml

@@ -124,6 +124,22 @@
         </foreach>
     </delete>
 
+
+    <select id="getCompleteStatsByMethod" resultType="map">
+        SELECT
+        COALESCE(scfs, '其他') AS category,
+        ROUND(COALESCE(SUM("面积_亩"), 0), 2) AS complate_area
+        FROM vector.gj_shiji_shouchu
+        WHERE 1=1
+        <if test="year != null and year != '' and year != '0'">
+            AND scnd = #{year}::NUMERIC
+        </if>
+        GROUP BY COALESCE(scfs, '其他')
+        ORDER BY complate_area DESC
+    </select>
+
+
+
     <select id="getStatsByYear" resultType="map">
         SELECT
             COALESCE(CAST(scnd AS VARCHAR), '其它') AS year,

+ 2 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/GjShouchuJihuaMapper.xml

@@ -7,7 +7,8 @@
     <select id="getPlanSummaryByYear" resultType="map">
         SELECT
             COUNT(*) AS plan_project_count,
-            ROUND(COALESCE(SUM(mj_mu), 0), 2) AS plan_area
+            ROUND(COALESCE(SUM(mj_mu), 0), 2) AS plan_area,
+            ROUND(COALESCE(SUM(sccb), 0), 2) AS plan_cost
         FROM vector.gj_shouchu_jihua
         WHERE 1=1
         <if test="year != null and year != '' and year != '0'">