fix App时区

master
luoyang 5 years ago
parent 3398abeb43
commit 626ec917d5

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.2.48</version>
<version>1.2.49</version>
<properties>
<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.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<>();

Loading…
Cancel
Save