|
@@ -121,12 +121,12 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
this.remove(Wrappers.<SpStatementQuarterReport>lambdaQuery()
|
|
|
.eq(SpStatementQuarterReport::getQuarter, currentQuarter)
|
|
|
.eq(SpStatementQuarterReport::getYear, currentYear));
|
|
|
- //原始数据
|
|
|
+ //原始数据(连电平台数据)
|
|
|
CompletableFuture<List<SpQuarterReportOriginVo>> future1 =
|
|
|
CompletableFuture.supplyAsync(
|
|
|
() -> spStatementShipUsageMonthMapper.selectQuarterOrigin(startDate, endDate,
|
|
|
newStartDate, newEndDate));
|
|
|
- //线下手动上报数据
|
|
|
+ //线下手动上报数据(泊位本月使用情况)
|
|
|
CompletableFuture<List<SpQuarterReportBlVo>> future2 = CompletableFuture.supplyAsync(
|
|
|
() -> spStatementShipUsageMonthMapper.selectQuarterBlBerth(startDate, endDate));
|
|
|
CompletableFuture.allOf(future1, future2).join();
|
|
@@ -134,90 +134,112 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
List<SpQuarterReportBlVo> spQuarterBlBerth = future2.get();
|
|
|
//原始数据处理
|
|
|
HashMap<Integer, List<SpQuarterReportOriginVo>> resultMapOrigin = new HashMap<>();
|
|
|
+ // 集装箱
|
|
|
List<SpQuarterReportOriginVo> container = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(1)).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.CONTAINER_BERTH.getDataType(), container);
|
|
|
+ // 滚装
|
|
|
List<SpQuarterReportOriginVo> roll = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(7)).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.ROLL_BERTH.getDataType(), roll);
|
|
|
+ // 干散货 2000吨及以上
|
|
|
List<SpQuarterReportOriginVo> dryBulk2000 = spQuarterOrigin.stream().filter(
|
|
|
i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3))
|
|
|
&& i.getCapacity() >= 2000).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_2000.getDataType(),
|
|
|
dryBulk2000);
|
|
|
+ // 干散货其他
|
|
|
List<SpQuarterReportOriginVo> dryBulk = spQuarterOrigin.stream().filter(
|
|
|
i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3)) && i.getCapacity() < 2000)
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_OTHER.getDataType(),
|
|
|
dryBulk);
|
|
|
+ // 多用途 2000吨及以上
|
|
|
List<SpQuarterReportOriginVo> multiUse2000 = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(11) && i.getCapacity() >= 2000)
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_2000.getDataType(),
|
|
|
multiUse2000);
|
|
|
+ // 多用途其他
|
|
|
List<SpQuarterReportOriginVo> multiUse = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(11) && i.getCapacity() < 2000)
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_OTHER.getDataType(), multiUse);
|
|
|
+ // 通用 2000吨及以上
|
|
|
List<SpQuarterReportOriginVo> common2000 = spQuarterOrigin.stream().filter(
|
|
|
i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
|
|
|
&& i.getCapacity() >= 2000).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.COMMON_BERTH_2000.getDataType(), common2000);
|
|
|
+ // 通用其他
|
|
|
List<SpQuarterReportOriginVo> common = spQuarterOrigin.stream().filter(
|
|
|
i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
|
|
|
&& i.getCapacity() < 2000).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.COMMON_BERTH_OTHER.getDataType(), common);
|
|
|
+ // 邮轮
|
|
|
List<SpQuarterReportOriginVo> cruise = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(6)).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.CRUISE_BERTH.getDataType(), cruise);
|
|
|
+ // 客运
|
|
|
List<SpQuarterReportOriginVo> passenger = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(4) || i.getBerthType().equals(5))
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.PASSENGER_BERTH.getDataType(), passenger);
|
|
|
+ // 其他
|
|
|
List<SpQuarterReportOriginVo> other = spQuarterOrigin.stream()
|
|
|
.filter(i -> i.getBerthType().equals(255)).collect(Collectors.toList());
|
|
|
resultMapOrigin.put(ShorePowerQuarterDataType.OTHER_BERTH.getDataType(), other);
|
|
|
//手动数据处理
|
|
|
HashMap<Integer, List<SpQuarterReportBlVo>> resultMapBl = new HashMap<>();
|
|
|
+ // 集装箱
|
|
|
List<SpQuarterReportBlVo> containerBl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(1)).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.CONTAINER_BERTH.getDataType(), containerBl);
|
|
|
+ // 滚装
|
|
|
List<SpQuarterReportBlVo> rollBl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(7)).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.ROLL_BERTH.getDataType(), rollBl);
|
|
|
+ // 干散货 2000吨及以上
|
|
|
List<SpQuarterReportBlVo> dryBulk2000Bl = spQuarterBlBerth.stream().filter(
|
|
|
i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3))
|
|
|
&& i.getCapacity() >= 2000).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_2000.getDataType(),
|
|
|
dryBulk2000Bl);
|
|
|
+ // 干散货其他
|
|
|
List<SpQuarterReportBlVo> dryBulkBl = spQuarterBlBerth.stream().filter(
|
|
|
i -> (i.getBerthType().equals(2) || i.getBerthType().equals(3)) && i.getCapacity() < 2000)
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.DRY_BULK_CARGO_BERTH_OTHER.getDataType(),
|
|
|
dryBulkBl);
|
|
|
+ // 多用途 2000吨及以上
|
|
|
List<SpQuarterReportBlVo> multiUse2000Bl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(11) && i.getCapacity() >= 2000)
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_2000.getDataType(), multiUse2000Bl);
|
|
|
+ // 多用途其他
|
|
|
List<SpQuarterReportBlVo> multiUseBl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(11) && i.getCapacity() < 2000)
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.MULTI_USE_BERTH_OTHER.getDataType(), multiUseBl);
|
|
|
+ // 通用 2000吨及以上
|
|
|
List<SpQuarterReportBlVo> common2000Bl = spQuarterBlBerth.stream().filter(
|
|
|
i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
|
|
|
&& i.getCapacity() >= 2000).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.COMMON_BERTH_2000.getDataType(), common2000Bl);
|
|
|
+ // 通用其他
|
|
|
List<SpQuarterReportBlVo> commonBl = spQuarterBlBerth.stream().filter(
|
|
|
i -> (i.getBerthType().equals(9) || i.getBerthType().equals(10))
|
|
|
&& i.getCapacity() < 2000).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.COMMON_BERTH_OTHER.getDataType(), commonBl);
|
|
|
+ // 邮轮
|
|
|
List<SpQuarterReportBlVo> cruiseBl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(6)).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.CRUISE_BERTH.getDataType(), cruiseBl);
|
|
|
+ // 客运
|
|
|
List<SpQuarterReportBlVo> passengerBl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(4) || i.getBerthType().equals(5))
|
|
|
.collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.PASSENGER_BERTH.getDataType(), passengerBl);
|
|
|
+ // 其他
|
|
|
List<SpQuarterReportBlVo> otherBl = spQuarterBlBerth.stream()
|
|
|
.filter(i -> i.getBerthType().equals(255)).collect(Collectors.toList());
|
|
|
resultMapBl.put(ShorePowerQuarterDataType.OTHER_BERTH.getDataType(), otherBl);
|
|
@@ -225,7 +247,7 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
ShorePowerQuarterDataType[] dataTypes = ShorePowerQuarterDataType.values();
|
|
|
//计算季度,即使某个类型没有数据也能存进表里 spStatementQuarterReports必定会有12条数据
|
|
|
for (ShorePowerQuarterDataType dataType : dataTypes) {
|
|
|
- // 集装箱数据从指标报表中的集装箱数据中拿取
|
|
|
+ // 集装箱数据从指标报表中的集装箱数据中拿取(GHJG_PORT_MANAGE.SP_STATEMENT_CONTAINER)
|
|
|
if (ShorePowerQuarterDataType.CONTAINER_BERTH.equals(dataType)) {
|
|
|
SpQuarterReportOriginVo spQuarterReportOriginVo = containerMapper.selectCurrentQuarterData(
|
|
|
quarterReportDateString);
|
|
@@ -276,9 +298,11 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
start = DateUtils.stringToDate(currentYear + "-" + "10" + dateEnd, "yyyy-MM");
|
|
|
end = DateUtils.stringToDate(currentYear + "-" + "12" + dateEnd, "yyyy-MM");
|
|
|
}
|
|
|
+ // 其他泊位
|
|
|
SpStatementQuarterReport otherSumEntity = spStatementQuarterReports.stream()
|
|
|
.filter(i -> i.getDataType().equals(ShorePowerQuarterDataType.OTHER_BERTH.getDataType()))
|
|
|
.collect(Collectors.toList()).get(0);
|
|
|
+ // 查询季度内长江经济带报表数据
|
|
|
SpShipUsageMonthQuarterVo spShipUsageMonthQuarterVo = spStatementShipUsageMonthMapper.selectThreeMonthsDataTotal(
|
|
|
start, end);
|
|
|
BigDecimal originChargeTimeSum = BigDecimal.ZERO;
|
|
@@ -287,19 +311,20 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
for (SpStatementQuarterReport report : spStatementQuarterReports.stream()
|
|
|
.filter(i -> !i.getDataType().equals(ShorePowerQuarterDataType.OTHER_BERTH.getDataType()))
|
|
|
.collect(Collectors.toList())) {
|
|
|
- // 计算接电时间的合计值和其他泊位值
|
|
|
+ // 计算接电时间的合计值//和其他泊位值
|
|
|
originChargeTimeSum = reportSum.getChargeTimeQuarter()
|
|
|
.add(report.getChargeTimeQuarter()).setScale(2, RoundingMode.HALF_UP);
|
|
|
reportSum.setChargeTimeQuarter(originChargeTimeSum);
|
|
|
- // 计算使用岸电次数的合计值和其他泊位值
|
|
|
+ // 计算使用岸电次数的合计值//和其他泊位值
|
|
|
originShipUsageSum = reportSum.getShipUsageQuarter()
|
|
|
.add(report.getShipUsageQuarter()).setScale(2, RoundingMode.HALF_UP);
|
|
|
reportSum.setShipUsageQuarter(originShipUsageSum);
|
|
|
- // 计算用电量的合计值和其他泊位值
|
|
|
+ // 计算用电量的合计值//和其他泊位值
|
|
|
originElectUseSum = reportSum.getElectUseQuarter()
|
|
|
.add(report.getElectUseQuarter()).setScale(2, RoundingMode.HALF_UP);
|
|
|
reportSum.setElectUseQuarter(originElectUseSum);
|
|
|
}
|
|
|
+ // 其它泊位数值=长江经济带统计总数-除其他泊位之外的泊位综总和
|
|
|
BigDecimal otherChargeTimeSum = spShipUsageMonthQuarterVo.getShorePowerTimeMonth()
|
|
|
.subtract(originChargeTimeSum);
|
|
|
otherSumEntity.setChargeTimeQuarter(otherChargeTimeSum.setScale(2, RoundingMode.HALF_UP));
|
|
@@ -324,8 +349,7 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
if (CollectionUtils.isEmpty(pastData)) {
|
|
|
for (SpStatementQuarterReport spStatementQuarterReport : spStatementQuarterReports) {
|
|
|
spStatementQuarterReport.setShipUsageYear(spStatementQuarterReport.getShipUsageQuarter());
|
|
|
- spStatementQuarterReport.setChargeTimeYear(
|
|
|
- spStatementQuarterReport.getChargeTimeQuarter());
|
|
|
+ spStatementQuarterReport.setChargeTimeYear(spStatementQuarterReport.getChargeTimeQuarter());
|
|
|
spStatementQuarterReport.setElectUseYear(spStatementQuarterReport.getElectUseQuarter());
|
|
|
}
|
|
|
} else {
|
|
@@ -338,8 +362,7 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
spStatementQuarterReport.setShipUsageYear(spStatementQuarterReport.getShipUsageQuarter()
|
|
|
.add(pastList.get(spStatementQuarterReport.getDataType()).get(0).getShipUsageYear()));
|
|
|
spStatementQuarterReport.setChargeTimeYear(spStatementQuarterReport.getChargeTimeQuarter()
|
|
|
- .add(
|
|
|
- pastList.get(spStatementQuarterReport.getDataType()).get(0).getChargeTimeYear()));
|
|
|
+ .add(pastList.get(spStatementQuarterReport.getDataType()).get(0).getChargeTimeYear()));
|
|
|
}
|
|
|
}
|
|
|
BigDecimal shipUsageYear = reportSum.getShipUsageYear();
|