From 21f933a1dad7e74fa3c04250203cff12fdd6c965 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 11 Apr 2019 13:46:20 +0800 Subject: [PATCH] fix app timezone --- .../payment/manage/appclient/beans/AppQueryBean.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java index 3b6f89515..938344f1c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java @@ -35,18 +35,21 @@ public class AppQueryBean { public JSONObject toParams() { JSONObject params = new JSONObject(); + if (timezone != null) { + format.setTimeZone(TimeZone.getTimeZone(timezone)); + } if (begin != null) { try { - params.put("begin", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"")); - params.put("from", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"")); + params.put("begin", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne")); + params.put("from", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne")); } catch (ParseException e) { throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format"); } } if (end != null) { try { - params.put("end", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"")); - params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"")); + params.put("end", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne")); + params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne")); } catch (ParseException e) { throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format"); }