package com.moral.api.pojo.form.dataDisplay; import com.moral.constant.Constants; import com.moral.util.DateUtils; import lombok.Data; import java.util.Date; import java.util.List; /** * @ClassName SensorComparsionDisplayForm * @Description 监测因子对比图请求实体 * @Author 陈凯裕 * @Date 2021/10/8 14:18 * @Version TODO **/ @Data public class SensorComparisonDisplayForm { private String mac; private String reportType; private String time; private List sensors; /* * 该属性不由前端传递,由time和reportType进行计算 * */ private Date startDate; /* * 该属性不由前端传递,由time和reportType进行计算 * */ private Date endDate; public boolean valid(){ if(mac==null||reportType==null||time==null||sensors==null) return false; if(reportType.equals(Constants.DAILY_REPORT)){ Date date = DateUtils.getDate(time,"yyyy-MM-dd"); startDate = DateUtils.getDailyStartTime(date); endDate = DateUtils.getDailyEndTime(date); }else if(reportType.equals(Constants.MONTHLY_REPORT)){ Date date = DateUtils.getDate(time,"yyyy-MM"); startDate = DateUtils.getMonthlyStartTime(date); endDate = DateUtils.getMonthlyEndTime(date); }else return false; return true; } }