Переглянути джерело

fix: 页面坐标点数据接口增加自定义字段站点类型

chenxiaowei 2 роки тому
батько
коміт
7c86e8f7f6

+ 19 - 2
qhiot-leaflet/src/main/java/com/qhiot/leaflet/controller/LeafletController.java

@@ -607,6 +607,7 @@ public class LeafletController extends BaseController {
     @RequestMapping(value = "/mapMarkerJson", method = RequestMethod.POST)
     @ResponseBody
     public Object mapMarkerJson( @RequestParam(value = "stationTypes", required = false) String stationTypes,
+                                 @RequestParam(value = "customStationTypes", required = false) String customStationTypes,
                                  @RequestParam(value = "areaIds", required = false) String areaIds,
                                  @RequestParam(value = "warnFlag", required = false) String warnFlag,
                                  @RequestParam(value = "stationFlag", required = false) String stationFlag,
@@ -695,6 +696,12 @@ public class LeafletController extends BaseController {
                         }
 
                     }
+
+                    if (StringUtil.isNotBlank(customStationTypes)) {
+                        String[] split = customStationTypes.split(",");
+                        map.put("customStationTypes", split);
+                    }
+
                     if(StringUtil.isNotBlank(waterPalceType)){
                         if (waterPalceType.contains(",")){
                             String[] stIds = waterPalceType.split(",");
@@ -962,8 +969,18 @@ public class LeafletController extends BaseController {
     @ResponseBody
     public Object waterStationType() {
         try {
-            List<StationType> leafNode = stationTypeService.getLeafNode(getShiroUser().getTargetTenantId(), "5");
-            return AjaxResponse.success().put("waterStationTypeList",leafNode);
+            List<StationType> leafNode = stationTypeService.getLeafNode(getShiroUser().getTargetTenantId());
+            Map<String, List<StationType>> stationMap = new HashMap<>();
+            for (StationType stationType : leafNode) {
+                if (stationMap.containsKey(stationType.getCategory())) {
+                    stationMap.get(stationType.getCategory()).add(stationType);
+                } else {
+                    List<StationType> stationTypes = new ArrayList<>();
+                    stationTypes.add(stationType);
+                    stationMap.put(stationType.getCategory(), stationTypes);
+                }
+            }
+            return AjaxResponse.success().put("data", stationMap);
         } catch (Exception e) {
             LOGGER.error(e.getMessage(),e);
             return AjaxResponse.fail(e.getMessage());