From 8033666a705490d065e8ce0423ce7e215396ba7a Mon Sep 17 00:00:00 2001 From: aoshiguchen <1052045476@qq.com> Date: Wed, 23 Nov 2022 10:09:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3license=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../asgc/neutrino/proxy/server/service/LicenseService.java | 2 +- .../asgc/neutrino/proxy/server/util/ParamCheckUtil.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java index a744706c..4da7fe49 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java @@ -125,7 +125,7 @@ public class LicenseService { ParamCheckUtil.checkNotNull(oldLicenseDO, ExceptionConstant.LICENSE_NOT_EXIST); LicenseDO licenseCheck = licenseMapper.checkRepeat(oldLicenseDO.getUserId(), req.getName(), Sets.newHashSet(oldLicenseDO.getId())); - ParamCheckUtil.checkNotNull(licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT); + ParamCheckUtil.checkMustNull(licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT); licenseMapper.update(req.getId(), req.getName(), new Date()); return new LicenseUpdateRes(); diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java index f1980e10..7dc59f49 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java @@ -66,6 +66,13 @@ public class ParamCheckUtil { } } + public static void checkMustNull(Object obj, ExceptionConstant constant, Object... params) { + if (null != obj) { + throw ServiceException.create(constant, params); + } + } + + public static void checkNotNull(Object obj, ExceptionConstant constant, Object... params) { if (null == obj) { throw ServiceException.create(constant, params);