Commit 14b32640adba2e67f69626070c076741cc3a1ea0
1 parent
2a5db419
feat(garden): 添加GIS道路管理和坐标转换功能
- 新增GIS道路管理相关控制器、服务和数据对象 - 实现WGS84到GCJ02坐标转换算法和工具类 - 添加GIS道路关联和取消关联功能 - 实现GIS道路坐标批量转换功能 - 添加GIS道路数据导入导出功能 - 新增问题类型级联查询接口优化前端展示 - 配置本地调试Mock认证支持 - 更新部署脚本和数据库表结构变更SQL
Showing
2 changed files
with
16 additions
and
81 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/gis/GisRoadController.java
| @@ -17,7 +17,6 @@ import java.io.IOException; | @@ -17,7 +17,6 @@ import java.io.IOException; | ||
| 17 | import java.time.LocalDate; | 17 | import java.time.LocalDate; |
| 18 | import java.time.format.DateTimeFormatter; | 18 | import java.time.format.DateTimeFormatter; |
| 19 | import java.util.*; | 19 | import java.util.*; |
| 20 | -import java.util.stream.Collectors; | ||
| 21 | 20 | ||
| 22 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 21 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 23 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 22 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| @@ -68,105 +67,38 @@ public class GisRoadController { | @@ -68,105 +67,38 @@ public class GisRoadController { | ||
| 68 | @PreAuthorize("@ss.hasPermission('garden:gis-road:export')") | 67 | @PreAuthorize("@ss.hasPermission('garden:gis-road:export')") |
| 69 | @ApiAccessLog(operateType = EXPORT) | 68 | @ApiAccessLog(operateType = EXPORT) |
| 70 | public void exportGisRoadExcel(@Valid GisRoadPageReqVO pageReqVO, | 69 | public void exportGisRoadExcel(@Valid GisRoadPageReqVO pageReqVO, |
| 71 | - HttpServletResponse response) throws IOException { | 70 | + HttpServletResponse response) throws IOException { |
| 72 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | 71 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 73 | List<GisRoadRespVO> list = gisRoadService.getGisRoadPage(pageReqVO).getList(); | 72 | List<GisRoadRespVO> list = gisRoadService.getGisRoadPage(pageReqVO).getList(); |
| 74 | - | ||
| 75 | - // 按道路名称分组 | ||
| 76 | - Map<String, List<GisRoadRespVO>> groupedByRoad = new LinkedHashMap<>(); | ||
| 77 | - List<GisRoadRespVO> unassociatedList = new ArrayList<>(); | ||
| 78 | - for (GisRoadRespVO vo : list) { | ||
| 79 | - if (vo.getRoadName() == null || vo.getRoadName().isEmpty()) { | ||
| 80 | - unassociatedList.add(vo); | ||
| 81 | - } else { | ||
| 82 | - groupedByRoad.computeIfAbsent(vo.getRoadName(), k -> new ArrayList<>()).add(vo); | ||
| 83 | - } | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | List<GisRoadExportVO> exportList = new ArrayList<>(); | 73 | List<GisRoadExportVO> exportList = new ArrayList<>(); |
| 87 | - | ||
| 88 | - // 未关联的记录:保持原样 | ||
| 89 | - for (GisRoadRespVO vo : unassociatedList) { | 74 | + for (GisRoadRespVO vo : list) { |
| 90 | GisRoadExportVO exportVO = new GisRoadExportVO(); | 75 | GisRoadExportVO exportVO = new GisRoadExportVO(); |
| 91 | exportVO.setGisPlotName(vo.getGisPlotName()); | 76 | exportVO.setGisPlotName(vo.getGisPlotName()); |
| 92 | exportVO.setRoadName(vo.getRoadName()); | 77 | exportVO.setRoadName(vo.getRoadName()); |
| 93 | - exportVO.setGisPlotArea(vo.getGisPlotArea() != null ? String.format("%.2f", vo.getGisPlotArea()) : null); | 78 | + exportVO.setGisPlotArea(vo.getGisPlotArea()); |
| 94 | exportVO.setTotalArea(vo.getTotalArea()); | 79 | exportVO.setTotalArea(vo.getTotalArea()); |
| 95 | - exportVO.setGisIsRelatedStr("未关联"); | 80 | + exportVO.setGisIsRelatedStr(vo.getGisIsRelated() != null && vo.getGisIsRelated() == 1 ? "已关联" : "未关联"); |
| 96 | exportVO.setGisDiffArea(vo.getGisDiffArea()); | 81 | exportVO.setGisDiffArea(vo.getGisDiffArea()); |
| 97 | exportVO.setCompanyName(vo.getCompanyName()); | 82 | exportVO.setCompanyName(vo.getCompanyName()); |
| 98 | exportVO.setDeptName(vo.getDeptName()); | 83 | exportVO.setDeptName(vo.getDeptName()); |
| 99 | - String positionInfo = buildPositionInfo(vo); | ||
| 100 | - exportVO.setPositionInfo(positionInfo.isEmpty() ? null : positionInfo); | ||
| 101 | - exportList.add(exportVO); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - // 已关联的记录:按道路名称合并 | ||
| 105 | - for (Map.Entry<String, List<GisRoadRespVO>> entry : groupedByRoad.entrySet()) { | ||
| 106 | - List<GisRoadRespVO> group = entry.getValue(); | ||
| 107 | - GisRoadRespVO first = group.get(0); | ||
| 108 | - | ||
| 109 | - GisRoadExportVO exportVO = new GisRoadExportVO(); | ||
| 110 | - exportVO.setRoadName(entry.getKey()); | ||
| 111 | - | ||
| 112 | - // 十谱绿地名称:用顿号拼接 | ||
| 113 | - exportVO.setGisPlotName(group.stream() | ||
| 114 | - .map(GisRoadRespVO::getGisPlotName) | ||
| 115 | - .filter(Objects::nonNull) | ||
| 116 | - .collect(Collectors.joining("、"))); | ||
| 117 | - | ||
| 118 | - // 十谱绿地面积:一一对应拼接,不求和 | ||
| 119 | - exportVO.setGisPlotArea(group.stream() | ||
| 120 | - .map(v -> v.getGisPlotArea() != null ? String.format("%.2f", v.getGisPlotArea()) : "0.00") | ||
| 121 | - .collect(Collectors.joining("、"))); | ||
| 122 | - | ||
| 123 | - // 道路面积:求和 | ||
| 124 | - float sumTotalArea = 0; | ||
| 125 | - for (GisRoadRespVO v : group) { | ||
| 126 | - if (v.getTotalArea() != null) { | ||
| 127 | - sumTotalArea += v.getTotalArea(); | ||
| 128 | - } | 84 | + // 位置信息:起点描述 ~ 终点描述 |
| 85 | + String positionInfo = ""; | ||
| 86 | + if (vo.getStartingRemark() != null) { | ||
| 87 | + positionInfo += vo.getStartingRemark(); | ||
| 129 | } | 88 | } |
| 130 | - exportVO.setTotalArea(sumTotalArea); | ||
| 131 | - | ||
| 132 | - // 十谱绿地面积求和(用于计算差异面积) | ||
| 133 | - float sumGisPlotArea = 0; | ||
| 134 | - for (GisRoadRespVO v : group) { | ||
| 135 | - if (v.getGisPlotArea() != null) { | ||
| 136 | - sumGisPlotArea += v.getGisPlotArea(); | 89 | + if (vo.getEndRemark() != null) { |
| 90 | + if (!positionInfo.isEmpty()) { | ||
| 91 | + positionInfo += " ~ "; | ||
| 137 | } | 92 | } |
| 93 | + positionInfo += vo.getEndRemark(); | ||
| 138 | } | 94 | } |
| 139 | - | ||
| 140 | - // 差异面积:十谱绿地面积合计 - 道路面积合计 | ||
| 141 | - exportVO.setGisDiffArea(sumGisPlotArea - sumTotalArea); | ||
| 142 | - | ||
| 143 | - exportVO.setGisIsRelatedStr("已关联"); | ||
| 144 | - exportVO.setCompanyName(first.getCompanyName()); | ||
| 145 | - exportVO.setDeptName(first.getDeptName()); | ||
| 146 | - // 位置信息:起点描述 ~ 终点描述 | ||
| 147 | - String positionInfo = buildPositionInfo(first); | ||
| 148 | exportVO.setPositionInfo(positionInfo.isEmpty() ? null : positionInfo); | 95 | exportVO.setPositionInfo(positionInfo.isEmpty() ? null : positionInfo); |
| 149 | exportList.add(exportVO); | 96 | exportList.add(exportVO); |
| 150 | } | 97 | } |
| 151 | - | ||
| 152 | String filename = "十谱绿地核对" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xls"; | 98 | String filename = "十谱绿地核对" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xls"; |
| 153 | ExcelUtils.write(response, filename, "数据", GisRoadExportVO.class, exportList); | 99 | ExcelUtils.write(response, filename, "数据", GisRoadExportVO.class, exportList); |
| 154 | } | 100 | } |
| 155 | 101 | ||
| 156 | - private String buildPositionInfo(GisRoadRespVO vo) { | ||
| 157 | - String positionInfo = ""; | ||
| 158 | - if (vo.getStartingRemark() != null) { | ||
| 159 | - positionInfo += vo.getStartingRemark(); | ||
| 160 | - } | ||
| 161 | - if (vo.getEndRemark() != null) { | ||
| 162 | - if (!positionInfo.isEmpty()) { | ||
| 163 | - positionInfo += " ~ "; | ||
| 164 | - } | ||
| 165 | - positionInfo += vo.getEndRemark(); | ||
| 166 | - } | ||
| 167 | - return positionInfo; | ||
| 168 | - } | ||
| 169 | - | ||
| 170 | @PostMapping("/associate") | 102 | @PostMapping("/associate") |
| 171 | @Operation(summary = "关联道路到 GIS 图斑") | 103 | @Operation(summary = "关联道路到 GIS 图斑") |
| 172 | // @PreAuthorize("@ss.hasPermission('garden:gis-road:query')") | 104 | // @PreAuthorize("@ss.hasPermission('garden:gis-road:query')") |
| @@ -193,3 +125,5 @@ public class GisRoadController { | @@ -193,3 +125,5 @@ public class GisRoadController { | ||
| 193 | } | 125 | } |
| 194 | 126 | ||
| 195 | } | 127 | } |
| 128 | + | ||
| 129 | + |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/gis/vo/GisRoadExportVO.java
| @@ -22,7 +22,8 @@ public class GisRoadExportVO { | @@ -22,7 +22,8 @@ public class GisRoadExportVO { | ||
| 22 | 22 | ||
| 23 | @Schema(description = "十谱绿地面积") | 23 | @Schema(description = "十谱绿地面积") |
| 24 | @ExcelProperty("十谱绿地面积(㎡)") | 24 | @ExcelProperty("十谱绿地面积(㎡)") |
| 25 | - private String gisPlotArea; | 25 | + @JsonSerialize(using = TwoDecimalFloatSerializer.class) |
| 26 | + private Float gisPlotArea; | ||
| 26 | 27 | ||
| 27 | @Schema(description = "道路面积") | 28 | @Schema(description = "道路面积") |
| 28 | @ExcelProperty("道路面积(㎡)") | 29 | @ExcelProperty("道路面积(㎡)") |