瀏覽代碼

Merge branch 'f-xiaogu' into dev

gushoubang 8 月之前
父節點
當前提交
55b12e4074

+ 6 - 4
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/ApplyService.java

@@ -7,15 +7,17 @@ import com.onemap.system.api.factory.ApplyFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * 分析服务
  */
 @FeignClient(contextId = "applyService", value = ServiceNameConstants.APPLY_SERVICE, fallbackFactory = ApplyFallbackFactory.class)
 public interface ApplyService {
-    @GetMapping("/fzxz/GetCascadeList")
-    RequestResult GetCascadeList(String param);
-
     @PostMapping("/tabledata/polygon/GetTableData")
-    RequestResult queryTableListByPolygon(PolygonDataVo polygonDataVo);
+    RequestResult queryTableListByPolygon(@RequestBody PolygonDataVo polygonDataVo);
+
+    @GetMapping("/fzxz/GetCascadeList")
+    RequestResult GetCascadeList(@RequestParam("param") String param);
 }

+ 5 - 5
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/domain/PolygonDataVo.java

@@ -4,9 +4,9 @@ import lombok.Data;
 
 @Data
 public class PolygonDataVo {
-    String sourceDataId;
-    String sourcePolygonWkt;
-    String sourceLayerId;
-    String sourceLayerType;
-    String queryTableId;
+    String sourceDataId;//地块id
+    String sourcePolygonWkt;//地块wkt
+    String sourceLayerId;//对应数据表id,图层id
+    String sourceLayerType;//1
+    String queryTableId;//查询目标表id
 }

+ 2 - 1
onemap-api/onemap-api-system/src/main/java/com/onemap/system/api/factory/ApplyFallbackFactory.java

