转义缓存枪的3个状态
This commit is contained in:
parent
4602d58d0e
commit
cf8b5a54c8
@ -24,6 +24,8 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class);
|
||||||
|
|
||||||
|
public static final String[] stable = {"离线","故障","空闲","充电"};
|
||||||
|
public static final String[] pvgstable = {"否", "是", "未知"};
|
||||||
private static final String[] hftable = {"急停按钮动作故障","无可用整流模块","出风口温度过高","交流防雷故障","交直流模块DC20通信中断","绝缘检测模块FC08通信中断","电度表通信中断","读卡器通信中断","RC10通信中断","风扇调速板故障","直流熔断器故障","高压接触器故障","门打开"};
|
private static final String[] hftable = {"急停按钮动作故障","无可用整流模块","出风口温度过高","交流防雷故障","交直流模块DC20通信中断","绝缘检测模块FC08通信中断","电度表通信中断","读卡器通信中断","RC10通信中断","风扇调速板故障","直流熔断器故障","高压接触器故障","门打开"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,28 +36,28 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
RealtimeData realtimeData = objectMapper.convertValue(req, RealtimeData.class);
|
RealtimeData realtimeData = objectMapper.convertValue(req, RealtimeData.class);
|
||||||
String pileNo = realtimeData.getPileNo();
|
String pileNo = realtimeData.getPileNo();
|
||||||
String gunId = realtimeData.getGunId();
|
String gunId = realtimeData.getGunId();
|
||||||
String status = realtimeData.getStatus();
|
|
||||||
realtimeData.setCreateBy("SYSTEM");
|
realtimeData.setCreateBy("SYSTEM");
|
||||||
realtimeData.setCreateTime(Calendar.getInstance().getTime());
|
realtimeData.setCreateTime(Calendar.getInstance().getTime());
|
||||||
String gunkey = "gun:".concat(pileNo).concat(gunId);
|
String gunkey = "gun:".concat(pileNo).concat(gunId);
|
||||||
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||||
cacheGun.put("status", status);
|
String statusplain = stable[Integer.parseInt(realtimeData.getStatus())];
|
||||||
|
cacheGun.put("status", statusplain);
|
||||||
|
cacheGun.put("pileGunStatus", pvgstable[Integer.parseInt(realtimeData.getPileGunStatus())]);
|
||||||
|
cacheGun.put("vehicleGunStatus", pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())]);
|
||||||
|
String hardwareFault = realtimeData.getHardwareFault();
|
||||||
|
String hfs = toBits(hardwareFault);
|
||||||
|
char[] hfcs = hfs.toCharArray();
|
||||||
|
String hfsplain = "";
|
||||||
|
for (int i = hfcs.length-1; i >=0; i--) {
|
||||||
|
if (hfcs[i] == 49) {
|
||||||
|
hfsplain = hfsplain.concat(hftable[hfcs.length-i-1]).concat("!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cacheGun.put("hf", hfsplain);
|
||||||
REDIS.setCacheMap(gunkey, cacheGun);
|
REDIS.setCacheMap(gunkey, cacheGun);
|
||||||
String orderNo = realtimeData.getOrderNo();
|
String orderNo = realtimeData.getOrderNo();
|
||||||
if (orderNo.equals("00000000000000000000000000000000")) {
|
String orderkey = "order:".concat(orderNo);
|
||||||
// todo tidy logic
|
if (!orderNo.equals("00000000000000000000000000000000")) {
|
||||||
String hardwareFault = realtimeData.getHardwareFault();
|
|
||||||
String hfs = toBits(hardwareFault);
|
|
||||||
char[] hfcs = hfs.toCharArray();
|
|
||||||
String hfsplain = "";
|
|
||||||
for (int i = hfcs.length-1; i >=0; i--) {
|
|
||||||
if (hfcs[i] == 49) {
|
|
||||||
hfsplain = hfsplain.concat(hftable[hfcs.length-i-1]).concat("!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cacheGun.put("hf", hfsplain);
|
|
||||||
} else {
|
|
||||||
String orderkey = "order:".concat(orderNo);
|
|
||||||
Map<String, Object> order = REDIS.getCacheMap(orderkey);
|
Map<String, Object> order = REDIS.getCacheMap(orderkey);
|
||||||
List<RealtimeData> realtimeDataList = (List<RealtimeData>) order.get("realtimeDataList");
|
List<RealtimeData> realtimeDataList = (List<RealtimeData>) order.get("realtimeDataList");
|
||||||
if (realtimeDataList == null) {
|
if (realtimeDataList == null) {
|
||||||
@ -63,7 +65,7 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
}
|
}
|
||||||
realtimeDataList.add(realtimeData);
|
realtimeDataList.add(realtimeData);
|
||||||
order.put("soc", realtimeData.getSoc());
|
order.put("soc", realtimeData.getSoc());
|
||||||
order.put("status", status);
|
order.put("status", statusplain);
|
||||||
order.put("realtimeDataList", realtimeDataList);
|
order.put("realtimeDataList", realtimeDataList);
|
||||||
REDIS.setCacheMap(orderkey, order);
|
REDIS.setCacheMap(orderkey, order);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user