master
wangning 7 years ago
parent 0d280f93ac
commit ea8a6fa275

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.apps.core.impls; package au.com.royalpay.payment.manage.apps.core.impls;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -54,19 +55,25 @@ public class CustomerImpressionImpl implements CustomerImpression {
} }
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("customer_id", customer_id); params.put("customer_id", customer_id);
JSONObject paymentInfos = new JSONObject();
PageList<JSONObject> ordersLast = orderMapper.listOrderByCustomer(params, new PageBounds(1, 1, Order.formString("create_time.desc"))); PageList<JSONObject> ordersLast = orderMapper.listOrderByCustomer(params, new PageBounds(1, 1, Order.formString("create_time.desc")));
if (!CollectionUtils.isEmpty(ordersLast)) { if (!CollectionUtils.isEmpty(ordersLast)) {
JSONObject order = ordersLast.get(0); JSONObject order = ordersLast.get(0);
customer.put("last_pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss")); JSONObject paymentInfo = new JSONObject();
customer.put("last_pay_location", lookupService.getLocation(order.getString("customer_ip")).city); 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<JSONObject> ordersFirst = orderMapper.listOrderByCustomer(params, new PageBounds(1, 1, Order.formString("create_time.asc"))); PageList<JSONObject> ordersFirst = orderMapper.listOrderByCustomer(params, new PageBounds(1, 1, Order.formString("create_time.asc")));
if (!CollectionUtils.isEmpty(ordersFirst)) { if (!CollectionUtils.isEmpty(ordersFirst)) {
JSONObject order = ordersFirst.get(0); JSONObject order = ordersFirst.get(0);
customer.put("first_pay_time", DateFormatUtils.format(order.getDate("create_time"), "yyyy-MM-dd HH:mm:ss")); JSONObject paymentInfo = new JSONObject();
customer.put("first_pay_location", lookupService.getLocation(order.getString("customer_ip")).city); 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; return customer;
} }

@ -1,9 +1,9 @@
package au.com.royalpay.payment.manage.apps.web; 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.bean.CustomerImpressionQuery;
import au.com.royalpay.payment.manage.apps.core.CustomerImpression; import au.com.royalpay.payment.manage.apps.core.CustomerImpression;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
@AppController @AppClientController
@RequestMapping(value = "/customers/impression") @RequestMapping(value = "/customers/impression")
public class CustomerImpressionController { public class CustomerImpressionController {
@Resource @Resource
@ -24,7 +24,7 @@ public class CustomerImpressionController {
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody @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")); customerImpressionQuery.setClient_id(app.getInteger("client_id"));
return customerImpression.listPageble(customerImpressionQuery); return customerImpression.listPageble(customerImpressionQuery);
} }
@ -32,13 +32,13 @@ public class CustomerImpressionController {
@RequestMapping(value = "/{customer_id}", method = RequestMethod.GET) @RequestMapping(value = "/{customer_id}", method = RequestMethod.GET)
@ResponseBody @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); return customerImpression.findOne(app.getIntValue("client_id"),customer_id);
} }
@RequestMapping(value = "/{customer_id}", method = RequestMethod.PUT) @RequestMapping(value = "/{customer_id}", method = RequestMethod.PUT)
@ResponseBody @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")); customerImpression.modifyNameRemark(app.getIntValue("client_id"),customer_id,customerInfo.getString("name_remark"));
} }
} }

Loading…
Cancel
Save