修改类名称规范化

This commit is contained in:
wangiegie@gmail.com 2018-01-24 17:50:40 +08:00
parent 2d989c45ba
commit 717c7f9dd8
2 changed files with 6 additions and 11 deletions

View File

@ -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

View File

@ -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);
}
}
}