master
kira 6 years ago
commit 9c71e15dad

@ -562,7 +562,7 @@
* @apiUse GlobalError * @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 * @apiName SettleLog
* @apiGroup CommonApi * @apiGroup CommonApi
* @apiVersion 1.0.0 * @apiVersion 1.0.0

@ -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.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 com.alibaba.fastjson.JSONObject;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
@ -18,11 +20,32 @@ import javax.annotation.Resource;
public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> { public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> {
@Resource @Resource
private StringRedisTemplate stringRedisTemplate; private StringRedisTemplate stringRedisTemplate;
@Resource
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
@Override @Override
public void onApplicationEvent(AfterPaymentFinishEvent event) { public void onApplicationEvent(AfterPaymentFinishEvent event) {
JSONObject order = event.getFinishedEvent().getOrder(); JSONObject order = event.getFinishedEvent().getOrder();
JSONObject lastOrderInfo = new JSONObject();
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("customer_impression"); BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("customer_impression");
ops.rightPush(order.toJSONString()); 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);
}
} }
} }

@ -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.customers.core.CustomerPaymentInfoService;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper; import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -18,6 +19,8 @@ public class CustomerPaymentInfoImpl implements CustomerPaymentInfoService {
if (sysCustomerPaymentInfoMapper.selectPaymentInfo(paymentInfo.getString("wechat_openid")) != null) { if (sysCustomerPaymentInfoMapper.selectPaymentInfo(paymentInfo.getString("wechat_openid")) != null) {
throw new BadRequestException("openid already exists"); throw new BadRequestException("openid already exists");
} }
paymentInfo.put("id", IdUtil.getId());
sysCustomerPaymentInfoMapper.save(paymentInfo); sysCustomerPaymentInfoMapper.save(paymentInfo);
} }

Loading…
Cancel
Save