From 4027c84debe02178256da7cb4a8ec7d06509ebfa Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Thu, 4 Jan 2018 11:10:34 +0800 Subject: [PATCH] update --- .../apps/bean/CustomerImpressionQuery.java | 33 +++++++++++++++---- .../core/impls/CustomerImpressionImpl.java | 31 +++++++++++++++++ .../mappers/client/ClientCustomersMapper.xml | 12 +++++-- .../manage/mappers/payment/OrderMapper.xml | 6 ++-- 4 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/bean/CustomerImpressionQuery.java b/src/main/java/au/com/royalpay/payment/manage/apps/bean/CustomerImpressionQuery.java index a177232b0..c4ae0da28 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/bean/CustomerImpressionQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/bean/CustomerImpressionQuery.java @@ -8,29 +8,42 @@ import java.math.BigDecimal; * Created by wangning on 2017/12/28. */ public class CustomerImpressionQuery { - private int payment_times; + private int payment_times_begin; + private int payment_times_end; private BigDecimal amount_begin; private BigDecimal amount_end; private String order; + private String nick_name; private int client_id; private int page = 1; private int limit = 10; public JSONObject toParam(){ 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_end",this.amount_end); param.put("order",this.order); param.put("client_id",this.client_id); + param.put("nick_name",nick_name); 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) { - this.payment_times = payment_times; + public void setPayment_times_end(int payment_times_end) { + this.payment_times_end = payment_times_end; } public BigDecimal getamount_begin() { @@ -96,5 +109,13 @@ public class CustomerImpressionQuery { public void setClient_id(int 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; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImpl.java b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImpl.java index 034c11350..1288bbc83 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImpl.java @@ -8,6 +8,7 @@ import javax.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; +import org.joda.time.DateTime; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; 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("customer_id", order.getString("customer_id")); client_customer.put("channel", order.getString("channel")); + client_customer.put("tag","不活跃用户"); if (order.getString("alipay_headimg") == null) { client_customer.put("headimg", order.getString("wechat_headimg")); 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("channel", order.getString("channel")); + clientCustomerInfo.put("tag","不活跃用户"); clientCustomerInfo.put("update_time",now); 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 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 diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml index 1de5ec0bb..15477002f 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml @@ -3,12 +3,15 @@