Merge remote-tracking branch 'origin/develop' into develop

master
eason.qian 7 years ago
commit 2519717c54

@ -3,15 +3,22 @@ package au.com.royalpay.payment.manage.analysis.web;
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean; import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
import au.com.royalpay.payment.manage.analysis.core.CustomersAnalysisService; import au.com.royalpay.payment.manage.analysis.core.CustomersAnalysisService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 10/11/2016. * Created by yishuqian on 10/11/2016.
*/ */
@ -82,6 +89,7 @@ public class CustomersAnalysisController {
public JSONObject getCustomerOrders(@PathVariable String customer_id, TradeLogQuery tradeLogQuery, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject getCustomerOrders(@PathVariable String customer_id, TradeLogQuery tradeLogQuery, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = tradeLogQuery.toParams(null); JSONObject params = tradeLogQuery.toParams(null);
params.put("customer_id",customer_id); params.put("customer_id",customer_id);
params.put("status",5);
if (manager.getInteger("org_id") != null) { if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id")); params.put("org_id", manager.getIntValue("org_id"));
} }

@ -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,33 @@ 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);
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"))); 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("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"))); 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("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; return customer;
} }
@ -75,6 +90,7 @@ public class CustomerImpressionImpl implements CustomerImpression {
public void generate(int client_id) { public void generate(int client_id) {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client_id); 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"))); PageList<JSONObject> lastRecord = clientCustomersMapper.listCustomerInfo(params, new PageBounds(1, 1, Order.formString("update_time.desc")));
if (!CollectionUtils.isEmpty(lastRecord)) { if (!CollectionUtils.isEmpty(lastRecord)) {
params.put("confirm_time", lastRecord.get(0).getDate("update_time")); 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("payment_times", order.getIntValue("payment_times"));
client_customer.put("total_amount", order.getBigDecimal("total_amount")); client_customer.put("total_amount", order.getBigDecimal("total_amount"));
client_customer.put("update_time", now); client_customer.put("update_time", now);
client_customer.put("last_payment_time",order.getDate("confirm_time"));
clientCustomersMapper.insert(client_customer); clientCustomersMapper.insert(client_customer);
} else { } else {
clientCustomerInfo.put("payment_times", clientCustomerInfo.getIntValue("payment_times") + order.getIntValue("payment_times")); 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("channel", order.getString("channel"));
clientCustomerInfo.put("tag","不活跃用户"); clientCustomerInfo.put("tag","不活跃用户");
clientCustomerInfo.put("update_time",now); clientCustomerInfo.put("update_time",now);
clientCustomerInfo.put("last_payment_time",order.getDate("confirm_time"));
clientCustomersMapper.update(clientCustomerInfo); clientCustomersMapper.update(clientCustomerInfo);
} }
} }

@ -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"));
} }
} }

@ -3,7 +3,7 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper">
<select id="listCustomerInfo" resultType="com.alibaba.fastjson.JSONObject"> <select id="listCustomerInfo" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
client_id,customer_id,name_remak,headimg,nick_name,tag,payment_times,total_amount,update_time,channel client_id,customer_id,name_remak,headimg,nick_name,tag,payment_times,total_amount,update_time,channel,last_payment_time
FROM sys_clients_customers FROM sys_clients_customers
where where
client_id = #{client_id} client_id = #{client_id}

@ -455,7 +455,13 @@
SELECT o.*,c.short_name,c.client_moniker FROM pmt_orders o SELECT o.*,c.short_name,c.client_moniker FROM pmt_orders o
LEFT JOIN sys_clients c on c.client_id = o.client_id LEFT JOIN sys_clients c on c.client_id = o.client_id
<where> <where>
o.customer_id=#{customer_id} and o.status=5 o.customer_id=#{customer_id}
<if test="status != null">
and o.status=5
</if>
<if test="include_success_status != null">
and o.status>#{include_success_status}
</if>
<if test="from!=null">and ocreate_time &gt;= #{from}</if> <if test="from!=null">and ocreate_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if> <if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="org_id!=null">and c.org_id=#{org_id}</if> <if test="org_id!=null">and c.org_id=#{org_id}</if>
@ -551,6 +557,9 @@
<if test="confirm_time"> <if test="confirm_time">
and o.confirm_time > #{confirm_time} and o.confirm_time > #{confirm_time}
</if> </if>
<if test="include_success_status!=null">
and o.status >#{include_success_status}
</if>
group by o.customer_id group by o.customer_id
</select> </select>
<select id="listPaid" resultType="com.alibaba.fastjson.JSONObject"> <select id="listPaid" resultType="com.alibaba.fastjson.JSONObject">

Loading…
Cancel
Save