Commit b6cc8562 by fz

1.保存注册信息,如果蓝牙地址有则更新,没有新增

1 parent 59fcb807
...@@ -392,6 +392,17 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -392,6 +392,17 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
String mobileMac = request.getMobileMac(); String mobileMac = request.getMobileMac();
if (StringUtils.isNotBlank(mobileMac)) { if (StringUtils.isNotBlank(mobileMac)) {
try {
SmartKeyBlueSenseExample blueSenseExample = new SmartKeyBlueSenseExample();
blueSenseExample.createCriteria()
.andUserIdEqualTo(smartVehicleBlueKey.getUserId())
.andSnEqualTo(smartVehicleBlueKey.getSn())
.andMobileBlueMacEqualTo(mobileMac)
.andIsDeleteEqualTo(0);
List<SmartKeyBlueSense> list = smartKeyBlueSenseService.selectByExample(blueSenseExample);
if(CollectionUtils.isEmpty(list)){
//如果手机mac不存在,新增
SmartKeyBlueSense blueSense = SmartKeyBlueSense.builder() SmartKeyBlueSense blueSense = SmartKeyBlueSense.builder()
.userId(smartVehicleBlueKey.getUserId()) .userId(smartVehicleBlueKey.getUserId())
.sn(smartVehicleBlueKey.getSn()) .sn(smartVehicleBlueKey.getSn())
...@@ -400,9 +411,14 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -400,9 +411,14 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
.isDelete(0) .isDelete(0)
.autoSenseStatus(0) .autoSenseStatus(0)
.build(); .build();
try {
//新增车钥匙手机蓝牙mac,自动感应状态 //新增车钥匙手机蓝牙mac,自动感应状态
smartKeyBlueSenseService.insert(blueSense); smartKeyBlueSenseService.insert(blueSense);
}else {
SmartKeyBlueSense blueSense = list.get(0);
blueSense.setMobileBlueMac(mobileMac);
//新增车钥匙手机蓝牙mac,自动感应状态
smartKeyBlueSenseService.updateByPrimaryKeySelective(blueSense);
}
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_9); throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_9);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!