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 7c1d0eeb
authored
May 02, 2021
by
fz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.添加主钥匙,分享钥匙批量上报指令日志接口
1 parent
0c1a6d49
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
133 additions
and
6 deletions
src/main/java/com/glsx/smart/controller/AiLockingkeyController.java
src/main/java/com/glsx/smart/controller/AiLockingkeyShareController.java
src/main/java/com/glsx/smart/dao/mapper/SmartKeyCommandLogMapper.java
src/main/java/com/glsx/smart/dao/mapper/SmartKeyCommandShareLogMapper.java
src/main/java/com/glsx/smart/pojo/request/SmartCarKeyActionLogBatchRequest.java
src/main/java/com/glsx/smart/pojo/request/SmartCarKeyShareActionLogBatchRequest.java
src/main/java/com/glsx/smart/service/AiLockingKeyService.java
src/main/java/com/glsx/smart/service/AiLockingKeyShareService.java
src/main/java/com/glsx/smart/service/SmartKeyCommandLogService.java
src/main/java/com/glsx/smart/service/SmartKeyCommandShareLogService.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
src/main/java/com/glsx/smart/service/impl/AiLockingKeyShareServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartKeyCommandLogServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartKeyCommandShareLogServiceImpl.java
src/main/resources/mapper/SmartKeyCommandLogMapper.xml
src/main/resources/mapper/SmartKeyCommandShareLogMapper.xml
src/main/java/com/glsx/smart/controller/AiLockingkeyController.java
View file @
7c1d0ee
package
com
.
glsx
.
smart
.
controller
;
package
com
.
glsx
.
smart
.
controller
;
import
com.glsx.cloudframework.core.util.Assert
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.pojo.request.*
;
import
com.glsx.smart.pojo.request.*
;
import
com.glsx.smart.service.AiLockingKeyService
;
import
com.glsx.smart.service.AiLockingKeyService
;
...
@@ -94,6 +95,12 @@ public class AiLockingkeyController {
...
@@ -94,6 +95,12 @@ public class AiLockingkeyController {
return
aiLockingKeyService
.
LogLockingKeyCommand
(
request
);
return
aiLockingKeyService
.
LogLockingKeyCommand
(
request
);
}
}
//车钥匙操作指令批量上报
@PostMapping
(
value
=
"/batchLogCommand"
)
public
R
batchLogCommand
(
@RequestBody
SmartCarKeyActionLogBatchRequest
request
)
{
return
aiLockingKeyService
.
batchLogCommand
(
request
);
}
//车钥匙修改昵称
//车钥匙修改昵称
@PostMapping
(
value
=
"/setName"
)
@PostMapping
(
value
=
"/setName"
)
public
R
setLockingKeyName
(
@RequestBody
SmartCarKeyNameRequest
request
)
{
public
R
setLockingKeyName
(
@RequestBody
SmartCarKeyNameRequest
request
)
{
...
...
src/main/java/com/glsx/smart/controller/AiLockingkeyShareController.java
View file @
7c1d0ee
...
@@ -44,6 +44,12 @@ public class AiLockingkeyShareController {
...
@@ -44,6 +44,12 @@ public class AiLockingkeyShareController {
return
aiLockingKeyShareService
.
logShareLockingKeyCommand
(
request
);
return
aiLockingKeyShareService
.
logShareLockingKeyCommand
(
request
);
}
}
//车钥匙操作指令批量上报
@PostMapping
(
value
=
"/batchLogCommand"
)
public
R
batchLogCommand
(
@RequestBody
SmartCarKeyShareActionLogBatchRequest
request
)
{
return
aiLockingKeyShareService
.
batchLogCommand
(
request
);
}
//获取分享的钥匙信息
//获取分享的钥匙信息
@GetMapping
(
value
=
"/getKey"
)
@GetMapping
(
value
=
"/getKey"
)
public
R
getShareLockingKey
(
@RequestParam
(
value
=
"keyId"
)
String
keyId
)
{
public
R
getShareLockingKey
(
@RequestParam
(
value
=
"keyId"
)
String
keyId
)
{
...
...
src/main/java/com/glsx/smart/dao/mapper/SmartKeyCommandLogMapper.java
View file @
7c1d0ee
...
@@ -2,6 +2,7 @@ package com.glsx.smart.dao.mapper;
...
@@ -2,6 +2,7 @@ package com.glsx.smart.dao.mapper;
import
com.glsx.smart.dao.entity.SmartKeyCommandLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLogExample
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLogExample
;
import
com.glsx.smart.pojo.request.SmartCarKeyCommandRequest
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -30,4 +31,6 @@ public interface SmartKeyCommandLogMapper {
...
@@ -30,4 +31,6 @@ public interface SmartKeyCommandLogMapper {
int
updateByPrimaryKeySelective
(
SmartKeyCommandLog
record
);
int
updateByPrimaryKeySelective
(
SmartKeyCommandLog
record
);
int
updateByPrimaryKey
(
SmartKeyCommandLog
record
);
int
updateByPrimaryKey
(
SmartKeyCommandLog
record
);
int
insertBatch
(
@Param
(
"lockingkeyActLogList"
)
List
<
SmartCarKeyCommandRequest
>
lockingkeyActLogList
);
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/com/glsx/smart/dao/mapper/SmartKeyCommandShareLogMapper.java
View file @
7c1d0ee
...
@@ -2,6 +2,7 @@ package com.glsx.smart.dao.mapper;
...
@@ -2,6 +2,7 @@ package com.glsx.smart.dao.mapper;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLogExample
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLogExample
;
import
com.glsx.smart.pojo.request.SmartCarKeyShareLogRequest
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -60,4 +61,6 @@ public interface SmartKeyCommandShareLogMapper {
...
@@ -60,4 +61,6 @@ public interface SmartKeyCommandShareLogMapper {
* @return update count
* @return update count
*/
*/
int
updateByPrimaryKey
(
SmartKeyCommandShareLog
record
);
int
updateByPrimaryKey
(
SmartKeyCommandShareLog
record
);
int
insertBatch
(
@Param
(
"lockingkeyActLogList"
)
List
<
SmartCarKeyShareLogRequest
>
lockingkeyActLogList
);
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/com/glsx/smart/pojo/request/SmartCarKeyActionLogBatchRequest.java
0 → 100644
View file @
7c1d0ee
package
com
.
glsx
.
smart
.
pojo
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author fengzhi
* @version 1.0.0
* @ClassName LockingkeyShareIdRequest.java
* @description: 分享的数字钥匙操作
* @createTime 2021年05月02日 09:59:00
*/
@Data
public
class
SmartCarKeyActionLogBatchRequest
{
/**
* 批量上报的日志
*/
@NotBlank
private
String
actLogList
;
@NotBlank
private
String
userId
;
}
src/main/java/com/glsx/smart/pojo/request/SmartCarKeyShareActionLogBatchRequest.java
0 → 100644
View file @
7c1d0ee
package
com
.
glsx
.
smart
.
pojo
.
request
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* @author fengzhi
* @version 1.0.0
* @ClassName LockingkeyShareIdRequest.java
* @description: 分享的数字钥匙操作
* @createTime 2021年05月02日 09:59:00
*/
@Data
public
class
SmartCarKeyShareActionLogBatchRequest
{
/**
* 批量上报的日志
*/
@NotBlank
private
String
actLogList
;
}
src/main/java/com/glsx/smart/service/AiLockingKeyService.java
View file @
7c1d0ee
...
@@ -53,4 +53,6 @@ public interface AiLockingKeyService {
...
@@ -53,4 +53,6 @@ public interface AiLockingKeyService {
R
getShareToken
(
SmartCarKeyTokenRequest
request
);
R
getShareToken
(
SmartCarKeyTokenRequest
request
);
R
getShareKeyList
(
SmartShareCarKeyPageRequest
request
);
R
getShareKeyList
(
SmartShareCarKeyPageRequest
request
);
R
batchLogCommand
(
SmartCarKeyActionLogBatchRequest
request
);
}
}
src/main/java/com/glsx/smart/service/AiLockingKeyShareService.java
View file @
7c1d0ee
package
com
.
glsx
.
smart
.
service
;
package
com
.
glsx
.
smart
.
service
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.pojo.request.SmartCarKeyReceiveRequest
;
import
com.glsx.smart.pojo.request.*
;
import
com.glsx.smart.pojo.request.SmartCarKeyShareLogRequest
;
import
com.glsx.smart.pojo.request.SmartShareKeyEditReq
;
public
interface
AiLockingKeyShareService
{
public
interface
AiLockingKeyShareService
{
...
@@ -20,4 +18,6 @@ public interface AiLockingKeyShareService {
...
@@ -20,4 +18,6 @@ public interface AiLockingKeyShareService {
R
isTokenValid
(
String
token
);
R
isTokenValid
(
String
token
);
R
getShareKeyListByUser
(
Long
userId
);
R
getShareKeyListByUser
(
Long
userId
);
R
batchLogCommand
(
SmartCarKeyShareActionLogBatchRequest
request
);
}
}
src/main/java/com/glsx/smart/service/SmartKeyCommandLogService.java
View file @
7c1d0ee
...
@@ -2,6 +2,7 @@ package com.glsx.smart.service;
...
@@ -2,6 +2,7 @@ package com.glsx.smart.service;
import
com.glsx.smart.dao.entity.SmartKeyCommandLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLogExample
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLogExample
;
import
com.glsx.smart.pojo.request.SmartCarKeyCommandRequest
;
import
java.util.List
;
import
java.util.List
;
...
@@ -30,6 +31,7 @@ public interface SmartKeyCommandLogService {
...
@@ -30,6 +31,7 @@ public interface SmartKeyCommandLogService {
int
updateByPrimaryKey
(
SmartKeyCommandLog
record
);
int
updateByPrimaryKey
(
SmartKeyCommandLog
record
);
int
insertBatch
(
List
<
SmartCarKeyCommandRequest
>
lockingkeyActLogList
);
}
}
...
...
src/main/java/com/glsx/smart/service/SmartKeyCommandShareLogService.java
View file @
7c1d0ee
...
@@ -2,6 +2,7 @@ package com.glsx.smart.service;
...
@@ -2,6 +2,7 @@ package com.glsx.smart.service;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLogExample
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLogExample
;
import
com.glsx.smart.pojo.request.SmartCarKeyShareLogRequest
;
import
java.util.List
;
import
java.util.List
;
public
interface
SmartKeyCommandShareLogService
{
public
interface
SmartKeyCommandShareLogService
{
...
@@ -29,4 +30,5 @@ public interface SmartKeyCommandShareLogService{
...
@@ -29,4 +30,5 @@ public interface SmartKeyCommandShareLogService{
int
updateByPrimaryKey
(
SmartKeyCommandShareLog
record
);
int
updateByPrimaryKey
(
SmartKeyCommandShareLog
record
);
int
insertBatch
(
List
<
SmartCarKeyShareLogRequest
>
lockingkeyActLogList
);
}
}
src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
View file @
7c1d0ee
package
com
.
glsx
.
smart
.
service
.
impl
;
package
com
.
glsx
.
smart
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.alibaba.nacos.common.utils.StringUtils
;
import
com.alibaba.nacos.common.utils.StringUtils
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
...
@@ -184,6 +185,25 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
...
@@ -184,6 +185,25 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
return
R
.
ok
();
return
R
.
ok
();
}
}
//车钥匙操作指令批量上报
@Override
public
R
batchLogCommand
(
SmartCarKeyActionLogBatchRequest
request
)
{
String
userId
=
request
.
getUserId
();
String
actLogList
=
request
.
getActLogList
();
List
<
SmartCarKeyCommandRequest
>
lockingkeyActLogList
=
JSONArray
.
parseArray
(
actLogList
,
SmartCarKeyCommandRequest
.
class
);
if
(
CollectionUtils
.
isEmpty
(
lockingkeyActLogList
))
{
return
R
.
ok
();
}
lockingkeyActLogList
.
stream
().
forEach
(
key
->
key
.
setUserId
(
userId
));
int
count
=
smartKeyCommandLogService
.
insertBatch
(
lockingkeyActLogList
);
return
R
.
ok
().
data
(
count
);
}
//车钥匙修改昵称
//车钥匙修改昵称
@Override
@Override
public
R
setLockingKeyName
(
SmartCarKeyNameRequest
request
)
{
public
R
setLockingKeyName
(
SmartCarKeyNameRequest
request
)
{
...
@@ -707,4 +727,6 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
...
@@ -707,4 +727,6 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
return
R
.
ok
().
data
(
PageInfo
.
of
(
shareKeyList
));
return
R
.
ok
().
data
(
PageInfo
.
of
(
shareKeyList
));
}
}
}
}
src/main/java/com/glsx/smart/service/impl/AiLockingKeyShareServiceImpl.java
View file @
7c1d0ee
package
com
.
glsx
.
smart
.
service
.
impl
;
package
com
.
glsx
.
smart
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.nacos.common.utils.StringUtils
;
import
com.alibaba.nacos.common.utils.StringUtils
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
...
@@ -8,9 +9,7 @@ import com.glsx.plat.core.web.R;
...
@@ -8,9 +9,7 @@ import com.glsx.plat.core.web.R;
import
com.glsx.smart.dao.entity.*
;
import
com.glsx.smart.dao.entity.*
;
import
com.glsx.smart.exception.BusinessException
;
import
com.glsx.smart.exception.BusinessException
;
import
com.glsx.smart.exception.ResultEnum
;
import
com.glsx.smart.exception.ResultEnum
;
import
com.glsx.smart.pojo.request.SmartCarKeyReceiveRequest
;
import
com.glsx.smart.pojo.request.*
;
import
com.glsx.smart.pojo.request.SmartCarKeyShareLogRequest
;
import
com.glsx.smart.pojo.request.SmartShareKeyEditReq
;
import
com.glsx.smart.redis.RedisService
;
import
com.glsx.smart.redis.RedisService
;
import
com.glsx.smart.service.AiLockingKeyShareService
;
import
com.glsx.smart.service.AiLockingKeyShareService
;
import
com.glsx.smart.service.SmartKeyCommandShareLogService
;
import
com.glsx.smart.service.SmartKeyCommandShareLogService
;
...
@@ -169,6 +168,21 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
...
@@ -169,6 +168,21 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
return
R
.
ok
();
return
R
.
ok
();
}
}
//分享钥匙操作日志批量上报
@Override
public
R
batchLogCommand
(
SmartCarKeyShareActionLogBatchRequest
request
)
{
String
actLogList
=
request
.
getActLogList
();
List
<
SmartCarKeyShareLogRequest
>
lockingkeyActLogList
=
JSONArray
.
parseArray
(
actLogList
,
SmartCarKeyShareLogRequest
.
class
);
if
(
CollectionUtils
.
isEmpty
(
lockingkeyActLogList
))
{
return
R
.
ok
().
data
(
0
);
}
int
count
=
shareLogService
.
insertBatch
(
lockingkeyActLogList
);
return
R
.
ok
().
data
(
count
);
}
//删除共享钥匙
//删除共享钥匙
@Override
@Override
...
...
src/main/java/com/glsx/smart/service/impl/SmartKeyCommandLogServiceImpl.java
View file @
7c1d0ee
...
@@ -3,6 +3,7 @@ package com.glsx.smart.service.impl;
...
@@ -3,6 +3,7 @@ package com.glsx.smart.service.impl;
import
com.glsx.smart.dao.entity.SmartKeyCommandLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLogExample
;
import
com.glsx.smart.dao.entity.SmartKeyCommandLogExample
;
import
com.glsx.smart.dao.mapper.SmartKeyCommandLogMapper
;
import
com.glsx.smart.dao.mapper.SmartKeyCommandLogMapper
;
import
com.glsx.smart.pojo.request.SmartCarKeyCommandRequest
;
import
com.glsx.smart.service.SmartKeyCommandLogService
;
import
com.glsx.smart.service.SmartKeyCommandLogService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -70,6 +71,11 @@ public class SmartKeyCommandLogServiceImpl implements SmartKeyCommandLogService
...
@@ -70,6 +71,11 @@ public class SmartKeyCommandLogServiceImpl implements SmartKeyCommandLogService
return
smartKeyCommandLogMapper
.
updateByPrimaryKey
(
record
);
return
smartKeyCommandLogMapper
.
updateByPrimaryKey
(
record
);
}
}
@Override
public
int
insertBatch
(
List
<
SmartCarKeyCommandRequest
>
lockingkeyActLogList
)
{
return
smartKeyCommandLogMapper
.
insertBatch
(
lockingkeyActLogList
);
}
}
}
...
...
src/main/java/com/glsx/smart/service/impl/SmartKeyCommandShareLogServiceImpl.java
View file @
7c1d0ee
...
@@ -3,6 +3,7 @@ package com.glsx.smart.service.impl;
...
@@ -3,6 +3,7 @@ package com.glsx.smart.service.impl;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLog
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLogExample
;
import
com.glsx.smart.dao.entity.SmartKeyCommandShareLogExample
;
import
com.glsx.smart.dao.mapper.SmartKeyCommandShareLogMapper
;
import
com.glsx.smart.dao.mapper.SmartKeyCommandShareLogMapper
;
import
com.glsx.smart.pojo.request.SmartCarKeyShareLogRequest
;
import
com.glsx.smart.service.SmartKeyCommandShareLogService
;
import
com.glsx.smart.service.SmartKeyCommandShareLogService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -69,4 +70,9 @@ public class SmartKeyCommandShareLogServiceImpl implements SmartKeyCommandShareL
...
@@ -69,4 +70,9 @@ public class SmartKeyCommandShareLogServiceImpl implements SmartKeyCommandShareL
return
smartKeyCommandShareLogMapper
.
updateByPrimaryKey
(
record
);
return
smartKeyCommandShareLogMapper
.
updateByPrimaryKey
(
record
);
}
}
@Override
public
int
insertBatch
(
List
<
SmartCarKeyShareLogRequest
>
lockingkeyActLogList
)
{
return
smartKeyCommandShareLogMapper
.
insertBatch
(
lockingkeyActLogList
);
}
}
}
src/main/resources/mapper/SmartKeyCommandLogMapper.xml
View file @
7c1d0ee
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/SmartKeyCommandShareLogMapper.xml
View file @
7c1d0ee
...
@@ -203,4 +203,12 @@
...
@@ -203,4 +203,12 @@
create_time = #{createTime,jdbcType=TIMESTAMP}
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</update>
<insert
id=
"insertBatch"
parameterType=
"com.glsx.smart.pojo.request.SmartCarKeyShareLogRequest"
>
INSERT INTO `smart_key_command_share_log` (`share_car_key_id`, `key_command`, `create_time`)
VALUES
<foreach
collection=
"lockingkeyActLogList"
item=
"keyActLog"
separator=
","
>
(#{keyActLog.shareKeyId,jdbcType=BIGINT},#{keyActLog.keyCommand,jdbcType=VARCHAR},#{keyActLog.createTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
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