From 0a1327d926f92e21e46aa5d66457fd8a3e996298 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 28 Aug 2018 17:53:33 +0800 Subject: [PATCH 1/2] add listen customerPaymentInfo --- .../listeners/AfterPaymentFinishListener.java | 23 +++++++++++++++++++ .../core/impls/CustomerPaymentInfoImpl.java | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java b/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java index 30f21ef73..36369dca4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java @@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.apps.events.listeners; import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent; +import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper; +import au.com.royalpay.payment.tools.utils.id.IdUtil; import com.alibaba.fastjson.JSONObject; import org.springframework.context.ApplicationListener; @@ -18,11 +20,32 @@ import javax.annotation.Resource; public class AfterPaymentFinishListener implements ApplicationListener { @Resource private StringRedisTemplate stringRedisTemplate; + @Resource + private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper; @Override public void onApplicationEvent(AfterPaymentFinishEvent event) { JSONObject order = event.getFinishedEvent().getOrder(); + JSONObject lastOrderInfo = new JSONObject(); + BoundListOperations ops = stringRedisTemplate.boundListOps("customer_impression"); ops.rightPush(order.toJSONString()); + + lastOrderInfo.put("wechat_openid", order.getString("customer_id")); + lastOrderInfo.put("idcard_name", order.getString("payer_name")); + lastOrderInfo.put("idcard_no", order.getString("payer_identity_card")); + lastOrderInfo.put("bankcard", order.getString("card_number")); + lastOrderInfo.put("bank", order.getString("bankId")); + + JSONObject orderInfo = sysCustomerPaymentInfoMapper.selectPaymentInfo(order.getString("customer_id")); + + if (orderInfo != null) { + lastOrderInfo.put("id", orderInfo.getString("id")); + sysCustomerPaymentInfoMapper.update(lastOrderInfo); + }else { + lastOrderInfo.put("id", IdUtil.getId()); + sysCustomerPaymentInfoMapper.save(lastOrderInfo); + } + } } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java index 934376c9e..22037a1d6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.customers.core.impls; import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService; import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper; import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.utils.id.IdUtil; import com.alibaba.fastjson.JSONObject; import org.springframework.stereotype.Service; @@ -18,6 +19,8 @@ public class CustomerPaymentInfoImpl implements CustomerPaymentInfoService { if (sysCustomerPaymentInfoMapper.selectPaymentInfo(paymentInfo.getString("wechat_openid")) != null) { throw new BadRequestException("openid already exists"); } + + paymentInfo.put("id", IdUtil.getId()); sysCustomerPaymentInfoMapper.save(paymentInfo); } From 3bf47ef97174e2d965bc798b01e07b952cc0c20f Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 29 Aug 2018 09:18:32 +0800 Subject: [PATCH 2/2] document fix --- src/document/en/apis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/document/en/apis.js b/src/document/en/apis.js index f7e18b05f..a09a8949e 100644 --- a/src/document/en/apis.js +++ b/src/document/en/apis.js @@ -562,7 +562,7 @@ * @apiUse GlobalError */ /** - * @api {GET} /api/v1.0/gateway/partners/{partner_code}/transactions Query Settlement Details + * @api {GET} /api/v1.0/gateway/partners/{partner_code}/settlements Query Settlement Details * @apiName SettleLog * @apiGroup CommonApi * @apiVersion 1.0.0