DateVO.java 2.1 KB
package com.skua.modules.common.vo;

import com.skua.core.util.DateUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Data
public class DateVO {

    @ApiModelProperty(value = "去年(yyyy)")
    private int lastYear;

    @ApiModelProperty(value = "去年(yyyy-MM)")
    private String lastYearMonth;
    @ApiModelProperty(value = "去年(yyyy-MM-dd)")
    private String lastYearStartDate;
    @ApiModelProperty(value = "去年(yyyy-MM-dd)")
    private String lastYearEndDate;


    @ApiModelProperty(value = "上月(yyyy-MM)")
    private String lastMonth;

    @ApiModelProperty(value = "上月(yyyy-MM-dd)")
    private String lastMonthDay;


    @ApiModelProperty(value = "昨天")
    private String yesterday;

    @ApiModelProperty(value = "当月(yyyy)")
    private int nowYear;

    @ApiModelProperty(value = "当月(yyyy-MM)")
    private String nowMonth;

    @ApiModelProperty(value = "当月(yyyy-MM-dd)")
    private String nowMonthStartDate;

    @ApiModelProperty(value = "当月(yyyy-MM-dd)")
    private String nowMonthEndDate;

    @ApiModelProperty(value = "当月(yyyy-MM-dd)")
    private String nowYearStartDate;
    @ApiModelProperty(value = "当月(yyyy-MM-dd)")
    private String nowYearEndDate;


    public DateVO(String currentDate) {
        this.nowMonth = DateUtils.dateformat(currentDate,"yyyy-MM");
        this.nowMonthStartDate = nowMonth+"-01";
        this.nowMonthEndDate = nowMonth+"-31";


        //this.lastYear = getYear(nowMonth,"yyyy-MM")-1;
        //this.lastMonth = DateUtils.getLastMonthOfMonth(nowMonth);
        nowYear = Integer.parseInt( DateUtils.dateformat(currentDate,"yyyy") ) ;
        nowYearStartDate = nowYear + "-01-01";
        nowYearEndDate = nowYear + "-12-31";
    /*    this.lastMonthStartTime = lastMonth+"-01";
        this.lastMonthEndTime = lastMonth+"-31";

        this.lastYearStartTime = lastYear+"-01";
        this.lastYearEndTime = lastYear +"-31";*/
    }
}