Commit c51873ef1e24319cc7439da42bfc2cc18f31ba48
1 parent
a8d4e5e8
feat(garden): 添加GIS道路管理和坐标转换功能
- 新增GIS道路管理相关控制器、服务和数据对象 - 实现WGS84到GCJ02坐标转换算法和工具类 - 添加GIS道路关联和取消关联功能 - 实现GIS道路坐标批量转换功能 - 添加GIS道路数据导入导出功能 - 新增问题类型级联查询接口优化前端展示 - 配置本地调试Mock认证支持 - 更新部署脚本和数据库表结构变更SQL
Showing
4 changed files
with
65 additions
and
27 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/gis/GisRoadController.java
| @@ -70,7 +70,6 @@ public class GisRoadController { | @@ -70,7 +70,6 @@ public class GisRoadController { | ||
| 70 | HttpServletResponse response) throws IOException { | 70 | HttpServletResponse response) throws IOException { |
| 71 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | 71 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 72 | List<GisRoadRespVO> list = gisRoadService.getGisRoadPage(pageReqVO).getList(); | 72 | List<GisRoadRespVO> list = gisRoadService.getGisRoadPage(pageReqVO).getList(); |
| 73 | - // 只导出表格展示的 6 列数据 | ||
| 74 | List<GisRoadExportVO> exportList = new ArrayList<>(); | 73 | List<GisRoadExportVO> exportList = new ArrayList<>(); |
| 75 | for (GisRoadRespVO vo : list) { | 74 | for (GisRoadRespVO vo : list) { |
| 76 | GisRoadExportVO exportVO = new GisRoadExportVO(); | 75 | GisRoadExportVO exportVO = new GisRoadExportVO(); |
| @@ -80,9 +79,23 @@ public class GisRoadController { | @@ -80,9 +79,23 @@ public class GisRoadController { | ||
| 80 | exportVO.setTotalArea(vo.getTotalArea()); | 79 | exportVO.setTotalArea(vo.getTotalArea()); |
| 81 | exportVO.setGisIsRelatedStr(vo.getGisIsRelated() != null && vo.getGisIsRelated() == 1 ? "已关联" : "未关联"); | 80 | exportVO.setGisIsRelatedStr(vo.getGisIsRelated() != null && vo.getGisIsRelated() == 1 ? "已关联" : "未关联"); |
| 82 | exportVO.setGisDiffArea(vo.getGisDiffArea()); | 81 | exportVO.setGisDiffArea(vo.getGisDiffArea()); |
| 82 | + exportVO.setCompanyName(vo.getCompanyName()); | ||
| 83 | + exportVO.setDeptName(vo.getDeptName()); | ||
| 84 | + // 位置信息:起点描述 ~ 终点描述 | ||
| 85 | + String positionInfo = ""; | ||
| 86 | + if (vo.getStartingRemark() != null) { | ||
| 87 | + positionInfo += vo.getStartingRemark(); | ||
| 88 | + } | ||
| 89 | + if (vo.getEndRemark() != null) { | ||
| 90 | + if (!positionInfo.isEmpty()) { | ||
| 91 | + positionInfo += " ~ "; | ||
| 92 | + } | ||
| 93 | + positionInfo += vo.getEndRemark(); | ||
| 94 | + } | ||
| 95 | + exportVO.setPositionInfo(positionInfo.isEmpty() ? null : positionInfo); | ||
| 83 | exportList.add(exportVO); | 96 | exportList.add(exportVO); |
| 84 | } | 97 | } |
| 85 | - String filename = "GIS核对" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xls"; | 98 | + String filename = "十谱绿地核对" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xls"; |
| 86 | ExcelUtils.write(response, filename, "数据", GisRoadExportVO.class, exportList); | 99 | ExcelUtils.write(response, filename, "数据", GisRoadExportVO.class, exportList); |
| 87 | } | 100 | } |
| 88 | 101 |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/gis/vo/GisRoadExportVO.java
| @@ -7,21 +7,21 @@ import lombok.Data; | @@ -7,21 +7,21 @@ import lombok.Data; | ||
| 7 | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | 7 | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 8 | import cn.idev.excel.annotation.ExcelProperty; | 8 | import cn.idev.excel.annotation.ExcelProperty; |
| 9 | 9 | ||
| 10 | -@Schema(description = "GIS 道路核对导出 VO") | 10 | +@Schema(description = "十谱绿地核对导出 VO") |
| 11 | @Data | 11 | @Data |
| 12 | @ExcelIgnoreUnannotated | 12 | @ExcelIgnoreUnannotated |
| 13 | public class GisRoadExportVO { | 13 | public class GisRoadExportVO { |
| 14 | 14 | ||
| 15 | - @Schema(description = "图斑名称") | ||
| 16 | - @ExcelProperty("图斑名称") | 15 | + @Schema(description = "十谱绿地名称") |
| 16 | + @ExcelProperty("十谱绿地名称") | ||
| 17 | private String gisPlotName; | 17 | private String gisPlotName; |
| 18 | 18 | ||
| 19 | @Schema(description = "道路名称") | 19 | @Schema(description = "道路名称") |
| 20 | @ExcelProperty("道路名称") | 20 | @ExcelProperty("道路名称") |
| 21 | private String roadName; | 21 | private String roadName; |
| 22 | 22 | ||
| 23 | - @Schema(description = "图斑面积") | ||
| 24 | - @ExcelProperty("图斑面积(㎡)") | 23 | + @Schema(description = "十谱绿地面积") |
| 24 | + @ExcelProperty("十谱绿地面积(㎡)") | ||
| 25 | @JsonSerialize(using = TwoDecimalFloatSerializer.class) | 25 | @JsonSerialize(using = TwoDecimalFloatSerializer.class) |
| 26 | private Float gisPlotArea; | 26 | private Float gisPlotArea; |
| 27 | 27 | ||
| @@ -39,4 +39,16 @@ public class GisRoadExportVO { | @@ -39,4 +39,16 @@ public class GisRoadExportVO { | ||
| 39 | @JsonSerialize(using = TwoDecimalFloatSerializer.class) | 39 | @JsonSerialize(using = TwoDecimalFloatSerializer.class) |
| 40 | private Float gisDiffArea; | 40 | private Float gisDiffArea; |
| 41 | 41 | ||
| 42 | + @Schema(description = "归属单位") | ||
| 43 | + @ExcelProperty("归属单位") | ||
| 44 | + private String companyName; | ||
| 45 | + | ||
| 46 | + @Schema(description = "归属班组") | ||
| 47 | + @ExcelProperty("归属班组") | ||
| 48 | + private String deptName; | ||
| 49 | + | ||
| 50 | + @Schema(description = "位置信息") | ||
| 51 | + @ExcelProperty("位置信息") | ||
| 52 | + private String positionInfo; | ||
| 53 | + | ||
| 42 | } | 54 | } |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/gis/GisRoadServiceImpl.java
| @@ -124,19 +124,11 @@ public class GisRoadServiceImpl implements GisRoadService { | @@ -124,19 +124,11 @@ public class GisRoadServiceImpl implements GisRoadService { | ||
| 124 | .set(RoadDO::getGisIsRelated, 0)); | 124 | .set(RoadDO::getGisIsRelated, 0)); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | - // 清空 garden_gis_road 的道路关联信息 | 127 | + // 取消关联:仅将关联状态置为 0,其他字段因数据库 NOT NULL 约束保留原值 |
| 128 | gisRoadMapper.update(null, | 128 | gisRoadMapper.update(null, |
| 129 | new LambdaUpdateWrapper<GisRoadDO>() | 129 | new LambdaUpdateWrapper<GisRoadDO>() |
| 130 | .eq(GisRoadDO::getId, gisRoad.getId()) | 130 | .eq(GisRoadDO::getId, gisRoad.getId()) |
| 131 | - .set(GisRoadDO::getGisRoadId, null) | ||
| 132 | - .set(GisRoadDO::getRoadName, null) | ||
| 133 | - .set(GisRoadDO::getTotalArea, null) | ||
| 134 | - .set(GisRoadDO::getCompanyId, null) | ||
| 135 | - .set(GisRoadDO::getDeptId, null) | ||
| 136 | - .set(GisRoadDO::getGisDiffArea, null) | ||
| 137 | - .set(GisRoadDO::getGisIsRelated, 0) | ||
| 138 | - .set(GisRoadDO::getGisRelatedUser, null) | ||
| 139 | - .set(GisRoadDO::getGisRelatedTime, null)); | 131 | + .set(GisRoadDO::getGisIsRelated, 0)); |
| 140 | } | 132 | } |
| 141 | 133 | ||
| 142 | @Override | 134 | @Override |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/problemtype/GardenProblemTypeServiceImpl.java
| @@ -98,12 +98,33 @@ public class GardenProblemTypeServiceImpl implements GardenProblemTypeService { | @@ -98,12 +98,33 @@ public class GardenProblemTypeServiceImpl implements GardenProblemTypeService { | ||
| 98 | 98 | ||
| 99 | @Override | 99 | @Override |
| 100 | public List<ProblemTypeCascadeRespVO> getProblemTypeTree(String parentCode) { | 100 | public List<ProblemTypeCascadeRespVO> getProblemTypeTree(String parentCode) { |
| 101 | - List<GardenProblemTypeDO> allList = gardenProblemTypeMapper.selectList( | ||
| 102 | - new com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX<GardenProblemTypeDO>() | ||
| 103 | - .eq(GardenProblemTypeDO::getStatus, 1) | ||
| 104 | - .eq(GardenProblemTypeDO::getParentCode, parentCode) | ||
| 105 | - .orderByAsc(GardenProblemTypeDO::getSort) | ||
| 106 | - .orderByAsc(GardenProblemTypeDO::getId)); | 101 | + List<GardenProblemTypeDO> allList; |
| 102 | + | ||
| 103 | + if (parentCode == null) { | ||
| 104 | + allList = gardenProblemTypeMapper.selectList( | ||
| 105 | + new com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX<GardenProblemTypeDO>() | ||
| 106 | + .eq(GardenProblemTypeDO::getStatus, 1) | ||
| 107 | + .orderByAsc(GardenProblemTypeDO::getSort) | ||
| 108 | + .orderByAsc(GardenProblemTypeDO::getId)); | ||
| 109 | + } else { | ||
| 110 | + List<GardenProblemTypeDO> level2List = gardenProblemTypeMapper.selectByParentCodeAndLevel(parentCode, 2); | ||
| 111 | + | ||
| 112 | + List<String> level2Codes = level2List.stream() | ||
| 113 | + .map(GardenProblemTypeDO::getTypeCode) | ||
| 114 | + .collect(Collectors.toList()); | ||
| 115 | + | ||
| 116 | + List<GardenProblemTypeDO> level3List = new ArrayList<>(); | ||
| 117 | + if (!level2Codes.isEmpty()) { | ||
| 118 | + level3List = gardenProblemTypeMapper.selectList( | ||
| 119 | + new com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX<GardenProblemTypeDO>() | ||
| 120 | + .eq(GardenProblemTypeDO::getStatus, 1) | ||
| 121 | + .in(GardenProblemTypeDO::getParentCode, level2Codes)); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + allList = new ArrayList<>(); | ||
| 125 | + allList.addAll(level2List); | ||
| 126 | + allList.addAll(level3List); | ||
| 127 | + } | ||
| 107 | 128 | ||
| 108 | Map<String, List<GardenProblemTypeDO>> childrenMap = allList.stream() | 129 | Map<String, List<GardenProblemTypeDO>> childrenMap = allList.stream() |
| 109 | .filter(item -> item.getParentCode() != null && !item.getParentCode().equals(item.getTypeCode())) | 130 | .filter(item -> item.getParentCode() != null && !item.getParentCode().equals(item.getTypeCode())) |
| @@ -119,11 +140,11 @@ public class GardenProblemTypeServiceImpl implements GardenProblemTypeService { | @@ -119,11 +140,11 @@ public class GardenProblemTypeServiceImpl implements GardenProblemTypeService { | ||
| 119 | result.add(vo); | 140 | result.add(vo); |
| 120 | } | 141 | } |
| 121 | } else { | 142 | } else { |
| 122 | - List<GardenProblemTypeDO> parentList = allList.stream() | ||
| 123 | - .filter(item -> parentCode.equals(item.getTypeCode())) | 143 | + List<GardenProblemTypeDO> childrenList = allList.stream() |
| 144 | + .filter(item -> parentCode.equals(item.getParentCode())) | ||
| 124 | .collect(Collectors.toList()); | 145 | .collect(Collectors.toList()); |
| 125 | - for (GardenProblemTypeDO parent : parentList) { | ||
| 126 | - ProblemTypeCascadeRespVO vo = buildTreeNode(parent, childrenMap); | 146 | + for (GardenProblemTypeDO child : childrenList) { |
| 147 | + ProblemTypeCascadeRespVO vo = buildTreeNode(child, childrenMap); | ||
| 127 | result.add(vo); | 148 | result.add(vo); |
| 128 | } | 149 | } |
| 129 | } | 150 | } |