|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.apps.core.impls;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -54,19 +55,33 @@ public class CustomerImpressionImpl implements CustomerImpression {
|
|
|
|
|
}
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
params.put("customer_id", customer_id);
|
|
|
|
|
params.put("include_success_status",4);
|
|
|
|
|
List<JSONObject> paymentInfos = new ArrayList<>();
|
|
|
|
|
PageList<JSONObject> ordersLast = orderMapper.listOrderByCustomer(params, new PageBounds(1, 1, Order.formString("create_time.desc")));
|
|
|
|
|
if (!CollectionUtils.isEmpty(ordersLast)) {
|
|
|
|
|
JSONObject order = ordersLast.get(0);
|
|
|
|
|
customer.put("last_pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
customer.put("last_pay_location", lookupService.getLocation(order.getString("customer_ip")).city);
|
|
|
|
|
JSONObject paymentInfo = new JSONObject();
|
|
|
|
|
paymentInfo.put("pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
String city = lookupService.getLocation(order.getString("customer_ip")).city;
|
|
|
|
|
if(!StringUtils.isEmpty(city)){
|
|
|
|
|
paymentInfo.put("pay_location", city);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
paymentInfos.add(paymentInfo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
PageList<JSONObject> ordersFirst = orderMapper.listOrderByCustomer(params, new PageBounds(1, 1, Order.formString("create_time.asc")));
|
|
|
|
|
if (!CollectionUtils.isEmpty(ordersFirst)) {
|
|
|
|
|
JSONObject order = ordersFirst.get(0);
|
|
|
|
|
customer.put("first_pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
customer.put("first_pay_location", lookupService.getLocation(order.getString("customer_ip")).city);
|
|
|
|
|
|
|
|
|
|
JSONObject paymentInfo = new JSONObject();
|
|
|
|
|
paymentInfo.put("pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
String city = lookupService.getLocation(order.getString("customer_ip")).city;
|
|
|
|
|
if(!StringUtils.isEmpty(city)){
|
|
|
|
|
paymentInfo.put("pay_location", city);
|
|
|
|
|
}
|
|
|
|
|
paymentInfos.add(paymentInfo);
|
|
|
|
|
}
|
|
|
|
|
customer.put("payment_info",paymentInfos);
|
|
|
|
|
return customer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -75,6 +90,7 @@ public class CustomerImpressionImpl implements CustomerImpression {
|
|
|
|
|
public void generate(int client_id) {
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
|
params.put("include_success_status",4);
|
|
|
|
|
PageList<JSONObject> lastRecord = clientCustomersMapper.listCustomerInfo(params, new PageBounds(1, 1, Order.formString("update_time.desc")));
|
|
|
|
|
if (!CollectionUtils.isEmpty(lastRecord)) {
|
|
|
|
|
params.put("confirm_time", lastRecord.get(0).getDate("update_time"));
|
|
|
|
@ -102,6 +118,7 @@ public class CustomerImpressionImpl implements CustomerImpression {
|
|
|
|
|
client_customer.put("payment_times", order.getIntValue("payment_times"));
|
|
|
|
|
client_customer.put("total_amount", order.getBigDecimal("total_amount"));
|
|
|
|
|
client_customer.put("update_time", now);
|
|
|
|
|
client_customer.put("last_payment_time",order.getDate("confirm_time"));
|
|
|
|
|
clientCustomersMapper.insert(client_customer);
|
|
|
|
|
} else {
|
|
|
|
|
clientCustomerInfo.put("payment_times", clientCustomerInfo.getIntValue("payment_times") + order.getIntValue("payment_times"));
|
|
|
|
@ -122,6 +139,7 @@ public class CustomerImpressionImpl implements CustomerImpression {
|
|
|
|
|
clientCustomerInfo.put("channel", order.getString("channel"));
|
|
|
|
|
clientCustomerInfo.put("tag","不活跃用户");
|
|
|
|
|
clientCustomerInfo.put("update_time",now);
|
|
|
|
|
clientCustomerInfo.put("last_payment_time",order.getDate("confirm_time"));
|
|
|
|
|
clientCustomersMapper.update(clientCustomerInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|