Browse Source

上报数修改

gushoubang 3 months ago
parent
commit
9b670b0125

+ 3 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/res/LandMyAttend.java

@@ -1,5 +1,6 @@
 package com.onemap.apply.domain.res;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -8,6 +9,7 @@ import java.util.List;
 
 @NoArgsConstructor
 @Data
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class LandMyAttend {
 
 
@@ -24,6 +26,7 @@ public class LandMyAttend {
 
     @NoArgsConstructor
     @Data
+    @JsonIgnoreProperties(ignoreUnknown = true)
     public static class RecordsDTO {
         @JsonProperty("nodeName")
         private String nodeName;

+ 31 - 14
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/sbjk/XzczghcgsbServiceImpl.java

@@ -187,8 +187,8 @@ public class XzczghcgsbServiceImpl implements XzczghcgsbService {
     @Override
     public List<TreeAnalyse> getStatistics() {
         int current = 1;
-//        List<LandMyAttend.RecordsDTO> list = getAllLandMyAttendsData(2, current, 200, "1506");
-        List<LandMyAttend.RecordsDTO> list = new ArrayList<>();
+        List<LandMyAttend.RecordsDTO> list = getAllLandMyAttendsData(2, current, 200, "1506");
+//        List<LandMyAttend.RecordsDTO> list = new ArrayList<>();
         // 根据divisionCode的前9位进行divisionCode分组数量
         Map<String, List<String>> townCountMap = new HashMap<>();
         // 根据divisionCode的前9位进行divisionCode分组节点类别
@@ -233,10 +233,6 @@ public class XzczghcgsbServiceImpl implements XzczghcgsbService {
         //组织乡镇数据
         List<TreeAnalyse> townTreeList = new ArrayList<>();
         for (TusexzqhDTO tusexzqhDTO : townList) {
-            if(tusexzqhDTO.getTownship().contains("魏家")){
-                System.out.println("魏家");
-            }
-
             Integer villageNum = tuseXzqhMapper.getAllVillageNumByPid(tusexzqhDTO.getCode());
 //            Integer townReportNum = tuseXzqhMapper.getTownReportNum(tusexzqhDTO.getCode());//上报数
             Integer townReportAllNum = tuseXzqhMapper.getTownReportAllNum(tusexzqhDTO.getCode());//颖备案数
@@ -405,22 +401,43 @@ public class XzczghcgsbServiceImpl implements XzczghcgsbService {
         return cityTreeList;
     }
 
+//    private List<LandMyAttend.RecordsDTO> getAllLandMyAttendsData(int planType, int current, int size, String divisionCode) {
+//        // 正式环境
+//        JSONObject jsonObject = sbSearchService.getLandMyAttendsData(planType, current, size, divisionCode, "");
+//        // 测试数据
+////         JSONObject jsonObject = sbSearchService.landMyAttendsData(planType, current, size, divisionCode);
+//        List<LandMyAttend.RecordsDTO> list = new ArrayList<>();
+//        if (jsonObject.containsKey("success") && jsonObject.getBoolean("success")) {
+//            LandMyAttend landMyAttend = jsonObject.getObject("data", LandMyAttend.class);
+//            list.addAll(landMyAttend.getRecords());
+//            if (current < landMyAttend.getPages() + 1) {
+//                list.addAll(getAllLandMyAttendsData(planType, current + 1, size, divisionCode));
+//            }
+//        }
+//        return list;
+//    }
+
+
     private List<LandMyAttend.RecordsDTO> getAllLandMyAttendsData(int planType, int current, int size, String divisionCode) {
-        // 正式环境
-        JSONObject jsonObject = sbSearchService.getLandMyAttendsData(planType, current, size, divisionCode, "");
         // 测试数据
-//         JSONObject jsonObject = sbSearchService.landMyAttendsData(planType, current, size, divisionCode);
+        WebResult jsonObject = sbSearchService.landMyAttendsData(planType, current, size, divisionCode);
         List<LandMyAttend.RecordsDTO> list = new ArrayList<>();
-        if (jsonObject.containsKey("success") && jsonObject.getBoolean("success")) {
-            LandMyAttend landMyAttend = jsonObject.getObject("data", LandMyAttend.class);
-            list.addAll(landMyAttend.getRecords());
-            if (current < landMyAttend.getPages() + 1) {
+        if (jsonObject.containsKey("success") && (Boolean) jsonObject.get("success")) {
+            HashMap<String,Object> resMap = (HashMap<String, Object>) jsonObject.get("data");
+
+            List<HashMap<String,Object>> getList= (List<HashMap<String, Object>>) resMap.get("records");
+            for ( Map<String,Object> mapObj: getList) {
+                ObjectMapper objectMapper = new ObjectMapper();
+                LandMyAttend.RecordsDTO recordsDTO = objectMapper.convertValue(mapObj, LandMyAttend.RecordsDTO.class);
+                list.add(recordsDTO);
+            }
+
+            if (current < (Integer)resMap.get("pages") + 1) {
                 list.addAll(getAllLandMyAttendsData(planType, current + 1, size, divisionCode));
             }
         }
         return list;
     }
-
     /**
      * 新增记录
      *