fix App时区

master
luoyang 5 years ago
parent 3398abeb43
commit 626ec917d5

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.2.48</version> <version>1.2.49</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -9,6 +9,9 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.castor.util.StringUtil; 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.DateFormat;
import java.text.ParseException; import java.text.ParseException;
@ -39,20 +42,16 @@ public class AppQueryBean {
public JSONObject toParams() { public JSONObject toParams() {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
if (begin != null) { if (begin != null) {
try { DateTime fromDate = DateTime.parse(begin, DateTimeFormat.forPattern("yyyyMMdd"))
params.put("begin", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne"))).withZone(DateTimeZone.getDefault());
params.put("from", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); params.put("begin", fromDate.toDateTime());
} catch (ParseException e) { params.put("from", fromDate.toDateTime());
throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format");
}
} }
if (end != null) { if (end != null) {
try { DateTime toDate = DateTime.parse(end, DateTimeFormat.forPattern("yyyyMMdd"))
params.put("end", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne"))).withZone(DateTimeZone.getDefault());
params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne")); params.put("end", toDate.toDateTime());
} catch (ParseException e) { params.put("to", toDate.toDateTime());
throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format");
}
} }
if (gateway != null && gateway.length > 0) { if (gateway != null && gateway.length > 0) {
List<Integer> tradeTypes = new ArrayList<>(); List<Integer> tradeTypes = new ArrayList<>();

Loading…
Cancel
Save