|
@@ -180,11 +180,22 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
lapiResult.setSuccess(true);
|
|
|
lapiResult.setData(dataMap);
|
|
|
lapiResultList.add(lapiResult);
|
|
|
+
|
|
|
+ try{
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),true);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
} else {
|
|
|
lapiResult.setMsg("绑定失败");
|
|
|
lapiResult.setSuccess(false);
|
|
|
lapiResult.setData(dataMap);
|
|
|
lapiResultList.add(lapiResult);
|
|
|
+ try{
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),false);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -199,6 +210,7 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
lapiResult.setMsg(e.getMessage().contains("timed out") ? "设备连接超时" : e.getMessage());
|
|
|
lapiResult.setData(dataMap);
|
|
|
lapiResultList.add(lapiResult);
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),null);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -295,11 +307,21 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
lapiResult.setSuccess(true);
|
|
|
lapiResult.setData(dataMap);
|
|
|
lapiResultList.add(lapiResult);
|
|
|
+ try{
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),true);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
} else {
|
|
|
lapiResult.setMsg("绑定失败");
|
|
|
lapiResult.setSuccess(false);
|
|
|
lapiResult.setData(dataMap);
|
|
|
lapiResultList.add(lapiResult);
|
|
|
+ try{
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),false);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -317,6 +339,7 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
lapiResult.setMsg(e.getMessage().contains("timed out") ? "设备连接超时" : e.getMessage());
|
|
|
lapiResult.setData(dataMap);
|
|
|
lapiResultList.add(lapiResult);
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),null);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -777,10 +800,24 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
JSONObject response = LApiUtil.getResponse(dataJson);
|
|
|
Integer num = response.getInteger("Total");
|
|
|
if (num > 0) {
|
|
|
+
|
|
|
+ try{
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),true);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
+ }else {
|
|
|
+ try{
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),false);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
+ personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),null);
|
|
|
return false;
|
|
|
}
|
|
|
|