From f7c049a2d6282457afaf40a7e313b4afc4e5701a Mon Sep 17 00:00:00 2001 From: duLingLing Date: Mon, 18 Nov 2019 18:03:53 +1200 Subject: [PATCH] =?UTF-8?q?Upd:App=E6=9F=A5=E7=9C=8B=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E6=B1=87=E6=80=BB=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../core/impls/RetailAppServiceImp.java | 3 --- .../manage/tradelog/beans/TradeLogQuery.java | 24 ++++++++----------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index c6167da35..92e9ca0c3 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.2.84 + 1.2.85 UTF-8 1.4.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index e040bfce4..8c5e25cc9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -964,9 +964,6 @@ public class RetailAppServiceImp implements RetailAppService { ArrayList dateContains = new ArrayList<>(); for (JSONObject order : orders) { Calendar calendar = (Calendar) order.get("transaction_time"); - if (timezone != null) { - calendar.setTimeZone(TimeZone.getTimeZone(timezone)); - } String tradeDate = DateFormatUtils.format(calendar, "yyyy-MM-dd", calendar.getTimeZone()); String tradeTime = DateFormatUtils.format(calendar, "HH:mm:ss", calendar.getTimeZone()); order.put("trade_date", tradeDate); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java index f2c40c9b2..b5f92b810 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java @@ -2,16 +2,15 @@ package au.com.royalpay.payment.manage.tradelog.beans; import au.com.royalpay.payment.core.beans.OrderStatus; import au.com.royalpay.payment.core.beans.PayChannel; -import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.tools.defines.TradeType; -import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import com.alibaba.fastjson.JSONObject; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormat; import java.text.DateFormat; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; @@ -53,19 +52,16 @@ public class TradeLogQuery { public JSONObject toParams(String timezone) { JSONObject params = new JSONObject(); if (datefrom != null) { - try { - params.put("from", TimeZoneUtils.formatTime(format.parse(datefrom),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"Australia/Melbourne")); - } catch (ParseException e) { - throw new ParamInvalidException("datefrom", "error.payment.valid.invalid_date_format"); - } + DateTime fromDate = DateTime.parse(datefrom, DateTimeFormat.forPattern("yyyyMMdd")) + .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone) ? timezone : "Australia/Melbourne"))).withZone(DateTimeZone.getDefault()); + params.put("from", fromDate.toDate()); } if (dateto != null) { - try { - params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(dateto), 1),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"Australia/Melbourne")); - } catch (ParseException e) { - throw new ParamInvalidException("dateto", "error.payment.valid.invalid_date_format"); - } + DateTime toDate = DateTime.parse(dateto, DateTimeFormat.forPattern("yyyyMMdd")) + .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone) ? timezone : "Australia/Melbourne"))).withZone(DateTimeZone.getDefault()); + params.put("to", DateUtils.addDays(toDate.toDate(), 1)); } + if (StringUtils.isNotBlank(searchText)) { params.put("search_text", searchText); if (StringUtils.isNotBlank(textType)) {