fix: 新增产品时productKey校验
parent
de53e07304
commit
c866098564
|
@ -104,7 +104,8 @@ public enum ErrCode implements IEnum {
|
||||||
RECORD_NOT_FOUND(00000000, "记录不存在"),
|
RECORD_NOT_FOUND(00000000, "记录不存在"),
|
||||||
ADD_PLATFORM_USER_ERROR(00000000, "添加平台用户失败"),
|
ADD_PLATFORM_USER_ERROR(00000000, "添加平台用户失败"),
|
||||||
UPLOAD_FILE_ERROR(00000000, "上传文件失败"),
|
UPLOAD_FILE_ERROR(00000000, "上传文件失败"),
|
||||||
FILE_NAME_IS_NULL(00000000, "文件名为空,获取文件名失败");
|
FILE_NAME_IS_NULL(00000000, "文件名为空,获取文件名失败"),
|
||||||
|
PRODUCT_KEY_EXIST(00000000, "ProductKey已存在");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,11 @@ public class ProductServiceImpl implements IProductService {
|
||||||
|
|
||||||
String secret = UUID.randomUUID().toString(true);
|
String secret = UUID.randomUUID().toString(true);
|
||||||
product.setProductSecret(secret);
|
product.setProductSecret(secret);
|
||||||
|
String productKey = data.getProductKey();
|
||||||
|
Product oldProduct = productData.findByProductKey(productKey);
|
||||||
|
if(oldProduct != null){
|
||||||
|
throw new BizException(ErrCode.PRODUCT_KEY_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
productData.save(product);
|
productData.save(product);
|
||||||
return MapstructUtils.convert(product, ProductVo.class);
|
return MapstructUtils.convert(product, ProductVo.class);
|
||||||
|
|
Loading…
Reference in New Issue