Merge branch 'update' into develop

master
wangning 7 years ago
commit db15bacef1

@ -55,23 +55,30 @@ public class CustomerImpressionImpl implements CustomerImpression {
}
JSONObject params = new JSONObject();
params.put("customer_id", customer_id);
JSONObject paymentInfos = new JSONObject();
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);
JSONObject paymentInfo = new JSONObject();
paymentInfo.put("last_pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss"));
paymentInfo.put("last_pay_location", lookupService.getLocation(order.getString("customer_ip")).city);
paymentInfos.put("last_payment_info",paymentInfo);
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);
JSONObject paymentInfo = new JSONObject();
paymentInfo.put("first_pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss"));
paymentInfo.put("first_pay_location", lookupService.getLocation(order.getString("customer_ip")).city);
paymentInfos.put("first_payment_info",paymentInfo);
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;

Loading…
Cancel
Save