2026-03-24提交:首页事件部分功能;查询图接口新增故障停电和计划停电用户,以及提示框汇总数据;
This commit is contained in:
parent
d962cae2da
commit
b69dc1e3b4
@ -0,0 +1,68 @@
|
|||||||
|
package com.southern.power.grid.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.southern.power.grid.common.Result;
|
||||||
|
import com.southern.power.grid.entity.DnerEvent;
|
||||||
|
import com.southern.power.grid.entity.DnerEventVO;
|
||||||
|
import com.southern.power.grid.service.DnerEventService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配网抢修事件 控制层
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1/event")
|
||||||
|
public class DnerEventController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DnerEventService dnerEventService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<Boolean> add(@RequestBody DnerEvent event) {
|
||||||
|
return Result.success(dnerEventService.save(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除事件(级联删除附件、导出记录)
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public Result<Boolean> delete(@PathVariable Long id) {
|
||||||
|
return Result.success(dnerEventService.removeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改事件
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<Boolean> update(@RequestBody DnerEvent event) {
|
||||||
|
return Result.success(dnerEventService.updateById(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询事件
|
||||||
|
*/
|
||||||
|
@GetMapping("/get/{id}")
|
||||||
|
public DnerEvent getById(@PathVariable Long id) {
|
||||||
|
return dnerEventService.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有事件
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<DnerEventVO>> list() {
|
||||||
|
return Result.success(dnerEventService.listVO());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.southern.power.grid.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.southern.power.grid.entity.DnerEventAttachment;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件附件 Mapper
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface DnerEventAttachmentMapper extends BaseMapper<DnerEventAttachment> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.southern.power.grid.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.southern.power.grid.entity.DnerEventExportRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件导出记录 Mapper
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface DnerEventExportRecordMapper extends BaseMapper<DnerEventExportRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.southern.power.grid.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.southern.power.grid.entity.DnerEvent;
|
||||||
|
import com.southern.power.grid.entity.DnerEventVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配网抢修事件 Mapper
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface DnerEventMapper extends BaseMapper<DnerEvent> {
|
||||||
|
/**
|
||||||
|
* 查询事件列表,包含事件、附件信息
|
||||||
|
*
|
||||||
|
* @return 事件列表
|
||||||
|
*/
|
||||||
|
List<DnerEventVO> listVO();
|
||||||
|
}
|
||||||
@ -80,6 +80,36 @@ public class AreaTreeReq {
|
|||||||
*/
|
*/
|
||||||
Double pastTimePowerOutageRatioCount;
|
Double pastTimePowerOutageRatioCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未来XX小时/天
|
||||||
|
*/
|
||||||
|
Integer rainFutureTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未来XX小时/天的累计降雨量超过的mm
|
||||||
|
*/
|
||||||
|
Double futureTimeRainCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未来XX小时/天
|
||||||
|
*/
|
||||||
|
Integer futureTempPastTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未来XX小时/天的平均气温超过的℃
|
||||||
|
*/
|
||||||
|
Double futureTimeAvgTempCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未来XX小时/天
|
||||||
|
*/
|
||||||
|
Integer futureWindPastTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未来XX小时/天的极大风速超过的m/s
|
||||||
|
*/
|
||||||
|
Double futureTimeMaxWindCount;
|
||||||
|
|
||||||
// ============== 其他属性 ============
|
// ============== 其他属性 ============
|
||||||
/**
|
/**
|
||||||
* 是否开启高级筛选 0-未开启 1-开启
|
* 是否开启高级筛选 0-未开启 1-开启
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.southern.power.grid.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* K线图单个时间点汇总对象
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/24
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class DailyChartCollectVO {
|
||||||
|
/**
|
||||||
|
* 日累计停电影响数
|
||||||
|
*/
|
||||||
|
private Integer userCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障停电影响用户总数
|
||||||
|
*/
|
||||||
|
private Integer faultUserCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划停电影响用户数
|
||||||
|
*/
|
||||||
|
private Integer scheduledUserCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* K线数组,每一项包含起始值、结束值、最低、最高
|
||||||
|
*/
|
||||||
|
private List<Integer> klineObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近5/10/20/30日其下各县区23时停电用户数累加/县数量
|
||||||
|
*/
|
||||||
|
private Integer ma5Obj;
|
||||||
|
private Integer ma10Obj;
|
||||||
|
private Integer ma20Obj;
|
||||||
|
private Integer ma30Obj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日累计降雨量
|
||||||
|
*/
|
||||||
|
private Double cumulativeRainObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平均降雨量
|
||||||
|
*/
|
||||||
|
private Double avgRainObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平均气温
|
||||||
|
*/
|
||||||
|
private Double avgTempObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大气温
|
||||||
|
*/
|
||||||
|
private Double maxTempObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最低气温
|
||||||
|
*/
|
||||||
|
private Double minTempObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 风速
|
||||||
|
*/
|
||||||
|
private Double windSpeedObj;
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.southern.power.grid.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +23,16 @@ public class DailyPowerOutageEventVO {
|
|||||||
*/
|
*/
|
||||||
private List<Integer> userCounts;
|
private List<Integer> userCounts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障停电影响用户总数
|
||||||
|
*/
|
||||||
|
private List<Integer> faultUserCountList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划停电影响用户数
|
||||||
|
*/
|
||||||
|
private List<Integer> scheduledUserCountList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* K线数组,每一项包含起始值、结束值、最低、最高
|
* K线数组,每一项包含起始值、结束值、最低、最高
|
||||||
*/
|
*/
|
||||||
@ -64,4 +75,26 @@ public class DailyPowerOutageEventVO {
|
|||||||
* 风速
|
* 风速
|
||||||
*/
|
*/
|
||||||
private List<Double> windSpeed;
|
private List<Double> windSpeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汇总集合
|
||||||
|
*/
|
||||||
|
List<DailyChartCollectVO> collectVOList;
|
||||||
|
|
||||||
|
public void initList() {
|
||||||
|
kline = new ArrayList<>();
|
||||||
|
userCounts = new ArrayList<>();
|
||||||
|
cumulativeRain = new ArrayList<>();
|
||||||
|
avgRain = new ArrayList<>();
|
||||||
|
avgTemp = new ArrayList<>();
|
||||||
|
maxTemp = new ArrayList<>();
|
||||||
|
minTemp = new ArrayList<>();
|
||||||
|
windSpeed = new ArrayList<>();
|
||||||
|
ma5 = new ArrayList<>();
|
||||||
|
ma10 = new ArrayList<>();
|
||||||
|
ma20 = new ArrayList<>();
|
||||||
|
ma30 = new ArrayList<>();
|
||||||
|
faultUserCountList = new ArrayList<>();
|
||||||
|
scheduledUserCountList = new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,6 +93,16 @@ public class DnerDailyPowerOutageEvent {
|
|||||||
*/
|
*/
|
||||||
private Integer maxUserCount;
|
private Integer maxUserCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障停电影响用户总数
|
||||||
|
*/
|
||||||
|
private Integer faultUserCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划停电影响用户数
|
||||||
|
*/
|
||||||
|
private Integer scheduledUserCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停电状态(1-待停电;2-停电中;3-已复电)
|
* 停电状态(1-待停电;2-停电中;3-已复电)
|
||||||
*/
|
*/
|
||||||
|
|||||||
56
src/main/java/com/southern/power/grid/entity/DnerEvent.java
Normal file
56
src/main/java/com/southern/power/grid/entity/DnerEvent.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package com.southern.power.grid.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配网抢修事件主表
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("dner_event")
|
||||||
|
public class DnerEvent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件名称
|
||||||
|
*/
|
||||||
|
private String eventName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件描述
|
||||||
|
*/
|
||||||
|
private String eventDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.southern.power.grid.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件附件表
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("dner_event_attachment")
|
||||||
|
public class DnerEventAttachment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联事件ID
|
||||||
|
*/
|
||||||
|
private Long eventId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件存储路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件大小(字节)
|
||||||
|
*/
|
||||||
|
private Long fileSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否最新附件(1:是 0:否)
|
||||||
|
*/
|
||||||
|
private Integer isLatest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传人
|
||||||
|
*/
|
||||||
|
private String creator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
package com.southern.power.grid.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件导出记录表
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("dner_event_export_record")
|
||||||
|
public class DnerEventExportRecord {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出记录ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联事件ID
|
||||||
|
*/
|
||||||
|
private Long eventId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime exportTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出人
|
||||||
|
*/
|
||||||
|
private String exporter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出文件名
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出文件类型
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.southern.power.grid.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配网抢修事件VO
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class DnerEventVO {
|
||||||
|
/**
|
||||||
|
* 事件ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件名称
|
||||||
|
*/
|
||||||
|
private String eventName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件描述
|
||||||
|
*/
|
||||||
|
private String eventDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
// ========================= 附件信息 ===================================
|
||||||
|
/**
|
||||||
|
* 附件ID
|
||||||
|
*/
|
||||||
|
private Long attachmentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型
|
||||||
|
*/
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
// =========================== 导出图表记录 =====================================
|
||||||
|
/**
|
||||||
|
* 导出图表记录
|
||||||
|
*/
|
||||||
|
private List<DnerEventExportRecord> eventExportRecordList;
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.southern.power.grid.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分时图单个时间点汇总对象
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/24
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class HourlyChartCollectVO {
|
||||||
|
/**
|
||||||
|
* 停电影响用户总数
|
||||||
|
*/
|
||||||
|
private Integer powerOutageUserCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平均气温
|
||||||
|
*/
|
||||||
|
private Double avgTem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小时最大气温
|
||||||
|
*/
|
||||||
|
private Double maxTem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小时最低气温
|
||||||
|
*/
|
||||||
|
private Double minTem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小时降雨量
|
||||||
|
*/
|
||||||
|
private Double prec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小时极大风速
|
||||||
|
*/
|
||||||
|
private Double wind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障停电影响用户总数
|
||||||
|
*/
|
||||||
|
private Integer faultUserCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划停电影响用户数
|
||||||
|
*/
|
||||||
|
private Integer scheduledUserCount;
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.southern.power.grid.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +23,16 @@ public class HourlyPowerOutageEventChartVO {
|
|||||||
*/
|
*/
|
||||||
private List<Integer> powerOutageUserCountList;
|
private List<Integer> powerOutageUserCountList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障停电影响用户总数
|
||||||
|
*/
|
||||||
|
private List<Integer> faultUserCountList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划停电影响用户数
|
||||||
|
*/
|
||||||
|
private List<Integer> scheduledUserCountList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平均气温
|
* 平均气温
|
||||||
*/
|
*/
|
||||||
@ -46,4 +57,20 @@ public class HourlyPowerOutageEventChartVO {
|
|||||||
* 小时极大风速
|
* 小时极大风速
|
||||||
*/
|
*/
|
||||||
private List<Double> windList;
|
private List<Double> windList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汇总集合
|
||||||
|
*/
|
||||||
|
private List<HourlyChartCollectVO> collectVOList;
|
||||||
|
|
||||||
|
public void initList() {
|
||||||
|
powerOutageUserCountList = new ArrayList<>();
|
||||||
|
faultUserCountList = new ArrayList<>();
|
||||||
|
scheduledUserCountList = new ArrayList<>();
|
||||||
|
avgTemList = new ArrayList<>();
|
||||||
|
maxTemList = new ArrayList<>();
|
||||||
|
minTemList = new ArrayList<>();
|
||||||
|
precList = new ArrayList<>();
|
||||||
|
windList = new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.southern.power.grid.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.southern.power.grid.entity.DnerEventAttachment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件附件 服务接口
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
public interface DnerEventAttachmentService extends IService<DnerEventAttachment> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.southern.power.grid.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.southern.power.grid.entity.DnerEventExportRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件导出记录 服务接口
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
public interface DnerEventExportRecordService extends IService<DnerEventExportRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.southern.power.grid.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.southern.power.grid.entity.DnerEvent;
|
||||||
|
import com.southern.power.grid.entity.DnerEventVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配网抢修事件 服务接口
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
public interface DnerEventService extends IService<DnerEvent> {
|
||||||
|
/**
|
||||||
|
* 查询事件列表
|
||||||
|
*
|
||||||
|
* @return 事件列表
|
||||||
|
*/
|
||||||
|
List<DnerEventVO> listVO();
|
||||||
|
}
|
||||||
@ -2,10 +2,12 @@ package com.southern.power.grid.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.southern.power.grid.dao.DnerDailyPowerOutageEventMapper;
|
import com.southern.power.grid.dao.DnerDailyPowerOutageEventMapper;
|
||||||
|
import com.southern.power.grid.entity.DailyChartCollectVO;
|
||||||
import com.southern.power.grid.entity.DailyPowerOutageEventVO;
|
import com.southern.power.grid.entity.DailyPowerOutageEventVO;
|
||||||
import com.southern.power.grid.entity.DnerDailyPowerOutageEvent;
|
import com.southern.power.grid.entity.DnerDailyPowerOutageEvent;
|
||||||
import com.southern.power.grid.service.IDnerDailyPowerOutageEventService;
|
import com.southern.power.grid.service.IDnerDailyPowerOutageEventService;
|
||||||
import com.southern.power.grid.utils.TimeUtil;
|
import com.southern.power.grid.utils.TimeUtil;
|
||||||
|
import lombok.NonNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -34,69 +36,77 @@ public class DnerDailyPowerOutageEventServiceImpl
|
|||||||
orgCode, beforeNumDays, endDate);
|
orgCode, beforeNumDays, endDate);
|
||||||
Map<String, DnerDailyPowerOutageEvent> dateTimeAndEntityMap = dataList.stream().collect(Collectors.toMap(
|
Map<String, DnerDailyPowerOutageEvent> dateTimeAndEntityMap = dataList.stream().collect(Collectors.toMap(
|
||||||
DnerDailyPowerOutageEvent::getDataTime, Function.identity(), (k1, k2) -> k1));
|
DnerDailyPowerOutageEvent::getDataTime, Function.identity(), (k1, k2) -> k1));
|
||||||
List<List<Integer>> kline = new ArrayList<>();
|
DailyPowerOutageEventVO result = new DailyPowerOutageEventVO();
|
||||||
List<Integer> userCounts = new ArrayList<>();
|
result.initList();
|
||||||
List<Double> cumulativeRain = new ArrayList<>();
|
|
||||||
List<Double> avgRain = new ArrayList<>();
|
|
||||||
List<Double> avgTemp = new ArrayList<>();
|
|
||||||
List<Double> maxTemp = new ArrayList<>();
|
|
||||||
List<Double> minTemp = new ArrayList<>();
|
|
||||||
List<Double> windSpeed = new ArrayList<>();
|
|
||||||
List<Integer> ma5List = new ArrayList<>();
|
|
||||||
List<Integer> ma10List = new ArrayList<>();
|
|
||||||
List<Integer> ma20List = new ArrayList<>();
|
|
||||||
List<Integer> ma30List = new ArrayList<>();
|
|
||||||
List<String> dateTimeList = TimeUtil.getBetweenDates(startDate, endDate); // 获取开始时间到结束时间每一天的数组
|
List<String> dateTimeList = TimeUtil.getBetweenDates(startDate, endDate); // 获取开始时间到结束时间每一天的数组
|
||||||
dateTimeList.forEach(e -> { // 遍历开始时间和结束时间的日期
|
dateTimeList.forEach(e -> { // 遍历开始时间和结束时间的日期
|
||||||
DnerDailyPowerOutageEvent event = dateTimeAndEntityMap.get(e);
|
DnerDailyPowerOutageEvent event = dateTimeAndEntityMap.get(e);
|
||||||
if (Objects.isNull(event)) { // 数据为空,全部默认为0值
|
if (Objects.isNull(event)) { // 数据为空,全部默认为0值
|
||||||
List<Integer> klineE = Arrays.asList(0, 0, 0, 0);
|
setZeroData(result);
|
||||||
kline.add(klineE);
|
} else { // 数据不为空,正常赋值
|
||||||
cumulativeRain.add(0.0);
|
setDailyData(event, result, dateTimeAndEntityMap);
|
||||||
avgRain.add(0.0);
|
|
||||||
avgTemp.add(0.0);
|
|
||||||
maxTemp.add(0.0);
|
|
||||||
minTemp.add(0.0);
|
|
||||||
ma5List.add(0);
|
|
||||||
ma10List.add(0);
|
|
||||||
ma20List.add(0);
|
|
||||||
ma30List.add(0);
|
|
||||||
windSpeed.add(0.0);
|
|
||||||
userCounts.add(0);
|
|
||||||
} else {
|
|
||||||
List<Integer> klineE = Arrays.asList(event.getStarUserCount(), event.getEndUserCount(),
|
|
||||||
event.getMinUserCount(), event.getMaxUserCount());
|
|
||||||
kline.add(klineE);
|
|
||||||
cumulativeRain.add(Double.valueOf(event.getDailyPrecipitation()));
|
|
||||||
avgRain.add(Double.valueOf(event.getHourlyPrecipitation()));
|
|
||||||
avgTemp.add(Double.valueOf(event.getTemperature()));
|
|
||||||
maxTemp.add(Double.valueOf(event.getHourlyMaxTemperature()));
|
|
||||||
minTemp.add(Double.valueOf(event.getHourlyMinTemperature()));
|
|
||||||
ma5List.add(getMa(event, dateTimeAndEntityMap, 5));
|
|
||||||
ma10List.add(getMa(event, dateTimeAndEntityMap, 10));
|
|
||||||
ma20List.add(getMa(event, dateTimeAndEntityMap, 20));
|
|
||||||
ma30List.add(getMa(event, dateTimeAndEntityMap, 30));
|
|
||||||
windSpeed.add(Double.valueOf(event.getExtremeWindSpeedHourly()));
|
|
||||||
userCounts.add(event.getUserCount());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DailyPowerOutageEventVO result = new DailyPowerOutageEventVO();
|
result.setFullDates(dateTimeList.stream().map(
|
||||||
result.setFullDates(dateTimeList); // 日期列表
|
e -> e.replace("-", "/")).collect(Collectors.toList())); // 日期列表
|
||||||
result.setKline(kline); // K线数组,每一项包含起始值、结束值、最低、最高
|
result.setCollectVOList(getCollectVOList(result));
|
||||||
result.setCumulativeRain(cumulativeRain); // 日累计降雨量
|
|
||||||
result.setAvgRain(avgRain); // 平均降雨量
|
|
||||||
result.setAvgTemp(avgTemp); // 平均气温
|
|
||||||
result.setMaxTemp(maxTemp); // 最大气温
|
|
||||||
result.setMinTemp(minTemp); // 最低气温
|
|
||||||
result.setMa5(ma5List); // ma5
|
|
||||||
result.setMa10(ma10List);
|
|
||||||
result.setMa20(ma20List);
|
|
||||||
result.setMa30(ma30List);
|
|
||||||
result.setWindSpeed(windSpeed);
|
|
||||||
result.setUserCounts(userCounts);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static @NonNull List<DailyChartCollectVO> getCollectVOList(DailyPowerOutageEventVO result) {
|
||||||
|
List<DailyChartCollectVO> collectVOList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < result.getUserCounts().size(); i++) {
|
||||||
|
collectVOList.add(new DailyChartCollectVO().setUserCount(result.getUserCounts().get(i))
|
||||||
|
.setKlineObj(result.getKline().get(i)).setMa5Obj(result.getMa5().get(i))
|
||||||
|
.setMa10Obj(result.getMa10().get(i)).setMa20Obj(result.getMa20().get(i))
|
||||||
|
.setMa30Obj(result.getMa30().get(i)).setCumulativeRainObj(result.getCumulativeRain().get(i))
|
||||||
|
.setAvgRainObj(result.getAvgRain().get(i)).setAvgTempObj(result.getAvgTemp().get(i))
|
||||||
|
.setMaxTempObj(result.getMaxTemp().get(i)).setMinTempObj(result.getMinTemp().get(i))
|
||||||
|
.setWindSpeedObj(result.getWindSpeed().get(i))
|
||||||
|
.setFaultUserCount(result.getFaultUserCountList().get(i))
|
||||||
|
.setScheduledUserCount(result.getScheduledUserCountList().get(i)));
|
||||||
|
}
|
||||||
|
return collectVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setDailyData(DnerDailyPowerOutageEvent event, DailyPowerOutageEventVO result,
|
||||||
|
Map<String, DnerDailyPowerOutageEvent> dateTimeAndEntityMap) {
|
||||||
|
List<Integer> klineE = Arrays.asList(event.getStarUserCount(), event.getEndUserCount(),
|
||||||
|
event.getMinUserCount(), event.getMaxUserCount());
|
||||||
|
result.getKline().add(klineE);
|
||||||
|
result.getCumulativeRain().add(Double.valueOf(event.getDailyPrecipitation()));
|
||||||
|
result.getAvgRain().add(Double.valueOf(event.getHourlyPrecipitation()));
|
||||||
|
result.getAvgTemp().add(Double.valueOf(event.getTemperature()));
|
||||||
|
result.getMaxTemp().add(Double.valueOf(event.getHourlyMaxTemperature()));
|
||||||
|
result.getMinTemp().add(Double.valueOf(event.getHourlyMinTemperature()));
|
||||||
|
result.getMa5().add(getMa(event, dateTimeAndEntityMap, 5));
|
||||||
|
result.getMa10().add(getMa(event, dateTimeAndEntityMap, 10));
|
||||||
|
result.getMa20().add(getMa(event, dateTimeAndEntityMap, 20));
|
||||||
|
result.getMa30().add(getMa(event, dateTimeAndEntityMap, 30));
|
||||||
|
result.getWindSpeed().add(Double.valueOf(event.getExtremeWindSpeedHourly()));
|
||||||
|
result.getUserCounts().add(event.getUserCount());
|
||||||
|
result.getFaultUserCountList().add(event.getFaultUserCount());
|
||||||
|
result.getScheduledUserCountList().add(event.getScheduledUserCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setZeroData(DailyPowerOutageEventVO result) {
|
||||||
|
List<Integer> klineE = Arrays.asList(0, 0, 0, 0);
|
||||||
|
result.getKline().add(klineE);
|
||||||
|
result.getCumulativeRain().add(0.0);
|
||||||
|
result.getAvgRain().add(0.0);
|
||||||
|
result.getAvgTemp().add(0.0);
|
||||||
|
result.getMaxTemp().add(0.0);
|
||||||
|
result.getMinTemp().add(0.0);
|
||||||
|
result.getMa5().add(0);
|
||||||
|
result.getMa10().add(0);
|
||||||
|
result.getMa20().add(0);
|
||||||
|
result.getMa30().add(0);
|
||||||
|
result.getWindSpeed().add(0.0);
|
||||||
|
result.getUserCounts().add(0);
|
||||||
|
result.getFaultUserCountList().add(0);
|
||||||
|
result.getScheduledUserCountList().add(0);
|
||||||
|
}
|
||||||
|
|
||||||
private static int getMa(DnerDailyPowerOutageEvent event,
|
private static int getMa(DnerDailyPowerOutageEvent event,
|
||||||
Map<String, DnerDailyPowerOutageEvent> dateTimeAndEntityMap,
|
Map<String, DnerDailyPowerOutageEvent> dateTimeAndEntityMap,
|
||||||
int maNum) {
|
int maNum) {
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.southern.power.grid.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.southern.power.grid.dao.DnerEventAttachmentMapper;
|
||||||
|
import com.southern.power.grid.entity.DnerEventAttachment;
|
||||||
|
import com.southern.power.grid.service.DnerEventAttachmentService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件附件 服务实现类
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class DnerEventAttachmentServiceImpl
|
||||||
|
extends ServiceImpl<DnerEventAttachmentMapper, DnerEventAttachment>
|
||||||
|
implements DnerEventAttachmentService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.southern.power.grid.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.southern.power.grid.dao.DnerEventExportRecordMapper;
|
||||||
|
import com.southern.power.grid.entity.DnerEventExportRecord;
|
||||||
|
import com.southern.power.grid.service.DnerEventExportRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件导出记录 服务实现类
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class DnerEventExportRecordServiceImpl
|
||||||
|
extends ServiceImpl<DnerEventExportRecordMapper, DnerEventExportRecord>
|
||||||
|
implements DnerEventExportRecordService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package com.southern.power.grid.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.southern.power.grid.dao.DnerEventExportRecordMapper;
|
||||||
|
import com.southern.power.grid.dao.DnerEventMapper;
|
||||||
|
import com.southern.power.grid.entity.DnerEvent;
|
||||||
|
import com.southern.power.grid.entity.DnerEventExportRecord;
|
||||||
|
import com.southern.power.grid.entity.DnerEventVO;
|
||||||
|
import com.southern.power.grid.service.DnerEventService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配网抢修事件 服务实现类
|
||||||
|
*
|
||||||
|
* @author: junzhangfm
|
||||||
|
* @date: 2026/3/23
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class DnerEventServiceImpl extends ServiceImpl<DnerEventMapper, DnerEvent>
|
||||||
|
implements DnerEventService {
|
||||||
|
@Autowired
|
||||||
|
private DnerEventMapper dnerEventMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DnerEventExportRecordMapper dnerEventExportRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DnerEventVO> listVO() {
|
||||||
|
List<DnerEventVO> dnerEventVOS = dnerEventMapper.listVO();
|
||||||
|
if (!CollectionUtil.isEmpty(dnerEventVOS)) {
|
||||||
|
List<DnerEventExportRecord> dnerEventExportRecords = dnerEventExportRecordMapper.selectList(
|
||||||
|
new QueryWrapper<DnerEventExportRecord>().in("event_id",
|
||||||
|
dnerEventVOS.stream().map(DnerEventVO::getId).collect(Collectors.toList())));
|
||||||
|
// 结果按eventId分组获取map
|
||||||
|
Map<Long, List<DnerEventExportRecord>> groupMap = dnerEventExportRecords.stream().collect(
|
||||||
|
Collectors.groupingBy(DnerEventExportRecord::getEventId));
|
||||||
|
// map中的value要按导出时间倒叙排列
|
||||||
|
groupMap.values().forEach(list -> list.sort((
|
||||||
|
a1, a2) -> a2.getExportTime().compareTo(a1.getExportTime())));
|
||||||
|
// 塞入导出记录
|
||||||
|
dnerEventVOS.forEach(e -> {
|
||||||
|
e.setEventExportRecordList(groupMap.get(e.getId()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return dnerEventVOS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,12 +3,11 @@ package com.southern.power.grid.service.impl;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.southern.power.grid.dao.DnerHourlyPowerOutageEventMapper;
|
import com.southern.power.grid.dao.DnerHourlyPowerOutageEventMapper;
|
||||||
import com.southern.power.grid.entity.DnerHourlyPowerOutageEvent;
|
import com.southern.power.grid.entity.DnerHourlyPowerOutageEvent;
|
||||||
|
import com.southern.power.grid.entity.HourlyChartCollectVO;
|
||||||
import com.southern.power.grid.entity.HourlyPowerOutageEventChartVO;
|
import com.southern.power.grid.entity.HourlyPowerOutageEventChartVO;
|
||||||
import com.southern.power.grid.service.IDnerHourlyPowerOutageEventService;
|
import com.southern.power.grid.service.IDnerHourlyPowerOutageEventService;
|
||||||
import com.southern.power.grid.utils.TimeUtil;
|
import com.southern.power.grid.utils.TimeUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -31,9 +30,6 @@ public class DnerHourlyPowerOutageEventServiceImpl
|
|||||||
@Resource
|
@Resource
|
||||||
private DnerHourlyPowerOutageEventMapper dnerHourlyPowerOutageEventMapper;
|
private DnerHourlyPowerOutageEventMapper dnerHourlyPowerOutageEventMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HourlyPowerOutageEventChartVO queryIntradayData(String orgCode, String startDate, String endDate) {
|
public HourlyPowerOutageEventChartVO queryIntradayData(String orgCode, String startDate, String endDate) {
|
||||||
startDate = startDate.substring(0, 13) + ":00";
|
startDate = startDate.substring(0, 13) + ":00";
|
||||||
@ -42,45 +38,52 @@ public class DnerHourlyPowerOutageEventServiceImpl
|
|||||||
orgCode, startDate, endDate);
|
orgCode, startDate, endDate);
|
||||||
Map<String, DnerHourlyPowerOutageEvent> dateTimeAndEntityMap = dataList.stream().collect(Collectors.toMap(
|
Map<String, DnerHourlyPowerOutageEvent> dateTimeAndEntityMap = dataList.stream().collect(Collectors.toMap(
|
||||||
DnerHourlyPowerOutageEvent::getDataTime, Function.identity(), (k1, k2) -> k1));
|
DnerHourlyPowerOutageEvent::getDataTime, Function.identity(), (k1, k2) -> k1));
|
||||||
List<Integer> powerOutageUserCountList = new ArrayList<>();
|
HourlyPowerOutageEventChartVO result = new HourlyPowerOutageEventChartVO();
|
||||||
List<Double> avgTemList = new ArrayList<>();
|
result.initList();
|
||||||
List<Double> maxTemList = new ArrayList<>();
|
|
||||||
List<Double> minTemList = new ArrayList<>();
|
|
||||||
List<Double> precList = new ArrayList<>();
|
|
||||||
List<Double> windList = new ArrayList<>();
|
|
||||||
List<String> dateTimeList = TimeUtil.generateHourListAll(startDate, endDate); // 获取开始时间到结束时间的小时数组
|
List<String> dateTimeList = TimeUtil.generateHourListAll(startDate, endDate); // 获取开始时间到结束时间的小时数组
|
||||||
dateTimeList.forEach(e -> {
|
dateTimeList.forEach(e -> {
|
||||||
DnerHourlyPowerOutageEvent event = dateTimeAndEntityMap.get(e);
|
DnerHourlyPowerOutageEvent event = dateTimeAndEntityMap.get(e);
|
||||||
if (Objects.isNull(event)) { // 数据为空,全部默认为0值
|
if (Objects.isNull(event)) { // 数据为空,全部默认为0值
|
||||||
powerOutageUserCountList.add(0); // 停电影响用户总数
|
setZeroData(result);
|
||||||
avgTemList.add(0.0); // 平均气温
|
|
||||||
maxTemList.add(0.0); // 小时最大气温
|
|
||||||
minTemList.add(0.0); // 小时最低气温
|
|
||||||
precList.add(0.0); // 小时降雨量
|
|
||||||
windList.add(0.0); // 小时极大风速
|
|
||||||
} else {
|
} else {
|
||||||
powerOutageUserCountList.add(event.getUserCount()); // 停电影响用户总数
|
setHourlyData(result, event);
|
||||||
avgTemList.add(Double.valueOf(event.getTemperature())); // 平均气温
|
|
||||||
maxTemList.add(Double.valueOf(event.getHourlyMaxTemperature())); // 小时最大气温
|
|
||||||
minTemList.add(Double.valueOf(event.getHourlyMinTemperature())); // 小时最低气温
|
|
||||||
precList.add(Double.valueOf(event.getHourlyPrecipitation())); // 小时降雨量
|
|
||||||
windList.add(Double.valueOf(event.getExtremeWindSpeedHourly())); // 小时极大风速
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
HourlyPowerOutageEventChartVO result = new HourlyPowerOutageEventChartVO();
|
|
||||||
result.setDateList(TimeUtil.generateHourList(startDate, endDate)); // 日期列表
|
result.setDateList(TimeUtil.generateHourList(startDate, endDate)); // 日期列表
|
||||||
result.setPowerOutageUserCountList(powerOutageUserCountList);
|
List<HourlyChartCollectVO> collectVOList = new ArrayList<>();
|
||||||
result.setAvgTemList(avgTemList);
|
for (int i = 0; i < result.getPowerOutageUserCountList().size(); i++) {
|
||||||
result.setMaxTemList(maxTemList);
|
collectVOList.add(new HourlyChartCollectVO()
|
||||||
result.setMinTemList(minTemList);
|
.setPowerOutageUserCount(result.getPowerOutageUserCountList().get(i))
|
||||||
result.setPrecList(precList);
|
.setAvgTem(result.getAvgTemList().get(i)).setMaxTem(result.getMaxTemList().get(i))
|
||||||
result.setWindList(windList);
|
.setMinTem(result.getMinTemList().get(i)).setPrec(result.getPrecList().get(i))
|
||||||
|
.setWind(result.getWindList().get(i)).setFaultUserCount(result.getFaultUserCountList().get(i))
|
||||||
|
.setScheduledUserCount(result.getScheduledUserCountList().get(i)));
|
||||||
|
}
|
||||||
|
result.setCollectVOList(collectVOList);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void setHourlyData(HourlyPowerOutageEventChartVO result, DnerHourlyPowerOutageEvent event) {
|
||||||
|
result.getPowerOutageUserCountList().add(event.getUserCount()); // 停电影响用户总数
|
||||||
|
result.getFaultUserCountList().add(event.getFaultUserCount()); // 故障停电影响用户总数
|
||||||
|
result.getScheduledUserCountList().add(event.getScheduledUserCount()); // 计划停电影响用户总数
|
||||||
|
result.getAvgTemList().add(Double.valueOf(event.getTemperature())); // 平均气温
|
||||||
|
result.getMaxTemList().add(Double.valueOf(event.getHourlyMaxTemperature())); // 小时最大气温
|
||||||
|
result.getMinTemList().add(Double.valueOf(event.getHourlyMinTemperature())); // 小时最低气温
|
||||||
|
result.getPrecList().add(Double.valueOf(event.getHourlyPrecipitation())); // 小时降雨量
|
||||||
|
result.getWindList().add(Double.valueOf(event.getExtremeWindSpeedHourly())); // 小时极大风速
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setZeroData(HourlyPowerOutageEventChartVO result) {
|
||||||
|
result.getPowerOutageUserCountList().add(0); // 停电影响用户总数
|
||||||
|
result.getFaultUserCountList().add(0); // 故障停电影响用户总数
|
||||||
|
result.getScheduledUserCountList().add(0); // 计划停电影响用户总数
|
||||||
|
result.getAvgTemList().add(0.0); // 平均气温
|
||||||
|
result.getMaxTemList().add(0.0); // 小时最大气温
|
||||||
|
result.getMinTemList().add(0.0); // 小时最低气温
|
||||||
|
result.getPrecList().add(0.0); // 小时降雨量
|
||||||
|
result.getWindList().add(0.0); // 小时极大风速
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,14 +44,11 @@ public class DnerSiteAreaConfigurationServiceImpl
|
|||||||
List<DnerSiteAreaConfiguration> dataList;
|
List<DnerSiteAreaConfiguration> dataList;
|
||||||
if (ChartQueryTypeEnum.HOURLY_CHART.getCode().equals(req.getQueryType())) {
|
if (ChartQueryTypeEnum.HOURLY_CHART.getCode().equals(req.getQueryType())) {
|
||||||
// 分时图
|
// 分时图
|
||||||
handleAdvancedFilter(req); // 分时图高级筛选处理
|
handleHourlyAdvancedFilter(req); // 分时图高级筛选处理
|
||||||
dataList = dnerSiteAreaConfigurationMapper.selectHourlyChartAreaTree(req);
|
dataList = dnerSiteAreaConfigurationMapper.selectHourlyChartAreaTree(req);
|
||||||
} else {
|
} else {
|
||||||
// 日K图
|
// 日K图
|
||||||
if ("1".equals(req.getAdvancedFilterFlag())) {
|
handleDailyAdvancedFilter(req); // 日K图高级筛选处理
|
||||||
req.setCurrentDateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
|
||||||
// TODO 日K图高级筛选待完善
|
|
||||||
}
|
|
||||||
dataList = dnerSiteAreaConfigurationMapper.selectDailyChartAreaTree(req);
|
dataList = dnerSiteAreaConfigurationMapper.selectDailyChartAreaTree(req);
|
||||||
}
|
}
|
||||||
// 最终树
|
// 最终树
|
||||||
@ -65,7 +62,37 @@ public class DnerSiteAreaConfigurationServiceImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleAdvancedFilter(AreaTreeReq req) {
|
private void handleDailyAdvancedFilter(AreaTreeReq req) {
|
||||||
|
if ("1".equals(req.getAdvancedFilterFlag())) {
|
||||||
|
String currentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
req.setCurrentDateTime(currentDate);
|
||||||
|
if (!Objects.isNull(req.getRainPastTime()) && req.getRainPastTime() != 0) {
|
||||||
|
req.setRainStartDateTime(TimeUtil.getBeforeDate(currentDate, req.getRainPastTime()));
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(req.getAvgTempPastTime()) && req.getAvgTempPastTime() != 0) {
|
||||||
|
req.setAvgTempStartDateTime(TimeUtil.getBeforeDate(currentDate, req.getAvgTempPastTime()));
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(req.getMaxWindPastTime()) && req.getMaxWindPastTime() != 0) {
|
||||||
|
req.setMaxWindStartDateTime(TimeUtil.getBeforeDate(currentDate, req.getMaxWindPastTime()));
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(req.getPowerOutageTimePastTime()) && req.getPowerOutageTimePastTime() != 0) {
|
||||||
|
req.setPowerOutageTimeStartDateTime(
|
||||||
|
TimeUtil.getBeforeDate(currentDate, req.getPowerOutageTimePastTime()));
|
||||||
|
req.setPastTimePowerOutageTimeCount(Math.round(
|
||||||
|
req.getPastTimePowerOutageTimeCount() * 60 * 100) / 100.00); // 小时转分钟,四舍五入,取小数点后两位
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(req.getPowerOutageUserPastTime()) && req.getPowerOutageUserPastTime() != 0) {
|
||||||
|
req.setPowerOutageUserStartDateTime(
|
||||||
|
TimeUtil.getBeforeDate(currentDate, req.getPowerOutageUserPastTime()));
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(req.getPowerOutageRatioPastTime()) && req.getPowerOutageRatioPastTime() != 0) {
|
||||||
|
req.setPowerOutageRatioStartDateTime(
|
||||||
|
TimeUtil.getBeforeDate(currentDate, req.getPowerOutageRatioPastTime()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleHourlyAdvancedFilter(AreaTreeReq req) {
|
||||||
if ("1".equals(req.getAdvancedFilterFlag())) {
|
if ("1".equals(req.getAdvancedFilterFlag())) {
|
||||||
String currentDateTime = LocalDateTime.now() // 获取当前时间
|
String currentDateTime = LocalDateTime.now() // 获取当前时间
|
||||||
.withMinute(0) // 分钟设置为0
|
.withMinute(0) // 分钟设置为0
|
||||||
@ -109,6 +136,10 @@ public class DnerSiteAreaConfigurationServiceImpl
|
|||||||
if (!provinceCodeAndProvinceMap.containsKey(pCode)) { // 判断是否创建省节点
|
if (!provinceCodeAndProvinceMap.containsKey(pCode)) { // 判断是否创建省节点
|
||||||
AreaTreeVO province = new AreaTreeVO();
|
AreaTreeVO province = new AreaTreeVO();
|
||||||
province.setValue(pCode);
|
province.setValue(pCode);
|
||||||
|
// 去掉最后一个省字
|
||||||
|
if ("省".equals(pName.charAt(pName.length() - 1) + "")) {
|
||||||
|
pName = pName.substring(0, pName.length() - 1);
|
||||||
|
}
|
||||||
province.setLabel(pName);
|
province.setLabel(pName);
|
||||||
province.setChildren(new ArrayList<>());
|
province.setChildren(new ArrayList<>());
|
||||||
provinceCodeAndProvinceMap.put(pCode, province);
|
provinceCodeAndProvinceMap.put(pCode, province);
|
||||||
@ -134,7 +165,11 @@ public class DnerSiteAreaConfigurationServiceImpl
|
|||||||
if (!cityCodeAndCityMap.containsKey(cCode)) { // 判断是否创建市节点
|
if (!cityCodeAndCityMap.containsKey(cCode)) { // 判断是否创建市节点
|
||||||
AreaTreeVO city = new AreaTreeVO();
|
AreaTreeVO city = new AreaTreeVO();
|
||||||
city.setValue(cCode);
|
city.setValue(cCode);
|
||||||
city.setLabel(cName);
|
// 去掉最后一个市字
|
||||||
|
if ("市".equals(cName.charAt(cName.length() - 1) + "")) {
|
||||||
|
cName = cName.substring(0, cName.length() - 1);
|
||||||
|
}
|
||||||
|
city.setLabel(cName + "供电局");
|
||||||
city.setChildren(new ArrayList<>());
|
city.setChildren(new ArrayList<>());
|
||||||
cityCodeAndCityMap.put(cCode, city);
|
cityCodeAndCityMap.put(cCode, city);
|
||||||
// 挂到省份下
|
// 挂到省份下
|
||||||
@ -154,7 +189,10 @@ public class DnerSiteAreaConfigurationServiceImpl
|
|||||||
|
|
||||||
AreaTreeVO district = new AreaTreeVO();
|
AreaTreeVO district = new AreaTreeVO();
|
||||||
district.setValue(dCode);
|
district.setValue(dCode);
|
||||||
district.setLabel(dName);
|
if ("区".equals(dName.charAt(dName.length() - 1) + "")) {
|
||||||
|
dName = dName.substring(0, dName.length() - 1);
|
||||||
|
}
|
||||||
|
district.setLabel(dName + "供电局");
|
||||||
|
|
||||||
// 挂到对应市下面
|
// 挂到对应市下面
|
||||||
AreaTreeVO city = cityMap.get(pCode).get(cCode);
|
AreaTreeVO city = cityMap.get(pCode).get(cCode);
|
||||||
|
|||||||
@ -17,12 +17,14 @@ public class TimeUtil {
|
|||||||
// 完整格式:年月日 时分
|
// 完整格式:年月日 时分
|
||||||
private static final DateTimeFormatter FULL = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
private static final DateTimeFormatter FULL = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
|
private static final DateTimeFormatter FULL_HOUR = DateTimeFormatter.ofPattern("yyyy/MM/dd HH时");
|
||||||
|
|
||||||
// 仅小时格式
|
// 仅小时格式
|
||||||
private static final DateTimeFormatter HOUR = DateTimeFormatter.ofPattern("HH:mm");
|
private static final DateTimeFormatter HOUR = DateTimeFormatter.ofPattern("dd日HH时");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取开始时间到结束时间的小时数组,仅当天的第一条数据会展示年月日
|
* 获取开始时间到结束时间的小时数组,仅当天的第一条数据会展示年月日
|
||||||
* 比如[2026-03-13 22:00, 23:00, 2026-03-14 00:00, 01:00]
|
* 比如[2026/03/13/22, 13/23, 2026/03/14/00, 14/01]
|
||||||
*
|
*
|
||||||
* @param startTime 开始时间
|
* @param startTime 开始时间
|
||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
@ -42,7 +44,7 @@ public class TimeUtil {
|
|||||||
while (!current.isAfter(end)) {
|
while (!current.isAfter(end)) {
|
||||||
// 第一次 或 日期发生变化(跨天0点)→ 显示完整年月日
|
// 第一次 或 日期发生变化(跨天0点)→ 显示完整年月日
|
||||||
if (preDate == null || !current.toLocalDate().equals(preDate.toLocalDate())) {
|
if (preDate == null || !current.toLocalDate().equals(preDate.toLocalDate())) {
|
||||||
result.add(current.format(FULL));
|
result.add(current.format(FULL_HOUR));
|
||||||
} else {
|
} else {
|
||||||
// 同一天 → 只显示小时
|
// 同一天 → 只显示小时
|
||||||
result.add(current.format(HOUR));
|
result.add(current.format(HOUR));
|
||||||
@ -139,13 +141,25 @@ public class TimeUtil {
|
|||||||
return beforeHour.format(formatter);
|
return beforeHour.format(formatter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取前n天的时间
|
||||||
|
*
|
||||||
|
* @param dayTime 指定时间,比如2026-03-17
|
||||||
|
* @param beforeDayNum 前n天,比如2
|
||||||
|
* @return 前n天的日期,比如2026-03-15
|
||||||
|
*/
|
||||||
|
public static String getBeforeDate(String dayTime, int beforeDayNum) {
|
||||||
|
return LocalDate.parse(dayTime).minusDays(beforeDayNum).toString();
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// List<String> strings = generateHourList("2026-03-13 22:00", "2026-03-14 01:00");
|
// List<String> strings = generateHourList("2026-03-13 22:00", "2026-03-14 01:00");
|
||||||
// List<String> strings = getBetweenDates("2026-03-10", "2026-03-14");
|
// List<String> strings = getBetweenDates("2026-03-10", "2026-03-14");
|
||||||
// String strings = getBeforeNumDays("2026-03-15", 5);
|
// String strings = getBeforeNumDays("2026-03-15", 5);
|
||||||
// String beforeHourTime = getBeforeHourTime("2026-03-17 11:00", 2);
|
// String beforeHourTime = getBeforeHourTime("2026-03-17 11:00", 2);
|
||||||
// System.out.println(beforeHourTime);
|
// System.out.println(beforeHourTime);
|
||||||
System.out.println(Math.round(123.1278 * 1000) / 1000.0);
|
// System.out.println(getBeforeDate("2026-03-20", 2));
|
||||||
|
System.out.println(Math.round(12.12345 * 100) / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
select `id`, `org_code`, `data_time`, `hourly_precipitation`, `daily_precipitation`, `temperature`,
|
select `id`, `org_code`, `data_time`, `hourly_precipitation`, `daily_precipitation`, `temperature`,
|
||||||
`hourly_max_temperature`, `hourly_min_temperature`, `extreme_wind_speed_hourly`, `user_count`,
|
`hourly_max_temperature`, `hourly_min_temperature`, `extreme_wind_speed_hourly`, `user_count`,
|
||||||
`star_user_count`, `end_user_count`, `min_user_count`, `max_user_count`, `outage_state`, `outage_type`,
|
`star_user_count`, `end_user_count`, `min_user_count`, `max_user_count`, `outage_state`, `outage_type`,
|
||||||
`create_by`, `create_time`, `update_by`, `update_time`
|
`create_by`, `create_time`, `update_by`, `update_time`, `fault_user_count`, `scheduled_user_count`
|
||||||
from dner_daily_power_outage_event
|
from dner_daily_power_outage_event
|
||||||
where org_code = #{orgCode}
|
where org_code = #{orgCode}
|
||||||
and data_time >= #{startDate}
|
and data_time >= #{startDate}
|
||||||
|
|||||||
15
src/main/resources/mapper/DnerEventMapper.xml
Normal file
15
src/main/resources/mapper/DnerEventMapper.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<!-- namespace 必须 = Mapper 接口全类名 -->
|
||||||
|
<mapper namespace="com.southern.power.grid.dao.DnerEventMapper">
|
||||||
|
<select id="listVO" resultType="com.southern.power.grid.entity.DnerEventVO">
|
||||||
|
select t1.id, t1.event_name, t1.event_desc, t1.create_time, t1.create_by, t1.update_by, t1.update_time,
|
||||||
|
t2.id as attachment_id, t2.file_name, t2.file_type
|
||||||
|
from dner_event t1
|
||||||
|
left join dner_event_attachment t2
|
||||||
|
on t1.id = t2.event_id and t2.is_latest = 1
|
||||||
|
order by t1.create_time desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -7,7 +7,8 @@
|
|||||||
<select id="selectListByConditions" resultType="com.southern.power.grid.entity.DnerHourlyPowerOutageEvent">
|
<select id="selectListByConditions" resultType="com.southern.power.grid.entity.DnerHourlyPowerOutageEvent">
|
||||||
select `id`, `org_code`, `data_time`, `hourly_precipitation`, `daily_precipitation`, `temperature`,
|
select `id`, `org_code`, `data_time`, `hourly_precipitation`, `daily_precipitation`, `temperature`,
|
||||||
`hourly_max_temperature`, `hourly_min_temperature`, `extreme_wind_speed_hourly`, `user_count`,
|
`hourly_max_temperature`, `hourly_min_temperature`, `extreme_wind_speed_hourly`, `user_count`,
|
||||||
`outage_state`, `outage_type`, `create_by`, `create_time`, `update_by`, `update_time`
|
`outage_state`, `outage_type`, `create_by`, `create_time`, `update_by`, `update_time`,
|
||||||
|
`fault_user_count`, `scheduled_user_count`
|
||||||
from dner_hourly_power_outage_event
|
from dner_hourly_power_outage_event
|
||||||
where org_code = #{orgCode}
|
where org_code = #{orgCode}
|
||||||
and data_time >= #{startDate}
|
and data_time >= #{startDate}
|
||||||
|
|||||||
@ -107,6 +107,74 @@
|
|||||||
t1.id, t1.province, t1.province_code, t1.city, t1.city_code, t1.district, t1.district_code,
|
t1.id, t1.province, t1.province_code, t1.city, t1.city_code, t1.district, t1.district_code,
|
||||||
t1.create_by, t1.create_time, t1.update_by, t1.update_time
|
t1.create_by, t1.create_time, t1.update_by, t1.update_time
|
||||||
FROM dner_site_area_configuration t1
|
FROM dner_site_area_configuration t1
|
||||||
WHERE EXISTS (select 1 from dner_daily_power_outage_event t2 where t1.district_code = t2.org_code);
|
where 1=1
|
||||||
|
<choose>
|
||||||
|
<when test="param.advancedFilterFlag == 1">
|
||||||
|
<if test="param.rainPastTime != null and param.rainPastTime != 0">
|
||||||
|
# 过去 X 天累计日降雨量超过 Y mm
|
||||||
|
AND EXISTS (
|
||||||
|
select 1
|
||||||
|
from dner_daily_power_outage_event t2
|
||||||
|
where t1.district_code = t2.org_code
|
||||||
|
and t2.data_time >= #{param.rainStartDateTime}
|
||||||
|
and t2.data_time <![CDATA[ < ]]> #{param.currentDateTime}
|
||||||
|
having sum(t2.daily_precipitation) > #{param.pastTimeRainCount})
|
||||||
|
</if>
|
||||||
|
<if test="param.avgTempPastTime != null and param.avgTempPastTime != 0">
|
||||||
|
# 过去X天的平均气温超过 Y ℃
|
||||||
|
AND EXISTS (
|
||||||
|
select 1
|
||||||
|
from dner_daily_power_outage_event t2
|
||||||
|
where t1.district_code = t2.org_code
|
||||||
|
and t2.data_time >= #{param.avgTempStartDateTime}
|
||||||
|
and t2.data_time <![CDATA[ < ]]> #{param.currentDateTime}
|
||||||
|
and t2.temperature > #{param.pastTimeAvgTempCount})
|
||||||
|
</if>
|
||||||
|
<if test="param.maxWindPastTime != null and param.maxWindPastTime != 0">
|
||||||
|
# 过去X天的平均风速超过Y m/s
|
||||||
|
AND EXISTS (
|
||||||
|
select 1
|
||||||
|
from dner_daily_power_outage_event t2
|
||||||
|
where t1.district_code = t2.org_code
|
||||||
|
and t2.data_time >= #{param.maxWindStartDateTime}
|
||||||
|
and t2.data_time <![CDATA[ < ]]> #{param.currentDateTime}
|
||||||
|
and t2.extreme_wind_speed_hourly > #{param.pastTimeMaxWindCount})
|
||||||
|
</if>
|
||||||
|
<if test="param.powerOutageTimePastTime != null and param.powerOutageTimePastTime != 0">
|
||||||
|
# 过去X小时的停电时长超Y小时
|
||||||
|
AND EXISTS (
|
||||||
|
select 1
|
||||||
|
from dner_daily_power_outage_event t2
|
||||||
|
where t1.district_code = t2.org_code
|
||||||
|
and t2.data_time >= #{param.powerOutageTimeStartDateTime}
|
||||||
|
and t2.data_time <![CDATA[ < ]]> #{param.currentDateTime}
|
||||||
|
having sum(t2.power_outage_duration) > #{param.pastTimePowerOutageTimeCount})
|
||||||
|
</if>
|
||||||
|
<if test="param.powerOutageUserPastTime != null and param.powerOutageUserPastTime != 0">
|
||||||
|
# 过去X天的停电用户数超过Y户
|
||||||
|
AND EXISTS (
|
||||||
|
select 1
|
||||||
|
from dner_daily_power_outage_event t2
|
||||||
|
where t1.district_code = t2.org_code
|
||||||
|
and t2.data_time >= #{param.powerOutageUserStartDateTime}
|
||||||
|
and t2.data_time <![CDATA[ < ]]> #{param.currentDateTime}
|
||||||
|
having sum(t2.user_count) > #{param.pastTimePowerOutageUserCount})
|
||||||
|
</if>
|
||||||
|
<if test="param.powerOutageRatioPastTime != null and param.powerOutageRatioPastTime != 0">
|
||||||
|
# 未复电用户数占总停电用户数的比例大于 X %
|
||||||
|
AND EXISTS (
|
||||||
|
select 1
|
||||||
|
from dner_daily_power_outage_event t2
|
||||||
|
where t1.district_code = t2.org_code
|
||||||
|
and t2.data_time >= #{param.powerOutageRatioStartDateTime}
|
||||||
|
and t2.data_time <![CDATA[ < ]]> #{param.currentDateTime}
|
||||||
|
and (t2.not_restored_user_count/(t2.restored_user_count + t2.not_restored_user_count)) > #{param.pastTimePowerOutageRatioCount})
|
||||||
|
</if>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
# 过滤得到已存在数据的K线图
|
||||||
|
AND EXISTS (select 1 from dner_daily_power_outage_event t2 where t1.district_code = t2.org_code)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -238,7 +238,8 @@ create table dner_daily_power_outage_event_sync
|
|||||||
COLLATE = utf8mb4_unicode_ci COMMENT ='日K线停电事件同步记录表';
|
COLLATE = utf8mb4_unicode_ci COMMENT ='日K线停电事件同步记录表';
|
||||||
|
|
||||||
-- 区域气象数据
|
-- 区域气象数据
|
||||||
create table regional_weather_data(
|
create table regional_weather_data
|
||||||
|
(
|
||||||
id bigint unsigned auto_increment comment '主键ID' primary key,
|
id bigint unsigned auto_increment comment '主键ID' primary key,
|
||||||
org_code varchar(64) not null comment '地区编码',
|
org_code varchar(64) not null comment '地区编码',
|
||||||
data_time varchar(64) not null comment '资料时次',
|
data_time varchar(64) not null comment '资料时次',
|
||||||
@ -252,9 +253,12 @@ create table regional_weather_data(
|
|||||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||||
update_by varchar(64) null comment '修改人',
|
update_by varchar(64) null comment '修改人',
|
||||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间'
|
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间'
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci comment '区域气象数据';
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_unicode_ci comment '区域气象数据';
|
||||||
|
|
||||||
CREATE TABLE `pmds_qxj_city_weather` (
|
CREATE TABLE `pmds_qxj_city_weather`
|
||||||
|
(
|
||||||
`v01301` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '站号',
|
`v01301` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '站号',
|
||||||
`v_acode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '行政区编码',
|
`v_acode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '行政区编码',
|
||||||
`v_prcode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '所属省份',
|
`v_prcode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '所属省份',
|
||||||
@ -277,4 +281,58 @@ CREATE TABLE `pmds_qxj_city_weather` (
|
|||||||
`d_updatetime` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '资料更新时间',
|
`d_updatetime` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '资料更新时间',
|
||||||
`rksj` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '入库时间',
|
`rksj` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '入库时间',
|
||||||
PRIMARY KEY (`prediction_time`, `ddatetime`, `v01301`)
|
PRIMARY KEY (`prediction_time`, `ddatetime`, `v01301`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- 事件主表
|
||||||
|
CREATE TABLE `dner_event`
|
||||||
|
(
|
||||||
|
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '事件ID',
|
||||||
|
`event_name` VARCHAR(50) NOT NULL COMMENT '事件名称',
|
||||||
|
`event_desc` VARCHAR(500) DEFAULT NULL COMMENT '事件描述',
|
||||||
|
`create_time` DATETIME default current_timestamp NOT NULL COMMENT '创建时间',
|
||||||
|
`create_by` VARCHAR(64) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`update_by` VARCHAR(64) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` DATETIME default current_timestamp not null on update CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='配网抢修事件主表';
|
||||||
|
|
||||||
|
-- 附件表
|
||||||
|
CREATE TABLE `dner_event_attachment`
|
||||||
|
(
|
||||||
|
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '附件ID',
|
||||||
|
`event_id` BIGINT NOT NULL COMMENT '关联事件ID',
|
||||||
|
`file_name` VARCHAR(255) NOT NULL COMMENT '文件名',
|
||||||
|
`file_path` VARCHAR(512) NOT NULL COMMENT '文件存储路径',
|
||||||
|
`file_type` VARCHAR(32) NOT NULL COMMENT '文件类型',
|
||||||
|
`file_size` BIGINT NOT NULL COMMENT '文件大小(字节)',
|
||||||
|
`is_latest` TINYINT NOT NULL DEFAULT '1' COMMENT '是否最新附件(1:是 0:否)',
|
||||||
|
`creator` VARCHAR(64) NOT NULL COMMENT '上传人',
|
||||||
|
`create_time` DATETIME default current_timestamp NOT NULL COMMENT '上传时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_event_id` (`event_id`),
|
||||||
|
CONSTRAINT `fk_attachment_event` FOREIGN KEY (`event_id`) REFERENCES `dner_event` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='事件附件表';
|
||||||
|
|
||||||
|
-- 导出记录表
|
||||||
|
CREATE TABLE `dner_event_export_record`
|
||||||
|
(
|
||||||
|
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '导出记录ID',
|
||||||
|
`event_id` BIGINT NOT NULL COMMENT '关联事件ID',
|
||||||
|
`export_time` DATETIME default current_timestamp NOT NULL COMMENT '导出时间',
|
||||||
|
`exporter` VARCHAR(64) NOT NULL COMMENT '导出人',
|
||||||
|
`file_name` VARCHAR(255) NOT NULL COMMENT '导出文件名',
|
||||||
|
`file_path` VARCHAR(512) NOT NULL COMMENT '导出文件路径',
|
||||||
|
`file_type` VARCHAR(32) NOT NULL COMMENT '导出文件类型',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_event_id` (`event_id`),
|
||||||
|
CONSTRAINT `fk_export_event` FOREIGN KEY (`event_id`) REFERENCES `dner_event` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='事件导出记录表';
|
||||||
Loading…
x
Reference in New Issue
Block a user