zxl
2025-06-11 05e49980cd556d24239e00d028dc5efa25e0de14
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
package cn.lili.modules.system.entity.dto.payment;
 
import cn.lili.common.enums.ClientTypeEnum;
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportForm;
import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportItem;
import lombok.Data;
import lombok.experimental.Accessors;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 支持的支付方式
 *
 * @author Chopper
 * @since 2021-01-26 15:52
 */
@Data
@Accessors(chain = true)
public class PaymentSupportSetting {
 
    private List<PaymentSupportItem> paymentSupportItems;
 
 
    public PaymentSupportSetting() {
 
    }
 
    public PaymentSupportSetting(PaymentSupportForm paymentSupportForm) {
 
        List<PaymentSupportItem> paymentSupportItems = new ArrayList<>();
 
        for (ClientTypeEnum client : paymentSupportForm.getClients()) {
            PaymentSupportItem paymentSupportItem = new PaymentSupportItem();
 
            List<String> supports = new ArrayList<>();
            for (PaymentMethodEnum payment : paymentSupportForm.getPayments()) {
                supports.add(payment.name());
            }
            paymentSupportItem.setClient(client.name());
            paymentSupportItem.setSupports(supports);
            paymentSupportItems.add(paymentSupportItem);
 
        }
        this.paymentSupportItems = paymentSupportItems;
    }
}