zhitan-admin/src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-airconditioner/src/main/java/com/zhitan/airconditioner/common/AirCondConstants.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-airconditioner/src/main/java/com/zhitan/airconditioner/service/impl/AirConditionerServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/views/svg/components/configure.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/views/svg/components/configureView.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
zhitan-admin/src/main/resources/application.yml
@@ -12,7 +12,8 @@ # éªè¯ç ç±»å math æ°åè®¡ç® char å符éªè¯ captchaType: math # ååå°å domainName: http://127.0.0.1:8088 # domainName: http://127.0.0.1:8088 domainName: http://192.168.0.24:8888/prod-api # å¼åç¯å¢é ç½® server: zhitan-airconditioner/src/main/java/com/zhitan/airconditioner/common/AirCondConstants.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,10 @@ package com.zhitan.airconditioner.common; public class AirCondConstants { public static final String COOL_OPEN = "0"; public static final String HOT_OPEN = "1"; public static final String OFF = "2"; public static final String SEND_COMMAND_TOPIC = "lanbao/nygl/sevice/kt1/down"; } zhitan-airconditioner/src/main/java/com/zhitan/airconditioner/service/impl/AirConditionerServiceImpl.java
@@ -4,6 +4,7 @@ import java.util.List; import com.alibaba.fastjson2.JSONObject; import com.zhitan.airconditioner.common.AirCondConstants; import com.zhitan.airconditioner.domain.AirConditioner; import com.zhitan.airconditioner.domain.AirConditionerLog; import com.zhitan.airconditioner.mapper.AirConditionerLogMapper; @@ -12,6 +13,8 @@ import com.zhitan.common.utils.DateUtils; import com.zhitan.common.utils.SecurityUtils; import com.zhitan.framework.mqtt.MqttClientUtil; import com.zhitan.realtimedata.domain.TagValue; import com.zhitan.realtimedata.service.RealtimeDatabaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -31,6 +34,9 @@ @Autowired private MqttClientUtil mqttClientUtil; @Autowired private RealtimeDatabaseService realtimeDatabaseService; /** * æ¥è¯¢ç©ºè°æ§å¶å¨å表 @@ -176,20 +182,19 @@ JSONObject jsonObject = JSONObject.parseObject(msg); JSONObject rwProt = jsonObject.getJSONObject("rw_prot"); rwProt.put("id", airConditioner.getControllerId()); if ("0".equals(mode)) { if (AirCondConstants.COOL_OPEN.equals(mode)) { rwProt.getJSONArray("w_data").getJSONObject(0).put("value", "1"); } else if ("1".equals(mode)) { } else if (AirCondConstants.HOT_OPEN.equals(mode)) { rwProt.getJSONArray("w_data").getJSONObject(1).put("value", "1"); } else if ("2".equals(mode)) { } else if (AirCondConstants.OFF.equals(mode)) { rwProt.getJSONArray("w_data").getJSONObject(2).put("value", "1"); } // æå»ºMQTTæ¶æ¯ String topic = "lanbao/nygl/sevice/kt1/down"; String message = jsonObject.toJSONString(); // åéMQTTæ¶æ¯ mqttClientUtil.sendMessage(topic, message, 2); mqttClientUtil.sendMessage(AirCondConstants.SEND_COMMAND_TOPIC, message, 2); // è®°å½æä½æ¥å¿ AirConditionerLog log = new AirConditionerLog(); log.setAirConditionerId(id); zhitan-vue/src/views/svg/components/configure.vue
@@ -104,17 +104,19 @@ /* çå¬xhr对象 */ xhr.addEventListener("load", () => { svgHtml.value = xhr.responseText let values = xhr.responseXML.getElementsByTagName("text") let values = xhr.responseXML.getElementsByTagName("g") let tagTemps = [] for (let i = 0; i < values.length; i++) { if (values[i].getAttribute("id") != undefined) let tag_id = values[i].getAttribute("id"); // tag_idä¸ä¸ºç©ºå¹¶ä¸ä»¥EVå¼å ³ if (tag_id != undefined && tag_id.startsWith("EV")) { tagTemps.push({ param: values[i].textContent, param: values[i].id.split("_")[0], tag: "", tagType: "COLLECT", }) } } console.log(tags.value.length, tagTemps.length) if (tags.value.length === 0 || tags.value.length != tagTemps.length) { tags.value = [] tags.value = tagTemps zhitan-vue/src/views/svg/components/configureView.vue
@@ -45,10 +45,12 @@ } function refresh() { //console.log("refresh", tagCodes.value) if (tagCodes.value.length === 0) { return } getLiveData(tagCodes.value).then((response) => { // console.log("tagCodes:::", tagCodes.value) if (response.code === 200) { if (response.data) { response.data.forEach((tagValue) => { @@ -58,20 +60,39 @@ } else { value = "0" } // console.log("tagValue::",tagValue) let el = document.getElementById(tagValue.tagCode) if (el) { el.textContent = value // 夿tagValue.tagCodeæ¯ä¸æ¯ä»¥oldæsevenæoutå¼å¤´ if (tagValue.tagCode.startsWith("old") || tagValue.tagCode.startsWith("seven") || tagValue.tagCode.startsWith("out")) { // è·å elä¸çgæ ç¾ä¸çtextæ ç¾ï¼èµå¼ä¸ºvalue let svgTextElement = el.querySelector("g").querySelector("text"); console.log("svgTextElement::",svgTextElement) svgTextElement.textContent = value; }else { if (parseFloat(value) > 0) { el.setAttribute("fill", "rgb(0,234,136)") }else { el.setAttribute("fill", "rgb(255,82,96)") } } // console.log("el::",el) // å°elçfill屿§è®¾ç½®ä¸º23 } }) //è¿åæ¯åç¬å ç ç¨æ¥å¤ç æ²¡æææ æè ææ æ²¡æç»æç é½è®¾ç½®0 let allText = document.getElementsByTagName("text") for (let i = 0; i < allText.length; i++) { // console.log(i + "textContent=" + allText[i].textContent); if (allText[i].textContent == null || allText[i].textContent == "") { allText[i].textContent = "0" } } // let allText = document.getElementsByTagName("g") // for (let i = 0; i < allText.length; i++) { // // console.log(i + "textContent=" + allText[i].textContent); // if (allText[i].textContent == null || allText[i].textContent == "") { // allText[i].textContent = "0" // } // } } } }) @@ -101,12 +122,13 @@ xhr.addEventListener("load", () => { const resXML = xhr.responseXML let svgDom = resXML.documentElement.cloneNode(true) let values = svgDom.getElementsByTagName("text") let values = svgDom.getElementsByTagName("g") for (let i = 0; i < values.length; i++) { let tag = tags.value.filter((f) => f.param === values[i].textContent) let tag_id = values[i].getAttribute("id"); let tag = tags.value.filter((f) => f.param === values[i].id.split("_")[0]) if (tag && tag.length > 0) { let tagCode = tag[0].tag values[i].textContent = "" if (tagCode) { values[i].setAttribute("id", tagCode) tagCodes.value.push(tagCode)