ustcyc
2025-01-07 de5d55508afd27fb2b47e6d4d6fd9984525c222c
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
93
94
95
package com.zhitan.realtimedata.domain;
 
import com.zhitan.common.annotation.Excel;
import com.zhitan.common.core.domain.BaseEntity;
import com.zhitan.common.utils.DateUtils;
import lombok.Data;
 
import java.util.Date;
 
@Data
public class StatisticResult extends BaseEntity {
  /**
   * 指标主键
   */
  @Excel(name = "指标主键")
  private String indexId;
  /**
   * 指标编码
   */
  @Excel(name = "指标编码")
  private String indexCode;
  /**
   * 指标名称
   */
  @Excel(name = "指标名称")
  private String indexName;
  /**
   * 单位主键
   */
  @Excel(name = "单位主键")
  private String unitId;
  /**
   * 数据时间
   */
  @Excel(name = "数据时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
  private Date dataTime;
  /**
   * 本期值
   */
  @Excel(name = "本期值")
  private double currentValue;
  /**
   * 上期值
   */
  @Excel(name = "上期值")
  private double previousValue;
  /**
   * 同期值
   */
  @Excel(name = "同期值")
  private double lastYearValue;
  /**
   * 最大值
   */
  @Excel(name = "最大值")
  private double maxValue;
  /**
   * 最小值
   */
  @Excel(name = "最小值")
  private double minValue;
  /**
   * 平均值
   */
  @Excel(name = "平均值")
  private double avgValue;
  //时间
  private String formatdate;
 
  public void setFormatdate(String formatdate) {
    this.formatdate = DateUtils.parseDateToStr(formatdate,this.dataTime);
  }
 
  /**
   * 同比.
   */
  public double getYoy() {
    if (lastYearValue != 0) {
      return (currentValue - lastYearValue) / lastYearValue * 100;
    }
    return 0;
  }
 
  /**
   * 环比.
   * @return
   */
  public double getQoq() {
    if (previousValue != 0) {
      return (currentValue - previousValue) / previousValue * 100;
    }
    return 0;
  }
 
}