|
@@ -1,5 +1,9 @@
|
|
|
package com.zd.laboratory.service.impl;
|
|
package com.zd.laboratory.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
+import com.alibaba.fastjson.parser.Feature;
|
|
|
import com.zd.common.core.redis.RedisService;
|
|
import com.zd.common.core.redis.RedisService;
|
|
|
import com.zd.laboratory.config.TimeWaitConfigUtils;
|
|
import com.zd.laboratory.config.TimeWaitConfigUtils;
|
|
|
import com.zd.laboratory.domain.LabExitPointRelay;
|
|
import com.zd.laboratory.domain.LabExitPointRelay;
|
|
@@ -62,14 +66,17 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
public int openLight(LabExitPointRelay labExitPointRelay) {
|
|
public int openLight(LabExitPointRelay labExitPointRelay) {
|
|
|
List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(labExitPointRelay);
|
|
List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(labExitPointRelay);
|
|
|
|
|
|
|
|
Map <String, Object> relayListMap = new HashMap <>();
|
|
Map <String, Object> relayListMap = new HashMap <>();
|
|
|
Set <LabExitLineJoinPointVO> lightPointSet = new HashSet <>();
|
|
Set <LabExitLineJoinPointVO> lightPointSet = new HashSet <>();
|
|
|
if(redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId())!=null){
|
|
if(redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId())!=null){
|
|
|
- relayListMap = redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId());
|
|
|
|
|
- lightPointSet = (Set <LabExitLineJoinPointVO>) relayListMap.get("lightPointSet");
|
|
|
|
|
|
|
+ String joinPointVOSStr = redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId());
|
|
|
|
|
+ relayListMap = (Map <String, Object>) JSON.parseObject(joinPointVOSStr, Object.class, Feature.OrderedField);
|
|
|
|
|
+ JSONObject jsonObj = (JSONObject) JSONObject.parseObject(joinPointVOSStr, Object.class, Feature.OrderedField);
|
|
|
|
|
+ lightPointSet = jsonObj.getObject("lightPointSet", new TypeReference <Set <LabExitLineJoinPointVO>>(){});
|
|
|
}
|
|
}
|
|
|
//todo 开启继电器开关
|
|
//todo 开启继电器开关
|
|
|
for(LabExitPointRelay relay : labExitPointRelays){
|
|
for(LabExitPointRelay relay : labExitPointRelays){
|
|
@@ -106,13 +113,14 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
relayListMap.put("lightPointSet",lightPointSet);
|
|
relayListMap.put("lightPointSet",lightPointSet);
|
|
|
- redisService.setCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId(), relayListMap, 3L, TimeUnit.HOURS);
|
|
|
|
|
|
|
+ redisService.setCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId(), JSON.toJSONString(relayListMap), 3L, TimeUnit.HOURS);
|
|
|
//todo 发送前端消息
|
|
//todo 发送前端消息
|
|
|
messageSendService.exitLineToFloor(labExitPointRelay.getFloorId());
|
|
messageSendService.exitLineToFloor(labExitPointRelay.getFloorId());
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
public int closeLight(LabExitPointRelay labExitPointRelay) {
|
|
public int closeLight(LabExitPointRelay labExitPointRelay) {
|
|
|
List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(labExitPointRelay);
|
|
List <LabExitPointRelay> labExitPointRelays = labExitPointRelayMapper.selectLabExitPointRelayList(labExitPointRelay);
|
|
|
|
|
|
|
@@ -120,8 +128,10 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
|
|
|
Set <LabExitLineJoinPointVO> lightPointSet = new HashSet <>();
|
|
Set <LabExitLineJoinPointVO> lightPointSet = new HashSet <>();
|
|
|
Set <LabExitLineJoinPointVO> newLightPointSet = new HashSet <>();
|
|
Set <LabExitLineJoinPointVO> newLightPointSet = new HashSet <>();
|
|
|
if(redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId())!=null){
|
|
if(redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId())!=null){
|
|
|
- relayListMap = redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId());
|
|
|
|
|
- lightPointSet = (Set <LabExitLineJoinPointVO>) relayListMap.get("lightPointSet");
|
|
|
|
|
|
|
+ String joinPointVOSStr = redisService.getCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId());
|
|
|
|
|
+ relayListMap = (Map <String, Object>) JSON.parseObject(joinPointVOSStr, Object.class, Feature.OrderedField);
|
|
|
|
|
+ JSONObject jsonObj = (JSONObject) JSONObject.parseObject(joinPointVOSStr, Object.class, Feature.OrderedField);
|
|
|
|
|
+ lightPointSet = jsonObj.getObject("lightPointSet", new TypeReference <Set <LabExitLineJoinPointVO>>(){});
|
|
|
newLightPointSet.addAll(lightPointSet) ;
|
|
newLightPointSet.addAll(lightPointSet) ;
|
|
|
}
|
|
}
|
|
|
//todo 开启继电器开关
|
|
//todo 开启继电器开关
|
|
@@ -149,7 +159,7 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
relayListMap.put("lightPointSet",newLightPointSet);
|
|
relayListMap.put("lightPointSet",newLightPointSet);
|
|
|
- redisService.setCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId(), relayListMap, 3L, TimeUnit.HOURS);
|
|
|
|
|
|
|
+ redisService.setCacheObject("exitLineBy"+labExitPointRelay.getBuildId()+""+labExitPointRelay.getFloorId(), JSON.toJSONString(relayListMap), 3L, TimeUnit.HOURS);
|
|
|
//todo 发送前端消息
|
|
//todo 发送前端消息
|
|
|
messageSendService.exitLineToFloor(labExitPointRelay.getFloorId());
|
|
messageSendService.exitLineToFloor(labExitPointRelay.getFloorId());
|
|
|
return 1;
|
|
return 1;
|