Merge remote-tracking branch 'origin/master'

master
eason.qian 7 years ago
commit d9f715bb92

@ -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;
}
}

@ -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<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

@ -3,9 +3,11 @@ package au.com.royalpay.payment.manage.apps.web;
import au.com.royalpay.payment.manage.apps.AppController;
import au.com.royalpay.payment.manage.apps.bean.CustomerImpressionQuery;
import au.com.royalpay.payment.manage.apps.core.CustomerImpression;
import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -22,20 +24,21 @@ public class CustomerImpressionController {
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public JSONObject list(CustomerImpressionQuery customerImpressionQuery) {
public JSONObject list(CustomerImpressionQuery customerImpressionQuery,@ModelAttribute(CommonConsts.APP_INFO) JSONObject app) {
customerImpressionQuery.setClient_id(app.getInteger("client_id"));
return customerImpression.listPageble(customerImpressionQuery);
}
@RequestMapping(value = "/{client_id}/{customer_id}", method = RequestMethod.GET)
@RequestMapping(value = "/{customer_id}", method = RequestMethod.GET)
@ResponseBody
public JSONObject find(@PathVariable int client_id,@PathVariable String customer_id) {
return customerImpression.findOne(client_id,customer_id);
public JSONObject find(@PathVariable String customer_id,@ModelAttribute(CommonConsts.APP_INFO) JSONObject app) {
return customerImpression.findOne(app.getIntValue("client_id"),customer_id);
}
@RequestMapping(value = "/{client_id}/{customer_id}", method = RequestMethod.PUT)
@RequestMapping(value = "/{customer_id}", method = RequestMethod.PUT)
@ResponseBody
public void modifyNameRemark(@PathVariable int client_id, @PathVariable String customer_id, @RequestBody JSONObject customerInfo) {
customerImpression.modifyNameRemark(client_id,customer_id,customerInfo.getString("name_remark"));
public void modifyNameRemark(@PathVariable String customer_id, @RequestBody JSONObject customerInfo,@ModelAttribute(CommonConsts.APP_INFO) JSONObject app) {
customerImpression.modifyNameRemark(app.getIntValue("client_id"),customer_id,customerInfo.getString("name_remark"));
}
}

@ -3,12 +3,15 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper">
<select id="listCustomerInfo" resultType="com.alibaba.fastjson.JSONObject">
SELECT
*
client_id,customer_id,name_remak,headimg,nick_name,tag,payment_times,total_amount,update_time,channel
FROM sys_clients_customers
where
client_id = #{client_id}
<if test="payment_times >0">
and payment_times = #{payment_times}
<if test="payment_times_begin >0">
and payment_times &gt;= #{payment_times_begin}
</if>
<if test="payment_times_end > 0">
and payment_times &lt;= #{payment_times_end}
</if>
<if test="amount_begin != null">
and total_amount &gt; #{amount_begin}
@ -16,6 +19,9 @@
<if test="amount_end != null">
and total_amount &lt;=#{amount_end}
</if>
<if test="nick_name != null">
and (name_remak like CONCAT('%',#{nick_name},'%') or nick_name like CONCAT('%',#{nick_name},'%'))
</if>
</select>
<select id="getClientCustomerWithNull" resultType="com.alibaba.fastjson.JSONObject">

@ -543,13 +543,13 @@
cr.headimg wechat_headimg,
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_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}
<if test="confirm_time">
o.confirm_time > #{confirm_time}
and o.confirm_time > #{confirm_time}
</if>
group by o.customer_id
</select>

@ -1,10 +1,10 @@
window.onbeforeunload = function(e) {
window.onbeforeunload = function (e) {
return '页面已过期|Page Expired';
};
$(function () {
var ctrl = {doubled: false, accessed: false};
$('.coin').click(function () {
if(ctrl.accessed && !ctrl.doubled){
if (ctrl.accessed && !ctrl.doubled) {
var coin = $(this);
coin.addClass('throwing');
$.ajax({
@ -15,20 +15,21 @@ $(function () {
$('.encourage-dialog .money-amount').html(encourage.actural_amount);
$('.encourage-dialog .double-rate').html('X ' + encourage.factor);
$('.encourage-dialog .double-text').hide();
setTimeout(function(){
setTimeout(function () {
coin.removeClass('throwing');
},1000);
}, 1000);
},
error: function () {
setTimeout(function(){
setTimeout(function () {
coin.removeClass('throwing');
},1000);
}, 1000);
}
});
ctrl.doubled = true;
}
});
function loadEncourage() {
$.ajax({
url: '/act/encourage_money/orders/' + window.order_id,
@ -39,28 +40,32 @@ $(function () {
$('.encourage-dialog .money-amount').html(encourage.actural_amount);
$('.encourage-dialog .double-rate').html('X ' + encourage.factor);
$('.encourage-dialog').removeClass('hide');
ctrl.accessed=true;
ctrl.accessed = true;
}
}
})
}
loadEncourage();
function loadPoints() {
$.ajax({
url: '/customers/points/' + window.order_id +'/check',
method: 'GET',
dataType: 'text',
success: function (data) {
if (data>0){
$('.points-dialog .points-value').html('+ ' + data);
$('.points-dialog').removeClass('hide');
}
if ([0, 1, 2, 11].indexOf(window.order_gateway) >= 0) {
$.ajax({
url: '/customers/points/' + window.order_id + '/check',
method: 'GET',
dataType: 'text',
success: function (data) {
if (data > 0) {
$('.points-dialog .points-value').html('+ ' + data);
$('.points-dialog').removeClass('hide');
}
},error:function () {
}
});
}, error: function () {
}
});
}
}
loadPoints();
$('.encourage-dialog .close-circle').click(function () {

Loading…
Cancel
Save