package com.gyee.power.fitting.controller.gf; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.gyee.power.fitting.common.result.JsonResult; import com.gyee.power.fitting.common.result.ResultCode; import com.gyee.power.fitting.model.PhotovoltaicAnalysis; import com.gyee.power.fitting.model.ProBasicEquipment; import com.gyee.power.fitting.service.IPhotovoltaicAnalysisService; import com.gyee.power.fitting.service.ProBasicEquipmentService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** *
* 光伏分析 前端控制器 *
* * @author gfhd * @since 2023-10-13 */ @RestController @RequestMapping("/photovoltaic") public class PhotovoltaicAnalysisController { @Resource private IPhotovoltaicAnalysisService photovoltaicAnalysisService; @Resource private ProBasicEquipmentService proBasicEquipmentService; @GetMapping("/analysis") public JSONObject photovoltaicAnalysis( @RequestParam("stationId") String stationId, @RequestParam("time") String time, @RequestParam("timeType") String timeType) { Date date, startDate, endDate; if ("year".equals(timeType)) { date = DateUtil.parse(time, "yyyy"); startDate = DateUtil.beginOfYear(date); endDate = DateUtil.endOfYear(date); } else if ("month".equals(timeType)) { date = DateUtil.parse(time, "yyyy-MM"); startDate = DateUtil.beginOfMonth(date); endDate = DateUtil.endOfMonth(date); } else { date = DateUtil.parse(time); startDate = DateUtil.beginOfDay(date); endDate = DateUtil.endOfDay(date); } QueryWrapper