Merge branch 'update' into develop

master
wangning 7 years ago
commit ae0f0d724f

@ -8,29 +8,42 @@ import java.math.BigDecimal;
* Created by wangning on 2017/12/28. * Created by wangning on 2017/12/28.
*/ */
public class CustomerImpressionQuery { public class CustomerImpressionQuery {
private int payment_times; private int payment_times_begin;
private int payment_times_end;
private BigDecimal amount_begin; private BigDecimal amount_begin;
private BigDecimal amount_end; private BigDecimal amount_end;
private String order; private String order;
private String nick_name;
private int client_id; private int client_id;
private int page = 1; private int page = 1;
private int limit = 10; private int limit = 10;
public JSONObject toParam(){ public JSONObject toParam(){
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("payment_times",this.payment_times); param.put("payment_times_begin",this.payment_times_begin);
param.put("payment_times_end",this.payment_times_end);
param.put("amount_begin",this.amount_begin); param.put("amount_begin",this.amount_begin);
param.put("amount_end",this.amount_end); param.put("amount_end",this.amount_end);
param.put("order",this.order); param.put("order",this.order);
param.put("client_id",this.client_id); param.put("client_id",this.client_id);
param.put("nick_name",nick_name);
return param; return param;
} }
public int getPayment_times() {
return payment_times; public int getPayment_times_begin() {
return payment_times_begin;
}
public void setPayment_times_begin(int payment_times_begin) {
this.payment_times_begin = payment_times_begin;
}
public int getPayment_times_end() {
return payment_times_end;
} }
public void setPayment_times(int payment_times) { public void setPayment_times_end(int payment_times_end) {
this.payment_times = payment_times; this.payment_times_end = payment_times_end;
} }
public BigDecimal getamount_begin() { public BigDecimal getamount_begin() {
@ -96,5 +109,13 @@ public class CustomerImpressionQuery {
public void setClient_id(int client_id) { public void setClient_id(int client_id) {
this.client_id = client_id; this.client_id = client_id;
} }
public String getNick_name() {
return nick_name;
}
public void setNick_name(String nick_name) {
this.nick_name = nick_name;
}
} }

@ -8,6 +8,7 @@ import javax.annotation.Resource;
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.joda.time.DateTime;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -90,6 +91,7 @@ public class CustomerImpressionImpl implements CustomerImpression {
client_customer.put("client_id", order.getIntValue("client_id")); client_customer.put("client_id", order.getIntValue("client_id"));
client_customer.put("customer_id", order.getString("customer_id")); client_customer.put("customer_id", order.getString("customer_id"));
client_customer.put("channel", order.getString("channel")); client_customer.put("channel", order.getString("channel"));
client_customer.put("tag","不活跃用户");
if (order.getString("alipay_headimg") == null) { if (order.getString("alipay_headimg") == null) {
client_customer.put("headimg", order.getString("wechat_headimg")); client_customer.put("headimg", order.getString("wechat_headimg"));
client_customer.put("nick_name", order.getString("wechat_nickname")); client_customer.put("nick_name", order.getString("wechat_nickname"));
@ -118,10 +120,39 @@ public class CustomerImpressionImpl implements CustomerImpression {
clientCustomerInfo.put("nick_name", order.getString("alipay_nickname")); clientCustomerInfo.put("nick_name", order.getString("alipay_nickname"));
} }
clientCustomerInfo.put("channel", order.getString("channel")); clientCustomerInfo.put("channel", order.getString("channel"));
clientCustomerInfo.put("tag","不活跃用户");
clientCustomerInfo.put("update_time",now); clientCustomerInfo.put("update_time",now);
clientCustomersMapper.update(clientCustomerInfo); clientCustomersMapper.update(clientCustomerInfo);
} }
} }
generateTag(client_id);
}
private void generateTag(int client_id){
JSONObject params = new JSONObject();
DateTime dt = new DateTime();
dt = dt.minusMonths(5);
params.put("confirm_time",dt.toDate());
params.put("client_id",client_id);
List<JSONObject> orders = orderMapper.listAnalysisClientCustomer(params);
for (JSONObject order : orders) {
int payment_times = order.getInteger("payment_times");
JSONObject updateRecord = new JSONObject();
updateRecord.put("client_id",order.getIntValue("client_id"));
updateRecord.put("customer_id",order.getString("customer_id"));
if(payment_times<2){
updateRecord.put("tag","不活跃用户");
}
if(payment_times>=2 && payment_times<10){
updateRecord.put("tag","潜力用户");
}
if(payment_times>=10){
updateRecord.put("tag","忠实用户");
}
clientCustomersMapper.update(updateRecord);
}
} }
@Override @Override

@ -7,8 +7,11 @@
FROM sys_clients_customers FROM sys_clients_customers
where where
client_id = #{client_id} client_id = #{client_id}
<if test="payment_times >0"> <if test="payment_times_begin >0">
and payment_times = #{payment_times} and payment_times &gt;= #{payment_times_begin}
</if>
<if test="payment_times_end > 0">
and payment_times &lt;= #{payment_times_end}
</if> </if>
<if test="amount_begin != null"> <if test="amount_begin != null">
and total_amount &gt; #{amount_begin} and total_amount &gt; #{amount_begin}
@ -16,6 +19,9 @@
<if test="amount_end != null"> <if test="amount_end != null">
and total_amount &lt;=#{amount_end} and total_amount &lt;=#{amount_end}
</if> </if>
<if test="nick_name != null">
and (name_remak like CONCAT('%',#{nick_name},'%') or nick_name like CONCAT('%',#{nick_name},'%'))
</if>
</select> </select>
<select id="getClientCustomerWithNull" resultType="com.alibaba.fastjson.JSONObject"> <select id="getClientCustomerWithNull" resultType="com.alibaba.fastjson.JSONObject">

@ -543,13 +543,13 @@
cr.headimg wechat_headimg, cr.headimg wechat_headimg,
max( o.confirm_time) confirm_time max( o.confirm_time) confirm_time
from pmt_orders_copy o from pmt_orders o
left join sys_customer_relation cr on cr.wepay_openid = o.customer_id left join sys_customer_relation cr on cr.wepay_openid = o.customer_id
left join sys_customer_relation_alipay cra on cra.alipay_uid = o.customer_id left join sys_customer_relation_alipay cra on cra.alipay_uid = o.customer_id
where o.customer_id is not null where o.customer_id is not null and (o.channel = 'Alipay' or o.channel = 'Wechat')
and client_id = #{client_id} and client_id = #{client_id}
<if test="confirm_time"> <if test="confirm_time">
o.confirm_time > #{confirm_time} and o.confirm_time > #{confirm_time}
</if> </if>
group by o.customer_id group by o.customer_id
</select> </select>

Loading…
Cancel
Save