Prechádzať zdrojové kódy

活动截止时间格式调整

codingliang 1 rok pred
rodič
commit
5882a0d1eb

+ 7 - 4
src/main/java/com/sqx/modules/activity/dto/ActivityDTO.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import javax.validation.Valid;
 import javax.validation.constraints.NotBlank;
@@ -52,14 +53,16 @@ public class ActivityDTO {
     @Pattern(regexp = "[1-4]", message = "活动类型只能为1-4")
     private String type;
 
-    @ApiModelProperty(value = "活动开始时间 yyyy-MM-dd", required = true)
+    @ApiModelProperty(value = "活动开始时间 yyyy-MM-dd HH:mm:ss", required = true)
     @NotNull(message = "活动开始时间不能为空")
-    @JsonFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date startTime;
 
-    @ApiModelProperty(value = "活动结束时间 yyy-MM-dd", required = true)
+    @ApiModelProperty(value = "活动结束时间 yyy-MM-dd HH:mm:ss", required = true)
     @NotNull(message = "活动结束时间不能为空")
-    @JsonFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date endTime;
 
     @Valid