xiangpei
2025-05-14 0e63eb88f8b83ec075d1d5cbba9ed84da6c96193
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package cn.lili.modules.payment.serviceimpl;
 
import cn.lili.modules.payment.kit.CashierSupport;
import cn.lili.modules.payment.kit.dto.PaymentSuccessParams;
import cn.lili.modules.payment.kit.params.CashierExecute;
import cn.lili.modules.payment.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * 支付日志 业务实现
 *
 * @author Chopper
 * @since 2020-12-19 09:25
 */
@Slf4j
@Service
public class PaymentServiceImpl implements PaymentService {
 
    @Autowired
    private List<CashierExecute> cashierExecutes;
    @Autowired
    private CashierSupport cashierSupport;
 
    @Override
    public void success(PaymentSuccessParams paymentSuccessParams) {
 
        //支付状态
        boolean paymentResult = cashierSupport.paymentResult(paymentSuccessParams.getPayParam());
 
        //已支付则返回
        if (paymentResult) {
            log.warn("收银台重复收款,流水号:{}", paymentSuccessParams.getReceivableNo());
            return;
        }
 
        log.debug("支付成功,第三方流水:{}", paymentSuccessParams.getReceivableNo());
        //支付结果处理
        for (CashierExecute cashierExecute : cashierExecutes) {
            cashierExecute.paymentSuccess(paymentSuccessParams);
        }
    }
 
    @Override
    public void adminPaySuccess(PaymentSuccessParams paymentSuccessParams) {
 
        log.debug("支付状态修改成功->银行转账");
        //支付结果处理
        for (CashierExecute cashierExecute : cashierExecutes) {
            cashierExecute.paymentSuccess(paymentSuccessParams);
        }
    }
}