Commit 077576df by fz

1.请求类参数统一string接收,再转类型

1 parent 6f65d44e
...@@ -8,9 +8,9 @@ import lombok.Data; ...@@ -8,9 +8,9 @@ import lombok.Data;
@Data @Data
public class SmartCarKeyAutoSenseRequest{ public class SmartCarKeyAutoSenseRequest{
//智能车钥匙自动感应状态 //智能车钥匙自动感应状态
private Integer autoSenseStatus; private String autoSenseStatus;
private String sn; private String sn;
private Long userId; private String userId;
} }
...@@ -16,5 +16,5 @@ public class SmartCarKeyCommandRequest{ ...@@ -16,5 +16,5 @@ public class SmartCarKeyCommandRequest{
private String keyCommond; private String keyCommond;
//用户id //用户id
private Long userId; private String userId;
} }
...@@ -12,5 +12,5 @@ public class SmartCarKeyNameRequest{ ...@@ -12,5 +12,5 @@ public class SmartCarKeyNameRequest{
private String sn; private String sn;
private Long userId; private String userId;
} }
...@@ -19,5 +19,5 @@ public class SmartCarKeyRegisterRequest{ ...@@ -19,5 +19,5 @@ public class SmartCarKeyRegisterRequest{
//智能车钥匙MAC地址 //智能车钥匙MAC地址
private String smartLockMac; private String smartLockMac;
private Long userId; private String userId;
} }
...@@ -9,5 +9,5 @@ import lombok.Data; ...@@ -9,5 +9,5 @@ import lombok.Data;
public class SmartCarKeyRequest{ public class SmartCarKeyRequest{
private String sn; private String sn;
private Long userId; private String userId;
} }
...@@ -9,5 +9,5 @@ import lombok.Data; ...@@ -9,5 +9,5 @@ import lombok.Data;
public class SmartCarKeyRmRequest { public class SmartCarKeyRmRequest {
private String sn; private String sn;
private Long userId; private String userId;
} }
...@@ -46,7 +46,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -46,7 +46,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
@Override @Override
public R getLockingKey(SmartCarKeyRequest request) { public R getLockingKey(SmartCarKeyRequest request) {
SmartCarKeyResponse response = new SmartCarKeyResponse(); SmartCarKeyResponse response = new SmartCarKeyResponse();
SmartVehicleBlueKeyExample example = getExampleBysn(request.getUserId(),request.getSn()); SmartVehicleBlueKeyExample example = getExampleBysn(Long.valueOf(request.getUserId()),request.getSn());
List<SmartVehicleBlueKey> smartVehicleBlueKeys = smartVehicleBlueKeyService.selectByExample(example); List<SmartVehicleBlueKey> smartVehicleBlueKeys = smartVehicleBlueKeyService.selectByExample(example);
if(CollectionUtils.isEmpty(smartVehicleBlueKeys)){ if(CollectionUtils.isEmpty(smartVehicleBlueKeys)){
...@@ -65,7 +65,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -65,7 +65,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//保存,crep用明文存储 //保存,crep用明文存储
newKey.setSn(request.getSn()); newKey.setSn(request.getSn());
newKey.setUserId(request.getUserId()); newKey.setUserId(Long.valueOf(request.getUserId()));
newKey.setCrepCode(crep); newKey.setCrepCode(crep);
newKey.setCreateTime(new Date()); newKey.setCreateTime(new Date());
newKey.setAutoSenseStatus(0); newKey.setAutoSenseStatus(0);
...@@ -113,7 +113,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -113,7 +113,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
} }
//更新,crep用明文存储 //更新,crep用明文存储
carkey.setSn(request.getSn()); carkey.setSn(request.getSn());
carkey.setUserId(request.getUserId()); carkey.setUserId(Long.valueOf(request.getUserId()));
carkey.setCrepCode(crep); carkey.setCrepCode(crep);
carkey.setCreateTime(new Date()); carkey.setCreateTime(new Date());
carkey.setAutoSenseStatus(0); carkey.setAutoSenseStatus(0);
...@@ -135,7 +135,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -135,7 +135,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
public R removeLockingKey(SmartCarKeyRmRequest request) { public R removeLockingKey(SmartCarKeyRmRequest request) {
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey(); SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setIsDelete(1); smartVehicleBlueKey.setIsDelete(1);
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(request.getUserId(), request.getSn())); smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(Long.valueOf(request.getUserId()), request.getSn()));
return R.ok(); return R.ok();
} }
...@@ -144,7 +144,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -144,7 +144,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
@Override @Override
public R LogLockingKeyCommand(SmartCarKeyCommandRequest carKeyCommandRequest) { public R LogLockingKeyCommand(SmartCarKeyCommandRequest carKeyCommandRequest) {
SmartKeyCommandLog logData = new SmartKeyCommandLog(); SmartKeyCommandLog logData = new SmartKeyCommandLog();
logData.setUserId(carKeyCommandRequest.getUserId()); logData.setUserId(Long.valueOf(carKeyCommandRequest.getUserId()));
String crep = ""; String crep = "";
try { try {
crep = aesEncryptUtils.decrypt(carKeyCommandRequest.getCrepCode()); crep = aesEncryptUtils.decrypt(carKeyCommandRequest.getCrepCode());
...@@ -164,7 +164,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -164,7 +164,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
public R setLockingKeyName(SmartCarKeyNameRequest request) { public R setLockingKeyName(SmartCarKeyNameRequest request) {
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey(); SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setKeyName(request.getKeyName()); smartVehicleBlueKey.setKeyName(request.getKeyName());
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(request.getUserId(), request.getSn())); smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(Long.valueOf(request.getUserId()), request.getSn()));
return R.ok(); return R.ok();
} }
...@@ -172,8 +172,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -172,8 +172,8 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
@Override @Override
public R setLockingKeyAutoSense(SmartCarKeyAutoSenseRequest request) { public R setLockingKeyAutoSense(SmartCarKeyAutoSenseRequest request) {
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey(); SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setAutoSenseStatus(request.getAutoSenseStatus()); smartVehicleBlueKey.setAutoSenseStatus(Integer.valueOf(request.getAutoSenseStatus()));
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(request.getUserId(), request.getSn())); smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(Long.valueOf(request.getUserId()), request.getSn()));
return R.ok(); return R.ok();
} }
...@@ -198,7 +198,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -198,7 +198,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
smartVehicleBlueKey.setCrepCode(crep); smartVehicleBlueKey.setCrepCode(crep);
smartVehicleBlueKey.setSecretKey(keySecret); smartVehicleBlueKey.setSecretKey(keySecret);
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample(); SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria().andUserIdEqualTo(request.getUserId()).andCrepCodeEqualTo(crep).andIsDeleteEqualTo(0); example.createCriteria().andUserIdEqualTo(Long.valueOf(request.getUserId())).andCrepCodeEqualTo(crep).andIsDeleteEqualTo(0);
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey,example); smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey,example);
return R.ok(); return R.ok();
...@@ -214,7 +214,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -214,7 +214,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//获取crep(雪花算法+userid) //获取crep(雪花算法+userid)
private String getCrepCode(SmartCarKeyRequest request) { private String getCrepCode(SmartCarKeyRequest request) {
long snowId = SnowFlake.nextId(); long snowId = SnowFlake.nextId();
long userId = request.getUserId(); long userId = Long.parseLong(request.getUserId());
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
return sb.append(snowId).append(userId).toString(); return sb.append(snowId).append(userId).toString();
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!