Commit 7c1d0eeb by fz

1.添加主钥匙,分享钥匙批量上报指令日志接口

1 parent 0c1a6d49
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) {
......
...@@ -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) {
......
...@@ -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
...@@ -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
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;
}
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;
}
...@@ -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);
} }
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);
} }
...@@ -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);
} }
......
...@@ -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);
} }
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));
} }
} }
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
......
...@@ -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);
}
} }
......
...@@ -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);
}
} }
...@@ -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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!