Commit 372c3133 by wnb0128

Merge branch 'dev' of 192.168.3.233:open-source/chejia-smart-service into dev

2 parents 1c8599a3 c2b3e389
package cn.com.glsx.smart.common.exception;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public class BusinessException extends RuntimeException {
private Integer code;
private String message;
public BusinessException() {}
public BusinessException(ResultEnum resultEnum) {
this.code = resultEnum.getCode();
this.message = resultEnum.getMessage();
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public static BusinessException create(int code, String message){
BusinessException businessException = new BusinessException();
businessException.code = code;
businessException.message = message;
return businessException;
}
public static BusinessException create(ResultEnum resultEnum) {
return create(resultEnum.getCode(), resultEnum.getMessage());
}
public static BusinessException create(ResultEnum resultEnum, Object... args) {
String message = String.format(resultEnum.getMessage(), args);
return create(resultEnum.getCode(), message);
}
}
package cn.com.glsx.smart.common.exception;
import com.glsx.plat.exception.BusinessException;
/**
* <p>Description: 车家智能异常类
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public class ChejiaBusinessException extends BusinessException {
private ChejiaBusinessException(int code, String message) {
super(BusinessException.create(code, message));
}
//private ChejiaBusinessException(ResultEnum resultEnum) {
// this(resultEnum.getCode(), resultEnum.getMessage());
//}
public static ChejiaBusinessException create(int code, String message){
return new ChejiaBusinessException(code, message);
}
//public static ChejiaBusinessException create(ResultEnum resultEnum) {
// return create(resultEnum.getCode(), resultEnum.getMessage());
//}
public static ChejiaBusinessException create(ResultEnum resultEnum, Object... args) {
String message = String.format(resultEnum.getMessage(), args);
return create(resultEnum.getCode(), message);
}
}
......@@ -3,9 +3,6 @@ package cn.com.glsx.smart.common.exception;
import com.glsx.plat.core.web.R;
import com.glsx.plat.exception.GlobalExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
......@@ -15,21 +12,21 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
*
* @author wbh
* @date 2021-03-16
* @deprecated 抛出异常,让上游服务捕获信息
*/
@Slf4j
@RestControllerAdvice
public class ChejiaSmartExceptionHandler extends GlobalExceptionHandler {
@ExceptionHandler({BusinessException.class})
public R handleBusinessException(BusinessException e) {
@ExceptionHandler({ChejiaBusinessException.class})
public R handleBusinessException(ChejiaBusinessException e) {
log.error("业务异常", e);
return R.error(e.getMessage());
R r = e.getResultEntity();
return R.error(r.getCode(), r.getMessage());
}
@ExceptionHandler({CarKeyException.class})
public R handleCarKeyException(CarKeyException e) {
log.error("车钥匙异常", e);
return R.error(e.getCode(),e.getMessage());
return R.error(e.getCode(), e.getMessage());
}
//@ExceptionHandler({ServletRequestBindingException.class, MethodArgumentNotValidException.class,
......@@ -38,7 +35,7 @@ public class ChejiaSmartExceptionHandler extends GlobalExceptionHandler {
// log.error("参数错误", e);
// return R.error(ResultEnum.PARAM_ERROR.getCode(), ResultEnum.PARAM_ERROR.getMessage());
//}
//
//@ExceptionHandler(Exception.class)
//public R handleException(Exception e) {
// log.error("未知异常", e);
......
package cn.com.glsx.smart.common.filter;
import com.glsx.plat.common.utils.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
import com.glsx.plat.common.utils.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
/**
* <p>Description: 跨域配置
......@@ -18,8 +20,7 @@ import java.util.Enumeration;
* @author wbh
* @date 2021-03-18
*/
//TODO 跨域有默认的拦截器,请对比后处理 宝辉 已存在com.glsx.plat.web.filter.CorsFilter
@Component
//@Component
public class ChejiaCorsFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
......
package cn.com.glsx.smart.modules.controller;
import java.util.List;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartSysCode;
import cn.com.glsx.smart.modules.service.SmartSysCodeService;
......@@ -13,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.common.exception.BusinessException;
import java.util.List;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartUserDevice;
import cn.com.glsx.smart.modules.service.SmartUserDeviceService;
......@@ -14,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>Description: 用户设备业务
* <p>Project: chejia-smart
......@@ -40,7 +39,7 @@ public class UserDeviceController {
public List<SmartUserDevice> getList(SmartUserDevice req) {
log.info("$$$$ /userDevice/getList param: {}", JSON.toJSONString(req));
if (req.getUserId() == null) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "userId");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "userId");
}
return userDeviceService.getList(req);
}
......@@ -55,7 +54,7 @@ public class UserDeviceController {
public SmartUserDevice getByDeviceId(SmartUserDevice req) {
log.info("$$$$ /userDevice/getByDeviceId param: {}", JSON.toJSONString(req));
if (StringUtils.isBlank(req.getDeviceId())) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "deviceId");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "deviceId");
}
return userDeviceService.getByDeviceId(req);
}
......@@ -70,7 +69,7 @@ public class UserDeviceController {
public boolean save(@RequestBody SmartUserDevice req) {
log.info("$$$$ /userDevice/save param: {}", JSON.toJSONString(req));
if (StringUtils.isBlank(req.getDeviceId()) || req.getChannel() == null) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "deviceId, channel");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "deviceId, channel");
}
return userDeviceService.save(req) > 0;
}
......@@ -85,7 +84,7 @@ public class UserDeviceController {
public boolean deleteDevice(@RequestBody SmartUserDevice req) {
log.info("$$$$ /userDevice/deleteDevice param: {}", JSON.toJSONString(req));
if (StringUtils.isBlank(req.getDeviceId()) || req.getChannel() == null) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "deviceId, channel");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "deviceId, channel");
}
return userDeviceService.deleteDevice(req) > 0;
}
......@@ -100,7 +99,7 @@ public class UserDeviceController {
public String getUserBindKey(String token) {
log.info("$$$$ /userDevice/getUserBindKey param: {}", token);
if (StringUtils.isBlank(token)) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "token");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "token");
}
return userDeviceService.getUserBindKey(token);
}
......
package cn.com.glsx.smart.modules.service.impl;
import cn.com.glsx.smart.modules.entity.*;
import cn.com.glsx.smart.common.exception.BusinessException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.model.request.*;
import cn.com.glsx.smart.modules.model.response.SmartCarKeyResponse;
import cn.com.glsx.smart.modules.service.*;
import cn.com.glsx.smart.common.utils.AesEncryptUtils;
import cn.com.glsx.smart.common.utils.JwtUtil;
import cn.com.glsx.smart.common.utils.SnowflakeWorker;
import cn.com.glsx.smart.modules.entity.SmartKeyBlueSense;
import cn.com.glsx.smart.modules.entity.SmartKeyBlueSenseExample;
import cn.com.glsx.smart.modules.entity.SmartKeyCommandLog;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueKeyExample;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueShareKey;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueShareKeyExample;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyActionLogBatchRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyAutoSenseRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyCommandRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyNameRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyRegisterRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyTokenRequest;
import cn.com.glsx.smart.modules.model.request.SmartCarKeyUserRequest;
import cn.com.glsx.smart.modules.model.request.SmartKeyPrimaryShareEditReq;
import cn.com.glsx.smart.modules.model.request.SmartShareCarKeyPageRequest;
import cn.com.glsx.smart.modules.model.response.SmartCarKeyResponse;
import cn.com.glsx.smart.modules.service.AiLockingKeyService;
import cn.com.glsx.smart.modules.service.SmartKeyBlueSenseService;
import cn.com.glsx.smart.modules.service.SmartKeyCommandLogService;
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.alibaba.nacos.common.utils.CollectionUtils;
......@@ -22,9 +47,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>Description:智能车钥匙service
* <p>Project: chejia-smart
......@@ -75,7 +97,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
try {
crep_encrypt = aesEncryptUtils.encrypt(crep);
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_1);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_1);
}
//新增车钥匙
......@@ -92,7 +114,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//如果车钥匙有数据,但是crep为空字符串
if (StringUtils.isEmpty(crepCode)) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_10);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_10);
}
//如果车钥匙有对应的crep,返回钥匙信息
......@@ -108,8 +130,9 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
SmartVehicleBlueKeyExample example = smartVehicleBlueKeyService.getBlueKeyExampleByUserAndSn(Long.valueOf(request.getUserId()), request.getSn());
List<SmartVehicleBlueKey> keyList = smartVehicleBlueKeyService.selectByExample(example);
if (CollectionUtils.isEmpty(keyList))
if (CollectionUtils.isEmpty(keyList)) {
return R.ok();
}
SmartVehicleBlueKey blueKey = keyList.get(0);
......@@ -171,7 +194,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
try {
crep = aesEncryptUtils.decrypt(carKeyCommandRequest.getCrepCode());
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_4);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_4);
}
//明文存储crep
logData.setCrepCode(crep);
......@@ -243,9 +266,9 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
return exist;
});
if (IfExist)
if (IfExist) {
return R.error("keyName重复,已存在");
else {
} else {
for (SmartVehicleBlueKey blueKey : keyList) {
//更新该设备的名称
if (sn.equals(blueKey.getSn()) && !keyName.equals(blueKey.getKeyName())) {
......@@ -339,7 +362,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
secretKey = aesEncryptUtils.decryptSecret(secretKey_db);
}
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_12);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_12);
}
String crepCode = key.getCrepCode();
......@@ -352,7 +375,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
secret_key_encrypt = aesEncryptUtils.encrypt(secretKey);
}
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_13);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_13);
}
//拷贝属性
......@@ -442,7 +465,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
crep = aesEncryptUtils.decrypt(request.getCrepCode());
keySecret = aesEncryptUtils.decrypt(request.getSecretKey());
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_5);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_5);
}
//将密钥明文加密后存入数据库
......@@ -452,7 +475,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
try {
secretKey_db = aesEncryptUtils.encryptSecret(keySecret);
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_7);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_7);
}
}
//查询车钥匙
......@@ -465,7 +488,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//车钥匙不存在
if (CollectionUtils.isEmpty(smartVehicleBlueKeyList)) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_3);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_3);
}
SmartVehicleBlueKey smartVehicleBlueKey = smartVehicleBlueKeyList.get(0);
......@@ -504,7 +527,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
smartKeyBlueSenseService.updateByPrimaryKeySelective(blueSense);
}
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_9);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_9);
}
......@@ -551,7 +574,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//保存车钥匙
smartVehicleBlueKeyService.insert(newKey);
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_8);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_8);
}
//拷贝属性,crep用密文传输
......@@ -568,7 +591,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
} catch (Exception e) {
String error_msg = "智能车钥匙查询,secretKey解密异常,crep存在:" + crepExist + ",crep:" + crepCode;
log.info(error_msg);
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_6);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_6);
}
}
......@@ -584,7 +607,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
} catch (Exception e) {
String error_msg = "智能车钥匙查询加密异常,crep存在:" + crepExist + ",crep:" + crepCode;
log.info(error_msg);
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_2);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_2);
}
BeanUtils.copyProperties(carkey, response);
......
package cn.com.glsx.smart.modules.service.impl;
import cn.com.glsx.smart.modules.entity.*;
import cn.com.glsx.smart.common.exception.BusinessException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
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.SmartKeyCommandShareLog;
import cn.com.glsx.smart.modules.entity.SmartShareKeyBlueKey;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueShareKey;
import cn.com.glsx.smart.modules.entity.SmartVehicleBlueShareKeyExample;
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.SmartShareKeyEditReq;
import cn.com.glsx.smart.common.redis.RedisService;
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.com.glsx.smart.common.utils.AesEncryptUtils;
import cn.com.glsx.smart.common.utils.JwtUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.nacos.common.utils.StringUtils;
......@@ -26,10 +37,6 @@ import org.apache.dubbo.common.utils.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* <p>Description:智能车钥匙service
* <p>Project: chejia-smart
......@@ -83,8 +90,9 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
SmartVehicleBlueKey key = keyList.get(0);
//将数据库密钥解密成明文
List<String> arr = encryptKey(key.getCrepCode(), key.getSecretKey());
if (CollectionUtils.isEmpty(arr) || arr.size() != 2)
if (CollectionUtils.isEmpty(arr) || arr.size() != 2) {
return R.error("钥匙信息不完整");
}
key.setCrepCode(arr.get(0));
key.setSecretKey(arr.get(1));
......@@ -107,7 +115,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
//setnx,只允许一个人领取钥匙
boolean res = redisService.setnx("receive_share_key:" + token, userId);
if (!res) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_14);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_14);
}
//已领取
......@@ -185,13 +193,15 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
public R getShareLockingKey(String keyid) {
List<SmartShareKeyBlueKey> keyList = shareKeyService.getShareKeyListByKeyId(Long.valueOf(keyid));
if (CollectionUtils.isEmpty(keyList))
if (CollectionUtils.isEmpty(keyList)) {
return R.ok().data(null);
}
SmartShareKeyBlueKey key = keyList.get(0);
List<String> arr = encryptKey(key.getCrepCode(), key.getSecretKey());
if (CollectionUtils.isEmpty(arr) || arr.size() != 2)
if (CollectionUtils.isEmpty(arr) || arr.size() != 2) {
return R.error("钥匙信息不完整");
}
key.setCrepCode(arr.get(0));
key.setSecretKey(arr.get(1));
......@@ -215,8 +225,9 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
keys.stream().forEach(key -> {
//将数据库密钥解密成明文
List<String> arr = encryptKey(key.getCrepCode(), key.getSecretKey());
if (CollectionUtils.isEmpty(arr) || arr.size() != 2)
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_21);
if (CollectionUtils.isEmpty(arr) || arr.size() != 2) {
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_21);
}
key.setCrepCode(arr.get(0));
key.setSecretKey(arr.get(1));
......@@ -232,7 +243,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
List<SmartVehicleBlueKey> keyList = blueKeyService.selectById(keyid);
if (CollectionUtils.isEmpty(keyList)) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_19);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_19);
}
SmartVehicleBlueKey blueKey = keyList.get(0);
......@@ -243,13 +254,13 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
//主钥匙是否信息完整
if (StringUtils.isBlank(crepCode) || StringUtils.isBlank(secretKey) || StringUtils.isBlank(smartLockMac)) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_21);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_21);
}
//主钥匙是否关闭分享
int status = blueKey.getShareStatus();
if (status == 0) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_20);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_20);
}
......@@ -257,7 +268,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
boolean isReceive = isKeyReceive(keyShareID);
if (isReceive) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_14);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_14);
}
//校验过期时间
......@@ -267,7 +278,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
SmartVehicleBlueShareKey shareKey = shareKeyService.selectByPrimaryKey(keyShareID);
if (null == shareKey) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_15);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_15);
}
Date expireDate = shareKey.getExpireTime();
......@@ -277,11 +288,12 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
nowDate = sdf.parse(nowTime);
} catch (ParseException e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_15);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_15);
}
if (nowDate.after(expireDate))
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_16);
if (nowDate.after(expireDate)) {
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_16);
}
return shareKey;
}
......@@ -291,9 +303,9 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
try {
claims = jwtUtil.getClaimsFromToken(token);
} catch (ExpiredJwtException e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_18);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_18);
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_17);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_17);
}
return claims;
}
......@@ -308,7 +320,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
secretKey = aesEncryptUtils.decryptSecret(secretKey_db);
}
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_12);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_12);
}
......@@ -326,7 +338,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
arr.add(secret_key_encrypt);
}
} catch (Exception e) {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_13);
throw ChejiaBusinessException.create(ResultEnum.CAR_KEY_EXCEP_13);
}
return arr;
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.enums.DeviceChannelEnum;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartDeviceOrder;
import cn.com.glsx.smart.modules.entity.SmartProduct;
import cn.com.glsx.smart.modules.entity.SmartSysCode;
import cn.com.glsx.smart.modules.mapper.SmartDeviceOrderMapper;
import cn.com.glsx.smart.modules.mapper.SmartProductMapper;
import cn.com.glsx.smart.modules.mapper.SmartSysCodeMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.service.BaseService;
import cn.com.glsx.smart.modules.service.SmartProductService;
import com.alibaba.fastjson.JSONArray;
......@@ -21,12 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>Description: 产品列表业务
* <p>Project: chejia-smart
......@@ -84,7 +83,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
public SmartProduct getById(Long id) {
SmartProduct product = productMapper.getById(id);
if (product == null) {
throw new BusinessException(ResultEnum.PRODUCT_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_NOT_FOUND);
}
return product;
}
......@@ -177,7 +176,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
if (product.getId() == null) {
int nameCount = productMapper.countByProductName(product.getProductName());
if (nameCount > 0) {
throw new BusinessException(ResultEnum.PRODUCT_NAME_DUPLICATE);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_NAME_DUPLICATE);
}
product.setCreateTime(now);
product.setCreateBy(0L);
......@@ -187,7 +186,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
if (record != null) {
success = productMapper.updateByPrimaryKeySelective(product) > 0;
} else {
throw new BusinessException(ResultEnum.PRODUCT_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_NOT_FOUND);
}
}
......@@ -224,7 +223,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
boolean success;
SmartProduct product = productMapper.selectByPrimaryKey(id);
if (product == null) {
throw new BusinessException(ResultEnum.PRODUCT_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_NOT_FOUND);
}
product.setStatus((byte) (product.getStatus() ^ 0b00000001));
success = productMapper.updateByPrimaryKeySelective(product) > 0;
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartProduct;
import cn.com.glsx.smart.modules.entity.SmartProductType;
import cn.com.glsx.smart.modules.entity.SmartUserDevice;
import cn.com.glsx.smart.modules.mapper.SmartProductMapper;
import cn.com.glsx.smart.modules.mapper.SmartProductTypeMapper;
import cn.com.glsx.smart.modules.mapper.SmartUserDeviceMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.model.response.RemoteDeviceResp;
import cn.com.glsx.smart.modules.service.BaseService;
import cn.com.glsx.smart.modules.service.SmartProductTypeService;
......@@ -21,10 +29,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>Description: 产品类型业务
* <p>Project: chejia-smart
......@@ -86,7 +90,7 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
public SmartProductType getById(Long id) {
SmartProductType productType = productTypeMapper.getById(id);
if (productType == null) {
throw new BusinessException(ResultEnum.PRODUCT_TYPE_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_TYPE_NOT_FOUND);
}
return productType;
}
......@@ -108,7 +112,7 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
if (productType.getId() == null) {
int nameCount = productTypeMapper.countByProductTypeName(productType.getTypeName());
if (nameCount > 0) {
throw new BusinessException(ResultEnum.PRODUCT_TYPE_NAME_DUPLICATE);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_TYPE_NAME_DUPLICATE);
}
productType.setCreateTime(now);
productType.setCreateBy(0L);
......@@ -118,7 +122,7 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
if (record != null) {
success = productTypeMapper.updateByPrimaryKeySelective(productType) > 0;
} else {
throw new BusinessException(ResultEnum.PRODUCT_TYPE_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.PRODUCT_TYPE_NOT_FOUND);
}
}
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.List;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartDeviceOrder;
import cn.com.glsx.smart.modules.entity.SmartDeviceOrdervalue;
import cn.com.glsx.smart.modules.entity.SmartScenceSupstatus;
......@@ -9,8 +13,6 @@ import cn.com.glsx.smart.modules.mapper.SmartDeviceOrderMapper;
import cn.com.glsx.smart.modules.mapper.SmartDeviceOrdervalueMapper;
import cn.com.glsx.smart.modules.mapper.SmartScenceSupstatusMapper;
import cn.com.glsx.smart.modules.mapper.SmartSceneDataMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.service.SmartSceneDataService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......@@ -18,9 +20,6 @@ import com.glsx.plat.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -58,7 +57,7 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
if (record != null) {
return sceneDataMapper.updateByPrimaryKeySelective(sceneData);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.ID_NOT_FOUND);
}
}
}
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import cn.com.glsx.didicb.app.enums.MessageTypeEnum;
import cn.com.glsx.didicb.app.model.CarAssistantInfo;
import cn.com.glsx.didicb.app.remote.CarAssistantInfoRemote;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.common.redis.RedisService;
import cn.com.glsx.smart.common.utils.HttpUtil;
import cn.com.glsx.smart.modules.entity.SmartDeviceStatus;
import cn.com.glsx.smart.modules.entity.SmartScene;
import cn.com.glsx.smart.modules.entity.SmartSceneData;
import cn.com.glsx.smart.modules.mapper.SmartDeviceStatusMapper;
import cn.com.glsx.smart.modules.mapper.SmartSceneDataMapper;
import cn.com.glsx.smart.modules.mapper.SmartSceneMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.model.ExecuteTaskVo;
import cn.com.glsx.smart.modules.model.OrderResponse;
import cn.com.glsx.smart.modules.model.ResponseVo;
import cn.com.glsx.smart.common.redis.RedisService;
import cn.com.glsx.smart.modules.service.BaseService;
import cn.com.glsx.smart.modules.service.SmartSceneService;
import cn.com.glsx.smart.common.utils.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
......@@ -29,13 +39,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -93,7 +96,7 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
if (record != null) {
return sceneMapper.updateByPrimaryKeySelective(scene);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.ID_NOT_FOUND);
}
}
}
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.List;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartSysCode;
import cn.com.glsx.smart.modules.mapper.SmartSysCodeMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.service.BaseService;
import cn.com.glsx.smart.modules.service.SmartSysCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -52,7 +51,7 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
if (record != null) {
return sysCodeMapper.updateByPrimaryKeySelective(sysCode);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.ID_NOT_FOUND);
}
}
}
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartSysFile;
import cn.com.glsx.smart.modules.mapper.SmartSysFileMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.model.FileDTO;
import cn.com.glsx.smart.modules.service.SmartSysFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -36,7 +39,7 @@ public class SmartSysFileServiceImpl implements SmartSysFileService {
if (record != null) {
fileMapper.updateByPrimaryKeySelective(sysFile);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.ID_NOT_FOUND);
}
}
return sysFile.getId();
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.List;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartDeviceOrder;
import cn.com.glsx.smart.modules.entity.SmartDeviceOrdervalue;
import cn.com.glsx.smart.modules.entity.SmartScenceSupstatus;
import cn.com.glsx.smart.modules.entity.SmartTemplateParam;
import cn.com.glsx.smart.modules.mapper.*;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.mapper.SmartDeviceOrderMapper;
import cn.com.glsx.smart.modules.mapper.SmartDeviceOrdervalueMapper;
import cn.com.glsx.smart.modules.mapper.SmartProductTypeMapper;
import cn.com.glsx.smart.modules.mapper.SmartScenceSupstatusMapper;
import cn.com.glsx.smart.modules.mapper.SmartTemplateParamMapper;
import cn.com.glsx.smart.modules.service.SmartTemplateParamService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -58,7 +61,7 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService
if (record != null) {
return templateParamMapper.updateByPrimaryKeySelective(templateParam);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.ID_NOT_FOUND);
}
}
}
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.common.redis.RedisService;
import cn.com.glsx.smart.modules.entity.SmartUserChannel;
import cn.com.glsx.smart.modules.entity.SmartUserDevice;
import cn.com.glsx.smart.modules.entity.SmartUserRelation;
......@@ -8,9 +18,6 @@ import cn.com.glsx.smart.modules.mapper.SmartProductMapper;
import cn.com.glsx.smart.modules.mapper.SmartUserChannelMapper;
import cn.com.glsx.smart.modules.mapper.SmartUserDeviceMapper;
import cn.com.glsx.smart.modules.mapper.SmartUserRelationMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.common.redis.RedisService;
import cn.com.glsx.smart.modules.service.BaseService;
import cn.com.glsx.smart.modules.service.SmartUserDeviceService;
import com.alibaba.fastjson.JSON;
......@@ -22,14 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>Description: 用户设备业务
* <p>Project: chejia-smart
......@@ -79,7 +78,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
public SmartUserDevice getByDeviceId(SmartUserDevice req) {
SmartUserDevice userDevice = userDeviceMapper.getByDeviceId(req);
if (userDevice == null) {
throw BusinessException.create(ResultEnum.DEVICE_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.DEVICE_NOT_FOUND);
}
return userDevice;
}
......@@ -95,14 +94,14 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
SmartUserDevice savedUserDevice = userDeviceMapper.selectOne(record);
if (savedUserDevice == null) {
if (StringUtils.isBlank(req.getUid())) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "uid");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "uid");
}
// 根据第三方用户 id 查询用户绑定信息
SmartUserChannel ucRecord = new SmartUserChannel();
ucRecord.setThirdId(req.getUid());
SmartUserChannel savedUserChannel = userChannelMapper.selectOne(ucRecord);
if (savedUserChannel == null) {
throw BusinessException.create(ResultEnum.USER_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.USER_NOT_FOUND);
}
// 插入用户信息
req.setUserId(savedUserChannel.getUserId());
......@@ -113,7 +112,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
this.subscribeDevice(req);
} else {
if (StringUtils.isBlank(req.getDeviceName())) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "deviceName");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "deviceName");
}
savedUserDevice.setDeviceName(req.getDeviceName());
savedUserDevice.setUpdateTime(now);
......@@ -176,7 +175,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
if (Constants.USER_CHANNEL_AQARA.equals(req.getChannel())) {
// 只有绿米的设备需要订阅
if (StringUtils.isBlank(req.getPlatformProductId())) {
throw BusinessException.create(ResultEnum.PARAM_EMPTY, "platformProductId");
throw ChejiaBusinessException.create(ResultEnum.PARAM_EMPTY, "platformProductId");
}
// 通过用户手机号获取用户 token
SmartUserRelation userRelation = userRelationMapper.selectByPrimaryKey(req.getUserId());
......@@ -203,7 +202,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
log.info("$$$$ subscribeDevice resp = {}", respJson);
JSONObject respObj = JSON.parseObject(respJson);
if (!"200".equals(respObj.getString("code"))) {
throw BusinessException.create(ResultEnum.DEVICE_SUBSCRIBE_ERROR);
throw ChejiaBusinessException.create(ResultEnum.DEVICE_SUBSCRIBE_ERROR);
}
}
}
......
package cn.com.glsx.smart.modules.service.impl;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.common.exception.ChejiaBusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.entity.SmartUserChannel;
import cn.com.glsx.smart.modules.entity.SmartUserRelation;
import cn.com.glsx.smart.modules.mapper.SmartUserChannelMapper;
import cn.com.glsx.smart.modules.mapper.SmartUserRelationMapper;
import cn.com.glsx.smart.common.exception.BusinessException;
import cn.com.glsx.smart.common.exception.ResultEnum;
import cn.com.glsx.smart.modules.service.SmartUserRelationService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......@@ -16,12 +21,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -63,7 +62,7 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
if (record != null) {
return relationMapper.updateByPrimaryKeySelective(userRelation);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
throw ChejiaBusinessException.create(ResultEnum.ID_NOT_FOUND);
}
}
}
......@@ -183,6 +182,7 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
* @param mobile
* @return
*/
@Override
public Map<String, String> syncAqaraUserCore(String mobile){
Map<String, String> object = new HashMap<>();
object.put("account", mobile);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!