代码提交

This commit is contained in:
wr
2023-06-21 16:28:11 +08:00
parent 55dbe9e74e
commit d86dc8a676
5 changed files with 609 additions and 243 deletions

View File

@@ -1,10 +1,7 @@
package com.njcn.syncdata.controller;
import com.alibaba.fastjson.JSONArray;
import com.njcn.syncdata.pojo.po.AdsAstXbjcptGetFctgDi;
import com.njcn.syncdata.pojo.po.PWFeederLinePSR;
import com.njcn.syncdata.pojo.po.PWOPTransformerPSR;
import com.njcn.syncdata.pojo.po.Substation;
import com.njcn.syncdata.pojo.po.*;
import com.njcn.syncdata.service.IPowerDistributionareaService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -43,6 +40,11 @@ public class DataImportController {
return service.adsList();
}
@GetMapping("/adsDiList")
public List<AdsAstXbjcptGetFctgValueDi> adsDiList(String ds) {
return service.adsDiList(ds);
}
/**
* 获取业务中台返回体
*
@@ -90,13 +92,12 @@ public class DataImportController {
@PostMapping("/insertData")
public String insertData() {
String s = service.insertData(1);
String s = service.insertData();
return s;
}
@PostMapping("/insertDataTest")
public String insertDataTest() {
String s = service.insertData(0);
@PostMapping("/insertDataDi")
public String insertDataDi(String ds) {
String s = service.insertDataDi(ds);
return s;
}
}

View File

@@ -0,0 +1,90 @@
package com.njcn.syncdata.pojo.po;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author wr
* @description
* @date 2023/6/20 16:29
*/
@Data
public class AdsAstXbjcptGetFctgValueDi {
/**
*台区标识
*/
private String tg_id;
/**
*计量点号
*/
private String id;
/**
*电压变比
*/
private BigDecimal pt;
/**
*电流变比
*/
private BigDecimal ct;
/**
*相位标志 1-A2-B3-C
*/
private String Phase_flag;
/**
*电压最大值
*/
private BigDecimal max_u;
/**
*电压最小值
*/
private BigDecimal min_u;
/**
*电压平均值
*/
private BigDecimal avg_u;
/**
*单相有功功率-最大值
*/
private BigDecimal max_p;
/**
*单相有功功率-最小值
*/
private BigDecimal min_p;
/**
*单相有功功率-平均值
*/
private BigDecimal avg_p;
/**
*单相无功功率-最大值
*/
private BigDecimal max_q;
/**
*单相无功功率-最小值
*/
private BigDecimal min_q;
/**
*单相无功功率-平均值
*/
private BigDecimal avg_q;
/**
*台区电压越上限7%-15%时长h
*/
private BigDecimal up7_over_time;
/**
*台区电压越上限15%及以上时长h
*/
private BigDecimal up15_over_time;
/**
*台区电压越下限时长h
*/
private BigDecimal down_over_time;
/**
*台区潮流倒送时长h
*/
private BigDecimal neg_p_time;
/**
*日期
*/
private String ds;
}

View File

@@ -1397,35 +1397,35 @@ public class RDisMpMeasurePhaseReportD {
/**
* 谐波电压超限时长
*/
private int harmonicVoltageOverrunDuration;
private float harmonicVoltageOverrunDuration;
/**
* 三相电压不平衡度超限时长
*/
private int tpVoltageUnbalanceOverrunDuration;
private float tpVoltageUnbalanceOverrunDuration;
/**
* 台区电压越上限7%-15%)时长
*/
@TableField("VOLTAGE_overrun_7_15_up_duration")
private int voltageOverrun715UpDuration;
private float voltageOverrun715UpDuration;
/**
* 台区电压越上限15%及以上)时长
*/
@TableField("VOLTAGE_overrun_15_up_duration")
private int voltageOverrun15UpDuration;
private float voltageOverrun15UpDuration;
/**
* 台区电压越下限时长
*/
@TableField("VOLTAGE_overrun_down_duration")
private int voltageOverrunDownDuration;
private float voltageOverrunDownDuration;
/**
* 台区潮流倒送时长
*/
private int reversedDuration;
private float reversedDuration;
/**
* 日应收五项指标分钟平均值数量

View File

@@ -2,6 +2,7 @@ package com.njcn.syncdata.service;
import com.njcn.db.service.IReplenishMybatisService;
import com.njcn.syncdata.pojo.po.AdsAstXbjcptGetFctgDi;
import com.njcn.syncdata.pojo.po.AdsAstXbjcptGetFctgValueDi;
import com.njcn.syncdata.pojo.po.PowerDistributionarea;
import java.util.List;
@@ -29,6 +30,12 @@ public interface IPowerDistributionareaService extends IReplenishMybatisService<
*/
List<AdsAstXbjcptGetFctgDi> adsList();
/**
* 获取日报表数据
* @return
*/
List<AdsAstXbjcptGetFctgValueDi> adsDiList(String ds);
/**
* 通用资源数据中台数据查询
* @param token 数据token
@@ -39,5 +46,7 @@ public interface IPowerDistributionareaService extends IReplenishMybatisService<
*/
Map getResourceData(String token,String psrType,Integer num, String fieldName,String fieldValue);
String insertData(Integer type);
String insertData();
String insertDataDi(String ds);
}

View File

