hotfix: 优化用户数查询

master
Yixian 3 years ago
parent 6a3a214708
commit b1c04352b6

@ -414,11 +414,9 @@
<select id="countNewCustomers" resultType="java.lang.Integer"> <select id="countNewCustomers" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
SELECT COUNT(DISTINCT customer_id) FROM (SELECT o.customer_id FROM pmt_transactions t SELECT COUNT(customer_id) FROM (
INNER JOIN pmt_orders o ON o.order_id = t.order_id SELECT o.customer_id,min(o.create_time) first_pay FROM pmt_orders o
]]> WHERE o.create_time < #{end} and o.status>4
<![CDATA[
WHERE o.create_time >= #{begin} AND o.create_time < #{end}
]]> ]]>
<if test="client_ids!=null"> <if test="client_ids!=null">
AND o.client_id IN AND o.client_id IN
@ -429,30 +427,17 @@
<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="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and t.org_id in <if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if> </if>
<if test="channel !=null">and o.channel = #{channel}</if> <if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[ <![CDATA[
GROUP BY o.customer_id) p GROUP BY o.customer_id
where p.customer_id NOT IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id having first_pay>=#{begin}
]]> ) p
<![CDATA[
WHERE o.create_time < #{begin}
]]>
<if test="client_ids!=null">
AND o.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and o.client_id=#{client_id}
</if>
<![CDATA[
)
]]> ]]>
</select> </select>
<select id="countOldCustomers" resultType="java.lang.Integer"> <select id="countOldCustomers" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[

@ -20,6 +20,9 @@ server {
server { server {
listen 3000; listen 3000;
server_name _ default; server_name _ default;
underscores_in_headers on;
proxy_ignore_client_abort on;
client_max_body_size 0;
location ~ ^/api/v1.0/retail/((?!(app|rsvc)).)+ { location ~ ^/api/v1.0/retail/((?!(app|rsvc)).)+ {
proxy_pass http://rppaycenter; proxy_pass http://rppaycenter;
@ -31,7 +34,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -47,7 +50,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -62,7 +65,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -78,7 +81,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -94,7 +97,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -109,7 +112,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -125,7 +128,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -141,7 +144,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -157,7 +160,6 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -173,7 +175,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -188,7 +190,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -203,7 +205,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }

Loading…
Cancel
Save