package com.shcd.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shanghaigeography.Util.DateUtils;
import com.shcd.conf.SnowflakeMakeConf;
import com.shcd.entity.ShorePowerDeviceUsage;
import com.shcd.entity.SpStatementInlandLow;
import com.shcd.enums.AreaSortEnum;
import com.shcd.enums.ShorePowerConnRecordInfoEnum;
import com.shcd.service.SpStatementInlandLowService;
import com.shcd.mapper.SpStatementInlandLowMapper;
import com.shcd.vo.ShorePowerConnRecordInfoVo;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

/**
 * @author 14390
 * @description 针对表【SP_STATEMENT_INLAND_LOW(内河低压分析表)】的数据库操作Service实现
 * @createDate 2024-01-22 14:57:44
 */
@Service
@Slf4j
public class SpStatementInlandLowServiceImpl extends
    ServiceImpl<SpStatementInlandLowMapper, SpStatementInlandLow>
    implements SpStatementInlandLowService {

  @Resource
  SpStatementInlandLowMapper mapper;

  @Resource
  SnowflakeMakeConf snowflakeMakeConf;

  @Override
  public List<ShorePowerDeviceUsage> getOriginDataFromPage(String date) {
    Map<String, Object> params = new HashMap<>(2);
    params.put("reportDateStart", date);
    params.put("reportDateEnd", date);
    return mapper.getOriginDataFromPage(params);
  }

  @Override
  public List<ShorePowerDeviceUsage> getCurrentYearOriginDataFromPage() {
    return mapper.getCurrentYearOriginDataFromPage();
  }

  @Override
  public SpStatementInlandLow getLastMonthReportData(String date, Integer type) {
    return mapper.getLastMonthReportData(date, type);
  }

  @Override
  public List<ShorePowerConnRecordInfoVo> selectDataFromShorePower(Map<String, Object> params) {
    return mapper.selectDataFromShorePower(params);
  }

  @Override
  public List<ShorePowerConnRecordInfoVo> selectCurrentYearDataFromShorePower() {
    return mapper.selectCurrentYearDataFromShorePower();
  }

  @Override
  public void deleteAllCurrentMonthReport1(Date reportDate) {
    mapper.deleteAllCurrentMonthReport1(
        DateUtils.dateToString(reportDate, DateUtils.DATE_FORMAT_12));
  }

  @Override
  public void deleteAllCurrentMonthReport2(Date reportDate) {
    mapper.deleteAllCurrentMonthReport2(
        DateUtils.dateToString(reportDate, DateUtils.DATE_FORMAT_12));
  }

  @Override
  public List<SpStatementInlandLow> selectCurrentMonthReport2Count(Date reportDate) {
    return mapper.selectList(Wrappers.<SpStatementInlandLow>lambdaQuery()
        .eq(SpStatementInlandLow::getReportDate, reportDate)
        .eq(SpStatementInlandLow::getType, "2"));
  }

  @Override
  public List<SpStatementInlandLow> selectCurrentMonthReport1Count(Date reportDate) {
    return mapper.selectList(Wrappers.<SpStatementInlandLow>lambdaQuery()
        .eq(SpStatementInlandLow::getReportDate, reportDate)
        .eq(SpStatementInlandLow::getType, "1"));
  }

  @Override
  public void makeReport1(String currentMonthDate, String lastMonthDate) {
    try {
      List<ShorePowerDeviceUsage> originList = this.getOriginDataFromPage(
          currentMonthDate);
      log.info("统计当月原始数据为:{}", JSONObject.toJSONString(originList));
      // 查询上个月报表数据 用来计算环比
      List<SpStatementInlandLow> lastReportDataList = this.getAllLastMonthReportData(lastMonthDate,
          1);
      log.info("统计上月报表数据为:{}", JSONObject.toJSONString(lastReportDataList));
//       查询全年原始数据 用来计算当年累计
//      List<ShorePowerDeviceUsage> currentYearOriginList = this.getCurrentYearOriginDataFromPage();
//      log.info("当年累计原始数据为:{}", JSONObject.toJSONString(currentYearOriginList));
      List<SpStatementInlandLow> spStatementInlandLowList = new ArrayList<>(originList.size());
      // 计算各区
      executeEveryDistrict(originList, lastReportDataList, spStatementInlandLowList);
      // 计算合计
      executeTotal(spStatementInlandLowList, lastMonthDate);
      log.info("最终存储的内河低压分析表1为:{}", JSONObject.toJSONString(spStatementInlandLowList));
      List<SpStatementInlandLow> currentList = this.selectCurrentMonthReport1Count(
          spStatementInlandLowList.get(0).getReportDate());
      if (!CollectionUtils.isEmpty(currentList)) {
        this.deleteAllCurrentMonthReport1(
            spStatementInlandLowList.get(0).getReportDate());
      }
      super.saveBatch(spStatementInlandLowList);
    } catch (Exception e) {
      e.printStackTrace();
      log.error("内河低压分析表 表1 中间表生成逻辑出错....原因:{}", e.getMessage());
    }

  }

  @Override
  public void makeReport2(String currentDate, String lastMonthDate, String last2MonthDate,
      String last3MonthDate) {
    try {
      String date = currentDate + "-24 23:59:59";
      String lastMonthDate11 = lastMonthDate + "-25 00:00:00";
      Map<String, Object> params = new HashMap<>(2);
      params.put("reportDateStart", lastMonthDate11);
      params.put("reportDateEnd", date);
      params.put("lastReportDateStart", last2MonthDate + "-25 00:00:00");
      params.put("lastReportDateEnd", lastMonthDate + "-24 23:59:59");
//      List<ShorePowerConnRecordInfoVo> currentMonthData = this.selectDataFromShorePower(
//          params);
      //低压标准化计算逻辑变更,这个是第二个版本,
      List<ShorePowerConnRecordInfoVo> currentMonthData = this.selectDataFromShorePowerV2(params);
      log.info("市级平台自动上传<当月>数据为:{}", JSONObject.toJSONString(currentMonthData));
      // 查询上个月报表数据 用来计算环比
      List<SpStatementInlandLow> lastReportDataList = this.getAllLastMonthReportData(lastMonthDate,
          2);
      log.info("市级平台自动上传<上月>数据为:{}", JSONObject.toJSONString(lastReportDataList));
      // 查询全年原始数据 用来计算当年累计
//      String yearStartDate =
//          (Integer.parseInt(currentDate.split("-")[0]) - 1) + "-12-25  00:00:00";
//      String yearEndDate = currentDate + "-24 23:59:59";
//      Map<String, Object> yearParams = new HashMap<>(2);
//      yearParams.put("reportDateStart", yearStartDate);
//      yearParams.put("reportDateEnd", yearEndDate);
//      List<ShorePowerConnRecordInfoVo> currentYearDataList = this.selectDataFromShorePower(
//          yearParams);
//      log.info("市级平台自动上传<全年>数据为:{}", JSONObject.toJSONString(currentYearDataList));
      // 计算各区
      List<SpStatementInlandLow> spStatementInlandLowList = executeEveryDistrict2(currentMonthData,
          lastReportDataList, currentDate);
      // 计算合计
      executeTotal2(spStatementInlandLowList, lastMonthDate);
      List<SpStatementInlandLow> currentList = this.selectCurrentMonthReport2Count(
          spStatementInlandLowList.get(0).getReportDate());
      if (!CollectionUtils.isEmpty(currentList)) {
        this.deleteAllCurrentMonthReport2(
            spStatementInlandLowList.get(0).getReportDate());
      }
      log.info("最终存储的内河低压分析表2为:{}", JSONObject.toJSONString(spStatementInlandLowList));
      super.saveBatch(spStatementInlandLowList);
    } catch (Exception e) {
      e.printStackTrace();
      log.error("内河低压分析表 表2 中间表生成逻辑出错....原因:{}", e.getMessage());
    }
  }

  private List<ShorePowerConnRecordInfoVo> selectDataFromShorePowerV2(Map<String, Object> params) {
    return mapper.selectDataFromShorePowerV2(params);
  }

  @Override
  public List<SpStatementInlandLow> getAllLastMonthReportData(String lastMonthDate, int type) {
    return mapper.getAllLastMonthReportData(lastMonthDate, type);
  }


  private void executeEveryDistrict(List<ShorePowerDeviceUsage> originList,
      List<SpStatementInlandLow> lastReportDataList,
      List<SpStatementInlandLow> spStatementInlandLowList) {
    for (ShorePowerDeviceUsage thisMonthData : originList) {
      // 计算各区  当月数据
      SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
      String id = String.valueOf(snowflakeMakeConf.snowflakeId());
      spStatementInlandLow.setId(id);
      spStatementInlandLow.setSort(Integer.valueOf(thisMonthData.getSort()));
      spStatementInlandLow.setDistrict(thisMonthData.getDistrict());
      spStatementInlandLow.setBoatUseNumberMonth(
          thisMonthData.getShorePowerBoatUseNumber());
      spStatementInlandLow.setPowerConnHoursMonth(thisMonthData.getPowerConnHours());
      spStatementInlandLow.setElectricityUsageMonth(
          thisMonthData.getElectricityConsumption());
      spStatementInlandLow.setReportDate(thisMonthData.getReportDate());
      spStatementInlandLow.setType(1);
      // 计算当年累计 以及 环比
      Calendar thisCalendar = Calendar.getInstance();
      thisCalendar.setTime(thisMonthData.getReportDate());
      if (thisCalendar.get(Calendar.MONTH) == Calendar.JANUARY) {
        spStatementInlandLow.setBoatUseNumberYearTotal(
            spStatementInlandLow.getBoatUseNumberMonth());
        spStatementInlandLow.setPowerConnHoursYearTotal(
            spStatementInlandLow.getPowerConnHoursMonth());
        spStatementInlandLow.setElectricityUsageYearTotal(
            spStatementInlandLow.getElectricityUsageMonth());
      } else {
        // 2月才开始计算环比
        for (SpStatementInlandLow lastReportData : lastReportDataList) {
          if (lastReportData.getDistrict().equals(spStatementInlandLow.getDistrict())) {
            spStatementInlandLow.setBoatUseNumberChain(
                getRate(spStatementInlandLow.getBoatUseNumberMonth(),
                    lastReportData.getBoatUseNumberMonth()));
            spStatementInlandLow.setBoatUseNumberYearTotal(
                spStatementInlandLow.getBoatUseNumberMonth()
                    .add(lastReportData.getBoatUseNumberYearTotal())
                    .setScale(2, RoundingMode.HALF_UP));
            spStatementInlandLow.setPowerConnHoursYearTotal(
                spStatementInlandLow.getPowerConnHoursMonth()
                    .add(lastReportData.getPowerConnHoursYearTotal())
                    .setScale(2, RoundingMode.HALF_UP));
            spStatementInlandLow.setElectricityUsageYearTotal(
                spStatementInlandLow.getElectricityUsageMonth()
                    .add(lastReportData.getElectricityUsageYearTotal())
                    .setScale(2, RoundingMode.HALF_UP));
          }

        }
      }
      spStatementInlandLowList.add(spStatementInlandLow);
    }
  }

  private static BigDecimal getRate(BigDecimal thisMonthData,
      BigDecimal lastMonthData) {
    if (Objects.isNull(lastMonthData) || lastMonthData.equals(BigDecimal.ZERO)) {
      return null;
    }
    BigDecimal result = (thisMonthData.subtract(lastMonthData)).multiply(BigDecimal.valueOf(100))
        .divide(lastMonthData, 2, RoundingMode.HALF_UP);
    return result.setScale(2, RoundingMode.HALF_UP);
  }

  private void executeTotal(List<SpStatementInlandLow> spStatementInlandLowList,
      String lastMonthDate) {
    // 计算合计
    SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
    spStatementInlandLow.setId(String.valueOf(snowflakeMakeConf.snowflakeStringId()));
    spStatementInlandLow.setSort(12);
    spStatementInlandLow.setDistrict("合计");
    spStatementInlandLow.setBoatUseNumberMonth(BigDecimal.ZERO);
    spStatementInlandLow.setBoatUseNumberChain(BigDecimal.ZERO);
    spStatementInlandLow.setBoatUseNumberYearTotal(BigDecimal.ZERO);
    spStatementInlandLow.setPowerConnHoursMonth(BigDecimal.ZERO);
    spStatementInlandLow.setPowerConnHoursYearTotal(BigDecimal.ZERO);
    spStatementInlandLow.setElectricityUsageMonth(BigDecimal.ZERO);
    spStatementInlandLow.setElectricityUsageYearTotal(BigDecimal.ZERO);
    spStatementInlandLowList.forEach(x -> {
      spStatementInlandLow.setBoatUseNumberMonth(
          x.getBoatUseNumberMonth().add(spStatementInlandLow.getBoatUseNumberMonth()));
      spStatementInlandLow.setBoatUseNumberYearTotal(
          x.getBoatUseNumberYearTotal().add(spStatementInlandLow.getBoatUseNumberYearTotal()));
      spStatementInlandLow.setPowerConnHoursMonth(
          x.getPowerConnHoursMonth().add(spStatementInlandLow.getPowerConnHoursMonth()));
      spStatementInlandLow.setPowerConnHoursYearTotal(
          x.getPowerConnHoursYearTotal().add(spStatementInlandLow.getPowerConnHoursYearTotal()));
      spStatementInlandLow.setElectricityUsageMonth(
          x.getElectricityUsageMonth().add(spStatementInlandLow.getElectricityUsageMonth()));
      spStatementInlandLow.setElectricityUsageYearTotal(x.getElectricityUsageYearTotal()
          .add(spStatementInlandLow.getElectricityUsageYearTotal()));
      spStatementInlandLow.setType(x.getType());
      spStatementInlandLow.setReportDate(x.getReportDate());
    });
    // 获取上个月的合计值用来计算环比
    SpStatementInlandLow lastMonthReportData = this.getLastMonthReportData(
        lastMonthDate, spStatementInlandLow.getType());
    if (Objects.isNull(lastMonthReportData) || Objects.isNull(
        lastMonthReportData.getBoatUseNumberMonth())
        || lastMonthReportData.getBoatUseNumberMonth().equals(BigDecimal.ZERO)) {
      spStatementInlandLow.setBoatUseNumberChain(null);
    } else {
      BigDecimal rate = (spStatementInlandLow.getBoatUseNumberMonth()
          .subtract(lastMonthReportData.getBoatUseNumberMonth())).multiply(
              BigDecimal.valueOf(100))
          .divide(lastMonthReportData.getBoatUseNumberMonth(), 2, RoundingMode.HALF_UP);
      spStatementInlandLow.setBoatUseNumberChain(rate);
    }
    spStatementInlandLowList.add(spStatementInlandLow);
  }

  private void executeTotal2(List<SpStatementInlandLow> spStatementInlandLowList,
      String lastMonthDate) {
    SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
    spStatementInlandLow.setId(String.valueOf(snowflakeMakeConf.snowflakeStringId()));
    spStatementInlandLow.setSort(12);
    spStatementInlandLow.setDistrict("合计");
    spStatementInlandLow.setBoatUseNumberMonth(BigDecimal.ZERO);
    spStatementInlandLow.setBoatUseNumberChain(BigDecimal.ZERO);
    spStatementInlandLow.setBoatUseNumberYearTotal(BigDecimal.ZERO);
    spStatementInlandLow.setPowerConnHoursMonth(BigDecimal.ZERO);
    spStatementInlandLow.setPowerConnHoursYearTotal(BigDecimal.ZERO);
    spStatementInlandLow.setElectricityUsageMonth(BigDecimal.ZERO);
    spStatementInlandLow.setElectricityUsageYearTotal(BigDecimal.ZERO);
    spStatementInlandLowList.forEach(x -> {
      spStatementInlandLow.setBoatUseNumberMonth(
          x.getBoatUseNumberMonth().add(spStatementInlandLow.getBoatUseNumberMonth()));
      spStatementInlandLow.setBoatUseNumberYearTotal(
          x.getBoatUseNumberYearTotal().add(spStatementInlandLow.getBoatUseNumberYearTotal()));
      spStatementInlandLow.setPowerConnHoursMonth(
          x.getPowerConnHoursMonth().add(spStatementInlandLow.getPowerConnHoursMonth()));
      spStatementInlandLow.setPowerConnHoursYearTotal(
          x.getPowerConnHoursYearTotal().add(spStatementInlandLow.getPowerConnHoursYearTotal()));
      spStatementInlandLow.setElectricityUsageMonth(
          x.getElectricityUsageMonth().add(spStatementInlandLow.getElectricityUsageMonth()));
      spStatementInlandLow.setElectricityUsageYearTotal(x.getElectricityUsageYearTotal()
          .add(spStatementInlandLow.getElectricityUsageYearTotal()));
      spStatementInlandLow.setType(x.getType());
      spStatementInlandLow.setReportDate(x.getReportDate());
    });
    // 拿上个月的中间表的"合计"数据  用来计算使用岸电船舶(艘次)的环比
    SpStatementInlandLow lastMonthReportData = this.getLastMonthReportData(
        lastMonthDate, spStatementInlandLow.getType());
    if (Objects.isNull(lastMonthReportData) || Objects.isNull(
        lastMonthReportData.getBoatUseNumberMonth())
        || lastMonthReportData.getBoatUseNumberMonth().equals(BigDecimal.ZERO)) {
      spStatementInlandLow.setBoatUseNumberChain(null);
    } else {
      BigDecimal rate = (spStatementInlandLow.getBoatUseNumberMonth()
          .subtract(lastMonthReportData.getBoatUseNumberMonth())).multiply(
              BigDecimal.valueOf(100))
          .divide(lastMonthReportData.getBoatUseNumberMonth(), 2, RoundingMode.HALF_UP);
      spStatementInlandLow.setBoatUseNumberChain(rate);
    }
    spStatementInlandLowList.add(spStatementInlandLow);
  }


  private List<SpStatementInlandLow> executeEveryDistrict2(
      List<ShorePowerConnRecordInfoVo> currentMonthData,
      List<SpStatementInlandLow> lastReportDataList, String currentDate)
      throws ParseException {
    List<SpStatementInlandLow> spStatementInlandLowList = new ArrayList<>(
        currentMonthData.size());
    for (ShorePowerConnRecordInfoEnum areaEnum : ShorePowerConnRecordInfoEnum.values()) {
      SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
      spStatementInlandLow.setId(String.valueOf(snowflakeMakeConf.snowflakeId()));
      spStatementInlandLow.setDistrict(areaEnum.getArea());
      spStatementInlandLow.setReportDate(
          DateUtils.stringToDate(currentDate, DateUtils.DATE_FORMAT_12));
      spStatementInlandLow.setSort(
          AreaSortEnum.getByArea(spStatementInlandLow.getDistrict()).getOwningArea());
      spStatementInlandLow.setType(2);
      List<ShorePowerConnRecordInfoVo> areaCollectData = currentMonthData.stream()
          .filter(
              i -> ShorePowerConnRecordInfoEnum.getByArea(Integer.parseInt(i.getArea())).getArea()
                  .equals(areaEnum.getArea())).collect(
              Collectors.toList());
      ShorePowerConnRecordInfoVo currentMonth;
      if (!CollectionUtils.isEmpty(areaCollectData)) {
        currentMonth = areaCollectData.get(0);
      } else {
        currentMonth = new ShorePowerConnRecordInfoVo();
      }
      spStatementInlandLow.setBoatUseNumberMonth(currentMonth.getTotal());
      // 使用岸电小时在查询数据库时已经转换为小时计算
      spStatementInlandLow.setPowerConnHoursMonth(currentMonth.getDuration());
      spStatementInlandLow.setElectricityUsageMonth(currentMonth.getElect());
      // 计算当年累计 以及 环比
      Calendar thisCalendar = Calendar.getInstance();
      thisCalendar.setTime(DateUtils.stringToDate(currentDate, DateUtils.DATE_FORMAT_12));
      if (thisCalendar.get(Calendar.MONTH) == Calendar.JANUARY) {
        spStatementInlandLow.setBoatUseNumberYearTotal(
            spStatementInlandLow.getBoatUseNumberMonth());
        spStatementInlandLow.setPowerConnHoursYearTotal(
            spStatementInlandLow.getPowerConnHoursMonth());
        spStatementInlandLow.setElectricityUsageYearTotal(
            spStatementInlandLow.getElectricityUsageMonth());
      } else {
        // 2月才开始计算环比
        for (SpStatementInlandLow lastReportData : lastReportDataList) {
          if (lastReportData.getDistrict().equals(spStatementInlandLow.getDistrict())) {
            spStatementInlandLow.setBoatUseNumberChain(
                getRate(spStatementInlandLow.getBoatUseNumberMonth(),
                    lastReportData.getBoatUseNumberMonth()));
            spStatementInlandLow.setBoatUseNumberYearTotal(
                spStatementInlandLow.getBoatUseNumberMonth()
                    .add(lastReportData.getBoatUseNumberYearTotal())
                    .setScale(2, RoundingMode.HALF_UP));
            spStatementInlandLow.setPowerConnHoursYearTotal(
                spStatementInlandLow.getPowerConnHoursMonth()
                    .add(lastReportData.getPowerConnHoursYearTotal())
                    .setScale(2, RoundingMode.HALF_UP));
            spStatementInlandLow.setElectricityUsageYearTotal(
                spStatementInlandLow.getElectricityUsageMonth()
                    .add(lastReportData.getElectricityUsageYearTotal())
                    .setScale(2, RoundingMode.HALF_UP));
          }
        }
      }
      spStatementInlandLowList.add(spStatementInlandLow);
    }
//    for (ShorePowerConnRecordInfoVo currentMonth : currentMonthData) {
//      SpStatementInlandLow spStatementInlandLow = new SpStatementInlandLow();
//      spStatementInlandLow.setId(String.valueOf(snowflakeMakeConf.snowflakeId()));
//      spStatementInlandLow.setReportDate(
//          DateUtils.stringToDate(currentDate, DateUtils.DATE_FORMAT_12));
//      spStatementInlandLow.setDistrict(
//          ShorePowerConnRecordInfoEnum.getByArea(Integer.parseInt(currentMonth.getArea()))
//              .getArea());
//      spStatementInlandLow.setSort(
//          AreaSortEnum.getByArea(spStatementInlandLow.getDistrict()).getSort());
//      spStatementInlandLow.setType(2);
//      spStatementInlandLow.setBoatUseNumberMonth(currentMonth.getTotal());
//      // 使用岸电小时在查询数据库时已经转换为小时计算
//      spStatementInlandLow.setPowerConnHoursMonth(currentMonth.getDuration());
//      spStatementInlandLow.setElectricityUsageMonth(currentMonth.getElect());
//      // 计算当年累计 以及 环比
//      Calendar thisCalendar = Calendar.getInstance();
//      thisCalendar.setTime(DateUtils.stringToDate(currentDate, DateUtils.DATE_FORMAT_12));
//      if (thisCalendar.get(Calendar.MONTH) == Calendar.JANUARY) {
//        spStatementInlandLow.setBoatUseNumberYearTotal(
//            spStatementInlandLow.getBoatUseNumberMonth());
//        spStatementInlandLow.setPowerConnHoursYearTotal(
//            spStatementInlandLow.getPowerConnHoursMonth());
//        spStatementInlandLow.setElectricityUsageYearTotal(
//            spStatementInlandLow.getElectricityUsageMonth());
//      } else {
//        // 2月才开始计算环比
//        for (SpStatementInlandLow lastReportData : lastReportDataList) {
//          if (lastReportData.getDistrict().equals(spStatementInlandLow.getDistrict())) {
//            spStatementInlandLow.setBoatUseNumberChain(
//                getRate(spStatementInlandLow.getBoatUseNumberMonth(),
//                    lastReportData.getBoatUseNumberMonth()));
//            spStatementInlandLow.setBoatUseNumberYearTotal(
//                spStatementInlandLow.getBoatUseNumberMonth()
//                    .add(lastReportData.getBoatUseNumberYearTotal())
//                    .setScale(2, RoundingMode.HALF_UP));
//            spStatementInlandLow.setPowerConnHoursYearTotal(
//                spStatementInlandLow.getPowerConnHoursMonth()
//                    .add(lastReportData.getPowerConnHoursYearTotal())
//                    .setScale(2, RoundingMode.HALF_UP));
//            spStatementInlandLow.setElectricityUsageYearTotal(
//                spStatementInlandLow.getElectricityUsageMonth()
//                    .add(lastReportData.getElectricityUsageYearTotal())
//                    .setScale(2, RoundingMode.HALF_UP));
//          }
//        }
//      }
//      spStatementInlandLowList.add(spStatementInlandLow);
//    }
    return spStatementInlandLowList;
  }
}




