|
@@ -163,6 +163,158 @@ class SaveMeterInfoHistoryDay {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //优化批量更新
|
|
|
+ void saveEquipmentRfdl_FJ1() {
|
|
|
+
|
|
|
+ //设置取值开始时间
|
|
|
+ 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 "%_FJ_%" 取出所有风机的电量测点code
|
|
|
+ List<TestingPoint> testingPointList = testingPointService.list(new QueryWrapper<TestingPoint>()
|
|
|
+ .eq("uniform_code", "AI064")
|
|
|
+ .like("code", "%_FJ_%")
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ //批量查询的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 (rfdl.doubleValue() > 50000 || 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 > 50000 || 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));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //避免出现过大错误数据,异常数据给死值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));
|
|
|
+
|
|
|
+ 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);
|
|
|
+ meterInfoEquipment.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+
|
|
|
+ boolean found = false;
|
|
|
+ for (MeterInfoEquipment meterInfoEquipmentOne : listMeterInfoEquipment) {
|
|
|
+ if (DateUtil.isSameDay(new DateTime(meterInfoEquipmentOne.getDate()), dateTime1)
|
|
|
+ && (thingId1.getNemCode().equals(meterInfoEquipmentOne.getEquipmentNemCode()))
|
|
|
+ ) {
|
|
|
+ found = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (found) {
|
|
|
+ QueryWrapper<MeterInfoEquipment> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("equipment_nem_code", thingId1.getNemCode()).eq("date", dateTime1.toLocalDateTime());
|
|
|
+ meterInfoEquipment.update(queryWrapper1);
|
|
|
+ } else {
|
|
|
+ insertList.add(meterInfoEquipment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (insertList.size() > 0) {
|
|
|
+ meterInfoEquipmentService.saveBatch(insertList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//电计量底码表
|
|
|
void saveCalculatingProjectFDL() {
|
|
|
|
|
@@ -939,6 +1091,385 @@ class SaveMeterInfoHistoryDay {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //光伏日发电量,优化批量插入或者更新
|
|
|
+ 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);
|
|
|
+ meterInfoEquipment.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+
|
|
|
+ //遍历listMeterInfoEquipment,有则放入更新集合,没有则放入插入集合
|
|
|
+ boolean found = false;
|
|
|
+ for (MeterInfoEquipment meterInfoEquipmentOne : listMeterInfoEquipment) {
|
|
|
+ if (DateUtil.isSameDay(new DateTime(meterInfoEquipmentOne.getDate()), dateTime1)
|
|
|
+ && (thingId1.getNemCode().equals(meterInfoEquipmentOne.getEquipmentNemCode()))
|
|
|
+// && (!rfdl.equals(meterInfoEquipmentOne.getRfdl()))
|
|
|
+ ) {
|
|
|
+ found = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (found) {
|
|
|
+ QueryWrapper<MeterInfoEquipment> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("equipment_nem_code", thingId1.getNemCode()).eq("date", dateTime1.toLocalDateTime());
|
|
|
+ meterInfoEquipment.update(queryWrapper1);
|
|
|
+ } else {
|
|
|
+ insertList.add(meterInfoEquipment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (insertList.size() > 0) {
|
|
|
+ meterInfoEquipmentService.saveBatch(insertList);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//光伏逆变器日发电量(场站)
|
|
|
void saveCalculatingNBQFDL() {
|
|
|
|
|
@@ -1288,7 +1819,8 @@ class SaveMeterInfoHistoryDay {
|
|
|
//风场总
|
|
|
@XxlJob("saveFD")
|
|
|
public void saveFD() {
|
|
|
- this.saveEquipmentRfdl();
|
|
|
+// this.saveEquipmentRfdl();
|
|
|
+ this.saveEquipmentRfdl_FJ1();
|
|
|
this.saveBottomCode();
|
|
|
this.saveCalculatingProjectFDL();
|
|
|
//优化后
|
|
@@ -1306,7 +1838,8 @@ class SaveMeterInfoHistoryDay {
|
|
|
//光伏总
|
|
|
@XxlJob("saveGF")
|
|
|
public void saveGF() {
|
|
|
- this.saveEquipmentRfdl_GF();
|
|
|
+// this.saveEquipmentRfdl_GF();
|
|
|
+ this.saveEquipmentRfdl_GF1();
|
|
|
this.saveCalculatingNBQFDL();
|
|
|
this.saveBottomCode_GF();
|
|
|
this.saveCalculating_GF();
|
|
@@ -1314,9 +1847,10 @@ class SaveMeterInfoHistoryDay {
|
|
|
|
|
|
|
|
|
//风场+光伏
|
|
|
- @XxlJob("saveFD_GF")
|
|
|
- public void saveFD_GF() {
|
|
|
- this.saveEquipmentRfdl();
|
|
|
+ @XxlJob("saveGF_FD")
|
|
|
+ public void saveGF_FD() {
|
|
|
+// this.saveEquipmentRfdl();
|
|
|
+ this.saveEquipmentRfdl_FJ1();
|
|
|
this.saveBottomCode();
|
|
|
this.saveCalculatingProjectFDL();
|
|
|
//优化后
|
|
@@ -1331,16 +1865,17 @@ class SaveMeterInfoHistoryDay {
|
|
|
// this.saveCalculating();
|
|
|
// this.saveCalculating();
|
|
|
|
|
|
- this.saveEquipmentRfdl_GF();
|
|
|
+// this.saveEquipmentRfdl_GF();
|
|
|
+ this.saveEquipmentRfdl_GF1();
|
|
|
this.saveCalculatingNBQFDL();
|
|
|
this.saveBottomCode_GF();
|
|
|
this.saveCalculating_GF();
|
|
|
}
|
|
|
|
|
|
- @XxlJob("meterinfoDayMonthYear_FD_GF")
|
|
|
+ @XxlJob("meterinfoDayMonthYear_GF_FD")
|
|
|
public void meterinfoDayMonthYear(){
|
|
|
- saveMeterInfoHistoryMonthYear.sumFD_GF();
|
|
|
- this.saveFD_GF();
|
|
|
+ saveMeterInfoHistoryMonthYear.sumGF_FD();
|
|
|
+ this.saveGF_FD();
|
|
|
|
|
|
}
|
|
|
|