package com.moral.api.pojo.form.aqi;
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.moral.util.DateUtils;
|
import lombok.Data;
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import java.util.Date;
|
|
/**
|
* @ClassName QueryPollutionLevelsForPieChartFrom
|
* @Description TODO
|
* @Author 陈凯裕
|
* @Date 2021/11/11 8:37
|
* @Version TODO
|
**/
|
@Data
|
public class QueryPieChartOfPollutionLevelForm {
|
|
/*
|
* 地区码 必传
|
* */
|
Integer regionCode;
|
|
/*
|
* 自定义开始时间
|
* 非必传,当不传的时候默认获取今年的数据
|
* */
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
Date startDate;
|
|
/*
|
* 自定义结束时间
|
* */
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
Date endDate;
|
|
public boolean valid(){
|
if(regionCode==null)
|
return false;
|
//如果没有自定义时间,则开始时间设定为今年第一天,结束时间设定为昨天
|
if(startDate==null||endDate==null){
|
startDate = DateUtils.getFirstDayOfCurrYear();
|
endDate = DateUtils.getYesterdayDate();
|
}
|
return true;
|
}
|
}
|