kaiyu
2021-11-12 6a8b22c541448dbe15eb1b046dbf456131c2f325
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
    }
}