@@ -2,6 +2,9 @@ package com.njcn.syncdata.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -9,6 +12,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cloud.apigateway.sdk.utils.Client;
import com.cloud.apigateway.sdk.utils.Request;
import com.njcn.db.service.impl.ReplenishMybatisServiceImpl;
@@ -33,8 +37,10 @@ import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URI;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -153,6 +159,77 @@ public class PowerDistributionareaServiceImpl extends ReplenishMybatisServiceImp
return aas;
}
@Override
public List<AdsAstXbjcptGetFctgValueDi> adsDiList(String ds) {
List<AdsAstXbjcptGetFctgValueDi> aas = new ArrayList<>();
String key = "0e3bac160fd246f181ad4fd47da6929a";
String secret = "383b4b2536234d84ac909cd605762061";
String url = "http://0f92aaf3da9b4dd2ab80a337495ccf09.apigw.he-region-2.sgic.sgcc.com.cn/ast/ydxxcjxt/dws/get_e_mp_fctg_value_zl_ds";
String apiId = "d8f4ca4de8ad7244dee3f1d813cfe0d8";
String apiName = "get_电能质量谐波监测系统_分布式光伏台区台账_e_mp_fctg_value_zl_时间";
Request request = new Request();
CloseableHttpClient client = null;
try {
request.setKey(key);
request.setSecret(secret);
//接口访问类型
request.setMethod("GET");
//接口访问url
request.setUrl(url);
//API中 header头传输的参数
request.addHeader("x-api-id", apiId);
request.addHeader("Content-Type", "Application/json");
//API中 Query传输的参数
request.addQueryStringParam("ds", ds);
//API中 Body体参数
//request.setBody("demo");
} catch (Exception e) {
log.error(Thread.currentThread().getName() + "链接" + apiName + "失败");
e.printStackTrace();
}
try {
HttpRequestBase signedRequest = Client.sign(request);
Header[] authorization = signedRequest.getHeaders("Authorization");
signedRequest.addHeader("x-Authorization", authorization[0].getValue());
//Send the request.
client = HttpClients.custom().build();
HttpResponse response = client.execute(signedRequest);
//Print the status line of the response.
log.info(response.getStatusLine().toString());
//Print the header fields of the response.
Header[] resHeaders = response.getAllHeaders();
for (Header h : resHeaders) {
log.info(h.getName() + ":" + h.getValue());
}
//Print the body of the response.
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
String s = EntityUtils.toString(resEntity, "UTF-8");
log.info(System.getProperty("line.separator") + s);
JSONObject jsonObject = JSON.parseObject(s);
Map data = jsonObject.getObject("data", Map.class);
aas = JSONArray.parseArray(data.get("data").toString(), AdsAstXbjcptGetFctgValueDi.class);
}
} catch (Exception e) {
log.error(Thread.currentThread().getName() + "链接" + apiName + "失败");
e.printStackTrace();
} finally {
try {
if (client != null) {
client.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return aas;
}
@Override
public Map getResourceData(String token, String psrType, Integer num, String fieldName, String fieldValue) {
Map body = new HashMap();
@@ -188,7 +265,7 @@ public class PowerDistributionareaServiceImpl extends ReplenishMybatisServiceImp
}
@Override
public String insertData(Integer type) {
public String insertData() {
String message = "数据导入成功!";
try {
//初始化集合
@@ -356,232 +433,171 @@ public class PowerDistributionareaServiceImpl extends ReplenishMybatisServiceImp
return message;
}
public static <T> List<T> staticMethod(Integer a, Class<T> t) {
List<T> aas = new ArrayList<>();
String s = null;
switch (a) {
case 1:
s = "[{\n" +
" \"RUN_DATE\":\"2014-10-19 00:00:00\",\n" +
" \"ACCOUNT_ID\":\"c06e78c12c8afa98904fb5b289014fc06e636c1f90\",\n" +
" \"BELONG_TYPE\":\"1\",\n" +
" \"YX_TG_ID\":\"1569713\",\n" +
" \"CUSTOMER_TRANSFORMER_NAME\":\"电网_杨户解家寨内\",\n" +
" \"DEPART\":\"13B9B47F20603324E05338297A0A0595\",\n" +
" \"IS_WHOLESET_EQUIP\":null,\n" +
" \"SIGNIFICANCE\":\"1\",\n" +
" \"DISPATCH_OP_RIGHT\":null,\n" +
" \"POLE_ID\":\"10200001-3367889\",\n" +
" \"TRUSTEE\":null,\n" +
" \"DISPATCH_RIGHT\":null,\n" +
" \"MARKETING_UNIT\":null,\n" +
" \"ROOT_ID\":\"10000100-173425\",\n" +
" \"ALIAS_NAME\":null,\n" +
" \"CREATE_TIME\":\"2022-07-24 04:41:09\",\n" +
" \"ID\":\"11000000-579533\",\n" +
" \"DISPATCH_PERMISSION\":null,\n" +
" \"MEMO\":null,\n" +
" \"RETIRED_DATE\":null,\n" +
" \"LAST_RUN_DATE\":null,\n" +
" \"CAPACITY\":200,\n" +
" \"ROOT_CLASS_NAME\":\"PWFeederLinePSR\",\n" +
" \"MRID\":\"04M72000000363062\",\n" +
" \"PLAN_FEATURE\":\"05\",\n" +
" \"IS_COALTOELECTRICITY\":null,\n" +
" \"CHARGE_PILE_NUMBER\":0,\n" +
" \"SERVICE_POINT_ID\":null,\n" +
" \"DISPATCH_MONITOR_RIGHT\":null,\n" +
" \"PARENT_ID\":\"10000200-3235697\",\n" +
" \"NAME\":\"杨户解家寨内\",\n" +
" \"PATH_NAME\":\"\\\\赵县\\\\解家宅线426\\\\解家宅线426干线\\\\解家宅线426解家寨村内分支\",\n" +
" \"IS_STATION5G_POWER\":null,\n" +
" \"ADDRESS\":null,\n" +
" \"CUSTOMER_TRANSFORMER_ID\":\"1968493\",\n" +
" \"IS_AGENT\":\"0\",\n" +
" \"MODIFY_TIME\":\"2023-01-12 16:58:36\",\n" +
" \"MAINTENANCE_TEAM\":\"13B9B47F20783324E05338297A0A0595\",\n" +
" \"VOLTAGELEVEL_ID\":\"22\",\n" +
" \"DEV_MASTER\":\"130000000146834\",\n" +
" \"IS_CHARGEPILE_POWER\":null,\n" +
" \"CLASS_NAME\":\"PWOPTransformerPSR\",\n" +
" \"SUBGEOREGION\":\"\",\n" +
" \"AFFILIATRD_BRANCH\":null,\n" +
" \"DISTRICT\":\"13B9B47F1F223324E05338297A0A0595\",\n" +
" \"RUN_NO\":\"10038\",\n" +
" \"PARENT_CLASS_NAME\":\"PWSubLinePSR\",\n" +
" \"REGION_TYPE\":\"05\",\n" +
" \"ELECHTG_METHOD\":null,\n" +
" \"PATH_ID\":\"\\\\1f0b1e58-cfbd-11e9-b474-fa163ec04b01\\\\10000100-173505\\\\10000201-3235601\\\\10000200-3235697\",\n" +
" \"RUN_STATUS\":\"20\",\n" +
" \"IS_RURAL_GRID\":\"1\",\n" +
" \"CUSTOMER_NO\":null,\n" +
" \"GEOREGION\":\"1f0b1e58-cfbd-11e9-b474-fa163ec04b01\",\n" +
" \"USE_NATURE\":\"03\",\n" +
" \"SECTION\":\"13B9B47F20773324E05338297A0A0595\"\n" +
" }]";
aas = JSONArray.parseArray(s, t);
break;
case 2:
s = "[\n" +
" {\n" +
" \"DISPATCH_DEPART\": null,\n" +
" \"RUN_DATE\": \"2017-07-18 00:00:00\",\n" +
" \"START_STATION_ID\": \"30000000-180377\",\n" +
" \"BELONG_TYPE\": \"1\",\n" +
" \"ACCOUNT_ID\": \"04DKX-173425\",\n" +
" \"TRANSFORMER_CAPACITY\": 13440,\n" +
" \"TRANSFORMER_CAPACITY_PRIV\": 3065,\n" +
" \"DEPART\": \"13B9B47F20603324E05338297A0A0595\",\n" +
" \"SIGNIFICANCE\": null,\n" +
" \"START_STATION_CLASS_NAME\": \"Substation\",\n" +
" \"TRANSFORMER_CAPACITY_AMOR\": 1800,\n" +
" \"ROOT_ID\": \"10000100-173425\",\n" +
" \"ALIAS_NAME\": \"北龙化线454\",\n" +
" \"IS_CROSSCOUNTY_CONTACT\": null,\n" +
" \"START_BAY_CLASS_NAME\": \"BayPSR\",\n" +
" \"CREATE_TIME\": \"2022-07-24 03:45:33\",\n" +
" \"ID\": \"10000100-173425\",\n" +
" \"IS_DISTRIBUTEDELECHTG\": null,\n" +
" \"SECTION_COUNT\": 0,\n" +
" \"CONDUCTOR_LENGTH\": 16.721,\n" +
" \"RETIRED_DATE\": null,\n" +
" \"MEMO\": \"【煤改电】\",\n" +
" \"AGENT_LINE_LENGTH\": 0.012,\n" +
" \"LAST_RUN_DATE\": \"2005-09-06 00:00:00\",\n" +
" \"CURRENT_LIMIT\": 0,\n" +
" \"ROOT_CLASS_NAME\": \"PWFeederLinePSR\",\n" +
" \"MRID\": \"04M72000035746393\",\n" +
" \"PRECOMSTATION_COUNT\": 0,\n" +
" \"SWITCHSTATION_COUNT\": 0,\n" +
" \"PLAN_FEATURE\": \"04\",\n" +
" \"IS_COALTOELECTRICITY\": \"1\",\n" +
" \"POWERCABLE_COUNT\": 0,\n" +
" \"TRANSFORMER_COUNT_PRIV\": 17,\n" +
" \"START_SWITCH_ID\": \"30500000-191318\",\n" +
" \"PARENT_ID\": \"10000100-173425\",\n" +
" \"NAME\": \"北龙化线454\",\n" +
" \"PATH_NAME\": \"\\\\赵县\",\n" +
" \"LOOP_UNIT_COUNT\": 0,\n" +
" \"IS_AGENT\": \"0\",\n" +
" \"MODIFY_TIME\": \"2023-05-17 07:51:45\",\n" +
" \"IS_NSUBO\": null,\n" +
" \"INTERCONNECYION_LINE\": null,\n" +
" \"POLE_COUNT\": 342,\n" +
" \"MAINTENANCE_TEAM\": \"13B9B47F206E3324E05338297A0A0595\",\n" +
" \"DEV_MASTER\": \"130000000146417\",\n" +
" \"VOLTAGELEVEL_ID\": \"22\",\n" +
" \"LENGTH\": 16.751,\n" +
" \"TRANSFORMER_COUNT_PUBL\": 56,\n" +
" \"PRECOMSTATION_CAPACITY\": 0,\n" +
" \"TRANSFORMER_COUNT_AMOR\": 5,\n" +
" \"CLASS_NAME\": \"PWFeederLinePSR\",\n" +
" \"SUBGEOREGION\": \"\",\n" +
" \"AFFILIATRD_BRANCH\": null,\n" +
" \"DISTRICT\": \"13B9B47F1F223324E05338297A0A0595\",\n" +
" \"DISPATCH_LEVEL\": null,\n" +
" \"RUN_NO\": \"454\",\n" +
" \"PARENT_CLASS_NAME\": \"PWFeederLinePSR\",\n" +
" \"CABLE_LENGTH\": 0.03,\n" +
" \"FUSE_COUNT\": 57,\n" +
" \"REGION_TYPE\": \"01\",\n" +
" \"LAYOUT_MODE\": \"2\",\n" +
" \"START_SWITCH_CLASS_NAME\": \"BreakerPSR\",\n" +
" \"PATH_ID\": \"\\\\1f0b1e58-cfbd-11e9-b474-fa163ec04b01\",\n" +
" \"TRANSFORMER_CAPACITY_PUBL\": 10375,\n" +
" \"INSULATEDWIRE_LENGTH\": 16.721,\n" +
" \"RUN_STATUS\": \"20\",\n" +
" \"SUPPLY_RADIUS\": 4.351,\n" +
" \"IS_RURAL_GRID\": \"1\",\n" +
" \"GEOREGION\": \"1f0b1e58-cfbd-11e9-b474-fa163ec04b01\",\n" +
" \"USE_NATURE\": \"03\",\n" +
" \"TRANSFORMER_COUNT\": 73,\n" +
" \"START_BAY_ID\": \"38000000-131567\",\n" +
" \"BASEWIRE_LENGTH\": 0,\n" +
" \"SWITCH_COUNT\": 69,\n" +
" \"SECTION\": \"13B9B47F206D3324E05338297A0A0595\",\n" +
" \"IS_CENTRALIZEDELECHTG\": \"0\"\n" +
" }\n" +
" ]";
aas = JSONArray.parseArray(s, t);
break;
case 3:
s = "[\n" +
" {\n" +
" \"RUN_DATE\": \"2004-11-30 00:00:00\",\n" +
" \"BELONG_TYPE\": \"1\",\n" +
" \"ACCOUNT_ID\": \"5B039E90-F1DF-4611-859B-D87562B86CFF-61535\",\n" +
" \"TELEPHONE_NUMBER\": null,\n" +
" \"DEPART\": \"13B9B47F20603324E05338297A0A0595\",\n" +
" \"SIGNIFICANCE\": \"4\",\n" +
" \"DISPATCH_RIGHT\": null,\n" +
" \"ROOT_ID\": \"30000000-180377\",\n" +
" \"FIRE_PREVENT_CERTIFICATION\": \"01\",\n" +
" \"ALIAS_NAME\": null,\n" +
" \"ID\": \"30000000-180377\",\n" +
" \"CREATE_TIME\": \"2022-07-11 07:29:41\",\n" +
" \"SCALE\": null,\n" +
" \"FIRE_PREVENT_TYPE\": \"01\",\n" +
" \"TYPE\": null,\n" +
" \"RETIRED_DATE\": null,\n" +
" \"MEMO\": \"【煤改电】11\",\n" +
" \"LAST_RUN_DATE\": null,\n" +
" \"CAPACITY\": 0,\n" +
" \"ROOT_CLASS_NAME\": \"Substation\",\n" +
" \"MRID\": \"04M00000012958387\",\n" +
" \"PLAN_FEATURE\": \"05\",\n" +
" \"SUPERVISOR\": null,\n" +
" \"IS_LOOPED_NETWORK\": \"0\",\n" +
" \"NAME\": \"35kV圪塔头站(农网)\",\n" +
" \"PARENT_ID\": \"30000000-180377\",\n" +
" \"REGION\": null,\n" +
" \"PATH_NAME\": \"\\\\赵县\",\n" +
" \"ADDRESS\": \"石家庄赵县033省道黄市村村西304乡道各南村东\",\n" +
" \"IS_AVC_JOINED\": \"1\",\n" +
" \"IS_GIS_SUBSTATION\": \"0\",\n" +
" \"IS_AGENT\": \"0\",\n" +
" \"POLLUTION_GRADE\": \"04\",\n" +
" \"MODIFY_TIME\": \"2022-11-17 09:52:59\",\n" +
" \"IMPORTANT_LEVEL\": \"4\",\n" +
" \"IS_FUSION_SUBSTATION\": \"0\",\n" +
" \"IS_NSUBO\": \"1\",\n" +
" \"MAINTENANCE_TEAM\": \"13B9B47F20643324E05338297A0A0595\",\n" +
" \"DEV_MASTER\": \"130000000010186\",\n" +
" \"VOLTAGELEVEL_ID\": \"25\",\n" +
" \"IS_LOWLYING\": \"0\",\n" +
" \"WATCH_KEEPER_MODE\": \"2\",\n" +
" \"IS_PIVOT\": \"0\",\n" +
" \"DESIGNER\": \"河北华艺建筑设计有限公司\",\n" +
" \"CLASS_NAME\": \"Substation\",\n" +
" \"IS_FIRT_JOINED\": \"1\",\n" +
" \"IS_UNDERGROUND\": null,\n" +
" \"CONSTRUCTOR_UNIT\": null,\n" +
" \"SUBGEOREGION\": \"\",\n" +
" \"DISTRICT\": \"13B9B47F1F223324E05338297A0A0595\",\n" +
" \"RUN_NO\": \"35kV圪塔头站(农网)\",\n" +
" \"PARENT_CLASS_NAME\": \"Substation\",\n" +
" \"IS_LOADER_STATION\": null,\n" +
" \"ARRENTMENT_FORM\": \"01\",\n" +
" \"MARKET_ACCOUNT\": \"\",\n" +
" \"FUSION_PROJECT\": null,\n" +
" \"ANTI_MISOPERATION_MODE\": null,\n" +
" \"PATH_ID\": \"\\\\1f0b1e58-cfbd-11e9-b474-fa163ec04b01\",\n" +
" \"RUN_STATUS\": \"20\",\n" +
" \"IS_CENTRAL_SUPERVISORY\": \"1\",\n" +
" \"HAVE_FLOOD_PREVENTION_WALL\": \"0\",\n" +
" \"IS_RURAL_GRID\": \"1\",\n" +
" \"GEOREGION\": \"1f0b1e58-cfbd-11e9-b474-fa163ec04b01\",\n" +
" \"USE_NATURE\": \"03\",\n" +
" \"IDLE_CAPACITY\": 0,\n" +
" \"IS_SMART\": \"0\",\n" +
" \"SECTION\": \"13B9B47F20633324E05338297A0A0595\"\n" +
" }\n" +
" ]";
aas = JSONArray.parseArray(s, t);
break;
}
return aas;
}
@Override
public String insertDataDi(String ds) {
List<RDisMpMeasurePhaseReportD> info=new ArrayList<>();
//查询日报表数据
List<AdsAstXbjcptGetFctgValueDi> adsDis = adsDiList(ds);
List<PowerDistributionarea> list = this.list(new QueryWrapper<PowerDistributionarea>()
.select("Id")
.eq("input_Status", 1)
.eq("Status", 1));
//获取台区id
List<String> tgId = list.stream().map(PowerDistributionarea::getId).collect(Collectors.toList());
DateTime parse = DateUtil.parse(ds, "yyyyMMdd");
LocalDateTime localDateTime = LocalDateTime.ofInstant(parse.toInstant(), ZoneId.systemDefault());
Map<String, List<AdsAstXbjcptGetFctgValueDi>> adsMap = adsDis.stream().collect(Collectors.groupingBy(AdsAstXbjcptGetFctgValueDi::getTg_id));
for (Map.Entry<String, List<AdsAstXbjcptGetFctgValueDi>> stringListEntry : adsMap.entrySet()) {
String key = stringListEntry.getKey();
if(!tgId.contains(key)){
continue;
}
List<AdsAstXbjcptGetFctgValueDi> value = stringListEntry.getValue();
RDisMpMeasurePhaseReportD reportD=new RDisMpMeasurePhaseReportD();
//初始化对象赋值
setData(reportD);
reportD.setMonitorId(key);
reportD.setDatdate(localDateTime);
reportD.setMonitoringDuration(24);
//max_u
OptionalDouble max = value.stream().filter(x->ObjectUtil.isNotNull(x.getMax_u())).mapToDouble(temp -> {
return temp.getMax_u().doubleValue();
}).max();
if(!max.isPresent()){
continue;
}
//min_u
OptionalDouble min = value.stream().filter(x->ObjectUtil.isNotNull(x.getMin_u())).mapToDouble(temp -> {
return temp.getMin_u().doubleValue();
}).min();
if(!min.isPresent()){
continue;
}
//avg_u
OptionalDouble avg = value.stream().filter(x->ObjectUtil.isNotNull(x.getAvg_u())).mapToDouble(temp -> {
return temp.getAvg_u().doubleValue();
}).average();
if(!avg.isPresent()){
continue;
}
//95
BigDecimal add = new BigDecimal(max.getAsDouble()).add(new BigDecimal(avg.getAsDouble()));
if(add.floatValue()!=0){
BigDecimal divide = add.divide(new BigDecimal(2), 4, BigDecimal.ROUND_UP);
reportD.setPhaseVoltageEffective95(divide.floatValue());
}else{
reportD.setSpActivePower_95(0.0f);
}
reportD.setPhaseVoltageEffectiveMax((float) max.getAsDouble());
reportD.setPhaseVoltageEffectiveMin((float) min.getAsDouble());
reportD.setPhaseVoltageEffectiveAvg((float) avg.getAsDouble());
//---------------------------------------------------------------------------------------------------
//max_u
OptionalDouble maxP = value.stream().filter(x->ObjectUtil.isNotNull(x.getMax_p())).mapToDouble(temp -> {
return temp.getMax_p().doubleValue();
}).max();
if(!maxP.isPresent()){
continue;
}
//min_u
OptionalDouble minP = value.stream().filter(x->ObjectUtil.isNotNull(x.getMin_p())).mapToDouble(temp -> {
return temp.getMin_p().doubleValue();
}).min();
if(!minP.isPresent()){
continue;
}
//avg_u
OptionalDouble avgP = value.stream().filter(x->ObjectUtil.isNotNull(x.getAvg_p())).mapToDouble(temp -> {
return temp.getAvg_p().doubleValue();
}).average();
if(!avgP.isPresent()){
continue;
}
//95
BigDecimal addP = new BigDecimal(maxP.getAsDouble()).add(new BigDecimal(avgP.getAsDouble()));
if(addP.floatValue()!=0){
BigDecimal divide = addP.divide(new BigDecimal(2), 4, BigDecimal.ROUND_UP);
reportD.setSpActivePower_95(divide.floatValue());
}else{
reportD.setSpActivePower_95(0.0f);
}
reportD.setSpActivePowerMax((float) maxP.getAsDouble());
reportD.setSpActivePowerMin((float) minP.getAsDouble());
reportD.setSpActivePowerAvg((float) avgP.getAsDouble());
//---------------------------------------------------------------------------------------------------
//max_Q
OptionalDouble maxQ = value.stream().filter(x->ObjectUtil.isNotNull(x.getMax_q())).mapToDouble(temp -> {
return temp.getMax_q().doubleValue();
}).max();
if(!maxQ.isPresent()){
continue;
}
//min_Q
OptionalDouble minQ = value.stream().filter(x->ObjectUtil.isNotNull(x.getMin_q())).mapToDouble(temp -> {
return temp.getMin_q().doubleValue();
}).min();
if(!minQ.isPresent()){
continue;
}
//avg_u
OptionalDouble avgQ = value.stream().filter(x->ObjectUtil.isNotNull(x.getAvg_q())).mapToDouble(temp -> {
return temp.getAvg_q().doubleValue();
}).average();
if(!avgQ.isPresent()){
continue;
}
//95
BigDecimal addQ = new BigDecimal(maxQ.getAsDouble()).add(new BigDecimal(avgQ.getAsDouble()));
if(addQ.floatValue()!=0){
BigDecimal divide = addQ.divide(new BigDecimal(2), 4, BigDecimal.ROUND_UP);
reportD.setSpApparentPower95(divide.floatValue());
}else{
reportD.setSpApparentPower95(0.0f);
}
reportD.setSpApparentPowerMax((float) maxQ.getAsDouble());
reportD.setSpApparentPowerMin((float) minQ.getAsDouble());
reportD.setSpApparentPowerAvg((float) avgQ.getAsDouble());
//---------------------------------------------------------------------------------------------------
//max_Q
OptionalDouble max715 = value.stream().filter(x->ObjectUtil.isNotNull(x.getUp7_over_time())).mapToDouble(temp -> {
return temp.getUp7_over_time().doubleValue();
}).max();
if(!max715.isPresent()){
continue;
}
OptionalDouble max15 = value.stream().filter(x->ObjectUtil.isNotNull(x.getUp15_over_time())).mapToDouble(temp -> {
return temp.getUp15_over_time().doubleValue();
}).max();
if(!max15.isPresent()){
continue;
}
OptionalDouble maxDown = value.stream().filter(x->ObjectUtil.isNotNull(x.getDown_over_time())).mapToDouble(temp -> {
return temp.getDown_over_time().doubleValue();
}).max();
if(!maxDown.isPresent()){
continue;
}
OptionalDouble maxNeg = value.stream().filter(x->ObjectUtil.isNotNull(x.getNeg_p_time())).mapToDouble(temp -> {
return temp.getNeg_p_time().doubleValue();
}).max();
if(!maxNeg.isPresent()){
continue;
}
reportD.setVoltageOverrun715UpDuration((float) max715.getAsDouble());
reportD.setVoltageOverrun15UpDuration((float) max15.getAsDouble());
reportD.setVoltageOverrunDownDuration((float) maxDown.getAsDouble());
reportD.setReversedDuration((float) maxNeg.getAsDouble());
reportD.setReceivableTargetNum(96);
reportD.setPracticalTargetNum(96);
info.add(reportD);
}
return "日报表数据导入成功";
}
public <T> List<T> resourceMethod(Integer a, String token, Integer num, String ids, Class<T> t) {
List<T> aas = new ArrayList<>();
switch (a) {
@@ -619,5 +635,255 @@ public class PowerDistributionareaServiceImpl extends ReplenishMybatisServiceImp
}
return "";
}
public void setData(RDisMpMeasurePhaseReportD reportD){
reportD.setSpReactivePowerMax(0.0F);
reportD.setSpReactivePowerMin(0.0F);
reportD.setSpReactivePowerAvg(0.0F);
reportD.setSpReactivePower95(0.0F);
reportD.setFrequencyMax(0.0F);
reportD.setFrequencyMin(0.0F);
reportD.setFrequencyAvg(0.0F);
reportD.setFrequency95(0.0F);
reportD.setFrequencyDeviationMax(0.0F);
reportD.setFrequencyDeviationMin(0.0F);
reportD.setFrequencyDeviationAvg(0.0F);
reportD.setFrequencyDeviation95(0.0F);
reportD.setFrequencyDeviationOverrunDuration(0);
reportD.setLineVoltageEffectiveMax(0.0F);
reportD.setLineVoltageEffectiveMin(0.0F);
reportD.setLineVoltageEffectiveAvg(0.0F);
reportD.setLineVoltageEffective95(0.0F);
reportD.setVDeUpMax(0.0F);
reportD.setVDeUpMin(0.0F);
reportD.setVDeUpAvg(0.0F);
reportD.setVDeUp95(0.0F);
reportD.setVDeLowMax(0.0F);
reportD.setVDeLowMin(0.0F);
reportD.setVDeLowAvg(0.0F);
reportD.setVDeLow95(0.0F);
reportD.setVDeOverrunDuration(0);
reportD.setCurrentEffectiveMax(0.0F);
reportD.setCurrentEffectiveMin(0.0F);
reportD.setCurrentEffectiveAvg(0.0F);
reportD.setCurrentEffective95(0.0F);
reportD.setTotalActivePowerMax(0.0F);
reportD.setTotalActivePowerMin(0.0F);
reportD.setTotalActivePowerAvg(0.0F);
reportD.setTotalActivePower_95(0.0F);
reportD.setTotalApparentPowerMax(0.0F);
reportD.setTotalApparentPowerMin(0.0F);
reportD.setTotalApparentPowerAvg(0.0F);
reportD.setTotalApparentPower95(0.0F);
reportD.setTotalReactivePowerMax(0.0F);
reportD.setTotalReactivePowerMin(0.0F);
reportD.setTotalReactivePowerAvg(0.0F);
reportD.setTotalReactivePower95(0.0F);
reportD.setTpPowerFactorAvg(0.0F);
reportD.setFundamentalVoltageMax(0.0F);
reportD.setFundamentalVoltageMin(0.0F);
reportD.setFundamentalVoltageAvg(0.0F);
reportD.setFundamentalVoltage95(0.0F);
reportD.setFundamentalCurrentMax(0.0F);
reportD.setFundamentalCurrentMin(0.0F);
reportD.setFundamentalCurrentAvg(0.0F);
reportD.setFundamentalCurrent95(0.0F);
reportD.setFundamentalActivePowerMax(0.0F);
reportD.setFundamentalActivePowerMin(0.0F);
reportD.setFundamentalActivePowerAvg(0.0F);
reportD.setFundamentalActivePower_95(0.0F);
reportD.setFundamentalRateofworkMax(0.0F);
reportD.setFundamentalRateofworkMin(0.0F);
reportD.setFundamentalRateofworkAvg(0.0F);
reportD.setFundamentalRateofwork95(0.0F);
reportD.setSpFundamentalPowerFactorMax(0.0F);
reportD.setSpFundamentalPowerFactorMin(0.0F);
reportD.setSpFundamentalPowerFactorAvg(0.0F);
reportD.setSpFundamentalPowerFactor95(0.0F);
reportD.setFundamentalPowerFactorMax(0.0F);
reportD.setFundamentalPowerFactorMin(0.0F);
reportD.setFundamentalPowerFactorAvg(0.0F);
reportD.setFundamentalPowerFactor95(0.0F);
reportD.setVoltageHarmonicWaveMax(0.0F);
reportD.setVoltageHarmonicWaveMin(0.0F);
reportD.setVoltageHarmonicWaveAvg(0.0F);
reportD.setVoltageHarmonicWave95(0.0F);
reportD.setHarmonicVoltageContent_2Max(0.0F);
reportD.setHarmonicVoltageContent_2Min(0.0F);
reportD.setHarmonicVoltageContent_2Avg(0.0F);
reportD.setHarmonicVoltageContent_295(0.0F);
reportD.setHarmonicVoltageContent_3Max(0.0F);
reportD.setHarmonicVoltageContent_3Min(0.0F);
reportD.setHarmonicVoltageContent_3Avg(0.0F);
reportD.setHarmonicVoltageContent_395(0.0F);
reportD.setHarmonicVoltageContent_4Max(0.0F);
reportD.setHarmonicVoltageContent_4Min(0.0F);
reportD.setHarmonicVoltageContent_4Avg(0.0F);
reportD.setHarmonicVoltageContent_495(0.0F);
reportD.setHarmonicVoltageContent_5Max(0.0F);
reportD.setHarmonicVoltageContent_5Min(0.0F);
reportD.setHarmonicVoltageContent_5Avg(0.0F);
reportD.setHarmonicVoltageContent_595(0.0F);
reportD.setHarmonicVoltageContent_6Max(0.0F);
reportD.setHarmonicVoltageContent_6Min(0.0F);
reportD.setHarmonicVoltageContent_6Avg(0.0F);
reportD.setHarmonicVoltageContent_695(0.0F);
reportD.setHarmonicVoltageContent_7Max(0.0F);
reportD.setHarmonicVoltageContent_7Min(0.0F);
reportD.setHarmonicVoltageContent_7Avg(0.0F);
reportD.setHarmonicVoltageContent_795(0.0F);
reportD.setHarmonicVoltageContent_8Max(0.0F);
reportD.setHarmonicVoltageContent_8Min(0.0F);
reportD.setHarmonicVoltageContent_8Avg(0.0F);
reportD.setHarmonicVoltageContent_895(0.0F);
reportD.setHarmonicVoltageContent_9Max(0.0F);
reportD.setHarmonicVoltageContent_9Min(0.0F);
reportD.setHarmonicVoltageContent_9Avg(0.0F);
reportD.setHarmonicVoltageContent_995(0.0F);
reportD.setHarmonicVoltageContent_10Max(0.0F);
reportD.setHarmonicVoltageContent_10Min(0.0F);
reportD.setHarmonicVoltageContent_10Avg(0.0F);
reportD.setHarmonicVoltageContent_1095(0.0F);
reportD.setHarmonicVoltageContent_11Max(0.0F);
reportD.setHarmonicVoltageContent_11Min(0.0F);
reportD.setHarmonicVoltageContent_11Avg(0.0F);
reportD.setHarmonicVoltageContent_1195(0.0F);
reportD.setHarmonicVoltageContent_12Max(0.0F);
reportD.setHarmonicVoltageContent_12Min(0.0F);
reportD.setHarmonicVoltageContent_12Avg(0.0F);
reportD.setHarmonicVoltageContent_1295(0.0F);
reportD.setHarmonicVoltageContent_13Max(0.0F);
reportD.setHarmonicVoltageContent_13Min(0.0F);
reportD.setHarmonicVoltageContent_13Avg(0.0F);
reportD.setHarmonicVoltageContent_1395(0.0F);
reportD.setHarmonicCurrentEffective_2Max(0.0F);
reportD.setHarmonicCurrentEffective_2Min(0.0F);
reportD.setHarmonicCurrentEffective_2Avg(0.0F);
reportD.setHarmonicCurrentEffective_295(0.0F);
reportD.setHarmonicCurrentEffective_3Max(0.0F);
reportD.setHarmonicCurrentEffective_3Min(0.0F);
reportD.setHarmonicCurrentEffective_3Avg(0.0F);
reportD.setHarmonicCurrentEffective_395(0.0F);
reportD.setHarmonicCurrentEffective_4Max(0.0F);
reportD.setHarmonicCurrentEffective_4Min(0.0F);
reportD.setHarmonicCurrentEffective_4Avg(0.0F);
reportD.setHarmonicCurrentEffective_495(0.0F);
reportD.setHarmonicCurrentEffective_5Max(0.0F);
reportD.setHarmonicCurrentEffective_5Min(0.0F);
reportD.setHarmonicCurrentEffective_5Avg(0.0F);
reportD.setHarmonicCurrentEffective_595(0.0F);
reportD.setHarmonicCurrentEffective_6Max(0.0F);
reportD.setHarmonicCurrentEffective_6Min(0.0F);
reportD.setHarmonicCurrentEffective_6Avg(0.0F);
reportD.setHarmonicCurrentEffective_695(0.0F);
reportD.setHarmonicCurrentEffective_7Max(0.0F);
reportD.setHarmonicCurrentEffective_7Min(0.0F);
reportD.setHarmonicCurrentEffective_7Avg(0.0F);
reportD.setHarmonicCurrentEffective_795(0.0F);
reportD.setHarmonicCurrentEffective_8Max(0.0F);
reportD.setHarmonicCurrentEffective_8Min(0.0F);
reportD.setHarmonicCurrentEffective_8Avg(0.0F);
reportD.setHarmonicCurrentEffective_895(0.0F);
reportD.setHarmonicCurrentEffective_9Max(0.0F);
reportD.setHarmonicCurrentEffective_9Min(0.0F);
reportD.setHarmonicCurrentEffective_9Avg(0.0F);
reportD.setHarmonicCurrentEffective_995(0.0F);
reportD.setHarmonicCurrentEffective_10Max(0.0F);
reportD.setHarmonicCurrentEffective_10Min(0.0F);
reportD.setHarmonicCurrentEffective_10Avg(0.0F);
reportD.setHarmonicCurrentEffective_1095(0.0F);
reportD.setHarmonicCurrentEffective_11Max(0.0F);
reportD.setHarmonicCurrentEffective_11Min(0.0F);
reportD.setHarmonicCurrentEffective_11Avg(0.0F);
reportD.setHarmonicCurrentEffective_1195(0.0F);
reportD.setHarmonicCurrentEffective_12Max(0.0F);
reportD.setHarmonicCurrentEffective_12Min(0.0F);
reportD.setHarmonicCurrentEffective_12Avg(0.0F);
reportD.setHarmonicCurrentEffective_1295(0.0F);
reportD.setHarmonicCurrentEffective_13Max(0.0F);
reportD.setHarmonicCurrentEffective_13Min(0.0F);
reportD.setHarmonicCurrentEffective_13Avg(0.0F);
reportD.setHarmonicCurrentEffective_1395(0.0F);
reportD.setHarmonicActivePower_2Max(0.0F);
reportD.setHarmonicActivePower_2Min(0.0F);
reportD.setHarmonicActivePower_2Avg(0.0F);
reportD.setHarmonicActivePower_295(0.0F);
reportD.setHarmonicActivePower_3Max(0.0F);
reportD.setHarmonicActivePower_3Min(0.0F);
reportD.setHarmonicActivePower_3Avg(0.0F);
reportD.setHarmonicActivePower_395(0.0F);
reportD.setHarmonicActivePower_4Max(0.0F);
reportD.setHarmonicActivePower_4Min(0.0F);
reportD.setHarmonicActivePower_4Avg(0.0F);
reportD.setHarmonicActivePower_495(0.0F);
reportD.setHarmonicActivePower_5Max(0.0F);
reportD.setHarmonicActivePower_5Min(0.0F);
reportD.setHarmonicActivePower_5Avg(0.0F);
reportD.setHarmonicActivePower_595(0.0F);
reportD.setHarmonicActivePower_6Max(0.0F);
reportD.setHarmonicActivePower_6Min(0.0F);
reportD.setHarmonicActivePower_6Avg(0.0F);
reportD.setHarmonicActivePower_695(0.0F);
reportD.setHarmonicActivePower_7Max(0.0F);
reportD.setHarmonicActivePower_7Min(0.0F);
reportD.setHarmonicActivePower_7Avg(0.0F);
reportD.setHarmonicActivePower_795(0.0F);
reportD.setHarmonicActivePower_8Max(0.0F);
reportD.setHarmonicActivePower_8Min(0.0F);
reportD.setHarmonicActivePower_8Avg(0.0F);
reportD.setHarmonicActivePower_895(0.0F);
reportD.setHarmonicActivePower_9Max(0.0F);
reportD.setHarmonicActivePower_9Min(0.0F);
reportD.setHarmonicActivePower_9Avg(0.0F);
reportD.setHarmonicActivePower_995(0.0F);
reportD.setHarmonicActivePower_10Max(0.0F);
reportD.setHarmonicActivePower_10Min(0.0F);
reportD.setHarmonicActivePower_10Avg(0.0F);
reportD.setHarmonicActivePower_1095(0.0F);
reportD.setHarmonicActivePower_11Max(0.0F);
reportD.setHarmonicActivePower_11Min(0.0F);
reportD.setHarmonicActivePower_11Avg(0.0F);
reportD.setHarmonicActivePower_1195(0.0F);
reportD.setHarmonicActivePower_12Max(0.0F);
reportD.setHarmonicActivePower_12Min(0.0F);
reportD.setHarmonicActivePower_12Avg(0.0F);
reportD.setHarmonicActivePower_1295(0.0F);
reportD.setHarmonicActivePower_13Max(0.0F);
reportD.setHarmonicActivePower_13Min(0.0F);
reportD.setHarmonicActivePower_13Avg(0.0F);
reportD.setHarmonicActivePower_1395(0.0F);
reportD.setPositiveSequenceVoltageMax(0.0F);
reportD.setPositiveSequenceVoltageMin(0.0F);
reportD.setPositiveSequenceVoltageAvg(0.0F);
reportD.setPositiveSequenceVoltage95(0.0F);
reportD.setNegativeSequenceVoltageMax(0.0F);
reportD.setNegativeSequenceVoltageMin(0.0F);
reportD.setNegativeSequenceVoltageAvg(0.0F);
reportD.setNegativeSequenceVoltage95(0.0F);
reportD.setZeroSequenceVoltageMax(0.0F);
reportD.setZeroSequenceVoltageMin(0.0F);
reportD.setZeroSequenceVoltageAvg(0.0F);
reportD.setZeroSequenceVoltage95(0.0F);
reportD.setNegativeSequenceVoltageUnbalanceMax(0.0F);
reportD.setNegativeSequenceVoltageUnbalanceMin(0.0F);
reportD.setNegativeSequenceVoltageUnbalanceAvg(0.0F);
reportD.setNegativeSequenceVoltageUnbalance95(0.0F);
reportD.setZeroSequenceVoltageImbalanceMax(0.0F);
reportD.setZeroSequenceVoltageImbalanceMin(0.0F);
reportD.setZeroSequenceVoltageImbalanceAvg(0.0F);
reportD.setZeroSequenceVoltageImbalance95(0.0F);
reportD.setNegativeSequenceCurrentUnbalanceMax(0.0F);
reportD.setNegativeSequenceCurrentUnbalanceMin(0.0F);
reportD.setNegativeSequenceCurrentUnbalanceAvg(0.0F);
reportD.setNegativeSequenceCurrentUnbalance95(0.0F);
reportD.setZeroSequenceCurrentImbalanceMax(0.0F);
reportD.setZeroSequenceCurrentImbalanceMin(0.0F);
reportD.setZeroSequenceCurrentImbalanceAvg(0.0F);
reportD.setZeroSequenceCurrentImbalance95(0.0F);
reportD.setFlowBackflowOverloadLoadrateMax(0.0F);
reportD.setFlowBackflowOverloadLoadrateMin(0.0F);
reportD.setFlowBackflowOverloadLoadrateAvg(0.0F);
reportD.setFlowBackflowOverloadLoadrate95(0.0F);
reportD.setHarmonicVoltageOverrunDuration(0);
reportD.setTpVoltageUnbalanceOverrunDuration(0);
}
}