mirror of https://gitee.com/maxjhandsome/pig
修改类名称规范化
This commit is contained in:
parent
2d989c45ba
commit
717c7f9dd8
|
@ -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
|
||||
|
|
|
@ -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<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
|
||||
if (!constraintViolations.isEmpty()) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for(ConstraintViolation<Object> constraint: constraintViolations){
|
||||
msg.append(constraint.getMessage()).append("<br>");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue