cjl
2023-11-08 0e4aa8d08a3bf8e8683d05081baefdbf96ce080f
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.moral.api.pojo.form.dataDisplay;
 
import com.fasterxml.jackson.annotation.JsonFormat;
import com.moral.constant.Constants;
import com.moral.util.DateUtils;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
 
import java.util.Date;
import java.util.List;
 
/**
 * @ClassName MonitorPointDataDisplayForm
 * @Description TODO
 * @Author 陈凯裕
 * @Date 2021/9/26 10:03
 * @Version TODO
 **/
@Data
public class MonitorPointDataDisplayForm {
 
    /*
     * 站点id
     */
//    private Integer monitorPointId;
 
 
    /**
     * mac号
     */
    private List<String>  macs;
 
    /*
     * 开始时间
     * */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH")
    @JsonFormat(pattern = "yyyy-MM-dd HH", timezone = "GMT+8")
    private Date startTime;
 
    /*
     * 结束时间
     * */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH")
    @JsonFormat(pattern = "yyyy-MM-dd HH", timezone = "GMT+8")
    private Date endTime;
 
    /*
     * 时报,日报,周报,月报类型
     * */
    private String reportType;
 
    /*
     * 检测数据是否有效
     * */
//    public boolean valid() {
//        if (monitorPointId == null)
//           return false;
//        if (reportType == null) {
//            if (startTime == null || endTime == null)
//                return false;
//            //结束时间获取当天最后一个小时
//            String endTimeStr = DateUtils.dateToDateString(endTime,"yyyy-MM-dd");
//            endTimeStr+=" 23:59:59";
//            endTime = DateUtils.getDate(endTimeStr,"yyyy-MM-dd HH:mm:ss");
//        } else {
//            if(startTime!=null&&endTime!=null)
//                return false;
//            if (reportType.equals(Constants.HOURLY_REPORT)) {
//                //时报选项默认为上个小时的数据
//                Date previousHour = DateUtils.getDateOfMin(new Date(), -60);
//                startTime = DateUtils.getHourlyStartTime(previousHour);
//            } else if (reportType.equals(Constants.DAILY_REPORT)) {
//                //日报选项默认为昨天的数据
//                Date yesterday = DateUtils.getDateOfDay(new Date(),-1);
//                startTime = DateUtils.getDailyStartTime(yesterday);
//            } else if (reportType.equals(Constants.WEEKLY_REPORT)) {
//                //周报选项默认为上周的数据
//                Date previous = DateUtils.getDateOfDay(new Date(),-7);
//                startTime = DateUtils.getWeeklyStartTime(previous);
//                endTime = DateUtils.getWeeklyEndTime(previous);
//            } else if (reportType.equals(Constants.MONTHLY_REPORT)) {
//                //月报选项默认为上月的数据
//                Date lastMonthFirstDay = DateUtils.getFirstDayOfLastMonth();
//                startTime = DateUtils.getMonthlyStartTime(lastMonthFirstDay);
//                endTime = DateUtils.getMonthlyEndTime(lastMonthFirstDay);
//            } else
//                return false;
//        }
//        return true;
//    }
 
}