|
@@ -54,7 +54,6 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
@Test
|
|
|
void saveEquipmentRfdl() {
|
|
|
|
|
|
-
|
|
|
//1,在testingpoint中根据 uniform_code=AI064 和code like "%_FJ_%" 取出所有风机的电量测点code
|
|
|
List<TestingPoint> testingPointList = testingPointService.list(new QueryWrapper<TestingPoint>()
|
|
|
.eq("uniform_code", "AI064")
|
|
@@ -134,8 +133,8 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
|
|
|
//避免出现过大错误数据,异常数据给死值4444.4444
|
|
|
- if (rfdl.doubleValue() > 100000 || rfdl.doubleValue() < 0){
|
|
|
- rfdl= BigDecimal.valueOf(4444.4444);
|
|
|
+ if (rfdl.doubleValue() > 100000 || rfdl.doubleValue() < 0) {
|
|
|
+ rfdl = BigDecimal.valueOf(4444.4444);
|
|
|
}
|
|
|
//9,company_nem_code (powerstation_nem_code project_nem_code line_nem_code equipment_nem_code )都在basic equipment中叫project_id name date rfdl 存入meterInfo表中
|
|
|
Equipment thingId1 = equipmentService.getOne(new QueryWrapper<Equipment>().eq("nem_code", thingId));
|
|
@@ -149,6 +148,7 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
meterInfoEquipment.setDate(dateTime1.toLocalDateTime());
|
|
|
meterInfoEquipment.setRfdl(rfdl);
|
|
|
meterInfoEquipment.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
QueryWrapper<MeterInfoEquipment> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("equipment_nem_code", thingId1.getNemCode()).eq("date", dateTime1.toLocalDateTime());
|
|
|
List<MeterInfoEquipment> list = meterInfoEquipmentService.list(queryWrapper);
|
|
@@ -605,7 +605,6 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//光伏日发电量
|
|
|
@Test
|
|
|
void saveEquipmentRfdl_GF() {
|
|
@@ -915,8 +914,8 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
|
|
|
|
|
|
//避免出现过大错误数据,异常数据给死值4444.4444
|
|
|
- if (rfdl.doubleValue() > 15000 || rfdl.doubleValue() < 0){
|
|
|
- rfdl= BigDecimal.valueOf(4444.4444);
|
|
|
+ if (rfdl.doubleValue() > 15000 || rfdl.doubleValue() < 0) {
|
|
|
+ rfdl = BigDecimal.valueOf(4444.4444);
|
|
|
}
|
|
|
//9,company_nem_code (powerstation_nem_code project_nem_code line_nem_code equipment_nem_code )都在basic equipment中叫project_id name date rfdl 存入meterInfo表中
|
|
|
Equipment thingId1 = equipmentService.getOne(new QueryWrapper<Equipment>().eq("nem_code", thingId));
|
|
@@ -942,6 +941,386 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //光伏日发电量,优化批量插入或者更新
|
|
|
+ @Test
|
|
|
+ void saveEquipmentRfdl_GF1() {
|
|
|
+
|
|
|
+ //设置取值开始时间
|
|
|
+ String startString = startTimeString;
|
|
|
+ DateTime startDateTime = DateUtil.parse(startString);
|
|
|
+
|
|
|
+ //设置取值结束时间
|
|
|
+ String endDateString = endTimeString;
|
|
|
+ DateTime endDateTime = DateUtil.parse(endDateString);
|
|
|
+
|
|
|
+ //指定开始日期到结束日期的天数
|
|
|
+ LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
+ LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
+ long between = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+
|
|
|
+
|
|
|
+ //1,在testingpoint中根据 uniform_code=AI064 和code like "%_G_IN_%" 取出所有光伏的电量测点code
|
|
|
+ List<TestingPoint> testingPointList = testingPointService.list(new QueryWrapper<TestingPoint>()
|
|
|
+ .eq("uniform_code", "AI064")
|
|
|
+ .like("thing_id", "%_G_IN_%")
|
|
|
+ );
|
|
|
+
|
|
|
+ //批量查询的thingIDs
|
|
|
+ ArrayList<String> thingIds = new ArrayList<>();
|
|
|
+ for (TestingPoint testingPoint1 : testingPointList) {
|
|
|
+ //获取设备ID
|
|
|
+ String thingId = testingPoint1.getThingId();
|
|
|
+ thingIds.add(thingId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ArrayList<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+// LocalDateTime localDateTime5 = dateTime4.toLocalDateTime();
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ QueryWrapper<MeterInfoEquipment> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .in("equipment_nem_code", thingIds)
|
|
|
+ .in("date", dateTimes);
|
|
|
+ List<MeterInfoEquipment> listMeterInfoEquipment = meterInfoEquipmentService.list(queryWrapper);
|
|
|
+
|
|
|
+
|
|
|
+ ArrayList<MeterInfoEquipment> insertList = new ArrayList<>();
|
|
|
+ ArrayList<MeterInfoEquipment> updateList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ //2,遍历list,每次取出一个code
|
|
|
+ for (TestingPoint testingPoint : testingPointList) {
|
|
|
+ //获取测点code
|
|
|
+ String pointcode = testingPoint.getCode();
|
|
|
+ //获取设备ID
|
|
|
+ String thingId = testingPoint.getThingId();
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
+
|
|
|
+ DateTime dateTime0 = DateUtil.offsetMillisecond(DateUtil.offsetDay(startDateTime, i), -1);
|
|
|
+ DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+// DateTime dateTime2 = DateUtil.offsetDay(startDateTime, i + 1);
|
|
|
+ DateTime dateTime2 = DateUtil.offsetMillisecond(DateUtil.offsetDay(startDateTime, i + 1), -1);
|
|
|
+
|
|
|
+ //8,结束点发电量减去开始点发电量得到日发电量(单位Kwh)
|
|
|
+ Map<String, PointData> historySection = adapter.getHistorySection(pointcode, dateTime0.getTime());
|
|
|
+ double value0 = 0;
|
|
|
+ if (!historySection.isEmpty()) {
|
|
|
+ value0 = historySection.get(pointcode).getValue();
|
|
|
+ }
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(Double.toString(value0));
|
|
|
+
|
|
|
+
|
|
|
+ List<PointData> historyRaw = adapter.getHistoryRaw(pointcode, dateTime1.getTime(), dateTime2.getTime());
|
|
|
+
|
|
|
+ BigDecimal rfdl = new BigDecimal(0);
|
|
|
+
|
|
|
+
|
|
|
+ if (historyRaw.size() > 0) {
|
|
|
+// BigDecimal bigDecimal1 = new BigDecimal(Double.toString(historyRaw.get(0).getValue()));
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(Double.toString(historyRaw.get(historyRaw.size() - 1).getValue()));
|
|
|
+ rfdl = bigDecimal2.subtract(bigDecimal1);
|
|
|
+
|
|
|
+
|
|
|
+ if (testingPoint.getStationId().equals("NX_GDDL_PL_GDC_STA")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_040_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_042_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_041_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_043_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_045_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_017_AI0021")) {
|
|
|
+ rfdl = rfdl.multiply(BigDecimal.valueOf(1000));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_014_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_018_AI0021")) {
|
|
|
+ rfdl = rfdl.multiply(BigDecimal.valueOf(1000));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_019_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_015_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_016_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_011_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_012_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_013_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_020_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (testingPoint.getStationId().equals("NX_GDDL_MCH_GDC_STA")) {
|
|
|
+ rfdl = rfdl.multiply(BigDecimal.valueOf(1000));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_035_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_038_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_039_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_033_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_034_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_037_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_040_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_041_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_042_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_036_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (rfdl.doubleValue() > 15000 || rfdl.doubleValue() < 0) {
|
|
|
+
|
|
|
+ ArrayList<Double> arrayList = new ArrayList<>();
|
|
|
+ for (PointData pointData : historyRaw) {
|
|
|
+ arrayList.add(pointData.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ int index = -1;
|
|
|
+ for (int j = 1; j < arrayList.size(); j++) {
|
|
|
+ double current = arrayList.get(j);
|
|
|
+ double previous = arrayList.get(j - 1);
|
|
|
+ double difference = current - previous;
|
|
|
+ if (difference > 15000 || difference < -1) {
|
|
|
+ index = j;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (index != -1) {
|
|
|
+ double valueGrow2 = arrayList.get(index);
|
|
|
+ BigDecimal bigDecimalGrow2 = new BigDecimal(Double.toString(valueGrow2));
|
|
|
+ double valueGrow1 = arrayList.get(index - 1);
|
|
|
+ BigDecimal bigDecimalGrow1 = new BigDecimal(Double.toString(valueGrow1));
|
|
|
+ rfdl = (bigDecimal2.subtract(bigDecimalGrow2)).add(bigDecimalGrow1.subtract(bigDecimal1));
|
|
|
+ if (testingPoint.getStationId().equals("NX_GDDL_PL_GDC_STA")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_040_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_042_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_041_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_043_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("PLGF.NX_GD_PLG_GF_P2_L2_045_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (testingPoint.getStationId().equals("NX_GDDL_MCH_GDC_STA")) {
|
|
|
+ rfdl = rfdl.multiply(BigDecimal.valueOf(1000));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_014_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_018_AI0021")) {
|
|
|
+ rfdl = rfdl.multiply(BigDecimal.valueOf(1000));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_019_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_015_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_017_AI0021")) {
|
|
|
+ rfdl = rfdl.multiply(BigDecimal.valueOf(1000));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_016_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_011_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_012_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_013_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("DWKGF.NX_GD_DWKG_GF_P1_L2_020_AI0021")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_035_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_038_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_039_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_033_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_034_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_037_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_040_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_041_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_042_AI0005")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (testingPoint.getCode().equals("XHGF.NX_GD_XHG_GF_P1_L4_036_AI0055")) {
|
|
|
+ rfdl = rfdl.divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //避免出现过大错误数据,异常数据给死值4444.4444
|
|
|
+ if (rfdl.doubleValue() > 15000 || rfdl.doubleValue() < 0) {
|
|
|
+ rfdl = BigDecimal.valueOf(4444.4444);
|
|
|
+ }
|
|
|
+ //9,company_nem_code (powerstation_nem_code project_nem_code line_nem_code equipment_nem_code )都在basic equipment中叫project_id name date rfdl 存入meterInfo表中
|
|
|
+ Equipment thingId1 = equipmentService.getOne(new QueryWrapper<Equipment>().eq("nem_code", thingId));
|
|
|
+
|
|
|
+ MeterInfoEquipment meterInfoEquipment = new MeterInfoEquipment();
|
|
|
+ meterInfoEquipment.setPowerstationNemCode(thingId1.getWindpowerstationId());
|
|
|
+ meterInfoEquipment.setProjectNemCode(thingId1.getProjectId());
|
|
|
+ meterInfoEquipment.setLineNemCode(thingId1.getLineId());
|
|
|
+ meterInfoEquipment.setEquipmentNemCode(thingId1.getNemCode());
|
|
|
+ meterInfoEquipment.setName(thingId1.getName());
|
|
|
+ meterInfoEquipment.setDate(dateTime1.toLocalDateTime());
|
|
|
+ meterInfoEquipment.setRfdl(rfdl);
|
|
|
+
|
|
|
+
|
|
|
+ //遍历listMeterInfoEquipment,有则放入更新集合,没有则放入插入集合
|
|
|
+ boolean add = false;
|
|
|
+ for (MeterInfoEquipment meterInfoEquipmentOne : listMeterInfoEquipment) {
|
|
|
+ if (dateTime1.toLocalDateTime().equals(meterInfoEquipmentOne.getDate()) && thingId1.getNemCode().equals(meterInfoEquipmentOne.getEquipmentNemCode())) {
|
|
|
+ add = updateList.add(meterInfoEquipment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!add) {
|
|
|
+ insertList.add(meterInfoEquipment);
|
|
|
+ }
|
|
|
+
|
|
|
+//
|
|
|
+// if (listMeterInfoEquipment.contains(meterInfoEquipment)) {
|
|
|
+// updateList.add(meterInfoEquipment);
|
|
|
+// } else {
|
|
|
+// insertList.add(meterInfoEquipment);
|
|
|
+// }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ meterInfoEquipmentService.saveBatch(insertList);
|
|
|
+ meterInfoEquipmentService.updateBatchById(updateList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//光伏逆变器日发电量(场站)
|
|
|
@Test
|
|
|
void saveCalculatingNBQFDL() {
|
|
@@ -1152,8 +1531,7 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
String formula2 = formula1
|
|
|
.replaceAll("DL.NX", "DL_NX")
|
|
|
.replaceAll("DJL.", "DJL_")
|
|
|
- .replaceAll("PLSJ1.NX", "PLSJ1_NX")
|
|
|
- ;
|
|
|
+ .replaceAll("PLSJ1.NX", "PLSJ1_NX");
|
|
|
System.out.println("转换后的公式字符串:" + formula2);
|
|
|
|
|
|
|
|
@@ -1182,8 +1560,7 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
String formula2 = formula1
|
|
|
.replaceAll("DL.NX", "DL_NX")
|
|
|
.replaceAll("DJL.", "DJL_")
|
|
|
- .replaceAll("PLSJ1.NX", "PLSJ1_NX")
|
|
|
- ;
|
|
|
+ .replaceAll("PLSJ1.NX", "PLSJ1_NX");
|
|
|
System.out.println("转换后的公式字符串:" + formula2);
|
|
|
|
|
|
|
|
@@ -1206,8 +1583,7 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
String meterPointCode_ = meterPointCode
|
|
|
.replaceAll("DL.", "DL_")
|
|
|
.replaceAll("DJL.", "DJL_")
|
|
|
- .replaceAll("PLSJ1.NX", "PLSJ1_NX")
|
|
|
- ;
|
|
|
+ .replaceAll("PLSJ1.NX", "PLSJ1_NX");
|
|
|
System.out.println("要查询的点code:" + meterPointCode);
|
|
|
System.out.println("替换后的点code:" + meterPointCode_);
|
|
|
//
|
|
@@ -1247,7 +1623,7 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
meterInfoCalculating.setName(meterPoint.getName());
|
|
|
meterInfoCalculating.setCode(meterPoint.getNemCode());
|
|
|
meterInfoCalculating.setDate(dateTime1.toLocalDateTime());
|
|
|
- meterInfoCalculating.setValue(bigDecimal1.divide(BigDecimal.valueOf(10000),4,RoundingMode.HALF_EVEN));
|
|
|
+ meterInfoCalculating.setValue(bigDecimal1.divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_EVEN));
|
|
|
meterInfoCalculating.setUpdateTime(LocalDateTime.now());
|
|
|
meterInfoCalculating.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
|
|
@@ -1290,7 +1666,6 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//风场总
|
|
|
@Test
|
|
|
void saveFJ() {
|
|
@@ -1312,7 +1687,8 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
//光伏总
|
|
|
@Test
|
|
|
void saveGF() {
|
|
|
- this.saveEquipmentRfdl_GF();
|
|
|
+// this.saveEquipmentRfdl_GF();
|
|
|
+ this.saveEquipmentRfdl_GF1();
|
|
|
this.saveCalculatingNBQFDL();
|
|
|
this.saveBottomCode_GF();
|
|
|
this.saveCalculating_GF();
|
|
@@ -1322,6 +1698,13 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
//风场+光伏
|
|
|
@Test
|
|
|
void saveFJ_GF() {
|
|
|
+
|
|
|
+ this.saveEquipmentRfdl_GF();
|
|
|
+ this.saveCalculatingNBQFDL();
|
|
|
+ this.saveBottomCode_GF();
|
|
|
+ this.saveCalculating_GF();
|
|
|
+
|
|
|
+
|
|
|
this.saveEquipmentRfdl();
|
|
|
this.saveBottomCode();
|
|
|
this.saveCalculatingProjectFDL();
|
|
@@ -1337,14 +1720,8 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
// this.saveCalculating();
|
|
|
// this.saveCalculating();
|
|
|
|
|
|
- this.saveEquipmentRfdl_GF();
|
|
|
- this.saveCalculatingNBQFDL();
|
|
|
- this.saveBottomCode_GF();
|
|
|
- this.saveCalculating_GF();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|