|
@@ -131,7 +131,7 @@ public class SpStatementShipUsageMonthServiceImpl extends ServiceImpl<SpStatemen
|
|
|
gh.setShorePowerCountMonth(ghMonth.getShorePowerCount().setScale(2, RoundingMode.HALF_UP));
|
|
|
gh.setShorePowerCountYear(ghYear.getShorePowerCount().add(ghMonth.getShorePowerCount()).setScale(2, RoundingMode.HALF_UP));
|
|
|
gh.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
|
|
|
- gh.setDataSource(1);
|
|
|
+ gh.setDataSource(10);
|
|
|
spStatementShipUsageMonths.add(gh);
|
|
|
//新增线下数据
|
|
|
//月度的
|
|
@@ -142,7 +142,7 @@ public class SpStatementShipUsageMonthServiceImpl extends ServiceImpl<SpStatemen
|
|
|
if (underLineMonth != null && underLineYear != null) {
|
|
|
underLine.setId(snowflakeGenerator.next().toString());
|
|
|
underLine.setReportDate(toDate);
|
|
|
- underLine.setDataSource(2);
|
|
|
+ underLine.setDataSource(20);
|
|
|
underLine.setShipUsageYear(underLineYear.getShipUsage().setScale(2, RoundingMode.HALF_UP));
|
|
|
underLine.setShipUsageMonth(underLineMonth.getShipUsage().setScale(2, RoundingMode.HALF_UP));
|
|
|
underLine.setShorePowerCountMonth(underLineMonth.getShorePowerCount().setScale(2, RoundingMode.HALF_UP));
|
|
@@ -162,7 +162,7 @@ public class SpStatementShipUsageMonthServiceImpl extends ServiceImpl<SpStatemen
|
|
|
Thread.sleep(1);
|
|
|
sum.setId(snowflakeGenerator.next().toString());
|
|
|
sum.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
|
|
|
- sum.setDataSource(3);
|
|
|
+ sum.setDataSource(99);
|
|
|
sum.setShipUsageMonth(origin.getShipUsageMonth().add(gh.getShipUsageMonth()).add(underLine.getShipUsageMonth()).setScale(2, RoundingMode.HALF_UP));
|
|
|
sum.setShipUsageYear(origin.getShipUsageYear().add(gh.getShipUsageYear()).add(underLine.getShipUsageMonth()).setScale(2, RoundingMode.HALF_UP));
|
|
|
sum.setShorePowerCountMonth(origin.getShorePowerCountMonth().add(gh.getShorePowerCountMonth()).add(underLine.getShorePowerCountMonth()).setScale(2, RoundingMode.HALF_UP));
|
|
@@ -188,6 +188,43 @@ public class SpStatementShipUsageMonthServiceImpl extends ServiceImpl<SpStatemen
|
|
|
wgq.setShorePowerTimeYear(wgqYear.getShorePowerTime().add(wgqMonth.getShorePowerTime()).setScale(2, RoundingMode.HALF_UP));
|
|
|
wgq.setShorePowerCountYear(wgqYear.getShorePowerCount().add(wgqMonth.getShorePowerCount()).setScale(2, RoundingMode.HALF_UP));
|
|
|
spStatementShipUsageMonths.add(wgq);
|
|
|
+ //计算内河平台数据
|
|
|
+ //先获取本月的数据
|
|
|
+ CompletableFuture<List<SpStatementShipUsageDetail>> futureInRiver = CompletableFuture.supplyAsync(() -> spStatementShipUsageMonthMapper.getInRiverDataThisMonth(thisDate, lastDate));
|
|
|
+ CompletableFuture<SpStatementShipUsageMonthVo> futureInRiverSelf = CompletableFuture.supplyAsync(() -> spStatementShipUsageMonthMapper.getInRiverDataSelfThisMonth(thisDate, lastDate));
|
|
|
+ //获取本月之前合计数据
|
|
|
+ CompletableFuture<SpStatementShipUsageMonthVo> futureInRiverLast = CompletableFuture.supplyAsync(() -> spStatementShipUsageMonthMapper.getInRiverDataBeforeThisMonth(dateStrLast));
|
|
|
+ CompletableFuture.allOf(futureInRiver, futureInRiverSelf, futureInRiverLast).join();
|
|
|
+ List<SpStatementShipUsageDetail> inRiverDetail = futureInRiver.get();
|
|
|
+ SpStatementShipUsageMonthVo inRiverSelfMonth = futureInRiverSelf.get();
|
|
|
+ SpStatementShipUsageMonthVo inRiverLast = futureInRiverLast.get();
|
|
|
+ SpStatementShipUsageMonthVo inRiver = makeOriginMonthData(inRiverDetail);
|
|
|
+ if (inRiverLast == null){
|
|
|
+ inRiverLast = new SpStatementShipUsageMonthVo();
|
|
|
+ }
|
|
|
+ SpStatementShipUsageMonth inRiverShipUsage = new SpStatementShipUsageMonth();
|
|
|
+ inRiverShipUsage.setId(snowflakeGenerator.next().toString());
|
|
|
+ inRiverShipUsage.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
|
|
|
+ inRiverShipUsage.setDataSource(1);
|
|
|
+ inRiverShipUsage.setShipUsageMonth(inRiver.getShipUsage().add(inRiverSelfMonth.getShipUsage()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ inRiverShipUsage.setShorePowerTimeMonth(inRiver.getShorePowerTime().add(inRiverSelfMonth.getShorePowerTime()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ inRiverShipUsage.setShorePowerCountMonth(inRiver.getShorePowerCount().add(inRiverSelfMonth.getShorePowerCount()).setScale(2,RoundingMode.HALF_UP));
|
|
|
+ inRiverShipUsage.setShipUsageYear(inRiverShipUsage.getShipUsageMonth().add(inRiverLast.getShipUsage()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ inRiverShipUsage.setShorePowerCountYear(inRiverShipUsage.getShorePowerCountMonth().add(inRiverLast.getShorePowerCount()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ inRiverShipUsage.setShorePowerTimeYear(inRiverShipUsage.getShorePowerTimeMonth().add(inRiverLast.getShorePowerTime()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ spStatementShipUsageMonths.add(inRiverShipUsage);
|
|
|
+ //计算外港平台数据
|
|
|
+ SpStatementShipUsageMonth outRiverShipUsage = new SpStatementShipUsageMonth();
|
|
|
+ outRiverShipUsage.setId(snowflakeGenerator.next().toString());
|
|
|
+ outRiverShipUsage.setReportDate(DateUtils.stringToDate(thisYear + "-" + thisMonth, "yyyy-MM"));
|
|
|
+ outRiverShipUsage.setDataSource(2);
|
|
|
+ outRiverShipUsage.setShipUsageMonth(origin.getShipUsageMonth().subtract(inRiverShipUsage.getShipUsageMonth()));
|
|
|
+ outRiverShipUsage.setShorePowerCountMonth(origin.getShorePowerCountMonth().subtract(inRiverShipUsage.getShorePowerCountMonth()));
|
|
|
+ outRiverShipUsage.setShorePowerTimeMonth(origin.getShorePowerTimeMonth().subtract(inRiverShipUsage.getShorePowerTimeMonth()));
|
|
|
+ outRiverShipUsage.setShipUsageYear(origin.getShipUsageYear().subtract(inRiverShipUsage.getShipUsageYear()));
|
|
|
+ outRiverShipUsage.setShorePowerCountYear(origin.getShorePowerCountYear().subtract(inRiverShipUsage.getShorePowerCountYear()));
|
|
|
+ outRiverShipUsage.setShorePowerTimeYear(origin.getShorePowerTimeYear().subtract(inRiverShipUsage.getShorePowerTimeYear()));
|
|
|
+ spStatementShipUsageMonths.add(outRiverShipUsage);
|
|
|
this.saveBatch(spStatementShipUsageMonths);
|
|
|
//岸电年比
|
|
|
ArrayList<SpStatementYearAnalysis> save = new ArrayList<>();
|