From ea8a6fa275407523f2e1b72ec303c6b0def89c98 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 5 Jan 2018 10:11:36 +0800 Subject: [PATCH 1/5] update --- .../apps/core/impls/CustomerImpressionImpl.java | 17 ++++++++++++----- .../apps/web/CustomerImpressionController.java | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) 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 1288bbc83..86db8f97e 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 @@ -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,25 @@ public class CustomerImpressionImpl implements CustomerImpression { } JSONObject params = new JSONObject(); params.put("customer_id", customer_id); + JSONObject paymentInfos = new JSONObject(); PageList 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("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); + } PageList 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("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); } + customer.put("payment_info",paymentInfos); return customer; } diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/web/CustomerImpressionController.java b/src/main/java/au/com/royalpay/payment/manage/apps/web/CustomerImpressionController.java index b57203804..acc9b2ed7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/web/CustomerImpressionController.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/web/CustomerImpressionController.java @@ -1,9 +1,9 @@ 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 au.com.royalpay.payment.tools.device.advise.AppClientController; import com.alibaba.fastjson.JSONObject; @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; -@AppController +@AppClientController @RequestMapping(value = "/customers/impression") public class CustomerImpressionController { @Resource @@ -24,7 +24,7 @@ public class CustomerImpressionController { @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody - public JSONObject list(CustomerImpressionQuery customerImpressionQuery,@ModelAttribute(CommonConsts.APP_INFO) JSONObject app) { + public JSONObject list(CustomerImpressionQuery customerImpressionQuery,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { customerImpressionQuery.setClient_id(app.getInteger("client_id")); return customerImpression.listPageble(customerImpressionQuery); } @@ -32,13 +32,13 @@ public class CustomerImpressionController { @RequestMapping(value = "/{customer_id}", method = RequestMethod.GET) @ResponseBody - public JSONObject find(@PathVariable String customer_id,@ModelAttribute(CommonConsts.APP_INFO) JSONObject app) { + public JSONObject find(@PathVariable String customer_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { return customerImpression.findOne(app.getIntValue("client_id"),customer_id); } @RequestMapping(value = "/{customer_id}", method = RequestMethod.PUT) @ResponseBody - public void modifyNameRemark(@PathVariable String customer_id, @RequestBody JSONObject customerInfo,@ModelAttribute(CommonConsts.APP_INFO) JSONObject app) { + public void modifyNameRemark(@PathVariable String customer_id, @RequestBody JSONObject customerInfo,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { customerImpression.modifyNameRemark(app.getIntValue("client_id"),customer_id,customerInfo.getString("name_remark")); } } From 916c7fce3f735b4fcd2e10bddff67ffa9c7ab39f Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 5 Jan 2018 13:58:24 +0800 Subject: [PATCH 2/5] update --- .../payment/manage/apps/core/impls/CustomerImpressionImpl.java | 2 ++ 1 file changed, 2 insertions(+) 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 86db8f97e..d232ac72e 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 @@ -109,6 +109,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")); @@ -129,6 +130,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); } } From 3fe7db9421346417711e0e5f2a0850bac5151f1b Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 5 Jan 2018 14:39:15 +0800 Subject: [PATCH 3/5] update --- .../core/impls/CustomerImpressionImpl.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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 d232ac72e..104d20a87 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 @@ -55,23 +55,30 @@ public class CustomerImpressionImpl implements CustomerImpression { } JSONObject params = new JSONObject(); params.put("customer_id", customer_id); - JSONObject paymentInfos = new JSONObject(); + List paymentInfos = new ArrayList<>(); PageList 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 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; From 20fcdb89cb47e175b64d09a7d79252ef4b00a3da Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 5 Jan 2018 15:57:05 +0800 Subject: [PATCH 4/5] update --- .../payment/manage/mappers/client/ClientCustomersMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 dfd1e3c25..780110af8 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,7 +3,7 @@