From 4b1939fb9f037dba291f3373e5198d226df7fc27 Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 30 Oct 2019 21:23:26 +0800 Subject: [PATCH] =?UTF-8?q?fix=20App=E6=97=B6=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../manage/appclient/beans/AppQueryBean.java | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 2262217aa..4ed55ce94 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 manage - 1.2.48 + 1.2.49 UTF-8 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 745a0bf0e..591597d84 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 @@ -9,6 +9,9 @@ import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.castor.util.StringUtil; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormat; import java.text.DateFormat; import java.text.ParseException; @@ -39,20 +42,16 @@ public class AppQueryBean { public JSONObject toParams() { JSONObject params = new JSONObject(); if (begin != null) { - try { - params.put("begin", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); - params.put("from", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); - } catch (ParseException e) { - throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format"); - } + DateTime fromDate = DateTime.parse(begin, DateTimeFormat.forPattern("yyyyMMdd")) + .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne"))).withZone(DateTimeZone.getDefault()); + params.put("begin", fromDate.toDateTime()); + params.put("from", fromDate.toDateTime()); } if (end != null) { - try { - params.put("end", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); - params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); - } catch (ParseException e) { - throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format"); - } + DateTime toDate = DateTime.parse(end, DateTimeFormat.forPattern("yyyyMMdd")) + .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne"))).withZone(DateTimeZone.getDefault()); + params.put("end", toDate.toDateTime()); + params.put("to", toDate.toDateTime()); } if (gateway != null && gateway.length > 0) { List tradeTypes = new ArrayList<>();