|
|
|
@ -24,6 +24,8 @@ import au.com.royalpay.payment.manage.apps.bean.CustomerImpressionQuery;
|
|
|
|
|
import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CustomerRelationAlipayMapper;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
@ -39,6 +41,10 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
|
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private LookupService lookupService;
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerRelationAlipayMapper customerRelationAlipayMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerMapper customerMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject listPageble(CustomerImpressionQuery customerImpressionQuery) {
|
|
|
|
@ -101,6 +107,11 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
|
|
|
|
|
if (StringUtils.isEmpty(order.getString("channel"))) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
JSONObject userInfo = customerMapper.findCustomerByOpenId(order.getString("customer_id"));
|
|
|
|
|
if (userInfo == null) {
|
|
|
|
|
userInfo = customerRelationAlipayMapper.findCustomerByUserId(order.getString("customer_id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomerWithNull(client_id, order.getString("customer_id"));
|
|
|
|
|
if (clientCustomerInfo == null) {
|
|
|
|
|
JSONObject client_customer = new JSONObject();
|
|
|
|
@ -108,12 +119,9 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
|
|
|
|
|
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"));
|
|
|
|
|
} else {
|
|
|
|
|
client_customer.put("headimg", order.getString("alipay_headimg"));
|
|
|
|
|
client_customer.put("nick_name", order.getString("alipay_nickname"));
|
|
|
|
|
if (userInfo != null) {
|
|
|
|
|
client_customer.put("headimg", userInfo.getString("headimg"));
|
|
|
|
|
client_customer.put("nick_name", userInfo.getString("nickname"));
|
|
|
|
|
}
|
|
|
|
|
client_customer.put("payment_times", order.getIntValue("payment_times"));
|
|
|
|
|
client_customer.put("total_amount", order.getBigDecimal("total_amount"));
|
|
|
|
@ -128,13 +136,9 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
|
|
|
|
|
} else {
|
|
|
|
|
clientCustomerInfo.put("total_amount", order.getBigDecimal("total_amount"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (order.getString("alipay_headimg") == null) {
|
|
|
|
|
clientCustomerInfo.put("headimg", order.getString("wechat_headimg"));
|
|
|
|
|
clientCustomerInfo.put("nick_name", order.getString("wechat_nickname"));
|
|
|
|
|
} else {
|
|
|
|
|
clientCustomerInfo.put("headimg", order.getString("alipay_headimg"));
|
|
|
|
|
clientCustomerInfo.put("nick_name", order.getString("alipay_nickname"));
|
|
|
|
|
if (userInfo != null) {
|
|
|
|
|
clientCustomerInfo.put("headimg", userInfo.getString("headimg"));
|
|
|
|
|
clientCustomerInfo.put("nick_name", userInfo.getString("nickname"));
|
|
|
|
|
}
|
|
|
|
|
clientCustomerInfo.put("channel", order.getString("channel"));
|
|
|
|
|
clientCustomerInfo.put("tag", "不活跃用户");
|
|
|
|
@ -146,7 +150,6 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
|
|
|
|
|
generateTag(client_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void generateTag(int client_id) {
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
DateTime dt = new DateTime();
|
|
|
|
|