Commit 265647a2 by fz

代码整理规范

1.优化车钥匙过期判断
1 parent d55cff92
Showing 27 changed files with 104 additions and 108 deletions
......@@ -3,7 +3,7 @@ package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.modules.entity.SmartKeyBlueSense;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueShareKey;
import cn.com.glsx.smart.modules.model.request.*;
import cn.com.glsx.smart.modules.model.response.SmartCarKeyResponse;
import cn.com.glsx.smart.modules.model.response.CarKeyResponse;
import cn.com.glsx.smart.modules.service.AiLockingKeyService;
import cn.com.glsx.smart.modules.service.AiLockingKeyShareService;
import com.github.pagehelper.PageInfo;
......@@ -37,7 +37,7 @@ public class AiLockingkeyController {
* 主车钥匙修改分享状态
*/
@PostMapping(value = "/setPrimaryShareStatus")
public R setPrimaryLockingKeyShareStatus(@RequestBody @Validated SmartKeyPrimaryShareEditReq request) {
public R setPrimaryLockingKeyShareStatus(@RequestBody @Validated KeyPrimaryShareEditReq request) {
aiLockingKeyService.setPrimaryLockingKeyShareStatus(request);
return R.ok();
}
......@@ -68,7 +68,7 @@ public class AiLockingkeyController {
* 分享车钥匙设置修改分享状态
*/
@PostMapping(value = "/setShareStatus")
public R setShareLockingKeyShareStatus(@RequestBody @Validated SmartShareKeyDeleteRequest request) {
public R setShareLockingKeyShareStatus(@RequestBody @Validated ShareKeyDeleteRequest request) {
String stopTime = aiLockingKeyShareService.removeShareKey(request);
return R.ok().data(stopTime);
}
......@@ -80,7 +80,7 @@ public class AiLockingkeyController {
*/
@GetMapping(value = "/get")
public R getLockingKey(@RequestParam("userId")String userId,@RequestParam("sn")String sn) {
SmartCarKeyResponse response = aiLockingKeyService.getLockingKey(userId,sn);
CarKeyResponse response = aiLockingKeyService.getLockingKey(userId,sn);
return R.ok().data(response);
}
......@@ -98,7 +98,7 @@ public class AiLockingkeyController {
*/
@GetMapping(value = "/user/getAll")
public R getAllKeyByUser(@RequestParam("userId")String userId) {
List<SmartCarKeyResponse> smartCarKeyResponses = aiLockingKeyService.getAllKeyByUser(userId);
List<CarKeyResponse> smartCarKeyResponses = aiLockingKeyService.getAllKeyByUser(userId);
return R.ok().data(smartCarKeyResponses);
}
......@@ -106,7 +106,7 @@ public class AiLockingkeyController {
* 智能车钥匙解绑
*/
@PostMapping(value = "/remove")
public R removeLockingKey(@RequestBody @Validated SmartCarKeyRequest request) {
public R removeLockingKey(@RequestBody @Validated CarKeyRequest request) {
aiLockingKeyService.removeLockingKey(request);
return R.ok();
}
......@@ -115,7 +115,7 @@ public class AiLockingkeyController {
* 智能车钥匙注册成功后的数据保存
*/
@PostMapping(value = "/saveRegisterInfo")
public R saveLockingKeyRegisterInfo(@RequestBody @Validated SmartCarKeyRegisterRequest request) {
public R saveLockingKeyRegisterInfo(@RequestBody @Validated CarKeyRegisterRequest request) {
aiLockingKeyService.saveLockingKeyRegisterInfo(request);
return R.ok();
}
......@@ -124,7 +124,7 @@ public class AiLockingkeyController {
* 根据userid注销钥匙
*/
@PostMapping(value = "/removeKeysByUser")
public R removeKeysByUser(@RequestBody @Validated SmartCarKeyUserRequest request) {
public R removeKeysByUser(@RequestBody @Validated CarKeyUserRequest request) {
int count = aiLockingKeyService.removeKeysByUser(request);
return R.ok().data(count);
}
......@@ -133,7 +133,7 @@ public class AiLockingkeyController {
* 车钥匙操作指令上报
*/
@PostMapping(value = "/logCommand")
public R LogLockingKeyCommand(@RequestBody @Validated SmartCarKeyCommandRequest request) {
public R LogLockingKeyCommand(@RequestBody @Validated CarKeyCommandRequest request) {
aiLockingKeyService.LogLockingKeyCommand(request);
return R.ok();
}
......@@ -142,7 +142,7 @@ public class AiLockingkeyController {
* 车钥匙操作指令批量上报
*/
@PostMapping(value = "/batchLogCommand")
public R batchLogCommand(@RequestBody @Validated SmartCarKeyActionLogBatchRequest request) {
public R batchLogCommand(@RequestBody @Validated CarKeyActionLogBatchRequest request) {
int count = aiLockingKeyService.batchLogCommand(request);
return R.ok().data(count);
}
......@@ -151,7 +151,7 @@ public class AiLockingkeyController {
* 车钥匙修改昵称
*/
@PostMapping(value = "/setName")
public R setLockingKeyName(@RequestBody @Validated SmartCarKeyNameRequest request) {
public R setLockingKeyName(@RequestBody @Validated CarKeyNameRequest request) {
aiLockingKeyService.setLockingKeyName(request);
return R.ok();
}
......@@ -160,7 +160,7 @@ public class AiLockingkeyController {
* 车钥匙修改自动感应
*/
@PostMapping(value = "/setAutoSense")
public R setLockingKeyAutoSense(@RequestBody @Validated SmartCarKeyAutoSenseRequest request) {
public R setLockingKeyAutoSense(@RequestBody @Validated CarKeyAutoSenseRequest request) {
aiLockingKeyService.setLockingKeyAutoSense(request);
return R.ok();
}
......
package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.modules.entity.SmartShareKeyBlueKey;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyReceiveRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareActionLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.SmartShareKeyDeleteRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyReceiveRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.ShareKeyDeleteRequest;
import cn.com.glsx.smart.modules.service.AiLockingKeyShareService;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
......@@ -59,7 +59,7 @@ public class AiLockingkeyShareController {
* 领取钥匙接口
*/
@PostMapping(value = "/receive")
public R receiveKey(@RequestBody @Validated SmartCarKeyReceiveRequest request) {
public R receiveKey(@RequestBody @Validated CarKeyReceiveRequest request) {
aiLockingKeyShareService.receiveKey(request);
return R.ok("钥匙领用成功");
}
......@@ -68,7 +68,7 @@ public class AiLockingkeyShareController {
* 分享钥匙的操作日志
*/
@PostMapping(value = "/logCommand")
public R logShareLockingKeyCommand(@RequestBody @Validated SmartCarKeyShareLogRequest request) {
public R logShareLockingKeyCommand(@RequestBody @Validated CarKeyShareLogRequest request) {
aiLockingKeyShareService.logShareLockingKeyCommand(request);
return R.ok();
}
......@@ -77,7 +77,7 @@ public class AiLockingkeyShareController {
* 车钥匙操作指令批量上报
*/
@PostMapping(value = "/batchLogCommand")
public R batchLogCommand(@RequestBody @Validated SmartCarKeyShareActionLogBatchRequest request) {
public R batchLogCommand(@RequestBody @Validated CarKeyShareLogBatchRequest request) {
int count = aiLockingKeyShareService.batchLogCommand(request);
return R.ok().data(count);
}
......@@ -95,7 +95,7 @@ public class AiLockingkeyShareController {
* 删除共享钥匙
*/
@PostMapping(value = "/removeShareKey")
public R removeShareKey(@RequestBody @Validated SmartShareKeyDeleteRequest request) {
public R removeShareKey(@RequestBody @Validated ShareKeyDeleteRequest request) {
String removeTime = aiLockingKeyShareService.removeShareKey(request);
return R.ok().data(removeTime);
}
......
......@@ -2,7 +2,7 @@ package cn.com.glsx.smart.modules.mapper;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLog;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLogExample;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyCommandRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyCommandRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -32,5 +32,5 @@ public interface SmartKeyCommandLogMapper {
int updateByPrimaryKey(SmartKeyCommandLog record);
int insertBatch(@Param("lockingkeyActLogList") List<SmartCarKeyCommandRequest> lockingkeyActLogList);
int insertBatch(@Param("lockingkeyActLogList") List<CarKeyCommandRequest> lockingkeyActLogList);
}
\ No newline at end of file
......@@ -2,7 +2,7 @@ package cn.com.glsx.smart.modules.mapper;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandShareLog;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandShareLogExample;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -62,5 +62,5 @@ public interface SmartKeyCommandShareLogMapper {
*/
int updateByPrimaryKey(SmartKeyCommandShareLog record);
int insertBatch(@Param("lockingkeyActLogList") List<SmartCarKeyShareLogRequest> lockingkeyActLogList);
int insertBatch(@Param("lockingkeyActLogList") List<CarKeyShareLogRequest> lockingkeyActLogList);
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank;
* @createTime 2021年05月02日 09:59:00
*/
@Data
public class SmartCarKeyActionLogBatchRequest extends SmartCarKeyUserRequest{
public class CarKeyActionLogBatchRequest extends CarKeyUserRequest {
/**
* 批量上报的日志
*/
......
......@@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
* 智能车钥匙,自动感应状态
*/
@Data
public class SmartCarKeyAutoSenseRequest extends SmartCarKeyRequest{
public class CarKeyAutoSenseRequest extends CarKeyRequest {
/**
* 智能车钥匙自动感应状态 0:关 1:近 2:中 3:远'
*/
......
......@@ -3,6 +3,7 @@ package cn.com.glsx.smart.modules.model.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
......@@ -11,7 +12,7 @@ import java.util.Date;
* 智能车钥匙,指令上报
*/
@Data
public class SmartCarKeyCommandRequest extends SmartCarKeyUserRequest{
public class CarKeyCommandRequest extends CarKeyUserRequest {
/**
* 平台生成的唯一CREP信息
*/
......
......@@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
* 智能车钥匙,昵称
*/
@Data
public class SmartCarKeyNameRequest extends SmartCarKeyRequest{
public class CarKeyNameRequest extends CarKeyRequest {
/**
* 钥匙昵称
*/
......
......@@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
* 智能车钥匙领取
*/
@Data
public class SmartCarKeyReceiveRequest extends SmartCarKeyUserRequest{
public class CarKeyReceiveRequest extends CarKeyUserRequest {
/**
* token令牌
*/
......
......@@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
* 智能车钥匙,注册信息保存
*/
@Data
public class SmartCarKeyRegisterRequest extends SmartCarKeyUserRequest{
public class CarKeyRegisterRequest extends CarKeyUserRequest {
/**
* 手机蓝牙的MAC地址
*/
......
......@@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
* 智能车钥匙,查询车钥匙和生成crep接口
*/
@Data
public class SmartCarKeyRequest extends SmartCarKeyUserRequest{
public class CarKeyRequest extends CarKeyUserRequest {
/**
* 设备号
*/
......
......@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank;
* @createTime 2021年05月02日 09:59:00
*/
@Data
public class SmartCarKeyShareActionLogBatchRequest {
public class CarKeyShareLogBatchRequest {
/**
* 批量上报的日志
*/
......
......@@ -9,7 +9,7 @@ import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class SmartCarKeyShareLogRequest {
public class CarKeyShareLogRequest {
/**
* 指令代码
* 1、开锁;2、关锁;3、开尾门;4、寻车;5、自动感应近;
......
package cn.com.glsx.smart.modules.model.request;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 智能车钥匙,指令上报
*/
@Data
public class SmartCarKeyUserRequest {
public class CarKeyUserRequest {
/**
* 用户id
*/
......
package cn.com.glsx.smart.modules.model.request;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 车钥匙修改分享状态接口
*/
@Data
public class SmartKeyPrimaryShareEditReq extends SmartCarKeyRequest{
public class KeyPrimaryShareEditReq extends CarKeyRequest {
/**
* 分享状态 0:关闭 1:打开
* 默认打开
......
package cn.com.glsx.smart.modules.model.request;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 智能车钥匙,解绑车钥匙接口
*/
@Data
public class SmartShareKeyDeleteRequest {
public class ShareKeyDeleteRequest {
/**
* 分享钥匙主键id
*/
......
......@@ -8,7 +8,7 @@ import java.io.Serializable;
import java.util.Date;
@Data
public class SmartCarKeyResponse implements Serializable {
public class CarKeyResponse implements Serializable {
private Long id;
/**
* 用户ID
......
......@@ -3,7 +3,7 @@ package cn.com.glsx.smart.modules.service;
import cn.com.glsx.smart.modules.entity.SmartKeyBlueSense;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueShareKey;
import cn.com.glsx.smart.modules.model.request.*;
import cn.com.glsx.smart.modules.model.response.SmartCarKeyResponse;
import cn.com.glsx.smart.modules.model.response.CarKeyResponse;
import com.github.pagehelper.PageInfo;
import java.util.List;
......@@ -19,43 +19,43 @@ public interface AiLockingKeyService {
/**
* 通过sn获取车钥匙
*/
SmartCarKeyResponse getLockingKey(String userId,String sn);
CarKeyResponse getLockingKey(String userId, String sn);
/**
* 通过sn解绑车钥匙
*/
void removeLockingKey(SmartCarKeyRequest request);
void removeLockingKey(CarKeyRequest request);
/**
* 车钥匙注册信息保存
*/
void saveLockingKeyRegisterInfo(SmartCarKeyRegisterRequest registerSaveRequest);
void saveLockingKeyRegisterInfo(CarKeyRegisterRequest registerSaveRequest);
/**
* 车钥匙指令上报
*/
void LogLockingKeyCommand(SmartCarKeyCommandRequest carKeyCommandRequest);
void LogLockingKeyCommand(CarKeyCommandRequest carKeyCommandRequest);
/**
* 修改车钥匙昵称
*/
void setLockingKeyName(SmartCarKeyNameRequest name);
void setLockingKeyName(CarKeyNameRequest name);
/**
* 修改车钥匙自动感应状态
*/
void setLockingKeyAutoSense(SmartCarKeyAutoSenseRequest autoSenseStatus);
void setLockingKeyAutoSense(CarKeyAutoSenseRequest autoSenseStatus);
List<SmartCarKeyResponse> getAllKeyByUser(String request);
List<CarKeyResponse> getAllKeyByUser(String request);
List<SmartKeyBlueSense> getMobileBlueMac(String userId,String sn);
int removeKeysByUser(SmartCarKeyUserRequest request);
int removeKeysByUser(CarKeyUserRequest request);
void setPrimaryLockingKeyShareStatus(SmartKeyPrimaryShareEditReq request);
void setPrimaryLockingKeyShareStatus(KeyPrimaryShareEditReq request);
int batchLogCommand(SmartCarKeyActionLogBatchRequest request);
int batchLogCommand(CarKeyActionLogBatchRequest request);
String getShareToken(String userId, String sn, String expireTime);
......
package cn.com.glsx.smart.modules.service;
import cn.com.glsx.smart.modules.entity.SmartShareKeyBlueKey;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyReceiveRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareActionLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.SmartShareKeyDeleteRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyReceiveRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.ShareKeyDeleteRequest;
import java.util.List;
import java.util.Map;
......@@ -13,11 +13,11 @@ public interface AiLockingKeyShareService {
Map<String, Object> getShareKeyByToken(String token);
void receiveKey(SmartCarKeyReceiveRequest request);
void receiveKey(CarKeyReceiveRequest request);
void logShareLockingKeyCommand(SmartCarKeyShareLogRequest request);
void logShareLockingKeyCommand(CarKeyShareLogRequest request);
String removeShareKey(SmartShareKeyDeleteRequest request);
String removeShareKey(ShareKeyDeleteRequest request);
SmartShareKeyBlueKey getShareLockingKey(String keyId);
......@@ -25,5 +25,5 @@ public interface AiLockingKeyShareService {
List<SmartShareKeyBlueKey> getShareKeyListByUser(Long userId);
int batchLogCommand(SmartCarKeyShareActionLogBatchRequest request);
int batchLogCommand(CarKeyShareLogBatchRequest request);
}
......@@ -2,7 +2,7 @@ package cn.com.glsx.smart.modules.service;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLog;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLogExample;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyCommandRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyCommandRequest;
import java.util.List;
......@@ -31,7 +31,7 @@ public interface SmartKeyCommandLogService {
int updateByPrimaryKey(SmartKeyCommandLog record);
int insertBatch(List<SmartCarKeyCommandRequest> lockingkeyActLogList);
int insertBatch(List<CarKeyCommandRequest> lockingkeyActLogList);
}
......
......@@ -2,7 +2,7 @@ package cn.com.glsx.smart.modules.service;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandShareLog;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandShareLogExample;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest;
import java.util.List;
......@@ -31,5 +31,5 @@ public interface SmartKeyCommandShareLogService{
int updateByPrimaryKey(SmartKeyCommandShareLog record);
int insertBatch(List<SmartCarKeyShareLogRequest> lockingkeyActLogList);
int insertBatch(List<CarKeyShareLogRequest> lockingkeyActLogList);
}
......@@ -7,7 +7,7 @@ import cn.com.glsx.smart.common.utils.JwtUtil;
import cn.com.glsx.smart.common.utils.SnowflakeWorker;
import cn.com.glsx.smart.modules.entity.*;
import cn.com.glsx.smart.modules.model.request.*;
import cn.com.glsx.smart.modules.model.response.SmartCarKeyResponse;
import cn.com.glsx.smart.modules.model.response.CarKeyResponse;
import cn.com.glsx.smart.modules.service.*;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
......@@ -33,7 +33,6 @@ import java.util.stream.Collectors;
* @author fengzhi
* @date 2021-04-19
*/
//TODO R.Error处理
@Service
@Slf4j
public class AiLockingKeyServiceImpl implements AiLockingKeyService {
......@@ -63,8 +62,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
*/
@Override
public SmartCarKeyResponse getLockingKey(String userId,String sn) {
SmartCarKeyResponse response = new SmartCarKeyResponse();
public CarKeyResponse getLockingKey(String userId, String sn) {
CarKeyResponse response = new CarKeyResponse();
//根据sn查询车钥匙
SmartVehicleBlueKey carkey = smartVehicleBlueKeyService.selectByUserAndSn(Long.valueOf(userId), sn);
......@@ -102,7 +101,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
* 智能车钥匙解绑
*/
@Override
public void removeLockingKey(SmartCarKeyRequest request) {
public void removeLockingKey(CarKeyRequest request) {
//根据userid,sn查询主钥匙
SmartVehicleBlueKey blueKey = smartVehicleBlueKeyService.selectByUserAndSnNotNull(request.getUserId(), request.getSn());
......@@ -118,7 +117,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
}
//private SmartVehicleBlueKey getCarKey(SmartCarKeyRequest request) {
//private SmartVehicleBlueKey getCarKey(CarKeyRequest request) {
// SmartVehicleBlueKeyExample example = smartVehicleBlueKeyService.getBlueKeyExampleByUserAndSn(Long.valueOf(request.getUserId()), request.getSn());
// List<SmartVehicleBlueKey> keyList = smartVehicleBlueKeyService.selectByExample(example);
//
......@@ -134,7 +133,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
* 根据userid注销
*/
@Override
public int removeKeysByUser(SmartCarKeyUserRequest request) {
public int removeKeysByUser(CarKeyUserRequest request) {
int count = 0;
long userId = request.getUserId();
......@@ -166,7 +165,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
* 车钥匙操作指令上报
*/
@Override
public void LogLockingKeyCommand(SmartCarKeyCommandRequest carKeyCommandRequest) {
public void LogLockingKeyCommand(CarKeyCommandRequest carKeyCommandRequest) {
SmartKeyCommandLog logData = new SmartKeyCommandLog();
logData.setUserId(Long.valueOf(carKeyCommandRequest.getUserId()));
String crep = aesEncryptUtils.decrypt(carKeyCommandRequest.getCrepCode());
......@@ -181,11 +180,11 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
* 车钥匙操作指令批量上报
*/
@Override
public int batchLogCommand(SmartCarKeyActionLogBatchRequest request) {
public int batchLogCommand(CarKeyActionLogBatchRequest request) {
long userId = request.getUserId();
String actLogList = request.getActLogList();
List<SmartCarKeyCommandRequest> lockingkeyActLogList = JSONArray.parseArray(actLogList, SmartCarKeyCommandRequest.class);
List<CarKeyCommandRequest> lockingkeyActLogList = JSONArray.parseArray(actLogList, CarKeyCommandRequest.class);
if (CollectionUtils.isEmpty(lockingkeyActLogList)) {
return 0;
}
......@@ -204,7 +203,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
* 车钥匙修改昵称
*/
@Override
public void setLockingKeyName(SmartCarKeyNameRequest request) {
public void setLockingKeyName(CarKeyNameRequest request) {
String keyName = request.getKeyName();
String sn = request.getSn();
......@@ -245,7 +244,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
* 车钥匙修改自动感应
*/
@Override
public void setLockingKeyAutoSense(SmartCarKeyAutoSenseRequest request) {
public void setLockingKeyAutoSense(CarKeyAutoSenseRequest request) {
long userId = request.getUserId();
String sn = request.getSn();
String mobileMac = request.getMobileMac();
......@@ -289,7 +288,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//根据用户ID查询车钥匙
@Override
public List<SmartCarKeyResponse> getAllKeyByUser(String userId) {
public List<CarKeyResponse> getAllKeyByUser(String userId) {
//根据用户id查询车钥匙
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria()
......@@ -303,8 +302,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
}
//转化为sn,完整车钥匙数据
Map<String, SmartCarKeyResponse> smartCarKeyResponseMap = keyList.stream().map(key -> {
SmartCarKeyResponse response = new SmartCarKeyResponse();
Map<String, CarKeyResponse> smartCarKeyResponseMap = keyList.stream().map(key -> {
CarKeyResponse response = new CarKeyResponse();
String crepCode = key.getCrepCode();
String secretKey_db = key.getSecretKey();
......@@ -316,12 +315,12 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
response.setCrepCode(arr[0]);
response.setSecretKey(arr[1]);
return response;
}).collect(Collectors.toMap(SmartCarKeyResponse::getSn, item -> item));
}).collect(Collectors.toMap(CarKeyResponse::getSn, item -> item));
List<SmartCarKeyResponse> responseList = new ArrayList<>(smartCarKeyResponseMap.values());
List<CarKeyResponse> responseList = new ArrayList<>(smartCarKeyResponseMap.values());
List<SmartCarKeyResponse> validList = new ArrayList();
List<CarKeyResponse> validList = new ArrayList();
//根据用户钥匙id,查询蓝牙,感应列表
List<Long> carKeyIds = keyList.stream().map(SmartVehicleBlueKey::getId).collect(Collectors.toList());
......@@ -382,7 +381,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//智能车钥匙注册成功后的数据保存
@Override
public void saveLockingKeyRegisterInfo(SmartCarKeyRegisterRequest request) {
public void saveLockingKeyRegisterInfo(CarKeyRegisterRequest request) {
String crepCode = request.getCrepCode();
String secretKey = request.getSecretKey();
//解密
......@@ -447,7 +446,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
smartVehicleBlueKeyService.updateByPrimaryKeySelective(smartVehicleBlueKey);
}
private void insertCarKey(String userId_str,String sn, SmartCarKeyResponse response, String crep) {
private void insertCarKey(String userId_str, String sn, CarKeyResponse response, String crep) {
long userId = Long.parseLong(userId_str);
long count = smartVehicleBlueKeyService.countKeyByUser(userId);
......@@ -482,7 +481,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
BeanUtils.copyProperties(newKey, response);
}
private void buildCarKeyData(SmartCarKeyResponse response, SmartVehicleBlueKey carkey, String crepCode) {
private void buildCarKeyData(CarKeyResponse response, SmartVehicleBlueKey carkey, String crepCode) {
//将数据库密钥解密成明文
String secretKey_db = carkey.getSecretKey();
......@@ -537,7 +536,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//主车钥匙修改分享状态
@Override
public void setPrimaryLockingKeyShareStatus(SmartKeyPrimaryShareEditReq request) {
public void setPrimaryLockingKeyShareStatus(KeyPrimaryShareEditReq request) {
Integer shareStatus = request.getShareStatus();
SmartVehicleBlueKey smartVehicleBlueKey = smartVehicleBlueKeyService.selectByUserAndSnNotNull(Long.valueOf(request.getUserId()), request.getSn());
......
......@@ -6,16 +6,17 @@ import cn.com.glsx.smart.common.redis.RedisService;
import cn.com.glsx.smart.common.utils.AesEncryptUtils;
import cn.com.glsx.smart.common.utils.JwtUtil;
import cn.com.glsx.smart.modules.entity.*;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyReceiveRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareActionLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.SmartShareKeyDeleteRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyReceiveRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.ShareKeyDeleteRequest;
import cn.com.glsx.smart.modules.service.AiLockingKeyShareService;
import cn.com.glsx.smart.modules.service.SmartKeyCommandShareLogService;
import cn.com.glsx.smart.modules.service.SmartVehicleBlueKeyService;
import cn.com.glsx.smart.modules.service.SmartVehicleBlueShareKeyService;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.glsx.cloudframework.core.util.DateFormatUtil;
import com.glsx.plat.common.utils.StringUtils;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
......@@ -24,7 +25,6 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -56,8 +56,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
@Autowired
private AesEncryptUtils aesEncryptUtils;
//TODO R.Error处理
/**
* 通过令牌获取领取信息
*/
......@@ -104,7 +102,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
* 领取钥匙接口
*/
@Override
public void receiveKey(SmartCarKeyReceiveRequest request) {
public void receiveKey(CarKeyReceiveRequest request) {
Long userId = request.getUserId();
String token = request.getToken();
......@@ -135,7 +133,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
* 分享钥匙的操作日志
*/
@Override
public void logShareLockingKeyCommand(SmartCarKeyShareLogRequest request) {
public void logShareLockingKeyCommand(CarKeyShareLogRequest request) {
long keyId = request.getShareKeyId();
String command = request.getKeyCommand();
SmartKeyCommandShareLog logData = new SmartKeyCommandShareLog();
......@@ -149,10 +147,10 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
* 分享钥匙操作日志批量上报
*/
@Override
public int batchLogCommand(SmartCarKeyShareActionLogBatchRequest request) {
public int batchLogCommand(CarKeyShareLogBatchRequest request) {
String actLogList = request.getActLogList();
int count = 0;
List<SmartCarKeyShareLogRequest> lockingkeyActLogList = JSONArray.parseArray(actLogList, SmartCarKeyShareLogRequest.class);
List<CarKeyShareLogRequest> lockingkeyActLogList = JSONArray.parseArray(actLogList, CarKeyShareLogRequest.class);
if (CollectionUtils.isEmpty(lockingkeyActLogList)) {
return count;
}
......@@ -167,7 +165,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
* 删除共享钥匙,返回删除的时间
*/
@Override
public String removeShareKey(SmartShareKeyDeleteRequest request) {
public String removeShareKey(ShareKeyDeleteRequest request) {
SmartVehicleBlueShareKey blueKey = new SmartVehicleBlueShareKey();
//分享状态关闭
blueKey.setShareStatus(0);
......@@ -264,16 +262,11 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
SmartVehicleBlueShareKey shareKey = shareKeyService.selectByPrimaryKey(keyShareID);
Date expireDate = shareKey.getExpireTime();
Date nowDate;
try {
nowDate = sdf.parse(nowTime);
} catch (ParseException e) {
e.printStackTrace();
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_DATE_FORMATE);
}
if (nowDate.after(expireDate)) {
Date dateNow = DateFormatUtil.toDate(DateFormatUtil.nowString("yyyy-MM-dd"), "yyyy-MM-dd");
if (expireDate.before(dateNow)) {
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_DATE_EXPIRE);
}
......
......@@ -3,7 +3,7 @@ package cn.com.glsx.smart.modules.service.impl;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLog;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLogExample;
import cn.com.glsx.smart.modules.mapper.SmartKeyCommandLogMapper;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyCommandRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyCommandRequest;
import cn.com.glsx.smart.modules.service.SmartKeyCommandLogService;
import org.springframework.stereotype.Service;
......@@ -72,7 +72,7 @@ public class SmartKeyCommandLogServiceImpl implements SmartKeyCommandLogService
}
@Override
public int insertBatch(List<SmartCarKeyCommandRequest> lockingkeyActLogList) {
public int insertBatch(List<CarKeyCommandRequest> lockingkeyActLogList) {
return smartKeyCommandLogMapper.insertBatch(lockingkeyActLogList);
}
......
......@@ -3,7 +3,7 @@ package cn.com.glsx.smart.modules.service.impl;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandShareLog;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandShareLogExample;
import cn.com.glsx.smart.modules.mapper.SmartKeyCommandShareLogMapper;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest;
import cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest;
import cn.com.glsx.smart.modules.service.SmartKeyCommandShareLogService;
import org.springframework.stereotype.Service;
......@@ -72,7 +72,7 @@ public class SmartKeyCommandShareLogServiceImpl implements SmartKeyCommandShareL
}
@Override
public int insertBatch(List<SmartCarKeyShareLogRequest> lockingkeyActLogList) {
public int insertBatch(List<CarKeyShareLogRequest> lockingkeyActLogList) {
return smartKeyCommandShareLogMapper.insertBatch(lockingkeyActLogList);
}
......
......@@ -270,7 +270,7 @@
</update>
<insert id="insertBatch" parameterType="cn.com.glsx.smart.modules.model.request.SmartCarKeyCommandRequest">
<insert id="insertBatch" parameterType="cn.com.glsx.smart.modules.model.request.CarKeyCommandRequest">
INSERT INTO `smart_key_command_log` (`user_id`, `crep_code`, `key_command`, `create_time`)
VALUES
<foreach collection="lockingkeyActLogList" item="keyActLog" separator=",">
......
......@@ -204,7 +204,7 @@
where id = #{id,jdbcType=BIGINT}
</update>
<insert id="insertBatch" parameterType="cn.com.glsx.smart.modules.model.request.SmartCarKeyShareLogRequest">
<insert id="insertBatch" parameterType="cn.com.glsx.smart.modules.model.request.CarKeyShareLogRequest">
INSERT INTO `smart_key_command_share_log` (`share_car_key_id`, `key_command`, `create_time`)
VALUES
<foreach collection="lockingkeyActLogList" item="keyActLog" separator=",">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!