提交代码
parent
8f665d4ff4
commit
09351213fb
|
@ -85,186 +85,83 @@ public class GainHzDataTask {
|
|||
|
||||
IotDeviceInfo iotDeviceInfo = new IotDeviceInfo();
|
||||
iotDeviceInfo.setDeviceName("配电箱");
|
||||
iotDeviceInfo.setFactoryName("华筑");
|
||||
List<IotDeviceInfo> iotDeviceInfos = iIotDeviceInfoService.selectIotDeviceInfoList(iotDeviceInfo);
|
||||
iotDeviceInfos.forEach(item -> {
|
||||
if(Objects.equals("华筑",item.getFactoryName())){
|
||||
if(item.getHzTenantId() != null && item.getHzProjectId() != null) {
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("tenantId", item.getHzTenantId());
|
||||
body.put("projectId", item.getHzProjectId());
|
||||
body.put("startTime", startTime);
|
||||
body.put("endTime", endTime);
|
||||
String res_str = HttpRequest.post(HzApiConf.IOT_POWER_HOST + HzApiConf.DISTRIBUTION_BOX_PAGE_REAL_DATA)
|
||||
.header("appId", HzApiConf.APP_ID).header("appSecret", HzApiConf.APP_SECRET)
|
||||
.body(body.toString())
|
||||
.execute().body();
|
||||
JSONObject res = JSONObject.parseObject(res_str);
|
||||
|
||||
//2. 解析数据
|
||||
System.out.println(res_str);
|
||||
JSONArray content = res.getJSONObject("data").getJSONArray("content");
|
||||
System.out.println(content);
|
||||
List<IotWarningInfo> iotWarningInfos = new ArrayList<>(16);
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
|
||||
//3.数据转换
|
||||
JSONObject tmp = content.getJSONObject(i);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(tmp.getString("deviceSn"));
|
||||
iotPower.setTime(tmp.getDate("createTime"));
|
||||
iotPower.setPower(BigDecimal.valueOf(tmp.getFloat("totalPower")));
|
||||
iotPower.setLeak(BigDecimal.valueOf(tmp.getFloat("leftElectric")));
|
||||
iotPower.setC1(BigDecimal.valueOf(tmp.getFloat("currentElectric1")));
|
||||
iotPower.setC2(BigDecimal.valueOf(tmp.getFloat("currentElectric2")));
|
||||
iotPower.setC3(BigDecimal.valueOf(tmp.getFloat("currentElectric3")));
|
||||
iotPower.setV1(BigDecimal.valueOf(tmp.getFloat("currentVoltage1")));
|
||||
iotPower.setV2(BigDecimal.valueOf(tmp.getFloat("currentVoltage2")));
|
||||
iotPower.setV3(BigDecimal.valueOf(tmp.getFloat("currentVoltage3")));
|
||||
iotPower.setT1(BigDecimal.valueOf(tmp.getFloat("monitorTem1")));
|
||||
iotPower.setT2(BigDecimal.valueOf(tmp.getFloat("monitorTem2")));
|
||||
iotPower.setT3(BigDecimal.valueOf(tmp.getFloat("monitorTem3")));
|
||||
iotPower.setT4(BigDecimal.valueOf(tmp.getFloat("monitorTem4")));
|
||||
if (t % 2 == 0 && !warrning[t]) {
|
||||
warrning = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning[t] = true;
|
||||
if (iotPower.getLeak().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_LEAK) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("漏电预警");
|
||||
iotWarningInfo.setContent(String.format("设备存在漏电,当前剩余电流:%s", iotPower.getLeak()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
|
||||
if (iotPower.getT1().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT2().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT3().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT4().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("温度异常");
|
||||
iotWarningInfo.setContent(String.format("设备当前温度:%s,%s,%s,%s,有温度高于70度", iotPower.getT1(), iotPower.getT2(), iotPower.getT3(), iotPower.getT4()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
}
|
||||
|
||||
//4. 数据入库
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
Request request = new Request();
|
||||
request.setUri("https://aqzg.makalu.cc/api/iot/power/save");
|
||||
request.addBody(JSONObject.parseObject(JSONObject.toJSONString(iotPower), HashMap.class));
|
||||
try {
|
||||
HttpClient.json(request);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if (iotPowers.size() > 0) {
|
||||
iotPowerService.batchInsertPower(iotPowers);
|
||||
}
|
||||
if (iotWarningInfos.size() > 0) {
|
||||
iotWarningInfoService.batchInsertWarning(iotWarningInfos);
|
||||
}
|
||||
}
|
||||
}else if(Objects.equals("华筑",item.getFactoryName())){
|
||||
String res_str = HttpRequest.get(HzApiConf.SD_IOT_POWER_HOST + "/metric/box/"+item.getDeviceId())
|
||||
if(item.getHzTenantId() != null && item.getHzProjectId() != null) {
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("tenantId", item.getHzTenantId());
|
||||
body.put("projectId", item.getHzProjectId());
|
||||
body.put("startTime", startTime);
|
||||
body.put("endTime", endTime);
|
||||
String res_str = HttpRequest.post(HzApiConf.IOT_POWER_HOST + HzApiConf.DISTRIBUTION_BOX_PAGE_REAL_DATA)
|
||||
.header("appId", HzApiConf.APP_ID).header("appSecret", HzApiConf.APP_SECRET)
|
||||
.body(body.toString())
|
||||
.execute().body();
|
||||
JSONObject res = JSONObject.parseObject(res_str).getJSONObject("result");
|
||||
// 电能检测数据
|
||||
JSONObject metric = res.getJSONObject("metric");
|
||||
// 温度检测数据
|
||||
JSONArray temperatures = res.getJSONArray("temperatures");
|
||||
// 漏电检测数据
|
||||
JSONArray leakages = res.getJSONArray("leakages");
|
||||
// 报警数据
|
||||
JSONObject ticketStatus = res.getJSONObject("ticketStatus");
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
JSONObject res = JSONObject.parseObject(res_str);
|
||||
|
||||
//2. 解析数据
|
||||
System.out.println(res_str);
|
||||
JSONArray content = res.getJSONObject("data").getJSONArray("content");
|
||||
System.out.println(content);
|
||||
List<IotWarningInfo> iotWarningInfos = new ArrayList<>(16);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(item.getDeviceId());
|
||||
iotPower.setTime(DateUtils.getNowDate());
|
||||
BigDecimal power = metric.getBigDecimal("power_a").add(metric.getBigDecimal("power_b")).add(metric.getBigDecimal("power_c"));
|
||||
iotPower.setPower(power.divide(new BigDecimal(3), 2, BigDecimal.ROUND_HALF_UP));
|
||||
int leak = 0;
|
||||
for (int i = 0; i < leakages.size(); i++) {
|
||||
JSONObject leakage = leakages.getJSONObject(i);
|
||||
if(Convert.toInt(leakage.get("leakage"),0)>leak){
|
||||
leak = leakage.getInteger("leakage");
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
|
||||
//3.数据转换
|
||||
JSONObject tmp = content.getJSONObject(i);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(tmp.getString("deviceSn"));
|
||||
iotPower.setTime(tmp.getDate("createTime"));
|
||||
iotPower.setPower(BigDecimal.valueOf(tmp.getFloat("totalPower")));
|
||||
iotPower.setLeak(BigDecimal.valueOf(tmp.getFloat("leftElectric")));
|
||||
iotPower.setC1(BigDecimal.valueOf(tmp.getFloat("currentElectric1")));
|
||||
iotPower.setC2(BigDecimal.valueOf(tmp.getFloat("currentElectric2")));
|
||||
iotPower.setC3(BigDecimal.valueOf(tmp.getFloat("currentElectric3")));
|
||||
iotPower.setV1(BigDecimal.valueOf(tmp.getFloat("currentVoltage1")));
|
||||
iotPower.setV2(BigDecimal.valueOf(tmp.getFloat("currentVoltage2")));
|
||||
iotPower.setV3(BigDecimal.valueOf(tmp.getFloat("currentVoltage3")));
|
||||
iotPower.setT1(BigDecimal.valueOf(tmp.getFloat("monitorTem1")));
|
||||
iotPower.setT2(BigDecimal.valueOf(tmp.getFloat("monitorTem2")));
|
||||
iotPower.setT3(BigDecimal.valueOf(tmp.getFloat("monitorTem3")));
|
||||
iotPower.setT4(BigDecimal.valueOf(tmp.getFloat("monitorTem4")));
|
||||
if (t % 2 == 0 && !warrning[t]) {
|
||||
warrning = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning[t] = true;
|
||||
if (iotPower.getLeak().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_LEAK) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("漏电预警");
|
||||
iotWarningInfo.setContent(String.format("设备存在漏电,当前剩余电流:%s", iotPower.getLeak()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
|
||||
if (iotPower.getT1().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT2().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT3().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP
|
||||
|| iotPower.getT4().floatValue() > HzApiConf.DISTRIBUTION_BOX_WARNING_TEMP) {
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("温度异常");
|
||||
iotWarningInfo.setContent(String.format("设备当前温度:%s,%s,%s,%s,有温度高于70度", iotPower.getT1(), iotPower.getT2(), iotPower.getT3(), iotPower.getT4()));
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
}
|
||||
|
||||
//4. 数据入库
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
Request request = new Request();
|
||||
request.setUri("https://aqzg.makalu.cc/api/iot/power/save");
|
||||
request.addBody(JSONObject.parseObject(JSONObject.toJSONString(iotPower), HashMap.class));
|
||||
try {
|
||||
HttpClient.json(request);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
iotPower.setLeak(BigDecimal.valueOf(leak));
|
||||
iotPower.setC1(BigDecimal.valueOf(metric.getFloat("current_a")));
|
||||
iotPower.setC2(BigDecimal.valueOf(metric.getFloat("current_b")));
|
||||
iotPower.setC3(BigDecimal.valueOf(metric.getFloat("current_c")));
|
||||
iotPower.setV1(BigDecimal.valueOf(metric.getFloat("voltage_a")));
|
||||
iotPower.setV2(BigDecimal.valueOf(metric.getFloat("voltage_b")));
|
||||
iotPower.setV3(BigDecimal.valueOf(metric.getFloat("voltage_c")));
|
||||
BigDecimal data = temperatures.getJSONObject(0).getBigDecimal("temperature");
|
||||
iotPower.setT1(data);
|
||||
iotPower.setT2(data);
|
||||
iotPower.setT3(data);
|
||||
iotPower.setT4(data);
|
||||
|
||||
// 预警数据
|
||||
if (t % 2 == 0 && !warrning_power_sd[t]) {
|
||||
warrning_power_sd = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning_power_sd[t] = true;
|
||||
|
||||
if(ticketStatus.getInteger("is_blackout")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("断电预警");
|
||||
iotWarningInfo.setContent("设备触发断电,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_smoke")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("烟感报警");
|
||||
iotWarningInfo.setContent("设备烟感报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_overload")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("过载报警");
|
||||
iotWarningInfo.setContent("设备过载报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_disconnect")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("断开报警");
|
||||
iotWarningInfo.setContent("设备断开报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_overheat")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType(" 高温报警");
|
||||
iotWarningInfo.setContent("设备高温报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_leakage")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType(" 漏电报警");
|
||||
iotWarningInfo.setContent("设备漏电报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
}
|
||||
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
if (iotPowers.size() > 0) {
|
||||
iotPowerService.batchInsertPower(iotPowers);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
package com.ruoyi.iot.task;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.iot.conf.HzApiConf;
|
||||
import com.ruoyi.iot.domain.IotDeviceInfo;
|
||||
import com.ruoyi.iot.domain.IotPower;
|
||||
import com.ruoyi.iot.domain.IotWarningInfo;
|
||||
import com.ruoyi.iot.service.IIotDeviceInfoService;
|
||||
import com.ruoyi.iot.service.IIotPowerService;
|
||||
import com.ruoyi.iot.service.IIotWarningInfoService;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 萨达配电箱数据定时任务
|
||||
* @Title: SadaHzDataTask
|
||||
* @Package com.yanzhu.xd.system.task
|
||||
* @Author: JiangYuQi
|
||||
* @Copyright 版权归"陕西马卡鲁信息技术有限公司(或个⼈)"所有
|
||||
* @CreateTime: 2024/10/26 17:05
|
||||
*/
|
||||
@Component("sadaHzDataTask")
|
||||
public class SadaHzDataTask {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SadaHzDataTask.class);
|
||||
|
||||
@Autowired
|
||||
private IIotPowerService iotPowerService;
|
||||
|
||||
@Autowired
|
||||
private IIotWarningInfoService iotWarningInfoService;
|
||||
|
||||
@Autowired
|
||||
private IIotDeviceInfoService iIotDeviceInfoService;
|
||||
|
||||
public static Boolean[] warrning_power_sd = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
|
||||
@Test
|
||||
public void getPowerData() {
|
||||
//获取当前时间是否需要预警两小时预警一次0,2,4,6,8,10,12,14,16,18,20,22
|
||||
Integer t = Integer.valueOf(new SimpleDateFormat("HH").format(new Date()));
|
||||
|
||||
//1.通过接口获取数据
|
||||
Long endTime = System.currentTimeMillis();
|
||||
Long startTime = endTime - HzApiConf.INTERVAL_TIME;
|
||||
|
||||
IotDeviceInfo iotDeviceInfo = new IotDeviceInfo();
|
||||
iotDeviceInfo.setDeviceName("配电箱");
|
||||
iotDeviceInfo.setFactoryName("萨达");
|
||||
List<IotDeviceInfo> iotDeviceInfos = iIotDeviceInfoService.selectIotDeviceInfoList(iotDeviceInfo);
|
||||
iotDeviceInfos.forEach(item -> {
|
||||
String res_str = HttpRequest.get(HzApiConf.SD_IOT_POWER_HOST + "/metric/box/"+item.getDeviceId())
|
||||
.execute().body();
|
||||
JSONObject res = JSONObject.parseObject(res_str).getJSONObject("result");
|
||||
// 电能检测数据
|
||||
JSONObject metric = res.getJSONObject("metric");
|
||||
// 温度检测数据
|
||||
JSONArray temperatures = res.getJSONArray("temperatures");
|
||||
// 漏电检测数据
|
||||
JSONArray leakages = res.getJSONArray("leakages");
|
||||
// 报警数据
|
||||
JSONObject ticketStatus = res.getJSONObject("ticketStatus");
|
||||
List<IotPower> iotPowers = new ArrayList<>(16);
|
||||
List<IotWarningInfo> iotWarningInfos = new ArrayList<>(16);
|
||||
IotPower iotPower = new IotPower();
|
||||
iotPower.setUid(item.getDeviceId());
|
||||
iotPower.setTime(DateUtils.getNowDate());
|
||||
BigDecimal power = metric.getBigDecimal("power_a").add(metric.getBigDecimal("power_b")).add(metric.getBigDecimal("power_c"));
|
||||
iotPower.setPower(power.divide(new BigDecimal(3), 2, BigDecimal.ROUND_HALF_UP));
|
||||
int leak = 0;
|
||||
for (int i = 0; i < leakages.size(); i++) {
|
||||
JSONObject leakage = leakages.getJSONObject(i);
|
||||
if(Convert.toInt(leakage.get("leakage"),0)>leak){
|
||||
leak = leakage.getInteger("leakage");
|
||||
}
|
||||
}
|
||||
iotPower.setLeak(BigDecimal.valueOf(leak));
|
||||
iotPower.setC1(BigDecimal.valueOf(metric.getFloat("current_a")));
|
||||
iotPower.setC2(BigDecimal.valueOf(metric.getFloat("current_b")));
|
||||
iotPower.setC3(BigDecimal.valueOf(metric.getFloat("current_c")));
|
||||
iotPower.setV1(BigDecimal.valueOf(metric.getFloat("voltage_a")));
|
||||
iotPower.setV2(BigDecimal.valueOf(metric.getFloat("voltage_b")));
|
||||
iotPower.setV3(BigDecimal.valueOf(metric.getFloat("voltage_c")));
|
||||
BigDecimal data = temperatures.getJSONObject(0).getBigDecimal("temperature");
|
||||
iotPower.setT1(data);
|
||||
iotPower.setT2(data);
|
||||
iotPower.setT3(data);
|
||||
iotPower.setT4(data);
|
||||
|
||||
// 预警数据
|
||||
if (t % 2 == 0 && !warrning_power_sd[t]) {
|
||||
warrning_power_sd = new Boolean[]{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
warrning_power_sd[t] = true;
|
||||
|
||||
if(ticketStatus.getInteger("is_blackout")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("断电预警");
|
||||
iotWarningInfo.setContent("设备触发断电,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_smoke")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("烟感报警");
|
||||
iotWarningInfo.setContent("设备烟感报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_overload")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("过载报警");
|
||||
iotWarningInfo.setContent("设备过载报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_disconnect")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType("断开报警");
|
||||
iotWarningInfo.setContent("设备断开报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_overheat")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType(" 高温报警");
|
||||
iotWarningInfo.setContent("设备高温报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
if(ticketStatus.getInteger("is_leakage")>0){
|
||||
IotWarningInfo iotWarningInfo = new IotWarningInfo();
|
||||
iotWarningInfo.setDeviceId(iotPower.getUid());
|
||||
iotWarningInfo.setType(" 漏电报警");
|
||||
iotWarningInfo.setContent("设备漏电报警,请排查异常情况");
|
||||
iotWarningInfo.setCreateTime(new Date());
|
||||
iotWarningInfos.add(iotWarningInfo);
|
||||
}
|
||||
}
|
||||
|
||||
iotPowers.add(iotPower);
|
||||
|
||||
if (iotPowers.size() > 0) {
|
||||
iotPowerService.batchInsertPower(iotPowers);
|
||||
}
|
||||
if (iotWarningInfos.size() > 0) {
|
||||
iotWarningInfoService.batchInsertWarning(iotWarningInfos);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi.weixin.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
|
Loading…
Reference in New Issue