ref 12119:AccountingDashboard - Create a new Accounting Dashboard

https://support.d4science.org/issues/12119

Fixed time limits in charts

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashboard@169941 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-07-24 17:06:54 +00:00
parent 7788474aed
commit 4a082c602c
1 changed files with 10 additions and 19 deletions

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.accountingdashboard.server.accounting; package org.gcube.portlets.user.accountingdashboard.server.accounting;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.GregorianCalendar;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -125,22 +125,13 @@ public class AccountingService {
"Invalid format: [dateStart=" + dateStart + ", dateEnd=" + dateEnd + "]"); "Invalid format: [dateStart=" + dateStart + ", dateEnd=" + dateEnd + "]");
} }
GregorianCalendar dateFrom; Instant dateFrom;
GregorianCalendar dateTo; Instant dateTo;
try { try {
int yearS = Integer.parseInt(dateStart.substring(0, 4));
logger.debug("yearS: " + yearS);
int monthS = Integer.parseInt(dateStart.substring(5, 7)) - 1;
logger.debug("monthS: " + monthS);
int dayS = Integer.parseInt(dateStart.substring(8, 10));
logger.debug("dayS: " + dayS);
dateFrom = new GregorianCalendar(yearS, monthS, dayS); dateFrom=Instant.parse(dateStart+"T00:00:00.00Z");
int yearE = Integer.parseInt(dateEnd.substring(0, 4)); dateTo=Instant.parse(dateEnd+"T00:00:00.00Z");
int monthE = Integer.parseInt(dateEnd.substring(5, 7)) - 1;
int dayE = Integer.parseInt(dateEnd.substring(8, 10));
dateTo = new GregorianCalendar(yearE, monthE, dayE);
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Invalid date format: [dateStart=" + dateStart + ", dateEnd=" + dateEnd + "]"); logger.error("Invalid date format: [dateStart=" + dateStart + ", dateEnd=" + dateEnd + "]");
@ -150,9 +141,9 @@ public class AccountingService {
} }
logger.debug("getReportByScope(): [ScopeDescriptor=" + scopeDescriptor + ", dateFrom=" logger.debug("getReportByScope(): [ScopeDescriptor=" + scopeDescriptor + ", dateFrom="
+ dateFrom.getTime() + ", dateTo=" + dateTo.getTime() + ", measureResolution=" + dateFrom + ", dateTo=" + dateTo + ", measureResolution="
+ MeasureResolution.MONTHLY + "]"); + MeasureResolution.MONTHLY + "]");
Report report = dao.getReportByScope(scopeDescriptor, dateFrom.getTime(), dateTo.getTime(), Report report = dao.getReportByScope(scopeDescriptor, dateFrom, dateTo,
MeasureResolution.MONTHLY); MeasureResolution.MONTHLY);
logger.debug("Report: " + report); logger.debug("Report: " + report);