From a13dc532aa93bfa9ce5c3c01323e00869f4f0b76 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: Tue, 27 Feb 2024 14:01:23 +0800
Subject: [PATCH] 大华setPTZ1调用普通方法

---
 ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 153 insertions(+), 25 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
index 78e357e..8a8c4ba 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -4,13 +4,27 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
 import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
-import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.core.domain.entity.SysConfig;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.utils.data.Query;
+import com.ruoyi.utils.pagehelper.JpaPageInfo;
+import com.ruoyi.utils.result.Results;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -27,21 +41,32 @@
 import com.ruoyi.common.core.page.TableDataInfo;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 井管理Controller
- * 
+ *
  * @author 刘苏义
  * @date 2023-03-07
  */
 @RestController
 @RequestMapping("/alarmpoints/well")
 @Api(tags = "井管理接口")
-public class ArdAlarmpointsWellController extends BaseController
-{
+public class ArdAlarmpointsWellController extends BaseController {
     @Resource
     private IArdAlarmpointsWellService ardAlarmpointsWellService;
+
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Autowired
+    private ISysDeptService sysDeptService;
+
+    @Autowired
+    private ISysConfigService sysConfigService;
 
     /**
      * 查询井管理列表
@@ -49,11 +74,18 @@
     @PreAuthorize("@ss.hasPermi('alarmpoints:well:list')")
     @GetMapping("/list")
     @ApiOperation("查询井列表")
-    public TableDataInfo list(ArdAlarmpointsWell ardAlarmpointsWell)
-    {
+    public TableDataInfo list(ArdAlarmpointsWell ardAlarmpointsWell) {
         startPage();
         List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell);
         return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('alarmpoints:well:list')")
+    @GetMapping("/nonPageList")
+    @ApiOperation("查询井列表-不分页")
+    public AjaxResult nonPageList(ArdAlarmpointsWell ardAlarmpointsWell) {
+        List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell);
+        return success(list);
     }
 
     /**
@@ -63,8 +95,7 @@
     @Log(title = "井管理", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation("导出井列表")
-    public void export(HttpServletResponse response, ArdAlarmpointsWell ardAlarmpointsWell)
-    {
+    public void export(HttpServletResponse response, ArdAlarmpointsWell ardAlarmpointsWell) {
         List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell);
         ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class);
         util.exportExcel(response, list, "井管理数据");
@@ -76,8 +107,7 @@
     @PreAuthorize("@ss.hasPermi('alarmpoints:well:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation("获取井详细信息")
-    public AjaxResult getInfo(@PathVariable("id") String id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") String id) {
         return success(ardAlarmpointsWellService.selectArdAlarmpointsWellById(id));
     }
 
@@ -88,9 +118,12 @@
     @Log(title = "井管理", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation("新增井")
-    public AjaxResult add(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell)
-    {
-        return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell));
+    public AjaxResult add(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
+        try {
+            return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell));
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
+        }
     }
 
     /**
@@ -100,9 +133,12 @@
     @Log(title = "井管理", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation("修改井")
-    public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell)
-    {
-        return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
+    public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
+        try {
+            return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
+        }
     }
 
     /**
@@ -110,10 +146,9 @@
      */
     @PreAuthorize("@ss.hasPermi('alarmpoints:well:remove')")
     @Log(title = "井管理", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
+    @DeleteMapping("/{ids}")
     @ApiOperation("删除井")
-    public AjaxResult remove(@PathVariable String[] ids)
-    {
+    public AjaxResult remove(@PathVariable String[] ids) {
         return toAjax(ardAlarmpointsWellService.deleteArdAlarmpointsWellByIds(ids));
     }
 
@@ -121,19 +156,112 @@
     @PreAuthorize("@ss.hasPermi('alarmpoints:well:import')")
     @PostMapping("/importData")
     @ApiOperation("导入井")
-    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
-    {
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
         ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class);
-        List<ArdAlarmpointsWell> userList = util.importExcel(file.getInputStream());
+        List<ArdAlarmpointsWell> wellList = util.importExcel(file.getInputStream());
         String operName = getUsername();
-        String message = ardAlarmpointsWellService.importUser(userList, updateSupport, operName);
+        String message = ardAlarmpointsWellService.importWell(wellList, updateSupport, operName);
         return success(message);
     }
+
     @PostMapping("/importTemplate")
     @ApiOperation("井导入模板")
-    public void importTemplate(HttpServletResponse response)
-    {
+    public void importTemplate(HttpServletResponse response) {
         ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class);
         util.importTemplateExcel(response, "井数据");
     }
+
+    /**
+     * 井选项数据
+     */
+    @GetMapping("/options")
+    @ApiOperation("井选项数据")
+    public List options(ArdAlarmpointsWell ardAlarmpointsWell) {
+        List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellByWellIdLike(ardAlarmpointsWell);
+        List options = new ArrayList();
+        for (ArdAlarmpointsWell item : list) {
+            Map option = new HashMap();
+            option.put("value", item.getId());
+            option.put("label", item.getWellId());
+            option.put("description", item.getOilProduction());
+            options.add(option);
+        }
+        return options;
+    }
+
+    @GetMapping("/wellById/{id}")
+    @ApiOperation("查询单条兴趣点")
+    public Results wellById(@PathVariable String id) {
+        return Results.succeed(ardAlarmpointsWellService.wellById(id));
+    }
+
+    @PostMapping("/wellList")
+    @ApiOperation("查询权限下所有兴趣点")
+    public Results wellList() {
+        String usersId = SecurityUtils.getUserId();
+        //根据userId查询部门Id
+        SysUser sysUser = sysUserService.selectUserById(usersId);
+        //根据当前deptId或者当前及所属下级的所有deptId
+        List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+        //根据deptId获取对应兴趣点数据
+        List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.wellList(deptList);
+        return Results.succeed(list);
+    }
+
+    @PostMapping("/conditionList")
+    @ApiOperation("查询并筛选权限下所有兴趣点")
+    public Results conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam) {
+        String usersId = SecurityUtils.getUserId();
+        //根据userId查询部门Id
+        SysUser sysUser = sysUserService.selectUserById(usersId);
+        //根据当前deptId或者当前及所属下级的所有deptId
+        List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+        ardAlarmpointsWellParam.setDeptList(deptList);
+        //根据deptId获取对应兴趣点数据
+        return Results.succeed(ardAlarmpointsWellService.conditionList(ardAlarmpointsWellParam));
+    }
+
+    @PostMapping("/getNearbyWells")
+    @ApiOperation("查询附近的所有井")
+    public AjaxResult getNearbyWells(Double longitude,Double latitude, Long deptId, Integer pageNum, Integer pageSize) {
+        JpaPageInfo jpaPageInfo = new JpaPageInfo();
+        jpaPageInfo.setPageNum(pageNum);
+        jpaPageInfo.setPageSize(pageSize);
+        List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(longitude,latitude, deptId, 1000);
+        jpaPageInfo.doPage(nearbyWellList);
+        return AjaxResult.success(jpaPageInfo);
+    }
+
+    @GetMapping("/getRTUDataYJ8")
+    @ApiOperation("查询设备运行状态")
+    public AjaxResult getRTUDataYJ8(String wellId){
+        return AjaxResult.success(Query.getRTUDataYJ8(wellId));
+    }
+
+    @GetMapping("/getWellDataByWellId")
+    @ApiOperation("查询设备动静态属性")
+    public AjaxResult getWellData(String wellId){
+        SysConfig config = new SysConfig();
+        config.setConfigKey("3coracle");
+        List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
+        Map<String,Object> result = ardAlarmpointsWellService.getWellDataByWellId(wellId,sysConfigResult);
+        return AjaxResult.success(result);
+    }
+
+    @GetMapping("/getWellDataByPatrolplanIdAndPosition")
+    @ApiOperation("查询最近巡检设备动静态属性")
+    public AjaxResult getWellDataByPatrolplanIdAndPosition(@RequestBody Map<String,Object> para){
+        SysConfig config = new SysConfig();
+        config.setConfigKey("3coracle");
+        List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
+        Map<String,Object> result = ardAlarmpointsWellService.getWellDataByPatrolplanIdAndPosition(para,sysConfigResult);
+        return AjaxResult.success(result);
+    }
+
+    @GetMapping("/getWellById")
+    @ApiOperation("根据查询兴趣点基本属性")
+    public AjaxResult getWellById(@RequestBody Map<String,String> para){
+        ArdAlarmpointsWell result = ardAlarmpointsWellService.getWellById(para.get("id"));
+        return AjaxResult.success(result);
+    }
 }

--
Gitblit v1.9.3