|
@@ -4,15 +4,11 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.gyee.gaia.meter.entity.MeterInfoBottomcode;
|
|
|
-import com.gyee.gaia.meter.entity.MeterInfoCalculating;
|
|
|
-import com.gyee.gaia.meter.entity.MeterInfoEquipment;
|
|
|
-import com.gyee.gaia.meter.entity.MeterPoint;
|
|
|
+import com.gyee.gaia.meter.entity.*;
|
|
|
import com.gyee.gaia.meter.entity.vo.MeterInfoVo;
|
|
|
-import com.gyee.gaia.meter.service.impl.MeterInfoBottomcodeServiceImpl;
|
|
|
-import com.gyee.gaia.meter.service.impl.MeterInfoCalculatingServiceImpl;
|
|
|
-import com.gyee.gaia.meter.service.impl.MeterInfoEquipmentServiceImpl;
|
|
|
-import com.gyee.gaia.meter.service.impl.MeterPointServiceImpl;
|
|
|
+import com.gyee.gaia.meter.service.impl.*;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
+import org.jetbrains.annotations.Nullable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -21,7 +17,9 @@ import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Author: malijun
|
|
@@ -38,6 +36,8 @@ public class GetMeterInfo {
|
|
|
MeterInfoCalculatingServiceImpl meterInfoCalculatingService;
|
|
|
@Resource
|
|
|
MeterPointServiceImpl meterPointService;
|
|
|
+ @Resource
|
|
|
+ EquipmentServiceImpl equipmentService;
|
|
|
|
|
|
public ArrayList<MeterInfoVo> getBottomInfoByWindId(String windId, long startTime, long endTime) {
|
|
|
|
|
@@ -87,6 +87,65 @@ public class GetMeterInfo {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public ArrayList<MeterInfoVo> getBottomInfoByWindId(String windId, String meterType, long startTime, long endTime) {
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String format1 = simpleDateFormat.format(new Date(startTime));
|
|
|
+ String format2 = simpleDateFormat.format(new Date(endTime));
|
|
|
+
|
|
|
+ // 设置取值开始时间
|
|
|
+ DateTime startDateTime1 = DateUtil.parse(format1);
|
|
|
+ DateTime endDateTime1 = DateUtil.parse(format2);
|
|
|
+
|
|
|
+ DateTime startDateTime = DateUtil.beginOfDay(startDateTime1);
|
|
|
+ DateTime endDateTime = DateUtil.beginOfDay(endDateTime1);
|
|
|
+
|
|
|
+ // 指定开始日期到结束日期的天数
|
|
|
+ LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
+ LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+ System.out.println("相差天数" + betweenDays);
|
|
|
+
|
|
|
+ ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
+
|
|
|
+ List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("windpowerstation_id", windId)
|
|
|
+ .eq("property", "CD")
|
|
|
+ .eq("meter_type", meterType)
|
|
|
+ );
|
|
|
+
|
|
|
+ List<String> meterPointNemCodes = new ArrayList<>();
|
|
|
+ for (MeterPoint meterPoint : meterPoints) {
|
|
|
+ meterPointNemCodes.add(meterPoint.getNemCode());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //需要批量查询的日期集合
|
|
|
+ List<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MeterInfoBottomcode> meterInfoBottomcodes = meterInfoBottomcodeService.list(new QueryWrapper<MeterInfoBottomcode>()
|
|
|
+ .in("start_time", dateTimes)
|
|
|
+ .in("code", meterPointNemCodes)
|
|
|
+ );
|
|
|
+
|
|
|
+ for (MeterInfoBottomcode meterInfoBottomcode : meterInfoBottomcodes) {
|
|
|
+
|
|
|
+ MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
+ meterInfoVo.setDate(new DateTime(meterInfoBottomcode.getStartTime()));
|
|
|
+ meterInfoVo.setName(meterInfoBottomcode.getName());
|
|
|
+ meterInfoVo.setStartCode(meterInfoBottomcode.getStartValue());
|
|
|
+ meterInfoVo.setEndCode(meterInfoBottomcode.getEndValue());
|
|
|
+ meterInfoVo.setRdl(meterInfoBottomcode.getDayValue());
|
|
|
+ meterInfoVos.add(meterInfoVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return meterInfoVos;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public ArrayList<MeterInfoVo> getEquipmentInfoByWindId(String windId, long startTime, long endTime) {
|
|
|
|
|
@@ -127,7 +186,7 @@ public class GetMeterInfo {
|
|
|
meterInfoVos.add(meterInfoVo);
|
|
|
}
|
|
|
|
|
|
- MeterInfoCalculating meterInfoCalculating = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().eq("windpowerstation_id", windId).eq("date", dateTime1).like("code", "%_FJFDL_P%"));
|
|
|
+ MeterInfoCalculating meterInfoCalculating = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().eq("windpowerstation_id", windId).eq("date", dateTime1).like("code", "%_FJFDL_P0%"));
|
|
|
MeterInfoVo meterInfoVo1 = new MeterInfoVo();
|
|
|
meterInfoVo1.setDate(dateTime1);
|
|
|
meterInfoVo1.setName(meterInfoCalculating.getName());
|
|
@@ -143,8 +202,7 @@ public class GetMeterInfo {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public ArrayList<MeterInfoVo> getCalculatingInfoByWindId(String windId, long startTime, long endTime) {
|
|
|
+ public ArrayList<MeterInfoVo> getEquipmentInfoByEquipmentId(String id, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
@@ -170,18 +228,19 @@ public class GetMeterInfo {
|
|
|
DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
DateTime dateTime2 = DateUtil.offsetDay(startDateTime, i + 1);
|
|
|
|
|
|
- List<MeterInfoCalculating> meterInfoCalculatingList = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>().eq("windpowerstation_id", windId).eq("date", dateTime1));
|
|
|
+ List<MeterInfoEquipment> meterInfoEquipmentList = meterInfoEquipmentService.list(new QueryWrapper<MeterInfoEquipment>().eq("equipment_nem_code", id).eq("date", dateTime1));
|
|
|
//遍历集合
|
|
|
|
|
|
|
|
|
- for (MeterInfoCalculating meterInfoCalculating : meterInfoCalculatingList) {
|
|
|
+ for (MeterInfoEquipment meterInfoEquipment : meterInfoEquipmentList) {
|
|
|
|
|
|
MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
meterInfoVo.setDate(dateTime1);
|
|
|
- meterInfoVo.setName(meterInfoCalculating.getName());
|
|
|
- meterInfoVo.setRdl(meterInfoCalculating.getValue());
|
|
|
+ meterInfoVo.setName(meterInfoEquipment.getName());
|
|
|
+ meterInfoVo.setRdl(meterInfoEquipment.getRfdl().divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_EVEN));
|
|
|
meterInfoVos.add(meterInfoVo);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
System.out.println(meterInfoVos.size());
|
|
|
|
|
@@ -191,7 +250,7 @@ public class GetMeterInfo {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public ArrayList<MeterInfoVo> getCalculatingInfoMonthByWindId1(String windId, long startTime, long endTime) {
|
|
|
+ public ArrayList<MeterInfoVo> getCalculatingInfoByWindId(String windId, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
@@ -201,23 +260,23 @@ public class GetMeterInfo {
|
|
|
DateTime startDateTime1 = DateUtil.parse(format1);
|
|
|
DateTime endDateTime1 = DateUtil.parse(format2);
|
|
|
|
|
|
- DateTime startDateTime = DateUtil.beginOfMonth(startDateTime1);
|
|
|
- DateTime endDateTime = DateUtil.beginOfMonth(endDateTime1);
|
|
|
+ DateTime startDateTime = DateUtil.beginOfDay(startDateTime1);
|
|
|
+ DateTime endDateTime = DateUtil.beginOfDay(endDateTime1);
|
|
|
|
|
|
//指定开始日期到结束日期的天数
|
|
|
LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
- long between = ChronoUnit.MONTHS.between(day1, day2);
|
|
|
+ long between = ChronoUnit.DAYS.between(day1, day2);
|
|
|
|
|
|
|
|
|
ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
|
|
|
for (int i = 0; i <= between; i++) {
|
|
|
|
|
|
- DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
- DateTime dateTime2 = DateUtil.offsetMonth(startDateTime, i + 1);
|
|
|
+ DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ DateTime dateTime2 = DateUtil.offsetDay(startDateTime, i + 1);
|
|
|
|
|
|
- List<MeterInfoCalculating> meterInfoCalculatingList = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>().eq("windpowerstation_id", windId).eq("date", dateTime1).like("code", "%_MONTH"));
|
|
|
+ List<MeterInfoCalculating> meterInfoCalculatingList = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>().eq("windpowerstation_id", windId).eq("date", dateTime1));
|
|
|
//遍历集合
|
|
|
|
|
|
|
|
@@ -237,7 +296,65 @@ public class GetMeterInfo {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //修改后
|
|
|
+ public ArrayList<MeterInfoVo> getCalculatingInfoByWindId(String windId, String meterType, long startTime, long endTime) {
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String format1 = simpleDateFormat.format(new Date(startTime));
|
|
|
+ String format2 = simpleDateFormat.format(new Date(endTime));
|
|
|
+
|
|
|
+ // 设置取值开始时间
|
|
|
+ DateTime startDateTime1 = DateUtil.parse(format1);
|
|
|
+ DateTime endDateTime1 = DateUtil.parse(format2);
|
|
|
+
|
|
|
+ DateTime startDateTime = DateUtil.beginOfDay(startDateTime1);
|
|
|
+ DateTime endDateTime = DateUtil.beginOfDay(endDateTime1);
|
|
|
+
|
|
|
+ // 指定开始日期到结束日期的天数
|
|
|
+ LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
+ LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+ System.out.println("相差月数" + betweenDays);
|
|
|
+
|
|
|
+ ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
+
|
|
|
+ List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("windpowerstation_id", windId)
|
|
|
+ .eq("property", "JSD")
|
|
|
+ .eq("meter_type", meterType)
|
|
|
+ );
|
|
|
+
|
|
|
+ List<String> meterPointNemCodes = new ArrayList<>();
|
|
|
+ for (MeterPoint meterPoint : meterPoints) {
|
|
|
+ meterPointNemCodes.add(meterPoint.getNemCode());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //需要批量查询的日期集合
|
|
|
+ List<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MeterInfoCalculating> meterInfoCalculatings = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>()
|
|
|
+ .in("date", dateTimes)
|
|
|
+ .in("code", meterPointNemCodes)
|
|
|
+ );
|
|
|
+
|
|
|
+ for (MeterInfoCalculating meterInfoCalculating : meterInfoCalculatings) {
|
|
|
+
|
|
|
+ MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
+ meterInfoVo.setDate(new DateTime(meterInfoCalculating.getDate()));
|
|
|
+ meterInfoVo.setName(meterInfoCalculating.getName());
|
|
|
+ meterInfoVo.setRdl(meterInfoCalculating.getValue());
|
|
|
+ meterInfoVos.add(meterInfoVo);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return meterInfoVos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public ArrayList<MeterInfoVo> getCalculatingInfoMonthByWindId(String windId, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
@@ -316,54 +433,86 @@ public class GetMeterInfo {
|
|
|
return meterInfoVos;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public ArrayList<MeterInfoVo> getEquipmentInfoMonthByWindId1(String windId, long startTime, long endTime) {
|
|
|
+ public ArrayList<MeterInfoVo> getCalculatingInfoMonthByWindId(String windId, String meterType, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
|
String format2 = simpleDateFormat.format(new Date(endTime));
|
|
|
|
|
|
- //设置取值开始时间
|
|
|
+ // 设置取值开始时间
|
|
|
DateTime startDateTime1 = DateUtil.parse(format1);
|
|
|
DateTime endDateTime1 = DateUtil.parse(format2);
|
|
|
|
|
|
DateTime startDateTime = DateUtil.beginOfMonth(startDateTime1);
|
|
|
- DateTime endDateTime = DateUtil.beginOfMonth(endDateTime1);
|
|
|
+ DateTime endDateTime = DateUtil.endOfMonth(endDateTime1);
|
|
|
|
|
|
- //指定开始日期到结束日期的天数
|
|
|
+ // 指定开始日期到结束日期的天数
|
|
|
LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
long between = ChronoUnit.MONTHS.between(day1, day2);
|
|
|
-
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+ System.out.println("相差月数" + between);
|
|
|
|
|
|
ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
|
|
|
- for (int i = 0; i <= between; i++) {
|
|
|
+ List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("windpowerstation_id", windId)
|
|
|
+ .eq("meter_type", meterType)
|
|
|
+ .like("property", "JSD%"));
|
|
|
+
|
|
|
|
|
|
+ // 批量查询MeterInfoCalculating数据
|
|
|
+ List<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MeterInfoCalculating> meterInfoCalculatings = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>()
|
|
|
+ .in("date", dateTimes));
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
- DateTime dateTime2 = DateUtil.offsetMonth(startDateTime, i + 1);
|
|
|
+ DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
|
|
|
|
- List<MeterInfoCalculating> meterInfoCalculatingList = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>().eq("windpowerstation_id", windId).eq("date", dateTime1).like("code", "%_FJFDL_P%"));
|
|
|
- //遍历集合
|
|
|
+ LocalDateTime day3 = LocalDateTimeUtil.of(dateTime1);
|
|
|
+ LocalDateTime day4 = LocalDateTimeUtil.of(dateTime2);
|
|
|
+ long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
+ System.out.println("这月相差天数:" + betweenDay);
|
|
|
|
|
|
- for (MeterInfoCalculating meterInfoCalculating : meterInfoCalculatingList) {
|
|
|
+ for (MeterPoint meterPoint : meterPoints) {
|
|
|
+ System.out.println(meterPoint.getName());
|
|
|
|
|
|
MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
meterInfoVo.setDate(dateTime1);
|
|
|
- meterInfoVo.setName(meterInfoCalculating.getName());
|
|
|
- meterInfoVo.setRdl(meterInfoCalculating.getValue());
|
|
|
+ meterInfoVo.setName(meterPoint.getName());
|
|
|
+
|
|
|
+ BigDecimal ydl = BigDecimal.valueOf(0);
|
|
|
+ System.out.println("ydl开始值" + ydl);
|
|
|
+
|
|
|
+ for (int j = 0; j <= betweenDay; j++) {
|
|
|
+ System.out.println("J的值(第-1天)" + j);
|
|
|
+
|
|
|
+ DateTime dateTime3 = DateUtil.offsetDay(dateTime1, j);
|
|
|
+
|
|
|
+// MeterInfoCalculating meterInfoCalculating = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().eq("code", meterPoint.getNemCode()).eq("date", dateTime3));
|
|
|
+ MeterInfoCalculating meterInfoCalculating = findMeterInfoCalculating(meterInfoCalculatings, meterPoint.getNemCode(), dateTime3);
|
|
|
+
|
|
|
+ if (meterInfoCalculating != null) {
|
|
|
+ ydl = ydl.add(meterInfoCalculating.getValue());
|
|
|
+ System.out.println("当月每天累加" + ydl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ meterInfoVo.setRdl(ydl);
|
|
|
meterInfoVos.add(meterInfoVo);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- System.out.println(meterInfoVos.size());
|
|
|
|
|
|
return meterInfoVos;
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- //修改后
|
|
|
+
|
|
|
public ArrayList<MeterInfoVo> getEquipmentInfoMonthByWindId(String windId, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
@@ -381,11 +530,27 @@ public class GetMeterInfo {
|
|
|
LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
long between = ChronoUnit.MONTHS.between(day1, day2);
|
|
|
- System.out.println("相差月数" + between);
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+ System.out.println("相差天数" + between);
|
|
|
|
|
|
ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
|
|
|
- List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>().eq("windpowerstation_id", windId).eq("meter_type", "风机发电量"));
|
|
|
+ List<Equipment> equipments = equipmentService.list(new QueryWrapper<Equipment>()
|
|
|
+ .eq("windpowerstation_id", windId)
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ List<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MeterInfoEquipment> meterInfoEquipments = meterInfoEquipmentService.list(new QueryWrapper<MeterInfoEquipment>()
|
|
|
+ .in("date", dateTimes)
|
|
|
+ .eq("powerstation_nem_code", windId)
|
|
|
+ );
|
|
|
+
|
|
|
|
|
|
for (int i = 0; i <= between; i++) {
|
|
|
DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
@@ -396,12 +561,11 @@ public class GetMeterInfo {
|
|
|
long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
System.out.println("这月相差天数:" + betweenDay);
|
|
|
|
|
|
- for (MeterPoint meterPoint : meterPoints) {
|
|
|
- System.out.println(meterPoint.getName());
|
|
|
+ for (Equipment equipment : equipments) {
|
|
|
|
|
|
MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
meterInfoVo.setDate(dateTime1);
|
|
|
- meterInfoVo.setName(meterPoint.getName());
|
|
|
+ meterInfoVo.setName(equipment.getName());
|
|
|
|
|
|
BigDecimal ydl = BigDecimal.valueOf(0);
|
|
|
System.out.println("ydl开始值" + ydl);
|
|
@@ -411,12 +575,89 @@ public class GetMeterInfo {
|
|
|
|
|
|
DateTime dateTime3 = DateUtil.offsetDay(dateTime1, j);
|
|
|
|
|
|
- MeterInfoCalculating meterInfoCalculating = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().eq("code", meterPoint.getNemCode()).eq("date", dateTime3));
|
|
|
+ MeterInfoEquipment meterInfoEquipment = findMeterInfoEquipment(meterInfoEquipments, equipment.getNemCode(), dateTime3);
|
|
|
|
|
|
- if (meterInfoCalculating != null) {
|
|
|
- ydl = ydl.add(meterInfoCalculating.getValue());
|
|
|
+ if (meterInfoEquipment != null) {
|
|
|
+ ydl = ydl.add(meterInfoEquipment.getRfdl());
|
|
|
System.out.println("当月每天累加" + ydl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ meterInfoVo.setRdl(ydl);
|
|
|
+ meterInfoVos.add(meterInfoVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ return meterInfoVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ArrayList<MeterInfoVo> getEquipmentInfoMonthByWindId(String windId, String id, long startTime, long endTime) {
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String format1 = simpleDateFormat.format(new Date(startTime));
|
|
|
+ String format2 = simpleDateFormat.format(new Date(endTime));
|
|
|
+
|
|
|
+ // 设置取值开始时间
|
|
|
+ DateTime startDateTime1 = DateUtil.parse(format1);
|
|
|
+ DateTime endDateTime1 = DateUtil.parse(format2);
|
|
|
+
|
|
|
+ DateTime startDateTime = DateUtil.beginOfMonth(startDateTime1);
|
|
|
+ DateTime endDateTime = DateUtil.endOfMonth(endDateTime1);
|
|
|
+
|
|
|
+ // 指定开始日期到结束日期的天数
|
|
|
+ LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
+ LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
+ long between = ChronoUnit.MONTHS.between(day1, day2);
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
+ System.out.println("相差天数" + between);
|
|
|
+
|
|
|
+ ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
+
|
|
|
+ List<Equipment> equipments = equipmentService.list(new QueryWrapper<Equipment>()
|
|
|
+ .eq("windpowerstation_id", windId)
|
|
|
+ .eq("nem_code", id)
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ List<DateTime> dateTimes = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
+ DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
+ dateTimes.add(dateTime4);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MeterInfoEquipment> meterInfoEquipments = meterInfoEquipmentService.list(new QueryWrapper<MeterInfoEquipment>()
|
|
|
+ .in("date", dateTimes)
|
|
|
+ .eq("equipment_nem_code", id)
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i <= between; i++) {
|
|
|
+ DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
+ DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
|
+
|
|
|
+ LocalDateTime day3 = LocalDateTimeUtil.of(dateTime1);
|
|
|
+ LocalDateTime day4 = LocalDateTimeUtil.of(dateTime2);
|
|
|
+ long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
+ System.out.println("这月相差天数:" + betweenDay);
|
|
|
+
|
|
|
+ for (Equipment equipment : equipments) {
|
|
|
+
|
|
|
+ MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
+ meterInfoVo.setDate(dateTime1);
|
|
|
+ meterInfoVo.setName(equipment.getName());
|
|
|
+
|
|
|
+ BigDecimal ydl = BigDecimal.valueOf(0);
|
|
|
+ System.out.println("ydl开始值" + ydl);
|
|
|
+
|
|
|
+ for (int j = 0; j <= betweenDay; j++) {
|
|
|
+ System.out.println("J的值(第-1天)" + j);
|
|
|
+
|
|
|
+ DateTime dateTime3 = DateUtil.offsetDay(dateTime1, j);
|
|
|
+
|
|
|
+ MeterInfoEquipment meterInfoEquipment = findMeterInfoEquipment(meterInfoEquipments, equipment.getNemCode(), dateTime3);
|
|
|
+
|
|
|
+ if (meterInfoEquipment != null) {
|
|
|
+ ydl = ydl.add(meterInfoEquipment.getRfdl());
|
|
|
+ System.out.println("当月每天累加" + ydl);
|
|
|
}
|
|
|
}
|
|
|
meterInfoVo.setRdl(ydl);
|
|
@@ -428,7 +669,7 @@ public class GetMeterInfo {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public ArrayList<MeterInfoVo> getBottomInfoMonthByWindId(String windId, long startTime, long endTime) {
|
|
|
+ public ArrayList<MeterInfoVo> getBottomInfoMonthByWindId1(String windId, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
@@ -497,9 +738,8 @@ public class GetMeterInfo {
|
|
|
return meterInfoVos;
|
|
|
}
|
|
|
|
|
|
+ public ArrayList<MeterInfoVo> getBottomInfoMonthByWindId1(String windId, String meterType, long startTime, long endTime) {
|
|
|
|
|
|
- //优化后,时间存可能不对
|
|
|
- public ArrayList<MeterInfoVo> getBottomInfoMonthByWindId1(String windId, long startTime, long endTime) {
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
|
String format2 = simpleDateFormat.format(new Date(endTime));
|
|
@@ -519,32 +759,20 @@ public class GetMeterInfo {
|
|
|
|
|
|
ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
|
|
|
- List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>().eq("windpowerstation_id", windId).eq("property", "CD"));
|
|
|
+ List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
+ .eq("windpowerstation_id", windId)
|
|
|
+ .eq("property", "CD")
|
|
|
+ .eq("meter_type", meterType)
|
|
|
+ );
|
|
|
|
|
|
- // 提前生成需要查询的日期列表
|
|
|
- List<DateTime> dateTimes = new ArrayList<>();
|
|
|
for (int i = 0; i <= between; i++) {
|
|
|
- DateTime dateTime1 = DateUtil.offsetDay(startDateTime, i);
|
|
|
- dateTimes.add(dateTime1);
|
|
|
- }
|
|
|
-
|
|
|
- // 批量查询指定日期范围内的数据
|
|
|
- List<MeterInfoBottomcode> meterInfoBottomcodes = meterInfoBottomcodeService
|
|
|
- .list(new QueryWrapper<MeterInfoBottomcode>().in("start_time", dateTimes));
|
|
|
-
|
|
|
- Map<DateTime, MeterInfoBottomcode> meterInfoBottomcodeMap = new HashMap<>();
|
|
|
- for (MeterInfoBottomcode meterInfoBottomcode : meterInfoBottomcodes) {
|
|
|
- meterInfoBottomcodeMap.put(new DateTime(meterInfoBottomcode.getStartTime()), meterInfoBottomcode);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- for (DateTime dateTime1 : dateTimes) {
|
|
|
- DateTime dateTime2 = DateUtil.endOfDay(dateTime1);
|
|
|
+ DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
+ DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
|
|
|
|
LocalDateTime day3 = LocalDateTimeUtil.of(dateTime1);
|
|
|
LocalDateTime day4 = LocalDateTimeUtil.of(dateTime2);
|
|
|
long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
- System.out.println("这天相差天数:" + betweenDay);
|
|
|
+ System.out.println("这月相差天数:" + betweenDay);
|
|
|
|
|
|
for (MeterPoint meterPoint : meterPoints) {
|
|
|
System.out.println(meterPoint.getName());
|
|
@@ -561,16 +789,16 @@ public class GetMeterInfo {
|
|
|
|
|
|
DateTime dateTime3 = DateUtil.offsetDay(dateTime1, j);
|
|
|
|
|
|
- MeterInfoBottomcode meterInfoBottomcode = meterInfoBottomcodeMap.get(dateTime3);
|
|
|
+ MeterInfoBottomcode meterInfoBottomcode = meterInfoBottomcodeService.getOne(new QueryWrapper<MeterInfoBottomcode>().eq("code", meterPoint.getNemCode()).eq("start_time", dateTime3));
|
|
|
|
|
|
if (meterInfoBottomcode != null) {
|
|
|
ydl = ydl.add(meterInfoBottomcode.getDayValue());
|
|
|
- System.out.println("当天累加" + ydl);
|
|
|
+ System.out.println("当月每天累加" + ydl);
|
|
|
|
|
|
if (j == 0) {
|
|
|
meterInfoVo.setStartCode(meterInfoBottomcode.getStartValue());
|
|
|
}
|
|
|
- if (meterInfoBottomcode.getEndValue() != null) {
|
|
|
+ if (!(meterInfoBottomcode.getStartValue() == null)) {
|
|
|
meterInfoVo.setEndCode(meterInfoBottomcode.getEndValue());
|
|
|
}
|
|
|
}
|
|
@@ -583,8 +811,7 @@ public class GetMeterInfo {
|
|
|
return meterInfoVos;
|
|
|
}
|
|
|
|
|
|
- //没有按月累加
|
|
|
- public ArrayList<MeterInfoVo> getCalculatingInfoMonthByWindId3(String windId, long startTime, long endTime) {
|
|
|
+ public ArrayList<MeterInfoVo> getBottomInfoMonthByWindId(String windId, long startTime, long endTime) {
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
@@ -601,36 +828,27 @@ public class GetMeterInfo {
|
|
|
LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
long between = ChronoUnit.MONTHS.between(day1, day2);
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
System.out.println("相差月数" + between);
|
|
|
|
|
|
ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
|
|
|
- // 批量查询MeterPoint列表
|
|
|
List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
.eq("windpowerstation_id", windId)
|
|
|
- .like("property", "JSD%"));
|
|
|
+ .like("property", "CD"));
|
|
|
+
|
|
|
|
|
|
// 批量查询MeterInfoCalculating数据
|
|
|
List<DateTime> dateTimes = new ArrayList<>();
|
|
|
- for (int i = 0; i <= between; i++) {
|
|
|
- DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
- DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
|
-
|
|
|
- LocalDateTime day3 = LocalDateTimeUtil.of(dateTime1);
|
|
|
- LocalDateTime day4 = LocalDateTimeUtil.of(dateTime2);
|
|
|
- long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
- System.out.println("这月相差天数:" + betweenDay);
|
|
|
-
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
-
|
|
|
dateTimes.add(dateTime4);
|
|
|
}
|
|
|
|
|
|
- List<MeterInfoCalculating> meterInfoCalculatings = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>()
|
|
|
- .in("date", dateTimes));
|
|
|
- System.out.println("先查询的集合大小" + meterInfoCalculatings.size());
|
|
|
+ List<MeterInfoBottomcode> meterInfoBottomcodes = meterInfoBottomcodeService.list(new QueryWrapper<MeterInfoBottomcode>()
|
|
|
+ .in("start_time", dateTimes));
|
|
|
+
|
|
|
|
|
|
- // 处理查询结果,按月累加数据
|
|
|
for (int i = 0; i <= between; i++) {
|
|
|
DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
@@ -640,47 +858,43 @@ public class GetMeterInfo {
|
|
|
long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
System.out.println("这月相差天数:" + betweenDay);
|
|
|
|
|
|
-
|
|
|
for (MeterPoint meterPoint : meterPoints) {
|
|
|
-
|
|
|
+ System.out.println(meterPoint.getName());
|
|
|
|
|
|
MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
- meterInfoVo.setName(meterPoint.getName());
|
|
|
meterInfoVo.setDate(dateTime1);
|
|
|
- meterInfoVo.setRdl(BigDecimal.ZERO);
|
|
|
- BigDecimal ydl = BigDecimal.ZERO;
|
|
|
+ meterInfoVo.setName(meterPoint.getName());
|
|
|
+
|
|
|
+ BigDecimal ydl = BigDecimal.valueOf(0);
|
|
|
+ System.out.println("ydl开始值" + ydl);
|
|
|
|
|
|
for (int j = 0; j <= betweenDay; j++) {
|
|
|
+ System.out.println("J的值(第-1天)" + j);
|
|
|
+
|
|
|
DateTime dateTime3 = DateUtil.offsetDay(dateTime1, j);
|
|
|
|
|
|
- // 查找对应日期的MeterInfoCalculating对象
|
|
|
- MeterInfoCalculating meterInfoCalculating = findMeterInfoCalculating(meterInfoCalculatings, meterPoint.getNemCode(), dateTime3);
|
|
|
+ MeterInfoBottomcode meterInfoBottomcode = findMeterInfoBottomcode(meterInfoBottomcodes, meterPoint.getNemCode(), dateTime3);
|
|
|
|
|
|
- if (meterInfoCalculating != null) {
|
|
|
- ydl = ydl.add(meterInfoCalculating.getValue());
|
|
|
+
|
|
|
+ if (meterInfoBottomcode != null) {
|
|
|
+ if (j == 0) {
|
|
|
+ meterInfoVo.setStartCode(meterInfoBottomcode.getStartValue());
|
|
|
+ }
|
|
|
+ ydl = ydl.add(meterInfoBottomcode.getDayValue());
|
|
|
+ meterInfoVo.setEndCode(meterInfoBottomcode.getEndValue());
|
|
|
+ System.out.println("当月每天累加" + ydl);
|
|
|
}
|
|
|
}
|
|
|
meterInfoVo.setRdl(ydl);
|
|
|
meterInfoVos.add(meterInfoVo);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return meterInfoVos;
|
|
|
}
|
|
|
|
|
|
- // 辅助方法,根据日期和NemCode查找MeterInfoCalculating对象
|
|
|
- private MeterInfoCalculating findMeterInfoCalculating(List<MeterInfoCalculating> meterInfoCalculatings, String nemCode, DateTime date) {
|
|
|
- for (MeterInfoCalculating meterInfoCalculating : meterInfoCalculatings) {
|
|
|
- if (meterInfoCalculating.getCode().equals(nemCode) && DateUtil.isSameDay(new DateTime(meterInfoCalculating.getDate()), date)) {
|
|
|
- return meterInfoCalculating;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
+ public ArrayList<MeterInfoVo> getBottomInfoMonthByWindId(String windId, String meterType, long startTime, long endTime) {
|
|
|
|
|
|
- public ArrayList<MeterInfoVo> getCalculatingInfoMonthByWindId4(String windId, long startTime, long endTime) {
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format1 = simpleDateFormat.format(new Date(startTime));
|
|
|
String format2 = simpleDateFormat.format(new Date(endTime));
|
|
@@ -696,37 +910,28 @@ public class GetMeterInfo {
|
|
|
LocalDateTime day1 = LocalDateTimeUtil.of(startDateTime);
|
|
|
LocalDateTime day2 = LocalDateTimeUtil.of(endDateTime);
|
|
|
long between = ChronoUnit.MONTHS.between(day1, day2);
|
|
|
+ long betweenDays = ChronoUnit.DAYS.between(day1, day2);
|
|
|
System.out.println("相差月数" + between);
|
|
|
|
|
|
ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
- Map<String, MeterInfoVo> meterInfoMap = new HashMap<>();
|
|
|
|
|
|
- // 批量查询MeterPoint列表
|
|
|
List<MeterPoint> meterPoints = meterPointService.list(new QueryWrapper<MeterPoint>()
|
|
|
.eq("windpowerstation_id", windId)
|
|
|
- .like("property", "JSD%"));
|
|
|
+ .like("property", "CD")
|
|
|
+ .eq("meter_type", meterType));
|
|
|
+
|
|
|
|
|
|
// 批量查询MeterInfoCalculating数据
|
|
|
List<DateTime> dateTimes = new ArrayList<>();
|
|
|
- for (int i = 0; i <= between; i++) {
|
|
|
- DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
- DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
|
-
|
|
|
- LocalDateTime day3 = LocalDateTimeUtil.of(dateTime1);
|
|
|
- LocalDateTime day4 = LocalDateTimeUtil.of(dateTime2);
|
|
|
- long betweenDay = ChronoUnit.DAYS.between(day3, day4);
|
|
|
- System.out.println("这月相差天数:" + betweenDay);
|
|
|
-
|
|
|
+ for (int i = 0; i <= betweenDays; i++) {
|
|
|
DateTime dateTime4 = DateUtil.offsetDay(startDateTime, i);
|
|
|
-
|
|
|
dateTimes.add(dateTime4);
|
|
|
}
|
|
|
|
|
|
- List<MeterInfoCalculating> meterInfoCalculatings = meterInfoCalculatingService.list(new QueryWrapper<MeterInfoCalculating>()
|
|
|
- .in("date", dateTimes));
|
|
|
- System.out.println("先查询的集合大小" + meterInfoCalculatings.size());
|
|
|
+ List<MeterInfoBottomcode> meterInfoBottomcodes = meterInfoBottomcodeService.list(new QueryWrapper<MeterInfoBottomcode>()
|
|
|
+ .in("start_time", dateTimes));
|
|
|
+
|
|
|
|
|
|
- // 处理查询结果,按月累加数据
|
|
|
for (int i = 0; i <= between; i++) {
|
|
|
DateTime dateTime1 = DateUtil.offsetMonth(startDateTime, i);
|
|
|
DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
|
@@ -737,41 +942,73 @@ public class GetMeterInfo {
|
|
|
System.out.println("这月相差天数:" + betweenDay);
|
|
|
|
|
|
for (MeterPoint meterPoint : meterPoints) {
|
|
|
- String nemCode = meterPoint.getNemCode();
|
|
|
-
|
|
|
- MeterInfoVo meterInfoVo = meterInfoMap.get(nemCode);
|
|
|
- if (meterInfoVo == null) {
|
|
|
- meterInfoVo = new MeterInfoVo();
|
|
|
- meterInfoVo.setName(meterPoint.getName());
|
|
|
- meterInfoVo.setDate(dateTime1);
|
|
|
- meterInfoVo.setRdl(BigDecimal.ZERO);
|
|
|
- meterInfoMap.put(nemCode, meterInfoVo);
|
|
|
- }
|
|
|
+ System.out.println(meterPoint.getName());
|
|
|
+
|
|
|
+ MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
+ meterInfoVo.setDate(dateTime1);
|
|
|
+ meterInfoVo.setName(meterPoint.getName());
|
|
|
|
|
|
- BigDecimal ydl = meterInfoVo.getRdl();
|
|
|
+ BigDecimal ydl = BigDecimal.valueOf(0);
|
|
|
+ System.out.println("ydl开始值" + ydl);
|
|
|
|
|
|
for (int j = 0; j <= betweenDay; j++) {
|
|
|
+ System.out.println("J的值(第-1天)" + j);
|
|
|
+
|
|
|
DateTime dateTime3 = DateUtil.offsetDay(dateTime1, j);
|
|
|
|
|
|
- // 查找对应日期的MeterInfoCalculating对象
|
|
|
- MeterInfoCalculating meterInfoCalculating = findMeterInfoCalculating(meterInfoCalculatings, nemCode, dateTime3);
|
|
|
+ MeterInfoBottomcode meterInfoBottomcode = findMeterInfoBottomcode(meterInfoBottomcodes, meterPoint.getNemCode(), dateTime3);
|
|
|
|
|
|
- if (meterInfoCalculating != null) {
|
|
|
- ydl = ydl.add(meterInfoCalculating.getValue());
|
|
|
+
|
|
|
+ if (meterInfoBottomcode != null) {
|
|
|
+ if (j == 0) {
|
|
|
+ meterInfoVo.setStartCode(meterInfoBottomcode.getStartValue());
|
|
|
+ }
|
|
|
+ ydl = ydl.add(meterInfoBottomcode.getDayValue());
|
|
|
+ meterInfoVo.setEndCode(meterInfoBottomcode.getEndValue());
|
|
|
+ System.out.println("当月每天累加" + ydl);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
meterInfoVo.setRdl(ydl);
|
|
|
+ meterInfoVos.add(meterInfoVo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 添加所有MeterInfoVo对象到列表
|
|
|
- meterInfoVos.addAll(meterInfoMap.values());
|
|
|
-
|
|
|
return meterInfoVos;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 辅助方法,根据日期和NemCode查找MeterInfoCalculating对象
|
|
|
+ @Nullable
|
|
|
+ private MeterInfoCalculating findMeterInfoCalculating(@NotNull List<MeterInfoCalculating> meterInfoCalculatings, String nemCode, DateTime date) {
|
|
|
+
|
|
|
+ for (MeterInfoCalculating meterInfoCalculating : meterInfoCalculatings) {
|
|
|
+ if (meterInfoCalculating.getCode().equals(nemCode) && DateUtil.isSameDay(new DateTime(meterInfoCalculating.getDate()), date)) {
|
|
|
+ return meterInfoCalculating;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Nullable
|
|
|
+ private MeterInfoEquipment findMeterInfoEquipment(@NotNull List<MeterInfoEquipment> meterInfoEquipments, String nemCode, DateTime date) {
|
|
|
+ for (MeterInfoEquipment meterInfoEquipment : meterInfoEquipments) {
|
|
|
+ if (meterInfoEquipment.getEquipmentNemCode().equals(nemCode) && DateUtil.isSameDay(new DateTime(meterInfoEquipment.getDate()), date)) {
|
|
|
+ return meterInfoEquipment;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Nullable
|
|
|
+ private MeterInfoBottomcode findMeterInfoBottomcode(@NotNull List<MeterInfoBottomcode> meterInfoBottomcodes, String nemCode, DateTime date) {
|
|
|
+ for (MeterInfoBottomcode meterInfoBottomcode : meterInfoBottomcodes) {
|
|
|
+ if (meterInfoBottomcode.getCode().equals(nemCode) && DateUtil.isSameDay(new DateTime(meterInfoBottomcode.getStartTime()), date)) {
|
|
|
+ return meterInfoBottomcode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|