|
|
|
@ -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<AfterPaymentFinishEvent> {
|
|
|
|
|
@Resource
|
|
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
@Resource
|
|
|
|
|
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onApplicationEvent(AfterPaymentFinishEvent event) {
|
|
|
|
|
JSONObject order = event.getFinishedEvent().getOrder();
|
|
|
|
|
JSONObject lastOrderInfo = new JSONObject();
|
|
|
|
|
|
|
|
|
|
BoundListOperations<String, String> 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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|