fix app timezone

master
luoyang 6 years ago
parent 5c69bfb198
commit 394af694ca

@ -35,18 +35,21 @@ public class AppQueryBean {
public JSONObject toParams() {
JSONObject params = new JSONObject();
if (timezone != null) {
format.setTimeZone(TimeZone.getTimeZone(timezone));
}
if (begin != null) {
try {
params.put("begin", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:""));
params.put("from", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:""));
params.put("begin", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne"));
params.put("from", TimeZoneUtils.formatTime(format.parse(begin),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne"));
} catch (ParseException e) {
throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format");
}
}
if (end != null) {
try {
params.put("end", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:""));
params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:""));
params.put("end", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne"));
params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(end), 1),"yyyy-MM-dd HH:mm:ss","Australia/Melbourne"));
} catch (ParseException e) {
throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format");
}

Loading…
Cancel
Save