|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.zd.airbottle.api.feign.RemoteAirBottleService;
|
|
import com.zd.airbottle.api.feign.RemoteAirBottleService;
|
|
|
import com.zd.common.core.redis.RedisService;
|
|
import com.zd.common.core.redis.RedisService;
|
|
|
import com.zd.common.core.utils.SpringUtils;
|
|
import com.zd.common.core.utils.SpringUtils;
|
|
|
|
|
+import com.zd.common.core.utils.UUID;
|
|
|
import com.zd.laboratory.api.dto.WarningNoticeLogDto;
|
|
import com.zd.laboratory.api.dto.WarningNoticeLogDto;
|
|
|
import com.zd.laboratory.api.feign.RemoteLaboratoryService;
|
|
import com.zd.laboratory.api.feign.RemoteLaboratoryService;
|
|
|
import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
|
|
import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
|
|
@@ -39,8 +40,9 @@ public class BeaconMateImpl implements BeaconMate {
|
|
|
private RemoteLaboratoryService remoteLaboratoryService = SpringUtils.getBean(RemoteLaboratoryService.class);
|
|
private RemoteLaboratoryService remoteLaboratoryService = SpringUtils.getBean(RemoteLaboratoryService.class);
|
|
|
|
|
|
|
|
public void sendBeaconMate(String dataStr){
|
|
public void sendBeaconMate(String dataStr){
|
|
|
|
|
+ String uuid = UUID.fastUUID().toString();
|
|
|
try{
|
|
try{
|
|
|
- log.info("1=====================================》上报蓝牙网关编码:"+dataStr);
|
|
|
|
|
|
|
+ log.info("{} 1=====================================》上报蓝牙网关编码:"+dataStr,uuid);
|
|
|
JSONObject jsonObject=JSONObject.parseObject(dataStr);
|
|
JSONObject jsonObject=JSONObject.parseObject(dataStr);
|
|
|
String mac = jsonObject.getString("mac");
|
|
String mac = jsonObject.getString("mac");
|
|
|
if(mac!=null && !"".equals(mac)){
|
|
if(mac!=null && !"".equals(mac)){
|
|
@@ -56,17 +58,17 @@ public class BeaconMateImpl implements BeaconMate {
|
|
|
if(resultData.getCode()==200 && resultData.getData() != null){
|
|
if(resultData.getCode()==200 && resultData.getData() != null){
|
|
|
// redis存储蓝牙网关mac地址,用于在线离线问题。
|
|
// redis存储蓝牙网关mac地址,用于在线离线问题。
|
|
|
redisService.setCacheObject(BaseConstants.BEACON_MAC+"~"+ mac,mac, 60L, TimeUnit.SECONDS);
|
|
redisService.setCacheObject(BaseConstants.BEACON_MAC+"~"+ mac,mac, 60L, TimeUnit.SECONDS);
|
|
|
- log.info("2=====================================》获取实验室id:"+resultData.getData().get("subId"));
|
|
|
|
|
|
|
+ log.info("{} 2=====================================》获取实验室id:"+resultData.getData().get("subId"),uuid);
|
|
|
Long subId = Long.parseLong(resultData.getData().get("subId")+"");
|
|
Long subId = Long.parseLong(resultData.getData().get("subId")+"");
|
|
|
List <Map<String,Object>> beaconList = redisService.getCacheObject(BaseConstants.BEACON_MATE_INFO+"~"+subId);
|
|
List <Map<String,Object>> beaconList = redisService.getCacheObject(BaseConstants.BEACON_MATE_INFO+"~"+subId);
|
|
|
if(beaconList==null || initFlag){
|
|
if(beaconList==null || initFlag){
|
|
|
- log.info("2.1=====================================》初始化实验室信标列表和实验室下的所有信标生命周期");
|
|
|
|
|
|
|
+ log.info("{} 2.1=====================================》 {} 初始化实验室信标列表和实验室下的所有信标生命周期",uuid,subId);
|
|
|
// 根据实验室id获取蓝牙信标列表
|
|
// 根据实验室id获取蓝牙信标列表
|
|
|
remoteAirBottleService.setBeaconBySubId(subId);
|
|
remoteAirBottleService.setBeaconBySubId(subId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(beaconList!=null){
|
|
if(beaconList!=null){
|
|
|
- log.info("3=====================================》上报信标列表:"+jsonObject.getJSONArray("devices"));
|
|
|
|
|
|
|
+ log.info("{} 3=====================================》 {} 上报信标列表:"+jsonObject.getJSONArray("devices"),uuid,subId);
|
|
|
JSONArray array = jsonObject.getJSONArray("devices");
|
|
JSONArray array = jsonObject.getJSONArray("devices");
|
|
|
|
|
|
|
|
// 这里需要查看信标通知列表,移除通知列表对应的信标气瓶数据
|
|
// 这里需要查看信标通知列表,移除通知列表对应的信标气瓶数据
|
|
@@ -87,14 +89,14 @@ public class BeaconMateImpl implements BeaconMate {
|
|
|
// 这里需要处理信标字符串
|
|
// 这里需要处理信标字符串
|
|
|
beaconStr = checkBeacon(beaconStr);
|
|
beaconStr = checkBeacon(beaconStr);
|
|
|
if(beaconList.get(x).get("beaconTag").equals(beaconStr)){
|
|
if(beaconList.get(x).get("beaconTag").equals(beaconStr)){
|
|
|
- log.info("4.=====================================》上报的信标处理后返回信标编码:"+beaconStr+";实验室下匹配后的信标:"+beaconList.get(x).get("beaconTag"));
|
|
|
|
|
|
|
+ log.info("{} 4.=====================================》上报的信标处理后返回信标编码:"+beaconStr+"; {} 实验室下匹配后的信标:"+beaconList.get(x).get("beaconTag"),uuid,subId);
|
|
|
// redis存储蓝牙信标编码和实验室id和mac地址
|
|
// redis存储蓝牙信标编码和实验室id和mac地址
|
|
|
- redisService.setCacheObject(BaseConstants.BEACON_MATE_DET+"~"+ beaconStr+"~"+subId+"~"+beaconList.get(x).get("gasName"),beaconStr, 120L, TimeUnit.SECONDS);
|
|
|
|
|
|
|
+ redisService.setCacheObject(BaseConstants.BEACON_MATE_DET+"~"+ beaconStr+"~"+subId+"~"+beaconList.get(x).get("gasName"),beaconStr, 10L, TimeUnit.MINUTES);
|
|
|
// 循环信标通知,把还回来的气瓶提示移除。
|
|
// 循环信标通知,把还回来的气瓶提示移除。
|
|
|
if(beaconNoticeList != null){
|
|
if(beaconNoticeList != null){
|
|
|
for(Map notice:beaconNoticeList){
|
|
for(Map notice:beaconNoticeList){
|
|
|
if(notice.get("beaconTag").equals(beaconStr)){
|
|
if(notice.get("beaconTag").equals(beaconStr)){
|
|
|
- log.info("5.=====================================》移除返回来的信标提示语:"+notice);
|
|
|
|
|
|
|
+ log.info("{} 5.=====================================》 {} 移除返回来的信标提示语:"+notice,uuid,subId);
|
|
|
newNoticeList.remove(notice);
|
|
newNoticeList.remove(notice);
|
|
|
beaconTagBuild.append(",");
|
|
beaconTagBuild.append(",");
|
|
|
beaconTagBuild.append(beaconStr);
|
|
beaconTagBuild.append(beaconStr);
|
|
@@ -115,7 +117,7 @@ public class BeaconMateImpl implements BeaconMate {
|
|
|
messageSendService.riskPlanTriggerNotice();
|
|
messageSendService.riskPlanTriggerNotice();
|
|
|
//这里需要调用通知修改接口,把离位改成在位
|
|
//这里需要调用通知修改接口,把离位改成在位
|
|
|
if(beaconTagBuild.length()>0){
|
|
if(beaconTagBuild.length()>0){
|
|
|
- log.info("6.=====================================》带离气瓶归还后需要修改在位"+beaconTagBuild.substring(1));
|
|
|
|
|
|
|
+ log.info("{} 6.=====================================》 {} 带离气瓶归还后需要修改在位"+beaconTagBuild.substring(1),uuid,subId);
|
|
|
WarningNoticeLogDto warningNoticeLogDto = new WarningNoticeLogDto();
|
|
WarningNoticeLogDto warningNoticeLogDto = new WarningNoticeLogDto();
|
|
|
warningNoticeLogDto.setBeaconTag(beaconTagBuild.substring(1));
|
|
warningNoticeLogDto.setBeaconTag(beaconTagBuild.substring(1));
|
|
|
remoteLaboratoryService.updateLocationState(warningNoticeLogDto);
|
|
remoteLaboratoryService.updateLocationState(warningNoticeLogDto);
|