Commit da12b7c5 LN

NLM入库不亮灯bug修改

1 个父辈 80382e20
...@@ -188,6 +188,10 @@ public class NLMShelfHandler extends BaseDeviceHandler { ...@@ -188,6 +188,10 @@ public class NLMShelfHandler extends BaseDeviceHandler {
return; return;
} }
String allLightOnStr = ""; String allLightOnStr = "";
for (final String posName : posNameList) {
DevicesStatusUtil.clearOp(cid, "close", posName);
}
for (final String posName : posNameList) { for (final String posName : posNameList) {
String lightOnStr = posName + "=" + color; String lightOnStr = posName + "=" + color;
DevicesStatusUtil.appendOp(cid, "open", lightOnStr); DevicesStatusUtil.appendOp(cid, "open", lightOnStr);
......
...@@ -18,10 +18,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -18,10 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
...@@ -278,6 +275,36 @@ public class DevicesStatusUtil { ...@@ -278,6 +275,36 @@ public class DevicesStatusUtil {
opMap.put(opKey, value); opMap.put(opKey, value);
storageOpMap.put(cid, opMap); storageOpMap.put(cid, opMap);
} }
public static void clearOp(String cid, String opKey, String opValue) {
try {
Map<String, String> opMap = storageOpMap.get(cid);
if (opMap == null) {
return;
}
String value = opMap.get(opKey);
if (ObjectUtil.isEmpty(value)) {
return;
} else if (!value.contains(opValue)) {
return;
}
else if(value.equals(opValue)){
opMap.remove(opKey);
}else {
String t1 = "|" + opValue;
String t2 = opValue + "|";
if (opValue.contains(t1)) {
opValue = opValue.replace(t1, "");
}
if (opValue.contains(t2)) {
opValue = opValue.replace(t2, "");
}
opMap.put(opKey, opValue);
}
storageOpMap.put(cid, opMap);
} catch (Exception exception) {
log.error("出错:" + exception.toString());
}
}
public static Map<String,String> getAndRemoveOp(String cid){ public static Map<String,String> getAndRemoveOp(String cid){
Map<String, String> opMap = storageOpMap.get(cid); Map<String, String> opMap = storageOpMap.get(cid);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!