|
@@ -67,6 +67,7 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
Date endDate;
|
|
|
Date newStartDate;
|
|
|
Date newEndDate;
|
|
|
+ List<String> quarterReportDateString = new ArrayList<>();
|
|
|
if (currentQuarter == 1) {
|
|
|
startDate = DateUtils.stringToDate(currentYear - 1 + "-" + "12" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
@@ -75,6 +76,9 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
newEndDate = DateUtils.stringToDate(currentYear + "-" + "02" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
+ quarterReportDateString.add(currentYear + "-01");
|
|
|
+ quarterReportDateString.add(currentYear + "-02");
|
|
|
+ quarterReportDateString.add(currentYear + "-03");
|
|
|
} else if (currentQuarter == 2) {
|
|
|
startDate = DateUtils.stringToDate(currentYear + "-" + "03" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
@@ -83,6 +87,9 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
newEndDate = DateUtils.stringToDate(currentYear + "-" + "05" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
+ quarterReportDateString.add(currentYear + "-04");
|
|
|
+ quarterReportDateString.add(currentYear + "-05");
|
|
|
+ quarterReportDateString.add(currentYear + "-06");
|
|
|
} else if (currentQuarter == 3) {
|
|
|
startDate = DateUtils.stringToDate(currentYear + "-" + "06" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
@@ -91,6 +98,9 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
newEndDate = DateUtils.stringToDate(currentYear + "-" + "08" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
+ quarterReportDateString.add(currentYear + "-07");
|
|
|
+ quarterReportDateString.add(currentYear + "-08");
|
|
|
+ quarterReportDateString.add(currentYear + "-09");
|
|
|
} else {
|
|
|
startDate = DateUtils.stringToDate(currentYear + "-" + "09" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
@@ -99,6 +109,9 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
newEndDate = DateUtils.stringToDate(currentYear + "-" + "11" + dateEnd,
|
|
|
"yyyy-MM-dd HH:mm:ss");
|
|
|
+ quarterReportDateString.add(currentYear + "-10");
|
|
|
+ quarterReportDateString.add(currentYear + "-11");
|
|
|
+ quarterReportDateString.add(currentYear + "-12");
|
|
|
}
|
|
|
|
|
|
this.remove(Wrappers.<SpStatementQuarterReport>lambdaQuery()
|
|
@@ -208,16 +221,31 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
ShorePowerQuarterDataType[] dataTypes = ShorePowerQuarterDataType.values();
|
|
|
|
|
|
for (ShorePowerQuarterDataType dataType : dataTypes) {
|
|
|
- SpStatementQuarterReport spStatementQuarterReport = new SpStatementQuarterReport();
|
|
|
- spStatementQuarterReport.setDataType(dataType.getDataType());
|
|
|
- spStatementQuarterReport.setId(snowflakeConfig.snowflakeStringId());
|
|
|
- spStatementQuarterReport.setYear(currentYear);
|
|
|
- spStatementQuarterReport.setQuarter(currentQuarter);
|
|
|
- calculateQuarterReportDetailOriginMonth(spStatementQuarterReport,
|
|
|
- resultMapOrigin.get(dataType.getDataType()));
|
|
|
- calculateQuarterReportDetailBlMonth(spStatementQuarterReport,
|
|
|
- resultMapBl.get(dataType.getDataType()));
|
|
|
- spStatementQuarterReports.add(spStatementQuarterReport);
|
|
|
+
|
|
|
+ if (ShorePowerQuarterDataType.CONTAINER_BERTH.equals(dataType)) {
|
|
|
+ SpQuarterReportOriginVo spQuarterReportOriginVo = containerMapper.selectCurrentQuarterData(
|
|
|
+ quarterReportDateString);
|
|
|
+ SpStatementQuarterReport spStatementQuarterReport = new SpStatementQuarterReport();
|
|
|
+ spStatementQuarterReport.setDataType(dataType.getDataType());
|
|
|
+ spStatementQuarterReport.setId(snowflakeConfig.snowflakeStringId());
|
|
|
+ spStatementQuarterReport.setYear(currentYear);
|
|
|
+ spStatementQuarterReport.setQuarter(currentQuarter);
|
|
|
+ spStatementQuarterReport.setShipUsageQuarter(spQuarterReportOriginVo.getShipUsage());
|
|
|
+ spStatementQuarterReport.setChargeTimeQuarter(spQuarterReportOriginVo.getChargeTime());
|
|
|
+ spStatementQuarterReport.setElectUseQuarter(spQuarterReportOriginVo.getElect());
|
|
|
+ spStatementQuarterReports.add(spStatementQuarterReport);
|
|
|
+ } else {
|
|
|
+ SpStatementQuarterReport spStatementQuarterReport = new SpStatementQuarterReport();
|
|
|
+ spStatementQuarterReport.setDataType(dataType.getDataType());
|
|
|
+ spStatementQuarterReport.setId(snowflakeConfig.snowflakeStringId());
|
|
|
+ spStatementQuarterReport.setYear(currentYear);
|
|
|
+ spStatementQuarterReport.setQuarter(currentQuarter);
|
|
|
+ calculateQuarterReportDetailOriginMonth(spStatementQuarterReport,
|
|
|
+ resultMapOrigin.get(dataType.getDataType()));
|
|
|
+ calculateQuarterReportDetailBlMonth(spStatementQuarterReport,
|
|
|
+ resultMapBl.get(dataType.getDataType()));
|
|
|
+ spStatementQuarterReports.add(spStatementQuarterReport);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -400,13 +428,13 @@ public class SpStatementQuarterReportServiceImpl extends
|
|
|
containerSingleData.setElectUsage(currentMonthContainerData.getElectUseQuarter());
|
|
|
if (!Objects.isNull(sameTimeLastYear)) {
|
|
|
containerSingleData.setShipUsageTon(
|
|
|
- containerSingleData.getShipUsage().subtract(sameTimeLastYear.getShipUsage())
|
|
|
- .multiply(BigDecimal.valueOf(100))
|
|
|
- .divide(sameTimeLastYear.getShipUsage(), 2, RoundingMode.HALF_UP));
|
|
|
- containerSingleData.setElectUsageTon(
|
|
|
- containerSingleData.getElectUsage().subtract(sameTimeLastYear.getElectUsage())
|
|
|
- .multiply(BigDecimal.valueOf(100))
|
|
|
- .divide(sameTimeLastYear.getElectUsage(), 2, RoundingMode.HALF_UP));
|
|
|
+ containerSingleData.getShipUsage().subtract(sameTimeLastYear.getShipUsage())
|
|
|
+ .multiply(BigDecimal.valueOf(100))
|
|
|
+ .divide(sameTimeLastYear.getShipUsage(), 2, RoundingMode.HALF_UP));
|
|
|
+ containerSingleData.setElectUsageTon(
|
|
|
+ containerSingleData.getElectUsage().subtract(sameTimeLastYear.getElectUsage())
|
|
|
+ .multiply(BigDecimal.valueOf(100))
|
|
|
+ .divide(sameTimeLastYear.getElectUsage(), 2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
containerMapper.insert(containerSingleData);
|
|
|
}
|