事件配置设备报警后群发消息BUG修复

master
alsszer 5 months ago
parent db19114ba7
commit 145fc94b34

@ -199,4 +199,6 @@ public interface IDeviceInfoData extends IOwnedData<DeviceInfo, String> {
List<DeviceInfo> findNeverUsedDevices(); List<DeviceInfo> findNeverUsedDevices();
Long findNeverUsedDevices(DeviceInfo deviceInfo,Boolean flag); Long findNeverUsedDevices(DeviceInfo deviceInfo,Boolean flag);
List<AlertStatDTO> getDeviceRecord(); List<AlertStatDTO> getDeviceRecord();
List<DeviceInfo> findByDeptAreaIdAndProductKeyAndDeviceName(Long areaDeptId, String productKey, String deviceName);
} }

@ -127,6 +127,12 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi
public List<AlertStatDTO> getDeviceRecord() { public List<AlertStatDTO> getDeviceRecord() {
return deviceInfoData.getDeviceRecord(); return deviceInfoData.getDeviceRecord();
} }
@Override
public List<DeviceInfo> findByDeptAreaIdAndProductKeyAndDeviceName(Long deviceId, String productKey, String deviceName) {
return deviceInfoData.findByDeptAreaIdAndProductKeyAndDeviceName(deviceId,productKey,deviceName);
}
/** /**
* *
*/ */

