parent
5251d2fde3
commit
d1be4005f8
@ -0,0 +1,41 @@
|
|||||||
|
package au.com.royalpay.payment.manage.apps.events.listeners.ctrip;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent;
|
||||||
|
import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by wangning on 17/01/2018.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> {
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
@Resource
|
||||||
|
private CouponValidateService couponValidateService;
|
||||||
|
@Resource
|
||||||
|
private CouponAccuessLogMapper couponAccuessLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(AfterPaymentFinishEvent event) {
|
||||||
|
JSONObject order = event.getFinishedEvent().getOrder();
|
||||||
|
String orderId = order.getString("order_id");
|
||||||
|
List<JSONObject> accuessCouponLogs = couponAccuessLogMapper.findCouponByOrderId(orderId);
|
||||||
|
if (accuessCouponLogs != null&&accuessCouponLogs.size()>0) {
|
||||||
|
JSONObject accuessCouponLog = accuessCouponLogs.get(0);
|
||||||
|
String couponId = accuessCouponLog.getString("coupon_id");
|
||||||
|
couponValidateService.ctripCouponLogNotice(couponId,orderId,order.getString("customer_id"));
|
||||||
|
logger.info("订单 [" + orderId + "]推送支付成功Ctrip卡券=======>[" + couponId + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package au.com.royalpay.payment.manage.apps.events.listeners.ctrip;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.core.events.RefundFinishedEvent;
|
||||||
|
import au.com.royalpay.payment.core.mappers.PmtOrderMapper;
|
||||||
|
import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kira
|
||||||
|
* @date 2018/8/8
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RefundFinishedEventListener implements ApplicationListener<RefundFinishedEvent> {
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
@Resource
|
||||||
|
private PmtOrderMapper orderMapper;
|
||||||
|
@Resource
|
||||||
|
private CouponValidateService couponValidateService;
|
||||||
|
@Resource
|
||||||
|
private CouponAccuessLogMapper couponAccuessLogMapper;
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(RefundFinishedEvent event) {
|
||||||
|
JSONObject refund = event.getRefundOrder();
|
||||||
|
JSONObject order = orderMapper.find(refund.getString("order_id"));
|
||||||
|
String orderId = order.getString("order_id");
|
||||||
|
List<JSONObject> accuessCouponLogs = couponAccuessLogMapper.findCouponByOrderId(orderId);
|
||||||
|
if (accuessCouponLogs != null&&accuessCouponLogs.size()>0) {
|
||||||
|
JSONObject accuessCouponLog = accuessCouponLogs.get(0);
|
||||||
|
String couponId = accuessCouponLog.getString("coupon_id");
|
||||||
|
couponValidateService.ctripCouponLogNotice(couponId,orderId,order.getString("customer_id"));
|
||||||
|
logger.info("订单 [" + orderId + "]推送退款成功Ctrip卡券=======>[" + couponId + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue