Commit 03ad2373 by songyinghui

feature: 小程序兼容

parent 1ab951b6
......@@ -15,11 +15,6 @@ import java.util.Map;
public class MaterialAnalyzeDataQO extends MaterialStatisticsBaseQO {
private static final long serialVersionUID = 3422937373665522931L;
/**
* 时间筛选
* 1 过去7天(默认选中),2 过去30天,3 过去60天,4 过去90天,5本周,6 本月,7 上月,8 上上月,9 上上上月
*/
private Integer fixedDateDiff;
/**
* 排序字段
......
package com.gic.haoban.manage.web.qo.content.statistics;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.haoban.common.utils.DateUtil;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import java.util.Date;
/**
* @Author MUSI
......@@ -42,6 +47,12 @@ public class MaterialStatisticsBaseQO extends BasePageInfo {
*/
private String endDate;
/**
* 时间筛选
* 1 过去7天(默认选中),2 过去30天,3 过去60天,4 过去90天,5本周,6 本月,7 上月,8 上上月,9 上上上月
*/
private Integer fixedDateDiff;
public String getEnterpriseId() {
return enterpriseId;
......@@ -68,6 +79,12 @@ public class MaterialStatisticsBaseQO extends BasePageInfo {
}
public String getStartDate() {
if (StringUtils.isNotBlank(this.startDate)) {
return this.startDate;
}
if (this.fixedDateDiff != null) {
return convertStartDate(this.fixedDateDiff);
}
return startDate;
}
......@@ -76,10 +93,42 @@ public class MaterialStatisticsBaseQO extends BasePageInfo {
}
public String getEndDate() {
if (StringUtils.isBlank(this.endDate)) {
return DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
}
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String convertStartDate(Integer fixedDateDiff) {
if (fixedDateDiff == null) {
return null;
}
switch (fixedDateDiff) {
case 1:
return DateUtil.dateToStr(DateUtils.addDays(new Date(), -7), "yyyy-MM-dd");
case 2:
return DateUtil.dateToStr(DateUtils.addDays(new Date(), -30), "yyyy-MM-dd");
case 3:
return DateUtil.dateToStr(DateUtils.addDays(new Date(), -60), "yyyy-MM-dd");
case 4:
return DateUtil.dateToStr(DateUtils.addDays(new Date(), -90), "yyyy-MM-dd");
case 5:
return DateUtil.dateToStr(cn.hutool.core.date.DateUtil.beginOfWeek(new Date()), "yyyy-MM-dd");
case 6:
return DateUtil.dateToStr(cn.hutool.core.date.DateUtil.beginOfMonth(new Date()), "yyyy-MM-dd");
case 7:
return DateUtil.dateToStr(cn.hutool.core.date.DateUtil.lastMonth(), "yyyy-MM-dd");
case 8:
return DateUtil.dateToStr(cn.hutool.core.date.DateUtil.beginOfMonth(cn.hutool.core.date.DateUtil.offsetMonth(new Date(), -2)), "yyyy-MM-dd");
case 9:
return DateUtil.dateToStr(cn.hutool.core.date.DateUtil.beginOfMonth(cn.hutool.core.date.DateUtil.offsetMonth(new Date(), -3)), "yyyy-MM-dd");
default:
return null;
}
}
}
......@@ -15,11 +15,6 @@ import java.util.Map;
public class MaterialStoreAnalyzeDataQO extends MaterialStatisticsBaseQO {
private static final long serialVersionUID = 3422937373665522931L;
/**
* 时间筛选
* 1 过去7天(默认选中),2 过去30天,3 过去60天,4 过去90天,5本周,6 本月,7 上月,8 上上月,9 上上上月
*/
private Integer fixedDateDiff;
/**
* 排序字段
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment