|
|
@@ -27,6 +27,7 @@ import com.ruoyi.ems.model.CallResponse;
|
|
|
import com.ruoyi.ems.model.QueryDevice;
|
|
|
import com.ruoyi.ems.model.slightctl.BaselineInfo;
|
|
|
import com.ruoyi.ems.model.slightctl.CcElecInfo;
|
|
|
+import com.ruoyi.ems.model.slightctl.DevSub;
|
|
|
import com.ruoyi.ems.model.slightctl.DeviceInfo;
|
|
|
import com.ruoyi.ems.model.slightctl.SlcDevice;
|
|
|
import com.ruoyi.ems.model.slightctl.SlcDeviceLamp;
|
|
|
@@ -166,7 +167,21 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
throw new UnsupportedOperationException("不支持的abilityKey");
|
|
|
}
|
|
|
}
|
|
|
- else if (DevObjType.DEVC.getCode() == abilityParam.getObjType()) {
|
|
|
+ else if (DevObjType.DEVC.getCode() == abilityParam.getObjType() && StringUtils.equals(LAMP_POST_MODE_CODE,
|
|
|
+ abilityParam.getModelCode())) {
|
|
|
+ switch (abilityParam.getAbilityKey()) {
|
|
|
+ case "lightControlAll":
|
|
|
+ lampPostLightControl(abilityParam.getObjCode(), abilityParam.getAbilityParam());
|
|
|
+ break;
|
|
|
+ // case "lightControlBrightness":
|
|
|
+ // lampPostLightControlBrightness(abilityParam.getObjCode(), abilityParam.getAbilityParam());
|
|
|
+ // break;
|
|
|
+ default:
|
|
|
+ throw new UnsupportedOperationException("不支持的abilityKey");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (DevObjType.DEVC.getCode() == abilityParam.getObjType() && StringUtils.equals(DEV_MODE_CODE,
|
|
|
+ abilityParam.getModelCode())) {
|
|
|
switch (abilityParam.getAbilityKey()) {
|
|
|
case "lightControl":
|
|
|
lightControl(abilityParam.getObjCode(), abilityParam.getAbilityParam());
|
|
|
@@ -222,28 +237,51 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
|
|
|
public void lightControlAll(String paramValue) {
|
|
|
QueryDevice queryDevice = new QueryDevice();
|
|
|
- queryDevice.setDeviceModel(DEV_MODE_CODE);
|
|
|
+ queryDevice.setDeviceModel(LAMP_POST_MODE_CODE);
|
|
|
queryDevice.setSubsystemCode(SUBSYSTEM_CODE);
|
|
|
queryDevice.setDeviceStatus(1);
|
|
|
List<EmsDevice> devices = deviceService.selectList(queryDevice);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(devices)) {
|
|
|
- JsonEntity.ObjBuilder json = JsonEntity.objBuilder();
|
|
|
-
|
|
|
for (EmsDevice device : devices) {
|
|
|
- EmsObjAttrValue value = objAttrValueService.selectObjAttrValue(DEV_MODE_CODE, device.getDeviceCode(),
|
|
|
- "deviceId");
|
|
|
- json.addKeyArray("deviceIds", value.getAttrValue());
|
|
|
+ lampPostLightControl(device.getDeviceCode(), paramValue);
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void lampPostLightControl(String lampPostId, String paramValue) {
|
|
|
+ EmsObjAttrValue lampPostSubDev = objAttrValueService.selectObjAttrValue(LAMP_POST_MODE_CODE, lampPostId,
|
|
|
+ "subDev");
|
|
|
+
|
|
|
+ if (null != lampPostSubDev) {
|
|
|
+ JSONArray lights = JSONArray.parseArray(lampPostSubDev.getAttrValue());
|
|
|
+
|
|
|
+ JsonEntity.ObjBuilder json = JsonEntity.objBuilder();
|
|
|
+
|
|
|
+ lights.forEach(item -> {
|
|
|
+ JSONObject jsonObject = (JSONObject) item;
|
|
|
+ json.addKeyArray("deviceIds", jsonObject.getString("deviceCode"));
|
|
|
+ });
|
|
|
+
|
|
|
+ JSONObject jsonObject = (JSONObject) lights.get(0);
|
|
|
|
|
|
EmsObjAttrValue projectIdAttr = objAttrValueService.selectObjAttrValue(DEV_MODE_CODE,
|
|
|
- devices.get(0).getDeviceCode(), "projectId");
|
|
|
+ jsonObject.getString("deviceCode"), "projectId");
|
|
|
|
|
|
JsonEntity.ObjBuilder lampListObj = JsonEntity.objBuilder().putKv("lampNo", "1")
|
|
|
.putKv("lampOnOff", paramValue).putKv("brightness", 0);
|
|
|
json.addKeyArray("lampList", lampListObj.build().getJsonObj());
|
|
|
|
|
|
- lightControl(projectIdAttr.getAttrValue(), json.build().getJsonObj());
|
|
|
+ SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
|
|
|
+
|
|
|
+ // 下发执行命令
|
|
|
+ lightControl(template, projectIdAttr.getAttrValue(), json.build().getJsonObj());
|
|
|
+
|
|
|
+ // 刷新属性
|
|
|
+ lights.forEach(item -> {
|
|
|
+ JSONObject object = (JSONObject) item;
|
|
|
+ mergeLightDevAttr(template, projectIdAttr.getAttrValue(), object.getString("deviceCode"), null);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -271,14 +309,19 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
json.addKeyArray("lampList", lampListObj.build().getJsonObj());
|
|
|
}
|
|
|
|
|
|
- lightControl(projectIdAttr.getAttrValue(), json.build().getJsonObj());
|
|
|
+ SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
|
|
|
+
|
|
|
+ // 下发执行命令
|
|
|
+ lightControl(template, projectIdAttr.getAttrValue(), json.build().getJsonObj());
|
|
|
+
|
|
|
+ // 刷新属性
|
|
|
+ mergeLightDevAttr(template, projectIdAttr.getAttrValue(), deviceIdAttr.getAttrValue(), null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 灯组开关控制
|
|
|
*/
|
|
|
- public void lightControl(String projectId, JSONObject req) {
|
|
|
- SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
|
|
|
+ public void lightControl(SquareLightCtlTemplate template, String projectId, JSONObject req) {
|
|
|
CallData<Void> callData = template.lightControl(projectId, req);
|
|
|
saveCallLog(SUBSYSTEM_CODE, SYS_MODE_CODE, "lightControl", callData.getCallStatus(), callData.getCallPayload(),
|
|
|
callData.getResPayload());
|
|
|
@@ -308,14 +351,19 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
json.addKeyArray("lampList", lampListObj.build().getJsonObj());
|
|
|
}
|
|
|
|
|
|
- lightControlBrightness(projectIdAttr.getAttrValue(), json.build().getJsonObj());
|
|
|
+ SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
|
|
|
+
|
|
|
+ // 下发控制命令
|
|
|
+ lightControlBrightness(template, projectIdAttr.getAttrValue(), json.build().getJsonObj());
|
|
|
+
|
|
|
+ // 刷新属性
|
|
|
+ mergeLightDevAttr(template, projectIdAttr.getAttrValue(), deviceIdAttr.getAttrValue(), null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 灯组亮度控制
|
|
|
*/
|
|
|
- public void lightControlBrightness(String projectId, JSONObject req) {
|
|
|
- SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
|
|
|
+ public void lightControlBrightness(SquareLightCtlTemplate template, String projectId, JSONObject req) {
|
|
|
CallData<Void> callData = template.controlBrightness(projectId, req);
|
|
|
saveCallLog(SUBSYSTEM_CODE, SYS_MODE_CODE, "lightControlBrightness", callData.getCallStatus(),
|
|
|
callData.getCallPayload(), callData.getResPayload());
|
|
|
@@ -337,7 +385,7 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
.filter(dev -> StringUtils.equals(dev.getDeviceModelId(), "1945454135655632897"))
|
|
|
.collect(Collectors.toList());
|
|
|
syncLightDeviceList(lightDevs);
|
|
|
- mergeLightDevAttrValue(project.getProjectId(), lightDevs);
|
|
|
+ mergeLightDevAttrs(project.getProjectId(), lightDevs);
|
|
|
|
|
|
// 集中器设备同步
|
|
|
List<SlcDevice> centDevs = callData.getList().stream()
|
|
|
@@ -472,11 +520,20 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
}
|
|
|
|
|
|
private EmsObjAttrValue buildLampPostLights(String deviceCode, List<String> lampList) {
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+
|
|
|
+ for (String lamp : lampList) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("deviceCode", lamp);
|
|
|
+ jsonObject.put("modelCode", DEV_MODE_CODE);
|
|
|
+ jsonArray.add(jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
EmsObjAttrValue attrValue = new EmsObjAttrValue();
|
|
|
attrValue.setObjCode(deviceCode);
|
|
|
attrValue.setModelCode(LAMP_POST_MODE_CODE);
|
|
|
attrValue.setAttrKey("subDev");
|
|
|
- attrValue.setAttrValue(JSON.toJSONString(lampList));
|
|
|
+ attrValue.setAttrValue(jsonArray.toString());
|
|
|
return attrValue;
|
|
|
}
|
|
|
|
|
|
@@ -506,103 +563,104 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
|
|
|
return device;
|
|
|
}
|
|
|
|
|
|
- private void mergeLightDevAttrValue(String projectId, List<SlcDevice> slcDevices) {
|
|
|
+ private void mergeLightDevAttrs(String projectId, List<SlcDevice> slcDevices) {
|
|
|
SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
|
|
|
|
|
|
for (SlcDevice slcDevice : slcDevices) {
|
|
|
- CallData<DeviceInfo> callData = template.getDeviceInfo(projectId, slcDevice.getDeviceId());
|
|
|
- DeviceInfo deviceInfo = callData.getData();
|
|
|
+ mergeLightDevAttr(template, projectId, slcDevice.getDeviceId(), slcDevice);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- List<EmsObjAttrValue> oaValues = objAttrValueService.selectByObjCode(DEV_MODE_CODE,
|
|
|
- slcDevice.getDeviceId());
|
|
|
+ private void mergeLightDevAttr(SquareLightCtlTemplate template, String projectId, String deviceId,
|
|
|
+ SlcDevice slcDevice) {
|
|
|
+ CallData<DeviceInfo> callData = template.getDeviceInfo(projectId, deviceId);
|
|
|
+ DeviceInfo deviceInfo = callData.getData();
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(oaValues)) {
|
|
|
- Map<String, EmsObjAttrValue> vMap = oaValues.stream()
|
|
|
- .collect(Collectors.toMap(EmsObjAttrValue::getAttrKey, Function.identity()));
|
|
|
+ List<EmsObjAttrValue> oaValues = objAttrValueService.selectByObjCode(DEV_MODE_CODE, deviceId);
|
|
|
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "abnormal", String.valueOf(slcDevice.getAbnormal()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "csq", slcDevice.getCsq());
|
|
|
+ if (CollectionUtils.isNotEmpty(oaValues)) {
|
|
|
+ Map<String, EmsObjAttrValue> vMap = oaValues.stream()
|
|
|
+ .collect(Collectors.toMap(EmsObjAttrValue::getAttrKey, Function.identity()));
|
|
|
|
|
|
- if (null != deviceInfo.getBaselineInfo()) {
|
|
|
- BaselineInfo baselineInfo = deviceInfo.getBaselineInfo();
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "firmwareVer", baselineInfo.getFirmwareVer());
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "softwareVer", baselineInfo.getSoftwareVer());
|
|
|
- }
|
|
|
+ if (null != deviceInfo.getBaselineInfo()) {
|
|
|
+ BaselineInfo baselineInfo = deviceInfo.getBaselineInfo();
|
|
|
+ checkAndUpdate(vMap, deviceId, "firmwareVer", baselineInfo.getFirmwareVer());
|
|
|
+ checkAndUpdate(vMap, deviceId, "softwareVer", baselineInfo.getSoftwareVer());
|
|
|
+ }
|
|
|
|
|
|
- if (null != deviceInfo.getStatusInfo()) {
|
|
|
- StatusInfo sInfo = deviceInfo.getStatusInfo();
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "current", String.valueOf(sInfo.getCurrent()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "power", String.valueOf(sInfo.getPower()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "factor", String.valueOf(sInfo.getFactor()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "voltage", String.valueOf(sInfo.getVoltage()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "energy", String.valueOf(sInfo.getEnergy()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "temperature",
|
|
|
- String.valueOf(sInfo.getTemperature()));
|
|
|
- }
|
|
|
+ if (null != deviceInfo.getStatusInfo()) {
|
|
|
+ StatusInfo sInfo = deviceInfo.getStatusInfo();
|
|
|
+ checkAndUpdate(vMap, deviceId, "csq", String.valueOf(sInfo.getCsq()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "current", String.valueOf(sInfo.getCurrent()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "power", String.valueOf(sInfo.getPower()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "factor", String.valueOf(sInfo.getFactor()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "voltage", String.valueOf(sInfo.getVoltage()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "energy", String.valueOf(sInfo.getEnergy()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "temperature", String.valueOf(sInfo.getTemperature()));
|
|
|
+ }
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(deviceInfo.getLampList())) {
|
|
|
- List<SlcDeviceLamp> lampList = deviceInfo.getLampList();
|
|
|
- SlcDeviceLamp lamp = lampList.get(0);
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "cct", String.valueOf(lamp.getCct()));
|
|
|
- checkAndUpdate(vMap, slcDevice.getDeviceId(), "lampOnOff", String.valueOf(lamp.getLampOnOff()));
|
|
|
- }
|
|
|
+ if (CollectionUtils.isNotEmpty(deviceInfo.getLampList())) {
|
|
|
+ List<SlcDeviceLamp> lampList = deviceInfo.getLampList();
|
|
|
+ SlcDeviceLamp lamp = lampList.get(0);
|
|
|
+ checkAndUpdate(vMap, deviceId, "cct", String.valueOf(lamp.getCct()));
|
|
|
+ checkAndUpdate(vMap, deviceId, "lampOnOff", String.valueOf(lamp.getLampOnOff()));
|
|
|
}
|
|
|
- else {
|
|
|
- oaValues = new ArrayList<>();
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "projectId", projectId));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ oaValues = new ArrayList<>();
|
|
|
+
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "projectId", projectId));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "deviceId", deviceId));
|
|
|
+
|
|
|
+ if (null != slcDevice) {
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "imageUrl", slcDevice.getImageUrl()));
|
|
|
oaValues.add(
|
|
|
- new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "deviceId", slcDevice.getDeviceId()));
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "abnormal", String.valueOf(slcDevice.getAbnormal())));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "csq", slcDevice.getCsq()));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "lampList",
|
|
|
+ JSON.toJSONString(slcDevice.getLampList())));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != deviceInfo.getDeviceInfo()) {
|
|
|
+ DevSub subInfo = deviceInfo.getDeviceInfo();
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "deviceUid", subInfo.getDeviceUid()));
|
|
|
oaValues.add(
|
|
|
- new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "deviceUid", slcDevice.getDeviceUid()));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "deviceModelId",
|
|
|
- slcDevice.getDeviceModelId()));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "minCct",
|
|
|
- String.valueOf(slcDevice.getMinCct())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "maxCct",
|
|
|
- String.valueOf(slcDevice.getMaxCct())));
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "minCct", String.valueOf(subInfo.getMinCct())));
|
|
|
oaValues.add(
|
|
|
- new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "imageUrl", slcDevice.getImageUrl()));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "abnormal",
|
|
|
- String.valueOf(slcDevice.getAbnormal())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "csq", slcDevice.getCsq()));
|
|
|
-
|
|
|
- if (null != deviceInfo.getBaselineInfo()) {
|
|
|
- BaselineInfo bInfo = deviceInfo.getBaselineInfo();
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "firmwareVer",
|
|
|
- bInfo.getFirmwareVer()));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "softwareVer",
|
|
|
- bInfo.getSoftwareVer()));
|
|
|
- }
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "maxCct", String.valueOf(subInfo.getMaxCct())));
|
|
|
+ }
|
|
|
|
|
|
- if (null != deviceInfo.getStatusInfo()) {
|
|
|
- StatusInfo sInfo = deviceInfo.getStatusInfo();
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "current",
|
|
|
- String.valueOf(sInfo.getCurrent())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "power",
|
|
|
- String.valueOf(sInfo.getPower())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "factor",
|
|
|
- String.valueOf(sInfo.getFactor())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "voltage",
|
|
|
- String.valueOf(sInfo.getVoltage())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "energy",
|
|
|
- String.valueOf(sInfo.getEnergy())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "frequency",
|
|
|
- String.valueOf(sInfo.getFrequency())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "temperature",
|
|
|
- String.valueOf(sInfo.getTemperature())));
|
|
|
- }
|
|
|
+ if (null != deviceInfo.getBaselineInfo()) {
|
|
|
+ BaselineInfo bInfo = deviceInfo.getBaselineInfo();
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "deviceModelId", bInfo.getDeviceModelId()));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "firmwareVer", bInfo.getFirmwareVer()));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "softwareVer", bInfo.getSoftwareVer()));
|
|
|
+ }
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(deviceInfo.getLampList())) {
|
|
|
- List<SlcDeviceLamp> lampList = deviceInfo.getLampList();
|
|
|
- SlcDeviceLamp lamp = lampList.get(0);
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "cct",
|
|
|
- String.valueOf(lamp.getCct())));
|
|
|
- oaValues.add(new EmsObjAttrValue(slcDevice.getDeviceId(), DEV_MODE_CODE, "lampOnOff",
|
|
|
- String.valueOf(lamp.getLampOnOff())));
|
|
|
- }
|
|
|
+ if (null != deviceInfo.getStatusInfo()) {
|
|
|
+ StatusInfo sInfo = deviceInfo.getStatusInfo();
|
|
|
+ oaValues.add(
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "current", String.valueOf(sInfo.getCurrent())));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "power", String.valueOf(sInfo.getPower())));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "factor", String.valueOf(sInfo.getFactor())));
|
|
|
+ oaValues.add(
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "voltage", String.valueOf(sInfo.getVoltage())));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "energy", String.valueOf(sInfo.getEnergy())));
|
|
|
+ oaValues.add(
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "frequency", String.valueOf(sInfo.getFrequency())));
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "temperature",
|
|
|
+ String.valueOf(sInfo.getTemperature())));
|
|
|
+ }
|
|
|
|
|
|
- objAttrValueService.insertBatch(oaValues);
|
|
|
+ if (CollectionUtils.isNotEmpty(deviceInfo.getLampList())) {
|
|
|
+ List<SlcDeviceLamp> lampList = deviceInfo.getLampList();
|
|
|
+ SlcDeviceLamp lamp = lampList.get(0);
|
|
|
+ oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "cct", String.valueOf(lamp.getCct())));
|
|
|
+ oaValues.add(
|
|
|
+ new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "lampOnOff", String.valueOf(lamp.getLampOnOff())));
|
|
|
}
|
|
|
+
|
|
|
+ objAttrValueService.insertBatch(oaValues);
|
|
|
}
|
|
|
}
|
|
|
|