Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3692b850
authored
May 04, 2021
by
fengzhi
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/smart-car-key-share' into smart-car-key-share
2 parents
34cb0005
65fcea86
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
src/main/java/com/glsx/smart/exception/GlobalExceptionHandler.java
src/main/java/com/glsx/smart/service/SmartVehicleBlueKeyService.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartVehicleBlueKeyServiceImpl.java
src/main/java/com/glsx/smart/exception/GlobalExceptionHandler.java
View file @
3692b85
...
@@ -6,6 +6,7 @@ import org.springframework.validation.BindException;
...
@@ -6,6 +6,7 @@ import org.springframework.validation.BindException;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.ServletRequestBindingException
;
import
org.springframework.web.bind.ServletRequestBindingException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
/**
/**
* <p>Description:
* <p>Description:
...
@@ -16,7 +17,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
...
@@ -16,7 +17,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
* @deprecated 抛出异常,让上游服务捕获信息
* @deprecated 抛出异常,让上游服务捕获信息
*/
*/
@Slf4j
@Slf4j
//
@RestControllerAdvice
@RestControllerAdvice
@Deprecated
@Deprecated
public
class
GlobalExceptionHandler
{
public
class
GlobalExceptionHandler
{
@ExceptionHandler
({
BusinessException
.
class
})
@ExceptionHandler
({
BusinessException
.
class
})
...
...
src/main/java/com/glsx/smart/service/SmartVehicleBlueKeyService.java
View file @
3692b85
...
@@ -2,7 +2,6 @@ package com.glsx.smart.service;
...
@@ -2,7 +2,6 @@ package com.glsx.smart.service;
import
com.glsx.smart.dao.entity.SmartVehicleBlueKey
;
import
com.glsx.smart.dao.entity.SmartVehicleBlueKey
;
import
com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample
;
import
com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample
;
import
com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,6 +37,8 @@ public interface SmartVehicleBlueKeyService {
...
@@ -38,6 +37,8 @@ public interface SmartVehicleBlueKeyService {
List
<
SmartVehicleBlueKey
>
selectById
(
Long
id
);
List
<
SmartVehicleBlueKey
>
selectById
(
Long
id
);
int
removeKeyByIds
(
List
<
Long
>
keyIds
);
int
removeKeyByIds
(
List
<
Long
>
keyIds
);
long
countKeyByUser
(
long
userId
);
}
}
...
...
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
View file @
3692b85
...
@@ -359,11 +359,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
...
@@ -359,11 +359,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
List
<
SmartCarKeyResponse
>
responseList
=
new
ArrayList
<>(
smartCarKeyResponseMap
.
values
());
List
<
SmartCarKeyResponse
>
responseList
=
new
ArrayList
<>(
smartCarKeyResponseMap
.
values
());
//给没有名称的钥匙设置名字
//
//
给没有名称的钥匙设置名字
AtomicInteger
num
=
new
AtomicInteger
(
1
);
//
AtomicInteger num = new AtomicInteger(1);
responseList
.
stream
()
//
responseList.stream()
.
filter
(
key
->
StringUtils
.
isBlank
(
key
.
getKeyName
()))
//
.filter(key -> StringUtils.isBlank(key.getKeyName()))
.
forEach
(
key
->
key
.
setKeyName
(
"钥匙"
+
num
.
getAndIncrement
()));
//
.forEach(key -> key.setKeyName("钥匙" + num.getAndIncrement()));
//根据用户钥匙id,查询蓝牙,感应列表
//根据用户钥匙id,查询蓝牙,感应列表
...
@@ -517,6 +517,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
...
@@ -517,6 +517,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
long
userId
=
Long
.
valueOf
(
request
.
getUserId
());
long
userId
=
Long
.
valueOf
(
request
.
getUserId
());
String
sn
=
request
.
getSn
();
String
sn
=
request
.
getSn
();
long
count
=
smartVehicleBlueKeyService
.
countKeyByUser
(
userId
);
//如果sn没有车钥匙,生成只含有crep钥匙信息返回
//如果sn没有车钥匙,生成只含有crep钥匙信息返回
SmartVehicleBlueKey
newKey
=
new
SmartVehicleBlueKey
();
SmartVehicleBlueKey
newKey
=
new
SmartVehicleBlueKey
();
newKey
.
setSn
(
sn
);
newKey
.
setSn
(
sn
);
...
@@ -532,12 +534,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
...
@@ -532,12 +534,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//默认手机编号
//默认手机编号
newKey
.
setMobileCode
(
"0"
);
newKey
.
setMobileCode
(
"0"
);
//默认车钥匙备注
//默认车钥匙备注
newKey
.
setKeyName
(
"
"
);
newKey
.
setKeyName
(
"
钥匙"
+(++
count
)
);
//创建时间为现在
//创建时间为现在
newKey
.
setCreateTime
(
new
Date
());
newKey
.
setCreateTime
(
new
Date
());
//默认0,正常数据
//默认0,正常数据
newKey
.
setIsDelete
(
0
);
newKey
.
setIsDelete
(
0
);
newKey
.
setShareStatus
(
1
);
newKey
.
setPeripheralUuid
(
""
);
newKey
.
setPeripheralUuid
(
""
);
try
{
try
{
...
...
src/main/java/com/glsx/smart/service/impl/SmartVehicleBlueKeyServiceImpl.java
View file @
3692b85
...
@@ -99,6 +99,14 @@ public class SmartVehicleBlueKeyServiceImpl implements SmartVehicleBlueKeyServic
...
@@ -99,6 +99,14 @@ public class SmartVehicleBlueKeyServiceImpl implements SmartVehicleBlueKeyServic
public
int
removeKeyByIds
(
List
<
Long
>
keyIds
)
{
public
int
removeKeyByIds
(
List
<
Long
>
keyIds
)
{
return
smartVehicleBlueKeyMapper
.
removeKeyByIds
(
keyIds
);
return
smartVehicleBlueKeyMapper
.
removeKeyByIds
(
keyIds
);
}
}
@Override
public
long
countKeyByUser
(
long
userId
)
{
SmartVehicleBlueKeyExample
example
=
new
SmartVehicleBlueKeyExample
();
example
.
createCriteria
()
.
andUserIdEqualTo
(
userId
);
return
smartVehicleBlueKeyMapper
.
countByExample
(
example
);
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment