From de20216b43bc0a23a65bf40d704afed8c8a109fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E9=9B=AA=E4=BC=9F?= Date: Thu, 7 Nov 2024 13:56:40 +0800 Subject: [PATCH] =?UTF-8?q?TD=E6=9C=8D=E5=8A=A1bug=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9D=90=E6=A0=87=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HwDeviceController.java | 7 +++++++ .../controller/TdEngineController.java | 19 +++++++++++++++++++ .../ruoyi/tdengine/mapper/TdEngineMapper.java | 2 ++ .../tdengine/service/ITdEngineService.java | 2 ++ .../service/impl/TdEngineServiceImpl.java | 4 ++++ .../mapper/tdengine/TdEngineMapper.xml | 4 ++++ 6 files changed, 38 insertions(+) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java index 6a4cd40..0b434b0 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java @@ -53,6 +53,7 @@ public class HwDeviceController extends BaseController { @Autowired private IHwSceneService hwSceneService; + /** * 查询设备信息列表 */ @@ -251,4 +252,10 @@ public class HwDeviceController extends BaseController { return AjaxResult.success(hwDeviceModeService.getDeviceByModel(modelId)); } + @GetMapping("/getDeviceLocation") + private AjaxResult getDeviceLocation(Long deviceId){ + Map deviceLocation = hwDeviceService.getDeviceLocation(deviceId); + return AjaxResult.success(deviceLocation); + } + } diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java index 232af38..03b8c3a 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java @@ -329,6 +329,25 @@ public class TdEngineController { return R.fail(e.getMessage()); } } + @InnerAuth + @PostMapping("/getDeviceLocation") + public R getDeviceLocation(@Validated @RequestBody TdSelectDto tdSelectDto) { + try { + return R.ok(this.tdEngineService.getDeviceLocation(tdSelectDto)); + } catch (UncategorizedSQLException e) { + String message = e.getCause().getMessage(); + try { + message = message.substring(message.lastIndexOf("invalid operation")); + } catch (Exception ex) { + } + log.error(message); + return R.fail(message); + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } + /** * @return R>> diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java index 0e0a03c..70b638f 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java @@ -163,6 +163,8 @@ public interface TdEngineMapper { void dropTable(@Param("databaseName") String databaseName, @Param("tableName") String tableName); + Map getDeviceLocation(TdSelectDto tdSelectDto); + // /** // * 检查表是否存在 // * @param dataBaseName diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java index 1ab6212..5aa074c 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java @@ -141,6 +141,8 @@ public interface ITdEngineService { * @date 2024-04-20 11:08 */ public void dropTable(String databaseName, String tableName) throws Exception; + + Map getDeviceLocation(TdSelectDto tdSelectDto); // void initSTableFrame(String msg) throws Exception; // List> getRealtimeData(SelectVisualDto selectVisualDto); diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java index 134c706..a1859d8 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java @@ -242,6 +242,10 @@ public class TdEngineServiceImpl implements ITdEngineService { } + @Override + public Map getDeviceLocation(TdSelectDto tdSelectDto) { + return this.tdEngineMapper.getDeviceLocation(tdSelectDto); + } /** * @param: databaseName diff --git a/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml b/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml index f85667c..e5d99c3 100644 --- a/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml +++ b/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml @@ -309,6 +309,10 @@ group by timetruncate(ts,1d),devicetype,onlinestatus,devicecode order by ts +