From 3738ebb1c4bb4d23062bf55033040a691307ffb9 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Mon, 8 Jan 2018 13:58:56 +0800 Subject: [PATCH] customer impression --- ...on.java => CustomerImpressionService.java} | 2 +- ...ava => CustomerImpressionServiceImpl.java} | 6 ++--- .../web/CustomerImpressionController.java | 24 ++++++++++------- .../manage/mappers/payment/OrderMapper.xml | 2 +- .../CustomerImpressionServiceImplTest.java | 27 +++++++++++++++++++ 5 files changed, 47 insertions(+), 14 deletions(-) rename src/main/java/au/com/royalpay/payment/manage/apps/core/{CustomerImpression.java => CustomerImpressionService.java} (91%) rename src/main/java/au/com/royalpay/payment/manage/apps/core/impls/{CustomerImpressionImpl.java => CustomerImpressionServiceImpl.java} (98%) create mode 100644 src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/core/CustomerImpression.java b/src/main/java/au/com/royalpay/payment/manage/apps/core/CustomerImpressionService.java similarity index 91% rename from src/main/java/au/com/royalpay/payment/manage/apps/core/CustomerImpression.java rename to src/main/java/au/com/royalpay/payment/manage/apps/core/CustomerImpressionService.java index f4e21636f..2f15ef700 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/core/CustomerImpression.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/core/CustomerImpressionService.java @@ -7,7 +7,7 @@ import com.alibaba.fastjson.JSONObject; /** * Created by wangning on 2017/12/28. */ -public interface CustomerImpression { +public interface CustomerImpressionService { JSONObject listPageble(CustomerImpressionQuery customerImpressionQuery); 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/CustomerImpressionServiceImpl.java similarity index 98% rename from src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImpl.java rename to src/main/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImpl.java index fce4fd986..6bcb524a6 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/CustomerImpressionServiceImpl.java @@ -21,7 +21,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.maxmind.geoip.LookupService; 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.CustomerImpressionService; import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.tools.exceptions.BadRequestException; @@ -32,7 +32,7 @@ import au.com.royalpay.payment.tools.utils.PageListUtils; * Created by wangning on 2017/12/28. */ @Service -public class CustomerImpressionImpl implements CustomerImpression { +public class CustomerImpressionServiceImpl implements CustomerImpressionService { @Resource private ClientCustomersMapper clientCustomersMapper; @Resource @@ -90,7 +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); + params.put("include_success_status",3); PageList 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")); 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 acc9b2ed7..d19dbe8b6 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,7 +1,7 @@ package au.com.royalpay.payment.manage.apps.web; 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.CustomerImpressionService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.device.advise.AppClientController; @@ -20,25 +20,31 @@ import javax.annotation.Resource; @RequestMapping(value = "/customers/impression") public class CustomerImpressionController { @Resource - private CustomerImpression customerImpression; + private CustomerImpressionService customerImpressionService; @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody - public JSONObject list(CustomerImpressionQuery customerImpressionQuery,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { + public JSONObject list(CustomerImpressionQuery customerImpressionQuery, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { customerImpressionQuery.setClient_id(app.getInteger("client_id")); - return customerImpression.listPageble(customerImpressionQuery); + return customerImpressionService.listPageble(customerImpressionQuery); } - @RequestMapping(value = "/{customer_id}", method = RequestMethod.GET) @ResponseBody - public JSONObject find(@PathVariable String customer_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { - return customerImpression.findOne(app.getIntValue("client_id"),customer_id); + public JSONObject find(@PathVariable String customer_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { + return customerImpressionService.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.RETAIL_DEVICE) JSONObject app) { - customerImpression.modifyNameRemark(app.getIntValue("client_id"),customer_id,customerInfo.getString("name_remark")); + public void modifyNameRemark(@PathVariable String customer_id, @RequestBody JSONObject customerInfo, + @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { + customerImpressionService.modifyNameRemark(app.getIntValue("client_id"), customer_id, customerInfo.getString("name_remark")); + } + + @RequestMapping(value = "/gengrate", method = RequestMethod.PUT) + @ResponseBody + public void generate(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject app) { + customerImpressionService.generate(app.getIntValue("client_id")); } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index cff0bf23d..d9476cdbf 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -552,7 +552,7 @@ from pmt_orders o left join sys_customer_relation cr on cr.wepay_openid = o.customer_id left join sys_customer_relation_alipay cra on cra.alipay_uid = o.customer_id - where o.customer_id is not null and (o.channel = 'Alipay' or o.channel = 'Wechat') + where o.customer_id is not null and o.channel is not null and client_id = #{client_id} and o.confirm_time > #{confirm_time} diff --git a/src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java b/src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java new file mode 100644 index 000000000..f165f4a3b --- /dev/null +++ b/src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java @@ -0,0 +1,27 @@ +package au.com.royalpay.payment.manage.apps.core.impls; + +import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * Created by wangning on 08/01/2018. + */ +@SpringBootTest +@ActiveProfiles({"local","alipay","wechat","jd","bestpay"}) +@RunWith(SpringRunner.class) +public class CustomerImpressionServiceImplTest { + @Resource + private CustomerImpressionService customerImpressionService; + @Test + public void generate() throws Exception { + customerImpressionService.generate(9); + } + +} \ No newline at end of file