Commit d0ef2ed0 by fz

1.钥匙信息注册保存,给钥匙设置默认名字

1 parent 359013ec
......@@ -2,7 +2,6 @@ package com.glsx.smart.service;
import com.glsx.smart.dao.entity.SmartVehicleBlueKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample;
import com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample;
import java.util.List;
......@@ -38,6 +37,8 @@ public interface SmartVehicleBlueKeyService {
List<SmartVehicleBlueKey> selectById(Long id);
int removeKeyByIds(List<Long> keyIds);
long countKeyByUser(long userId);
}
......
......@@ -359,11 +359,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
List<SmartCarKeyResponse> responseList = new ArrayList<>(smartCarKeyResponseMap.values());
//给没有名称的钥匙设置名字
AtomicInteger num = new AtomicInteger(1);
responseList.stream()
.filter(key -> StringUtils.isBlank(key.getKeyName()))
.forEach(key -> key.setKeyName("钥匙" + num.getAndIncrement()));
////给没有名称的钥匙设置名字
//AtomicInteger num = new AtomicInteger(1);
//responseList.stream()
// .filter(key -> StringUtils.isBlank(key.getKeyName()))
// .forEach(key -> key.setKeyName("钥匙" + num.getAndIncrement()));
//根据用户钥匙id,查询蓝牙,感应列表
......@@ -517,6 +517,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
long userId = Long.valueOf(request.getUserId());
String sn = request.getSn();
long count = smartVehicleBlueKeyService.countKeyByUser(userId);
//如果sn没有车钥匙,生成只含有crep钥匙信息返回
SmartVehicleBlueKey newKey = new SmartVehicleBlueKey();
newKey.setSn(sn);
......@@ -532,12 +534,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//默认手机编号
newKey.setMobileCode("0");
//默认车钥匙备注
newKey.setKeyName("");
newKey.setKeyName("钥匙"+(++count));
//创建时间为现在
newKey.setCreateTime(new Date());
//默认0,正常数据
newKey.setIsDelete(0);
newKey.setShareStatus(1);
newKey.setPeripheralUuid("");
try {
......
......@@ -99,6 +99,14 @@ public class SmartVehicleBlueKeyServiceImpl implements SmartVehicleBlueKeyServic
public int removeKeyByIds(List<Long> keyIds) {
return smartVehicleBlueKeyMapper.removeKeyByIds(keyIds);
}
@Override
public long countKeyByUser(long userId) {
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria()
.andUserIdEqualTo(userId);
return smartVehicleBlueKeyMapper.countByExample(example);
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!