huliguo
8 天以前 568eac31d05d075075a69285a2c77b2d3afec23e
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java
@@ -19,6 +19,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
@@ -54,8 +55,18 @@
    @GetMapping(value = "/photovoltaicAndConsumption")
    public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() {
        //需调用接口 获取光伏发电量
        return AjaxResult.success(new PhotovoltaicAndConsumptionVO());
        List<Integer> siteIds= Arrays.asList(25,26);
        PhotovoltaicAndConsumptionVO vo = new PhotovoltaicAndConsumptionVO();
        List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds));
        if(list==null|| list.isEmpty()){
            return AjaxResult.success(vo);
        }
        vo.setGreenElectricityToday(list.get(0).getGreenElectricityToday());
        list.remove(0);
        list.forEach(x->{
            vo.setGreenElectricityToday(vo.getGreenElectricityToday().add(x.getGreenElectricityToday()));
        });
        return AjaxResult.success(vo);
    }