From 0abccf5e570dce53a802bca4ce25118dd900692c Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 23 二月 2024 14:07:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 112 insertions(+), 6 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 3ee4de7..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,11 +4,24 @@
 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.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;
@@ -46,6 +59,15 @@
     @Resource
     private IArdAlarmpointsWellService ardAlarmpointsWellService;
 
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Autowired
+    private ISysDeptService sysDeptService;
+
+    @Autowired
+    private ISysConfigService sysConfigService;
+
     /**
      * 鏌ヨ浜曠鐞嗗垪琛�
      */
@@ -56,6 +78,14 @@
         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);
     }
 
     /**
@@ -91,8 +121,8 @@
     public AjaxResult add(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
         try {
             return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell));
-        } catch (DuplicateKeyException e) {
-            return AjaxResult.error("浜曞彿閲嶅");
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
         }
     }
 
@@ -106,8 +136,8 @@
     public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
         try {
             return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
-        } catch (DuplicateKeyException e) {
-            return AjaxResult.error("浜曞彿閲嶅");
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
         }
     }
 
@@ -128,9 +158,9 @@
     @ApiOperation("瀵煎叆浜�")
     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);
     }
 
@@ -158,4 +188,80 @@
         }
         return options;
     }
+
+    @GetMapping("/wellById/{id}")
+    @ApiOperation("鏌ヨ鍗曟潯鍏磋叮鐐�")
+    public Results wellById(@PathVariable String id) {
+        return Results.succeed(ardAlarmpointsWellService.wellById(id));
+    }
+
+    @PostMapping("/wellList")
+    @ApiOperation("鏌ヨ鏉冮檺涓嬫墍鏈夊叴瓒g偣")
+    public Results wellList() {
+        String usersId = SecurityUtils.getUserId();
+        //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+        SysUser sysUser = sysUserService.selectUserById(usersId);
+        //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+        List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+        //鏍规嵁deptId鑾峰彇瀵瑰簲鍏磋叮鐐规暟鎹�
+        List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.wellList(deptList);
+        return Results.succeed(list);
+    }
+
+    @PostMapping("/conditionList")
+    @ApiOperation("鏌ヨ骞剁瓫閫夋潈闄愪笅鎵�鏈夊叴瓒g偣")
+    public Results conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam) {
+        String usersId = SecurityUtils.getUserId();
+        //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+        SysUser sysUser = sysUserService.selectUserById(usersId);
+        //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+        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