diff --git a/pig-common/src/main/java/com/github/pig/common/bean/aop/ControllerAop.java b/pig-common/src/main/java/com/github/pig/common/bean/aop/ControllerAop.java index 37fdcc84..ac0f11bd 100644 --- a/pig-common/src/main/java/com/github/pig/common/bean/aop/ControllerAop.java +++ b/pig-common/src/main/java/com/github/pig/common/bean/aop/ControllerAop.java @@ -1,12 +1,8 @@ package com.github.pig.common.bean.aop; import com.github.pig.common.constant.SecurityConstants; -import com.github.pig.common.util.R; import com.github.pig.common.util.UserUtils; -import com.github.pig.common.util.exception.CheckException; -import com.github.pig.common.util.exception.UnloginException; import com.github.pig.common.vo.UserVo; -import com.xiaoleilu.hutool.lang.Console; import org.apache.commons.lang.StringUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -22,7 +18,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.util.Arrays; -import java.util.Optional; /** * @author lengleng diff --git a/pig-common/src/main/java/com/github/pig/common/util/Assert.java b/pig-common/src/main/java/com/github/pig/common/util/Assert.java index e677fe1a..bcbe9847 100644 --- a/pig-common/src/main/java/com/github/pig/common/util/Assert.java +++ b/pig-common/src/main/java/com/github/pig/common/util/Assert.java @@ -1,6 +1,6 @@ package com.github.pig.common.util; -import com.github.pig.common.util.exception.CheckException; +import com.github.pig.common.util.exception.CheckedException; import org.apache.commons.lang.StringUtils; import javax.validation.ConstraintViolation; @@ -25,29 +25,29 @@ public class Assert { * 校验对象 * @param object 待校验对象 * @param groups 待校验的组 - * @throws CheckException 校验不通过,则报RRException异常 + * @throws CheckedException 校验不通过,则报RRException异常 */ public static void validateEntity(Object object, Class... groups) - throws CheckException { + throws CheckedException { Set> constraintViolations = validator.validate(object, groups); if (!constraintViolations.isEmpty()) { StringBuilder msg = new StringBuilder(); for(ConstraintViolation constraint: constraintViolations){ msg.append(constraint.getMessage()).append("
"); } - throw new CheckException(msg.toString()); + throw new CheckedException(msg.toString()); } } public static void isBlank(String str, String message) { if (StringUtils.isBlank(str)) { - throw new CheckException(message); + throw new CheckedException(message); } } public static void isNull(Object object, String message) { if (object == null) { - throw new CheckException(message); + throw new CheckedException(message); } } }