|
|
@ -1,14 +1,13 @@
|
|
|
|
package au.com.royalpay.payment.manage.apps.events.listeners;
|
|
|
|
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.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.utils.id.IdUtil;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.context.ApplicationListener;
|
|
|
|
import org.springframework.context.ApplicationListener;
|
|
|
|
import org.springframework.data.redis.core.BoundListOperations;
|
|
|
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
@ -18,33 +17,36 @@ import javax.annotation.Resource;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> {
|
|
|
|
public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> {
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
|
|
|
|
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CustomerPaymentInfoService customerPaymentInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@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();
|
|
|
|
if(!"hf".equals(order.getString("channel"))){
|
|
|
|
|
|
|
|
return;
|
|
|
|
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("customer_impression");
|
|
|
|
}
|
|
|
|
ops.rightPush(order.toJSONString());
|
|
|
|
if(StringUtils.isEmpty(order.getString("ext_params"))){
|
|
|
|
|
|
|
|
return;
|
|
|
|
lastOrderInfo.put("wechat_openid", order.getString("customer_id"));
|
|
|
|
}
|
|
|
|
lastOrderInfo.put("idcard_name", order.getString("payer_name"));
|
|
|
|
JSONObject extParam = JSONObject.parseObject(order.getString("ext_params"));
|
|
|
|
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"));
|
|
|
|
JSONObject orderInfo = sysCustomerPaymentInfoMapper.selectPaymentInfo(order.getString("customer_id"));
|
|
|
|
|
|
|
|
|
|
|
|
if (orderInfo != null) {
|
|
|
|
if (orderInfo != null) {
|
|
|
|
lastOrderInfo.put("id", orderInfo.getString("id"));
|
|
|
|
orderInfo.put("idcard_name", extParam.getString("payer_name"));
|
|
|
|
sysCustomerPaymentInfoMapper.update(lastOrderInfo);
|
|
|
|
orderInfo.put("idcard_no", extParam.getString("payer_identity_card"));
|
|
|
|
|
|
|
|
orderInfo.put("bankcard", extParam.getString("card_number"));
|
|
|
|
|
|
|
|
orderInfo.put("bank", extParam.getString("bankId"));
|
|
|
|
|
|
|
|
sysCustomerPaymentInfoMapper.update(orderInfo);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
lastOrderInfo.put("id", IdUtil.getId());
|
|
|
|
JSONObject lastOrderInfo = new JSONObject();
|
|
|
|
sysCustomerPaymentInfoMapper.save(lastOrderInfo);
|
|
|
|
lastOrderInfo.put("wechat_openid", extParam.getString("customer_id"));
|
|
|
|
|
|
|
|
lastOrderInfo.put("idcard_name", extParam.getString("payer_name"));
|
|
|
|
|
|
|
|
lastOrderInfo.put("idcard_no", extParam.getString("payer_identity_card"));
|
|
|
|
|
|
|
|
lastOrderInfo.put("bankcard", extParam.getString("card_number"));
|
|
|
|
|
|
|
|
lastOrderInfo.put("bank", extParam.getString("bankId"));
|
|
|
|
|
|
|
|
customerPaymentInfoService.save(lastOrderInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|