121 lines
4.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.southern.power.grid.controller;
import com.southern.power.grid.common.Result;
import com.southern.power.grid.entity.*;
import com.southern.power.grid.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 配网抢修-Controller
*
* @author: junzhangfm
* @date: 2026/3/13
**/
@RestController
@RequestMapping("/api/v1/dner")
@Slf4j
public class DnerController {
@Autowired
private IDnerHourlyPowerOutageEventService dnerHourlyPowerOutageEventService;
@Autowired
private IDnerDailyPowerOutageEventService dnerDailyPowerOutageEventService;
@Autowired
private IDnerSiteAreaConfigurationService dnerSiteAreaConfigurationService;
@Autowired
private IDnerDailyPowerOutageEventSyncService dnerDailyPowerOutageEventSyncService;
@Autowired
private IRegionalWeatherDataService regionalWeatherDataService;
@Autowired
private DnerEventAttachmentService dnerEventAttachmentService;
@PostMapping("/area-tree/query")
public Result<List<AreaTreeVO>> queryAreaTree(@RequestBody @Valid AreaTreeReq req) {
return Result.success(dnerSiteAreaConfigurationService.queryAreaTree(req));
}
/**
* 分时图数据查询
*
* @param orgCode 地区编码
* @param startDate 开始时间
* @param endDate 结束时间
* @return 返回结果
*/
@GetMapping("/intraday/query")
public Result<HourlyPowerOutageEventChartVO> queryIntradayData(@RequestParam String orgCode,
@RequestParam String startDate,
@RequestParam String endDate,
@RequestParam String eventId) {
return Result.success(dnerHourlyPowerOutageEventService.queryIntradayData(
orgCode, startDate, endDate, eventId));
}
/**
* K线数据查询
*
* @param orgCode 地区编码
* @param startDate 开始时间
* @param endDate 结束时间
* @return 返回结果
*/
@GetMapping("/kline/query")
public Result<DailyPowerOutageEventVO> queryKlineData(@RequestParam String orgCode,
@RequestParam String startDate,
@RequestParam String endDate,
@RequestParam String eventId) {
return Result.success(dnerDailyPowerOutageEventService.queryKlineData(
orgCode, startDate, endDate, eventId));
}
/**
* 下载附件
*
* @param attachmentId 附件ID
* @return 响应体
*/
@GetMapping("/excel/download/{attachmentId}")
public ResponseEntity<Resource> downloadExcel(@PathVariable Long attachmentId) {
return dnerEventAttachmentService.downloadExcel(attachmentId);
}
/**
* 同步区域气象数据
*
* @param startDate 开始日期(数据示例2025-09-01 00:00:00)
* @param endDate 结束日期(数据示例2025-09-01 00:00:00)
* @return 结果 <字符串>
*/
@GetMapping("/sync/regionWeatherData")
public Result<String> syncRegionWeatherData(@RequestParam String startDate, @RequestParam String endDate) {
regionalWeatherDataService.syncOldWeatherData(startDate, endDate);
return Result.success("success");
}
/**
* 同步每日停电事件
*
* @param startDate 开始日期(数据示例2025-09-01)
* @param endDate 结束日期(数据示例2025-09-01)
* @param eventId 事件Id
* @return 结果 <布尔>
*/
@GetMapping("/sync/dailyPowerOutageEvent")
public Result<Boolean> syncDailyPowerOutageEvent(@RequestParam String startDate, @RequestParam String endDate, @RequestParam Long eventId) {
return Result.success(dnerDailyPowerOutageEventSyncService.processingData(startDate, endDate,eventId));
}
}