@@ -8,6 +8,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
 
 @Component
 public class ApplyFallbackFactory implements FallbackFactory<ApplyService> {
@@ -17,7 +18,7 @@ public class ApplyFallbackFactory implements FallbackFactory<ApplyService> {
     public ApplyService create(Throwable cause) {
         return new ApplyService() {
             @Override
-            public RequestResult queryTableListByPolygon(PolygonDataVo polygonDataVo) {
+            public RequestResult queryTableListByPolygon(@RequestBody PolygonDataVo polygonDataVo) {
                 return RequestResult.error("内部错误");
             }
 

+ 9 - 11
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/domain/res/TableSortRes.java

@@ -2,15 +2,13 @@ package com.onemap.analyse.domain.res;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
-import lombok.NoArgsConstructor;
 
-@NoArgsConstructor
-@Data
-public class TableSortRes {
-    @JsonProperty("tableId")
-    private String tableId;
-    @JsonProperty("tableName")
-    private String tableName;
-    @JsonProperty("sort")
-    private String sort;
-}
+// @Data
+// public class TableSortRes {
+//     @JsonProperty("tableId")
+//     private String tableId;
+//     @JsonProperty("tableName")
+//     private String tableName;
+//     @JsonProperty("sort")
+//     private String sort;
+// }

+ 77 - 23
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/ReportServiceImpl.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.onemap.analyse.domain.*;
 import com.onemap.analyse.domain.calculation.ReportImage;
 import com.onemap.analyse.domain.res.GeomRes;
-import com.onemap.analyse.domain.res.TableSortRes;
 import com.onemap.analyse.domain.vo.FactorSpatialVo;
 import com.onemap.analyse.domain.vo.TableNameIdsVo;
 import com.onemap.analyse.mapper.FactorUseMapper;
@@ -217,14 +216,14 @@ public class ReportServiceImpl implements IReportService {
             fwfx = fwfx.substring(0, fwfx.length() - 1) + "。详情如下:";
             NpoiHelper.content(document, fwfx, pos++);
 
-            // 获取插入图片
-            ReportImage reportImage = getWktImage(geomRes.getGeom(), 400);
-
-            XWPFParagraph imageParagraph = document.createParagraph();
-            imageParagraph.setAlignment(ParagraphAlignment.CENTER); // Center align the image
-            XWPFRun imageRun = imageParagraph.createRun();
-            imageRun.addPicture(reportImage.getInputStream(), XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(reportImage.getUseWidth()), Units.toEMU(reportImage.getUseHeight()));
-            pos++;
+            // // 获取插入图片
+            // ReportImage reportImage = getWktImage(geomRes.getGeom(), 400);
+            //
+            // XWPFParagraph imageParagraph = document.createParagraph();
+            // imageParagraph.setAlignment(ParagraphAlignment.CENTER); // Center align the image
+            // XWPFRun imageRun = imageParagraph.createRun();
+            // imageRun.addPicture(reportImage.getInputStream(), XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(reportImage.getUseWidth()), Units.toEMU(reportImage.getUseHeight()));
+            // pos++;
 
             // 添加分页
             XWPFParagraph pageBreakParagraph1 = document.createParagraph();
@@ -246,7 +245,12 @@ public class ReportServiceImpl implements IReportService {
             }
 
             // 获取规划信息
-            List<TableSortRes> tableSortRes = getCascadeList();
+            List<Map<String, String>> tableSortRes = getCascadeList();
+            PolygonDataVo polygonDataVo = new PolygonDataVo();
+            polygonDataVo.setSourceLayerId(tableSortRes.get(0).get("tableId"));
+            polygonDataVo.setSourceLayerType("1");
+
+
             for (int i = 0; i < fzxzJgGisDTOList.size(); i++) {
                 if (i != 0) {
                     // 添加分页
@@ -302,18 +306,66 @@ public class ReportServiceImpl implements IReportService {
                     cell.removeParagraph(0);
                 }
 
-                // 获取地块图片
-                String geomWkt = item.getGeom();
-                ReportImage imageTable = getWktImage(geomWkt, 300);
+                // // 获取地块图片
+                // String geomWkt = item.getGeom();
+                // ReportImage imageTable = getWktImage(geomWkt, 300);
+                //
+                // // 在合并后的单元格中创建一个新的段落
+                // XWPFParagraph paraImag = row.getCell(0).addParagraph();
+                // paraImag.setAlignment(ParagraphAlignment.CENTER); // 居中对齐
+                // XWPFRun run = paraImag.createRun();
+                // run.addPicture(imageTable.getInputStream(), XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(imageTable.getUseWidth()), Units.toEMU(imageTable.getUseHeight()));
 
-                // 在合并后的单元格中创建一个新的段落
-                XWPFParagraph paraImag = row.getCell(0).addParagraph();
-                paraImag.setAlignment(ParagraphAlignment.CENTER); // 居中对齐
-                XWPFRun run = paraImag.createRun();
-                run.addPicture(imageTable.getInputStream(), XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(imageTable.getUseWidth()), Units.toEMU(imageTable.getUseHeight()));
 
+                // 获取地块信息
+                for (int j = 0; j < tableSortRes.size(); j++) {
+                    if (j == 0) {
+                        continue;
+                    }
+                    polygonDataVo.setSourceDataId(item.getDkid());
+                    polygonDataVo.setSourcePolygonWkt(item.getGeom().replace("SRID=4326;", ""));
+                    polygonDataVo.setQueryTableId(tableSortRes.get(j).get("tableId"));
+
+                    Map<String, Object> mapData = getTableData(polygonDataVo);
+                    String dataname = (String) mapData.get("dataname");// 土地现状
+                    if (mapData.containsKey("datalist")) {
+                        List tabPlanTitles = new ArrayList<NpoiHelper.TableTitle>();
+                        NpoiHelper.TableTitle planC1Title = new NpoiHelper.TableTitle();
+                        planC1Title.setKey("type");
+                        planC1Title.setName("类型");
+                        planC1Title.setWidth(4150);
+                        tabPlanTitles.add(planC1Title);
+
+                        NpoiHelper.TableTitle planC2Title = new NpoiHelper.TableTitle();
+                        planC2Title.setKey("area");
+                        planC2Title.setName("面积");
+                        planC2Title.setWidth(4150);
+                        tabPlanTitles.add(planC2Title);
+
+                        List<Map<String, Object>> dataPlanlist = new ArrayList<>();
+
+                        List<Map<String, Object>> mapList = (List<Map<String, Object>>) mapData.get("datalist");
+
+                        // XWPFTable tableLand = document.createTable(mapList.size() , 2);// 创建表格
+                        // tableLand.setWidth(8300);// 总宽度
+                        for (int iLand = 0; iLand < mapList.size(); iLand++) {
+                            Map<String, Object> planMap=new HashMap<>();
+                            planMap.put("type", mapList.get(iLand).get("groupvalue"));
+                            planMap.put("area", mapList.get(iLand).get("sumvalue")+" 平方米");
+                            dataPlanlist.add(planMap);
+
+                            // tableLand.getRow(j).getCell(0).setParagraph(NpoiHelper.setCellText(table, (String) mapList.get(iLand).get("groupvalue"), null));
+                            // tableLand.getRow(j).getCell(1).setParagraph(NpoiHelper.setCellText(table, (Double) mapList.get(iLand).get("sumvalue")+" 平方米", null));
+                        }
+                        NpoiHelper.setComTable(document, tabPlanTitles, dataPlanlist, "规划信息", pos++);
+
+                        System.out.println("");
+                    }
+                    // String base = (String) mapData.get("base");
+                    System.out.println("");
+                }
                 // 插入因子
-                insertFactorImage(geomRes.getGeom(), geomWkt, rootFactors, factorTypeMap, document, pos);
+                // insertFactorImage(geomRes.getGeom(), geomWkt, rootFactors, factorTypeMap, document, pos);
             }
 
 
@@ -634,16 +686,18 @@ public class ReportServiceImpl implements IReportService {
     /**
      * 获取级联列表
      */
-    private List<TableSortRes> getCascadeList() {
+    private List<Map<String, String>> getCascadeList() {
         RequestResult requestResult = applyService.GetCascadeList("");
-        List<TableSortRes> tableSortResList = (List<TableSortRes>) requestResult.get("data");
+        List<Map<String, String>> tableSortResList = (List<Map<String, String>>) requestResult.get("data");
         return tableSortResList;
     }
 
     /**
      * 获取表格数据
      */
-    private void getTableData(PolygonDataVo polygonDataVo) {
-        applyService.queryTableListByPolygon(polygonDataVo);
+    private Map<String, Object> getTableData(PolygonDataVo polygonDataVo) {
+        RequestResult requestResult = applyService.queryTableListByPolygon(polygonDataVo);
+        Map<String, Object> mapData = (Map<String, Object>) requestResult.get("data");
+        return mapData;
     }
 }