|
@@ -0,0 +1,49 @@
|
|
|
|
|
+package com.zksy.web.controller.base;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.zksy.base.domain.vo.EquipmentBaseVO;
|
|
|
|
|
+import com.zksy.base.service.EquipmentBaseService;
|
|
|
|
|
+import com.zksy.common.annotation.Anonymous;
|
|
|
|
|
+import com.zksy.common.core.domain.AjaxResult;
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 物联感知设备 - GIS 地图点位
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * 统一管理供水、窨井等各根类型设备的 GIS 点位查询,前端通过菜单 {@code query} 注入的
|
|
|
|
|
+ * {@code rootTypeId}(1-供水设备 / 4-窨井设备,空=全部)控制数据范围,查询逻辑参考
|
|
|
|
|
+ * {@code WarningThresholdController}。
|
|
|
|
|
+ * </p>
|
|
|
|
|
+ */
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/equipment-gis")
|
|
|
|
|
+@Api(tags = "物联感知设备-GIS地图点位")
|
|
|
|
|
+public class EquipmentGISController {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private EquipmentBaseService service;
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/points")
|
|
|
|
|
+ @ApiOperation(value = "按根类型查询设备 GIS 点位", notes = "返回带经纬度的设备,用于地图打点")
|
|
|
|
|
+ @Anonymous
|
|
|
|
|
+ public AjaxResult points(
|
|
|
|
|
+ @ApiParam("设备根类型ID(菜单 rootTypeId 数据范围过滤,空=全部)。1-供水设备 4-窨井设备")
|
|
|
|
|
+ @RequestParam(required = false) Integer rootTypeId) {
|
|
|
|
|
+ // 复用统一设备台账查询,按根类型过滤并过滤掉无坐标的设备
|
|
|
|
|
+ Page<EquipmentBaseVO> page = service.findByPage(1L, 10000L, null, null, null,
|
|
|
|
|
+ rootTypeId, null, null, null, null, null, null);
|
|
|
|
|
+ List<EquipmentBaseVO> list = page.getRecords().stream()
|
|
|
|
|
+ .filter(v -> v.getLongitude() != null && v.getLatitude() != null)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|