fix app订单流水查询过慢

master
luoyang 5 years ago
parent 0ad99dd1ad
commit 6523740dcd

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

@ -77,6 +77,7 @@ import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.joda.time.DateTime;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -855,7 +856,15 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("dev_id", device.getString("dev_id")); params.put("dev_id", device.getString("dev_id"));
} }
params.put("client_id", client_id); params.put("client_id", client_id);
if (StringUtils.isBlank(params.getString("begin"))) {
Date now = new Date();
Date lastWeekDay = DateUtils.addDays(now, -7);
lastWeekDay = new DateTime(lastWeekDay.getTime()).withTimeAtStartOfDay().toDate();
params.put("from", lastWeekDay);
params.put("begin", lastWeekDay);
params.put("end", now);
params.put("to", now);
}
PageList<JSONObject> orders = orderMapper.listTransactionsForApp(params, PageList<JSONObject> orders = orderMapper.listTransactionsForApp(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("transaction_time.desc"))); new PageBounds(query.getPage(), query.getLimit(), Order.formString("transaction_time.desc")));
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time"); TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");

@ -728,8 +728,8 @@
<if test="client_ids==null and client_id !=null"> <if test="client_ids==null and client_id !=null">
and o.client_id=#{client_id} and o.client_id=#{client_id}
</if> </if>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if> <if test="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if> <if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(t.transaction_time)=date(#{date}) <if test="date!=null">and date(t.transaction_time)=date(#{date})
</if> </if>
<if test="trade_type!=null">and o.gateway in <if test="trade_type!=null">and o.gateway in

Loading…
Cancel
Save