package com.tievd.jyz.entity.vo;
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
import lombok.Data;
|
import lombok.experimental.Accessors;
|
|
import java.io.Serializable;
|
import java.time.temporal.ChronoField;
|
import java.util.function.Function;
|
|
/**
|
* <p>
|
* 加油记录表
|
* </p>
|
*
|
* @author
|
* @since 2023-02-24
|
*/
|
@Data
|
@Accessors(chain = true)
|
@Schema(name = "加油量")
|
public class DataStatisReqVo implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
@Schema(description = "开始时间")
|
private String startTime;
|
|
@Schema(description = "结束时间")
|
private String endTime;
|
|
@Schema(description = "活动前开始时间")
|
private String beforeStartTime;
|
|
@Schema(description = "活动前结束时间")
|
private String beforeEndTime;
|
|
@Schema(description = "活动后开始时间")
|
private String afterStartTime;
|
|
@Schema(description = "活动后结束时间")
|
private String afterEndTime;
|
|
public void setOrgCodeIfnull(String orgCode) {
|
if (this.orgCode == null || this.orgCode.equals("")){
|
this.orgCode = orgCode;
|
}
|
}
|
|
@Schema(description = "所属机构")
|
private String orgCode;
|
|
@Schema(description = "扇形图类型 1按车型/加油数(折线车流量) 2按车位/加油数(折线销量) 3车型/销量 4车位/销量 ")
|
private int type = 1;
|
|
@Schema(description = "趋势分析类型 0车流量 1加油数 2销量 3通过率 4客户 5流失率 ")
|
private TrendType trendType;
|
|
@Schema(description = "HOURS, DAYS, MONTHS")
|
private StatUnit timeUnit = StatUnit.HOURS;
|
|
private DataStatisReqVo setTimeUnit(String timeUnit){
|
this.timeUnit = StatUnit.valueOf(timeUnit);
|
return this;
|
}
|
|
public enum StatUnit {
|
|
HOURS("HOURS", 12, "HH:mm", ChronoField.MINUTE_OF_HOUR),
|
|
DAYS("DAYS", 14, "YYYY-MM-dd", ChronoField.HOUR_OF_DAY),
|
|
MONTHS("MONTHS", 12, "YYYY-MM", ChronoField.DAY_OF_MONTH);
|
|
String name;
|
|
int value;
|
|
String statFormat;
|
|
ChronoField initField;
|
|
StatUnit(String name, int value, String statFormat, ChronoField initField){
|
this.name = name;
|
this.value = value;
|
this.statFormat = statFormat;
|
this.initField = initField;
|
}
|
|
public Integer value() {
|
return this.value;
|
}
|
|
public String statFormat() {
|
return this.statFormat;
|
}
|
|
public ChronoField initField() {
|
return this.initField;
|
}
|
|
}
|
|
public enum TrendType {
|
TRAFFIC(1, StatDataTableVo::getCarCount, StatDataTableVo::getEntryRate, "车流量", "拐入率"),
|
OIL(2, StatDataTableVo::getOilCount, StatDataTableVo::getOilVolume, "加油数", "油品销量"),
|
OIL_vOLUME(3, StatDataTableVo::getOilVolume, t -> 100 * (t.getOilVolume() - t.getPreStatVo().getOilVolume()) / (t.getPreStatVo().getOilVolume() + 1), "油品销量", "环比"),
|
SPAND_AVG(4, StatDataTableVo::getSpandAvg, t -> 100 * (t.getSpandAvg() - t.getPreStatVo().getSpandAvg()) / (t.getPreStatVo().getSpandAvg() + 1), "通过率", "环比"),
|
CLIENT(5, null),
|
LOSE_CLIENT(6, null);
|
|
int val;
|
|
Function<?, ?> barFunc;
|
|
Function<?, ?> lineFunc;
|
|
String barName;
|
|
String lineName;
|
|
TrendType(int val, Function<StatDataTableVo, ?> barFunc, Function<StatDataTableVo, ?> lineFunc, String barName, String lineName) {
|
this.val = val;
|
this.barFunc = barFunc;
|
this.lineFunc = lineFunc;
|
this.barName = barName;
|
this.lineName = lineName;
|
}
|
|
TrendType(int val, Function<OilStatisVo, ?> barFunc) {
|
this.val = val;
|
this.barFunc = barFunc;
|
}
|
|
public Function<?, ?> getBarFunc() {
|
return barFunc;
|
}
|
|
public Function<?, ?> getLineFunc() {
|
return lineFunc;
|
}
|
|
public String getBarName() {
|
return barName;
|
}
|
|
public String getLineName() {
|
return lineName;
|
}
|
}
|
}
|