huliguo
2 天以前 8115295a64e0809246897fefb8c45de06dce0799
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
package com.ruoyi.other.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.Logical;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.other.api.domain.TNotice;
import com.ruoyi.other.api.domain.TScreenContent;
import com.ruoyi.other.api.dto.NoticeQueryDto;
import com.ruoyi.other.service.TNoticeService;
import com.ruoyi.other.service.TScreenContentService;
import com.ruoyi.other.util.EnergyRefreshService;
import com.ruoyi.other.vo.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huliguo
 * @since 2025/5/23
 */
@RestController
@RequestMapping("/t_screen_content")
public class TScreenContentController {
 
    @Resource
    private TScreenContentService screenContentService;
    @Resource
    private EnergyRefreshService energyRefreshService;
 
    /**
     * 顶部-累计电量
     */
    @ApiOperation(tags = {"顶部-累计电量"},value = "充电桩数据大屏")
    @GetMapping(value = "/top")
    public AjaxResult<ScreenTopVO> top(@RequestParam("siteIds") List<Integer> siteIds) {
        return AjaxResult.success(screenContentService.top(siteIds));
    }
 
    /**
     * 光伏发电和消纳  这里的绿电是调后台大屏内容管理的
     */
    @ApiOperation(tags = {"光伏发电和消纳"},value = "充电桩数据大屏")
    @GetMapping(value = "/photovoltaicAndConsumption")
    public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() {
        //需调用接口 获取光伏发电量
 
        return AjaxResult.success(new PhotovoltaicAndConsumptionVO());
    }
 
 
    /**
     * 累计减排数据
     */
    @ApiOperation(tags = {"减排数据"},value = "充电桩数据大屏")
    @GetMapping(value = "/emissionReduction")
    public AjaxResult<EmissionReductionVO> emissionReduction (@RequestParam("siteIds") List<Integer> siteIds) {
        return AjaxResult.success( screenContentService.emissionReduction(siteIds));
    }
    /**
     * 光伏发电实时情况
     */
    @ApiOperation(tags = {"光伏发电实时情况"},value = "充电桩数据大屏")
    @GetMapping(value = "/photovoltaicPowerGeneration")
    public AjaxResult<PhotovoltaicPowerGenerationVO> photovoltaicPowerGeneration (@RequestParam("siteIds") List<Integer> siteIds) {
        return AjaxResult.success( screenContentService.photovoltaicPowerGeneration(siteIds));
    }
 
    /**
     * 储能放电情况
     */
    @ApiOperation(tags = {"储能放电情况"},value = "充电桩数据大屏")
    @GetMapping(value = "/energyStorageDischarge")
    public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() {
        //需调用接口 获取光伏发电量
        EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO();
        vo.setTodayDischarge(energyRefreshService.getCurrentValue());
        return AjaxResult.success(vo);
    }
 
 
 
    /**
     * 停车场共享情况及相关数据
     */
    @ApiOperation(tags = {"停车场共享情况及相关数据"},value = "充电桩数据大屏")
    @GetMapping(value = "/screen")
    public AjaxResult<TScreenContent> screen(@RequestParam("siteIds") List<Integer> siteIds) {
        List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds));
        TScreenContent tScreenContent = new TScreenContent();
        if(list==null|| list.isEmpty()){
            return AjaxResult.success(tScreenContent);
        }
        BeanUtils.copyProperties( list.get(0),tScreenContent);
        list.remove(0);
        list.forEach(x->{
            tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge()));
            tScreenContent.setGreenElectricity(tScreenContent.getGreenElectricity().add(x.getGreenElectricity()));
            tScreenContent.setGreenElectricityToday(tScreenContent.getGreenElectricityToday().add(x.getGreenElectricityToday()));
            tScreenContent.setValueOne(tScreenContent.getValueOne().add(x.getValueOne()));
            tScreenContent.setValueTwo(tScreenContent.getValueTwo().add(x.getValueTwo()));
            tScreenContent.setValueThree(tScreenContent.getValueThree().add(x.getValueThree()));
            if(tScreenContent.getStatisticalDeadline().isBefore(x.getStatisticalDeadline())) tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline());
        });
        return AjaxResult.success(tScreenContent);
    }
 
    /**
     * 数据回显 站点id
     */
    //todo 鉴权
    @RequiresPermissions(value = {"/publicAnnouncementManagement"}, logical = Logical.OR)
    @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "查询")
    @GetMapping(value = "/{siteId}")
    public AjaxResult<TScreenContent> detail(@PathVariable("siteId") Integer siteId) {
        TScreenContent one = screenContentService.getOne(new LambdaQueryWrapper<TScreenContent>().eq(TScreenContent::getSiteId, siteId));
        return AjaxResult.success(one);
    }
 
    /**
     * 新增修改
     */
    //todo 鉴权
    @RequiresPermissions(value = {"",""}, logical = Logical.OR)
    @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "新增修改")
    @PostMapping(value = "/saveOrUpdate")
    @Log(title = "【大屏管理】新增修改内容", businessType = BusinessType.INSERT)
    public AjaxResult saveOrUpdate(@RequestBody TScreenContent screenContent) {
        screenContentService.saveOrUpdate(screenContent);
        return AjaxResult.success();
    }
}