package com.ehu.bean;

import com.google.common.base.Joiner;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Alan
 * @date 2018/11/12 14:53
 **/
public interface Product {
    /**
     * 获取下单的产品名称，微信不能超过49个字
     *
     * @param products 产品
     * @return 产品名，逗号隔开
     */
    static String getNames(List<? extends Product> products) {
        String body = "";
        if (products != null && products.size() > 0) {
            body = Joiner.on(",").join(products.stream().map(o -> (o.getName())).collect(Collectors.toList()));

            body = body.replaceAll("\\ ", "");
            if (body.length() > 47) {
                body = body.substring(0, 47) + "等";
            }
        }
        return body;
    }

    String getName();
}

@@ -631,17 +631,17 @@
 th() %3E 4
-7
+6
 ) %7B%0A    
@@ -682,9 +682,9 @@
 0, 4
-7
+6
 ) + 

fix 微信支付body长度49改为46