|
@@ -132,6 +132,11 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //避免出现过大错误数据,异常数据给死值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));
|
|
|
|
|
@@ -156,7 +161,6 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//电计量底码表
|
|
|
@Test
|
|
|
void saveCalculatingProjectFDL() {
|
|
@@ -325,7 +329,6 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //项目期次风机总发电量
|
|
|
|
|
|
//有公式的计算电量
|
|
|
@Test
|
|
@@ -344,7 +347,9 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
long between = ChronoUnit.DAYS.between(day1, day2);
|
|
|
|
|
|
- List<MeterPoint> meterPointJSDList = meterPointService.list(new QueryWrapper<MeterPoint>().eq("property", "JSD").ne("formula", ""));
|
|
|
+ List<MeterPoint> meterPointJSDList = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("property", "JSD")
|
|
|
+ .ne("formula", ""));
|
|
|
|
|
|
for (MeterPoint meterPoint : meterPointJSDList) {
|
|
|
String formula1 = meterPoint.getFormula();
|
|
@@ -442,19 +447,169 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //调用上面4个,第四个需要3-4次
|
|
|
+ //有公式的计算,优化查询
|
|
|
@Test
|
|
|
- void saveFJ() {
|
|
|
- this.saveEquipmentRfdl();
|
|
|
- this.saveBottomCode();
|
|
|
- this.saveCalculatingProjectFDL();
|
|
|
- this.saveCalculating();
|
|
|
- this.saveCalculating();
|
|
|
- this.saveCalculating();
|
|
|
- this.saveCalculating();
|
|
|
+ void saveCalculating_FJ() {
|
|
|
+
|
|
|
+ //设置取值开始时间
|
|
|
+ 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);
|
|
|
+
|
|
|
+ List<MeterPoint> meterPointJSDList = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("property", "JSD")
|
|
|
+ .ne("formula", ""));
|
|
|
+
|
|
|
+
|
|
|
+ //时间集合,以便后面批量查询
|
|
|
+ List<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+ //code集合,以便后面批量查询
|
|
|
+ List<String> codes = new ArrayList<>();
|
|
|
+ for (MeterPoint meterPoint : meterPointJSDList) {
|
|
|
+ String formula1 = meterPoint.getFormula();
|
|
|
+ System.out.println("转换前的公式:" + formula1);
|
|
|
+ String formula2 = formula1.replaceAll("DL.NX", "DL_NX").replaceAll("DJL.", "DJL_");
|
|
|
+ System.out.println("转换后的公式字符串:" + formula2);
|
|
|
+
|
|
|
+
|
|
|
+ String[] meterPointCodes = StringUtils.split(formula1, "[+-*/()]");
|
|
|
+ meterPointCodes = Arrays.stream(meterPointCodes)
|
|
|
+ .filter(meterPointCode -> !(meterPointCode.length() < 8))
|
|
|
+ .toArray(String[]::new);
|
|
|
+ System.out.println("过滤后公式中的测点数:" + meterPointCodes.length);
|
|
|
+ System.out.println(Arrays.toString(meterPointCodes));
|
|
|
+ codes.addAll(Arrays.asList(meterPointCodes));
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量查询
|
|
|
+ List<MeterInfoCalculating> list1 = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>()
|
|
|
+ .in("code", codes)
|
|
|
+ .in("date", dateTimes)
|
|
|
+ );
|
|
|
+ List<MeterInfoBottomcode> list2 = meterInfoBottomcodeService.list(new QueryWrapper<MeterInfoBottomcode>()
|
|
|
+ .in("code", codes)
|
|
|
+ .in("start_time", dateTimes));
|
|
|
+
|
|
|
+
|
|
|
+ for (MeterPoint meterPoint : meterPointJSDList) {
|
|
|
+ String formula1 = meterPoint.getFormula();
|
|
|
+ System.out.println("转换前的公式:" + formula1);
|
|
|
+ String formula2 = formula1.replaceAll("DL.NX", "DL_NX").replaceAll("DJL.", "DJL_");
|
|
|
+ System.out.println("转换后的公式字符串:" + formula2);
|
|
|
+
|
|
|
+
|
|
|
+ String[] meterPointCodes = StringUtils.split(formula1, "[+-*/()]");
|
|
|
+ meterPointCodes = Arrays.stream(meterPointCodes)
|
|
|
+ .filter(meterPointCode -> !(meterPointCode.length() < 8))
|
|
|
+ .toArray(String[]::new);
|
|
|
+ System.out.println("过滤后公式中的测点数:" + meterPointCodes.length);
|
|
|
+ System.out.println(Arrays.toString(meterPointCodes));
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ //开始时间
|
|
|
+ DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+// DateTime dateTime2 = DateUtil.offsetDay(startDateTime, i + 1);
|
|
|
+ //遍历code数据,拿到每一个code,用code和时间,在meter_info_bottom中拿到dayValue
|
|
|
+ for (String meterPointCode : meterPointCodes) {
|
|
|
+// String meterPointCode_ = meterPointCode.replaceAll("\\.", "_");
|
|
|
+ String meterPointCode_ = meterPointCode.replaceAll("DL.", "DL_").replaceAll("DJL.", "DJL_");
|
|
|
+ System.out.println("要查询的点code:" + meterPointCode);
|
|
|
+ System.out.println("替换后的点code:" + meterPointCode_);
|
|
|
+//
|
|
|
+ try {
|
|
|
+ if (meterPointCode.startsWith("DL")) {
|
|
|
+ System.out.println("计算测点DL:" + meterPointCode);
|
|
|
+ for (MeterInfoCalculating meterInfoCalculating : list1) {
|
|
|
+ if (meterInfoCalculating.getCode().equals(meterPointCode) && meterInfoCalculating.getDate().equals(dateTime1.toLocalDateTime())) {
|
|
|
+
|
|
|
+ System.out.println("DL点数据:" + meterInfoCalculating.getValue());
|
|
|
+ map.put(meterPointCode_, meterInfoCalculating.getValue());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ System.out.println("计算测点Bottom:" + meterPointCode);
|
|
|
+
|
|
|
+ for (MeterInfoBottomcode meterInfoBottomcode : list2) {
|
|
|
+ if (meterInfoBottomcode.getCode().equals(meterPointCode) && meterInfoBottomcode.getStartTime().equals(dateTime1.toLocalDateTime())) {
|
|
|
+
|
|
|
+ System.out.println("Bottom点数据日电量:" + meterInfoBottomcode.getDayValue());
|
|
|
+ map.put(meterPointCode_, meterInfoBottomcode.getDayValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println("获取数据异常:" + e.getMessage());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("map集合:" + map);
|
|
|
+ try {
|
|
|
+ BigDecimal bigDecimal1 = (BigDecimal) ScriptShell.parseExpr(formula2, map);
|
|
|
+ System.out.println("公式计算后数据:" + bigDecimal1);
|
|
|
+ MeterInfoCalculating meterInfoCalculating = new MeterInfoCalculating();
|
|
|
+ meterInfoCalculating.setName(meterPoint.getName());
|
|
|
+ meterInfoCalculating.setCode(meterPoint.getNemCode());
|
|
|
+ meterInfoCalculating.setDate(dateTime1.toLocalDateTime());
|
|
|
+ meterInfoCalculating.setValue(bigDecimal1);
|
|
|
+ meterInfoCalculating.setUpdateTime(LocalDateTime.now());
|
|
|
+ meterInfoCalculating.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
+
|
|
|
+ QueryWrapper<MeterInfoCalculating> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("date", dateTime1.toLocalDateTime()).eq("code", meterPoint.getNemCode());
|
|
|
+ List<MeterInfoCalculating> list = meterInfoCalculatingService.list(queryWrapper);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ meterInfoCalculating.update(queryWrapper);
|
|
|
+ } else {
|
|
|
+ meterInfoCalculating.insert();
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (ArithmeticException e) {
|
|
|
+
|
|
|
+ MeterInfoCalculating meterInfoCalculating = new MeterInfoCalculating();
|
|
|
+ meterInfoCalculating.setName(meterPoint.getName());
|
|
|
+ meterInfoCalculating.setCode(meterPoint.getNemCode());
|
|
|
+ meterInfoCalculating.setDate(dateTime1.toLocalDateTime());
|
|
|
+ meterInfoCalculating.setValue(BigDecimal.valueOf(0));
|
|
|
+ meterInfoCalculating.setUpdateTime(LocalDateTime.now());
|
|
|
+ meterInfoCalculating.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
+
|
|
|
+ QueryWrapper<MeterInfoCalculating> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("date", dateTime1.toLocalDateTime()).eq("code", meterPoint.getNemCode());
|
|
|
+ List<MeterInfoCalculating> list = meterInfoCalculatingService.list(queryWrapper);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ meterInfoCalculating.update(queryWrapper);
|
|
|
+ } else {
|
|
|
+ meterInfoCalculating.insert();
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println("存入异常 :" + e.getMessage());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
//光伏日发电量
|
|
|
@Test
|
|
|
void saveEquipmentRfdl_GF() {
|
|
@@ -506,11 +661,125 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
|
|
|
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<>();
|
|
@@ -534,9 +803,125 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
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));
|
|
|
|
|
@@ -561,12 +946,68 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //电计量底码表
|
|
|
+ @Test
|
|
|
+ void saveCalculatingNBQFDL() {
|
|
|
+
|
|
|
+
|
|
|
+ //设置取值开始时间
|
|
|
+ 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,所有期次发电量测点
|
|
|
+ List<MeterPoint> meterPointList = meterPointService.list(new QueryWrapper<MeterPoint>().eq("property", "JSD_NBQFDL"));
|
|
|
+
|
|
|
+ //遍历期次发电量测点,拿到场站id,
|
|
|
+ for (MeterPoint meterPoint : meterPointList) {
|
|
|
+ String projectId = meterPoint.getWindpowerstationId();
|
|
|
+
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
+ DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+
|
|
|
+ List<MeterInfoEquipment> meterInfoEquipments = meterInfoEquipmentService.list(new QueryWrapper<MeterInfoEquipment>().eq("powerstation_nem_code", projectId).eq("date", dateTime1));
|
|
|
+ BigDecimal bigDecimal = BigDecimal.valueOf(0);
|
|
|
+ for (MeterInfoEquipment meterInfoEquipment : meterInfoEquipments) {
|
|
|
+ bigDecimal = bigDecimal.add(meterInfoEquipment.getRfdl());
|
|
|
+ }
|
|
|
+
|
|
|
+ MeterInfoCalculating meterInfoCalculating = new MeterInfoCalculating();
|
|
|
+ meterInfoCalculating.setName(meterPoint.getName());
|
|
|
+ meterInfoCalculating.setDate(dateTime1.toLocalDateTime());
|
|
|
+ meterInfoCalculating.setValue(bigDecimal.divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_EVEN));
|
|
|
+ meterInfoCalculating.setCode(meterPoint.getNemCode());
|
|
|
+ meterInfoCalculating.setUpdateTime(LocalDateTime.now());
|
|
|
+ meterInfoCalculating.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
+
|
|
|
+ QueryWrapper<MeterInfoCalculating> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("date", dateTime1.toLocalDateTime()).eq("code", meterPoint.getNemCode());
|
|
|
+ List<MeterInfoCalculating> list = meterInfoCalculatingService.list(queryWrapper);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ meterInfoCalculating.update(queryWrapper);
|
|
|
+ } else {
|
|
|
+ meterInfoCalculating.insert();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//光伏底码数据
|
|
|
@Test
|
|
|
void saveBottomCode_GF() {
|
|
|
|
|
|
- //1,查询所有风电场
|
|
|
- List<PowerStation> powerStationList = powerStationService.list(new QueryWrapper<PowerStation>().like("nem_code", "_GDC_"));
|
|
|
+ //1,查询所有光电场
|
|
|
+ List<PowerStation> powerStationList = powerStationService.list(new QueryWrapper<PowerStation>()
|
|
|
+ .like("nem_code", "_GDC_"));
|
|
|
|
|
|
for (PowerStation powerStation : powerStationList) {
|
|
|
|
|
@@ -576,100 +1017,103 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
.eq("property", "CD")
|
|
|
);
|
|
|
|
|
|
- //3,遍历测点,拿到每个测点的nem_code
|
|
|
- for (MeterPoint meterPoint : meterPointList) {
|
|
|
- System.out.println(meterPoint);
|
|
|
- //获取测点code
|
|
|
- String pointcode = meterPoint.getNemCode();
|
|
|
+ if (meterPointList.size() > 0) {
|
|
|
|
|
|
- //设置取值开始时间
|
|
|
- String startString = startTimeString;
|
|
|
- DateTime startDateTime = DateUtil.parse(startString);
|
|
|
+ //3,遍历测点,拿到每个测点的nem_code
|
|
|
+ for (MeterPoint meterPoint : meterPointList) {
|
|
|
+ System.out.println(meterPoint);
|
|
|
+ //获取测点code
|
|
|
+ String pointcode = meterPoint.getNemCode();
|
|
|
|
|
|
- //设置取值结束时间
|
|
|
- String endDateString = endTimeString;
|
|
|
- DateTime endDateTime = DateUtil.parse(endDateString);
|
|
|
+ //设置取值开始时间
|
|
|
+ String startString = startTimeString;
|
|
|
+ DateTime startDateTime = DateUtil.parse(startString);
|
|
|
|
|
|
- //指定开始日期到结束日期的天数
|
|
|
- LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
- LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
- long between = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+ //设置取值结束时间
|
|
|
+ String endDateString = endTimeString;
|
|
|
+ DateTime endDateTime = DateUtil.parse(endDateString);
|
|
|
|
|
|
- for (int i = 0; i <= between; i++) {
|
|
|
+ //指定开始日期到结束日期的天数
|
|
|
+ LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
+ LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
+ long between = ChronoUnit.DAYS.between(day1, day2);
|
|
|
|
|
|
- DateTime dateTime0 = DateUtil.offsetMillisecond(DateUtil.offsetDay(startDateTime, i), -1);
|
|
|
- //开始时间00:00:01
|
|
|
- DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
- //结束时间第二天00:00:01
|
|
|
-// DateTime dateTime2 = DateUtil.offsetDay(startDateTime, i + 1);
|
|
|
- DateTime dateTime2 = DateUtil.offsetMillisecond(DateUtil.offsetDay(startDateTime, i + 1), -1);
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
|
|
|
- BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
- BigDecimal bigDecimal2 = new BigDecimal(0);
|
|
|
- BigDecimal rfdl = new BigDecimal(0);
|
|
|
+ //开始时间,前一天最后
|
|
|
+ DateTime dateTime0 = DateUtil.offsetMillisecond(DateUtil.offsetDay(startDateTime, i), -1);
|
|
|
|
|
|
- Map<String, PointData> historySection = adapter.getHistorySection(pointcode, dateTime0.getTime());
|
|
|
- double value0 = 0;
|
|
|
- if (!historySection.isEmpty()) {
|
|
|
- value0 = historySection.get(pointcode).getValue();
|
|
|
- }
|
|
|
- bigDecimal1 = new BigDecimal(Double.toString(value0));
|
|
|
+ DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ //结束时间,当天最后
|
|
|
+ DateTime dateTime2 = DateUtil.offsetMillisecond(DateUtil.offsetDay(startDateTime, i + 1), -1);
|
|
|
|
|
|
- List<PointData> historyRaw = adapter.getHistoryRaw(pointcode, dateTime1.getTime(), dateTime2.getTime());
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(0);
|
|
|
+ BigDecimal rfdl = new BigDecimal(0);
|
|
|
|
|
|
- if (historyRaw.size() > 0) {
|
|
|
-// bigDecimal1 = new BigDecimal(Double.toString(historyRaw.get(0).getValue()));
|
|
|
- bigDecimal1 = bigDecimal1.divide(meterPoint.getXs(), 4, RoundingMode.HALF_EVEN);
|
|
|
- bigDecimal2 = new BigDecimal(Double.toString(historyRaw.get(historyRaw.size() - 1).getValue()));
|
|
|
- bigDecimal2 = bigDecimal2.divide(meterPoint.getXs(), 4, RoundingMode.HALF_EVEN);
|
|
|
- rfdl = bigDecimal2.subtract(bigDecimal1).multiply(meterPoint.getMagnification());
|
|
|
+ Map<String, PointData> historySection = adapter.getHistorySection(pointcode, dateTime0.getTime());
|
|
|
+ double value0 = 0;
|
|
|
+ if (!historySection.isEmpty()) {
|
|
|
+ value0 = historySection.get(pointcode).getValue();
|
|
|
+ }
|
|
|
+ bigDecimal1 = new BigDecimal(Double.toString(value0));
|
|
|
|
|
|
- if (rfdl.doubleValue() > 5000000 || rfdl.doubleValue() < 0) {
|
|
|
+ List<PointData> historyRaw = adapter.getHistoryRaw(pointcode, dateTime1.getTime(), dateTime2.getTime());
|
|
|
|
|
|
- ArrayList<Double> arrayList = new ArrayList<>();
|
|
|
- for (PointData pointData : historyRaw) {
|
|
|
- arrayList.add(pointData.getValue());
|
|
|
- }
|
|
|
- int index = -1;
|
|
|
- // 定义增长阈值
|
|
|
- double threshold = 50000.0;
|
|
|
+ if (historyRaw.size() > 0) {
|
|
|
+// bigDecimal1 = new BigDecimal(Double.toString(historyRaw.get(0).getValue()));
|
|
|
+ bigDecimal1 = bigDecimal1.divide(meterPoint.getXs(), 4, RoundingMode.HALF_EVEN);
|
|
|
+ bigDecimal2 = new BigDecimal(Double.toString(historyRaw.get(historyRaw.size() - 1).getValue()));
|
|
|
+ bigDecimal2 = bigDecimal2.divide(meterPoint.getXs(), 4, RoundingMode.HALF_EVEN);
|
|
|
+ rfdl = bigDecimal2.subtract(bigDecimal1).multiply(meterPoint.getMagnification());
|
|
|
|
|
|
- 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 > threshold) {
|
|
|
- index = j;
|
|
|
- break;
|
|
|
+ if (rfdl.doubleValue() > 1000000 || rfdl.doubleValue() < 0) {
|
|
|
+
|
|
|
+ ArrayList<Double> arrayList = new ArrayList<>();
|
|
|
+ for (PointData pointData : historyRaw) {
|
|
|
+ arrayList.add(pointData.getValue());
|
|
|
+ }
|
|
|
+ int index = -1;
|
|
|
+ // 定义增长阈值
|
|
|
+ double threshold = 15000.0;
|
|
|
+
|
|
|
+ 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 > threshold) {
|
|
|
+ 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)).multiply(meterPoint.getMagnification());
|
|
|
}
|
|
|
- }
|
|
|
- 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)).multiply(meterPoint.getMagnification());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- MeterInfoBottomcode meterInfoBottomcode = new MeterInfoBottomcode();
|
|
|
- meterInfoBottomcode.setName(meterPoint.getName());
|
|
|
- meterInfoBottomcode.setStartTime(dateTime1.toLocalDateTime());
|
|
|
- meterInfoBottomcode.setStartValue(bigDecimal1);
|
|
|
- meterInfoBottomcode.setEndTime(dateTime2.toLocalDateTime());
|
|
|
- meterInfoBottomcode.setEndValue(bigDecimal2);
|
|
|
- meterInfoBottomcode.setDayValue(rfdl);
|
|
|
- meterInfoBottomcode.setCode(pointcode);
|
|
|
- meterInfoBottomcode.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
-
|
|
|
- QueryWrapper<MeterInfoBottomcode> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("start_time", dateTime1.toLocalDateTime()).eq("code", meterPoint.getNemCode());
|
|
|
- List<MeterInfoBottomcode> list = meterInfoBottomcodeService.list(queryWrapper);
|
|
|
- if (list.size() > 0) {
|
|
|
- meterInfoBottomcode.update(queryWrapper);
|
|
|
- } else {
|
|
|
- meterInfoBottomcode.insert();
|
|
|
+ MeterInfoBottomcode meterInfoBottomcode = new MeterInfoBottomcode();
|
|
|
+ meterInfoBottomcode.setName(meterPoint.getName());
|
|
|
+ meterInfoBottomcode.setStartTime(dateTime1.toLocalDateTime());
|
|
|
+ meterInfoBottomcode.setStartValue(bigDecimal1);
|
|
|
+ meterInfoBottomcode.setEndTime(dateTime2.toLocalDateTime());
|
|
|
+ meterInfoBottomcode.setEndValue(bigDecimal2);
|
|
|
+ meterInfoBottomcode.setDayValue(rfdl);
|
|
|
+ meterInfoBottomcode.setCode(pointcode);
|
|
|
+ meterInfoBottomcode.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
+
|
|
|
+ QueryWrapper<MeterInfoBottomcode> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("start_time", dateTime1.toLocalDateTime()).eq("code", meterPoint.getNemCode());
|
|
|
+ List<MeterInfoBottomcode> list = meterInfoBottomcodeService.list(queryWrapper);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ meterInfoBottomcode.update(queryWrapper);
|
|
|
+ } else {
|
|
|
+ meterInfoBottomcode.insert();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -709,7 +1153,11 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
for (MeterPoint meterPoint : meterPointJSDList) {
|
|
|
String formula1 = meterPoint.getFormula();
|
|
|
System.out.println("转换前的公式:" + formula1);
|
|
|
- String formula2 = formula1.replaceAll("DL.NX", "DL_NX").replaceAll("DJL.", "DJL_");
|
|
|
+ String formula2 = formula1
|
|
|
+ .replaceAll("DL.NX", "DL_NX")
|
|
|
+ .replaceAll("DJL.", "DJL_")
|
|
|
+ .replaceAll("PLSJ1.NX", "PLSJ1_NX")
|
|
|
+ ;
|
|
|
System.out.println("转换后的公式字符串:" + formula2);
|
|
|
|
|
|
|
|
@@ -735,7 +1183,11 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
for (MeterPoint meterPoint : meterPointJSDList) {
|
|
|
String formula1 = meterPoint.getFormula();
|
|
|
System.out.println("转换前的公式:" + formula1);
|
|
|
- String formula2 = formula1.replaceAll("DL.NX", "DL_NX").replaceAll("DJL.", "DJL_");
|
|
|
+ String formula2 = formula1
|
|
|
+ .replaceAll("DL.NX", "DL_NX")
|
|
|
+ .replaceAll("DJL.", "DJL_")
|
|
|
+ .replaceAll("PLSJ1.NX", "PLSJ1_NX")
|
|
|
+ ;
|
|
|
System.out.println("转换后的公式字符串:" + formula2);
|
|
|
|
|
|
|
|
@@ -755,7 +1207,11 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
//遍历code数据,拿到每一个code,用code和时间,在meter_info_bottom中拿到dayValue
|
|
|
for (String meterPointCode : meterPointCodes) {
|
|
|
// String meterPointCode_ = meterPointCode.replaceAll("\\.", "_");
|
|
|
- String meterPointCode_ = meterPointCode.replaceAll("DL.", "DL_").replaceAll("DJL.", "DJL_");
|
|
|
+ String meterPointCode_ = meterPointCode
|
|
|
+ .replaceAll("DL.", "DL_")
|
|
|
+ .replaceAll("DJL.", "DJL_")
|
|
|
+ .replaceAll("PLSJ1.NX", "PLSJ1_NX")
|
|
|
+ ;
|
|
|
System.out.println("要查询的点code:" + meterPointCode);
|
|
|
System.out.println("替换后的点code:" + meterPointCode_);
|
|
|
//
|
|
@@ -763,26 +1219,23 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
if (meterPointCode.startsWith("DL")) {
|
|
|
System.out.println("计算测点DL:" + meterPointCode);
|
|
|
for (MeterInfoCalculating meterInfoCalculating : list1) {
|
|
|
- if(meterInfoCalculating.getCode().equals(meterPointCode)&&meterInfoCalculating.getDate().equals(dateTime1.toLocalDateTime())){
|
|
|
+ if (meterInfoCalculating.getCode().equals(meterPointCode) && meterInfoCalculating.getDate().equals(dateTime1.toLocalDateTime())) {
|
|
|
|
|
|
System.out.println("DL点数据:" + meterInfoCalculating.getValue());
|
|
|
map.put(meterPointCode_, meterInfoCalculating.getValue());
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-// MeterInfoCalculating meterInfoCalculating = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().eq("code", meterPointCode).eq("date", dateTime1));
|
|
|
} else {
|
|
|
System.out.println("计算测点Bottom:" + meterPointCode);
|
|
|
|
|
|
for (MeterInfoBottomcode meterInfoBottomcode : list2) {
|
|
|
- if(meterInfoBottomcode.getCode().equals(meterPointCode)&&meterInfoBottomcode.getStartTime().equals(dateTime1.toLocalDateTime())){
|
|
|
+ if (meterInfoBottomcode.getCode().equals(meterPointCode) && meterInfoBottomcode.getStartTime().equals(dateTime1.toLocalDateTime())) {
|
|
|
|
|
|
System.out.println("Bottom点数据日电量:" + meterInfoBottomcode.getDayValue());
|
|
|
map.put(meterPointCode_, meterInfoBottomcode.getDayValue());
|
|
|
}
|
|
|
}
|
|
|
-// MeterInfoBottomcode meterInfoBottomcode = meterInfoBottomcodeService.getOne(new QueryWrapper<MeterInfoBottomcode>().eq("code", meterPointCode).eq("start_time", dateTime1));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -798,7 +1251,7 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
meterInfoCalculating.setName(meterPoint.getName());
|
|
|
meterInfoCalculating.setCode(meterPoint.getNemCode());
|
|
|
meterInfoCalculating.setDate(dateTime1.toLocalDateTime());
|
|
|
- meterInfoCalculating.setValue(bigDecimal1);
|
|
|
+ meterInfoCalculating.setValue(bigDecimal1.divide(BigDecimal.valueOf(10000),4,RoundingMode.HALF_EVEN));
|
|
|
meterInfoCalculating.setUpdateTime(LocalDateTime.now());
|
|
|
meterInfoCalculating.setWindpowerstationId(meterPoint.getWindpowerstationId());
|
|
|
|
|
@@ -841,6 +1294,49 @@ class SaveMeterInfoHistoryDayTest {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ //风场总
|
|
|
+ @Test
|
|
|
+ void saveFJ() {
|
|
|
+ this.saveEquipmentRfdl();
|
|
|
+ this.saveBottomCode();
|
|
|
+ this.saveCalculatingProjectFDL();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveCalculating();
|
|
|
+ }
|
|
|
+
|
|
|
+ //光伏总
|
|
|
+ @Test
|
|
|
+ void saveGF() {
|
|
|
+ this.saveEquipmentRfdl_GF();
|
|
|
+ this.saveCalculatingNBQFDL();
|
|
|
+ this.saveBottomCode_GF();
|
|
|
+ this.saveCalculating_GF();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //风场+光伏
|
|
|
+ @Test
|
|
|
+ void saveFJ_GF() {
|
|
|
+ this.saveEquipmentRfdl();
|
|
|
+ this.saveBottomCode();
|
|
|
+ this.saveCalculatingProjectFDL();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveCalculating();
|
|
|
+ this.saveEquipmentRfdl_GF();
|
|
|
+ this.saveCalculatingNBQFDL();
|
|
|
+ this.saveBottomCode_GF();
|
|
|
+ this.saveCalculating_GF();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|