From 00c5f924450bade3b016485b6a3490e03299023d Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Wed, 10 Apr 2024 17:57:02 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/service/impl/AsDeviceServiceImpl.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java index f388d87..9b4d82b 100644 --- a/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java +++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java @@ -205,15 +205,21 @@ public class AsDeviceServiceImpl extends ServiceImpl i String pulseModeSwitch = "true".equals(asDevice.getPulseMode()) ? "1" : "0";//脉冲模式开关 JSONObject pulseModeParamObj = JSON.parseObject(asDevice.getPulseModeParam()); //将‘0分3秒’这样的字符串转换成秒 - int sprayTime1 = convertStringToSeconds(pulseModeParamObj.getString("sprayTime"));//喷洒时间 - int intervalTime = convertStringToSeconds(pulseModeParamObj.getString("intervalTime"));//间隔时间 + int sprayTime1 = convertStringToSeconds(pulseModeParamObj.getString("js_sec"));//喷洒时间 + int intervalTime = convertStringToSeconds(pulseModeParamObj.getString("jg_sec"));//间隔时间 Integer waterIntensity = asDevice.getWaterIntensity(); String min = asDevice.getScreenRestTime().replace("min", "");//息屏时间转换成秒 - Integer minNum = Integer.parseInt(min) * 60; - Integer hourNum = Integer.parseInt(min.replace("hour", "")) * 60 * 60; - String screenRestTime = min.contains("hour") ? hourNum.toString() : minNum.toString(); + String screenRestTime; + if(min.contains("hour")){ + String hour = min.replace("hour", ""); + Integer hourNum = Integer.parseInt(hour) * 60 * 60; + screenRestTime = hourNum.toString(); + }else{ + Integer minNum = Integer.parseInt(min) * 60; + screenRestTime = minNum.toString(); + } String screenRestTimeSwitch = "99".equals(asDevice.getScreenRestTime()) ? "0" : "1";//息屏开关 StringBuilder command = new StringBuilder() .append("qiangdu").append(waterIntensity).append(IotConstants.COMMAND_SEPARATOR)