|
@@ -11,6 +11,8 @@ import lombok.Builder;
|
|
|
import lombok.Data;
|
|
|
import lombok.NoArgsConstructor;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.joda.time.DateTime;
|
|
|
+import org.joda.time.Days;
|
|
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
import javax.validation.constraints.NotNull;
|
|
@@ -18,6 +20,7 @@ import java.io.Serializable;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
/**
|
|
@@ -28,20 +31,20 @@ import java.util.Optional;
|
|
|
public class DegreeWrapper {
|
|
|
|
|
|
@Data
|
|
|
- @Builder
|
|
|
+ @Builder
|
|
|
@NoArgsConstructor
|
|
|
@AllArgsConstructor
|
|
|
@ApiModel(" DegreeQuery-考级信息")
|
|
|
public static class DegreeQuery implements QueryInfo {
|
|
|
-
|
|
|
- @ApiModelProperty("当前页")
|
|
|
+
|
|
|
+ @ApiModelProperty("当前页")
|
|
|
private Integer page;
|
|
|
|
|
|
@ApiModelProperty("分页行数")
|
|
|
private Integer rows;
|
|
|
|
|
|
@ApiModelProperty("考级名称/编号")
|
|
|
- private String keyword;
|
|
|
+ private String keyword;
|
|
|
|
|
|
|
|
|
@ApiModelProperty("开始时间")
|
|
@@ -101,7 +104,7 @@ public class DegreeWrapper {
|
|
|
}
|
|
|
|
|
|
@Data
|
|
|
- @ApiModel(" Degree-考级信息")
|
|
|
+ @ApiModel(" Degree-考级信息")
|
|
|
public static class Degree {
|
|
|
|
|
|
|
|
@@ -146,6 +149,8 @@ public class DegreeWrapper {
|
|
|
@ApiModelProperty("报名状态 NOT_START:未开始,START:报名中,END:报名结束")
|
|
|
private EDegreeStatus status;
|
|
|
|
|
|
+ @ApiModelProperty("倒计时开始天数")
|
|
|
+ private Integer startDays;
|
|
|
|
|
|
public String jsonString() {
|
|
|
return JSON.toJSONString(this);
|
|
@@ -154,7 +159,17 @@ public class DegreeWrapper {
|
|
|
public static Degree from(String json) {
|
|
|
return JSON.parseObject(json, Degree.class);
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ public Integer getStartDays() {
|
|
|
+ if (Objects.nonNull(getStartTime()) && EDegreeStatus.NOT_START == getStatus()) {
|
|
|
+
|
|
|
+ DateTime now = DateTime.now().withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
|
|
|
+ // 计算与当前时间相差天数
|
|
|
+ return Days.daysBetween(now, new DateTime(getStartTime())).getDays();
|
|
|
+ }
|
|
|
+ return Optional.ofNullable(startDays).orElse(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@Data
|
|
|
@ApiModel(" DegreeStatistical-考级信息统计")
|