初始提交:添加分时处理
This commit is contained in:
parent
e418fa18ab
commit
d962cae2da
@ -36,7 +36,7 @@ public class DataExcelEntity {
|
|||||||
@ExcelProperty(value = "停电结束时间")
|
@ExcelProperty(value = "停电结束时间")
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
@ExcelProperty(value = "停电时长")
|
@ExcelProperty(value = "停电时长(mins)")
|
||||||
private Float lengthOutage ;
|
private Float lengthOutage ;
|
||||||
|
|
||||||
@ExcelProperty(value = "停电影响用户数")
|
@ExcelProperty(value = "停电影响用户数")
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import com.southern.power.grid.entity.WeatherSiteAreaConfiguration;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
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.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -59,6 +60,7 @@ public class HourlyOutageExcelProcessService {
|
|||||||
/**
|
/**
|
||||||
* 对外主入口:处理一批 Excel 解析后的数据,按逻辑补齐气象数据并批量入库
|
* 对外主入口:处理一批 Excel 解析后的数据,按逻辑补齐气象数据并批量入库
|
||||||
*/
|
*/
|
||||||
|
@Transactional
|
||||||
public void process(List<DataExcelEntity> excelRows) {
|
public void process(List<DataExcelEntity> excelRows) {
|
||||||
// 1. 加载南网区划配置表
|
// 1. 加载南网区划配置表
|
||||||
loadNwAreaConfig();
|
loadNwAreaConfig();
|
||||||
@ -70,10 +72,10 @@ public class HourlyOutageExcelProcessService {
|
|||||||
|
|
||||||
// 3 & 4. 循环处理 Excel 行
|
// 3 & 4. 循环处理 Excel 行
|
||||||
for (DataExcelEntity row : excelRows) {
|
for (DataExcelEntity row : excelRows) {
|
||||||
if(row.getLengthOutage()<lengthOutage) {
|
// if(row.getLengthOutage()<lengthOutage) {
|
||||||
log.info("lengthOutage is less than 60! {}, {}, {}", row.getProvince(), row.getCity(), row.getDistrict());
|
// log.info("lengthOutage is less than 60! {}, {}, {}", row.getProvince(), row.getCity(), row.getDistrict());
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 3.1 根据南网省/市/区县 → district_code
|
// 3.1 根据南网省/市/区县 → district_code
|
||||||
String districtCode = findDistrictCode(row.getProvince(), row.getCity(), row.getDistrict());
|
String districtCode = findDistrictCode(row.getProvince(), row.getCity(), row.getDistrict());
|
||||||
|
|||||||
@ -82,6 +82,8 @@ CREATE TABLE `dner_daily_power_outage_event`
|
|||||||
`extreme_wind_speed_hourly` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '日内极大风速',
|
`extreme_wind_speed_hourly` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '日内极大风速',
|
||||||
`power_outage_duration` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '停电时长',
|
`power_outage_duration` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '停电时长',
|
||||||
`user_count` int(11) DEFAULT NULL COMMENT '停电影响用户总数',
|
`user_count` int(11) DEFAULT NULL COMMENT '停电影响用户总数',
|
||||||
|
`fault_user_count` int(11) DEFAULT NULL COMMENT '故障停电影响用户总数',
|
||||||
|
`scheduled_user_count` int(11) DEFAULT NULL COMMENT '计划停电影响用户总数',
|
||||||
`restored_user_count` int(11) DEFAULT NULL COMMENT '已复电停电影响总用户数',
|
`restored_user_count` int(11) DEFAULT NULL COMMENT '已复电停电影响总用户数',
|
||||||
`not_restored_user_count` int(11) DEFAULT NULL COMMENT '未复电停电影响总用户数',
|
`not_restored_user_count` int(11) DEFAULT NULL COMMENT '未复电停电影响总用户数',
|
||||||
`star_user_count` int(11) DEFAULT NULL COMMENT '起始影响用户总数',
|
`star_user_count` int(11) DEFAULT NULL COMMENT '起始影响用户总数',
|
||||||
@ -252,3 +254,27 @@ create table regional_weather_data(
|
|||||||
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` (
|
||||||
|
`v01301` varchar(50) COLLATE utf8mb4_unicode_ci NOT 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_city` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '所属地市',
|
||||||
|
`v_county` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '所属区县',
|
||||||
|
`v05001` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '纬度',
|
||||||
|
`v06001` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '经度',
|
||||||
|
`ddatetime` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '预报时次',
|
||||||
|
`prediction_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '预报时效,小时',
|
||||||
|
`weather_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '天气现象',
|
||||||
|
`tem` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '温度',
|
||||||
|
`tem_max` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '最高温度',
|
||||||
|
`tem_min` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '最低温度',
|
||||||
|
`precipitation` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '降水量,毫米',
|
||||||
|
`rhum` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '相对湿度',
|
||||||
|
`wind_speed` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '风速',
|
||||||
|
`wind_direction` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '风向',
|
||||||
|
`cloud` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '云量,成',
|
||||||
|
`vis` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能见度,km',
|
||||||
|
`d_updatetime` 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`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
Loading…
x
Reference in New Issue
Block a user