baoshiwei
2025-05-06 8dd7af51db4cf768fbf92002b5b62f7fb9d1c929
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package com.zhitan.web.controller.energydatastatistics;
 
import com.zhitan.common.annotation.Anonymous;
import com.zhitan.common.core.controller.BaseController;
import com.zhitan.common.core.domain.AjaxResult;
import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData;
import com.zhitan.energydata.service.IEnergyDataStatisticService;
import com.zhitan.energydata.vo.FactoryEnergyConsumptionVo;
import com.zhitan.energydata.vo.PurchaseConsumptionVo;
import com.zhitan.home.domain.vo.HomePeakValleyVO;
import com.zhitan.home.service.impl.IHomePageService;
import com.zhitan.peakvalley.domain.dto.PeakValleyDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Date;
import java.util.List;
 
/**
 * 能源数据综合分析
 *
 * @author ZhiTan
 * @date 2024-10-30
 */
@RestController
@RequestMapping("/energydatahomepage")
@Anonymous
public class EnergyDataStatisticsController extends BaseController
{
 
    @Autowired
    public IHomePageService homepageService;
 
    @Autowired
    private IEnergyDataStatisticService statisticService;
 
    /**
     * @description: 当日能耗统计
     * @return
     */
    @GetMapping("/energyConsumptionSummation/day")
    public AjaxResult energyConsumptionSummationDay() {
        try {
            String timeType = "DAY";
            String modelCode = "LBJT";
            return AjaxResult.success(homepageService.energyConsumptionSummation(timeType,modelCode));
        } catch (Exception ex) {
            logger.error("获取出错!", ex);
            return AjaxResult.error("获取出错!");
        }
    }
 
    /**
     * 电同环比分析
     * @param timeType:month、year
     * @return
     */
    @GetMapping("/energyConsumptionSummation")
    public AjaxResult energyConsumptionSummation(String timeType) {
        try {
            String modelCode = "LBJT";
            return AjaxResult.success(statisticService.energyConsumptionSummation(timeType,modelCode));
        } catch (Exception ex) {
            logger.error("获取出错!", ex);
            return AjaxResult.error("获取出错!");
        }
    }
 
    /**
     * @description: 各厂区当月能耗统计
     * @return
     */
    @GetMapping("/factoryEnergyConsumption")
    public AjaxResult factoryEnergyConsumption() {
        try {
            String timeType = "MONTH";
            String modelCode = "LBJT";
            FactoryEnergyConsumptionVo vo=statisticService.factoryEnergyConsumption(timeType,modelCode);
            return AjaxResult.success(vo);
        } catch (Exception ex) {
            logger.error("获取出错!", ex);
            return AjaxResult.error("获取出错!");
        }
    }
 
    /**
     * 用电趋势分析---按年:往前推12个月,每个月统计
     * @return
     */
    @GetMapping("/segmentAnalysis/year")
    public AjaxResult segmentAnalysisMonth() {
        PeakValleyDTO dto =new PeakValleyDTO();
        dto.setModelCode("LBJT");
        dto.setTimeType("YEAR");
        dto.setQueryTime(new Date());
        return AjaxResult.success(statisticService.segmentAnalysisMonth(dto));
    }
 
 
    /**
     * 用电趋势统计---按月
     * @return
     */
    @GetMapping("/segmentAnalysis/month")
    public AjaxResult segmentAnalysisDay() {
        PeakValleyDTO dto =new PeakValleyDTO();
        dto.setModelCode("LBJT");
        dto.setTimeType("MONTH");
        dto.setQueryTime(new Date());
        return AjaxResult.success(statisticService.segmentAnalysisDay(dto));
    }   
 
    /**
     * 用电趋势统计---按日
     * @return
     */
    @GetMapping("/segmentAnalysis/day")
    public AjaxResult segmentAnalysisHour() {
        PeakValleyDTO dto =new PeakValleyDTO();
        dto.setModelCode("LBJT");
        dto.setTimeType("DAY");
        dto.setQueryTime(new Date());
        return AjaxResult.success(statisticService.segmentAnalysisHour(dto));
    }
 
    /**
     * @description: 购入和消耗对比
     * @return
     */
    @GetMapping("/purchaseConsumption")
    public AjaxResult purchaseConsumption() {
        String timeType="MONTH";
        String modelCode = "LBJT";
        List<PurchaseConsumptionVo> consumptionAnalysisVO = statisticService.purchaseConsumption(modelCode,timeType);
        return AjaxResult.success(consumptionAnalysisVO);
    }
 
    /**
     * @description: 科室能耗排名
     * @return
     */
    @GetMapping("/energyConsumptionRanking")
    public AjaxResult energyConsumptionRanking(String timeType) {
        String modelCode = "LBJT";
        List<RankingEnergyData> consumptionAnalysisVO = statisticService.energyConsumptionRanking(modelCode,timeType);
        return AjaxResult.success(consumptionAnalysisVO);
    }
 
    /**
     * @description: 能源成本占比
     * @return
     */
    @GetMapping("/costProp")
    public AjaxResult costProp(String timeType) {
        String modelCode = "LBJT";
        List<PurchaseConsumptionVo> consumptionAnalysisVO = statisticService.costProp(modelCode, timeType);
        return AjaxResult.success(consumptionAnalysisVO);
 
    }
 
    /**
     * @description: 尖峰平谷占比
     * @param timeType
     */
    @GetMapping("/peakValley")
    public AjaxResult peakValley(String timeType) {
        try {
            String modelcode = "LBJT";
            List<HomePeakValleyVO> vo = homepageService.peakValley(timeType,modelcode);
            return AjaxResult.success(vo);
        } catch (Exception ex) {
            logger.error("获取出错!", ex);
            return AjaxResult.error("获取出错!");
        }
    }
}