mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-13 21:53:41 +08:00
Merge branch 'zongzibinbin:main' into main
This commit is contained in:
@@ -6,6 +6,8 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -20,12 +22,15 @@ import java.io.Serializable;
|
||||
public class FileMsgDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty("大小(字节)")
|
||||
@NotNull
|
||||
private Long size;
|
||||
|
||||
@ApiModelProperty("下载地址")
|
||||
@NotBlank
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty("文件名(带后缀)")
|
||||
@NotBlank
|
||||
private String fileName;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -20,11 +22,14 @@ import java.io.Serializable;
|
||||
public class SoundMsgDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty("大小(字节)")
|
||||
@NotNull
|
||||
private Long size;
|
||||
|
||||
@ApiModelProperty("时长(秒)")
|
||||
@NotNull
|
||||
private Integer second;
|
||||
|
||||
@ApiModelProperty("下载地址")
|
||||
@NotBlank
|
||||
private String url;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import lombok.NoArgsConstructor;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Description: 视频消息入参
|
||||
@@ -23,20 +22,23 @@ import java.math.BigDecimal;
|
||||
public class VideoMsgDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty("大小(字节)")
|
||||
@NotNull
|
||||
private Long size;
|
||||
|
||||
@ApiModelProperty("下载地址")
|
||||
@NotBlank
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty("缩略图宽度(像素)")
|
||||
@NotNull
|
||||
private Integer thumbWidth = BigDecimal.ROUND_HALF_DOWN;
|
||||
private Integer thumbWidth;
|
||||
|
||||
@ApiModelProperty("缩略图高度(像素)")
|
||||
@NotNull
|
||||
private Integer thumbHeight;
|
||||
|
||||
@ApiModelProperty("缩略图大小(字节)")
|
||||
@NotNull
|
||||
private Long thumbSize;
|
||||
|
||||
@ApiModelProperty("缩略图下载地址")
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GlobalExceptionHandler {
|
||||
e.getBindingResult().getFieldErrors().forEach(x -> errorMsg.append(x.getField()).append(x.getDefaultMessage()).append(","));
|
||||
String message = errorMsg.toString();
|
||||
log.info("validation parameters error!The reason is:{}", message);
|
||||
return ApiResult.fail(-1, message.substring(0, message.length() - 1));
|
||||
return ApiResult.fail(CommonErrorEnum.PARAM_VALID.getErrorCode(), message.substring(0, message.length() - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class GlobalExceptionHandler {
|
||||
e.getBindingResult().getFieldErrors().forEach(x -> errorMsg.append(x.getField()).append(x.getDefaultMessage()).append(","));
|
||||
String message = errorMsg.toString();
|
||||
log.info("validation parameters error!The reason is:{}", message);
|
||||
return ApiResult.fail(-1, message.substring(0, message.length() - 1));
|
||||
return ApiResult.fail(CommonErrorEnum.PARAM_VALID.getErrorCode(), message.substring(0, message.length() - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.abin.mallchat.common.common.utils;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.abin.mallchat.common.common.exception.*;
|
||||
import lombok.SneakyThrows;
|
||||
import com.abin.mallchat.common.common.exception.BusinessErrorEnum;
|
||||
import com.abin.mallchat.common.common.exception.BusinessException;
|
||||
import com.abin.mallchat.common.common.exception.CommonErrorEnum;
|
||||
import com.abin.mallchat.common.common.exception.ErrorEnum;
|
||||
import org.hibernate.validator.HibernateValidator;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validation;
|
||||
@@ -57,7 +57,7 @@ public class AssertUtil {
|
||||
errorMsg.append(violation.getPropertyPath().toString()).append(":").append(violation.getMessage()).append(",");
|
||||
}
|
||||
//去掉最后一个逗号
|
||||
throwException(errorMsg.toString().substring(0,errorMsg.length()-1));
|
||||
throwException(CommonErrorEnum.PARAM_VALID, errorMsg.toString().substring(0, errorMsg.length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user