@ -176,6 +176,18 @@ public class DeviceInfoPropertyDataCache implements IDeviceInfoData {
public List<AlertStatDTO> getDeviceRecord() { public List<AlertStatDTO> getDeviceRecord() {
return deviceInfoData.getDeviceRecord(); return deviceInfoData.getDeviceRecord();
} }
@Override
public List<DeviceInfo> findByDeptAreaIdAndProductKeyAndDeviceName(Long areaDeptId, String productKey, String deviceName) {
List<DeviceInfo> deviceInfo = deviceInfoData.findByDeptAreaIdAndProductKeyAndDeviceName(areaDeptId, productKey, deviceName);
if (deviceInfo == null) {
return null;
}
deviceInfo.forEach(deviceInfo1 -> deviceInfo1.setProperty(getProperties(deviceInfo1.getDeviceId())));
// deviceInfo.setProperty(getProperties(deviceInfo.getDeviceId()));
return deviceInfo;
}
@Override @Override
public List<DeviceInfo> findByParentId(String parentId) { public List<DeviceInfo> findByParentId(String parentId) {
return deviceInfoData.findByParentId(parentId); return deviceInfoData.findByParentId(parentId);

@ -39,4 +39,6 @@ public interface DeviceInfoRepository extends JpaRepository<TbDeviceInfo, String
List<TbDeviceInfo> findByDeptAreaIdAndProductKey(Long deptAreaId,String productKey); List<TbDeviceInfo> findByDeptAreaIdAndProductKey(Long deptAreaId,String productKey);
long countByUid(String uid); long countByUid(String uid);
long countByUidAndState(String uid,String state); long countByUidAndState(String uid,String state);
List<TbDeviceInfo> findByDeptAreaIdAndProductKeyAndDeviceName(Long deptAreaId, String productKey, String deviceName);
} }

@ -513,6 +513,11 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
} }
@Override
public List<DeviceInfo> findByDeptAreaIdAndProductKeyAndDeviceName(Long deptAreaId, String productKey, String deviceName) {
return parseVoToDto(deviceInfoRepository.findByDeptAreaIdAndProductKeyAndDeviceName(deptAreaId, productKey, deviceName));
}
@Override @Override
public Paging<DeviceInfo> findByConditionsExcel(String name, String uid, String subUid, public Paging<DeviceInfo> findByConditionsExcel(String name, String uid, String subUid,
String productKey, String groupId, String productKey, String groupId,

@ -398,26 +398,26 @@ public class ThingServiceImpl implements IThingService {
.alertTime(System.currentTimeMillis()) .alertTime(System.currentTimeMillis())
.details("您的设备【" + device.getDeviceName() + "】触发事件 事件类型为:【" + map.get("eventTypeValue").toString() + "】。") .details("您的设备【" + device.getDeviceName() + "】触发事件 事件类型为:【" + map.get("eventTypeValue").toString() + "】。")
.build()); .build());
if (ObjectUtil.isNotEmpty(deviceInfoArrayList1)) { // if (ObjectUtil.isNotEmpty(deviceInfoArrayList1)) {
for (int j = 0; j < deviceInfoArrayList1.size(); j++) { // for (int j = 0; j < deviceInfoArrayList1.size(); j++) {
String deviceName = deviceInfoArrayList1.get(j).getNodeStatus().equals("1")?device.getDeviceName(): deviceInfoArrayList1.get(j).getNodeDevice(); // String deviceName = deviceInfoArrayList1.get(j).getNodeStatus().equals("1")?device.getDeviceName(): deviceInfoArrayList1.get(j).getNodeDevice();
idAlertRecordData.save(AlertRecord.builder() // idAlertRecordData.save(AlertRecord.builder()
.level(config1.get(i).getLevel()) // .level(config1.get(i).getLevel())
.name(config1.get(i).getName()) // .name(config1.get(i).getName())
.reasonForRemovalFlag(0) // .reasonForRemovalFlag(0)
.productKey(device.getProductKey()) // .productKey(device.getProductKey())
.levelStatus(eventTypeValue1) // .levelStatus(eventTypeValue1)
.deviceName(deviceInfoArrayList1.get(j).getDeviceName()) // .deviceName(deviceInfoArrayList1.get(j).getDeviceName())
.site(deviceInfoArrayList1.get(j).getSite()) // .site(deviceInfoArrayList1.get(j).getSite())
.tenantId(deviceInfoArrayList1.get(j).getTenantId()) // .tenantId(deviceInfoArrayList1.get(j).getTenantId())
.uid(deviceInfoArrayList1.get(j).getUid()) // .uid(deviceInfoArrayList1.get(j).getUid())
.deptAreaId(deviceInfoArrayList1.get(j).getDeptAreaId()) // .deptAreaId(deviceInfoArrayList1.get(j).getDeptAreaId())
.readFlg(false) // .readFlg(false)
.alertTime(System.currentTimeMillis()) // .alertTime(System.currentTimeMillis())
.details("您的设备【" + deviceInfoArrayList1.get(j).getDeviceName() + "】,节点" + deviceInfoArrayList1.get(j).getNode() + "触发事件,事件类型:【联动箱输出】," + "告警设备:" + deviceName) // .details("您的设备【" + deviceInfoArrayList1.get(j).getDeviceName() + "】,节点" + deviceInfoArrayList1.get(j).getNode() + "触发事件,事件类型:【联动箱输出】," + "告警设备:" + deviceName)
.build()); // .build());
} // }
} // }
ruleExecutor.execute1(thingModelMessage, config1); ruleExecutor.execute1(thingModelMessage, config1);
} }
} }
@ -447,26 +447,26 @@ public class ThingServiceImpl implements IThingService {
.alertTime(System.currentTimeMillis()) .alertTime(System.currentTimeMillis())
.details("您的设备【" + device.getDeviceName() + "】触发事件 事件类型为:【" + map.get("eventTypeValue").toString() + "】。") .details("您的设备【" + device.getDeviceName() + "】触发事件 事件类型为:【" + map.get("eventTypeValue").toString() + "】。")
.build()); .build());
if (ObjectUtil.isNotEmpty(deviceInfoArrayList1)) { // if (ObjectUtil.isNotEmpty(deviceInfoArrayList1)) {
for (int j = 0; j < deviceInfoArrayList1.size(); j++) { // for (int j = 0; j < deviceInfoArrayList1.size(); j++) {
String deviceName = deviceInfoArrayList1.get(j).getNodeStatus().equals("1")?device.getDeviceName(): deviceInfoArrayList1.get(j).getNodeDevice(); // String deviceName = deviceInfoArrayList1.get(j).getNodeStatus().equals("1")?device.getDeviceName(): deviceInfoArrayList1.get(j).getNodeDevice();
idAlertRecordData.save(AlertRecord.builder() // idAlertRecordData.save(AlertRecord.builder()
.level(config.get(i).getLevel()) // .level(config.get(i).getLevel())
.name(config.get(i).getName()) // .name(config.get(i).getName())
.site(deviceInfoArrayList1.get(j).getSite()) // .site(deviceInfoArrayList1.get(j).getSite())
.reasonForRemovalFlag(0) // .reasonForRemovalFlag(0)
.productKey(device.getProductKey()) // .productKey(device.getProductKey())
.levelStatus(eventTypeValue1) // .levelStatus(eventTypeValue1)
.deviceName(deviceInfoArrayList1.get(j).getDeviceName()) // .deviceName(deviceInfoArrayList1.get(j).getDeviceName())
.tenantId(deviceInfoArrayList1.get(j).getTenantId()) // .tenantId(deviceInfoArrayList1.get(j).getTenantId())
.uid(deviceInfoArrayList1.get(j).getUid()) // .uid(deviceInfoArrayList1.get(j).getUid())
.deptAreaId(deviceInfoArrayList1.get(j).getDeptAreaId()) // .deptAreaId(deviceInfoArrayList1.get(j).getDeptAreaId())
.readFlg(false) // .readFlg(false)
.alertTime(System.currentTimeMillis()) // .alertTime(System.currentTimeMillis())
.details("您的设备【" + deviceInfoArrayList1.get(j).getDeviceName() + "】,节点" + deviceInfoArrayList1.get(j).getNode() + "触发事件,事件类型:【联动箱输出】," + "告警设备:" + deviceName) // .details("您的设备【" + deviceInfoArrayList1.get(j).getDeviceName() + "】,节点" + deviceInfoArrayList1.get(j).getNode() + "触发事件,事件类型:【联动箱输出】," + "告警设备:" + deviceName)
.build()); // .build());
} // }
} // }
ruleExecutor.execute1(thingModelMessage, config); ruleExecutor.execute1(thingModelMessage, config);
} }
// RuleExecutor ruleExecutor = new RuleExecutor(); // RuleExecutor ruleExecutor = new RuleExecutor();
@ -493,7 +493,21 @@ public class ThingServiceImpl implements IThingService {
flag = false; flag = false;
if (deviceInfo2.getNodeOneStatus().equals("1")) { if (deviceInfo2.getNodeOneStatus().equals("1")) {
//选中的任意一个设备报警就发送联动控制指令 //选中的任意一个设备报警就发送联动控制指令
String[] deviceNames = {
deviceInfo2.getNodeOneDevice(),
deviceInfo2.getNodeTwoDevice(),
deviceInfo2.getNodeThreeDevice(),
deviceInfo2.getNodeFourDevice(),
deviceInfo2.getNodeFiveDevice()
};
boolean matchFound = Arrays.stream(deviceNames)
.filter(Objects::nonNull)
.anyMatch(name -> name.equals(device.getDeviceName()));
if (matchFound) {
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeOne()); flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeOne());
}
} else { } else {
//满足所有的设备告警才触发联动控制 //满足所有的设备告警才触发联动控制
String[] nodeOneDevice = deviceInfo2.getNodeOneDevice().split(","); String[] nodeOneDevice = deviceInfo2.getNodeOneDevice().split(",");
@ -515,7 +529,21 @@ public class ThingServiceImpl implements IThingService {
flag = false; flag = false;
if (deviceInfo2.getNodeTwoStatus().equals("1")) { if (deviceInfo2.getNodeTwoStatus().equals("1")) {
//选中的任意一个设备报警就发送联动控制指令 //选中的任意一个设备报警就发送联动控制指令
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeTwo()); String[] deviceNames = {
deviceInfo2.getNodeOneDevice(),
deviceInfo2.getNodeTwoDevice(),
deviceInfo2.getNodeThreeDevice(),
deviceInfo2.getNodeFourDevice(),
deviceInfo2.getNodeFiveDevice()
};
boolean matchFound = Arrays.stream(deviceNames)
.filter(Objects::nonNull)
.anyMatch(name -> name.equals(device.getDeviceName()));
if (matchFound) {
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeOne());
}
} else { } else {
//满足所有的设备告警才触发联动控制 //满足所有的设备告警才触发联动控制
String[] nodeOneDevice = deviceInfo2.getNodeTwoDevice().split(","); String[] nodeOneDevice = deviceInfo2.getNodeTwoDevice().split(",");
@ -534,7 +562,21 @@ public class ThingServiceImpl implements IThingService {
flag = false; flag = false;
if (deviceInfo2.getNodeThreeStatus().equals("1")) { if (deviceInfo2.getNodeThreeStatus().equals("1")) {
//选中的任意一个设备报警就发送联动控制指令 //选中的任意一个设备报警就发送联动控制指令
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeThree()); String[] deviceNames = {
deviceInfo2.getNodeOneDevice(),
deviceInfo2.getNodeTwoDevice(),
deviceInfo2.getNodeThreeDevice(),
deviceInfo2.getNodeFourDevice(),
deviceInfo2.getNodeFiveDevice()
};
boolean matchFound = Arrays.stream(deviceNames)
.filter(Objects::nonNull)
.anyMatch(name -> name.equals(device.getDeviceName()));
if (matchFound) {
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeOne());
}
} else { } else {
//满足所有的设备告警才触发联动控制 //满足所有的设备告警才触发联动控制
String[] nodeOneDevice = deviceInfo2.getNodeThreeDevice().split(","); String[] nodeOneDevice = deviceInfo2.getNodeThreeDevice().split(",");
@ -553,7 +595,21 @@ public class ThingServiceImpl implements IThingService {
flag = false; flag = false;
if (deviceInfo2.getNodeFourStatus().equals("1")) { if (deviceInfo2.getNodeFourStatus().equals("1")) {
//选中的任意一个设备报警就发送联动控制指令 //选中的任意一个设备报警就发送联动控制指令
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeFour()); String[] deviceNames = {
deviceInfo2.getNodeOneDevice(),
deviceInfo2.getNodeTwoDevice(),
deviceInfo2.getNodeThreeDevice(),
deviceInfo2.getNodeFourDevice(),
deviceInfo2.getNodeFiveDevice()
};
boolean matchFound = Arrays.stream(deviceNames)
.filter(Objects::nonNull)
.anyMatch(name -> name.equals(device.getDeviceName()));
if (matchFound) {
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeOne());
}
} else { } else {
//满足所有的设备告警才触发联动控制 //满足所有的设备告警才触发联动控制
String[] nodeOneDevice = deviceInfo2.getNodeFourDevice().split(","); String[] nodeOneDevice = deviceInfo2.getNodeFourDevice().split(",");
@ -572,7 +628,21 @@ public class ThingServiceImpl implements IThingService {
flag = false; flag = false;
if (deviceInfo2.getNodeFiveStatus().equals("1")) { if (deviceInfo2.getNodeFiveStatus().equals("1")) {
//选中的任意一个设备报警就发送联动控制指令 //选中的任意一个设备报警就发送联动控制指令
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeFive()); String[] deviceNames = {
deviceInfo2.getNodeOneDevice(),
deviceInfo2.getNodeTwoDevice(),
deviceInfo2.getNodeThreeDevice(),
deviceInfo2.getNodeFourDevice(),
deviceInfo2.getNodeFiveDevice()
};
boolean matchFound = Arrays.stream(deviceNames)
.filter(Objects::nonNull)
.anyMatch(name -> name.equals(device.getDeviceName()));
if (matchFound) {
flag = deviceLinkageControlSend(deviceInfo2, deviceInfo2.getNodeOne());
}
} else { } else {
//满足所有的设备告警才触发联动控制 //满足所有的设备告警才触发联动控制
String[] nodeOneDevice = deviceInfo2.getNodeFiveDevice().split(","); String[] nodeOneDevice = deviceInfo2.getNodeFiveDevice().split(",");
@ -669,12 +739,27 @@ public class ThingServiceImpl implements IThingService {
"controlOutput", node + "0001" "controlOutput", node + "0001"
)) ))
.build(); .build();
idAlertRecordData.save(AlertRecord.builder()
.level("1")
.name("联动控制箱下发")
.reasonForRemovalFlag(0)
.productKey(device.getProductKey())
.levelStatus("联动控制箱下发")
.deviceName(device.getDeviceName())
.site(device.getSite())
.tenantId(device.getTenantId())
.uid(device.getUid())
.deptAreaId(device.getDeptAreaId())
.readFlg(false)
.alertTime(System.currentTimeMillis())
.details("您的设备【" + device.getDeviceName() + "】,节点" + node + "触发事件,事件类型:【联动箱输出】。")
.build());
//联动控制箱下发指令 //联动控制箱下发指令
deviceService.invoke(thingService); deviceService.invoke(thingService);
return true; return true;
} }
//浓度变化 //浓度变化,事件类型:
public void extractDetectorData(DeviceInfo device, Map<String, Object> baseInfo) { public void extractDetectorData(DeviceInfo device, Map<String, Object> baseInfo) {
for (Map.Entry<String, Object> entry : baseInfo.entrySet()) { for (Map.Entry<String, Object> entry : baseInfo.entrySet()) {
if (entry.getKey().startsWith("dataDetectorValue")) { if (entry.getKey().startsWith("dataDetectorValue")) {

@ -28,10 +28,12 @@ import cc.iotkit.common.thing.ThingModelMessage;
import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.common.utils.JsonUtils;
import cc.iotkit.data.manager.IAlertConfigData; import cc.iotkit.data.manager.IAlertConfigData;
import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IDeviceInfoData;
import cc.iotkit.data.manager.IProductData;
import cc.iotkit.data.manager.IUserInfoData; import cc.iotkit.data.manager.IUserInfoData;
import cc.iotkit.model.UserInfo; import cc.iotkit.model.UserInfo;
import cc.iotkit.model.alert.AlertConfig; import cc.iotkit.model.alert.AlertConfig;
import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.model.product.Product;
import cc.iotkit.model.rule.RuleLog; import cc.iotkit.model.rule.RuleLog;
import cc.iotkit.model.worder.WorderDO; import cc.iotkit.model.worder.WorderDO;
import cc.iotkit.ruleengine.action.Action; import cc.iotkit.ruleengine.action.Action;
@ -63,9 +65,11 @@ import org.dromara.sms4j.api.entity.SmsResponse;
import org.dromara.sms4j.core.factory.SmsFactory; import org.dromara.sms4j.core.factory.SmsFactory;
import org.dromara.sms4j.provider.enumerate.SupplierType; import org.dromara.sms4j.provider.enumerate.SupplierType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.security.auth.message.config.AuthConfig; import javax.security.auth.message.config.AuthConfig;
@ -100,6 +104,14 @@ public class RuleExecutor {
@Resource @Resource
private WxMaService wxMaService; private WxMaService wxMaService;
@Autowired
@Qualifier("productDataCache")
private IProductData productData;
@Autowired
@Qualifier("deviceInfoDataCache")
private IDeviceInfoData deviceInfoData;
public void execute1(ThingModelMessage message,List<AlertConfig> listAlertConfigs) { public void execute1(ThingModelMessage message,List<AlertConfig> listAlertConfigs) {
DeviceInfo deviceInfo = iDeviceInfoData.findByDeviceId(message.getDeviceId()); DeviceInfo deviceInfo = iDeviceInfoData.findByDeviceId(message.getDeviceId());
// 注入 WxMaService 后直接调用 // 注入 WxMaService 后直接调用
@ -279,6 +291,7 @@ public class RuleExecutor {
case "0": case "0":
//发送短信 //发送短信
try { try {
Date date = new Date(message.getTime()); Date date = new Date(message.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String templateId = "SMS_492470379"; String templateId = "SMS_492470379";
@ -303,6 +316,23 @@ public class RuleExecutor {
System.out.println("短信接口返回的数据:" + smsResponse); System.out.println("短信接口返回的数据:" + smsResponse);
/* if (!"OK".equals(smsResponse.getCode())) { /* if (!"OK".equals(smsResponse.getCode())) {
}*/ }*/
// 发送联动控制箱短信
List<DeviceInfo> deviceInfos = deviceLinkageControl(deviceInfo);
if(CollectionUtils.isEmpty(deviceInfos)){
break;
}
String templateId1 = "SMS_496730336";
LinkedHashMap<String, String> map1 = new LinkedHashMap<>(1);
map.put("boxDeviceName", deviceInfos.get(0).getDeviceName());
String deviceName = deviceInfos.get(0).getNodeStatus().equals("1")?deviceInfo.getDeviceName(): deviceInfos.get(0).getNodeDevice();
String node = deviceInfos.get(0).getNode();
map.put("node", node);
map.put("deviceSite", site);
map.put("deviceName", deviceName);
SmsBlend smsBlend1 = SmsFactory.createSmsBlend(SupplierType.ALIBABA);
SmsResponse smsResponse1 = smsBlend1.sendMessage(userInfo.getUserName(), templateId1, map);
System.out.println("短信接口返回的数据:" + smsResponse1);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -518,4 +548,98 @@ public class RuleExecutor {
return results; return results;
} }
private List<DeviceInfo> deviceLinkageControl(DeviceInfo device) {
List<DeviceInfo> deviceInfo1 = new ArrayList<>();
deviceInfo1 = getDeviceInfo(device.getDeptAreaId(), "MQFejp7cyDMH3enG");
Boolean flag = false;
String nodeStatus = null;
List<DeviceInfo> deviceInfo55 = new ArrayList<>();
if (deviceInfo1 != null && !deviceInfo1.isEmpty()) {
for (DeviceInfo deviceInfo2 : deviceInfo1) {
if (ObjectUtil.isNotNull(deviceInfo2.getNodeOne()) && ObjectUtil.isNotNull(deviceInfo2.getNodeOneStatus()) && ObjectUtil.isNotNull(deviceInfo2.getNodeOneDevice())) {
if(device.getDeviceName().equals(deviceInfo2.getNodeOneDevice())){
nodeStatus = "1";
deviceInfo2.setNode(nodeStatus);
deviceInfo2.setNodeStatus(deviceInfo2.getNodeOneStatus());
deviceInfo2.setNodeDevice(deviceInfo2.getNodeOneDevice());
deviceInfo55.add(deviceInfo2);
}
}
if (ObjectUtil.isNotNull(deviceInfo2.getNodeTwo()) && ObjectUtil.isNotNull(deviceInfo2.getNodeTwoStatus()) && ObjectUtil.isNotNull(deviceInfo2.getNodeTwoDevice())) {
//deviceLinkageControlSend(deviceInfo2,deviceInfo2.getNodeTwo());
if(device.getDeviceName().equals(deviceInfo2.getNodeTwoDevice())){
nodeStatus = "2";
deviceInfo2.setNode(nodeStatus);
deviceInfo2.setNodeStatus(deviceInfo2.getNodeTwoStatus());
deviceInfo2.setNodeDevice(deviceInfo2.getNodeTwoDevice());
deviceInfo55.add(deviceInfo2);
}
}
if (ObjectUtil.isNotNull(deviceInfo2.getNodeThree()) && ObjectUtil.isNotNull(deviceInfo2.getNodeThreeStatus()) && ObjectUtil.isNotNull(deviceInfo2.getNodeThreeDevice())) {
// deviceLinkageControlSend(deviceInfo2,deviceInfo2.getNodeThree());
if(device.getDeviceName().equals(deviceInfo2.getNodeThreeDevice())){
nodeStatus = "3";
deviceInfo2.setNode(nodeStatus);
deviceInfo2.setNodeStatus(deviceInfo2.getNodeThreeStatus());
deviceInfo2.setNodeDevice(deviceInfo2.getNodeThreeDevice());
deviceInfo55.add(deviceInfo2);
}
}
if (ObjectUtil.isNotNull(deviceInfo2.getNodeFour()) && ObjectUtil.isNotNull(deviceInfo2.getNodeFourStatus()) && ObjectUtil.isNotNull(deviceInfo2.getNodeFourDevice())) {
// deviceLinkageControlSend(deviceInfo2,deviceInfo2.getNodeFour());
if(device.getDeviceName().equals(deviceInfo2.getNodeFourDevice())){
nodeStatus = "4";
deviceInfo2.setNode(nodeStatus);
deviceInfo2.setNodeStatus(deviceInfo2.getNodeFourStatus());
deviceInfo2.setNodeDevice(deviceInfo2.getNodeFourDevice());
deviceInfo55.add(deviceInfo2);
}
}
if (ObjectUtil.isNotNull(deviceInfo2.getNodeFive()) && ObjectUtil.isNotNull(deviceInfo2.getNodeFiveStatus()) && ObjectUtil.isNotNull(deviceInfo2.getNodeFiveDevice())) {
// deviceLinkageControlSend(deviceInfo2,deviceInfo2.getNodeFive());
if(device.getDeviceName().equals(deviceInfo2.getNodeFiveDevice())){
nodeStatus = "5";
deviceInfo2.setNode(nodeStatus);
deviceInfo2.setNodeStatus(deviceInfo2.getNodeFiveStatus());
deviceInfo2.setNodeDevice(deviceInfo2.getNodeFiveDevice());
deviceInfo55.add(deviceInfo2);
}
}
}
}
return deviceInfo55;
}
public List<DeviceInfo> getDeviceInfo(Long areaDeptId, String productKey) {
try {
return deviceInfoData.findByDeptAreaIdAndProductKey(areaDeptId, productKey);
// return deviceInfoData.findByDeptAreaIdAndProductKeyAndDeviceName(areaDeptId, productKey, deviceName);
} catch (Throwable e) {
log.error("get device error", e);
return null;
}
}
} }

@ -60,6 +60,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
url: jdbc:mysql://123.57.78.108:3306/hma_iot?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&useSSL=false url: jdbc:mysql://123.57.78.108:3306/hma_iot?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&useSSL=false
# url: jdbc:mysql://123.57.78.108:3306/hma_iot_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&useSSL=false
username: root username: root
password: 1093e4769496a6ed password: 1093e4769496a6ed
#password: CGKhbMfrdz6w3icX #password: CGKhbMfrdz6w3icX

Loading…
Cancel
Save