|
|
|
@ -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)) {
|
|
|
|
|