|
|
|
@ -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<Integer> tradeTypes = new ArrayList<>();
|
|
|
|
|