package lingtao.net.service;

import lingtao.net.bean.Msg;
import lingtao.net.bean.Product;
import lingtao.net.bean.SysDictSearchPro;
import lingtao.net.bean.SysUser;
import lingtao.net.dao.ProductMapper;
import lingtao.net.dao.QuoteLogMapper;
import lingtao.net.util.*;
import lingtao.net.vo.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Pattern;

@Service
public class ProductService {

    @Autowired
    ProductMapper productMapper;

    @Autowired
    QuoteLogMapper quoteLogMapper;

    // 保留俩位小数
    DecimalFormat df = new DecimalFormat("0.00");

    public List<Product> findAllPro() {
        return productMapper.findAllPro();
    }

    // 价格列表
    public List<Product> getProductList(Product product) {
        return productMapper.getProductList(product);
    }

    public Msg updatePriceById(int proId, String field, String value) {
        SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
        String role = user.getRole();
        boolean flag = false;
        if (role.contains(",")) {
            String[] split = role.split(",");
            for (int i = 0; i < split.length; i++) {
                // [管理员/产品经理]身份才允许修改价格
                if ("2".equals(split[i]) || "3".equals(split[i])) {
                    flag = true;
                    break;
                }
            }
        } else {
            if ("2".equals(role) || "3".equals(role)) {
                flag = true;
            }
        }
        if (!flag) {
            return Msg.fail();
        }

        Product product = new Product();

        if (!StringUtils.isEmpty(value)) {
            product.setProId(proId);
            product.setUpdater(user.getRealname());
            if ("count".equals(field)) {
                product.setCount(Integer.valueOf(value));
            } else if ("price".equals(field)) {
                product.setPrice(Double.valueOf(value));
            } else if ("priceMultiple".equals(field)) {
                product.setPriceMultiple(Double.valueOf(value));
            } else if ("weight".equals(field)) {
                product.setWeight(value);
            }
            try {
                productMapper.updatePriceById(product);
                return Msg.success();
            } catch (Exception e) {
                return Msg.fail();
            }
        }
        return Msg.fail();
    }

    // 根据产品种类获取材质
    public List<Product> getKindsByPro(String proTypeValue) {
        return productMapper.getKindsByPro(proTypeValue);
    }

    // 搜索产品
    public List<SysDictSearchPro> searchPro(String likeProTypeLabel) {
        return productMapper.searchPro(likeProTypeLabel);
    }

    // 获取名片位数
    public static int getNum(double length, double width) {
        double l1 = Math.ceil(length / 9);
        double w1 = Math.ceil(width / 5.4);
        double l2 = Math.ceil(width / 9);
        double w2 = Math.ceil(length / 5.4);
        int min = (int) Math.min(l1 * w1, l2 * w2);

        return min;
    }

    private static double getNumber(double divisor, double dividend) {
        double number = divisor / dividend;
        double integer = Math.floor(divisor / dividend);
        double decimals = number - integer;
        if (decimals > 0.1) {
            return integer + 1;
        }
        return integer;
    }

    public static int getNumAdd(double length, double width) {
        double l1 = getNumber(length, 9);

        double w1 = getNumber(width, 5.4);
        double l2 = getNumber(width, 9);
        double w2 = getNumber(length, 5.4);
        int min = (int) Math.min(Math.ceil(l1) * Math.ceil(w1), Math.ceil(l2) * Math.ceil(w2));

        return min;
    }

    public List<Product> getHekaPrice(int min, Product dto, List<Product> priceList, int count) {
        if (min < 5) {
            dto.setKindValue(String.valueOf(min));
            if (count <= 10000) {
                priceList = productMapper.getThanPrice(dto);
            } else {
                priceList = productMapper.thanThousandPrice(dto);
            }
            // 腰封/吊旗标识，比优惠券贵10元
            if (!StringUtils.isEmpty(dto.getD())) {
                for (Product product : priceList) {
                    product.setPrice(product.getPrice() + 10);
                }
            }
        } else {
            if (min > 5 && min < 10) {
                dto.setKindValue("6");
            } else if (min > 10 && min <= 20) {
                dto.setKindValue("11");
            } else if (min > 20 && min <= 30) {
                dto.setKindValue("21");
            } else if (min > 30 && min <= 40) {
                dto.setKindValue("31");
            } else if (min > 40 && min <= 50) {
                dto.setKindValue("41");
            } else if (min > 50) {
                dto.setKindValue("51");
            } else {
                // 5、10位
                dto.setKindValue(String.valueOf(min));
            }
            // 设置位数
            dto.setNum(min);
            // 腰封/吊旗标识，比优惠券贵10元/位
            if (!StringUtils.isEmpty(dto.getD())) {
                if (min <= 20) {
                    dto.setP(30);
                } else {
                    dto.setP(25);
                }
                if (count <= 10000)
                    priceList = productMapper.hangingFlagsThanPrice(dto);
                else
                    priceList = productMapper.hangingFlagsThousandThanPrice(dto);
            } else {
                /*
                 * if (min >= 6 && min <= 9) { dto.setP(30); priceList = productMapper.couponThanPrices(dto); }else
                 */
                if (count <= 10000) {
                    priceList = productMapper.couponThanPrice(dto);
                } else {
                    priceList = productMapper.couponThousandThanPrice(dto);
                }

            }
        }

        if (priceList.size() >= 4) {
            priceList = priceList.subList(0, 4);
        }
        // 名片优惠券报价 2个位以上的每个位各涨5元
        if (min > 1) {
            for (Product product : priceList) {
                product.setPrice(product.getPrice() + min * 5);
            }
        }
        // 产品价格倍数
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
        }

        return priceList;
    }

    private void f_getEathPrice(List<Product> priceList, double len, double wid, String toothpick_size) {
        for (Product product : priceList) {
            int numbers = product.getCount();
            if ((wid <= 5.4 && len <= 5.4) && ((len >= 5 && len < 4.5) || (wid >= 5 && wid < 4.5))) {
                if (numbers == 500 || numbers == 1000) {
                    product.setPrice(product.getPrice() + 10);
                } else if (numbers >= 2000) {
                    product.setPrice(product.getPrice() + 20);
                }
            }  /*
             * else if(length == 5 && width == 5) { if(numbers >= 2000 && numbers < 10000) { product.setPrice(product.getPrice() + 15); }else if(numbers >= 10000) { product.setPrice(product.getPrice() + 40); } }
             */ else if ((len > 9 || wid > 5.4) && (len > 5.4 || wid > 9)) {
                if (numbers == 500) {
                    product.setPrice(product.getPrice() + 5);
                } else if (numbers == 1000) {
                    product.setPrice(product.getPrice() + 10);
                } else if (numbers >= 2000) {
                    product.setPrice(product.getPrice() + 20);
                }
            }
        }
    }

    @SuppressWarnings({"static-access"})
    public List<Product> getThanPrice(Product dto, String role) {
        String proType = dto.getProTypeValue();
        String kind = dto.getKindValue();
        String kind2 = dto.getKind2Value();
        String kind3 = dto.getKind3Value();

        // 款数
        Integer number = dto.getNumber();
        String size = dto.getSize();
        Double width = dto.getWidth();
        Double length = dto.getLength();
        Double height = null;
        Double area = null;
        String oldKind = "";
        double wei = 0;
        /*
         * if(proType.equals("帆布")){ String sizeList[] = size.split(","); size = sizeList[1]; }else
         */
        if ("17".equals(proType)) {
            if (!StringUtils.isEmpty(size)) {
                String sizeList[] = size.split(",");
                size = sizeList[0];
            }
        } else if (("手拉旗".equals(dto.getProTypeValue()) && "常规".equals(dto.getStickerKind()))) {
            size += "*" + dto.getWidth();
        }
        int count = dto.getCount();
        count = Math.abs(count);
        if (!StringUtils.isEmpty(size)) {
            // 海报下的刻字，只有一个尺寸
            if ("17".equals(proType)) {
                if ("5".equals(kind)) {
                    size = size + "*0";
                } else if ("6".equals(kind)) {
                    size = size + "*" + dto.getWidth();
                    dto.setSize(size);
                }
            }
            length = Double.valueOf(size.substring(0, size.indexOf("*")));
            String other_size = size;
            if (size.contains(",")) {
                size = size.split(",")[0];
            }
            if (size.indexOf(("*"), size.indexOf("*") + 1) == -1) {
                width = Double.valueOf(size.substring(size.indexOf("*") + 1));
            } else {
                width = Double.valueOf(size.substring(size.indexOf("*") + 1, size.indexOf(("*"), size.indexOf("*") + 1)));
                height = Double.valueOf(size.substring(size.indexOf(("*"), size.indexOf("*") + 1) + 1));
                height = Math.abs(height);
            }
            length = Math.abs(length);
            width = Math.abs(width);
            size = other_size;
        }
        if ("杯垫".equals(proType) && "13".equals(dto.getKindValue())) {
            proType = "香薰卡";
        }
        // 返回的价格集合
        List<Product> priceList = new ArrayList<Product>();
        switch (proType) {
            // 不干胶/特殊不干胶
            case "0":
                // 书写纸不干胶和牛皮纸价格一致
                if ("7".equals(kind)) {
                    dto.setKindValue("3");
                    kind = "3";
                }
                // 铜版纸不干胶
                /*
                 * if ("0".equals(kind)) { if ("覆哑膜".equals(dto.getCraftMo()) && new AStickersPrice().f_getRole(dto.getRole()) != 1) { // 哑膜铜版纸不干胶 dto.setKindValue("0"); kind = "4"; } } else if ("1".equals(kind) || "2".equals(kind)) { // PVC/透明哑膜不干胶 if ("覆哑膜".equals(dto.getCraftMo())) { dto.setKindValue("PVC覆哑膜"); kind = "1"; } }else
                 */
                if ("PP合成纸".equals(kind)) {
                    // PP合成纸的价格是牛皮纸价格*0.8
                    oldKind = "PP合成纸";
                    dto.setKindValue("3");
                    kind = "3";
                } else if ("封口贴铜版纸不干胶".equals(kind)) {
                    priceList = new PriceUtils().getFktPrice(number, priceList);
                    return chucklePrice(role, priceList, dto);
                } else if ("双面印刷不干胶".equals(dto.getStickerKind())) {
                    priceList = StickersDoublePrice.getPrice(length, width, count, number);
                    return chucklePrice(role, priceList, dto);
                } else if ("插旗".equals(dto.getStickerKind())) {
                    if ("铜版纸不干胶".equals(kind)) {
                        dto.setKindValue("0");
                        dto.setLength(length);
                        dto.setWidth(width);
                        area = length * width / 10000;
                        if (length > 20 && length < 21) {
                            length = Math.ceil(length);
                            area = length * width / 10000;
                        }
                        if (width > 20 && width < 21) {
                            width = Math.ceil(width);
                            area = length * width / 10000;
                        }
                        if ("常规".equals(dto.getKind2Value())) {
                            priceList = normalSticker(dto, "0", number, area, width, length, count, oldKind, priceList);
                        }
                        if ("数码".equals(dto.getKind2Value())) {
                            priceList = lessSticker(dto, "0", number, width, length, count, priceList, role);
                        }

                        if (priceList.size() >= 3) {
                            priceList = priceList.subList(0, 3);
                        }
                    } else if ("PVC不干胶".equals(kind)) {
                        if (length > 20 && length < 21) {
                            length = Math.ceil(length);
                            area = length * width / 10000;
                        }
                        if (width > 20 && width < 21) {
                            width = Math.ceil(width);
                            area = length * width / 10000;
                        }
                        if ("常规".equals(dto.getKind2Value())) {
                            priceList = normalSticker(dto, "1", number, area, width, length, count, oldKind, priceList);
                        }
                        if ("数码".equals(dto.getKind2Value())) {
                            priceList = lessSticker(dto, "1", number, width, length, count, priceList, role);
                        }
                        if (priceList.size() >= 3) {
                            priceList = priceList.subList(0, 3);
                        }
                    } else {
                        area = length * width;
                        int[] count_list = {500, 1000, 2000, 3000, 5000, 10000, 20000};
                        int[][] prices = {
                                {172, 209, 209, 209, 209, 209, 209, 209, 313, 365, 382, 400, 435},
                                {192, 209, 209, 209, 209, 209, 261, 278, 400, 504, 522, 556, 609},
                                {382, 418, 418, 418, 418, 418, 418, 418, 678, 800, 835, 922, 1009},
                                {470, 504, 504, 539, 556, 556, 591, 626, 887, 1078, 1130, 1252, 1373},
                                {556, 591, 591, 696, 747, 922, 973, 1078, 1443, 1721, 1843, 2017, 2208},
                                {783, 817, 817, 1009, 1199, 1495, 1582, 1947, 2625, 3199, 3477, 3703, 4085},
                                {1217, 1287, 1287, 1599, 1982, 2486, 2921, 3651, 5007, 6119, 6259, 7197, 7910},
                        };
                        double[] areas = {1, 4, 6, 9, 12, 16, 20, 25, 36, 45, 48.6, 54, 60};
                        for (int j = 0; j < count_list.length; j++) {
                            if (priceList.size() > 2) {
                                break;
                            }
                            int item_count = count_list[j];
                            if (count > item_count) {
                                continue;
                            }
                            int count_index = Arrays.binarySearch(count_list, item_count);

                            if (count_index >= 0) {
                                Product pro = new Product();
                                double price = new PriceUtils().TablePrice(area, prices[count_index], areas);

                                if ("6.5".equals(dto.getToothpick_size())) {
                                    price = price + (item_count * 0.1);
                                }
                                if ("10".equals(dto.getToothpick_size())) {
                                    price = price + (item_count * 0.1);
                                }
                                if ("12".equals(dto.getToothpick_size())) {
                                    price = price + (item_count * 0.14);
                                }
                                pro.setCount(item_count);
                                pro.setPrice(Math.ceil(price * number));
                                priceList.add(pro);
                            }
                        }

                        return chucklePrice(role, priceList, dto);
                    }
//				return priceList;

                } else if ("8".equals(kind) || "10".equals(kind) || "11".equals(kind) || "12".equals(kind)) {
                    priceList = new PriceUtils().getMeiWenZhiPrice(length, width, count, number, dto.getCraftQie());
                    if (number > 1) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() * number));
                        }
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("13".equals(kind)) {
                    oldKind = "13";
                    dto.setKindValue("2");
                    kind = "2";
                } else if ("17".equals(kind) || "18".equals(kind)) {
                    // 单个产品的面积
                    area = (length + 0.3) * (width + 0.3) / 10000;
                    if ("17".equals(kind)) {
                        kind = "6";
                    }
                    if ("18".equals(kind)) {
                        kind = "7";
                    }
                    priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000), dto);
                    // 根据款数重新算价格/计算重量
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * number));
                        product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.25));
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("15".equals(kind) || "16".equals(kind)) {
                    List<String> craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();

                    if ("15".equals(kind) && dto.getCraftTang().contains("彩色印刷+烫金")) {
                        double[][] prices = new double[][]{
                                {403, 503, 503, 503, 543, 582, 582, 582, 620, 620, 660, 698, 775, 775, 852.5, 853, 853},
                                {520, 520, 520, 520, 560, 600, 600, 600, 640, 640, 680, 720, 800, 800, 880, 880, 880},
                                {600, 600, 600, 600, 637.5, 675, 675, 675, 750, 750, 825, 862.5, 975, 975, 1050, 1050, 1125},
                                {625, 625, 625, 625, 662.5, 700, 700, 700, 775, 775, 850, 887.5, 1000, 1000, 1075, 1075, 1150},
                                {652, 652, 652, 652, 725, 762, 762, 762, 870, 870, 942, 978, 1051, 1051, 1087, 1087, 1196},
                                {798, 798, 798, 798, 943, 1015, 1015, 1015, 1087, 1087, 1196, 1196, 1341, 1341, 1450, 1450, 1631},
                                {910, 910, 910, 910, 1120, 1155, 1225, 1225, 1400, 1470, 1575, 1575, 1680, 1680, 1855, 1925, 2100},
                        };
                        int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000};
                        double[] areas = new double[]{9, 12.25, 16, 20.25, 25, 30.25, 36, 42.25, 49, 56.25, 64, 72.25, 81, 90.25, 100, 110.25, 121};
                        area = (length + 0.4) * (width + 0.4);//加上4毫出血
                        priceList = getAreaNextPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() * 0.8));
                            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
                        }
                    } else {
                        priceList = new SwzStickersPrice().getPrice(count, length, width, number, dto.getCraftTang());
                        for (Product product : priceList) {
                            double rate = 1;
                            if (craft_list.contains("有色激凸")) {
                                rate = 1.8;
                            }
                            product.setPrice(Math.ceil(product.getPrice() * number * rate));
                        }
                    }

                    return chucklePrice(role, priceList, dto);
                }
                // 查询出来的价格集合
                List<Product> stickersList = new ArrayList<Product>();

                // 单个产品的面积
                area = length * width / 10000;

                // 选择少数量/打印不干胶按钮
                if ("少数量".contentEquals(dto.getStickerKind()) || "专版打印".contentEquals(dto.getStickerKind())) {
                    stickersList = lessSticker(dto, kind, number, width, length, count, stickersList, role);

                    if (stickersList.get(0) == null) {
                        return null;
                    }
                } else {
                    if (length > 20 && length < 21) {
                        length = Math.ceil(length);
                        area = length * width / 10000;
                    }
                    if (width > 20 && width < 21) {
                        width = Math.ceil(width);
                        area = length * width / 10000;
                    }
                    stickersList = normalSticker(dto, kind, number, area, width, length, count, oldKind, stickersList);
                    if (stickersList == null) {
                        return chucklePrice(role, stickersList, dto);
                    }
                }
                // 把查出来的集合添加到priceList中
                for (int i = 0; i < stickersList.size(); i++) {
                    priceList.add(stickersList.get(i));
                }
                // 计算重量
                for (Product product : priceList) {
                    // PVC跟静电膜的×0.3，牛皮纸不干胶 *0.22，其他0.24
                    if ("1".equals(kind) || "静电贴".equals(kind)) {
                        product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
                    } else {
                        product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.24));
                    }
                }

                if ("覆哑膜".equals(dto.getCraftMo()) && !"1".equals(kind) && !("插旗".equals(dto.getStickerKind()) && ("铜版纸不干胶".equals(kind) || "PVC不干胶".equals(kind)))) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.2));
                    }
                }


                if (priceList.size() >= 3) {
                    priceList = priceList.subList(0, 3);
                }

                if ("13".equals(oldKind)) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.2));
                    }
                }
                if ("0".equals(kind) || "插旗".equals(dto.getStickerKind())) {
                    f_getEathPrice(priceList, length, width, dto.getToothpick_size());
                    if ("插旗".equals(dto.getStickerKind())) {
                        for (Product product : priceList) {
                            double basePrice = 0;
                            if ("粘牙签".equals(dto.getCraftShua())) {
                                if ("常规".equals(dto.getKind2Value())) {
                                    if (product.getCount() <= 500) {
                                        basePrice = 0.108;
                                    } else if (product.getCount() <= 1000) {
                                        basePrice = 0.127;
                                    } else if (product.getCount() <= 2000) {
                                        basePrice = 0.118;
                                    } else if (product.getCount() <= 3000) {
                                        basePrice = 0.114;
                                    } else if (product.getCount() <= 5000) {
                                        basePrice = 0.106;
                                    } else {
                                        basePrice = 0.086;
                                    }
                                }
                                if ("数码".equals(dto.getKind2Value())) {
                                    basePrice = 0.5;
                                }
                            }

                            if ("配牙签".equals(dto.getCraftShua())) {
                                if (product.getCount() <= 500) {
                                    basePrice = 0.032;
                                } else if (product.getCount() <= 1000) {
                                    basePrice = 0.023;
                                } else if (product.getCount() <= 2000) {
                                    basePrice = 0.0185;
                                } else if (product.getCount() <= 3000) {
                                    basePrice = 0.014;
                                } else if (product.getCount() <= 5000) {
                                    basePrice = 0.01;
                                } else {
                                    basePrice = 0.0068;
                                }
                            }
                            if ("10".equals(dto.getToothpick_size())) {
                                basePrice = basePrice + 0.01;
                            }
                            if ("12".equals(dto.getToothpick_size())) {
                                basePrice = basePrice + 0.02;
                            }
                            if ("常规".equals(dto.getKind2Value()) && "0".equals(dto.getKindValue())) {
                                product.setPrice(product.getPrice() + Math.max(Math.ceil(product.getCount() * basePrice), 5));
                            } else {
                                product.setPrice(product.getPrice() + Math.max(Math.ceil(product.getCount() * basePrice), 5) * number);
                            }
                            if ("配牙签".equals(dto.getCraftShua()) && "6.5".equals(dto.getToothpick_size()) && ((width == 9 && length == 2.5) || length == 9 && width == 2.5)) {
                                if (product.getCount() == 500) {
                                    double other_price = 60;
                                    product.setPrice(other_price);
                                }
                                if (product.getCount() == 1000) {
                                    double other_price = 80;
                                    product.setPrice(other_price);
                                }
                            }
                        }
                        if ("覆哑膜".equals(dto.getCraftMo()) && !"1".equals(kind) && "铜版纸不干胶".equals(kind)) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.3));
                            }
                        }
                    }

                    if (!StringUtils.isEmpty(dto.getCraft())) {
                        String craftList[] = dto.getCraft();

                        if ("配刮刮膜".equals(craftList[0])) {
                            for (Product product : priceList) {
                                double gPrice = product.getCount() * 0.04 > 20 ? product.getCount() * 0.04 : 20;
                                product.setPrice(Math.ceil(product.getPrice() + gPrice));
                            }
                        } else if ("粘刮刮膜".equals(craftList[0])) {
                            for (Product product : priceList) {
                                double gPrice = product.getCount() * 0.1 > 40 ? product.getCount() * 0.1 : 40;
                                product.setPrice(Math.ceil(product.getPrice() + gPrice));
                            }
                        }
                    }
                }
                if ("插旗".equals(dto.getStickerKind()) && "常规".equals(dto.getKind2Value())) {
                    if (number > 1 && "0".equals(dto.getKindValue())) {
                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() * number);
                        }
                    }
                }

                if ("0".equals(dto.getKindValue()) && !"专版打印".contentEquals(dto.getStickerKind())) {
                    if (number > 1) {
                        for (Product product : stickersList) {
                            product.setPrice(product.getPrice() * number);
                        }
                    }
                }

                double huaxianPrice = 0.0;
                if (("0".equals(dto.getKindValue()) || "1".equals(dto.getKindValue())) && "划线".equals(dto.getCraftQieType())) {
                    //宽度大于50  长度185-500
                    for (Product product : stickersList) {
                        if ("0".equals(dto.getKindValue())) {
                            if (!((width >= 5 && length >= 18.5 && length <= 500) || (length >= 5 && width >= 18.5 && width <= 500))) {
                                huaxianPrice = Math.max(0.1 * product.getCount() * number, 50);
                            }
                        } else {
                            huaxianPrice = Math.max(0.12 * product.getCount() * number, 50);
                        }
                        product.setPrice(Math.ceil(product.getPrice() + huaxianPrice));
                    }
                }

                return chucklePrice(role, priceList, dto);
            case "1":
                dto.setWidth(width);
                dto.setLength(length);
                priceList = productMapper.getThanPrice(dto);
                return chucklePrice(role, priceList, dto);
            // 卷装标签
            case "2":
                // 单个产品的面积
                area = (length + 0.3) * (width + 0.3) / 10000;
                priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000), dto);
                // 根据款数重新算价格/计算重量
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                    product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.25));
                }
                return chucklePrice(role, priceList, dto);
            // 插卡
            case "3":
                // 菱形单面直角插牌
                if ("1".equals(dto.getKindValue())) {
                    priceList = new PriceUtils().getInsertCard(size, count);
                } else {
                    if ("9".equals(dto.getKindValue()) || "10".equals(dto.getKindValue()) || "14".equals(dto.getKindValue()) || "15".equals(dto.getKindValue())) {
                        dto.setKindValue("4");
                    } else if ("11".equals(dto.getKindValue())) {
                        dto.setKindValue("8");
                    }
                    priceList = productMapper.getThanPrice(dto);
                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    }
                }

                if (!StringUtils.isEmpty(dto.getSize1())) {
                    String size1 = dto.getSize1();
                    Double length1 = null;
                    Double width1 = null;

                    List<Product> priceList2 = new ArrayList<Product>();
                    length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
                    if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
                        width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
                    } else {
                        width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
                    }
                    length1 = Math.abs(length1);
                    width1 = Math.abs(width1);
                    if (((length1 <= 9 && width1 <= 5.4) || (length1 <= 5.4 && width1 <= 9))) {
                        for (Product product : priceList) {
                            product.setPrice(Math.floor(product.getPrice() * 2));
                        }
                    } else {
                        return null;
                    }
                }

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                List<String> crafts_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
                if ("0".equals(kind) && (crafts_list.contains("击凸") || crafts_list.contains("压凹"))) {
                    priceList = new ArrayList<>();
                    Product product = new Product();
                    int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000};
                    double[] base_price = {180, 200, 220, 400, 550, 880, 1580, 2844, 4266};
                    int num = getNum(length, width);
                    for (int i = 0; i < counts.length; i++) {
                        product = new Product();
                        if (counts[i] < dto.getCount()) {
                            continue;
                        }
                        if (priceList.size() > 3) {
                            break;
                        }
                        product.setPrice(Math.ceil(base_price[i] * num * 0.9 * number));
                        product.setCount(counts[i]);
                        product.setWeight(df.format(number * length * width * product.getCount() * 0.00003));
                        priceList.add(product);

                    }
                    return chucklePrice(role, priceList, dto);
                }
                // 根据款数重新算价格/计算重量
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                    if (crafts_list.contains("弹力绳")) {
                        product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
                    }
                    if (crafts_list.contains("弹力绳捆")) {
                        product.setPrice(Math.floor(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10));
                    }
                    product.setWeight(df.format(number * length * width * product.getCount() * 0.00003));
                }
                return chucklePrice(role, priceList, dto);
            // 优惠券
            case "4":
                if ("11".equals(dto.getKind())) {// 圣诞卡
                    priceList = new PriceUtils().getSdkPrice(count, number);
                } else if ("9".equals(dto.getKind())) {// 售后卡
                    priceList = new PriceUtils().getShkPrice(size, count, number);
                } else if ("10".equals(dto.getKind())) {// 吸管套
                    int min = getNum(length, width);
//                    if (min > 1) {
                    String[] xgtCraft = {"模切"};
                    dto.setCraft(xgtCraft);
                    priceList = getHekaPrice(min, dto, priceList, count);
                    getCraft(dto, priceList, length * 10, width * 10, min);
                    /*} else {
                        if ("6.5*5.4".equals(dto.getSize())) {
                            dto.setKindValue("0");
                            dto.setKind1Value("0");
                            dto.setProTypeValue("4");
                            priceList = productMapper.getThanPrice(dto);
                        } else {
                            dto.setKindValue("0");
                            dto.setProTypeValue("3");
                            priceList = productMapper.getThanPrice(dto);
                            for (Product product : priceList) {
                                if (product.getCount() == 200) {
                                    product.setPrice(60.0);
                                }
                            }
                        }
                    }*/
                    /*
                     * if (priceList.size() >= 4) { priceList = priceList.subList(0, 4); }
                     */
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * number));
                        product.setWeight(df.format(0.3 * length * width * product.getCount() / 10000 * number));
                    }
                } else if ("13".equals(dto.getKind())) {
                    int min = getNum(length, width);
                    dto.setLength(length);
                    dto.setWidth(width);
                    int tempNumber = dto.getNumber();
                    List<String> craftList = !StringUtils.isEmpty(dto.getCraft()) ? new ArrayList<>(Arrays.asList(dto.getCraft())) : new ArrayList<>();
                    Boolean isMq = false;
                    if (craftList.contains("模切")) {
                        dto.setNumber(1);
                        isMq = true;
                    }
                    priceList = new CouponPrice().getCouponPrice(min, dto, priceList, count, craftList);
                    craftList.remove("模切");
                    List<String> tang_craft = new ArrayList<>();
                    if (craftList.contains("单面烫金")) {
                        tang_craft.add("单面烫金");
                    }
                    if (craftList.contains("双面烫金")) {
                        tang_craft.add("双面烫金");
                    }
                    dto.setCraft(tang_craft.toArray(new String[tang_craft.size()]));
                    getCraft(dto, priceList, length * 10, width * 10, min);
                    for (Product product : priceList) {
                        double carft_price = 0;
                        if (craftList.contains("压痕")) {
                            carft_price += Math.max(0.02 * product.getCount(), 10);
                        }
                        if (craftList.contains("压点线")) {
                            carft_price += Math.max(0.02 * product.getCount(), 10);
                        }
                        if (craftList.contains("圆角")) {
                            carft_price += Math.max(0.02 * product.getCount(), 10);
                        }
                        if (craftList.contains("打码")) {
                            double danjia = 0.0;
                            // 5000张以上，一张10分
                            if (dto.getCount() > 5000) {
                                danjia = 0.1;
                            } else {
                                danjia = 0.1;
                            }
                            if ("上下编码".equals(dto.getBianma())) {
                                carft_price += Math.ceil((danjia * product.getCount() * 2 > 120 ? danjia * product.getCount() * 2 : 120));
                            } else {
                                carft_price += Math.ceil((danjia * product.getCount()));
                            }
                        }
                        carft_price = Math.ceil(carft_price * dto.getNumber());
                        //腰封的模切费单独计算
                        product.setPrice(Math.ceil((product.getPrice() + carft_price)));
                        product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
                    }
                    if (isMq) {
                        for (Product product : priceList) {
                            product.setPrice(Math.floor(product.getPrice() * tempNumber));
                            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
                        }
                    }
                } else {
                    List<String> craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
                    if ("10".equals(dto.getKindValue2())) {
                        area = length * width;
                        int[][] prices = {
                                {106, 106, 106, 106, 106, 107, 108, 109, 116, 130, 131, 133, 142, 193, 195, 198, 246, 430, 438, 557, 573},
                                {139, 139, 139, 139, 143, 145, 147, 160, 162, 171, 176, 179, 205, 255, 260, 266, 279, 490, 497, 628, 632},
                                {226, 237, 245, 253, 255, 256, 258, 265, 269, 280, 290, 310, 325, 395, 410, 445, 453, 650, 721, 914, 920},
                                {313, 342, 343, 375, 380, 385, 390, 395, 398, 400, 405, 409, 418, 540, 545, 555, 620, 811, 836, 1056, 1128},
                                {465, 510, 515, 553, 559, 565, 571, 581, 587, 599, 610, 615, 629, 810, 820, 830, 921, 1200, 1250, 1580, 1685},
                                {760, 809, 836, 865, 873, 878, 882, 890, 900, 913, 923, 930, 955, 1208, 1258, 1330, 1500, 1646, 2044, 2086, 2788},
                                {1395, 1412, 1423, 1434, 1454, 1489, 1524, 1530, 1532, 1540, 1545, 1559, 1632, 2210, 2240, 2440, 2850, 3100, 3786, 3866, 5116},
                        };
                        int[][] tang_prices = {
                                {122, 129, 136, 150, 179, 193},
                                {122, 129, 136, 150, 179, 193},
                                {170, 177, 184, 211, 252, 279},
                                {247, 273, 299, 338, 403, 355},
                                {304, 353, 378, 440, 539, 614},
                                {448, 508, 569, 666, 823, 968},
                                {873, 991, 1109, 1298, 1605, 1888}
                        };
                        double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 172.8, 194.4, 224, 288, 294, 400};
                        double[] tang_areas = {50, 100, 150, 250, 350, 450};
                        int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};

                        for (int i = 0; i < count_list.length; i++) {
                            int item_count = count_list[i];
                            if (count > item_count) {
                                continue;
                            }
                            if (priceList.size() > 2) {
                                break;
                            }
                            int count_index = Arrays.binarySearch(count_list, item_count);
                            double price = 0;
                            double carft_price = 0;
                            double min_carft = 0;
                            if (count_index >= 0) {
                                price = new PriceUtils().TablePrice(area, prices[count_index], areas);

                                if (craft_list.contains("打孔")) {
                                    carft_price += Math.max(0.03 * item_count, 30);
                                }
                                if (craft_list.contains("压痕")) {
                                    carft_price += 0.03 * dto.getYaheng() * item_count;
                                }
                                if (craft_list.contains("打点线")) {
                                    carft_price += 0.02 * dto.getDadianxian() * item_count;
                                }
                                if (craft_list.contains("打码")) {
                                    carft_price += Math.max(0.05 * dto.getMaxian() * item_count, 15);
                                }
                                if (craft_list.contains("配葫芦针")) {
                                    carft_price += Math.max(0.016 * item_count, 10);
                                }
                                if (craft_list.contains("配流苏")) {
                                    carft_price += Math.max(0.15 * item_count, 30);
                                }
                                if (craft_list.contains("穿流苏")) {
                                    carft_price += Math.max(0.5 * item_count, 100);
                                }
                                if (craft_list.contains("配尼龙绳")) {
                                    if ("红色绳子".equals(dto.getShen_color())) {
                                        carft_price += Math.max(0.009 * item_count, 10);
                                    } else {
                                        carft_price += Math.max(0.03 * item_count, 3);
                                    }
                                }
                                if (craft_list.contains("穿尼龙绳")) {
                                    carft_price += Math.max(0.2 * item_count, 40);
                                }
                                if (craft_list.contains("配弹力绳")) {
                                    carft_price += Math.max(0.1 * item_count, 10);
                                }
                                if (craft_list.contains("配弹力绳捆")) {
                                    carft_price += 10 * Math.ceil(item_count * 20.0 / 5000);
                                }
                                double tang_price = 0;
                                if (craft_list.contains("单面烫金") || craft_list.contains("双面烫金")) {
                                    tang_price = new PriceUtils().TablePrice(area, tang_prices[count_index], tang_areas);
                                    if (craft_list.contains("双面烫金")) {
                                        tang_price = tang_price * 2;
                                    }
                                }

                                carft_price += tang_price;
                            }

                            Product product = new Product();
                            product.setCount(item_count);
                            product.setPrice(Math.ceil((price + carft_price) * number));
                            priceList.add(product);

                        }
                        return chucklePrice(role, priceList, dto);
                    }
                    int min = getNum(length, width);
                    String[] kind_list = {"3", "4", "5", "7"};
                    dto.setD("");
                    priceList = getHekaPrice(min, dto, priceList, count);
                    boolean isyaofeng = false;

                    double moqiePrice = 0;
                    craft_list = new ArrayList<>(craft_list);
                    if (!craft_list.contains("模切") && (craft_list.contains("压痕") || craft_list.contains("压点线"))) {
                        //压1痕最小尺寸10.8*5.4cm,压2痕最小尺寸13.5*5.4CM按照贺卡模切价格算
                        boolean is_moqie = false;
                        if ((craft_list.contains("压痕") && dto.getYaheng() == 1) || (craft_list.contains("压点线") && dto.getDadianxian() == 1)) {
                            if ((length < 10.8 && width < 5.4) || (length < 5.4 && width < 10.8)) {
                                is_moqie = true;
                            }
                        }
                        if (craft_list.contains("压痕") && dto.getYaheng() == 2 || (craft_list.contains("压点线") && dto.getDadianxian() == 2)) {
                            if ((length < 13.5 && width < 5.4) || (length < 5.4 && width < 13.5)) {
                                is_moqie = true;
                            }
                        }
                        if (craft_list.contains("压痕") && dto.getYaheng() == 3 || (craft_list.contains("压点线") && dto.getDadianxian() == 3)) {
                            craft_list.add("模切");
                        }
                        if (craft_list.contains("压痕") && dto.getYaheng() == 4 || (craft_list.contains("压点线") && dto.getDadianxian() == 4)) {
                            craft_list.add("模切");
                        }
                        if (is_moqie) {
                            isyaofeng = true;
                            for (int i = 0; i < dto.getCraft().length; i++) {
                                if ("压痕".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "模切";
                                }
                                if ("压点线".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "模切";
                                }
                            }
                        }
                    }
                    //300克铜版纸 腰封价格加上模板费--腰封的模切费
                    if ("1".equals(dto.getKind()) && craft_list.contains("模切") && !isyaofeng) {
                        double[][] CATEGORIES = {
                                {105, 140},    // 第一档
                                {140, 210},    // 第二档
                                {210, 285},    // 第三档
                                {285, 420},    // 第四档选项1
                                {210, 570},    // 第四档选项2
                                {420, 580},    // 第五档选项1
                                {285, 840},    // 第五档选项2
                                {580, 880}     // 第六档
                        };
                        int[] CATEGORY_PRICE = {
                                80, 90, 100, 130, 130, 170, 170, 330
                        };
                        int mu_price = 330;
                        double min_width = Math.min(width * 10 + 4, length * 10 + 4);
                        double max_width = Math.max(width * 10 + 4, length * 10 + 4);
                        for (int i = 0; i < CATEGORIES.length; i++) {
                            double categoryMin = CATEGORIES[i][0];
                            double categoryMax = CATEGORIES[i][1];

                            // 比较尺寸（考虑浮点数精度问题）
                            if (min_width < categoryMin && max_width <= categoryMax) {
                                mu_price = CATEGORY_PRICE[i];
                                break;
                            }
                        }
                        if (dto.getCraft() != null && craft_list.contains("模切")) {
                            for (int i = 0; i < dto.getCraft().length; i++) {
                                if ("模切".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                                if ("压痕".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                                if ("压点线".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                            }
                            moqiePrice = 0.06;
                        }
                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() + mu_price);
                        }
                    }
                    //300克铜版纸 贺卡 优惠券 抽奖券 存酒卡价格重新计算
                    if ((Arrays.asList(kind_list).contains(dto.getKind()) && "2".equals(dto.getKindValue2())) || isyaofeng) {
                        boolean is_moqie = false;
                        if (dto.getCraft() != null && Arrays.asList(dto.getCraft()).contains("模切")) {
                            is_moqie = true;
                        }

                        if (is_moqie) {
                            priceList = getOtherHekaPrice(dto, width, length);
                            moqiePrice = 0;
                            for (int i = 0; i < dto.getCraft().length; i++) {
                                if ("模切".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                                if ("双面覆哑膜".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                                if ("压痕".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                                if ("压点线".equals(dto.getCraft()[i])) {
                                    dto.getCraft()[i] = "";
                                }
                            }
                        }
                    }
                    //四个位拼多多价格调整
                    if (role.indexOf("1045") > -1 && min == 4) {
                        for (Product product : priceList) {
                            if (product.getCount() == 200) {
                                product.setPrice(product.getPrice() - 30);
                            }
                            if (product.getCount() == 500) {
                                product.setPrice(product.getPrice() - 10);
                            }
                        }
                    }
                    if ("1".equals(dto.getKind())) {
                        dto.setLengthTang(length);
                        dto.setWidthTang(width);
                    }
                    List<String> containList = new ArrayList<>(Arrays.asList("单面星光膜", "双面星光膜", "单面镭射膜", "双面镭射膜", "单面触感膜", "双面触感膜", "单面雪花膜", "双面雪花膜", "单面局部UV", "双面局部UV"));
                    if ("3".equals(dto.getKind()) && "2".equals(dto.getKindValue2()) && craft_list != null && !Collections.disjoint(craft_list, containList)) {
                        priceList = gethuafangApiPrice(dto, craft_list, width, length);
                        number = 1;
                    }

                    getCraft(dto, priceList, length * 10, width * 10, min);
                    // 刮刮膜增加价格
                    if (dto.getKind().equals("13")) {
                        if (dto.getSize1().equals("60*25")) {
                            for (Product product : priceList) {
                                product.setPrice(product.getPrice() + Math.ceil(0.08 * product.getCount() > 50 ? 0.08 * product.getCount() : 50));
                            }
                        } else {
                            for (Product product : priceList) {
                                product.setPrice(product.getPrice() + Math.ceil(0.04 * product.getCount() > 40 ? 0.04 * product.getCount() : 40));
                            }
                        }
                    }
                    // 根据款数重新算价格/计算重量
                    for (Product product : priceList) {
                        double carft_price = 0;
                        if (craft_list.contains("配葫芦针")) {
                            carft_price += Math.max(0.016 * product.getCount(), 10);
                        }
                        if (craft_list.contains("配流苏")) {
                            carft_price += Math.max(0.15 * product.getCount(), 30);
                        }
                        if (craft_list.contains("穿流苏")) {
                            carft_price += Math.max(0.5 * product.getCount(), 100);
                        }
                        if (craft_list.contains("配尼龙绳")) {
                            if ("红色绳子".equals(dto.getShen_color())) {
                                carft_price += Math.max(0.009 * product.getCount(), 10);
                            } else {
                                carft_price += Math.max(0.03 * product.getCount(), 3);
                            }
                        }
                        if (craft_list.contains("穿尼龙绳")) {
                            carft_price += Math.max(0.2 * product.getCount(), 40);
                        }
                        if (craft_list.contains("配弹力绳")) {
                            carft_price += Math.max(0.1 * product.getCount(), 10);
                        }
                        if (craft_list.contains("配弹力绳捆")) {
                            carft_price += 10 * Math.ceil(product.getCount() * 20.0 / 5000);
                        }
                        if (craft_list.contains("配弹力绳捆")) {
                            carft_price += 10 * Math.ceil(product.getCount() * 20.0 / 5000);
                        }
                        if (craft_list.contains("配棉绳")) {
                            carft_price += Math.max(Math.ceil(product.getCount() * 0.015), 15);
                        }
                        if (craft_list.contains("装opp袋")) {
                            carft_price += Math.max(Math.ceil(product.getCount() * 0.15), 5);
                        }
                        if (craft_list.contains("配opp袋")) {
                            double carft_base_price = 0;
                            if ("8*5".equals(dto.getToothpick_size())) {
                                carft_base_price = 10;
                            }
                            if ("10*5".equals(dto.getToothpick_size())) {
                                carft_base_price = 12;
                            }
                            if ("12*5".equals(dto.getToothpick_size())) {
                                carft_base_price = 14;
                            }
                            if ("12*6".equals(dto.getToothpick_size())) {
                                carft_base_price = 15;
                            }
                            if ("8*10".equals(dto.getToothpick_size())) {
                                carft_base_price = 17;
                            }
                            if ("8*12".equals(dto.getToothpick_size())) {
                                carft_base_price = 19;
                            }
                            if ("11*18".equals(dto.getToothpick_size())) {
                                carft_base_price = 30;
                            }
                            if ("17*6".equals(dto.getToothpick_size())) {
                                carft_base_price = 30;
                            }
                            if ("12*7".equals(dto.getToothpick_size())) {
                                carft_base_price = 17;
                            }
                            if ("12*10".equals(dto.getToothpick_size())) {
                                carft_base_price = 23;
                            }
                            carft_price += carft_base_price * Math.ceil(product.getCount() / 1000.0);
                        }
                        if (craft_list.contains("内部模切")) {
                            carft_price += 15 * dto.getN_mq_num();
                        }
                        if (craft_list.contains("配印章")) {
                            carft_price += 10 * dto.getPo_number();
                        }
                        //腰封的模切费单独计算
                        product.setPrice(Math.ceil((product.getPrice() + carft_price) * number + Math.max(Math.ceil(moqiePrice * product.getCount() * number), moqiePrice > 0 ? 55 : 0)));
                        product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
                    }

                    /*优惠券、抽奖卡特殊处理*/
                    if (("4".equals(dto.getKind()) || "5".equals(dto.getKind())) && !StringUtils.isEmpty(dto.getCraft()) && min == 2) {
                        List<String> list = Arrays.asList(dto.getCraft());
                        if (list.size() == 3 && list.contains("双面覆哑膜") && list.contains("压点线") && list.contains("打码")) {
                            for (Product product : priceList) {
                                if (product.getCount() == 200) {
                                    product.setPrice(90.0 * number);
                                } else if (product.getCount() == 500) {
                                    product.setPrice(120.0 * number);
                                }
                            }
                        } else if (list.size() == 2 && list.contains("压点线") && list.contains("打码")) {
                            for (Product product : priceList) {
                                if (product.getCount() == 200) {
                                    product.setPrice(90.0 * number);
                                } else if (product.getCount() == 500) {
                                    product.setPrice(120.0 * number);
                                }
                            }
                        }
                    }
                }

                return chucklePrice(role, priceList, dto);
            // 吊牌300/600/800克
            case "吊牌":
                // 自定义尺寸
                // 单个产品的面积
                area = length * width / 10000;

                // 300克
                if ("3".equals(kind) || "40".equals(kind)) {
                    // 直角打孔价格
                    if ("直角打孔".equals(dto.getCraftQie())) {
                        priceList = new PriceUtils().tags300PriceCraftZhi(dto, width, length, count, priceList);
                    } else {// 异形模切价格
                        priceList = new PriceUtils().tags300PriceCraftMo(dto, number, width, length, area, count, priceList);
                    }

                    if ("单面烫金".equals(dto.getCraftTang())) {
                        // 有2个尺寸带烫金
                        if (!StringUtils.isEmpty(dto.getSize1())) {
                            for (Product product : priceList) {
                                product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 > 85 * 2 ? product.getPrice() * 0.09 * 2 : 85 * 2)));
                            }
                        } else {
                            for (Product product : priceList) {
                                product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 85 ? product.getPrice() * 0.09 : 85)));
                            }
                        }
                    } else if ("双面烫金".equals(dto.getCraftTang())) {
                        // 有2个尺寸带烫金
                        if (!StringUtils.isEmpty(dto.getSize1())) {
                            for (Product product : priceList) {
                                product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 * 2 > 170 * 2 ? product.getPrice() * 0.09 * 2 * 2 : 170 * 2)));
                            }
                        } else {
                            for (Product product : priceList) {
                                product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 > 170 ? product.getPrice() * 0.09 * 2 : 170)));
                            }
                        }
                    }
                } else if ("4".equals(kind)) {// 600克/800克
                    if (length < 5.0 && width < 5.0) {
                        area = 5.0 * 5.0 / 10000;
                    }
                    priceList = new PriceUtils().tags600Price(dto, kind, kind2, area, count);
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }

                return chucklePrice(role, priceList, dto);
            // 服装吊牌
            case "服装吊牌":
                // 自定义尺寸
                // 单个产品的面积
                area = length * width / 10000;
                if ("常规".equals(dto.getStickerKind())) {
                    // 300克
                    if ("3".equals(kind)) {
                        Product product1 = new Product();
                        List<String> craft = dto.getCraft() == null ? new ArrayList<>() : new ArrayList<>(Arrays.asList(dto.getCraft()));
                        craft.add("双面覆哑膜");
                        if ("直角打孔".equals(dto.getCraftQie())) {
                            craft.add("打孔");
                        }
                        if ("异形模切".equals(dto.getCraftQie())) {
                            craft.add("模切");
                            craft.remove("打孔");
                        }
                        if (!"".equals(dto.getCraftTang())) {
                            craft.add(dto.getCraftTang());
                        }
                        product1.setCount(dto.getCount());
                        product1.setWidthTang(dto.getWidthTang());
                        product1.setLengthTang(dto.getLengthTang());
                        product1.setWidth(dto.getWidth());
                        product1.setNumber(dto.getNumber());
                        product1.setLength(dto.getLength());
                        product1.setCraft(craft.toArray(new String[craft.size()]));
                        product1.setProTypeValue("4");
                        product1.setKindValue("3");
                        product1.setKind("3");
                        product1.setSize(dto.getSize());
                        // 直角打孔价格
                        int min = getNum(length, width);
                        priceList = getHekaPrice(min, product1, priceList, count);
                        getCraft(product1, priceList, length * 10, width * 10, min);
                        for (Product product : priceList) {
                            if ("击凸".equals(dto.getAotu()) || "压凹".equals(dto.getAotu())) {
                                product.setPrice(Math.ceil(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
                            }
                            if (craft.contains("弹力绳")) {
                                product.setPrice(Math.ceil(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
                            }
                            if (craft.contains("弹力绳捆")) {
                                product.setPrice(Math.ceil(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10));
                            }
                            if (craft.contains("配棉绳")) {
                                product.setPrice(Math.ceil(product.getPrice() + Math.max(Math.ceil(product.getCount() * 0.015), 15)));
                            }
                            if (craft.contains("别针")) {
                                product.setPrice(Math.ceil(product.getPrice() + Math.max(Math.ceil(product.getCount() * 0.016), 10)));
                            }
                            if (craft.contains("流苏")) {
                                product.setPrice(Math.ceil(product.getPrice() + Math.max(Math.ceil(product.getCount() * 0.015), 30)));
                            }
                            if (craft.contains("绳子")) {
                                product.setPrice(Math.ceil(product.getPrice() + Math.max(Math.ceil(product.getCount() * 0.015), 10)));
                            }
                            if ("击凸".equals(dto.getAotu()) || "压凹".equals(dto.getAotu())) {
                                if (min > 1) {
                                    product.setPrice(Math.ceil(product.getPrice() * 1.5));
                                }
                            }
                        }
                        // 根据款数重新算价格/计算重量
                        for (Product product : priceList) {
                            if (product.getCount() >= 10000 && min > 1) {
                                if (min == 2) {
                                    product.setPrice(Math.floor(product.getPrice() * 0.9));
                                } else {
                                    product.setPrice(Math.floor(product.getPrice() * 0.8));
                                }

                            }
                            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
                        }
//                        if ("直角打孔".equals(dto.getCraftQie())) {
//                            priceList = new PriceUtils().tags300PriceCraftZhi(dto, width, length, count, priceList);
//                        } else if ("异形模切".equals(dto.getCraftQie())) {
//                            priceList = new PriceUtils().tagClothes300PriceCraftMo(dto, number, width, length, area, count, priceList);
//                        }
//                        // +棉绳钱 1分5一条
//                        if (!StringUtils.isEmpty(dto.getCraftSheng())) {
//                            for (Product product : priceList) {
//                                product.setPrice(product.getPrice() + product.getCount() * 0.015);
//                            }
//                        }
//                        if ("单面烫金".equals(dto.getCraftTang())) {
//                            // 有2个尺寸带烫金
//                            if (!StringUtils.isEmpty(dto.getSize1())) {
//                                for (Product product : priceList) {
//                                    product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 > 85 * 2 ? product.getPrice() * 0.09 * 2 : 85 * 2)));
//                                }
//                            } else {
//                                for (Product product : priceList) {
//                                    product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 120 ? product.getPrice() * 0.09 : 120)));
//                                }
//                            }
//                        } else if ("双面烫金".equals(dto.getCraftTang())) {
//                            // 有2个尺寸带烫金
//                            if (!StringUtils.isEmpty(dto.getSize1())) {
//                                for (Product product : priceList) {
//                                    product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 * 2 > 170 * 2 ? product.getPrice() * 0.09 * 2 * 2 : 170 * 2)));
//                                }
//                            } else {
//                                for (Product product : priceList) {
//                                    product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 > 170 ? product.getPrice() * 0.09 * 2 : 170)) * 1.1);
//                                }
//                            }
//                        } else

                    } else {// 900克
                        // 小于一个名片位的价格按照一个名片位报价
                        /*
                         * if((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) { area = 0.00486; }
                         */
                        priceList = new PriceUtils().tags600Price(dto, kind, kind2, area, count);

                        for (Product product : priceList) {
                            int num = getNum(width, length);
                            // 服装吊牌里面的600克吊牌把价格*1.3倍
                            if (!("6".equals(kind) && "无".equals(kind2))) {
                                if (num == 1) {
                                    product.setPrice(Math.floor(product.getPrice() * 1.3));
                                } else {
                                    product.setPrice(Math.floor(product.getPrice() * 1.2));
                                }

                            }
                            if ("4".equals(kind)) {
                                product.setPrice(Math.floor(product.getPrice() * 1.3));
                                if (num == 1 && "无".equals(kind2)) {
                                    product.setPrice(Math.floor(product.getPrice() * 1.3));
                                }
                                // 服装吊牌里面的900克吊牌把价格
                                if (product.getCount() <= 2000) {
                                    product.setPrice(Math.floor(product.getPrice() * 1.1));
                                }
                                if (product.getCount() > 2000 && product.getCount() <= 5000) {
                                    product.setPrice(Math.floor(product.getPrice() * 1.08));
                                }
                                if (product.getCount() > 5000) {
                                    product.setPrice(Math.floor(product.getPrice() * 1.06));
                                }
                            }
                        }

                        for (int i = 0; i < priceList.size(); i++) {
                            if (priceList.get(i).getCount() == 500) {
                                priceList.get(i).setPrice(Math.floor(priceList.get(i + 1).getPrice() - 5));
                            }
                        }
                        // +棉绳钱 1分5一条
                        for (Product product : priceList) {
                            if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("棉绳")) {
                                product.setPrice(product.getPrice() + product.getCount() * 0.015);
                            }
                            if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("弹力绳")) {
                                product.setPrice(product.getPrice() + Math.max(product.getCount() * 0.1, 10));
                            }
                            if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("弹力绳捆")) {
                                product.setPrice(product.getPrice() + 10 * Math.ceil(product.getCount() * 20.0 / 5000));
                            }
                        }
                        for (Product product : priceList) {
                            product.setWeight(df.format(length * width * product.getCount() / 10000 * 0.6));
                        }
                    }
                    if (priceList.size() >= 4) {
                        priceList = priceList.subList(0, 4);
                    }
                    // 根据款数重新算价格
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * number));
                    }
                } else {
                    double l = 420 + 4;
                    double w = 285 + 4;
                    length = length * 10 + 4;
                    width = width * 10 + 4;
                    // 一张l/w 大的纸张能做多少个此类尺寸的产品
                    double max = Math.max(Math.floor(l / length) * Math.floor(w / width), Math.floor(l / width) * Math.floor(w / length));
                    // 报的数量需要多少张大纸
                    // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                    int num = (int) Math.ceil(count * number / max);
                    double designFee = 0;
                    if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
                        designFee = 8;
                    } else if ((length - 4 <= 140 && width - 4 <= 100) || (length - 4 <= 100 && width - 4 <= 140)) {
                        designFee = 16;
                    } else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
                        designFee = 25;
                    } else if ((length - 4 <= 285 && width - 4 - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
                        designFee = 35;
                    } else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
                        designFee = 50;
                    } else {
                        designFee = 80;
                    }
                    Product products = dto;
                    products.setPrice(Math.floor(32 + (num - 5 > 0 ? num - 5 : 0) * 7 + designFee * number));
                    priceList.add(products);
                }

                // 产品重量
                double weight = 0;
                if ("3".equals(kind)) {
                    weight = 0.3;
                } else {
                    weight = 0.6;
                }
                for (Product product : priceList) {
                    product.setWeight(String.valueOf(weight * area * product.getCount() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 特价名片
            case "特价名片":
                // 选了【自定义尺寸】
                if (dto.isSwitchSize()) {

                } else {
                    dto.setKindValue("2");
                    // 【覆膜/不覆膜】价格写死了
                    // 不覆膜
                    dto.setKind1Value("0");
                    String[] craft = dto.getCraft();
                    if (!StringUtils.isEmpty(craft)) {
                        for (int i = 0; i < craft.length; i++) {
                            if ("双面覆哑膜".equals(craft[i])) {
                                // 覆膜
                                dto.setKind1Value("1");
                                craft[i] = null;
                                break;
                            }
                        }
                    }
                    // 尺寸只有9*5.4cm以内的
                    dto.setKind2Value("0");
                    // if ("9*5.4".equals(size)) {
                    // }
                    priceList = productMapper.getThanPrice(dto);
                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    }
                }
                // 加工艺的价格 --有覆膜，带尺寸过去（毫米）
                getCraft(dto, priceList, null, null, 0);
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 名片-特种纸名片
            case "特种纸名片":
                double addPrice = 5;

                List<String> craft_list = dto.getCraft() != null ? new ArrayList<>(Arrays.asList(dto.getCraft())) : new ArrayList<>();
//                if (craft_list.contains("压痕") && ((width <= 10 && length <= 7) || (width <= 7 && length <= 10))) {
//                    craft_list.remove("压痕");
//                    craft_list.add("异形模切");
//                }
                if (!craft_list.isEmpty()) {
                    dto.setCraft(craft_list.toArray(new String[craft_list.size()]));
                }

                if ("雅柔".equals(kind) || "萱姿".equals(kind)) {
                    kind = "珠光";
                    dto.setKindValue("珠光");
                } else if ("500克拉丝闪金".equals(kind) || "500克拉丝闪银".equals(kind)) {
                    dto.setKindValue("拉丝闪银");
                    length = 9.0;
                    width = 5.4;
                }
                if (dto.isSwitchCardCount() && ("珠光".equals(kind) || "溪雪".equals(kind))) {
                    // 出血（一边2毫米）
                    length = length * 10 + 4;
                    width = width * 10 + 4;
                    double l = 420;
                    double w = 290;
                    double price = 0.0;
                    // 第一张价格
                    double fixPrice = 60;
                    // 每张多少钱
                    double zhang = 10;

                    // 一张l/w 大的纸张能做多少个此类尺寸的产品
                    double max = Math.max(Math.floor(l / length) * Math.floor(w / width), Math.floor(l / width) * Math.floor(w / length));
                    // 报的数量需要多少张大纸
                    // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                    int num = (int) Math.ceil(count * number / max);
                    double zhekou = 1;

                    int min = getNum(length, width);
                    if (min == 1) {
                        zhekou = 1;
                    } else if (min == 2) {
                        zhekou = 0.83;
                    } else if (min == 3) {
                        zhekou = 0.8;
                    } else {
                        zhekou = 0.75;
                    }
                    price = fixPrice + (num - 5 > 0 ? num - 5 : 0) * zhang;
                    Product dto2 = new Product();
                    dto2.setCount(count);
                    dto2.setPrice(Math.ceil((price + addPrice) * zhekou));
                    priceList.add(dto2);
                    getCraft(dto, priceList, null, null, 0);
                } else if ("素芸".equals(kind)) {
                    int[] count_list = {100, 200, 400, 500, 1000, 2000, 3000, 5000, 10000};
                    double[] prices = {};
                    if ("500克".equals(dto.getKind())) {

                        prices = new double[]{144, 272, 528, 660, 1280, 2560, 3840, 6400, 12800};

                        if (craft_list.contains("击凸") || craft_list.contains("压凹") || (craft_list.contains("单面烫金") || craft_list.contains("双面烫金") || craft_list.contains("烫镭射银"))) {
                            prices = new double[]{214, 362, 658, 810, 1530, 3060, 4590, 7650, 15300};
                        }
                        if (craft_list.contains("圆角")) {
                            prices = new double[]{146, 276, 536, 670, 1300, 2600, 3900, 6500, 13000};
                        }
                        if (craft_list.contains("圆角") && (craft_list.contains("击凸") || craft_list.contains("压凹"))) {
                            prices = new double[]{216, 366, 666, 820, 1550, 3100, 4600, 7800, 15500};
                        }
                        if (craft_list.contains("圆角") && (craft_list.contains("单面烫金") || craft_list.contains("双面烫金") || craft_list.contains("烫镭射银"))) {
                            prices = new double[]{216, 366, 666, 820, 1550, 3100, 4600, 7800, 15500};
                        }
                        if (craft_list.contains("异形模切") && (craft_list.contains("单面烫金") || craft_list.contains("双面烫金") || craft_list.contains("烫镭射银"))) {
                            prices = new double[]{214, 362, 658, 810, 1530, 3060, 4590, 7650, 15300};
                        }
                        if (craft_list.contains("异形模切") && (craft_list.contains("击凸") || craft_list.contains("压凹"))) {
                            prices = new double[]{214, 362, 658, 810, 1530, 3060, 4590, 7650, 15300};
                        }

                        priceList = new ArrayList<>();
                        Product dto2 = null;

                        for (int i = 0; i < count_list.length; i++) {
                            double rate = 1.0;
                            if (count_list[i] < count) {
                                continue;
                            }
                            if (priceList.size() > 2) {
                                break;
                            }
                            if (count_list[i] >= 400) {
                                rate = 0.8;
                            }
                            if (craft_list.contains("双面烫金")) {
                                rate = rate * 1.8;
                            }
                            if (craft_list.contains("双面烫镭射银")) {
                                rate = rate * 1.8;
                            }

                            dto2 = new Product();
                            dto2.setCount(count_list[i]);
                            dto2.setPrice(Math.ceil(prices[i] * rate));
                            priceList.add(dto2);
                        }


                        int min = getNum(length, width);
                        for (Product product : priceList) {
                            double mqPrice = 0;

                            if (craft_list.contains("异形模切") && !(craft_list.contains("击凸") || craft_list.contains("压凹") || (craft_list.contains("单面烫金") || craft_list.contains("双面烫金") || craft_list.contains("烫镭射银")))) {
                                mqPrice = Math.ceil(15 * 0.01 * product.getCount() + 50);
                            }
                            if (craft_list.contains("打点线")) {
                                mqPrice += (35 + 0.2 * product.getCount()) * number;
                            }
                            product.setPrice(Math.floor(product.getPrice() * number * min + mqPrice));
                            product.setWeight(df.format(number * (length) / 100 * (width) / 100 * product.getCount() * 0.5));
                        }
                    }

                    if ("300克".equals(dto.getKind())) {
                        double sePrice = 5;
                        prices = new double[]{70, 135, 270, 335, 680, 1375, 2070, 3465, 6960};
                        if ((width <= 9 && length <= 5.4) || (length <= 9 && width <= 5.4)) {

                        } else if (width < 10 && length < 10) {
                            sePrice = 10;
                            prices = new double[]{128, 251, 502, 625, 1260, 2535, 3810, 6365, 12760};
                        } else if ((width <= 10 && length <= 15) || (length <= 10 && width <= 15)) {
                            prices = new double[]{185, 365, 730, 910, 1830, 3675, 5520, 9215, 18460};
                            sePrice = 15;
                        } else if (width < 15 && length < 15) {
                            prices = new double[]{300, 595, 1190, 1485, 2980, 5975, 8970, 14965, 29960};
                            sePrice = 20;
                            // ((width <= 20 && length <= 15) || (length <= 20 && width <= 15))
                        } else {
                            prices = new double[]{450, 895, 1790, 2235, 4480, 8975, 13470, 22465, 44960};
                            sePrice = 25;
                        }

                        priceList = new ArrayList<>();
                        Product dto2 = null;

                        for (int i = 0; i < count_list.length; i++) {
                            int itemCount = count_list[i];
                            if (count_list[i] < count) {
                                continue;
                            }
                            if (priceList.size() > 2) {
                                break;
                            }
                            double craft_price = 0;
                            if (craft_list.contains("圆角")) {
                                craft_price += 4 * itemCount / 100;
                            }
                            if (craft_list.contains("印刷颜色") && dto.getCo_number() != null && dto.getCo_number() > 0) {
                                craft_price += sePrice * (dto.getCo_number() > 1 ? 6 : dto.getCo_number());
                            }
                            if ((craft_list.contains("单面烫金") || craft_list.contains("双面烫金") || craft_list.contains("烫镭射银"))) {
                                double tangPrice = 45 + 0.1 * itemCount;
                                if (craft_list.contains("双面烫金") || craft_list.contains("双面烫镭射银")) {
                                    tangPrice = 45 * 2;
                                }
                                craft_price += tangPrice;
                            }

                            if (craft_list.contains("异形模切")) {
                                craft_price += 60 + 0.1 * itemCount;
                            }
                            if (craft_list.contains("压痕")) {
                                craft_price += 35 + 0.2 * itemCount;
                            }
                            if (craft_list.contains("打点线")) {
                                craft_price += 35 + 0.2 * itemCount;
                            }

                            if (craft_list.contains("击凸") || craft_list.contains("压凹")) {
                                craft_price += 52 + 0.1 * itemCount;
                            }

                            if (craft_list.contains("打码")) {
                                double danjia = 0.0;
                                if (dto.getMaxian() == 1) {
                                    danjia = 0.8;
                                }
                                if (dto.getMaxian() == 2) {
                                    danjia = 1.6;
                                }
                                if (dto.getMaxian() == 3) {
                                    danjia = 2.4;
                                }
                                craft_price += danjia * itemCount;
                            }
                            dto2 = new Product();
                            dto2.setCount(count_list[i]);
                            dto2.setPrice(Math.ceil((prices[i] + craft_price) * number));
                            priceList.add(dto2);
                        }
                    }
                    for (Product product : priceList) {
                        if (craft_list.contains("打孔")) {
                            product.setPrice(Math.ceil(product.getPrice() + 0.2 * product.getCount() * number));
                        }
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("草香".equals(kind) || "芳怡".equals(kind)) {
                    int[] count_list = {200, 500, 1000, 2000, 5000, 10000};
                    // 出血（一边2毫米）
                    length = length * 10 + 4;
                    width = width * 10 + 4;
                    // -300克/200克/157克少数量价格+重量+工艺+款数价格
                    double l = 0.0;
                    double w = 0.0;
                    double price = 0.0;
                    // 第一张价格
                    double fixPrice = 0.0;
                    // 每张多少钱
                    double zhang = 0.0;
                    // 设计费 *元/款
                    double designFee = 0.0;
                    // 模切费
                    double cutFee = 0.0;

                    /** ======= 婚礼卡费用 ======= */
                    // 5张以内价格
                    if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
                        fixPrice = 50.0;
                        zhang = 10;

                        if (dto.getCraft() != null) {
                            List<String> craftList = Arrays.asList(dto.getCraft());
                            if (craftList.contains("异形模切")) {
                                zhang = 18;
                            }
                        }

                        l = 420 + 4;
                        w = 285 + 4;

                    }

                    // 设计费不带出血的尺寸
                    if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
                        designFee = 8;
                    } else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
                        designFee = 15;
                    } else if ((length - 4 <= 285 && width - 4 - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
                        designFee = 35;
                    } else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
                        designFee = 50;
                    } else {
                        designFee = 80;
                    }

                    // 一张l/w 大的纸张能做多少个此类尺寸的产品
                    double max = Math.max(Math.floor(l / length) * Math.floor(w / width), Math.floor(l / width) * Math.floor(w / length));
                    // 报的数量需要多少张大纸
                    for (int i : count_list) {
                        // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                        if (i < count) {
                            continue;
                        }
//                        int num = (int) Math.ceil(i * number / max);
                        int num = (int) Math.ceil(i / max);
                        // 婚礼卡
                        price = fixPrice + (num - 1) * zhang + designFee + cutFee;

                        Product dto2 = new Product();
                        dto2.setCount(i);
                        dto2.setPrice(Math.ceil(price + addPrice));
                        priceList.add(dto2);
                    }

                    // 模切工艺
                    //getCraft(dto, priceList, null, null, 0);
                    if ("1".equals(dto.getKindValue())) {
                        // 给产品加上重量 扣除出血的4毫米
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * (length - 4) / 1000 * (width - 4) / 1000 * product.getCount() * 0.2 * 0.86));
                        }
                    } else {
                        // 给产品加上重量
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * (length - 4) / 1000 * (width - 4) / 1000 * product.getCount() * 0.3 * 0.86));
                        }
                    }

                    //第二款开始的设计费按照式设计内容
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * number));
                    }
                } else {
                    // 产品位数
                    double zhekou = 1;

                    int min = getNum(length, width);
                    if (min == 1) {
                        zhekou = 1;
                    } else if (min == 2) {
                        zhekou = 0.83;
                    } else if (min == 3) {
                        zhekou = 0.8;
                    } else {
                        zhekou = 0.75;
                    }

                    priceList = productMapper.getThanPrice(dto);

                    if (priceList.size() >= 4) {
                        priceList = priceList.subList(0, 4);
                    }
                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil((product.getPrice() + addPrice) * product.getPriceMultiple()));
                    }
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * number * min * zhekou));
                    }

                    if ("500克拉丝闪银".equals(kind)) {
                        String[] craft = dto.getCraft();
                        if (!StringUtils.isEmpty(craft)) {
                            for (int i = 0; i < craft.length; i++) {
                                if ("烫金/".equals(craft[i])) {
                                    for (Product product : priceList) {
                                        product.setPrice(Math.ceil(product.getPrice() + 20 + 25));
                                    }
                                } else if ("凹凸".equals(craft[i])) {
                                    for (Product product : priceList) {
                                        product.setPrice(Math.ceil(product.getPrice() + 20 + 25));
                                    }
                                } else if ("双面".equals(craft[i])) {
                                    for (Product product : priceList) {
                                        product.setPrice(Math.ceil(product.getPrice() * 2));
                                    }
                                }
                            }
                        }
                    } else {
                        dto.setMaxian(1);
                        getCraft(dto, priceList, length, width, 0);
                    }

                    for (Product product : priceList) {
                        if (craft_list.contains("配流苏")) {
                            product.setPrice(Math.ceil(product.getPrice() + 0.15 * dto.getCount() * number));
                        }
                        if (craft_list.contains("穿流苏")) {
                            product.setPrice(Math.ceil(product.getPrice() + 0.5 * dto.getCount() * number));
                        }
                    }
                    // 根据位数重新算价格
                    // 根据款数重新算价格

                    //直角的价格 按照报价系统乘以2.3  异形的按照报价系统的价格乘以1.5哈
                    if ("金绒".equals(kind) && craft_list.contains("白墨")) {
                        for (Product product : priceList) {
                            if (craft_list.contains("异形模切")) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.5));
                            } else {
                                product.setPrice(Math.ceil(product.getPrice() * 2.3));
                            }
                        }
                    }
                    if ("芳怡".equals(kind) || "草香".equals(kind)) {
                        for (Product product : priceList) {
                            product.setPrice(Math.floor(product.getPrice() * 1.5));
                        }
                    }
                    if ("皙贝".equals(kind) && craft_list.contains("异形模切")) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() * 0.8));
                        }
                    }
                }

                if (!"素芸".equals(kind)) {
                    double tang_price = 0;
                    double base_tang = 0;
                    if (craft_list.contains("单面烫金")) {
                        tang_price = 80;
                        base_tang = 0.15;
                    }
                    if (craft_list.contains("双面烫金")) {
                        tang_price = 160;
                        base_tang = 0.15;
                    }
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + (tang_price + base_tang * product.getCount()) * number));
                    }
                }
//                int tzWei = Integer.parseInt(Pattern.compile("[^0-9]").matcher(kind).replaceAll("").trim());// 获取材质中的克数
                int tzWei = 300;// 获取材质中的克数
                for (Product product : priceList) {
                    product.setWeight(df.format(tzWei / 1000.0 * length * width * product.getCount() / 10000.0 * number));
                }
                return chucklePrice(role, priceList, dto);
            // 合版封套
            case "6":
                double lengthSize = dto.getLengthSize();
                double widthSize = dto.getWidthSize();
                double heightSize = dto.getHeightSize();
                double l = lengthSize + heightSize;
                double w = widthSize * 2 + 2;
                // 有尺寸，是自定义封套
                if (lengthSize > 0) {
                    // 产品位数
                    double l1 = Math.ceil(l / 9.2);
                    double w1 = Math.ceil(w / 5.6);
                    double l2 = Math.ceil(w / 9.2);
                    double w2 = Math.ceil(l / 5.6);
                    // 产品位数
                    int min = (int) Math.min(l1 * w1, l2 * w2);
                    if ("0".equals(kind)) {
                        int priceArr[] = {14, 20, 38, 64, 150, 290};
                        priceList = new PriceUtils().getEnvelope(kind, count, min, priceArr);
                    } else {
                        int priceArr[] = {13, 19, 36, 62, 140, 280};
                        priceList = new PriceUtils().getEnvelope(kind, count, min, priceArr);
                    }
                    // 根据款数计算重量
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * l * w * 0.25 * product.getCount() * 1.15 / 10000));
                    }
                } else {
                    priceList = productMapper.getThanPrice(dto);

                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    }
                    // 根据款数计算重量
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * 0.43 * 0.3 * 0.25 * product.getCount() * 1.15));
                    }
                }
                // 工艺的钱
                getCraft(dto, priceList, null, null, 0);
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 房卡套
            case "7":
                lengthSize = dto.getLengthSize();
                widthSize = dto.getWidthSize();
                heightSize = dto.getHeightSize();
                l = lengthSize + heightSize;
                w = widthSize * 2 + 1.8;
                // 有尺寸，是自定义卡套
                if (lengthSize > 0) {
                    // 产品位数
                    double l1 = Math.ceil(l / 9.2);
                    double w1 = Math.ceil(w / 5.6);
                    double l2 = Math.ceil(w / 9.2);
                    double w2 = Math.ceil(l / 5.6);
                    // 产品位数
                    int min = (int) Math.min(l1 * w1, l2 * w2);
                    priceList = new PriceUtils().getRoomCard(count, min);
                    // 根据款数重新计算重量
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * l * w * 0.25 * product.getCount() * 1.15 / 10000));
                    }
                } else { // 没有尺寸，常规卡套
                    oldKind = kind;
                    dto.setKindValue("0");
                    priceList = productMapper.getThanPrice(dto);
                    dto.setKindValue(oldKind);
                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    }
                    // 根据款数计算重量
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * 0.13 * 0.139 * 0.25 * product.getCount() * 1.15));
                    }
                }
                // 工艺的钱
                getCraft(dto, priceList, null, null, 0);
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 档案袋
            case "8":
                priceList = productMapper.getThanPrice(dto);

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 彩色信封
            case "9":
                priceList = getXinFengPrice(dto, width, length, kind, kind2);
                return chucklePrice(role, priceList, dto);
            // 杯套
            case "10":
                if ("5".equals(kind)) {
                    /*
                     * if(length == null) { length = 29.0; width = 7.0; }
                     */
                    int min = getNum(length, width);
                    dto.setProTypeValue("4");
                    dto.setKind("3");
                    priceList = getHekaPrice(min, dto, priceList, count);

                    getCraft(dto, priceList, length * 10, width * 10, min);
                    if ("粘成品".equals(dto.getCraftTang())) {
                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() + 0.3 * product.getCount());
                        }
                    }
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * 0.3 * product.getCount() / 10000 * length * width));
                        product.setPrice(Math.ceil(product.getPrice() * number));
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("6".equals(kind)) {// 盲盒杯套价格
                    dto.setPrice(1800.0);
                    priceList.add(dto);
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * 0.3 * product.getCount() * 0.29 * 0.07));
                        product.setPrice(Math.ceil(product.getPrice() * number));
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("2".equals(kind)) {// 异形杯套价格计算
                    priceList = new PriceUtils().getCupSetPrice(count);
                } else {
                    priceList = productMapper.getThanPrice(dto);
                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    }
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 根据款数重新算价格/计算重量
                for (Product product : priceList) {
                    wei = 0.3;
                    if ("0".equals(kind) || "2".equals(kind)) {
                        area = 0.262 * 0.075;
                    } else if ("3".equals(kind) || "4".equals(kind)) {
                        area = 0.29 * 0.07;
                    } else if ("7".equals(kind)) {
                        area = 0.277 * 0.07;
                    } else {
                        area = 0.261 * 0.076;
                        wei = 0.25;
                    }

                    product.setPrice(Math.floor(product.getPrice() * number));
                    product.setWeight(df.format(number * wei * product.getCount() * area));
                }
                if ("4".equals(kind)) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() + number * 50));
                    }
                }
                return chucklePrice(role, priceList, dto);
            // 牛皮纸手提袋
            case "11":
                List<Product> hanbagList = new ArrayList<Product>();
                craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
                // 没有尺寸，就是常规，查询数据库
                if (StringUtils.isEmpty(size) && !dto.getK().equals("4")) {
                    // 各常规尺寸展开的长宽--用于计算重量
                    double danjia = 0.0;
                    if ("0".equals(dto.getKind2Value())) {
                        length = 640.0;
                        height = 385.0;
                        if (count <= 10000) {
                            danjia = 0.88;
                        } else {
                            danjia = 0.78;
                        }
                    } else if ("1".equals(dto.getKind2Value())) {
                        length = 720.0;
                        height = 400.0;
                        if (count <= 10000) {
                            danjia = 1.064;
                        } else {
                            danjia = 0.9;
                        }
                    } else if ("2".equals(dto.getKind2Value())) {
                        length = 780.0;
                        height = 385.0;
                        danjia = 1.11;
                    }
                    // 第一位添加自定义数量的价格
                    if (dto.isDiyCount() && count > 3000) {
                        Product dto2 = new Product();
                        dto2.setCount(count);
                        dto2.setPrice(Math.ceil(danjia * count));
                        priceList.add(dto2);
                    }
                    if ("2".equals(dto.getKindValue())) {
                        dto.setKindValue("0");
                    }
                    hanbagList = productMapper.getThanPrice(dto);
                    // 把查出来的价格跟在自定义数量价格后面
                    for (int i = 0; i < hanbagList.size(); i++) {
                        if (priceList.size() > 0) {
                            if (count == hanbagList.get(i).getCount())
                                continue;
                        }
                        priceList.add(hanbagList.get(i));
                    }
                    // 给产品加上重量
                    for (Product product : priceList) {
                        product.setWeight(df.format(product.getCount() * 0.03));
                    }
                } else {
                    if ("4".equals(dto.getK())) {
                        String kind2Value = dto.getKind2Value();
                        String kindValue = dto.getKindValue();
                        int[] base_count = null;
                        double[] base_price = null;
                        length = 0.0;
                        height = 0.0;
                        width = 0.0;
                        List<String> kind2ValueList = Arrays.asList("11", "12", "31", "37", "38", "62");
                        if ("0".equals(kindValue) && !kind2ValueList.contains(kind2Value)) {
                            base_count = new int[]{100, 500, 1000, 2000, 3000, 5000, 10000};
                        } else {
                            base_count = new int[]{500, 1000, 2000, 3000, 5000, 10000};
                        }
                        FunReturnVo funReturnVo = new PriceUtils().getBagTagPrice(kind2Value, kindValue);
                        if (funReturnVo.getBase_price() != null) {
                            base_price = funReturnVo.getBase_price();
                            width = funReturnVo.getWidth();
                            height = funReturnVo.getHeight();
                            length = funReturnVo.getLength();
                        }

                        Product pro = null;
                        double color_price = 0;
                        double bei_price = 0;
                        if (dto.getShen_type() == 0) {
                            if (!"白色".equals(dto.getShen_color()) && !"黄牛皮本色".equals(dto.getShen_color())) {
                                color_price = 0.02;
                            }
                        }
                        if (dto.getShen_type() == 1) {
                            color_price = 0.06;
                            if ("白色".equals(dto.getShen_color()) || "黄牛皮本色".equals(dto.getShen_color())) {
                                color_price = 0.03;
                            }
                        }
                        if (dto.getZheye() != null && dto.getZheye() == 0) {
                            bei_price = 0.4;
                        }
                        if (dto.getZheye() != null && dto.getZheye() == 1) {
                            bei_price = 0.6;
                        }
                        if (dto.getZheye() != null && dto.getZheye() == 2) {
                            bei_price = 0.3;
                        }
                        for (int i = 0; i < base_count.length; i++) {
                            if (base_count[i] < count) {
                                continue;
                            }
                            if (priceList.size() > 2) {
                                break;
                            }
                            pro = new Product();
                            pro.setCount(base_count[i]);
                            pro.setPrice(Math.ceil(base_price[i] + (base_count[i] * color_price) + (base_count[i] * bei_price)));
                            priceList.add(pro);
                        }

                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() * number);
                            product.setWeight(df.format((width + height) * length * 2 * 0.25 * 1.5 * product.getCount() / 10000));
                        }

                        return chucklePrice(role, priceList, dto);
                    }
                    double sizeLength = 0.0;
                    double sizeWidth = 0.0;
                    // 厘米转成毫米
                    sizeLength = length = length * 10;
                    sizeWidth = width = width * 10;
                    height = height * 10;
                    length = (length + width) * 2 + 20;
                    height = (height + (width / 2 + 20)) + 40;
                    double price = 0.0;
                    int ikai = 0;
                    String kai = "";
                    String kaiDa = PriceUtils.getDa(length, height);
                    String kaiZheng = PriceUtils.getZheng(length, height);
                    int intDa = Integer.parseInt(kaiDa);
                    int intZheng = Integer.parseInt(kaiZheng);
                    int maxDa = intDa > intZheng ? intDa : intZheng;
                    if (intZheng >= intDa) {
                        kai = "+" + maxDa;
                    }
                    if (kai.contains("+")) {
                        kai = kai.replaceAll("[^(0-9)]", "");
                        ikai = Integer.parseInt(kai);
                        // 140克牛皮纸
                        if ("0".equals(kind)) {
                            price = 1.2;
                            // 250克牛皮纸
                        } else {
                            price = 2.2;
                        }
                    } else {
                        ikai = maxDa;
                        if ("0".equals(kind)) {
                            price = 1.4;
                        } else {
                            price = 2.8;
                        }
                    }
                    // !福袋/礼品袋
                    if (!"2".equals(dto.getK())) {
                        if (length >= 1000 || height >= 700) {
                            ikai = 1;
                            priceList = new PriceUtils().getPriceHanding(count, ikai, price, 2);
                        } else {
                            // 系数 5千-1万的*1.6 5千以下的*1.7
                            if (count <= 5000) {
                                priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.7);
                            } else {
                                priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6);
                            }
                        }
                    } else {
                        if (length >= 1000 || height >= 700) {
                            ikai = 1;
                        }
                        // 数量超过1万个，系数*1.6
                        if (count > 10000) {
                            priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6);
                        } else {
                            priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.8);
                        }
                    }
                    // 给产品加上重量
                    if ("0".equals(kind)) {
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.14 * 1.25));
                        }
                    } else {
                        for (Product product : priceList) {
                            double craft_price = 0.0;
                            if (craft_list.contains("烫金")) {
                                craft_price = Math.ceil(300 + 0.5 * product.getCount());
                                //craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number), 200);
                            }
                            if (craft_list.contains("双面")) {
                                craft_price = Math.ceil(300 + 0.5 * product.getCount()) * 2;
                                //craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number * 2), 200);
                            }
                            product.setPrice(Math.ceil(product.getPrice() + craft_price));
                            product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25));
                        }
                    }
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 250克白牛皮纸
            case "12":
                priceList = productMapper.getThanPrice(dto);
                if ("0".equals(dto.getKindValue())) {
                    length = 700.0;
                    height = 460.0;
                } else if ("1".equals(dto.getKindValue())) {
                    length = 680.0;
                    height = 440.0;
                } else if ("2".equals(dto.getKindValue())) {
                    length = 740.0;
                    height = 500.0;
                } else if ("3".equals(dto.getKindValue())) {
                    length = 820.0;
                    height = 510.0;
                } else if ("4".equals(dto.getKindValue())) {
                    length = 740.0;
                    height = 380.0;
                } else if ("5".equals(dto.getKindValue())) {
                    length = 800.0;
                    height = 390.0;
                } else if ("6".equals(dto.getKindValue())) {
                    length = 980.0;
                    height = 390.0;
                } else if ("7".equals(dto.getKindValue())) {
                    length = 1000.0;
                    height = 430.0;
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                // 根据款数重新算价格/计算重量
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                    product.setWeight(df.format(length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25));
                }
                return chucklePrice(role, priceList, dto);
            // 吊旗
            case "13":
                length = length * 10;
                width = width * 10;
                String value = dto.getKind1Label();
                if (length <= 285 && width <= 210 || length <= 210 && width <= 285) {
                    dto.setKind2Value("0");
                } else if (length <= 420 && width <= 285 || length <= 285 && width <= 420) {
                    dto.setKind2Value("1");
                } else if (length <= 570 && width <= 280 || length <= 280 && width <= 570) {
                    dto.setKind2Value("2");
                } else if (length <= 520 && width <= 370 || length <= 370 && width <= 520) {
                    dto.setKind2Value("3");
                } else if (length <= 570 && width <= 420 || length <= 420 && width <= 570) {
                    dto.setKind2Value("4");
                } else if (length <= 730 && width <= 560 || length <= 560 && width <= 730) {
                    dto.setKind2Value("5");
                }
                priceList = productMapper.getThanPrice(dto);
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    if (product.getCount() >= 50) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.6));
                    }
                    //product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                if ("2".equals(value)) {
                    for (Product product : priceList) {
                        product.setPrice(product.getPrice() - 20);
                    }
                }
                // 给产品加上重量
                if ("2".equals(dto.getKindValue())) {
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 0.3 * 0.86));
                    }
                } else if ("1".equals(dto.getKindValue())) {
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 0.2 * 0.86));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 0.157 * 0.86));
                    }
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 宣传单
            case "14":
                length = length * 10;
                width = width * 10;
                if ((length <= 140 && width <= 210) || (length <= 210 && width <= 140)) {
                    dto.setKind2Value("2");
                    priceList = productMapper.getThanPrice(dto);
                } else if ((length <= 210 && width <= 285) || (length <= 285 && width <= 210)) {
                    dto.setKind2Value("1");
                    priceList = productMapper.getThanPrice(dto);
                } else if ((length <= 420 && width <= 285) || (length <= 285 && width <= 420)) {
                    dto.setKind2Value("0");
                    priceList = productMapper.getThanPrice(dto);
                } else {
                    // 产品位数
                    double l1 = Math.ceil(length / 210);
                    double w1 = Math.ceil(width / 285);
                    double l2 = Math.ceil(width / 210);
                    double w2 = Math.ceil(length / 285);
                    int min = (int) Math.min(l1 * w1, l2 * w2);

                    // 157克铜版纸尺寸大于57厘米，多加一位
                    if (length > 570 || width > 570) {
                        if ("3".equals(kind))
                            min = min + 1;
                    }
                    // 设置位数
                    dto.setNum(min);
                    // 位数以A4纸为标准计算
                    dto.setKind2Value("1");
                    priceList = productMapper.diaoqiThanPrice(dto);
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    if ("菜单".equals(dto.getKind2Label())) {
                        product.setPrice(product.getPrice() + 10);
                    }
                }

                // 工艺----如果有覆膜（亮膜哑膜价格一致）
                /**
                 * 宣传单复膜计算方法 157克（含157克）以下材质不能复膜，200克以上材质单面复膜：长*宽（M)*数量*0.6元/平方米，双面*2.最低收50，双面80
                 */
                String[] craft = dto.getCraft();
                if (!StringUtils.isEmpty(craft)) {
                    if (craft.length > 1) {
                        if ("折页".equals(craft[0]) && ("压痕").equals(craft[1])) {
                            craft[0] = "折页压痕";
                            craft[1] = "";
                        }
                    }
                    for (int i = 0; i < craft.length; i++) {
                        if ("折页".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + (product.getCount() * 0.03 > 70 ? product.getCount() * 0.03 : 70) + 25 * dto.getZheye()));
                            }
                        }
                        if ("压痕".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + (product.getCount() * 0.05 > 90 ? product.getCount() * 0.05 : 90) + 25 * dto.getZheye()));
                            }
                        }
                        if ("折页压痕".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + (product.getCount() * 0.07 > 100 ? product.getCount() * 0.07 : 100) + 25 * dto.getZheye()));
                            }
                        }
                        if ("模切".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + 30 + 65 + 0.15 * product.getCount()));
                            }
                        }
                        if ("单面覆膜".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + (length / 1000 * width / 1000 * product.getCount() * 0.7 > 50 ? length / 1000 * width / 1000 * product.getCount() * 0.7 : 50)));
                            }
                        }
                        if ("双面覆膜".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + (length / 1000 * width / 1000 * product.getCount() * 0.7 * 2 > 80 ? length / 1000 * width / 1000 * product.getCount() * 0.7 * 2 : 80)));
                            }
                        }
                    }
                }

                // 给产品加上重量
                weight = 0.0;
                switch (kind) {
                    case "0":
                        weight = 0.157;
                        break;
                    case "1":
                        weight = 0.25;
                        break;
                    case "2":
                        weight = 0.2;
                        break;
                    case "3":
                        weight = 0.157;
                        break;
                }
                // 根据款数重新算价格/计算重量
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                    product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * weight));
                }
                return chucklePrice(role, priceList, dto);
            // 腰封200克/157克
            case "15":
                // 腰封少数量走的是吊旗少数量的价格
                length = length * 10;
                width = width * 10;
                if ((length <= 280 && width <= 65) || length <= 65 && width <= 280) {
                    dto.setKind2Value("0");
                } else if (length <= 420 && width <= 80 || length <= 80 && width <= 420) {
                    dto.setKind2Value("1");
                } else if (length <= 420 && width <= 100 || length <= 100 && width <= 420) {
                    dto.setKind2Value("2");
                } else if (length <= 560 && width <= 80 || length <= 80 && width <= 560) {
                    dto.setKind2Value("3");
                } else if (length <= 560 && width <= 100 || length <= 100 && width <= 560) {
                    dto.setKind2Value("4");
                } else if (length <= 630 && width <= 100 || length <= 100 && width <= 630) {
                    dto.setKind2Value("5");
                } else if (length <= 750 && width <= 80 || length <= 80 && width <= 750) {
                    dto.setKind2Value("6");
                } else if (length <= 630 && width <= 200 || length <= 200 && width <= 630) {
                    dto.setKind2Value("7");
                } else if (length <= 850 && width <= 90 || length <= 90 && width <= 850) {
                    dto.setKind2Value("8");
                } else if (length <= 850 && width <= 210 || length <= 210 && width <= 850) {
                    dto.setKind2Value("9");
                } else if ((length > 850 || width > 210) && (width > 850 || length > 210)) {
                    dto.setKind2Value("9");
                }
                if (count <= 10000)
                    priceList = productMapper.getThanPrice(dto);
                else
                    priceList = productMapper.thanThousandPrice(dto);

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                if (length > 500 || width > 500) {
                    // 200克铜版纸
                    if ("1".equals(kind)) {
                        for (Product product : priceList) {
                            if (product.getCount() > 2000) {
                                product.setPrice(product.getPrice() + 50);
                            }
                        }
                    }
                }

                craft = dto.getCraft();
                // 腰封自己的模切单独价格
                if (!StringUtils.isEmpty(craft)) {
                    for (int i = 0; i < craft.length; i++) {
                        if ("模切".equals(craft[i])) {
                            craft[i] = "腰封模切";
                            break;
                        }
                    }
                }
                // 加工艺的价格 --有覆膜，带尺寸过去（毫米）
                getCraft(dto, priceList, length, width, 0);
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "金属标":
                craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());

                if ("金属标".equals(dto.getKind())) {
                    priceList = new PriceUtils().getMetalPrice(priceList, width, length, count, number);
                    // 根据款数重新算价格
//                    for (Product product : priceList) {
//                        product.setPrice(Math.floor(product.getPrice() * number));
//                    }
                    for (Product product : priceList) {
                        if (dto.getCraftMo().equals("双色")) {
                            product.setPrice(Math.floor(product.getPrice() * 2));
                        } else if (dto.getCraftMo().equals("彩色(三色)")) {
                            product.setPrice(Math.floor(product.getPrice() * 3));
                        } else if (dto.getCraftMo().equals("彩色(四色)")) {
                            product.setPrice(Math.floor(product.getPrice() * 4));
                        }
                    }
                } else if ("UV转印贴".equals(dto.getKind()) || "宠物转印贴".equals(dto.getKind())) {
                    if (dto.getCraft() != null && craft_list.size() > 0 && (craft_list.contains("冷转印") || craft_list.contains("烫画"))) {
                        int[] quantitySteps = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
                        double paperLength = 0, paperWidth = 0;
                        double chu = 0.6;

                        if (craft_list.contains("冷转印")) {
                            paperLength = 20;
                            paperWidth = 27;
                        }
                        if (craft_list.contains("烫画")) {
                            paperLength = 100;
                            paperWidth = 57;
                            chu = 1;
                        }
                        if (length == paperLength || length == paperWidth) {

                        } else {
                            length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(chu)).doubleValue();
                        }
                        if (width == paperLength || width == paperWidth) {

                        } else {
                            width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(chu)).doubleValue();
                        }

                        //一张大纸能放几个
                        double num = Math.max(Math.min(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)), 1);
                        if (craft_list.contains("烫画")) {
                            num = Math.max(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length));

                        }
                        double baseCount = Math.max(Math.ceil(dto.getCount() * dto.getNumber() / num), 1);
                        double countNum = Math.max(Math.ceil(dto.getNumber() / num), 1);
                        int coNumber = dto.getCo_number() == null ? 1 : dto.getCo_number();
                        if (coNumber <= 0) {
                            coNumber = 1;
                        }

                        double price = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum, width * length * dto.getCount() * number);

                        Product pro = new Product();
                        pro.setCount(dto.getCount());
                        pro.setPrice(price);
                        priceList.add(pro);
                        for (int i = 0; i < quantitySteps.length; i++) {
                            if (dto.getCount() >= quantitySteps[i]) {
                                continue;
                            }
                            if (priceList.size() >= 4) {
                                break;
                            }
                            baseCount = Math.max(Math.ceil(quantitySteps[i] * dto.getNumber() / num), 1);
                            countNum = Math.max(Math.ceil(dto.getNumber() / num), 1);
                            double currentPrice = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum, width * length * quantitySteps[i] * number);

                            pro = new Product();

                            pro.setCount(quantitySteps[i]);
                            pro.setPrice(currentPrice);
                            priceList.add(pro);
                        }
                        double apprise = 0;
                        for (Product product : priceList) {

                            product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));

                            product.setWeight(df.format((width + 0.6) * (length + 0.6) * product.getCount() * number / 10000 * 0.5 + 0.5));
                            if (product.getPrice() < apprise) {
                                product.setPrice(apprise);
                            }
                            apprise = product.getPrice();
                        }

                        if ("宠物转印贴".equals(dto.getKind())) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() == 50 ? product.getPrice() : product.getPrice() * 1.3));
                                double number_price = 0;
                                double number_price_base = 3;
                                for (int i = 0; i < number; i++) {
                                    number_price += Math.max(1, number_price_base);
                                    number_price_base--;
                                }
                                if ("宠物转印贴".equals(dto.getKind()) && craft_list.contains("内部裁切")) {
                                    product.setPrice(Math.ceil(product.getPrice() + 5 * dto.getN_mq_num()));
                                }
                                product.setPrice(Math.ceil(product.getPrice() + number_price));
                            }
                        }

                        if (craft_list.contains("熨斗")) {
                            dto.setPo_number(dto.getPo_number() == null ? 1 : dto.getPo_number());
                            for (Product product : priceList) {
                                product.setPrice(product.getPrice() + 40 * Math.max(dto.getPo_number(), 1));
                            }
                        }
                        return chucklePrice(role, priceList, dto);
                    }
                    if (length <= 2) {
                        length = 2.0;
                    }
                    if (width <= 2) {
                        width = 2.0;
                    }

                    //if(role.indexOf("1000") > -1 || role.indexOf("1006") > -1) {//菇凉&卓胜uv单独报价 priceList = new PriceUtils().UVStickerLessPrice(length, width, count,number, dto.getCraft()); }else {

                    // 1006 1003 1005 1037 1058 1002 1033 1045 卓盛 航和 米笛儿 竹范 领淘文具 榆家 涛莱 拼多多uv单独报价
                    List<String> crafts = new ArrayList<>(dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()));
                    crafts.remove("刮板");
                    crafts.remove("熨斗");
                    crafts.remove("哑光");
                    crafts.remove("内部裁切");
                    if (crafts.size() > 0 && "烫金".equals(crafts.get(0))) {
                        crafts.remove(0);
                    }
                    String[] newCrafts = crafts.size() == 0 ? null : crafts.stream().toArray(String[]::new);
                    priceList = new PriceUtils().UVStickerSmallPriceV2(length, width, count, number, dto.getCraftMo(), newCrafts, role.indexOf("1045") > -1);
                    if (priceList.get(0).getCount() != count) {
                        priceList.get(0).setCount(count);
                    }
                    if (!StringUtils.isEmpty(newCrafts)) {
                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() * number);
                        }
                    } else {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));
                        }
                    }
                    if (craft_list.contains("刮板")) {
                        dto.setPcount(dto.getPcount() == null ? 1 : dto.getPcount());
                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() + 2 * Math.max(dto.getPcount(), 1));
                        }
                    }

                    if ("宠物转印贴".equals(dto.getKind())) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() == 50 ? product.getPrice() : product.getPrice() * 1.3));
                            double number_price = 0;
                            double number_price_base = 3;
                            for (int i = 0; i < number; i++) {
                                number_price += Math.max(1, number_price_base);
                                number_price_base--;
                            }
                            if ("宠物转印贴".equals(dto.getKind()) && craft_list.contains("内部裁切")) {
                                product.setPrice(Math.ceil(product.getPrice() + 5 * dto.getN_mq_num()));
                            }
                            product.setPrice(Math.ceil(product.getPrice() + number_price));
                        }
                    }
//                    double base = number < 6 && number > 1 ? 5 : 0;
                    double apprise = 0;
                    for (Product product : priceList) {
                        product.setWeight(df.format((width + 0.6) * (length + 0.6) * product.getCount() * number / 10000 * 0.5 + 0.5));
                        if (apprise > product.getPrice()) {
                            product.setPrice(apprise);
                        }
                        apprise = product.getPrice();
                    }

                    /* } */

                    /*
                     * if(count < 10) { priceList = new PriceUtils().UVStickerLessPrice(length, width, count,number, dto.getCraft()); }else { priceList = new PriceUtils().UVStickerPrice(length, width, count,number, dto.getCraftMo(), dto.getCraft()); }
                     */

                    area = length * width * count / 10000;

                    /*
                     * List<Product> priceList2 = new PriceUtils().UVStickerLessPrice(length, width, count, number, dto.getCraft()); // 比较哪个便宜 if ((priceList.get(0).getPrice() > priceList2.get(0).getPrice()) && priceList2.get(0).getPrice() > 0) { // Double minPrice = Math.min(priceList.get(0).getPrice(), // priceList2.get(0).getPrice()); priceList = new ArrayList<Product>(); Product product = new Product(); product.setCount(count); product.setPrice(priceList2.get(0).getPrice());
                     * product.setMsg("大张出货（2-3天发货）"); priceList.add(product); return priceList; }
                     */
                }
                return chucklePrice(role, priceList, dto);
            case "卡片少数量":
                String crafts[] = dto.getCraft();
                String craftShua = dto.getCraftShua();
                if (dto.getProTypeLabel().equals("菜单")) {
                    priceList = new CardPrice().getMenuPrice(dto.getKind1Value(), size, count, number, dto.getCraft());
                } else if (dto.getProTypeLabel().equals("婚礼报纸")) {
                    length = length * 10 + 4;
                    width = width * 10 + 4;
                    double price = 50;
                    double designPrice = 30;
                    double zhang = 6;
                    l = 420 + 4;
                    w = 285 + 4;
                    // 一张l/w 大的纸张能做多少个此类尺寸的产品
                    double max = Math.max(Math.floor(l / length) * Math.floor(w / width), Math.floor(l / width) * Math.floor(w / length));
                    // 报的数量需要多少张大纸
                    // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                    int num = (int) Math.ceil(count * number / max);
                    price = price + designPrice * number;
                    if (num > 1) {
                        price += zhang * num;
                    }
                    Product dto2 = new Product();
                    dto2.setCount(count);
                    dto2.setPrice(Math.ceil(price));
                    priceList.add(dto2);
                } else if (dto.getProTypeLabel().equals("种子纸")) {
                    int av_count = count;

                    double unitPrice = 0;
                    if (count <= 50) {
                        unitPrice = 140;
                    } else if (count > 50 && count <= 100) {
                        unitPrice = 130;
                    } else if (count > 100 && count <= 200) {
                        unitPrice = 120;
                    } else if (count > 200 && count <= 500) {
                        unitPrice = 110;
                    } else if (count > 500 && count <= 1000) {
                        unitPrice = 100;
                    } else if (count > 1000 && count <= 2000) {
                        unitPrice = 95;
                    } else {
                        unitPrice = 90;
                    }
                    if ("4".equals(dto.getZ3type())) {
                        if (count <= 50) {
                            unitPrice = 160;
                        } else if (count > 50 && count <= 100) {
                            unitPrice = 155;
                        } else if (count > 100 && count <= 200) {
                            unitPrice = 150;
                        } else if (count > 200 && count <= 500) {
                            unitPrice = 145;
                        } else if (count > 500 && count <= 1000) {
                            unitPrice = 140;
                        } else if (count > 1000 && count <= 2000) {
                            unitPrice = 135;
                        } else {
                            unitPrice = 130;
                        }
                    }
                    double price = Math.ceil((length * width * count * unitPrice) / 10000);//价格计算尺寸*数量*200/10000

                    if (!StringUtils.isEmpty(crafts) && Arrays.asList(crafts).contains("编码")) {//起步价10
                        price += Math.max(count * 0.5, 10);
                    }
                    if (!StringUtils.isEmpty(crafts) && Arrays.asList(crafts).contains("打孔")) {
                        price += Math.max(count * 0.2, 10);
                    }
                    if (!StringUtils.isEmpty(crafts) && Arrays.asList(crafts).contains("手撕线")) {
                        price += Math.max(count * 0.2, 10);
                    }
                    if (!StringUtils.isEmpty(crafts) && Arrays.asList(crafts).contains("压痕")) {
                        price += Math.max(count * 0.2, 10);
                    }

                    price = price * number;//款数翻倍
                    price = Math.max(price, 50);

                    if (!StringUtils.isEmpty(crafts) && Arrays.asList(crafts).contains("装opp袋")) {
                        price += Math.ceil(Math.max(count * 0.15 * number, 5));
                    }

//                    if ("4".equals(dto.getZ3type())) {
//                        price += 100;
//                    }
                    craft_list = crafts != null ? Arrays.asList(crafts) : new ArrayList<>();
                    if (craft_list.size() > 0 && craft_list.contains("绳子")) {
                        price += Math.max(5, Math.ceil(0.1 * number * count));
                    }
                    if (craft_list.size() > 0 && craft_list.contains("葫芦针")) {
                        price += Math.max(Math.ceil(0.04 * number * count), 5);
                    }
                    if (craft_list.size() > 0 && craft_list.contains("棉绳")) {
                        price += Math.max(Math.ceil(0.1 * number * count), 5);
                    }
                    Product dto2 = new Product();
                    dto2.setCount(av_count);
                    dto2.setWeight(df.format(number * (length / 100) * (width / 100) * av_count * 0.3 * 0.86));
                    dto2.setPrice(Math.ceil(price));
                    priceList.add(dto2);
                } else if (!StringUtils.isEmpty(crafts) && crafts[crafts.length - 1].indexOf("烫金") > -1) {
                    // 出血（一边2毫米）
                    length = length * 10 + 4;
                    width = width * 10 + 4;
                    double price = 0.0;
                    // 第一张价格
                    double fixPrice = 0.0;
                    // 每张多少钱
                    double zhang = 0.0;
                    // 设计费 *元/款
                    double designFee = 0.0;
                    // 模切费
                    double cutFee = 0.0;
                    if ("异形卡片".equals(dto.getKind()) && !StringUtils.isEmpty(dto.getCraft())) {
                        fixPrice = 110.0;
                        zhang = 8;
                    } else {
                        fixPrice = 100.0;
                        if ("单面印刷".equals(craftShua)) {
                            zhang = 5;
                        } else {
                            zhang = 6;
                        }
                    }
                    // 设计费不带出血的尺寸
                    if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
                        designFee = 8;
                    } else if ((length - 4 <= 140 && width - 4 <= 100) || (length - 4 <= 100 && width - 4 <= 140)) {
                        designFee = 16;
                    } else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
                        designFee = 15;
                    } else if ((length - 4 <= 285 && width - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
                        designFee = 35;
                    } else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
                        designFee = 50;
                    }
                    l = 420 + 4;
                    w = 285 + 4;
                    // 一张l/w 大的纸张能做多少个此类尺寸的产品
                    double max = Math.max(Math.floor(l / length) * Math.floor(w / width), Math.floor(l / width) * Math.floor(w / length));
                    // 报的数量需要多少张大纸
                    // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                    int num = (int) Math.ceil(count / max);
                    price = fixPrice + (num - 5 > 0 ? num - 5 : 0) * zhang + designFee + cutFee;
                    Product dtos = new Product();
                    dtos.setCount(count);
                    dtos.setPrice(Math.ceil(price));
                    priceList.add(dtos);
                    for (int i = 0; i < crafts.length; i++) {
                        if ("烫金".equals(crafts[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + num * 25));
                            }
                        } else if ("彩色印刷+烫金".equals(crafts[i])) {// 少数量卡片带烫金工艺，每张烫金+35块(1张起收)
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + num * 35));
                            }
                        }
                    }
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * number));
                    }
                } else {
                    // 出血（一边2毫米）
                    length = length * 10 + 4;
                    width = width * 10 + 4;
                    // -300克/200克/157克少数量价格+重量+工艺+款数价格
                    l = 0.0;
                    w = 0.0;
                    double price = 0.0;
                    // 第一张价格
                    double fixPrice = 0.0;
                    // 每张多少钱
                    double zhang = 0.0;
                    // 设计费 *元/款
                    double designFee = 0.0;
                    // 模切费
                    double cutFee = 0.0;

                    /** ======= 婚礼卡费用 ======= */
                    // 5张以内价格
                    double fixPrice9 = 0.0;
                    // 每增加1张多少钱
                    double zhang9 = 0.0;
                    // 设计费
                    double designFee9 = 0.0;
                    // 模切费
                    double cutFee9 = 0.0;
                    // if ((length <= 285 && width <= 210) || (length <= 210 && width <= 285)) {
                    // fixPrice = 40.0;
                    // zhang = 8;
                    // l = 420;
                    // w = 285;
                    // fixPrice9 = 50;
                    // zhang9 = 8;
                    // } else
                    if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
                        if ("特种纸名片".equals(dto.getKind())) {
                            fixPrice = 50.0;
                            zhang = 10;

                            if (crafts != null) {
                                List<String> craftList = Arrays.asList(crafts);
                                if (craftList.contains("模切")) {
                                    zhang = 18;
                                }
                            }

                        } else if (("异形卡片".equals(dto.getKind()) && !StringUtils.isEmpty(dto.getCraft())) || (!StringUtils.isEmpty(dto.getCraft()) && Arrays.asList(dto.getCraft()).contains("异形"))) {
                            fixPrice = 32.0;
                            zhang = 8;
                        } else {
                            fixPrice = 30.0;
						/*if ("单面印刷".equals(craftShua)) {
							zhang = 8;
						} else {*/
                            zhang = 6;
                            /*}*/
                        }
                        l = 420;
                        w = 285;
                        fixPrice9 = 40;
                        zhang9 = 6;
                        // 婚礼卡，直角工艺一张5元
                        if (!StringUtils.isEmpty(dto.getCraft())) {
                            craft = dto.getCraft();
                            if ("直角".equals(craft[0])) {
                                zhang9 = 5;
                            }
                        }
                    } else if ((length - 4 <= 570 && width - 4 <= 420) || (length - 4 <= 420 && width - 4 <= 570)) {
                        if ("特种纸名片".equals(dto.getKind())) {
                            return null;
                        }
                        fixPrice = 60.0;
                        zhang = 8;
                        cutFee = 50;
                        if (!StringUtils.isEmpty(dto.getCraft()))
                            cutFee = 100;
                        l = 570;
                        w = 420;
                        fixPrice9 = 90;
                        zhang9 = 8;
                        cutFee9 = 150;
                    } else if ((length - 4 <= 730 && width - 4 <= 530) || (length - 4 <= 530 && width - 4 <= 730)) {
                        fixPrice = 100.0;
                        if ("特种纸名片".equals(dto.getKind())) {
                            return null;
                        }
                        if ("单面印刷".equals(craftShua)) {
                            zhang = 5;
                        } else {
                            zhang = 6;
                        }
                        cutFee = 50;
                        if (!StringUtils.isEmpty(dto.getCraft()))
                            cutFee = 100;
                        l = 730;
                        w = 530;
                        fixPrice9 = 100;
                        zhang9 = 10;
                        cutFee9 = 150;
                    }
                    /*
                     * if (!"特种纸名片".equals(dto.getKind()) && ("异形卡片".equals(dto.getKind()) || !StringUtils.isEmpty(dto.getCraft()))) { zhang = 7; }
                     */
                    /*
                     * 婚礼卡设计费成品尺寸90X54MM以内每款收10元 140X100MM以内每款收15元 210X140MM以内30元 210X285MM以内40元 420X285MM以内60元 大于420X285MM80元
                     */
                    // 设计费不带出血的尺寸
                    if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
                        designFee = 8;
                        designFee9 = 10;
                    } /*else if ((length - 4 <= 140 && width - 4 <= 100) || (length - 4 <= 100 && width - 4 <= 140)) {
					designFee = 16;
					designFee9 = 15;
				}*/ else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
                        designFee = 10;
                        designFee9 = 15;
                    } else if ((length - 4 <= 285 && width - 4 - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
                        designFee = 30;
                        designFee9 = 40;
                    } else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
                        designFee = 45;
                        designFee9 = 60;
                    } else {
                        designFee = 45;
                        designFee9 = 80;
                    }
                    if ("腰封".equals(dto.getKind())) {
                        zhang = 8;
                    }
                    if ("特种纸名片".equals(dto.getKind())) {
                        zhang = 16;
                    }
                    // 一张l/w 大的纸张能做多少个此类尺寸的产品
                    double max = 1;
                    if (length == 424 || length == 289 || width == 424 || width == 289) {
                        max = Math.max(Math.floor(l / (length - 4)) * Math.floor(w / (width - 4)), Math.floor(l / (width - 4)) * Math.floor(w / (length - 4)));
                    } else {
                        max = Math.max(Math.floor(l / length) * Math.floor(w / width), Math.floor(l / width) * Math.floor(w / length));
                    }
                    max = Math.max(max, 1);
                    // 报的数量需要多少张大纸
                    // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                    int num = (int) Math.ceil(count * number / max);
                    // 婚礼卡
                    if ("婚礼卡".equals(dto.getKind()) || "抽奖卡".equals(dto.getKind())) {
                        // 5张以内价格 + 每张费用（第6张起收）+ 设计费 * 款数 + 模切费 + 0.1 * 总数量 （排号费）
                        price = fixPrice9 + (num - 5 > 0 ? num - 5 : 0) * zhang9 + designFee9 + cutFee9 + 0.1 * count * number;
                    } else {
                        price = fixPrice + (num - 1) * zhang + designFee + cutFee;
                    }
                    if ("刮刮卡".equals(dto.getKind())) {
                        List<String> size1 = new ArrayList();
                        size1.add("70*50");
                        size1.add("35*58");
                        size1.add("41*72");
                        size1.add("60*25");
                        size1.add("15*48");
                        double sizePrice = 0.2 * count * number;
                        if (size1.contains(dto.getSize1())) {
                            sizePrice = Math.max(sizePrice, 5);
                        }
                        price = price + sizePrice;
                    }
                    Product dto2 = new Product();
                    dto2.setCount(count);
                    dto2.setPrice(Math.ceil(price));
                    priceList.add(dto2);
                    // 模切工艺
                    craft = dto.getCraft();
                    if (!StringUtils.isEmpty(craft)) {
                        for (int i = 0; i < craft.length; i++) {
                            if ("模切".equals(craft[i])) {
                                for (Product product : priceList) {
                                    product.setPrice(product.getPrice());// + cutFee
                                }
                            }
                            // 少数量卡片带烫金工艺，每张烫金+25块(1张起收)
                            /*
                             * if ("烫金".equals(craft[i])) { for (Product product : priceList) { product.setPrice(product.getPrice() + num * 25); } } else if ("彩色印刷+烫金".equals(craft[i])) {// 少数量卡片带烫金工艺，每张烫金+35块(1张起收) for (Product product : priceList) { product.setPrice(product.getPrice() + num * 35); } }
                             */
                        }
                    }
                    if ("直角卡片".equals(dto.getKind()) && ((width > 42 && length > 28.5) || (width > 28.5 && length > 42))) {
                        for (Product product : priceList) {
                            product.setPrice(Math.max(Math.ceil(product.getPrice() * 0.85), fixPrice + designFee));
                        }
                    }
                    if ("1".equals(dto.getKindValue())) {
                        // 给产品加上重量 扣除出血的4毫米
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * (length - 4) / 1000 * (width - 4) / 1000 * product.getCount() * 0.2 * 0.86));
                        }
                    } else {
                        // 给产品加上重量
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * (length - 4) / 1000 * (width - 4) / 1000 * product.getCount() * 0.3 * 0.86));
                        }
                    }
                }
                if (dto.getCraft() != null && ("异形卡片".equals(dto.getKind()) || "直角卡片".equals(dto.getKind()) || "贺卡".equals(dto.getKind()) || "特种纸名片".equals(dto.getKind()))) {
                    double peijianPrice = 0;
                    if (Arrays.binarySearch(dto.getCraft(), "配葫芦针") > -1) {
                        peijianPrice = 0.03;
                    }
                    if (Arrays.binarySearch(dto.getCraft(), "配棉绳") > -1) {
                        peijianPrice = 0.05;
                    }
                    if (Arrays.binarySearch(dto.getCraft(), "配尼龙绳") > -1) {
                        peijianPrice = 0.01;
                        if ("红色绳子".equals(dto.getShen_color())) {
                            peijianPrice = 0.02;
                        }
                    }
                    if (Arrays.binarySearch(dto.getCraft(), "配弹力绳") > -1) {
                        peijianPrice = 0.05;
                    }

                    for (Product product : priceList) {
                        if (peijianPrice > 0) {
                            product.setPrice(Math.ceil(product.getPrice() + peijianPrice * dto.getCount() * dto.getNumber() + 5));
                        }
                    }
                    if (Arrays.binarySearch(dto.getCraft(), "配流苏") > -1) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() + Math.max(5, 3 * dto.getCo_number())));
                        }
                    }
                }

                if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) {
                    if (number > 1) {
                        double designFee = 0;
                        if (role.contains("1053")) {
                            designFee = 5;
                        }
                        if (dto.getP() == 1) {
                            designFee += 0.6;
                        } else {
                            if (!dto.getProTypeLabel().equals("婚礼报纸") && !dto.getProTypeLabel().equals("菜单")) {
                                designFee += 5.5;
                            }
                            if (dto.getProTypeLabel().equals("菜单") || dto.getProTypeLabel().equals("婚礼报纸")) {
                                designFee += 17;
                            }
                        }

                        designFee = designFee * (number - 1);
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() + designFee));
                        }
                    }
                } else {

                    //第二款开始的设计费按照式设计内容
                    if (!dto.getProTypeLabel().equals("婚礼报纸") && !dto.getProTypeLabel().equals("菜单") && number > 1) {
                        double desFee = 0;
                        if (dto.getP() == 1) {
                            desFee = 0.6;
                        } else if (dto.getP() == 2 || dto.getP() == 3) {
                            desFee = 0.8;
                        } else if (dto.getP() == 4) {
                            desFee = 1.2;
                        } else if (dto.getP() == 5) {
                            desFee = 2;
                        } else {
                            desFee = 5.5;
//                            int min = getNumAdd((length - 4) / 10, (width - 4) / 10);
//                            if (min == 1) {
//                                desFee = 7;
//                            }
//                            if (min == 2) {
//                                desFee = 10;
//                            }
//                            if (min == 3) {
//                                desFee = 14;
//                            }
//                            if (min == 4) {
//                                desFee = 18;
//                            }
                        }

                        for (Product product : priceList) {
                            product.setPrice(Math.floor(product.getPrice() + desFee * (number - 1)));
                        }
                    }
                }


                return chucklePrice(role, priceList, dto);
            // 便签本/联单
            case "16":
                length = length * 10;
                width = width * 10;
                if ("联单".equals(dto.getNotePaperKind())) {
                    if ((length <= 130 && width <= 95) || length <= 95 && width <= 130) {
                        dto.setKindValue("0");
                    } else if (length <= 140 && width <= 100 || length <= 100 && width <= 140) {
                        dto.setKindValue("1");
                    } else if (length <= 175 && width <= 95 || length <= 95 && width <= 175) {
                        dto.setKindValue("2");
                    } else if (length <= 210 && width <= 95 || length <= 95 && width <= 210) {
                        dto.setKindValue("3");
                    } else if (length <= 185 && width <= 130 || length <= 130 && width <= 185) {
                        dto.setKindValue("4");
                    } else if (length <= 210 && width <= 140 || length <= 140 && width <= 210) {
                        dto.setKindValue("5");
                    } else if (length <= 260 && width <= 185 || length <= 185 && width <= 260) {
                        dto.setKindValue("6");
                    } else if (length <= 285 && width <= 210 || length <= 210 && width <= 285) {
                        dto.setKindValue("7");
                    } else if (length <= 370 && width <= 260 || length <= 260 && width <= 370) {
                        dto.setKindValue("8");
                    } else if (length <= 420 && width <= 285 || length <= 285 && width <= 420) {
                        dto.setKindValue("9");
                    }
                } else if ("稿纸/便签本/票本(每本100张)".equals(dto.getNotePaperKind())) {
                    if ((length <= 130 && width <= 90) || length <= 90 && width <= 130) {
                        dto.setKindValue("10");
                    } else if (length <= 140 && width <= 100 || length <= 100 && width <= 140) {
                        dto.setKindValue("11");
                    } else if (length <= 185 && width <= 130 || length <= 130 && width <= 185) {
                        dto.setKindValue("12");
                    } else if (length <= 210 && width <= 140 || length <= 140 && width <= 210) {
                        dto.setKindValue("13");
                    } else if (length <= 260 && width <= 185 || length <= 185 && width <= 260) {
                        dto.setKindValue("14");
                    } else if (length <= 285 && width <= 210 || length <= 210 && width <= 285) {
                        dto.setKindValue("15");
                    }
                } else if ("彩胶纸".equals(dto.getNotePaperKind())) {
                    dto.setKindValue("16");
                    if ("单面".equals(dto.getCraftMo())) {
                        dto.setKind2Value("6");
                    } else {
                        dto.setKind2Value("7");
                    }
                    priceList = productMapper.getThanPrice(dto);
                } else {
                    dto.setKindValue("17");
                    priceList = productMapper.getThanPrice(dto);
                }
                if ("联单".equals(dto.getNotePaperKind()) || "稿纸/便签本/票本(每本100张)".equals(dto.getNotePaperKind())) {
                    if (count <= 1000)
                        priceList = productMapper.getThanPrice(dto);
                    else
                        priceList = productMapper.notePaperPrice(dto);
                    // 数据库中是单价（成本价），需要*数量*利润
                    if ("联单".equals(dto.getNotePaperKind())) {
                        for (Product product : priceList) {
                            if (product.getCount() == 20) {
                                product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.8));
                            } else {
                                product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.5));
                            }
                        }
                    } else {
                        if ("10".equals(dto.getKindValue()) || "11".equals(dto.getKindValue())) {
                            for (Product product : priceList) {
                                if (product.getCount() == 10 || product.getCount() == 100 || product.getCount() == 200) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.5));
                                } else if (product.getCount() == 20) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.8));
                                } else if (product.getCount() == 30) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 3));
                                } else if (product.getCount() == 50) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.6));
                                } else if (product.getCount() == 500 || product.getCount() == 1000) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2));
                                } else {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 1.8));
                                }
                            }
                        } else if ("12".equals(dto.getKindValue()) || "13".equals(dto.getKindValue())) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.5));
                            }
                        } else if ("14".equals(dto.getKindValue()) || "15".equals(dto.getKindValue())) {
                            for (Product product : priceList) {
                                if (product.getCount() == 10) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.3));
                                } else if (product.getCount() == 20) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2.1));
                                } else if (product.getCount() == 30 || product.getCount() == 50 || product.getCount() == 100) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 2));
                                } else if (product.getCount() == 200 || product.getCount() == 500 || product.getCount() == 1000) {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 1.8));
                                } else {
                                    product.setPrice(Math.ceil(product.getPrice() * product.getCount() * 1.8));
                                }
                            }
                        }

                    }
                    // 加上重量(二联单每本100份（50份），三联单每本90份（30份），四联单每本100页（25份）)
                    // 三联单
                    if ("1".equals(kind2)) {
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 1.08 * 0.05 * 90));
                        }
                    } else {
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 1.08 * 0.05 * 100));
                        }
                    }
                } else {
                    if (count <= 10000) {
                        priceList = productMapper.getThanPrice(dto);
                    } else {

                        priceList = productMapper.thanThousandPrice(dto);
                    }

                    // 数据库中是（成本价），需要*利润
                    for (Product product : priceList) {
                        if (product.getCount() <= 1000) {
                            product.setPrice(Math.ceil(product.getPrice() * 2.5));
                        } else {
                            product.setPrice(Math.ceil(product.getPrice() * 2));
                        }
                    }
                    // 加上重量
                    if ("红头文件".equals(dto.getNotePaperKind())) {
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 0.08));
                        }
                    } else {
                        // 彩胶纸
                        for (Product product : priceList) {
                            product.setWeight(df.format(number * length / 1000 * width / 1000 * product.getCount() * 0.07));
                        }
                    }
                }

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 联单，且选择了【垫板】工艺
                // 21*14cm内，+5毛钱一本，超过+8毛一本
                if ("联单".equals(dto.getNotePaperKind()) && !StringUtils.isEmpty(dto.getCraft())) {
                    craft = dto.getCraft();
                    for (int i = 0; i < craft.length; i++) {
                        if ("垫板".equals(craft[i])) {
                            if (length <= 210 && width <= 140 || length <= 140 && width <= 210) {
                                for (Product product : priceList) {
                                    product.setPrice(Math.ceil(product.getPrice() + product.getCount() * 0.5));
                                }
                            } else {
                                for (Product product : priceList) {
                                    product.setPrice(Math.ceil(product.getPrice() + product.getCount() * 0.8));
                                }
                            }
                        } else if ("封皮".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + product.getCount() * 0.5));
                            }
                        } else if ("彩色".equals(craft[i])) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.8));
                            }
                        }
                    }
                } else if ("稿纸/便签本/票本(每本100张)".equals(dto.getNotePaperKind()) && !StringUtils.isEmpty(dto.getCraft())) {
                    craft = dto.getCraft();
                    for (int i = 0; i < craft.length; i++) {
                        if ("封皮".equals(craft[i]) || "垫板".equals(craft[i])) {
                            for (Product product : priceList) {
                                int bs = 1;
                                if (product.getCount() > 100) {
                                    if (product.getCount() % 100 > 0) {
                                        bs = product.getCount() / 100 + 1;
                                    } else {
                                        bs = product.getCount() / 100;
                                    }
                                }
                                product.setPrice(Math.ceil(product.getPrice() + bs * 20));
                            }
                        }
                    }
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }

                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 海报（款数*个数=个数）
            case "17":
                // 贡缎布
                crafts_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
                if ("7".equals(kind)) {
                    priceList = PriceUtils.satinClothPrice(kind2, length, width, count, number);
                    if (dto.getYaheng() != null && dto.getYaheng() > 0) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() + dto.getYaheng() * 15));
                        }
                    }
                    for (Product product : priceList) {
                        product.setWeight(df.format(0.165 * length * width * product.getCount() / 10000 * number));
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("6".equals(kind)) {// 条幅craftTiao

                    priceList = PriceUtils.bannerPrice(kind2, length, width, count, number, role);
                    /*
                     * if(length == 300 && width == 50) { }else if(width <= 80){ for(Product product:priceList) { product.setPrice(Math.ceil(product.getPrice() * 1.15 * 0.8)); } }else { for(Product product:priceList) { product.setPrice(Math.ceil(product.getPrice())); } }
                     */

                    if ("双喷".equals(dto.getCraftTiao())) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() * 1.5));
                        }
                    }
                    if (dto.getZheye() != null && dto.getZheye() > 0) {
                        for (Product product : priceList) {
                            product.setPrice(Math.ceil(product.getPrice() + dto.getZheye() * 15));
                        }
                    }
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * number));
                        product.setWeight(df.format(0.065 * length * width * product.getCount() / 10000 * number));
                        double other_price = 0;
                        if (width * length <= 50 * 50) {
                            if (number > 1) {
                                other_price = (count) * 5 * (number - 1) + (number - 1) * 5;
                            } else {
                                other_price = (count - 1) * 5;
                            }
                            product.setPrice(Math.ceil(40 + other_price));
                        }

                    }
                    if ((width == 50 && length == 300 || width == 300 && length == 50) && count > 1 && number == 1 && role.indexOf("1045") == -1) {
                        double basePrice = 10;
                        //印熊加5元
                        if (role.contains("1053")) {
                            basePrice = 5;
                        }
                        for (Product product : priceList) {
                            product.setPrice(product.getPrice() - basePrice);
                        }
                    }
                    if ((width == 50 && length == 300 || width == 300 && length == 50) && count == 1 && number == 1 && role.indexOf("1045") == -1) {
                        double basePrice = 10;
                        //印熊加5元

                        for (Product product : priceList) {
                            if (role.contains("1053")) {
                                basePrice = 5;
                            }
                            product.setPrice(Math.max(product.getPrice() - basePrice, 40));
                        }
                    }

                    return chucklePrice(role, priceList, dto);
                } else if ("5".equals(kind)) {// 刻字
                    Product pro = new Product();
                    pro.setCount(count);
                    pro.setPrice(Math.ceil(length * count * 0.32 > 40 ? length * count * 0.32 : 40));
                    priceList.add(pro);

                    // 根据款数重新算价格
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * number));
                    }
                    // 7.27 海报、合版封套 *1.15
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.15));
                    }
                    return chucklePrice(role, priceList, dto);
                } else if ("11".equals(kind)) {

                } else {
                    // 单位‘米’计算价格
                    if (!"4".equals(kind)) {
                        area = 0.0;
                        length = length / 100;
                        width = width / 100;
                        area = Double.valueOf(df.format(length * width * count));
                    }
                    // 裱板
                    if ("0".equals(kind) || "12".equals(kind)) {
                        priceList = new PosterPrice().acountPrice00(kind2, area, count, number);
                        for (Product product : priceList) {
                            if (crafts_list.contains("铁架支架")) {
                                product.setPrice(Math.ceil(product.getPrice() + 35 * dto.getZheye()));
                            }
                            if (crafts_list.contains("伸缩支架")) {
                                product.setPrice(Math.ceil(product.getPrice() + 10 * dto.getYaheng()));
                            }
                            if ("12".equals(kind)) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.2));
                            }
                        }

                    } else if ("1".equals(kind)) {// 室内写真
                        priceList = new PosterPrice().acountPrice01(kind2, area, count, number, width * 100, length * 100);
                    } else if ("2".equals(kind)) {// 户外写真
                        if ("24".equals(kind2)) {
                            double base_price = 0;
                            double price = 0.00;
                            length = length * 100;
                            width = width * 100;
                            if (dto.getSize().contains(",")) {//套餐
                                if ("100*30,100*45".equals(dto.getSize())) {
                                    base_price = 200;
                                }
                                if ("120*30,120*65".equals(dto.getSize())) {
                                    base_price = 230;
                                }
                                if ("150*30,150*65".equals(dto.getSize())) {
                                    base_price = 270;
                                }
                                if ("180*30,180*65".equals(dto.getSize())) {
                                    base_price = 300;
                                }
                            } else {
                                if ((width == 100 && length == 30) || (length == 100 && width == 30)) {//推荐尺寸
                                    base_price = 100;
                                }
                                if ((width == 100 && length == 45) || (length == 100 && width == 45)) {
                                    base_price = 120;
                                }
                                if ((width == 120 && length == 30) || (length == 120 && width == 30)) {
                                    base_price = 120;
                                }
                                if ((width == 120 && length == 65) || (length == 120 && width == 65)) {
                                    base_price = 130;
                                }
                                if ((width == 150 && length == 30) || (length == 150 && width == 30)) {
                                    base_price = 140;
                                }
                                if ((width == 150 && length == 65) || (length == 150 && width == 65)) {
                                    base_price = 150;
                                }
                                if ((width == 180 && length == 30) || (length == 180 && width == 30)) {
                                    base_price = 140;
                                }
                                if ((width == 180 && length == 65) || (length == 180 && width == 65)) {
                                    base_price = 180;
                                }
                            }
                            price = base_price * dto.getCount();
                            if (base_price == 0) {
                                area = 0.0;
                                area = width * length * dto.getCount() * 0.0001;
                                if (area <= 0.5) {
                                    price = area * 334;
                                }
                                if (area > 0.5 && area <= 0.6) {
                                    price = area * 280;
                                }
                                if (area > 0.6 && area <= 0.7) {
                                    price = area * 250;
                                }
                                if (area > 0.7 && area <= 0.8) {
                                    price = area * 220;
                                }
                                if (area > 0.8 && area <= 0.9) {
                                    price = area * 200;
                                }
                                if (area > 0.9) {
                                    price = area * 180;
                                }
                                price = Math.max(100, price);
                            }

                            Product pro = new Product();
                            pro.setCount(dto.getCount());
                            pro.setPrice(Math.ceil(price * number));
                            if (crafts_list.contains("刮板")) {
                                pro.setPrice(Math.ceil(price * number + 2 * dto.getPcount()));
                            }
                            priceList.add(pro);

                        } else {

                            priceList = new PosterPrice().acountPrice02(kind2, area, count, number, width * 100, length * 100);
                            for (Product product : priceList) {
                                if (crafts_list.contains("刮板")) {
                                    product.setPrice(Math.ceil(product.getPrice() + 2 * dto.getPcount()));
                                }
                            }
                        }
                    } else if ("3".equals(kind)) {// 布
                        if (kind2.equals("11") || kind2.equals("12") || kind2.equals("13")) {
                            priceList = new PriceUtils().getDbPrice(kind2, width * 100, length * 100, count, priceList, number);

                        } else if (kind2.equals("10")) {
                            length *= 100;
                            width *= 100;
                            if (width > 160) {
                                width = 160.0;
                            }
                            priceList = new PosterPrice().acountPrice03(kind2, length, width, area, count, number, dto.getCraftBu());
                            /*
                             * if(length == 300 && width == 50) { }else if(width <= 80){ for(Product product:priceList) { product.setPrice(Math.ceil(product.getPrice() * 1.15 * 0.8)); } }else { for(Product product:priceList) { product.setPrice(Math.ceil(product.getPrice())); } }
                             */
                            if (dto.getZheye() != null && dto.getZheye() > 0) {
                                for (Product product : priceList) {
                                    product.setPrice(Math.ceil(product.getPrice() + dto.getZheye() * 15));
                                }
                            }
                            for (Product product : priceList) {
                                product.setWeight(df.format(0.075 * length * width * product.getCount() / 10000 * number));
                            }
                        } else {
                            priceList = new PosterPrice().acountPrice03(kind2, length * 100, width * 100, area, count, number, dto.getCraftBu());
                        }

                        // 7.27 海报、合版封套 *1.15
                        // 除550灯布/双喷布
                        List<String> kind2_list = Arrays.asList("1", "2", "6", "7", "8", "10", "11", "12", "13");
                        if (!kind2_list.contains(kind2)) {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.15));
                            }
                        }
                    } else {// 展架
                        priceList = new PosterPrice().acountPrice04(kind2, count, number);
                        wei = 0.00;
                        //美式
                        if ("0".equals(kind2) || "1".equals(kind2) || "2".equals(kind2) || "3".equals(kind2) || "8".equals(kind2) || "9".equals(kind2)) {
                            wei = 2;
                        }
                        //门
                        if ("4".equals(kind2) || "6".equals(kind2) || "7".equals(kind2) || "10".equals(kind2) || "11".equals(kind2)) {
                            wei = 2.5;
                        }
                        //易拉宝
                        if ("12".equals(kind2) || "13".equals(kind2)) {
                            wei = 2;
                        }
                        for (Product product : priceList) {
                            product.setWeight(df.format(wei * product.getCount() * number));
                        }
                    }
                    if (number > 1 && width != null && length != null && width * length * 10000 < 40 * 50) {

                        if (("0".equals(kind) && "0".equals(kind2)) || "2".equals(kind)) {
                            double desFee = 0;
                            if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) {
                                if (dto.getP() == 1) {
                                    desFee = 0.6 * (number - 1);
                                } else {
                                    desFee = 25 * (number - 1);

                                }
                                for (Product product : priceList) {
                                    product.setPrice(Math.ceil(product.getPrice() + desFee));
                                }
                            } else {
                                if (dto.getP() == 1 || dto.getP() == 2 || dto.getP() == 3) {
                                    desFee = 3;
                                } else if (dto.getP() == 4) {
                                    desFee = 5;
                                } else if (dto.getP() == 5) {
                                    desFee = 6;
                                } else {
                                    desFee = 25;
                                }

                                for (Product product : priceList) {
                                    product.setPrice(Math.floor(product.getPrice() + desFee * (number - 1)));
                                }
                            }


                        }
                    }

                }
                return chucklePrice(role, priceList, dto);
            // 扇子
            case "18":
                if (dto.getKindValue().equals("5")) {
                    dto.setKindValue("0");
                    if (count <= 10000) {
                        priceList = productMapper.getThanPrice(dto);
                    } else {
                        priceList = productMapper.thanThousandPrice(dto);
                    }

                    dto.setKindValue("5");
                } else if (dto.getKindValue().equals("6")) {
                    int[] counts = new int[]{10, 100, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000};
                    double[] prices = new double[]{100, 734, 3500, 6666, 11000, 15000, 18000, 22000, 26000, 30000, 34000, 38000, 41000};
                    Product pro = null;
                    for (int i = 0; i < counts.length; i++) {
                        if (dto.getCount() > counts[i]) {
                            continue;
                        }
                        if (priceList.size() > 4) {
                            break;
                        }
                        pro = new Product();
                        pro.setCount(counts[i]);
                        pro.setPrice(prices[i]);
                        pro.setPriceMultiple(1d);
                        priceList.add(pro);
                    }

                } else if (!dto.getKindValue().equals("4")) {
                    if (count <= 10000) {
                        priceList = productMapper.getThanPrice(dto);
                    } else {
                        priceList = productMapper.thanThousandPrice(dto);
                    }
                } else {
                    String[] list = dto.getCraft();
                    if (list == null) {
                        dto.setKind1Value("1");
                    } else {
                        dto.setKind1Value("2");
                    }

                    if (count <= 10000) {
                        priceList = productMapper.getThanPrice(dto);
                    } else {
                        priceList = productMapper.notePaperPrice(dto);
                    }
                }

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }

                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                if (!StringUtils.isEmpty(dto.getCraft())) {
                    List<String> craftList = Arrays.asList(dto.getCraft());
                    if (craftList.contains("异形")) {
                        for (Product product : priceList) {
                            product.setPrice(Math.floor(product.getPrice() * 1.2));
                        }
                    }
                }
                // 异形工艺
                //getCraft(dto, priceList, null, null, 0);

                if (dto.getKindValue().equals("5")) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 0.1 * product.getCount()));
                    }
                }

                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                // 根据款数重新算重量（重量在数据库中）
                if (priceList.size() > 0 && !StringUtils.isEmpty(priceList.get(0).getWeight())) {
                    for (Product product : priceList) {
                        product.setWeight(df.format(Double.valueOf(product.getWeight()) * number));
                    }
                }
                return chucklePrice(role, priceList, dto);
            // 画册
            case "19":
                // 内页P数加上封面的4P
                dto.setPcount(dto.getPcount() + 4);
                if ("少数量".equals(dto.getKind())) {
                    priceList = new PictureAlbumPrice().getLessPrice(count, dto.getPcount());
                } else {
                    length = length * 10;
                    width = width * 10;
                    if (length <= 210 && width <= 140 || length <= 140 && width <= 210) {
                        if ("0".equals(kind2)) {
                            priceList = new PictureAlbumPrice().getPrice00(count, dto.getPcount());
                        } else if ("1".equals(kind2)) {
                            priceList = new PictureAlbumPrice().getPrice01(count, dto.getPcount());
                        } else {
                            priceList = new PictureAlbumPrice().getPrice02(count, dto.getPcount());
                        }
                    } else if (length <= 285 && width <= 210 || length <= 210 && width <= 285) {
                        if ("0".equals(kind2)) {
                            priceList = new PictureAlbumPrice().getPrice10(count, dto.getPcount());
                        } else if ("1".equals(kind2)) {
                            priceList = new PictureAlbumPrice().getPrice11(count, dto.getPcount());
                        } else {
                            priceList = new PictureAlbumPrice().getPrice12(count, dto.getPcount());
                        }
                    }
                    if (priceList.size() >= 4) {
                        priceList = priceList.subList(0, 4);
                    }
                    // 添加设计费.40元/P（封面4P也算设计费）
                    for (Product product : priceList) {
                        product.setPrice(product.getPrice() + dto.getPcount() * 40);
                    }
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }

                String[] craftList = dto.getCraft();
                if (craftList != null) {
                    if ("设计".equals(craftList[0])) {
                        // 设计费 = 20*p数
                        for (Product product : priceList) {
                            product.setPrice(Math.floor(product.getPrice() + dto.getPcount() * 20 * number));
                        }
                    }
                }

                return chucklePrice(role, priceList, dto);
            // 包装盒
            case "20":
                // 厘米转成毫米
                length = length * 10;
                width = width * 10;
                height = height * 10;
                // 价格
                double priceArr[] = {20, 15, 13, 10, 9, 9};
                // 数量
                int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
                // 双插盒
                if ("0".equals(kind)) {
                    // 长=（长+宽）*2+20
                    length = (length + width) * 2 + 20;
                    // 宽=（高+宽+宽+40）
                    width = height + width + width + 40;

                    // 双插盒展开超过650*500MM的另行报价
                    if (length >= 650 || width >= 500) {
                        return null;
                    }
                } else {// 飞机盒
                    // 长=（长+高*2*2）+10MM
                    length = (length + height * 2 * 2) + 10;
                    // 宽=（宽+高）*2+高+5MM）
                    width = (width + height) * 2 + height + 5;

                    // 飞机盒展开超过900*600MM的另行报价
                    if (length >= 900 || width >= 600) {
                        return null;
                    }
                }
                // 计算价格把毫米转成米
                length = length / 1000;
                width = width / 1000;
                Product pro = new Product();
                if (count > countArr[countArr.length - 1]) {
                    pro.setCount(count);
                    pro.setPrice(Math.ceil(length * width * count * priceArr[countArr.length - 1] > 1100 ? length * width * count * priceArr[countArr.length - 1] : 1100));
                    priceList.add(pro);
                } else {
                    for (int i = 0; i < countArr.length; i++) {
                        if (countArr[i] < count) {
                            continue;
                        }
                        pro = new Product();
                        pro.setCount(countArr[i]);
                        pro.setPrice(Math.ceil(length * width * countArr[i] * priceArr[i] > 1100 ? length * width * countArr[i] * priceArr[i] : 1100));
                        priceList.add(pro);
                    }
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 透明PVC名片
            case "21":
                if (count <= 10000) {
                    priceList = productMapper.getThanPrice(dto);
                } else {
                    priceList = productMapper.thanThousandPrice(dto);
                }

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setWeight(df.format(0.38 * 0.0855 * 1.7 * 0.054 * product.getCount() * number));
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 桌贴
            case "22":
                /*
                 * if ("0".equals(kind) || "10".equals(kind)) { priceList = new PriceUtils().getDeskSticker(priceList, width, length, count, number, dto.getCraftShua(), dto.getCraftJiao()); } else if ("1".equals(kind)) { // 产品的面积(平方米) area = length * width / 10000 * count; double price = 0.0; if (area <= 0.05) { price = 5000; } else if (area <= 0.1) { price = 1200; } else if (area <= 0.5) { price = 1000; } else if (area <= 0.8) { price = 800; } else if (area <= 1) { price = 600; } else if (area <=
                 * 1.5) { price = 400; } else { price = 300; } pro = new Product(); pro.setCount(count); pro.setPrice(Math.ceil(area * price > 100 ? area * price : 100)); priceList.add(pro); // 根据款数重新算价格 for (Product product : priceList) { product.setPrice(Math.floor(product.getPrice() * number)); } }
                 */
                /*
                 * if (priceList.size() >= 4) { priceList = priceList.subList(0, 4); }
                 */
                String[] ztCraft = {"背胶"};
                priceList = ZsPrice.getSmPrice(count, length, width, priceList, number, ztCraft, dto, role);
                for (Product product : priceList) {
                    if (dto.getKindValue().equals("0") || dto.getKindValue().equals("10")) {
                        wei = 0.38;
                    } else {
                        wei = 0.84;
                    }
                    product.setWeight(df.format(wei * length * width * product.getCount() / 10000 * 1.7 * number));
                }
                return chucklePrice(role, priceList, dto);
            // 0.38PVC亮光异型卡片
            case "PVC异型卡片":
                // 印刷价格
                area = length * width / 10000;
                priceList = new CardPrice().getPrice(count, area, dto.getKindValue());
                // 根据款数重新算价格

                for (Product product : priceList) {
                    if (dto.getKindValue().equals("3")) {// 0.76价格翻倍
                        product.setPrice(Math.ceil(product.getPrice() * 1.8));
                    }
                    if (dto.getKindValue().equals("4") || dto.getKindValue().equals("5")) {// 0.76价格翻倍
                        product.setPrice(Math.ceil(product.getPrice() * 1.8 * 1.2));
                    }

                }

                if ((length == 8 && width == 4) || (length == 4 && width == 8)) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * 1.2));
                    }
                }
                craft_list = Arrays.asList(dto.getCraft());
                for (Product product : priceList) {
                    double base = 1;
                    if (craft_list.contains("异形")) {
                        base = 1.5;
                    }
                    if (dto.getKindValue().equals("3")) {
                        wei = 0.76;
                    } else {
                        wei = 0.38;
                    }
                    product.setPrice(Math.floor(product.getPrice() * base * number));

                    product.setWeight(df.format(wei * length * width * 1.7 * product.getCount() / 10000 * number));
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 打印价格
                /*
                 * List<Product> priceList2 = new PriceUtils().getDeskSticker(new ArrayList<Product>(), width, length, count, number, dto.getCraftShua(), dto.getCraftJiao()); System.out.println(priceList.get(0).getPrice());
                 */
                /* System.out.println(priceList2.get(0).getPrice()); */
                // 比较哪个便宜
                /*
                 * if (priceList.get(0).getPrice() > priceList2.get(0).getPrice()) { // Double minPrice = Math.min(priceList.get(0).getPrice(), // priceList2.get(0).getPrice()); priceList = new ArrayList<Product>(); Product product = new Product(); product.setCount(count); product.setPrice(priceList2.get(0).getPrice()); priceList.add(product); }
                 */
                return chucklePrice(role, priceList, dto);
            // 滴塑
            case "23":
                priceList = PriceUtils.getDisuPrice(priceList, width, length, count, number, dto);
                return chucklePrice(role, priceList, dto);
            // 透明PVC名片---会员卡
            case "24":
                if (count <= 10000) {
                    priceList = productMapper.getThanPrice(dto);
                } else {
                    priceList = productMapper.thanThousandPrice(dto);
                }
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                getCraft(dto, priceList, null, null, 0);

                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setWeight(df.format(0.76 * 1.3 * 0.0855 * 0.054 * product.getCount() * number));
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 卡片-门挂牌
            case "25":
                priceList = productMapper.getThanPrice(dto);

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                craft = dto.getCraft();
                if (!StringUtils.isEmpty(craft)) {
                    for (int i = 0; i < craft.length; i++) {
                        // 门挂牌双面覆哑膜 ，比没覆膜价格*1.5倍
                        if ("双面覆哑膜".equals(craft[i])) {
                            // 产品价格倍数
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.5));
                            }
                        }
                    }
                }

                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 毕业证书
            case "26":
                priceList = new PriceUtils().getDiploma(count);
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 暖心贴
            case "27":
                priceList = getWarmStickerPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            // 彩色信纸
            case "彩色信纸":
                length = length * 10;
                width = width * 10;
                if (length <= 140 && width <= 100 || length <= 100 && width <= 140) {
                    dto.setKindValue("2");
                } else if (length <= 210 && width <= 140 || length <= 140 && width <= 210) {
                    dto.setKindValue("1");
                } else if (length <= 285 && width <= 210 || length <= 210 && width <= 285) {
                    dto.setKindValue("0");
                }
                priceList = productMapper.getThanPrice(dto);
                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }
                // 产品价格倍数
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                }
                /**
                 * 报价10本的*2.2 20本的*1.9 50本的*1.7 100本的*1.6 200本以上*1.5
                 */
                for (Product product : priceList) {
                    if (product.getCount() == 10) {
                        product.setPrice(Math.ceil(product.getPrice() * 2.1));
                    } else if (product.getCount() == 20) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.8));
                    } /*
                     * else if (product.getCount() == 50) { product.setPrice(Math.ceil(product.getPrice())); } else if (product.getCount() == 100) { product.setPrice(Math.ceil(product.getPrice() * 1.6)); } else if (product.getCount() >= 200) { product.setPrice(Math.ceil(product.getPrice() * 1.5)); }
                     */
                }

                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            // 复印纸
            case "复印纸":
                priceList = new PriceUtils().getCopyPaper(kind, kind2, kind3, count, size);
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "婚礼卡":
                priceList = new PriceUtils().getWeddingCardPrice(length, width, count, number, dto.getCraftMo(), dto.getCraftShua());
                return chucklePrice(role, priceList, dto);
            case "刮刮卡":
                // 选了【自定义尺寸】
                if (dto.isSwitchSize()) {

                } else {
                    // 300克铜版纸
                    dto.setKindValue("2");

                    // 不覆膜
                    dto.setKind1Value("0");
                    craft = dto.getCraft();
                    if (!StringUtils.isEmpty(craft)) {
                        for (int i = 0; i < craft.length; i++) {
                            if ("双面覆哑膜".equals(craft[i])) {
                                // 覆膜
                                dto.setKind1Value("1");
                                craft[i] = null;
                                break;
                            }
                        }
                    }
                    // 产品位数
                    int min = getNum(length, width);
                    // 根据位数算价格（最多4个位）
                    dto.setKind2Value(String.valueOf(min));
                    if (count <= 10000) {
                        priceList = productMapper.getThanPrice(dto);
                    } else {
                        priceList = productMapper.thanThousandPrice(dto);
                    }
                    // 产品价格倍数
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
                    }
                    if (!StringUtils.isEmpty(craft)) {
                        int isYx = 0;
                        for (int n = 0; n < craft.length; n++) {
                            if ("模切".equals(craft[n])) {
                                isYx = 1;
                            }
                        }
                        if (isYx == 1) {
                            for (Product product : priceList) {
                                double moPrice = product.getCount() * 0.06 > 40 ? product.getCount() * 0.06 : 40;
                                product.setPrice(Math.ceil(product.getPrice() + moPrice));
                            }
                        } else {
                            for (Product product : priceList) {
                                product.setPrice(Math.ceil(product.getPrice() + product.getCount() * 0.02));
                            }
                        }
                    }
                    // 刮刮膜价格。2分钱一张

                }
                // 加工艺的价格 --有覆膜，带尺寸过去（毫米）
                // getCraft(dto, priceList, null, null, 0);
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }

                return chucklePrice(role, priceList, dto);
            case "66":
                String craftTang = dto.getCraftTang().replace("双面烫银", "双面烫金");
                if (!kind.equals("500克黑卡")) {
                    kind = "500克带金边";
                    if (craftTang.indexOf("凹凸") > -1) {
                        dto.setKindValue("2");
                    } else {
                        dto.setKindValue("1");
                    }
                } else {
                    if (craftTang.indexOf("凹凸") > -1) {
                        dto.setKindValue("4");
                    } else {
                        dto.setKindValue("3");
                    }
                }


                if (count <= 10000) {
                    priceList = productMapper.getThanPrice(dto);
                }
                // 加工艺的价格 --有覆膜，带尺寸过去（毫米）
                /*getCraft(dto, priceList, null, null, 0);*/
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                    product.setWeight(df.format(0.09 * 0.054 * product.getCount() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "餐垫纸":
                priceList = new PriceUtils().getPlaceMatPrice(kind, length, width, count);
                craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
                // 根据款数重新算价格
                for (Product product : priceList) {
                    if (kind.equals("0")) {
                        wei = 0.08;
                    } else {
                        wei = 0.05;
                    }

                    product.setWeight(df.format(length * width * product.getCount() / 10000 * number * wei));
                    product.setPrice(Math.ceil(product.getPrice() * number * 1.3));
                    if (craft_list.contains("异形模切")) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.9));
                    }
                }
                return chucklePrice(role, priceList, dto);
            case "节目单":
                priceList = productMapper.getThanPrice(dto);
                if (StringUtils.isEmpty(dto.getCraft())) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() - 20));
                        product.setWeight(df.format(length * width * product.getCount() / 10000 * number * 0.3));
                    }
                }
                // 根据款数重新算价格
                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "硫酸纸吊牌":
                priceList = new PriceUtils().getAcidTagsPrice(length, width, dto.getSize1(), count);
                // 根据款数重新算价格
                area = length * width / 10000;
                String size1 = dto.getSize1();
                double length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
                double width1 = 0;
                if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
                    width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
                } else {
                    width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
                }
                double area1 = length1 * width1 / 10000;
                for (Product product : priceList) {
                    product.setWeight(df.format(product.getCount() * number * (0.135 * area + area1 * 0.3)));
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "杯垫":
                priceList = getBeiDianPrice(dto, width, length, role, kind2, kind);
                return chucklePrice(role, priceList, dto);
            case "锦旗":
                // 单价*产品数量*款数
                priceList = new PriceUtils().getJQPrice(kind3, number, width, length, count, priceList);
                return chucklePrice(role, priceList, dto);
            case "号码布":
                // 单价*产品数量*款数
                priceList = new PriceUtils().getHmbPrice(kind3, number, width, length, count, priceList);
                return chucklePrice(role, priceList, dto);
            case "彩旗":
                // 单价*产品数量*款数
                priceList = new PriceUtils().getCQPrice(number, width, length, count, priceList);
                return chucklePrice(role, priceList, dto);
            case "硫酸纸":
                priceList = getLiuSuanzhiPrice(dto, width, length, role, proType);
                return chucklePrice(role, priceList, dto);
            case "亚克力":
                priceList = new PriceUtils().getYklPrice(dto, number, width, length, count, priceList);
                for (Product product : priceList) {
                    if ((dto.getKind2Value().equals("4") || dto.getKind2Value().equals("5"))) {
                        if (dto.getCraftShua().equals("双面印刷")) {
                            product.setPrice(Math.floor(product.getPrice() * 1.8 * number));
                        } else {
                            product.setPrice(Math.floor(product.getPrice() * number));
                        }
                    } else {
                        product.setPrice(Math.floor(product.getPrice() * number));
                    }
                }
                return chucklePrice(role, priceList, dto);
            case "帆布":
                priceList = new PriceUtils().getFbPrice(dto, number, width, length, count, priceList);
                List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
                for (Product product : priceList) {
                    if (product.getCount() != null && number != null) {
                        if (carftList.contains("伸缩杆70-120CM")) {
                            product.setPrice(product.getPrice() + 2 * Math.max(dto.getPcount(), 1));
                        }
                        product.setWeight(df.format(0.28 * width * length * product.getCount() / 10000 * number));
                    }
                    if (width < 50 || length < 50) {
                        if (role.contains("1053")) {
                            product.setPrice(Math.ceil(product.getPrice() + number * 5));
                        }
                    }
                }
                return chucklePrice(role, priceList, dto);
            case "29"://慕斯垫
                priceList = productMapper.getMsdPrice(dto);

                if (priceList.size() >= 4) {
                    priceList = priceList.subList(0, 4);
                }

                if ("烫金带凹凸".equals(dto.getCraftTang())) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * 2));
                    }
                }

                for (Product product : priceList) {
                    product.setPrice(Math.floor(product.getPrice() * number));
                }

                if (kind.equals("0") || kind.equals("4") || kind.equals("5")) {
                    area = (double) (9 * 9);
                } else if (kind.equals("1")) {
                    area = (double) (9.5 * 9.5);
                } else {
                    area = (double) (12 * 8);
                }

                for (Product product : priceList) {
                    product.setWeight(df.format(0.8 * area * product.getCount() / 10000 * number));
                }

                return chucklePrice(role, priceList, dto);
            case "串旗":
                priceList = new PriceUtils().getCqPrice(width, length, count, number, priceList);
                if (dto.getCraft() != null) {
                    int type = 0;
                    for (int index = 0; index < dto.getCraft().length; index++) {
                        if ("木棍".equals(dto.getCraft()[index])) {
                            type = 1;
                        }
                    }
                    if (type == 1) {// 木棍多收3块
                        for (Product p : priceList) {
                            p.setPrice(p.getPrice() + 3 * number * count);
                        }
                    }
                }
                return chucklePrice(role, priceList, dto);
            case "桌布":
                width = width / 100;
                length = length / 100;
                priceList = new PriceUtils().getTableClothPrice(length, width, count, number, priceList);
                return chucklePrice(role, priceList, dto);
            case "仿古旗":
                area = length * width * count / 10000;
                priceList = new FgqPrice().getPrice(count, area, priceList, dto.getCraft(), dto.getKindValue(), number);
                for (Product product : priceList) {
                    if (dto.getCraft()[0].equals("单面")) {
                        product.setPrice(product.getPrice() > 40 ? product.getPrice() : 40);
                    } else {
                        product.setPrice(product.getPrice() > 45 ? product.getPrice() : 45);
                    }
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "手拉旗":
                priceList = getShouLaQiPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "筷子套":
                priceList = new KztPrice().getPrice(count, length, priceList);
                for (Product product : priceList) {
                    product.setWeight(df.format(length * 3 * number * 0.157));
                    product.setPrice(Math.floor(product.getPrice() * number));
                }
                return chucklePrice(role, priceList, dto);
            case "一次性纸杯":
                priceList = new PaperCupPrice().getPrice(count, priceList);
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() * number * 1.2));
                    product.setWeight(df.format(6 * product.getCount() / 1000 * number));
                }
                return chucklePrice(role, priceList, dto);
            case "PVC证件":
                // 价格按照大纸裁
                priceList = new ZsPrice().getPrice(count, length, width, priceList, number, dto.getCraftSheng());
                for (Product product : priceList) {
                    if (dto.getKindValue().equals("1") || dto.getKindValue().equals("2") || dto.getKindValue().equals("3")) {
                        wei = 0.84;
                    } else {
                        wei = 1;
                    }
                    length = length / 10;
                    width = width / 10;
                    product.setWeight(df.format(wei * length * width * product.getCount() / 10000 * number * 1.3));
                }
                return chucklePrice(role, priceList, dto);
            case "数码PVC":
                priceList = getsmPVCPrice(dto, width, length, role);
                return chucklePrice(role, priceList, dto);
            case "班旗":
                priceList = new BqPrice().getPrice(count, length, priceList, number, dto.getCraftShua(), dto.getCraft());
                List<String> craLists = !StringUtils.isEmpty(dto.getCraft()) ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
                wei = 0.0;
                if (craLists.contains("旗杆")) {
                    wei = 1;
                }
                for (Product product : priceList) {
                    if (craLists.contains("手绘")) {
                        product.setPrice(150.00 * number);
                    }
                    if (craLists.contains("伸缩旗杆")) {
                        product.setPrice(Math.ceil(product.getPrice() + dto.getPo_number() * 15));
                    }
                    product.setWeight(df.format(0.075 * length * width * product.getCount() / 10000 * number + product.getCount() * wei * number
                    ));
                }
                return chucklePrice(role, priceList, dto);
            case "卡贴":
                priceList = getkaTiePrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "会员卡卡套":
                priceList = new FerruleUtil().getPrice(length, count, priceList);
                if (number > 1) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() * number));
                    }
                }
                return chucklePrice(role, priceList, dto);
            case "手提杯托":
                priceList = getTuoBeiPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "天幕":
                priceList = getTianMuPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "挂布":
                priceList = getGuaBuPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "定制衫":
                priceList = getClotherPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "手绘":
                priceList = getShouhuiPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "奖牌":
                priceList = getMedalPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "防伪标":
                priceList = getantiLabelPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "透卡":
                priceList = getPETPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "澜达海报":
                priceList = getDalanPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "水标":
                priceList = getShuibiaoPrice(dto, length, width);
                return chucklePrice(role, priceList, dto);
            case "镭射吊牌":
                priceList = getLeiseDiaoPrice(dto, length, width);
                return chucklePrice(role, priceList, dto);
            case "刻字车贴":
                priceList = getCheTiePrice(dto, length, width);
                return chucklePrice(role, priceList, dto);
            case "胶带":
                priceList = getJiadaoPrice(dto, length, width);
                return chucklePrice(role, priceList, dto);
            case "特光不干胶":
                priceList = getLightPrice(dto, length, width);
                return chucklePrice(role, priceList, dto);
            case "淋膜纸":
                priceList = getLingmoPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "香薰卡":
                priceList = getaromatherapyPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "金属微章":
                priceList = getbadgePrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "冰箱贴":
                priceList = getfridgePrice(dto, width, length, role);
                return chucklePrice(role, priceList, dto);
            case "帆布袋":
                priceList = getCanvasBagPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "外卖盒":
                priceList = getTakeoutBoxPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "方巾纸":
                priceList = getHandkerPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "鼠标垫":
                priceList = getMousePadPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "手环":
                priceList = getWristBandPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "手提塑料袋":
                priceList = getPlasticBagPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "纸碗":
                priceList = getPaperBowlPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "挂画":
                priceList = getWallPaintingPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "电线胶":
                priceList = getWireTapePrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "包装纸":
                priceList = getWrappingPaper(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "撕撕乐":
                priceList = getTearingJoyPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "哑粉纸":
                priceList = getYaFenPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "UV打印亚克力":
                priceList = getUVDayinYKLPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "躺椅":
                priceList = getDeckCharitPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "钥匙扣":
                priceList = getKeychain(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "刺绣贴":
                priceList = getEmbroideredPatchPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            case "木浆棉":
                priceList = getWoodPulpCottonPrice(dto, width, length);
                return chucklePrice(role, priceList, dto);
            default:
                break;
        }
        return null;
    }

    private List<Product> getWoodPulpCottonPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();

        int count = dto.getCount();
        int number = dto.getNumber();

        double paperLength = 420;
        double paperWith = 297;

        width = width * 10 + 4;
        length = length * 10 + 4;
        // 一张l/w 大的纸张能做多少个此类尺寸的产品
        double max = Math.max(Math.floor(paperLength / length) * Math.floor(paperWith / width), Math.floor(paperLength / width) * Math.floor(paperWith / length));
        // 报的数量需要多少张大纸
        // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
        int num = (int) Math.ceil(count * number / Math.max(max, 1));
        double basePrice = 0;
        if (num <= 100) {
            basePrice = 40;
            basePrice = new PriceUtils().calcByTargetN(100, 40, 100, 40, num);
        } else if (num <= 300) {
            basePrice = 35;
            basePrice = new PriceUtils().calcByTargetN(100, 40, 300, 35, num);
        } else if (num <= 500) {
            basePrice = 30;
            basePrice = new PriceUtils().calcByTargetN(300, 35, 500, 30, num);
        } else if (num <= 1000) {
            basePrice = 28;
            basePrice = new PriceUtils().calcByTargetN(500, 35, 1000, 28, num);
        } else if (num <= 2000) {
            basePrice = 26;
            basePrice = new PriceUtils().calcByTargetN(1000, 28, 2000, 26, num);
        } else if (num <= 5000) {
            basePrice = 24;
            basePrice = new PriceUtils().calcByTargetN(2000, 26, 5000, 24, num);
        } else if (num <= 10000) {
            basePrice = 22;
            basePrice = new PriceUtils().calcByTargetN(5000, 24, 10000, 22, num);
        } else {
            basePrice = 20*num;
            //basePrice = new PriceUtils().calcByTargetN(10000, 20, 10000, 20, num);
        }
        double craftPrice = 0;
        double craftBasePrice = 0;
        double craftMiniPrice = 0;
        if (craft_list.contains("装opp袋")) {
            craftBasePrice = 0.20;
            craftPrice += Math.max(craftBasePrice * count, 10);
        }
        if (craft_list.contains("穿绳子")) {
            craftBasePrice = 0.20;
            craftPrice += Math.max(craftBasePrice * count, 10);
        }

        if (craft_list.contains("配opp袋")) {
            craftBasePrice = 0.15;
            craftPrice += Math.max(craftBasePrice * count, 5);
        }
        if (craft_list.contains("配绳子")) {
            craftBasePrice = 0.15;
            craftPrice += Math.max(craftBasePrice * count, 5);
        }
        Product pro = new Product();
        pro.setCount(count);
        pro.setNumber(number);
        pro.setPrice(Math.ceil((Math.max(basePrice, 80) + Math.max(craftPrice, craftMiniPrice)) * number));
        priceList.add(pro);

        return priceList;
    }

    private List<Product> getEmbroideredPatchPrice(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();

        int count = dto.getCount();
        int number = dto.getNumber();
        double area = width * length;
        double price = 0;

        int[] counts = {1, 5, 10, 20, 30, 50, 100, 200};
        double[] areas = {16, 25, 36, 49, 64, 100, 225, 400, 625, 900};

        double[][] prices = {
                {100, 28.8, 16.8, 13.2, 9.6, 7.2, 6, 4.8},
                {100, 28.8, 16.8, 13.2, 9.6, 7.2, 6, 4.8},
                {100, 28.8, 16.8, 13.2, 10.8, 8.4, 6.6, 5.4},
                {100, 28.8, 16.8, 13.2, 10.8, 8.4, 6.6, 5.4},
                {100, 33.6, 19.2, 14.4, 12, 9.6, 7.2, 6},
                {100, 40.8, 23.4, 17.4, 14.4, 11.52, 8.64, 7.2},
                {100, 50.4, 28.8, 21.6, 18, 14.4, 10.8, 9},
                {100, 50.4, 28.8, 21.6, 18, 14.4, 10.8, 9},
                {100, 67.2, 38.4, 28.8, 24, 19.2, 14.4, 12},
                {100, 67.2, 38.4, 28.8, 24, 19.2, 14.4, 12},
        };
        int area_index = 0;
        for (int i = 0; i < areas.length; i++) {
            if (area <= areas[i]) {
                area_index = i;
                break;
            }
        }
        double base_price = 0;
        for (int i = 0; i < counts.length; i++) {
            if (count > counts[i]) {
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            int itemCount = priceList.size() == 0 ? count : counts[i];
            base_price = prices[area_index][Math.max(itemCount == count ? i - 1 : i, 0)];
            Product pro = new Product();
            pro.setCount(itemCount);
            pro.setNumber(dto.getNumber());
            pro.setPrice(Math.ceil(itemCount * base_price * number));
            priceList.add(pro);
        }
        if (priceList.size() == 0) {
            Product pro = new Product();
            pro.setCount(count);
            pro.setNumber(number);
            pro.setPrice(Math.ceil(prices[area_index][prices[area_index].length - 1] * count * number));
            priceList.add(pro);
        }
        return priceList;
    }

    private List<Product> getKeychain(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();

        int count = dto.getCount();
        int number = dto.getNumber();
        double price = 0;
        double min_price = 35;
        if (width * length / 10000 < 0.001) {
            double basePrice = 1;
            price = Math.max(min_price, basePrice * count * dto.getNumber() + 8 * dto.getNumber());
        } else {
            double area = width * length / 10000 * count * dto.getNumber();
            double[] areas = {0, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 2, 3, 5, 7, 9, 10, 20, 50};
            int[] prices = {0, 1100, 1000, 950, 900, 850, 800, 750, 700, 650, 600, 550, 500, 480, 470, 460};
            if ("4".equals(dto.getKindValue())) {
                prices = new int[]{0, 1130, 1030, 980, 930, 880, 830, 780, 730, 680, 630, 580, 530, 510, 500, 490};
            }
            double last_price = 450;
            price = PriceUtils.TableUnitPrice(area, prices, areas, last_price);

            price = Math.max(price, min_price) + ((dto.getNumber() - 1) * 8);
        }
        double craft_price = 0;
        if (!StringUtils.isEmpty(dto.getBianma())) {
            double craft_base = 0.1;
            if ("圆型钥匙扣银色".equals(dto.getBianma()) || "珠链银色".equals(dto.getBianma())) {
                craft_base = 0;
            }
            craft_price = Math.ceil(craft_base * count * dto.getNumber());
        }
        String weight = df.format(width * length * 4.17 * dto.getCount() * 0.1 * number / 1000 * 2);
        Product pro = new Product();
        pro.setCount(dto.getCount());
        pro.setNumber(dto.getNumber());
        pro.setWeight(weight);
        pro.setPrice(Math.ceil(price + craft_price));
        priceList.add(pro);
        return priceList;
    }

    private List<Product> getDeckCharitPrice(Product dto, Double width, Double length) {
        List<String> craft_lists = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<String> craft_list = new ArrayList<>(craft_lists);
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        Product product = new Product();
        product.setPrice(Math.ceil(150 * count * number));
        product.setCount(dto.getCount());
        product.setNumber(dto.getNumber());
        product.setWeight(df.format(3.3 * count * number));
        priceList.add(product);
        return priceList;
    }

    private List<Product> getUVDayinYKLPrice(Product dto, Double width, Double length) {
        List<String> craft_lists = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<String> craft_list = new ArrayList<>(craft_lists);
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();

        ShengDaPriceRequstVo params = new ShengDaPriceRequstVo();
        params.setProductCategory("UVDAYINYAKELI");
        params.setPaper(dto.getKind());
        ShengDaPriceRequstItemVo baseCrafts = new ShengDaPriceRequstItemVo();

        baseCrafts.setName("打印");
        Map<String, String> basecraftsItem = new HashMap<>();
        basecraftsItem.put("类型", "标准款");
        baseCrafts.setParameters(basecraftsItem);
        params.setBaseCrafts(Collections.singletonList(baseCrafts));

        List<ShengDaPriceRequstPartsVo> partsVoList = new ArrayList<>();
        ShengDaPriceRequstPartsVo partsVo = new ShengDaPriceRequstPartsVo();
        partsVo.setName("板块");
        partsVo.setNum(count * number);
        partsVo.setSizeUnit("CM");
        partsVo.setWidth(width);
        partsVo.setHeight(length);
        List<ShengDaPriceRequstItemVo> crafts = new ArrayList<>();

        if ("1.8MM瓷白亚克力(市场2mm)".equals(params.getPaper()) || "2.3MM瓷白亚克力(市场3mm)".equals(params.getPaper()) || "4.2MM瓷白亚克力(市场5mm)".equals(params.getPaper())) {
            if (craft_list.contains("单面") || craft_list.contains("双面")) {
                //固定分类
                ShengDaPriceRequstItemVo craft_peng = new ShengDaPriceRequstItemVo();
                craft_peng.setName("正喷");
                craft_peng.setParameters(new HashMap<>());
                crafts.add(craft_peng);
            }
        }

        //印面 0不印 1单面 2双面
        partsVo.setPrintSide(0);
        craft_list.remove("不印面");
        if (craft_list.contains("单面")) {
            partsVo.setPrintSide(1);
            craft_list.remove("单面");
        }
        if (craft_list.contains("双面")) {
            partsVo.setPrintSide(2);
            craft_list.remove("双面");
        }


        //固定分类
        ShengDaPriceRequstItemVo craft_diaoke = new ShengDaPriceRequstItemVo();
        craft_diaoke.setName("按设计文件雕刻");
        Map<String, String> craft_diaokeItem = new HashMap<>();
        craft_diaokeItem.put("类型", "文件造型");
        craft_diaoke.setParameters(craft_diaokeItem);

        crafts.add(craft_diaoke);


        for (String s : craft_list) {
            ShengDaPriceRequstItemVo craftItem = new ShengDaPriceRequstItemVo();
            HashMap<String, String> parameters = new HashMap<>();
            if ("3m胶".equals(s)) {
                craftItem.setName("背胶");
                parameters.put("类型", "覆3M胶");
                craftItem.setParameters(parameters);
            } else if ("打孔".equals(s)) {
                craftItem.setName("打孔");
                String type = "按文件设计";
                if (craft_list.contains("广告钉") || craft_list.contains("镜钉")) {
                    type = "按钉子直径打孔";
                }
                parameters.put("类型", type);
                parameters.put("单块打孔个数", String.valueOf(Math.max(dto.getPcount() == null ? 0 : dto.getPcount(), 1)));
                craftItem.setParameters(parameters);
            } else {
                craftItem.setName(s);
            }
            crafts.add(craftItem);
        }
        partsVo.setCrafts(crafts);
        partsVoList.add(partsVo);
        params.setParts(partsVoList);

        ShengDaPriceResultVo result = ShengDaPriceUtils.getPrice(params);
        double price = Math.ceil(result.getData().getPrice() / (1 - 0.65));
        double designPrice = number * 8;

        Product product = new Product();
        product.setPrice(Math.ceil(Math.max(price, 30) + designPrice));
        product.setCount(dto.getCount());
        product.setNumber(dto.getNumber());
        priceList.add(product);
        return priceList;
    }

    private List<Product> getsmPVCPrice(Product dto, Double width, Double length, String role) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double wei = 0;
        // 价格按照大纸裁
        priceList = ZsPrice.getSmPrice(count, length, width, priceList, number, dto.getCraft(), dto, role);
        for (Product product : priceList) {
            if (craft_list.contains("菜品夹")) {
                product.setPrice(Math.ceil(product.getPrice() + dto.getStickNum() * 2));
            }

            if (dto.getKindValue().equals("1") || dto.getKindValue().equals("2") || dto.getKindValue().equals("3")) {
                wei = 0.38;
            } else if (dto.getKindValue().equals("4") || dto.getKindValue().equals("5") || dto.getKindValue().equals("6")) {
                wei = 0.84;
            } else if (dto.getKindValue().equals("11") || dto.getKindValue().equals("12") || dto.getKindValue().equals("13")) {
                wei = 0.76;
            } else {
                wei = 1;
            }
            product.setWeight(df.format(wei * length * width * product.getCount() / 10000 * number * 1.3));
        }
        return priceList;
    }

    private List<Product> getYaFenPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        List<String> paperCode = Arrays.asList("157克哑粉纸", "200克哑粉纸", "250克哑粉纸");
        HuaFangPriceRequstVo requstVo = new HuaFangPriceRequstVo();
        requstVo.setProductName("精品单页");
        requstVo.setProductPaperCode(paperCode.get(Integer.parseInt(dto.getKind()) - 1));
        requstVo.setProductPrintColor("彩色");
        requstVo.setProductPrintFace("双面");
        requstVo.setNum(dto.getCount());
        requstVo.setStyleNum(dto.getNumber());
        requstVo.setSizes(Arrays.asList(width * 10, length * 10));
        List<HuaFangPriceProcessItemsVo> list = new ArrayList<>();
        List<String> yahen = Arrays.asList("压一道痕", "压二道痕", "压三道痕");
        List<String> dianxian = Arrays.asList("压一道齿线", "压二道齿线", "压三道齿线");
        if (craft_list.contains("双面哑膜")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("覆膜");
            item.setProcessValue("双面哑膜");
            list.add(item);
        }
        if (craft_list.contains("双面亮膜")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("覆膜");
            item.setProcessValue("双面亮膜");
            list.add(item);
        }
        if (craft_list.contains("压痕")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("压痕");
            item.setProcessValue(yahen.get(dto.getYaheng() - 1));
            list.add(item);
        }
        if (craft_list.contains("点线")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("齿线");
            item.setProcessValue(dianxian.get(dto.getDadianxian() - 1));
            list.add(item);
        }
        if (craft_list.contains("折页")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("折页");
            item.setProcessValue(dto.getBianma());
            list.add(item);
        }
        if (craft_list.contains("异形模切") || width < 5.4 || length < 5.4) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("模切");
            item.setProcessValue("模切");
            list.add(item);
        }

        requstVo.setCalcProcess(list);
        HuaFangPriceResultVo result = HuaFangPriceUtil.getPrice(requstVo);
        Product product = new Product();
        product.setPrice(Math.ceil(result.getAmount() / (1 - 0.55)));
        product.setCount(dto.getCount());
        product.setNumber(dto.getNumber());
        priceList.add(product);
        return priceList;
    }

    private List<Product> gethuafangApiPrice(Product dto, List<String> craft_list, Double width, Double length) {
        List<Product> priceList = new ArrayList<>();
        HuaFangPriceRequstVo requstVo = new HuaFangPriceRequstVo();
        requstVo.setProductName("精品单页");
        requstVo.setProductPaperCode("300克铜版纸");
        requstVo.setProductPaperName("300-铜版（厚度31丝）");
        requstVo.setProductPrintColor("彩色");
        requstVo.setProductPrintFace("双面");
        requstVo.setNum(dto.getCount());
        requstVo.setStyleNum(dto.getNumber());
        requstVo.setSizes(Arrays.asList(width * 10, length * 10));
        List<HuaFangPriceProcessItemsVo> list = new ArrayList<>();
        List<String> fumo = new ArrayList<>(Arrays.asList("单面星光膜", "双面星光膜", "单面镭射膜", "双面镭射膜", "单面触感膜", "双面触感膜", "单面雪花膜", "双面雪花膜"));
        List<String> uv = new ArrayList<>(Arrays.asList("单面局部UV", "双面局部UV"));
        for (String s : craft_list) {
            if (fumo.contains(s)) {
                HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
                item.setProcessName("覆膜");
                item.setProcessValue(s);
                list.add(item);
            }
            if (uv.contains(s)) {
                HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
                item.setProcessName("UV");
                item.setProcessValue(s);
                item.setSizes(Arrays.asList(dto.getWidthUV() * 10, dto.getLengthVU() * 10));
                list.add(item);
            }

        }
        boolean ismoqie = false;
        if (craft_list.contains("模切")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("模切");
            item.setProcessValue("模切");
            list.add(item);
            ismoqie = true;
        }
        if (!ismoqie && craft_list.contains("圆角")) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("模切");
            item.setProcessValue("模切");
            list.add(item);
            ismoqie = true;
        }
        if (!ismoqie && (width < 5.4 || length < 5.4)) {
            HuaFangPriceProcessItemsVo item = new HuaFangPriceProcessItemsVo();
            item.setProcessName("模切");
            item.setProcessValue("模切");
            list.add(item);
        }
        requstVo.setCalcProcess(list);
        HuaFangPriceResultVo result = HuaFangPriceUtil.getPrice(requstVo);
        Product product = new Product();
        product.setPrice(Math.ceil(result.getAmount() / (1 - 0.5)));
        product.setCount(dto.getCount());
        product.setNumber(dto.getNumber());
        priceList.add(product);
        return priceList;
    }

    private List<Product> getXinFengPrice(Product dto, Double width, Double length, String kind, String kind2) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        // 120克双胶牛皮
        String kindValue9 = "";
        if ("10".equals(kind)) {
            dto.setKindValue("0");
            priceList = productMapper.getThanPrice(dto);
        } else if ("11".equals(kind)) {// 100克双胶牛皮
            dto.setKindValue("1");
            priceList = productMapper.getThanPrice(dto);
        } else if ("3".equals(kind)) {// 200克珠光冰白彩色信封
            // 200克珠光冰白彩色信封报价:140克的基础上每个+*元
            dto.setKindValue("2");// 140克的value值
            priceList = productMapper.getThanPrice(dto);
            for (Product product : priceList) {
                if ("2".equals(kind2)) {
                    product.setPrice(product.getPrice() + product.getCount() * 0.12);
                } else if ("3".equals(kind2)) {
                    product.setPrice(product.getPrice() + product.getCount() * 0.15);
                } else if ("4".equals(kind2)) {
                    product.setPrice(product.getPrice() + product.getCount() * 0.16);
                } else if ("5".equals(kind2)) {
                    product.setPrice(product.getPrice() + product.getCount() * 0.32);
                } else {
                    product.setPrice(product.getPrice() + product.getCount() * 0.11);
                }
            }
        } else {// 120/100克牛皮纸/ 140克珠光冰白彩色信封/高端珠光冰白烫金信封
            kindValue9 = dto.getKindValue();
            if ("12".equals(dto.getKindValue())) {
                dto.setKindValue("4");
            }
            priceList = productMapper.getThanPrice(dto);
        }
        // 保留4个价格
        if (priceList.size() >= 4) {
            priceList = priceList.subList(0, 4);
        }
        List<String> carft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
        // 产品价格倍数
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
            if ("4".equals(kindValue9)) {
                if (carft_list.contains("烫金")) {
                    if (carft_list.contains("2处")) {
                        product.setPrice(product.getPrice() + 100);
                    }
                    if (carft_list.contains("3处")) {
                        product.setPrice(product.getPrice() + 200);
                    }
                }
            }
            if ("12".equals(kindValue9)) {
                if (carft_list.contains("烫金")) {
                    if (carft_list.contains("1处")) {
                        product.setPrice(product.getPrice() + 150);
                    }
                    if (carft_list.contains("2处")) {
                        product.setPrice(product.getPrice() + 300);
                    }
                    if (carft_list.contains("3处")) {
                        product.setPrice(product.getPrice() + 450);
                    }
                }
            }

        }
        // 根据款数重新算重量（重量在数据库中）
        /*
         * if (!StringUtils.isEmpty(priceList.get(0).getWeight())) { for (Product product : priceList) { product.setWeight(df.format(Double.valueOf(product.getWeight()) * number)); } }
         */
        // 根据款数重新算价格
        double wei = 0.0;
        if (kind.equals("0") || kind.equals("10")) {
            wei = 0.12;
        } else if (kind.equals("1") || kind.equals("11")) {
            wei = 0.1;
        } else if (kind.equals("2")) {
            wei = 0.14;
        } else if (kind.equals("3")) {
            wei = 0.2;
        } else if (kind.equals("4")) {
            wei = 0.3;
        } else {
            wei = 0.15;
        }
        double area = 0;
        if (kind.equals("0") || kind.equals("10") || kind.equals("1") || kind.equals("11")) {
            if (dto.getKind2Value().equals("0")) {
                area = 0.176 * 0.125;
            } else if (dto.getKind2Value().equals("1")) {
                area = 0.22 * 0.11;
            } else if (dto.getKind2Value().equals("2")) {
                area = 0.23 * 0.12;
            } else if (dto.getKind2Value().equals("3")) {
                area = 0.229 * 0.162;
            } else if (dto.getKind2Value().equals("4")) {
                area = 0.25 * 0.162;
            } else {
                area = 0.324 * 0.229;
            }
        } else if (kind.equals("2") || kind.equals("3")) {
            if (dto.getKind2Value().equals("0")) {
                area = 0.165 * 0.1;
            } else if (dto.getKind2Value().equals("1")) {
                area = 0.175 * 0.11;
            } else if (dto.getKind2Value().equals("2")) {
                area = 0.176 * 0.125;
            } else if (dto.getKind2Value().equals("3")) {
                area = 0.22 * 0.11;
            } else if (dto.getKind2Value().equals("4")) {
                area = 0.23 * 0.12;
            } else if (dto.getKind2Value().equals("5")) {
                area = 0.229 * 0.162;
            } else if (dto.getKind2Value().equals("6")) {
                area = 0.25 * 0.162;
            } else {
                area = 0.324 * 0.229;
            }
        } else if (kind.equals("4")) {
            if (dto.getKind2Value().equals("0")) {
                area = 0.09 * 0.06;
            } else if (dto.getKind2Value().equals("1")) {
                area = 0.1 * 0.07;
            } else if (dto.getKind2Value().equals("2")) {
                area = 0.12 * 0.08;
            } else if (dto.getKind2Value().equals("3")) {
                area = 0.15 * 0.08;
            } else if (dto.getKind2Value().equals("4")) {
                area = 0.17 * 0.09;
            } else if (dto.getKind2Value().equals("5")) {
                area = 0.19 * 0.09;
            } else if (dto.getKind2Value().equals("6")) {
                area = 0.21 * 0.11;
            } else {
                area = 0.22 * 0.12;
            }
        } else {
            if (dto.getKind2Value().equals("0")) {
                area = 0.22 * 0.11;
            } else {
                area = 0.094 * 0.064;
            }
        }
        for (Product product : priceList) {
            product.setWeight(df.format(area * product.getCount() * number * wei));
            product.setPrice(Math.floor(product.getPrice() * number));
        }

        return priceList;
    }

    private List<Product> getBeiDianPrice(Product dto, Double width, Double length, String role, String kind2, String kind) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        // 单个产品的面积
        double area = length * width / 10000;
        double rate = 1;
        if ("烫黄金".equals(kind2)) {
            if (craft_list.contains("单面烫黄金")) {
                kind2 = "单面烫黄金";
            }
            if (craft_list.contains("双面烫黄金")) {
                kind2 = "双面烫黄金";
            }
        }
        if ("烫镭射银".equals(kind2)) {
            if (craft_list.contains("单面烫镭射银")) {
                kind2 = "单面烫镭射银";
            }
            if (craft_list.contains("双面烫镭射银")) {
                kind2 = "双面烫镭射银";
            }
            rate = 1.2;
        }
        // 300克
        if ("3".equals(kind)) {
            // 异形模切价格
            priceList = new PriceUtils().tagClothes300PriceCraftMo(dto, number, width, length, area, count, priceList);
            if ("单面烫金".equals(dto.getCraftTang())) {
                // 有2个尺寸带烫金
                if (!StringUtils.isEmpty(dto.getSize1())) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 > 85 * 2 ? product.getPrice() * 0.09 * 2 : 85 * 2)));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 85 ? product.getPrice() * 0.09 : 85)));
                    }
                }
            } else if ("双面烫金".equals(dto.getCraftTang())) {
                // 有2个尺寸带烫金
                if (!StringUtils.isEmpty(dto.getSize1())) {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 * 2 > 170 * 2 ? product.getPrice() * 0.09 * 2 * 2 : 170 * 2)));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 * 2 > 170 ? product.getPrice() * 0.09 * 2 : 170)));
                    }
                }
            }
        } else if ("6".equals(kind)) {

            priceList = new PriceUtils().tags600Price(dto, kind, kind2, area, count);
            for (Product product : priceList) {
                product.setPrice(Math.ceil(product.getPrice() * rate));
            }
        } else if ("10".equals(kind) || "11".equals(kind)) {
            int[] count_list = {50, 100, 200, 500, 1000};
            double[] jitu = {};
            double[] jitu_add = {};
            double[] tang = {};
            double[] yaao = {};
            double[] tanglei = {};
            if ("10".equals(kind)) {
                jitu = new double[]{267, 317, 450, 733, 1200};
                jitu_add = new double[]{190, 210, 250, 320, 440};
                tang = new double[]{250, 283, 383, 650, 980};
                tanglei = new double[]{300, 340, 460, 780, 1176};
                yaao = new double[]{250, 267, 383, 617, 950};
            } else if ("11".equals(kind)) {
                jitu = new double[]{267, 317, 417, 667, 1080};
                jitu_add = new double[]{95, 105, 125, 160, 220};
                tang = new double[]{250, 300, 350, 583, 930};
                tanglei = new double[]{300, 360, 420, 700, 1116};
                yaao = new double[]{250, 283, 317, 533, 900};
            }
            craft_list = Arrays.asList(dto.getCraft());
            for (int i = 0; i < count_list.length; i++) {
                if (priceList.size() > 2) {
                    break;
                }
                int count_item = count_list[i];
                if (count > count_item) {
                    continue;
                }
                Product product = new Product();
                product.setCount(count_item);
                if (craft_list.contains("击凸")) {
                    product.setPrice(jitu[i]);
                    if (dto.getJtcolor() != null && dto.getJtcolor().length > 1) {
                        product.setPrice(jitu[i] + jitu_add[i]);
                    }
                }
                if (craft_list.contains("烫金")) {
                    product.setPrice(tang[i]);
                }
                if (craft_list.contains("烫镭射银")) {
                    product.setPrice(tanglei[i]);
                    if (dto.getTcolor().contains("双面烫镭射银")) {
                        product.setPrice(Math.ceil(tanglei[i] * 1.5));
                    }
                }
                if (craft_list.contains("无色压凹")) {
                    product.setPrice(yaao[i]);
                }

                priceList.add(product);
            }

        } else if ("12".equals(kind)) {
            double basePrice = 0;
            if ("2mm".equals(dto.getSize1())) {
                basePrice = 5;
            }
            if ("3mm".equals(dto.getSize1())) {
                basePrice = 7;
            }
            if ("5mm".equals(dto.getSize1())) {
                basePrice = 9;
            }
            Product pro = new Product();
            pro.setCount(count);
            pro.setPrice(Math.max(Math.ceil(basePrice * count * number), 30) + 8 * (number - 1));
            priceList.add(pro);
            return priceList;

        } else {
            priceList = new PriceUtils().tags600Price(dto, kind, kind2, area, count);
            // 服装吊牌里面的900克吊牌把价格*1.3倍
            for (Product product : priceList) {
                product.setPrice(Math.floor(product.getPrice() * 1.3));
                if (product.getCount() <= 2000) {
                    product.setPrice(Math.floor(product.getPrice() * 1.1));
                }
                if (product.getCount() > 2000 && product.getCount() <= 5000) {
                    product.setPrice(Math.floor(product.getPrice() * 1.08));
                }
                if (product.getCount() > 5000) {
                    product.setPrice(Math.floor(product.getPrice() * 1.06));
                }
            }
            for (int i = 0; i < priceList.size(); i++) {
                if (priceList.get(i).getCount() == 500) {
                    priceList.get(i).setPrice(Math.floor(priceList.get(i + 1).getPrice() - 5));
                }
            }
        }
        double wei = 0;
        // 根据款数重新算价格
        for (Product product : priceList) {
            product.setPrice(Math.floor(product.getPrice() * number));
            if ("3".equals(kind)) {
                wei = 0.3;
            } else {
                wei = 0.6;
            }
            product.setWeight(df.format(wei * area * product.getCount() * number));
        }
        return priceList;
    }

    private List<Product> getLiuSuanzhiPrice(Product dto, Double width, Double length, String role, String proType) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        // 单价*产品数量*款数
        if (dto.getStickerKind().equals("常用")) {
            if (dto.getKindValue().equals("2")) {
//					if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
//						if ("直角".equals(dto.getCraft()[0])) {
//							if ("彩色".equals(dto.getKind())) {
//								dto.setKind1Value("2");
//							} else {
//								dto.setKind1Value("1");
//							}
//						} else {
//							if ("彩色".equals(dto.getKind())) {
//								dto.setKind1Value("4");
//							} else {
//								dto.setKind1Value("3");
//							}
//						}
//						if ((length <= 5 && width <= 3) || (length <= 3 && width <= 5)) {
//							dto.setKindValue("1");
//						} else if ((length <= 6.8 && width <= 3) || (length <= 3 && width <= 6.8)) {
//							dto.setKindValue("2");
//						} else if ((length <= 8 && width <= 3) || (length <= 3 && width <= 8)) {
//							dto.setKindValue("3");
//						} else if ((length <= 7 && width <= 3.5) || (length <= 3.5 && width <= 7)) {
//							dto.setKindValue("4");
//						} else {
//							dto.setKindValue("5");
//						}
//						priceList = productMapper.getThanPrice(dto);
//					} else {
                priceList = new PriceUtils().get80LszPrice(dto, width, length, count, priceList);
//					}
            } else {
                priceList = new PriceUtils().get80LszPrice(dto, width, length, count, priceList);
            }
            // 款数计算
            for (Product product : priceList) {
                product.setPrice(Math.floor(product.getPrice() * number));
            }
        } else {// 打印的价格和pvc不干胶打印价格一样--23.8.17更新后取消这个
            priceList = lessSticker(dto, proType, number, width, length, count, priceList, role);
            return priceList;
        }
        double wei = 0;
        // 重量
        for (Product product : priceList) {
            if (dto.getKindValue().equals("1")) {
                wei = 0.08;
            } else {
                wei = 0.135;
            }
            product.setWeight(df.format(number * length * width * product.getCount() / 10000 * wei));
        }
        return priceList;
    }

    private List<Product> getShouLaQiPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();

        if ("常规".equals(dto.getStickerKind())) {
            priceList = new FgqPrice().getSlqPrice(count, priceList);
        }
        if ("伸缩手拉旗".equals(dto.getStickerKind())) {
            double base_price = 0;
            if ((length == 24 && width == 70) || (length == 70 && width == 24)) {
                base_price = 30;
            }
            if ((length == 24 && width == 50) || (length == 50 && width == 24)) {
                base_price = 30;
            }
            if ((length == 24 && width == 100) || (length == 100 && width == 24)) {
                base_price = 35;
            }
            if ((length == 17 && width == 70) || (length == 70 && width == 17)) {
                base_price = 30;
            }
            if ((length == 17 && width == 50) || (length == 50 && width == 17)) {
                base_price = 30;
            }
            if ((length == 17 && width == 100) || (length == 100 && width == 17)) {
                base_price = 35;
            }
            Product product = new Product();
            product.setCount(dto.getCount());
            product.setNumber(number);
            product.setPrice(Math.ceil(base_price * dto.getCount()));
            priceList.add(product);

        }
        /* } */
        for (Product product : priceList) {
            product.setPrice(Math.floor(product.getPrice() * number));
            product.setWeight(df.format(length * width * product.getCount() / 10000 * number * 0.075));
        }
        return priceList;
    }

    private List<Product> getkaTiePrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();

        int min = getNum(length, width);
        dto.setProTypeValue("4");
        priceList = getHekaPrice(min, dto, priceList, count);
        for (Product product : priceList) {
            double dNum = 1;
            if (product.getCount() / 1000 > 1) {
                dNum = Math.floor(product.getCount() / 1000);
            }
            product.setPrice(Math.ceil(product.getPrice() + dNum * 3));
        }
        //工艺计算
        if (!StringUtils.isEmpty(dto.getCraft())) {
            List<String> craList = Arrays.asList(dto.getCraft());

            if (craList.contains("模切")) {
                if (min < 3) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 25 + 0.04 * product.getCount()));
                    }
                } else if (min < 16) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 50 + 0.04 * product.getCount()));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 30 + 50 + 0.04 * product.getCount()));
                    }
                }
            }
        }

        // 根据款数重新算价格/计算重量
        for (Product product : priceList) {
            product.setPrice(Math.floor(product.getPrice() * number));
            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
        }
        return priceList;
    }

    private List<Product> getTuoBeiPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        String size = dto.getSize();
        double area = length * width / 10000;
        if ("250克白卡纸".equals(dto.getKind())) {
            priceList = CupHolderUtil.getPrice(area, count, priceList);
            for (Product product : priceList) {
                product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.25));
            }

        } else {
            priceList = CupHolderUtil.getPvcPrice(size, dto.getKind(), count, priceList);
            for (Product product : priceList) {
                product.setWeight(df.format(0.38 * 0.0855 * 1.3 * 0.054 * product.getCount() * number));
            }
        }
        if (number > 1) {
            for (Product product : priceList) {
                product.setPrice(Math.floor(product.getPrice() * number));
            }
        }

        return priceList;
    }

    private List<Product> getTianMuPrice(Product dto, Double width, Double length) {
        List<String> craft_lists = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<String> craft_list = new ArrayList<>(craft_lists);
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double area = length * width / 10000;
        Product pro = new Product();
        pro.setCount(count);
        pro.setNumber(number);
        double price = 0;
        if (width == 290 && length == 290) {
            price = 250;
            if ("黑胶涤纶布".equals(dto.getKindValue())) {
                price = price + 10;
            }

            price = Math.ceil(price * count * number);
        } else if ((width == 420 && length == 390) || (length == 420 && width == 390)) {
            price = 440;
            if ("黑胶涤纶布".equals(dto.getKindValue())) {
                price = price + 10;
            }
            price = Math.ceil(price * count * number);
        } else if ((width == 420 && length == 490) || (length == 420 && width == 490)) {
            price = 550;
            if ("黑胶涤纶布".equals(dto.getKindValue())) {
                price = price + 10;
            }
            price = Math.ceil(price * count * number);
        } else {
            double basePrice = 0;
            if (area <= 4) {
                basePrice = 33;
            } else if (area <= 6) {
                basePrice = 32;
            } else if (area <= 9) {
                basePrice = 31;
            } else {
                basePrice = 29;
            }
            if ("黑胶涤纶布".equals(dto.getKindValue())) {
                basePrice = basePrice + 1;
            }
            price = Math.ceil(Math.max(basePrice * area * count, 50) * number);
        }

        pro.setPrice(Math.ceil(price));
        priceList.add(pro);

        for (Product product : priceList) {
            if (craft_list.contains("安装包")) {
                product.setPrice(Math.floor(product.getPrice() + dto.getShuliang() * 50));
            }
            if (craft_list.contains("防风绳")) {
                product.setPrice(Math.floor(product.getPrice() + dto.getPcount() * 2));
            }
            if (craft_list.contains("圆盘")) {
                product.setPrice(Math.floor(product.getPrice() + dto.getStickNum() * 8));
            }
            product.setWeight(String.valueOf(area * count * number * 0.08 + dto.getShuliang() * 3.3));
        }

        return priceList;
    }

    private List<Product> getGuaBuPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double area = length * width / 10000;

        priceList = AngClothUtil.getPrice(area, count, priceList, dto.getCraft());
        for (Product product : priceList) {
            product.setPrice(Math.floor(product.getPrice() * number));
            double other_price = 0;
            if (area <= 0.25) {
                other_price = (count) * 5 * number;
                product.setPrice(Math.floor(45 + other_price));
            }
            product.setWeight(df.format(area * product.getCount() * number * 0.06));
        }

        return priceList;
    }

    private List<Product> getClotherPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double basePrice = 0;
        double banfei = 0;

        List<String> kindList = Arrays.asList("T恤", "马甲", "工程服");

        if (kindList.contains(dto.getKindValue())) {
            String kind1value = dto.getKind1Value();
            if ("1108T".equals(kind1value)) {
                basePrice = 66;
            } else if ("2604".equals(kind1value)) {
                basePrice = 66;
            } else if ("8089".equals(kind1value)) {
                basePrice = 88;
            } else if ("1101".equals(kind1value)) {
                basePrice = 46;
            } else if ("1102".equals(kind1value)) {
                basePrice = 46;
            } else if ("9128".equals(kind1value)) {
                basePrice = 72;
            } else if ("9129".equals(kind1value)) {
                basePrice = 80;
            } else if ("9022".equals(kind1value)) {
                basePrice = 84;
            } else if ("9020".equals(kind1value)) {
                basePrice = 84;
            } else if ("9008".equals(kind1value)) {
                basePrice = 44;
            } else if ("9023".equals(kind1value)) {
                basePrice = 50;
            } else if ("9002".equals(kind1value)) {
                basePrice = 48;
            } else if ("6010A".equals(kind1value)) {
                basePrice = 122;
            } else if ("6016".equals(kind1value)) {
                basePrice = 106;
            } else if ("5608XM".equals(kind1value)) {
                basePrice = 140;
            } else if ("5608K".equals(kind1value)) {
                basePrice = 90;
            } else if ("903".equals(kind1value)) {
                basePrice = 58;
            } else if ("901".equals(kind1value)) {
                basePrice = 100;
            }
            double craftPrice = 0;
            if (craft_list.contains("烫画")) {
                if (craft_list.contains("前胸")) {
                    craftPrice += Math.max(5, 3 * dto.getCount() * number);
                    if (dto.getCount() * number > 5) {
                        craftPrice = 0;
                    }
                }
                if (craft_list.contains("后背")) {
                    craftPrice += Math.max(10, 5 * dto.getCount() * number);
                    if (dto.getCount() * number > 10) {
                        craftPrice = 0;
                    }
                }
            }
            if (craft_list.contains("刺绣")) {
                if (craft_list.contains("前胸")) {
                    craftPrice += Math.max(30, 3 * dto.getCount() * number);
                    if (dto.getCount() * number > 15) {
                        craftPrice = 0;
                    }
                }
                if (craft_list.contains("后背")) {
                    craftPrice += Math.max(50, 6 * dto.getCount() * number);
                    if (dto.getCount() * number > 20) {
                        craftPrice = 0;
                    }
                }
            }
            if (craft_list.contains("丝印")) {
                if (craft_list.contains("前胸")) {
                    craftPrice += Math.max(80, 2 * dto.getCount() * number);
                    if (dto.getCount() * number > 100) {
                        craftPrice = 0;
                    }
                }
                if (craft_list.contains("后背")) {
                    craftPrice += Math.max(100, 2 * dto.getCount() * number);
                    if (dto.getCount() * number > 100) {
                        craftPrice = 0;
                    }
                }
            }

            Product pro = new Product();
            pro.setCount(count);
            pro.setPrice(Math.ceil(basePrice * count * number) + craftPrice);
            priceList.add(pro);

        } else {
            if ("YP".equals(dto.getKindValue())) {
                basePrice = 19;
            }
            if ("XW".equals(dto.getKindValue())) {
                basePrice = 31;
            }
            if ("EP".equals(dto.getKindValue())) {
                basePrice = 31;
            }
            if ("ZT".equals(dto.getKindValue())) {
                basePrice = 57;
            }
            if (!StringUtils.isEmpty(dto.getSize())) {
                String[] size_list = dto.getSize().split(",");
                for (int i = 0; i < size_list.length; i++) {
                    double sizePirce = 0;
                    if ("10*10".equals(size_list[i])) {
                        sizePirce = 4;
                    }
                    if ("15*15".equals(size_list[i])) {
                        sizePirce = 6;
                    }
                    if ("15*20".equals(size_list[i])) {
                        sizePirce = 8;
                    }
                    if ("20*20".equals(size_list[i])) {
                        sizePirce = 10;
                    }
                    if ("25*15".equals(size_list[i])) {
                        sizePirce = 10;
                    }
                    if ("25*25".equals(size_list[i])) {
                        sizePirce = 12;
                    }
                    if ("30*30".equals(size_list[i])) {
                        sizePirce = 14;
                    }
                    if ("30*40".equals(size_list[i])) {
                        sizePirce = 16;
                    }

                    basePrice += sizePirce;
                }

            }
            if (dto.getPo_number() != null && dto.getCo_number() != null) {
                if (dto.getPo_number() > 0 || dto.getCo_number() > 0) {
                    basePrice += dto.getPo_number() * 4 * dto.getCo_number();
                    banfei = dto.getPo_number() * 40 * dto.getCo_number();
                }
            }
            count = dto.getCount();

            Product pro = new Product();
            pro.setCount(count);
            pro.setPrice(Math.max(basePrice * count * number, 30) + banfei);
            priceList.add(pro);
        }

        return priceList;
    }

    private List<Product> getShouhuiPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double price = 0;
        if ("1".equals(dto.getKindValue())) {
            if (number >= 1 && number <= 4) {
                price = 80;
            } else if (number >= 5 && number <= 10) {
                price = 75;
            } else if (number >= 11 && number <= 20) {
                price = 70;
            } else {
                price = 65;
            }
        } else if ("2".equals(dto.getKindValue())) {
            price = 70;
        } else if ("3".equals(dto.getKindValue())) {
            price = 200;
        } else if ("4".equals(dto.getKindValue())) {
            if ("1".equals(dto.getKind1Value())) {
                price = 80;
            }
            if ("2".equals(dto.getKind1Value())) {
                price = 160;
            }
        } else if ("5".equals(dto.getKindValue())) {
            if ("1".equals(dto.getKind1Value())) {
                price = 80;
            }
            if ("2".equals(dto.getKind1Value())) {
                price = 160;
            }
        } else if ("6".equals(dto.getKindValue())) {
            if ("1".equals(dto.getKind1Value())) {
                price = 80;
            }
            if ("2".equals(dto.getKind1Value())) {
                price = 98;
            }
        } else if ("7".equals(dto.getKindValue())) {
            price = 150;
        } else if ("8".equals(dto.getKindValue())) {
            if ("1".equals(dto.getKind1Value())) {
                price = 80;
            }
            if ("2".equals(dto.getKind1Value())) {
                price = 198;
            }
        } else if ("9".equals(dto.getKindValue())) {
            price = 150;
        }

        Product pro = new Product();
        pro.setCount(count);
        pro.setPrice(price * number);
        priceList.add(pro);
        return priceList;
    }

    private List<Product> getWarmStickerPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        if ("自定义".equals(dto.getStickerKind())) {

            int[][] prices = {
                    {85, 85, 85, 145, 200, 400},
                    {85, 85, 85, 150, 233, 233},
                    {85, 85, 85, 222, 336, 673},
            };
            int[] counts = {5, 10, 20, 50, 100, 200};
            int price_index = 0;
            if (width == 7.5 && length > 7.5) {
                price_index = 1;
            }
            if ((width == 10 && length == 7.5) || (length == 10 && width == 7.5)) {
                price_index = 2;
            }

            for (int i = 0; i < counts.length; i++) {
                int itemCount = counts[i];
                if (count > itemCount) {
                    continue;
                }
                if (priceList.size() > 2) {
                    break;
                }
                Product pro = new Product();
                pro.setPrice(Math.ceil(prices[price_index][i]));
                pro.setCount(itemCount);
                pro.setNumber(number);
                priceList.add(pro);
            }

        } else {
            priceList = productMapper.getThanPrice(dto);

            // 产品价格倍数
            for (Product product : priceList) {
                product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
            }

        }
        // 根据款数重新算价格
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() * number));
        }
        return priceList;
    }

    private List<Product> getTearingJoyPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int awards = dto.getAwards();
        double mini_price = 1000;
        int[] prices = {80, 80, 75, 70, 65, 60, 55, 50, 45};
        if (craft_list.contains("单面哑膜")) {
            prices = new int[]{85, 85, 80, 75, 70, 65, 60, 55, 50};
            mini_price = 1100;
        }
        if (craft_list.contains("异形模切")) {
            mini_price += 300;

        }
        if (craft_list.contains("打码")) {
            mini_price += 250;

        }
        int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000, 20000, 50000};

        if (count > counts[counts.length - 1]) {
            double awards_price = 0;
            if (awards > 5) {
                awards_price = 30 * Math.max((awards - 5), 0);
            }
            double craft_price = 0;
            double craft_base = 0;
            if (craft_list.contains("异形模切")) {
                craft_base = 0.02;
                if (count >= 100000) {
                    craft_base = 0.015;

                }
                craft_price += craft_base * count;
            }
            if (craft_list.contains("打码")) {
                craft_base = 0.02;
                if (count >= 100000) {
                    craft_base = 0.015;

                }
                craft_price += craft_base * count;
            }
            Product pro = new Product();
            pro.setCount(count);
            pro.setNumber(number);
            pro.setPrice(Math.ceil(Math.max((prices[prices.length - 1] * count * width * length / 10000 + awards_price + craft_price), mini_price) * number));
            priceList.add(pro);
        } else {

            for (int i = 0; i < counts.length; i++) {
                int itemCount = counts[i];
                if (count > itemCount) {
                    continue;
                }
                if (priceList.size() > 2) {
                    break;
                }
                double awards_price = 0;
                if (itemCount <= 10000) {
                    if (awards > 5) {
                        awards_price = 30 * Math.max((awards - 5), 0);
                    }
                }
                double craft_price = 0;
                double craft_base = 0;
                if (craft_list.contains("异形模切")) {
                    craft_base = 0.025;
                    if (itemCount >= 50000) {
                        craft_base = 0.02;
                    }

                    craft_price += craft_base * itemCount;
                }
                if (craft_list.contains("打码")) {
                    craft_base = 0.03;
                    if (itemCount >= 50000) {
                        craft_base = 0.02;
                    }

                    craft_price += craft_base * itemCount;
                }

                Product pro = new Product();
                pro.setCount(itemCount);
                pro.setNumber(number);
                pro.setPrice(Math.ceil(Math.max((prices[i] * itemCount * width * length / 10000 + awards_price + craft_price), mini_price) * number));
                priceList.add(pro);
            }
        }

        return priceList;
    }

    private List<Product> getWrappingPaper(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int min_count = 5;
        int[] prices = {60, 100, 190, 500, 800};
        int[] counts = {5, 10, 20, 50, 100};
        if ("1".equals(dto.getKind()) && (width == 490 || length == 490)) {
            prices = new int[]{50, 80, 140, 300, 450};
        }
        if ("2".equals(dto.getKind())) {
            prices = new int[]{50, 80, 140, 300, 450};
        }
        if ("3".equals(dto.getKind())) {
            prices = new int[]{50, 80, 140, 300, 450};
        }
        double craft_price = 0;
        if (craft_list.contains("双面胶")) {
            craft_price += Math.max(dto.getMaxian(), 1) * 1.5;
        }
        if (craft_list.contains("丝带")) {
            craft_price += Math.max(dto.getPcount(), 1) * 3.5;
        }
        count = count * number;
        for (int i = 0; i < counts.length; i++) {
            int countItem = counts[i];
            if (count >= countItem) {
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            Boolean isFirst = priceList.size() == 0;
            int base_price = prices[isFirst ? Math.max(i - 1, 0) : i];
            Product pro = new Product();
            pro.setCount(isFirst ? count : countItem);
            pro.setNumber(number);
            pro.setPrice(Math.ceil((double) base_price / counts[isFirst ? Math.max(i - 1, 0) : i] * Math.max(min_count, isFirst ? count : countItem) + craft_price));
            priceList.add(pro);
        }
        if (priceList.size() == 0) {
            Product pro = new Product();
            pro.setCount(count);
            pro.setNumber(number);
            pro.setPrice(Math.ceil((double) prices[prices.length - 1] / counts[counts.length - 1] * Math.max(min_count, count) + craft_price));
            priceList.add(pro);
        }
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 15));
        }
        return priceList;
    }

    private List<Product> getWireTapePrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double[] areas = {1, 2, 4, 10, 25, 48.60, 81, 100, 126, 170, 230, 294, 450, 598.50, 900};
        int[][] prices = {
                {75, 78, 78, 84, 160, 171, 256, 298, 349, 453, 529, 604, 851, 944, 1322},
                {78, 78, 93, 120, 222, 241, 304, 370, 452, 591, 711, 776, 1085, 1293, 1889},
                {106, 115, 142, 221, 310, 354, 506, 594, 708, 877, 1063, 1206, 1771, 2165, 3163},
                {160, 177, 196, 327, 444, 515, 681, 829, 1017, 1302, 1506, 1742, 2479, 3102, 4492},
                {192, 208, 278, 494, 555, 633, 1041, 1214, 1473, 1753, 2298, 2602, 3908, 4971, 7155},
                {324, 374, 476, 816, 936, 1190, 1934, 2322, 2720, 3230, 4250, 5016, 7396, 9350, 13600},
                {484, 583, 833, 1333, 1667, 2251, 3333, 3833, 4749, 6167, 8084, 9667, 14475, 18333, 26667},
        };
        int[] counts = {500, 1000, 2000, 3000, 5000, 10000, 20000};
        priceList = getAreaCenterPrice(counts, count, width * length, prices, areas, number);

        for (Product product : priceList) {
            if ("2".equals(dto.getKind())) {
                product.setPrice(Math.ceil(product.getPrice() * 1.1));
            }
            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
        }
        return priceList;
    }

    private List<Product> getWallPaintingPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double[][] prices = {
                {45, 45, 55, 75},
                {40, 40, 45, 65}
        };
        double area = length * width / 10000;
        double price = 0, dj = 0;
        double craft_price = 0;

        int index = 0;
        String product_weight = "";
        Map<String, Double> craft_weight_map = new HashMap<>();
        craft_weight_map.put("30", 0.055);
        craft_weight_map.put("40", 0.08);
        craft_weight_map.put("50", 0.095);
        craft_weight_map.put("60", 0.12);
        craft_weight_map.put("70", 0.14);
        craft_weight_map.put("80", 0.16);
        craft_weight_map.put("90", 0.18);
        craft_weight_map.put("100", 0.2);
        long key = Math.round(length);
        if ("贡缎布".equals(dto.getKind())) {
            index = 1;
        }
        if ("30*50".equals(dto.getSize())) {
            dj = prices[index][0];
            price = Math.ceil(count * dj);
        } else if ("50*80".equals(dto.getSize())) {
            dj = prices[index][1];
            price = Math.ceil(count * dj);
        } else if ("60*100".equals(dto.getSize())) {
            dj = prices[index][2];
            price = Math.ceil(count * dj);
        } else if ("80*120".equals(dto.getSize())) {
            dj = prices[index][3];
            price = Math.ceil(count * dj);
        } else {
            if ("贡缎布".equals(dto.getKind())) {
                if (area < 0.25) {
                    dj = 40;
                } else {
                    dj = 35;
                }
                area *= count;
                price = Math.max(Math.ceil(area * dj), 40);

            }
            if ("帆布".equals(dto.getKind())) {
                dto.setStickerKind("");
                priceList = new PriceUtils().getFbPrice(dto, number, width, length, count, priceList);
            }
            Map<String, Double> craft_price_map = new HashMap<>();
            craft_price_map.put("30", 5.0);
            craft_price_map.put("40", 6.0);
            craft_price_map.put("50", 7.0);
            craft_price_map.put("60", 8.0);
            craft_price_map.put("70", 9.0);
            craft_price_map.put("80", 10.0);
            craft_price_map.put("90", 11.0);
            craft_price_map.put("100", 12.0);
            if (craft_price_map.containsKey(String.valueOf(key))) {
                craft_price = craft_price_map.get(String.valueOf(key));
                if (craft_price > 0) {
                    craft_price = Math.ceil(craft_price * count * number);
                }
            }

        }
        if (price > 0) {
            Product pro = new Product();
            pro.setCount(count);
            pro.setPrice(price * number);
            priceList.add(pro);
        }
        if (craft_weight_map.containsKey(String.valueOf(key))) {
            double weight = craft_weight_map.get(String.valueOf(key));
            if ("贡缎布".equals(dto.getKind())) {
                product_weight = (df.format(0.165 * length * width * count / 10000 * number + weight * count * number));


            }
            if ("帆布".equals(dto.getKind())) {
                product_weight = (df.format(length * width * count / 10000 * 0.28 * number + weight * count * number));
            }

        }
        for (Product product : priceList) {
            product.setPrice(product.getPrice() + craft_price);
            product.setWeight(product_weight);
        }
        return priceList;
    }

    private List<Product> getPaperBowlPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int[] counts = {1200, 2400, 3600, 4800, 6000, 10000};
        double[][] prices = {
                {605, 1141, 1557, 2053, 2353, 3557},
                {633, 1195, 1641, 2164, 2491, 3788},
                {653, 1235, 1699, 2243, 2588, 3951},
        };
        int sizeIndex = 0;
        String size = dto.getSize();
        if ("165*64*145".equals(size)) {
            sizeIndex = 1;
        }
        if ("165*75*142".equals(size)) {
            sizeIndex = 2;
        }
        double carftPrice = 0;
        if (craft_list.contains("ops盖")) {
            carftPrice = 0.102;
        }
        if (craft_list.contains("pp盖")) {
            carftPrice = 0.125;
        }
        if (craft_list.contains("牛皮纸盖")) {
            carftPrice = 0.139;
        }
        if (craft_list.contains("白卡纸盖")) {
            carftPrice = 0.113;
        }
        for (int i = 0; i < counts.length; i++) {
            int itemCount = counts[i];
            if (itemCount < count) {
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            if (craft_list.contains("金箔") || craft_list.contains("铝箔")) {
                carftPrice += 0.115;
            }
            Product pro = new Product();
            pro.setCount(priceList.size() == 0 ? count : itemCount);
            pro.setPrice(Math.ceil((prices[sizeIndex][i] + carftPrice * itemCount) * number));
            pro.setNumber(number);
            priceList.add(pro);
        }
        if (priceList.size() == 0) {
            if (craft_list.contains("金箔") || craft_list.contains("铝箔")) {
                carftPrice += 0.115;
            }

            Product pro = new Product();
            pro.setCount(count);
            pro.setPrice(Math.ceil((prices[sizeIndex][prices[sizeIndex].length - 1] / counts[counts.length - 1] + carftPrice) * count * number));
            pro.setNumber(number);
            priceList.add(pro);
        }
        return priceList;
    }

    private List<Product> getPlasticBagPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int[] counts = {200, 500, 1000};
        double[][] prices = {
                {80, 144, 255},
                {96, 169, 300},
                {145, 280, 510},
        };

        if (craft_list.contains("双面相同")) {
            prices = new double[][]{
                    {97, 184, 335},
                    {112, 209, 380},
                    {161, 320, 590},
            };
        }

        if (craft_list.contains("双面不同")) {
            prices = new double[][]{
                    {117, 204, 355},
                    {132, 229, 400},
                    {181, 340, 610},
            };
        }
        int sizeIndex = 0;
        if (width == 40 && length == 30) {
            sizeIndex = 1;
        }
        if (width == 55 && length == 45) {
            sizeIndex = 2;
        }
        for (int i = 0; i < counts.length; i++) {
            int itemCount = counts[i];
            if (itemCount < count) {
                continue;
            }
            Product pro = new Product();
            pro.setCount(itemCount);
            pro.setPrice(Math.ceil(prices[sizeIndex][i] * number * 1.2));
            pro.setNumber(number);
            priceList.add(pro);
        }
        return priceList;
    }

    private List<Product> getWristBandPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int[] counts = {50, 100, 200, 300, 400, 500, 1000, 2000, 3000, 5000, 7000, 10000, 30000, 50000, 100000};
        double[][] prices = {
                {60, 70, 90, 100, 105, 110, 150, 200, 260, 430, 550, 690, 2020, 3080, 5950},
                {60, 70, 90, 100, 105, 110, 150, 200, 260, 430, 550, 690, 2020, 3080, 5950},
                {83, 93, 113, 120, 124, 128, 200, 300, 371, 595, 779, 1041, 3108, 4866, 9669},
                {83, 93, 113, 120, 124, 128, 200, 300, 371, 595, 779, 1041, 3108, 4866, 9669},
                {199, 212, 260, 273, 286, 299, 325, 455, 585, 845, 1105, 1495, 4225, 6435, 12987},
        };
        int j = 0;
        if ("1".equals(dto.getKind())) {
            if (length == 19 && width == 250) {
                j = 0;
            }
            if (length == 19 && width == 200) {
                j = 1;
            }
        }
        if ("2".equals(dto.getKind())) {
            if (length == 19 && width == 250) {
                j = 2;
            }
            if (length == 19 && width == 200) {
                j = 3;
            }
            if (length == 25 && width == 250) {
                j = 4;
            }
        }
        for (int i = 0; i < counts.length; i++) {
            int itemCount = counts[i];
            if (itemCount < count) {
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            double craftPrice = 0;
            double miniCraftPrice = 10;
            if (craft_list.contains("可变二维码")) {
                craftPrice = 0.02 * itemCount;
                miniCraftPrice = 60;
            }
            if (craft_list.contains("序列号")) {
                craftPrice = 0.02 * itemCount;
                miniCraftPrice = 15;
            }
            if (craft_list.contains("可变二维码+序列号")) {
                craftPrice = 0.03 * itemCount;
                miniCraftPrice = 75;
            }
            Product pro = new Product();
            pro.setCount(itemCount);
            if (priceList.size() == 0) {
                pro.setCount(count);
            }
            pro.setPrice(Math.ceil((prices[j][i] + Math.max(craftPrice, miniCraftPrice)) * number));
            pro.setNumber(number);
            pro.setWeight(df.format(width * length * itemCount * 0.08 / 100 / 10000));
            priceList.add(pro);
            if (priceList.size() == 1 && itemCount != count) {
                break;
            }
        }
        return priceList;
    }

    private List<Product> getMousePadPrice(Product dto, Double width, Double length) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double miniPrice = 55;
        double rate = 1;

        String kind = dto.getKind();
        int[] counts = {5, 10, 20, 30, 50, 100, 200};
        double[] areas = {100, 400, 900, 1600, 2500, 3600, 4900, 6400, 8100, 10000, 20000, 30000, 45000};
        double[][] prices = {
                {10, 10, 10, 16, 24, 35, 47, 61, 70, 90, 180, 280, 400},
                {4.7, 5, 8.75, 15, 23, 32, 44, 57.5, 71, 89, 175, 260, 350},
                {2.35, 3.7, 7.8, 13, 21, 29, 40, 52, 65, 81, 160, 240, 340},
                {1.5, 3.2, 6.8, 11, 18, 26, 35, 46, 55, 71, 142, 212, 317},
                {0.8, 2.8, 6.06, 10.5, 16, 23, 31, 40, 50, 60, 126, 188, 280},
                {0.7, 2.5, 5.44, 9.5, 14, 20, 28.3, 36.8, 46, 58, 113, 169, 254},
                {0.63, 2.27, 4.9, 8.6, 13, 18, 25, 33, 40, 52, 100, 150, 230},
        };
        if ("3".equals(kind)) {
            prices = new double[][]{
                    {11, 11, 11, 17.6, 26.4, 38.5, 51.7, 67.1, 77, 99, 198, 308, 440},
                    {5.17, 5.5, 9.625, 16.5, 25.3, 35.2, 48.4, 63.25, 78.1, 97.9, 192.5, 286, 385},
                    {2.585, 4.07, 8.58, 14.3, 23.1, 31.9, 44, 57.2, 71.5, 89.1, 176, 264, 374},
                    {1.65, 3.52, 7.48, 12.1, 19.8, 28.6, 38.5, 50.6, 60.5, 78.1, 156.2, 233.2, 348.7},
                    {0.88, 3.08, 6.666, 11.55, 17.6, 25.3, 34.1, 44, 55, 66, 138.6, 206.8, 308},
                    {0.77, 2.75, 5.984, 10.45, 15.4, 22, 31.13, 40.48, 50.6, 63.8, 124.3, 185.9, 279.4},
                    {0.693, 2.497, 5.39, 9.46, 14.3, 19.8, 27.5, 36.3, 44, 57.2, 110, 165, 253},
            };
        }
        if ("4".equals(kind)) {
            prices = new double[][]{
                    {12.1, 12.1, 12.1, 19.36, 29.04, 42.35, 56.87, 73.81, 84.7, 108.9, 217.8, 338.8, 484},
                    {5.687, 6.05, 10.5875, 18.15, 27.83, 38.72, 53.24, 69.575, 85.91, 107.69, 211.75, 314.6, 423.5},
                    {2.8435, 4.477, 9.438, 15.73, 25.41, 35.09, 48.4, 62.92, 78.65, 98.01, 193.6, 290.4, 411.4},
                    {1.815, 3.872, 8.228, 13.31, 21.78, 31.46, 42.35, 55.66, 66.55, 85.91, 171.82, 256.52, 383.57},
                    {0.968, 3.388, 7.3326, 12.705, 19.36, 27.83, 37.51, 48.4, 60.5, 72.6, 152.46, 227.48, 338.8},
                    {0.847, 3.025, 6.5824, 11.495, 16.94, 24.2, 34.243, 44.528, 55.66, 70.18, 136.73, 204.49, 307.34},
                    {0.7623, 2.7467, 5.929, 10.406, 15.73, 21.78, 30.25, 39.93, 48.4, 62.92, 121, 181.5, 278.3},
            };
        }
        if ("5".equals(kind)) {
            prices = new double[][]{
                    {13.2, 13.2, 13.2, 20.9, 31.9, 46.2, 62.7, 81.4, 93.5, 119.9, 239.8, 372.9, 532.4},
                    {6.05, 6.6, 12.1, 19.8, 30.8, 42.9, 58.3, 77, 94.6, 118.8, 233.2, 346.5, 466.4},
                    {3.08, 4.4, 9.9, 17.6, 27.5, 38.5, 52.8, 69.3, 86.9, 107.8, 213.4, 319, 452.1},
                    {1.98, 4.4, 8.8, 14.3, 24.2, 34.1, 46.2, 61.6, 73.7, 94.6, 189.2, 282.7, 422.4},
                    {0.99, 3.3, 7.7, 14.3, 20.9, 30.8, 41.8, 52.8, 67.1, 80.3, 167.2, 249.7, 372.9},
                    {0.88, 3.3, 7.7, 12.1, 18.7, 26.4, 37.4, 49.5, 61.6, 77, 150.7, 224.4, 337.7},
                    {0.88, 3.3, 6.6, 11, 17.6, 24.2, 33, 44, 52.8, 69.3, 133.1, 200.2, 305.8},
            };
        }
        //不锁边97折
        if (craft_list.contains("不锁边")) {
            rate = 0.97;
        }
        if (craft_list.contains("异形模切")) {
            rate = 1.35;
        }

        double unitPrice = 0;
        Product pro = new Product();
        for (int i = 0; i < counts.length; i++) {
            int itemCount = counts[i];
            unitPrice = PriceUtils.TableDoublePrice(width * length, prices[i], areas);
            if (itemCount < count) {
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            if (priceList.size() == 0 && itemCount != count) {
                pro = new Product();
                pro.setCount(count);
                pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice));
                pro.setNumber(number);
                pro.setWeight(df.format(width * length * 1.2 * count * 0.1 / 1000 * Double.parseDouble(kind)));
                priceList.add(pro);
            }

            pro = new Product();
            pro.setCount(itemCount);
            pro.setWeight(df.format(width * length * 1.2 * itemCount * 0.1 / 1000 * Double.parseDouble(kind)));
            pro.setPrice(Math.max(Math.ceil(unitPrice * itemCount * rate), miniPrice));
            pro.setNumber(number);
            priceList.add(pro);
        }
        if (priceList.size() == 0) {
            pro = new Product();
            pro.setCount(count);
            pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice));
            pro.setNumber(number);
            pro.setWeight(df.format(width * length * 1.2 * count * 0.1 / 1000 * Double.parseDouble(kind)));
            priceList.add(pro);
        }
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() * number));
        }
        return priceList;
    }

    private List<Product> getHandkerPrice(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int maxCount = 10;
        int count = dto.getCount();
        int number = dto.getNumber();
        int[] counts = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        double baseWeight = 8.7;
        int base = 0;
        if (width == 23) {
            base = 1;
            baseWeight = 9.3;
        }
        if (width == 27) {
            base = 2;
            baseWeight = 11;
        }
        double[][] prices = {
                {118, 233, 346, 450, 480, 576, 672, 768, 864, 900},
                {0, 0, 340, 450, 570, 684, 798, 912, 1026, 1040},
                {0, 0, 350, 460, 810, 972, 1134, 1296, 1458, 1780},
        };
        if ("双色".equals(dto.getShen_color())) {
            prices = new double[][]{
                    {0, 0, 0, 0, 625, 720, 840, 960, 1080, 1200},
                    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                    {0, 0, 0, 0, 875, 1020, 1190, 1280, 1350, 1450},
            };
        }
        Product pro = new Product();

        for (int i = 0; i < counts.length; i++) {
            int itemCount = counts[i];
            if (itemCount < count) {
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            double price = 0;
            if ("彩色".equals(dto.getShen_color())) {
                double basePrice = 0;
                if (itemCount == 1) {
                    basePrice = 116;
                } else if (itemCount == 2) {
                    basePrice = 108;
                } else {
                    basePrice = 98;
                }
                price = basePrice * itemCount * number;
            } else {
                price = prices[base][i] * number * 1.2;
            }
            pro = new Product();
            pro.setCount(itemCount);
            pro.setPrice(Math.ceil(price));
            pro.setNumber(number);
            pro.setWeight(df.format(baseWeight * itemCount));
            priceList.add(pro);
        }
        if (priceList.size() == 0 && count > maxCount) {
            double basePrice = prices[base][prices[base].length - 1];
            double price = 0;
            if ("彩色".equals(dto.getShen_color())) {
                basePrice = 98;
                price = basePrice * count * number;
            } else {
                price = basePrice / maxCount * count * number * 1.2;

            }
            pro = new Product();
            pro.setCount(count);
            pro.setPrice(Math.ceil(price));
            pro.setNumber(number);
            pro.setWeight(df.format(baseWeight * count * number));
            priceList.add(pro);
        }

        if ("1000/箱".equals(dto.getNotePaperKind())) {
            for (Product product : priceList) {
                product.setPrice(Math.ceil(product.getPrice() * 2));
            }
        }

        return priceList;
    }

    private List<Product> getTakeoutBoxPrice(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        double[] prices = {2500, 4800, 7200, 12000};
        double height = 6.5;
        width = 12.8;
        length = 10.5;
        if (dto.getPcount() == 3) {
            prices = new double[]{6000, 12000, 18000, 27000};
            height = 6.5;
            width = 21.5;
            length = 16.0;
        }
        if (dto.getPcount() == 5) {
            prices = new double[]{3600, 7200, 10800, 17750};
            height = 5.0;
            width = 16.5;
            length = 13.5;
        }

        int[] counts = {10000, 20000, 30000, 50000};
        Product pro = new Product();
        for (int i = 0; i < counts.length; i++) {
            if (counts[i] < count) {
                continue;
            }
            pro = new Product();
            pro.setCount(counts[i]);
            pro.setPrice(Math.ceil(prices[i] * number));
            pro.setNumber(number);
            pro.setWeight(df.format(width * length * 2 * 0.35 / 10000 * counts[i]));
            priceList.add(pro);
        }
        return priceList;
    }

    private double getListNumber(int[] counts, int count, double[] numbers) {
        for (int j = 0; j < counts.length; j++) {
            if (counts[j] <= count) {
                continue;
            }
            return numbers[j];
        }
        return 0.0;
    }

    private List<Product> getCanvasBagPrice(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        //布钱
        int[] counts = {5, 10, 20, 30, 50, 100, 200, 500, 1000, 5000, 10000};
        double[][] unit_prices = {
                {50, 34, 18, 12, 7.9, 4.5, 4, 3.6, 3.5, 3.3, 3},
                {50, 35, 19, 13, 7.9, 4.4, 4.2, 3.6, 3.3, 3.1, 3},
                {55, 38, 22, 15, 9.2, 4.8, 4.5, 4, 3.6, 3.4, 3.3}
        };
        int base = 2;
        if (width <= 27 && length <= 33 || length <= 27 && width <= 33) {
            base = 0;
        }
        if (width <= 30 && length <= 35 || length <= 30 && width <= 35) {
            base = 1;
        }
        int number = dto.getNumber();
        //布钱 +人工+印刷+手提
        Product pro = null;
        double lastPrice = 0;
        int lastCount = 0;
        for (int i = 0; i < counts.length; i++) {
            int itemCount = counts[i];
            double basePrice = unit_prices[base][i];


            if (itemCount < count) {
                lastPrice = basePrice;
                lastCount = itemCount;
                continue;
            }
            if (priceList.size() > 2) {
                break;
            }
            if (priceList.size() == 0 && itemCount != count) {
                pro = new Product();
                pro.setCount(count);
                pro.setPrice(Math.ceil(new PriceUtils().calcByTargetN(lastCount, lastPrice, itemCount, basePrice, count) * number));
                priceList.add(pro);
            }
            pro = new Product();
            pro.setCount(itemCount);
            pro.setPrice(Math.ceil(unit_prices[base][i] * itemCount * number));
            pro.setWeight(df.format(width * length * 1.8 * itemCount / 10000));
            priceList.add(pro);
            lastPrice = basePrice;

        }
        return priceList;
    }

    private List<Product> getfridgePrice(Product dto, Double width, Double length, String role) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        String cailiao = dto.getCailiao();
        double price = 0;
        double min_price = 50;
        int count = dto.getCount();
        int number = dto.getNumber();
        double last_price = 1000;
        double area = width * length * dto.getCount() / 10000 * dto.getNumber();
        String weight = "";
        if ("冰箱贴".equals(dto.getKindValue())) {
            if (width * length / 10000 < 0.001) {
                double basePrice = 1;
                if ("4.2".equals(cailiao)) {
                    basePrice = 1.5;
                }
                price = Math.max(basePrice * count * dto.getNumber() + 8 * dto.getNumber(), min_price);
            } else {

                double[] areas = {0, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 2, 3, 5, 7, 9, 10, 20, 50};
                int[] prices = {0, 1500, 1480, 1450, 1400, 1380, 1350, 1200, 1100, 1080, 1050, 1000, 1000, 1000, 1000, 1000};
                if ("2.3".equals(cailiao) && carft_list.contains("激光")) {
                    prices = new int[]{0, 1500, 1400, 1350, 1300, 1280, 1250, 1100, 1000, 950, 900, 850, 850, 850, 850, 850};
                    last_price = 850;
                }
                if ("4.2".equals(cailiao) && carft_list.contains("CNC")) {
                    prices = new int[]{0, 1600, 1500, 1480, 1450, 1400, 1380, 1350, 1300, 1250, 1200, 1200, 1200, 1200, 1200, 1200};
                    last_price = 1200;
                }
                if ("2.3".equals(cailiao) && carft_list.contains("CNC")) {
                    prices = new int[]{0, 1500, 1400, 1380, 1350, 1300, 1280, 1250, 1200, 1150, 1100, 1100, 1100, 1100, 1100, 1100};
                    last_price = 1100;
                }
                price = PriceUtils.TableUnitPrice(area, prices, areas, last_price);
                if (carft_list.contains("激光") && carft_list.contains("滴胶")) {
                    price = price * 1.3;
                }

            }
            price = Math.max(price, min_price) + ((dto.getNumber() - 1) * 8);
            weight = df.format(width * length * 4.17 * dto.getCount() * 0.1 * number / 1000 * Double.parseDouble(cailiao));
        }

        if ("对联冰箱贴".equals(dto.getKindValue())) {
            double basePrice = 0;
            min_price = 55;
            double baseWeight = 0.4;
            if ("2.3".equals(cailiao) && "70*80".equals(dto.getSize())) {
                basePrice = 8;
            }
            if ("2.3滴塑".equals(cailiao) && "70*80".equals(dto.getSize())) {
                basePrice = 10;
            }
            if ("2.3".equals(cailiao) && "90*100".equals(dto.getSize())) {
                basePrice = 10;
                baseWeight = 0.6;
            }
            if ("2.3滴塑".equals(cailiao) && "90*100".equals(dto.getSize())) {
                basePrice = 12;
                baseWeight = 0.6;
            }
            if ("2.3滴塑".equals(cailiao)) {
                cailiao = "2.3";
            }
            price = basePrice * count * number;
            if (carft_list.contains("激光") && carft_list.contains("滴胶")) {
                price = price * 1.3;
            }
            price = Math.ceil(Math.max((price), min_price) + 8 * number);
            weight = df.format(width * length * 4.17 * dto.getCount() * number * 0.1 / 100000 * Double.parseDouble(cailiao));
        }

        double card_price = 0;
        if (carft_list.contains("背卡")) {
            String card_size = dto.getSize1();
            int card_count = dto.getShuliang();
            int card_number = dto.getPinzhong();
            double card_width = Double.parseDouble(card_size.split("\\*")[0]);
            double card_length = Double.parseDouble(card_size.split("\\*")[1]);
            // 出血（一边2毫米）
            card_length = card_length * 10 + 4;
            card_width = card_width * 10 + 4;
            double fixPrice = 30.0;

            double zhang = 6;
            if (carft_list.contains("背卡异形模切")) {
                fixPrice = 32.0;
                zhang = 8;
            }

            double l = 420;
            double w = 285;
            double designFee = 0;
            if ((card_length - 4 <= 90 && card_width - 4 <= 54) || (card_length - 4 <= 54 && card_width - 4 <= 90)) {
                designFee = 8;
            } else if ((card_length - 4 <= 210 && card_width - 4 <= 140) || (card_length - 4 <= 140 && card_width - 4 <= 210)) {
                designFee = 15;
            } else if ((card_length - 4 <= 285 && card_width - 4 - 4 <= 210) || (card_length - 4 <= 210 && card_width - 4 <= 285)) {
                designFee = 35;
            } else if ((card_length - 4 <= 420 && card_width - 4 <= 285) || (card_length - 4 <= 285 && card_width - 4 <= 420)) {
                designFee = 50;
            } else {
                designFee = 80;
            }
            double max = 1;
            if (card_length == 424 || card_length == 289 || card_width == 424 || card_width == 289) {
                max = Math.max(Math.floor(l / (card_length - 4)) * Math.floor(w / (card_width - 4)), Math.floor(l / (card_width - 4)) * Math.floor(w / (card_length - 4)));
            } else {
                max = Math.max(Math.floor(l / card_length) * Math.floor(w / card_width), Math.floor(l / card_width) * Math.floor(w / card_length));
            }
            max = Math.max(max, 1);
            // 报的数量需要多少张大纸
            //100张 合版
            double desFee = 0;
            if (card_count > 100) {
                dto.setProTypeValue("4");
                priceList = getHekaPrice(getNum(length, width), dto, priceList, count);
                if (carft_list.contains("背卡异形模切")) {
                    priceList = getOtherHekaPrice(dto, width, length);
                }
                if (priceList != null && priceList.size() > 0) {
                    card_price = priceList.get(0).getPrice();
                    priceList = new ArrayList<>();
                    card_price = card_price * card_number;
                }
            } else {

                // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
                int num = (int) Math.ceil(card_count * card_number / max);
                card_price = fixPrice + (num - 1) * zhang + designFee + 0.2 * card_number * card_count;
                if (((card_width > 42 && card_length > 28.5) || (card_width > 28.5 && card_length > 42))) {
                    card_price = Math.max(Math.ceil(card_price * 0.85), fixPrice + designFee);
                }

                if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) {
                    if (card_number > 1) {
                        desFee = 5.5 * (card_number - 1);

                    }
                } else {
                    //第二款开始的设计费按照式设计内容
                    if (card_number > 1) {
                        desFee = 5.5;
                    }
                }
            }

            card_price += desFee;

        }


        Product pro = new Product();
        pro.setCount(dto.getCount());
        pro.setNumber(dto.getNumber());
        pro.setWeight(weight);
        pro.setPrice(Math.ceil(price + card_price));
        priceList.add(pro);

        if (role.contains("1045")) {
            for (Product product : priceList) {
                product.setPrice(Math.ceil(pro.getPrice() * 0.85));
            }
        }


        return priceList;
    }

    private List<Product> getbadgePrice(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int[] count_list = {
                50, 100, 200, 500, 1000, 2000, 3000, 5000, 10000
        };
        if (carft_list.contains("PET印刷")) {
            double[][] prices_list = {
                    {450, 880, 1700, 3250, 5380, 10000, 14728, 23685, 43103},
            };
            double mini_price = 450;
            int pre_count = 0;
            double base_price = 0;
            Product pro = new Product();
            for (int i = 0; i < count_list.length; i++) {
                double price = prices_list[0][i];

                int item_count = count_list[i];
                base_price = prices_list[0][i] / item_count;
                if (item_count < count) {
                    pre_count = item_count;
                    continue;
                }
                if (priceList.size() > 2) {
                    break;
                }
                //数量小于50

                if ((priceList.size() == 0) && count != item_count && count > pre_count) {
                    if (pre_count > 0) {
                        base_price = prices_list[0][i - 1] / pre_count;
                    }
                    pro = new Product();
                    pro.setCount(count);
                    pro.setWeight(df.format(0.005 * count * dto.getNumber()));
                    pro.setPrice(Math.max(Math.ceil(base_price * count * dto.getNumber()), mini_price));
                    priceList.add(pro);
                }
                base_price = prices_list[0][i] / item_count;
                pro = new Product();
                pro.setCount(item_count);
                pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
                pro.setPrice(Math.max(Math.ceil(base_price * item_count * dto.getNumber()), mini_price));
                priceList.add(pro);
                pre_count = item_count;

            }
            if (priceList.size() == 0) {
                pro = new Product();
                pro.setCount(count);
                pro.setWeight(df.format(0.005 * count * dto.getNumber()));
                pro.setPrice(Math.max(Math.ceil(base_price * count * dto.getNumber()), mini_price));
                priceList.add(pro);
            }
        }
        if (carft_list.contains("UV印刷")) {
            int pre_count = 0;
            double miniprice = 400;
            double mo_price = 300;
            double base_price = 3.5;
            int mini_count = 30;
            if (width <= 3 && length <= 3) {

            } else if (width <= 4 && length <= 4) {
                mo_price = 300;
                base_price = 4;
            } else if (width <= 5 && length <= 5) {
                mo_price = 320;
                base_price = 5;
            } else if (width <= 6 && length <= 6) {
                mo_price = 340;
                base_price = 6;
            } else if (width <= 7 && length <= 7) {
                mo_price = 380;
                base_price = 6.5;
            } else if (width <= 8 && length <= 8) {
                mo_price = 420;
                base_price = 7;
            } else {
                mo_price = 480;
                base_price = 8;
            }

            Product pro = new Product();
            pro.setCount(count);
            pro.setWeight(df.format(0.005 * dto.getNumber() * Math.max(mini_count, count)));
            pro.setPrice(Math.max(Math.ceil(base_price * Math.max(mini_count, count) * dto.getNumber() + mo_price * dto.getNumber()), miniprice));
            priceList.add(pro);
            for (int i = 0; i < count_list.length; i++) {
                int item_count = count_list[i];
                if (item_count < count || count == item_count) {
                    continue;
                }
                if (priceList.size() > 2) {
                    break;
                }
                pro = new Product();

                pro = new Product();
                pro.setCount(item_count);
                pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
                pro.setPrice(Math.max(Math.ceil(base_price * item_count * dto.getNumber() + mo_price * dto.getNumber()), miniprice));
                priceList.add(pro);
            }
        }
        return priceList;
    }


    private List<Product> getantiLabelPrice(Product dto, Double width, Double length) {
        List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        int[][] prices = {
                {176, 176, 176, 176, 176, 176, 176, 176, 180, 184, 192, 192, 202, 228, 228},
                {180, 180, 182, 184, 186, 188, 196, 206, 240, 260, 274, 286, 306, 344, 360},
                {184, 184, 184, 194, 214, 228, 264, 290, 358, 408, 434, 466, 506, 572, 650},
                {190, 202, 210, 224, 256, 282, 332, 374, 478, 554, 590, 660, 716, 814, 942},
                {200, 232, 254, 290, 338, 392, 468, 544, 728, 864, 920, 1046, 1138, 1298, 1520},
                {226, 312, 368, 452, 550, 672, 814, 980, 1358, 1636, 1746, 2008, 2190, 2502, 2970},
                {274, 470, 594, 784, 988, 1250, 1518, 1854, 2614, 3184, 3398, 3936, 4298, 4916, 5872},
        };
        int[] count_list = {500, 1000, 2000, 3000, 5000, 10000, 20000};
        double[] areas = {1, 4, 6, 9, 12, 16, 20, 25, 36, 45, 48.6, 54, 60, 72, 81};

        double area = length * width;
        priceList = getAreaCenterPrice(count_list, count, area, prices, areas, number);
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() * 1.3));
            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
        }
        if (carft_list.contains("印白墨")) {
            priceList = PriceUtils.getYinBaiPrice(priceList, width, length);
        }
        return priceList;
    }

    private List<Product> getaromatherapyPrice(Product dto, Double width, Double length) {
        List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        List<Product> priceList = new ArrayList<>();
        //大纸尺寸
        double max_width = 290;
        double max_length = 390;
        double base_price = 21;
        double min_price = 35;
        if ("2".equals(dto.getKind())) {
            max_width = 420;
            max_length = 310;
            base_price = 35;
        }
        if ("3".equals(dto.getKind())) {
            max_width = 420;
            max_length = 310;
            base_price = 40;
        }
        width = width * 10 + 4;
        length = length * 10 + 4;

        double max = 1;

        if (length == max_width + 4 || length == max_length + 4 || width == max_width + 4 || width == max_length + 4) {
            max = Math.max(Math.floor(max_width / (length - 4)) * Math.floor(max_length / (width - 4)), Math.floor(max_width / (width - 4)) * Math.floor(max_length / (length - 4)));
        } else {
            max = Math.max(Math.floor(max_width / length) * Math.floor(max_length / width), Math.floor(max_width / width) * Math.floor(max_length / length));
        }
        max = Math.max(max, 1);
        // 报的数量需要多少张大纸
        // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
        double num = Math.ceil(dto.getCount() / max);

        if (num > 3 && num <= 30) {
            base_price = 19;
            if ("2".equals(dto.getKind())) {
                base_price = 33;
            }
            if ("3".equals(dto.getKind())) {
                base_price = 38;
            }
        } else if (num > 31 && num <= 60) {
            base_price = 17;
            if ("2".equals(dto.getKind())) {
                base_price = 31;
            }
            if ("3".equals(dto.getKind())) {
                base_price = 36;
            }
        } else if (num > 61 && num <= 150) {
            base_price = 15;
            if ("2".equals(dto.getKind())) {
                base_price = 29;
            }
            if ("3".equals(dto.getKind())) {
                base_price = 34;
            }
        } else {
            base_price = 14;
            if ("2".equals(dto.getKind())) {
                base_price = 28;
            }
            if ("3".equals(dto.getKind())) {
                base_price = 33;
            }
        }
        double craft_price = 0;
        double bao_price = 0;
        if (carftList.contains("打码")) {
            bao_price += Math.max(Math.ceil(0.2 * dto.getCount() * dto.getNumber()), 15);
        }
        if (carftList.contains("单独包装")) {
            bao_price += Math.ceil(0.2 * dto.getCount() * dto.getNumber());
        }
        if (carftList.contains("真空包装")) {
            bao_price += Math.ceil(0.35 * dto.getCount() * dto.getNumber());
        }
        if (carftList.contains("配涤纶丝带")) {
            craft_price += Math.ceil(0.1 * dto.getCount() * dto.getNumber());
        }
        if (carftList.contains("配吊牌绳")) {
            craft_price += Math.ceil(0.1 * dto.getCount() * dto.getNumber());
        }
        if (carftList.contains("配弹力绳")) {
            craft_price += Math.ceil(0.1 * dto.getCount() * dto.getNumber());
        }
        if (carftList.contains("配别针")) {
            craft_price += Math.ceil(0.1 * dto.getCount() * dto.getNumber());
        }
        if (carftList.contains("穿涤纶丝带") || carftList.contains("穿吊牌绳") || carftList.contains("穿弹力绳") || carftList.contains("穿别针")) {
            craft_price += Math.ceil(0.15 * dto.getCount() * dto.getNumber());
        }
        int number = dto.getNumber();
        double designFee = 5 * (number - 1);
        double cardDesignFee = 0.0;
        int card_num = getNum((length - 4) / 10, (width - 4) / 10);
        if (card_num <= 1) {
            cardDesignFee = 8.5;
        } else if (card_num <= 2) {
            cardDesignFee = 12.5;
        } else if (card_num <= 3) {
            cardDesignFee = 16.5;
        } else {
            cardDesignFee = 20.5;
        }
        Product pro = new Product();
        pro.setPrice(Math.ceil(Math.max((base_price * num) * number, min_price) + designFee + bao_price + (craft_price == 0 ? craft_price : Math.max(craft_price, 5))));
        pro.setCount(dto.getCount());
        pro.setNumber(dto.getNumber());
        pro.setWeight(df.format(dto.getNumber() * (length - 4) / 1000 * (width - 4) / 1000 * dto.getCount() * 0.2 * 0.86));
        priceList.add(pro);
        return priceList;
    }

    private List<Product> getLingmoPrice(Product dto, Double width, Double length) {
        List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        int count_list[] = {10000, 20000, 30000, 50000, 100000};
        int number = dto.getNumber();
        List<Product> list = new ArrayList<>();
        double basePrice = width * length * 55 * 12 / 10000 / 1000 + 0.05;
        if ((width > 60 || length > 80) && width > 80 || length > 60) {
            basePrice = basePrice * 4;
        } else if ((width > 50 || length > 30) && width > 30 || length > 50) {
            basePrice = basePrice * 2;
        }
        double miniPrice = 850;
        double yunPrice = 50;
        double banPrice = 180;

        for (int i = 0; i < count_list.length; i++) {

            int item_count = count_list[i];

            if (item_count < dto.getCount()) {
                continue;
            }
            if (list.size() > 2) {
                break;
            }
            double craft_price = 0;
            //3万张以内的价格需要加上上机费，1-2色的上机费是200元，3色400
            if (item_count <= 30000) {
                craft_price = Math.ceil(Math.max(250, (dto.getCo_number() - 1) * 250));
            }
            double price = 0;
            price = Math.ceil(Math.max(miniPrice, basePrice * item_count + item_count / 10000 * yunPrice + banPrice + craft_price));
            Product pro = new Product();
            pro.setCount(item_count);
            pro.setPrice(price * number);
            pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
            list.add(pro);
        }
        return list;
    }

    private List<Product> getLightPrice(Product dto, Double width, Double length) {
        List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        double[][] prices = new double[][]{
                {403, 503, 503, 503, 543, 582, 582, 582, 620, 620, 660, 698, 775, 775, 852.5, 853, 853},
                {520, 520, 520, 520, 560, 600, 600, 600, 640, 640, 680, 720, 800, 800, 880, 880, 880},
                {600, 600, 600, 600, 637.5, 675, 675, 675, 750, 750, 825, 862.5, 975, 975, 1050, 1050, 1125},
                {625, 625, 625, 625, 662.5, 700, 700, 700, 775, 775, 850, 887.5, 1000, 1000, 1075, 1075, 1150},
                {652, 652, 652, 652, 725, 762, 762, 762, 870, 870, 942, 978, 1051, 1051, 1087, 1087, 1196},
                {798, 798, 798, 798, 943, 1015, 1015, 1015, 1087, 1087, 1196, 1196, 1341, 1341, 1450, 1450, 1631},
                {910, 910, 910, 910, 1120, 1155, 1225, 1225, 1400, 1470, 1575, 1575, 1680, 1680, 1855, 1925, 2100},
        };
        if (carftList.contains("烫金+激凸")) {
            prices = new double[][]{
                    {620, 620, 620, 698, 698, 852, 852, 980, 1127, 1285, 1465, 1656, 1871, 2095, 2346, 2605, 2892},
                    {640, 640, 640, 720, 720, 880, 880, 1012, 1164, 1327, 1512, 1709, 1931, 2163, 2422, 2689, 2984},
                    {713, 713, 713, 788, 788, 938, 938, 1078, 1240, 1413, 1611, 1821, 2057, 2304, 2581, 2864, 3197},
                    {863, 863, 863, 1050, 1050, 1125, 1125, 1294, 1488, 1696, 1934, 2185, 2469, 2765, 3097, 3437, 3815},
                    {979, 943, 1015, 1160, 1160, 1341, 1341, 1542, 1774, 2022, 2305, 2605, 2944, 3297, 3692, 4098, 4549},
                    {1124, 1160, 1160, 1450, 1595, 1740, 1885, 2168, 2493, 2842, 3240, 3661, 4137, 4633, 5189, 5760, 6393},
                    {1365, 1575, 2135, 2345, 2800, 3150, 3220, 3703, 4258, 4855, 5534, 6254, 7067, 7915, 8864, 9840, 10921},
            };
        }
        int number = dto.getNumber();
        int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000};
        double[] areas = new double[]{9, 12.25, 16, 20.25, 25, 30.25, 36, 42.25, 49, 56.25, 64, 72.25, 81, 90.25, 100, 110.25, 121};
        double area = (length + 0.4) * (width + 0.4);//加上4毫出血
        List<Product> priceList = getAreaNextPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
        for (Product product : priceList) {
            product.setPrice(Math.ceil(product.getPrice() * 0.8));
            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
        }

        return priceList;
    }

    private List<Product> getDalanPrice(Product dto, Double width, Double length) {
        //铜版纸200g （售价）
        int[][] prices = new int[][]{
                {90, 90, 90, 90, 90, 94, 94, 94, 94},
                {100, 100, 100, 100, 100, 187, 187, 187, 187},
                {140, 140, 140, 140, 140, 280, 280, 280, 280},
                {187, 187, 187, 187, 187, 374, 374, 374, 374},
                {234, 234, 234, 234, 234, 467, 467, 467, 467},
                {467, 467, 467, 467, 467, 934, 934, 934, 934},
                {934, 934, 934, 934, 934, 1867, 1867, 1867, 1867},
                {2334, 2334, 2334, 2334, 2334, 4667, 4667, 4667, 4667},
                {4667, 4667, 4667, 4667, 4667, 9334, 9334, 9334, 9334},
                {9334, 9334, 9334, 9334, 9334, 18667, 18667, 18667, 18667},
                {23334, 23334, 23334, 23334, 23334, 46667, 46667, 46667, 46667},
        };
        if ("2".equals(dto.getKind())) {
            prices = new int[][]{
                    {90, 90, 90, 90, 90, 107, 107, 107, 107},
                    {100, 107, 107, 107, 107, 213, 213, 213, 213},
                    {120, 160, 160, 160, 160, 320, 320, 320, 320},
                    {150, 213, 213, 213, 213, 427, 427, 427, 427},
                    {139, 267, 267, 267, 267, 533, 533, 533, 533},
                    {267, 533, 533, 533, 533, 1067, 1067, 1067, 1067},
                    {533, 1067, 1067, 1067, 1067, 2133, 2133, 2133, 2133},
                    {1333, 2667, 2667, 2667, 2667, 5333, 5333, 5333, 5333},
                    {2667, 5333, 5333, 5333, 5333, 10667, 10667, 10667, 10667},
                    {5333, 10667, 10667, 10667, 10667, 21333, 21333, 21333, 21333},
                    {13333, 26667, 26667, 26667, 26667, 53333, 53333, 53333, 53333},
            };
        }
        if ("3".equals(dto.getKind())) {
            prices = new int[][]{
                    {90, 90, 90, 90, 90, 150, 150, 150, 150},
                    {100, 140, 140, 150, 150, 300, 300, 300, 300},
                    {110, 207, 207, 223, 223, 447, 447, 447, 447},
                    {140, 277, 277, 300, 300, 597, 597, 597, 597},
                    {180, 347, 347, 373, 373, 747, 747, 747, 747},
                    {347, 693, 693, 747, 747, 1493, 1493, 1493, 1493},
                    {693, 1387, 1387, 1493, 1493, 2987, 2987, 2987, 2987},
                    {1733, 3467, 3467, 3733, 3733, 7467, 7467, 7467, 7467},
                    {3467, 6933, 6933, 7467, 7467, 14933, 14933, 14933, 14933},
                    {6933, 13867, 13867, 14933, 14933, 29867, 29867, 29867, 29867},
                    {17333, 34667, 34667, 37333, 37333, 74667, 74667, 74667, 74667},
            };
        }
        int[] count_list = new int[]{10, 20, 30, 40, 50, 100, 200, 500, 1000, 2000, 5000};
        double[] areas = new double[]{1197, 1716, 2394, 2596, 3430, 3467.1, 4788, 5192, 6860};
        double area = length * width;

        return getAreaCenterPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
    }

    private List<Product> getJiadaoPrice(Product dto, Double length, Double width) {
        List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());

        double[][] prices = {
                {90, 148, 240, 550},
                {100, 160, 250, 550},
                {110, 175, 258, 550},
                {120, 180, 266, 595},
                {130, 203, 290, 648},
        };
        if (!carftList.contains("白底黑字")) {
            prices = new double[][]{
                    {138, 148, 240, 550},
                    {150, 160, 250, 550},
                    {165, 175, 258, 550},
                    {170, 180, 266, 595},
                    {193, 203, 290, 648},
            };
        }
        int[] count_list = new int[]{10, 20, 40, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
        double[] lengths = {1.2, 1.5, 1.8, 2, 2.4};
        if ("2".equals(dto.getKind())) {
            prices = new double[][]{
                    {110, 210, 290, 587},
                    {119, 240, 298, 587},
                    {125, 240, 308, 587},
                    {137, 240, 316, 630},
                    {146, 254, 340, 681},
            };
            if (!carftList.contains("黑底白字")) {
                prices = new double[][]{
                        {226, 236, 290, 587},
                        {230, 240, 298, 587},
                        {230, 240, 308, 587},
                        {230, 240, 316, 630},
                        {244, 254, 340, 681},
                };
            }
        }
        if ("3".equals(dto.getKind())) {
            prices = new double[][]{
                    {91, 158, 234, 514},
                    {91, 158, 234, 514},
                    {100, 168, 242, 542},
                    {100, 168, 251, 550},
                    {110, 175, 275, 564},
            };
            count_list = new int[]{10, 20, 40, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
        }
        if ("4".equals(dto.getKind())) {
            prices = new double[][]{
                    {362, 678},
                    {423, 802},
                    {507, 980},
                    {545, 1033},
                    {643, 1225},
            };
            if (carftList.contains("满底全彩")) {
                prices = new double[][]{
                        {422, 832},
                        {472, 922},
                        {534, 1072},
                        {575, 1160},
                        {665, 1363},
                };
            }
            count_list = new int[]{50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
        }
        List<Product> list = new ArrayList<>();
        double last_price = 0;
        int last_count = 0;
        int current_int = Arrays.binarySearch(lengths, length);
        double[] prices_list = prices[current_int];
        double craft_price = 0;
        if (carftList.contains("切割机")) {
            craft_price = Math.ceil(dto.getStickNum() * 15);
        }
        for (int i = 0; i < count_list.length; i++) {
            double price = 0;

            int item_count = count_list[i];
            if (i < prices_list.length) {
                price = last_price = prices_list[i];
                last_count = item_count;
            } else {
                price = last_price * Math.ceil(1.0 * item_count / last_count);
            }

            if (item_count < dto.getCount()) {
                continue;
            }
            if (list.size() > 2) {
                break;
            }
            Product pro = new Product();
            pro.setCount(item_count);
            pro.setWeight(df.format(100 * length / 100 * 0.128 * item_count));
            pro.setPrice(Math.ceil(price * dto.getNumber() + craft_price));
            list.add(pro);
        }

        return list;
    }

    private List<Product> getOtherHekaPrice(Product dto, double length, double width) {
        int[][] prices = {
                {79, 79, 79, 79, 79, 79, 79, 79, 79, 91, 92, 92, 95, 125, 135, 139, 152, 186, 340, 345, 435, 450},
                {97, 97, 97, 97, 97, 97, 97, 97, 97, 114, 115, 116, 118, 158, 162, 162, 185, 194, 358, 363, 459, 465},
                {153, 153, 153, 153, 153, 153, 153, 153, 153, 169, 171, 172, 175, 234, 251, 256, 286, 291, 480, 490, 620, 635},
                {250, 250, 250, 250, 250, 250, 250, 250, 250, 266, 273, 275, 278, 330, 380, 390, 429, 442, 640, 655, 825, 877},
                {370, 370, 370, 370, 370, 370, 370, 370, 370, 371, 372, 373, 375, 480, 500, 515, 545, 632, 800, 886, 1030, 1240},
                {510, 510, 510, 510, 510, 510, 510, 510, 510, 589, 600, 605, 610, 750, 800, 820, 932, 1022, 1160, 1458, 1488, 2000},
                {945, 945, 945, 945, 945, 945, 945, 945, 945, 1030, 1040, 1045, 1050, 1200, 1440, 1460, 1798, 2000, 2400, 2950, 3012, 4000},
        };
        int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};
        double[] areas = {4, 16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 172.8, 194.4, 224, 288, 294, 400};
        //款数在外面处理
        return getAreaCenterPrice(count_list, dto.getCount(), length * width, prices, areas, 1);
    }

    private List<Product> getPETPrice(Product dto, double length, double width) {
        int[][] prices = new int[][]{
                {136, 163, 177, 190, 197, 227, 257, 303, 333, 407, 430},
                {193, 250, 277, 300, 313, 373, 433, 530, 587, 733, 780},
                {250, 337, 373, 410, 430, 520, 613, 757, 840, 1063, 1133},
                {307, 423, 473, 523, 547, 670, 790, 983, 1097, 1390, 1483},
                {333, 463, 520, 573, 603, 737, 873, 1090, 1210, 1540, 1643},
                {490, 697, 783, 873, 917, 1133, 1350, 1693, 1890, 2417, 2580},
                {533, 760, 857, 953, 1003, 1237, 1477, 1853, 2067, 2643, 2823},
                {990, 1440, 1633, 1830, 1927, 2397, 2873, 3627, 4057, 5207, 5567},
                {2007, 2943, 3347, 3747, 3950, 4927, 5910, 7473, 8367, 10743, 11490},
                {3013, 4413, 5013, 5613, 5913, 7373, 8847, 11180, 12513, 14077, 16007},
        };
        int[] count_list = new int[]{100, 200, 300, 400, 500, 800, 1000, 2000, 5000, 10000};
        double[] areas = new double[]{22.5, 35.1, 40.5, 45.9, 48.6, 67.75, 75, 96, 108, 140, 150};
        double area = length * width;
        List<Product> priceList = getAreaCenterPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
        List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        for (Product product : priceList) {
            product.setWeight(df.format(width / 100 * length / 100 * product.getCount() * 0.48 * 1.4));
//            if (carftList.contains("装opp袋")) {
//                product.setPrice(Math.ceil(product.getPrice() + Math.max(product.getCount() * dto.getNumber() * 0.33, 100)));
//            }
        }
        return priceList;
    }

    private List<Product> getCheTiePrice(Product dto, double length, double width) {
        double minPrice = 50;
        length = length / 100;
        width = width / 100;
        double area = length * width;
        double basePrice = 0;
        if ("1".equals(dto.getKind())) {
            if (area < 1) {
                basePrice = 166;
            } else if (area < 2) {
                basePrice = 160;
            } else if (area < 5) {
                basePrice = 150;
            } else if (area < 10) {
                basePrice = 120;
            } else {
                basePrice = 100;
            }
        }
        //反光贴
        if ("2".equals(dto.getKind())) {
            if (area <= 1) {
                basePrice = 138;
            } else if (area <= 2) {
                basePrice = 110;
            } else {
                basePrice = 100;
            }
        }
        int number = dto.getNumber();
        List<Product> priceList = new ArrayList<>();
        Product pro = new Product();
        double price = basePrice * dto.getCount() * area * dto.getNumber();
        if (area <= 0.25) {
            price = basePrice * dto.getCount() * area * dto.getNumber() + dto.getNumber() + 6;
        }
        pro.setPrice(Math.ceil(Math.max(price * 1.2, minPrice)));
        pro.setCount(dto.getCount());
        pro.setWeight(df.format(area * 0.25 * number));
        priceList.add(pro);
        return priceList;
    }

    private List<Product> getMedalPrice(Product dto, Double width, Double length) {
        String kindValue = dto.getKindValue();
        String name = dto.getKind1Value();
        double price = 0.0;
        Double zhongliang = 0.0;
        List<Product> priceList = new ArrayList<>();
        int count = dto.getCount();
        int number = dto.getNumber();
        if ("水晶".equals(kindValue)) {
            if ("酸洗五角星".equals(name)) {
                price = Math.ceil(98 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("炫彩刀片".equals(name)) {
                price = Math.ceil(98 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("金色刀片".equals(name)) {
                price = Math.ceil(120 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("尖角".equals(name)) {
                price = Math.ceil(160 * dto.getCount());
                zhongliang = 2.3;
            }
            if ("斜面6角星".equals(name)) {
                price = Math.ceil(90 * dto.getCount());
                zhongliang = 2.6;
            }
            if ("八角".equals(name)) {
                price = Math.ceil(108 * dto.getCount());
                zhongliang = 3.1;
            }
            if ("蓝色梦想".equals(name)) {
                price = Math.ceil(120 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("蓝色三条线".equals(name)) {
                price = Math.ceil(98 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("蓝色弯弯".equals(name)) {
                price = Math.ceil(98 * dto.getCount());
                zhongliang = 2.2;
            }
            if ("斜面5角星".equals(name)) {
                price = Math.ceil(88 * dto.getCount());
                zhongliang = 2.5;
            }
            if ("麦穗圆型".equals(name)) {
                price = Math.ceil(108 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("酸洗凹面".equals(name)) {
                price = Math.ceil(118 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("月牙".equals(name)) {
                price = Math.ceil(108 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("大拇指".equals(name)) {
                price = Math.ceil(60 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("宝剑".equals(name)) {
                price = Math.ceil(108 * dto.getCount());
                zhongliang = 2.9;
            }
            if ("蓝色五角星".equals(name)) {
                price = Math.ceil(128 * dto.getCount());
                zhongliang = 2.9;
            }
        } else {
            List<String> carfts = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
            if ("20*25".equals(dto.getSize())) {
                if (carfts.contains("直边")) {
                    price = Math.ceil(33 * dto.getCount());
                } else {
                    price = Math.ceil(39 * dto.getCount());
                }
                zhongliang = 1.3;
            }
            if ("24*31".equals(dto.getSize())) {
                if (carfts.contains("直边")) {
                    price = Math.ceil(36 * dto.getCount());
                } else {
                    price = Math.ceil(45 * dto.getCount());
                }
                zhongliang = 1.6;
            }
            if ("25*35".equals(dto.getSize())) {
                if (carfts.contains("直边")) {
                    price = Math.ceil(39 * dto.getCount());
                } else {
                    price = Math.ceil(54 * dto.getCount());
                }
                zhongliang = 1.7;
            }
            if ("30*40".equals(dto.getSize())) {
                if (carfts.contains("直边")) {
                    price = Math.ceil(42 * dto.getCount());
                } else {
                    price = Math.ceil(66 * dto.getCount());
                }
                zhongliang = 2.7;
            }
            if ("35*50".equals(dto.getSize())) {
                if (carfts.contains("直边")) {
                    price = Math.ceil(57 * dto.getCount());
                } else {
                    price = Math.ceil(75 * dto.getCount());
                }
                zhongliang = 3.6;
            }
            if ("40*60".equals(dto.getSize())) {
                if (carfts.contains("直边")) {
                    price = Math.ceil(75 * dto.getCount());
                } else {
                    price = Math.ceil(108 * dto.getCount());
                }
                zhongliang = 4.8;
            }
        }
        Product pro = new Product();
        pro.setCount(count);
        pro.setPrice(price * number);
        pro.setWeight(df.format(Math.ceil(zhongliang * dto.getCount() * number)));
        priceList.add(pro);
        return priceList;
    }

    private List<Product> getLeiseDiaoPrice(Product dto, double length, double width) {
        double[] prices = new double[]{170, 233, 370, 537, 643, 843, 1613, 3117, 4847};
        int[] count_list = new int[]{500, 1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000};
        int num = getNum(width, length);
        List<Product> priceList = new ArrayList<>();
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        int number = dto.getNumber();
        for (int i = 0; i < count_list.length; i++) {
            int count_item = count_list[i];
            if (priceList.size() > 2) {
                break;
            }
            if (dto.getCount() > count_item) {
                continue;
            }
            double price = prices[i];
            price = price + price * 0.9 * (num - 1);
            Product product = new Product();
            product.setCount(count_item);
            product.setPrice(Math.ceil(price));

            priceList.add(product);
        }
        for (Product product : priceList) {
            int item_count = product.getCount();
            double carft_price = 0;
            if (craft_list.contains("满底烫镭射银") && "双面".equals(dto.getCraftShua())) {
                product.setPrice(Math.ceil(product.getPrice() * 1.4));
            }
            if (craft_list.contains("打孔")) {
                carft_price += Math.max(0.03 * item_count, 30);
            }
            if (craft_list.contains("配葫芦针")) {
                carft_price += Math.max(0.016 * item_count, 10);
            }
            if (craft_list.contains("配流苏")) {
                carft_price += Math.max(0.15 * item_count, 30);
            }
            if (craft_list.contains("穿流苏")) {
                carft_price += Math.max(0.5 * item_count, 100);
            }
            if (craft_list.contains("配尼龙绳")) {
                if ("红色绳子".equals(dto.getShen_color())) {
                    carft_price += Math.max(0.009 * item_count, 10);
                } else {
                    carft_price += Math.max(0.03 * item_count, 3);
                }
            }
            if (craft_list.contains("穿尼龙绳")) {
                carft_price += Math.max(0.2 * item_count, 40);
            }
            if (craft_list.contains("配棉绳")) {
                carft_price += Math.max(0.015 * item_count, 25);
            }
            product.setPrice(Math.ceil(product.getPrice() + carft_price) * dto.getNumber());
            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));

        }

        return priceList;
    }

    private List<Product> getShuibiaoPrice(Product dto, double length, double width) {
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
        int count = dto.getCount();
        int number = dto.getNumber();
        int[][] prices = new int[][]{};
        if (craft_list.size() > 0) {
            if (craft_list.contains("单面") && craft_list.contains("亮膜")) {
                prices = new int[][]{
                        {387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 400},
                        {387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 405},
                        {387, 387, 387, 387, 387, 387, 387, 420, 470, 524, 577, 634, 697, 757},
                        {387, 387, 400, 470, 540, 624, 710, 797, 894, 1000, 1107, 1224, 1344, 1470},
                        {387, 487, 580, 680, 790, 910, 1040, 1177, 1324, 1477, 1640, 1494, 1640, 1794},
                        {517, 780, 937, 1104, 1290, 1487, 1700, 1587, 1787, 1997, 2220, 2454, 2700, 2960},
                        {987, 1520, 1504, 1780, 2084, 2404, 2757, 3130, 3527, 3950, 4394, 4864, 5357, 5877},
                };
            }
            if (craft_list.contains("双面") && craft_list.contains("亮膜")) {
                prices = new int[][]{
                        {720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720},
                        {720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720},
                        {720, 720, 720, 720, 720, 720, 720, 720, 724, 724, 734, 807, 884, 967},
                        {720, 720, 720, 724, 724, 790, 904, 1020, 1144, 1277, 1417, 1567, 1724, 1887},
                        {720, 724, 737, 864, 1007, 1167, 1330, 1507, 1694, 1897, 2107, 1944, 2137, 2340},
                        {724, 994, 1197, 1414, 1654, 1910, 2187, 2070, 2330, 2607, 2900, 3207, 3530, 3874},
                        {1264, 1947, 1960, 2320, 2717, 3144, 3604, 4094, 4617, 5167, 5754, 6370, 7020, 7700},

                };
            }
            if (craft_list.contains("单面") && craft_list.contains("哑膜")) {
                prices = new int[][]{
                        {387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387},
                        {387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 404},
                        {387, 387, 387, 387, 387, 387, 387, 427, 477, 527, 584, 640, 704, 767},
                        {387, 387, 404, 474, 547, 630, 717, 810, 904, 1010, 1120, 1237, 1357, 1487},
                        {387, 494, 587, 687, 800, 924, 1054, 1190, 1337, 1494, 1660, 1514, 1660, 1817},
                        {520, 790, 947, 1117, 1304, 1507, 1724, 1610, 1810, 2024, 2250, 2487, 2737, 3004},
                        {997, 1537, 1524, 1804, 2110, 2440, 2794, 3174, 3577, 4004, 4454, 4934, 5434, 5960},
                };
            }
            if (craft_list.contains("双面") && craft_list.contains("哑膜")) {
                prices = new int[][]{
                        {730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730},
                        {730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 730},
                        {730, 730, 730, 730, 730, 730, 730, 730, 730, 730, 744, 820, 897, 980},
                        {730, 730, 730, 730, 730, 800, 914, 1037, 1164, 1297, 1440, 1590, 1750, 1914},
                        {730, 730, 747, 880, 1024, 1180, 1347, 1530, 1724, 1924, 2137, 1977, 2174, 2380},
                        {730, 1010, 1214, 1437, 1677, 1937, 2220, 2104, 2370, 2654, 2950, 3264, 3594, 3940},
                        {1284, 1977, 1994, 2360, 2767, 3197, 3667, 4164, 4697, 5257, 5857, 6480, 7144, 7834},
                };
            }
            int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000};
            double[] areas = new double[]{16, 25, 30.25, 36, 42.25, 49, 56.25, 64, 72.25, 81, 90.25, 100, 110.25, 121};
            double area = length * width;
            List<Product> productList = getAreaCenterPrice(count_list, count, area, prices, areas, number);
            for (Product product : productList) {
                product.setWeight(df.format(product.getCount() / (product.getCount() / (width * length / 10000) / 0.76 / 1.47) * product.getCount()));
            }
            return productList;
        }
        return new ArrayList<>();
    }

    private List<Product> getAreaNextPrice(int[] count_list, int count, double area, double[][] prices,
                                           double[] areas, int number) {
        List<Product> priceList = new ArrayList<>();
        for (int i = 0; i < count_list.length; i++) {
            int count_item = count_list[i];
            if (priceList.size() > 2) {
                break;
            }
            if (count > count_item) {
                continue;
            }
            int count_index = Arrays.binarySearch(count_list, count_item);
            double price = 0;
            if (count_index >= 0) {
                price = new PriceUtils().TableNextPrice(area, prices[count_index], areas);
            }
            Product product = new Product();
            product.setCount(count_item);
            product.setPrice(Math.ceil(price * number));
            priceList.add(product);
        }
        return priceList;
    }

    private List<Product> getAreaCenterPrice(int[] count_list, int count, double area, int[][] prices, double[] areas, int number) {
        List<Product> priceList = new ArrayList<>();
        for (int i = 0; i < count_list.length; i++) {
            int count_item = count_list[i];
            if (priceList.size() > 2) {
                break;
            }
            if (count > count_item) {
                continue;
            }
            int count_index = Arrays.binarySearch(count_list, count_item);
            double price = 0;
            if (count_index >= 0) {
                price = new PriceUtils().TablePrice(area, prices[count_index], areas);
            }
            Product product = new Product();
            product.setCount(count_item);
            product.setPrice(Math.ceil(price * number));
            priceList.add(product);
        }
        return priceList;
    }

    private List<Product> getAreaCenterUnitPrice(int[] count_list, int count, double area, int[][] prices, double[] areas, int number) {
        List<Product> priceList = new ArrayList<>();
        boolean isLast = false;
        if (count > count_list[count_list.length - 1]) {
            isLast = true;
        }
        for (int i = 0; i < count_list.length; i++) {
            int count_item = count_list[i];
            if (priceList.size() > 2) {
                break;
            }
            if (count > count_item && !isLast) {
                continue;
            }
            int count_index = Arrays.binarySearch(count_list, count_item);
            double price = 0;
            if (count_index >= 0) {
                price = new PriceUtils().TablePrice(area, prices[count_index], areas);
            }
            if (isLast) {
                count_item = count;
            }
            Product product = new Product();
            product.setCount(count_item);
            product.setPrice(Math.ceil(price * number * count_item));
            priceList.add(product);
        }
        return priceList;
    }

    private double getAreaCenterUnitPriceOne(int[] count_list, int count, double area, double[][] prices, double[] areas) {
        List<Product> priceList = new ArrayList<>();
        boolean isLast = false;
        double price = 0;
        if (count > count_list[count_list.length - 1]) {
            isLast = true;
        }
        for (int i = 0; i < count_list.length; i++) {
            int count_item = count_list[i];
            if (count > count_item && !isLast) {
                continue;
            }
            int count_index = Arrays.binarySearch(count_list, count_item);
            if (count_index >= 0) {
                price = PriceUtils.TableDoublePrice(area, prices[count_index], areas);
                break;
            }

        }
        return price;
    }

    private List<Product> lessSticker(Product dto, String kind, Integer number, Double width, Double length,
                                      int count, List<Product> stickersList, String role) {
        double price = 0.0;
        // 一张大纸收费
        double addPrice = 0.0;
        switch (kind) {
            case "0":// A级铜版纸
            case "4":// 哑膜A级铜版纸
                price = 30;
                addPrice = 6;
                break;
            case "1":// PVC
            case "2":// 透明
            case "PVC覆哑膜":
            case "3":// 复古牛皮纸贴纸
            case "7":// 书写纸
            case "PP合成纸":
                price = 45;
                addPrice = 9;
                break;
            case "5":// 哑金
            case "6":// 哑银
            case "亮金":
            case "亮银":
                price = 45;
                addPrice = 10;
                break;
            case "银平光":
            case "金平光":
            case "拉丝金":
            case "拉丝银":
            case "珠光冰白纸":
            case "美纹纸":
            case "红洒金":
            case "飘金超白不干胶":
            case "白散金":
                price = 50;
                addPrice = 10;
                break;
            case "美纹纸散金":
                price = 50;
                addPrice = 10;
                break;
            case "易碎纸不干胶":
            case "静电贴":
                price = 50;
                addPrice = 11;
                break;
            case "树纹纸":
            case "刚古水纹超白":
            case "布纹纸超白":
            case "草香纸":
            case "美纹散金纸":
                price = 50;
                addPrice = 5.5;
                break;
            case "硫酸纸":
                price = 45;
                addPrice = 5.5;
                break;
            case "电线胶-PP合成纸":
            case "电线胶-PET哑银":
                price = 50;
                addPrice = 12;
                break;
        }
        stickersList.add(new PriceUtils().getA(kind, length, width, count, price, addPrice, number, dto.getCraftTang(), dto.getYinbai()));
        if (dto.getN_mq_num() != null && dto.getN_mq_num() >= 1) {
            double base_price = 5;

            for (Product product : stickersList) {
                product.setPrice(product.getPrice() + ((dto.getN_mq_num()) * base_price));
            }
        }
        if (number > 1 && dto.getP() != null) {
            double desFee = 0;
            if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) {
                if (dto.getP() == 1) {
                    desFee = 0.6 * (number - 1);
                } else {
                    desFee = 3.5 * (number - 1);
                }
            } else {
                if (dto.getP() == 1) {
                    desFee = 0.6;
                } else if (dto.getP() == 2 || dto.getP() == 3) {
                    desFee = 0.8;
                } else if (dto.getP() == 4) {
                    desFee = 1.2;
                } else if (dto.getP() == 5) {
                    desFee = 2;
                } else {
                    desFee = 5;
                }
                desFee = desFee * number;
            }

            for (Product product : stickersList) {
                if ("0".equals(kind) && "纯烫金".equals(dto.getCraftTang())) {
                    product.setPrice(product.getPrice() * number);
                } else {
                    product.setPrice(Math.ceil(product.getPrice() + desFee));
                }
            }

            //price = price + (number - 1) * 15;原来的设计费计算
        }
        return stickersList;
    }

    private List<Product> getPVCStickerPrice(Product dto, double width, double length) {
        int[][] prices = new int[][]{
                {85, 86, 86, 87, 88, 89, 90, 95, 95, 95, 177, 189, 246, 331, 1274, 1104, 1537, 2247},
                {90, 91, 91, 92, 93, 94, 95, 100, 100, 100, 182, 194, 251, 336, 1279, 1109, 1542, 2252},
                {119, 120, 120, 120, 120, 120, 120, 120, 133, 146, 224, 280, 362, 478, 1382, 1584, 2645, 3120},
                {143, 151, 158, 163, 167, 171, 175, 191, 208, 225, 359, 503, 620, 833, 2522, 2925, 4884, 5754},
                {204, 211, 218, 223, 225, 227, 230, 240, 258, 272, 451, 615, 729, 986, 3060, 3904, 7204, 10802},
                {306, 324, 324, 351, 351, 351, 351, 351, 394, 436, 811, 1004, 1219, 1554, 4508, 6315, 11240, 13230},
                {485, 496, 506, 512, 514, 516, 517, 524, 663, 802, 1224, 1628, 1967, 2595, 7803, 12229, 22462, 26432},
                {692, 718, 744, 773, 803, 833, 864, 1000, 1195, 1390, 2406, 3162, 3857, 5160, 15626, 24459, 41721, 48082},
        };
        if ("覆亮膜".equals(dto.getCraftMo())) {
            prices = new int[][]{
                    {85, 86, 86, 87, 88, 89, 90, 95, 95, 95, 177, 189, 246, 331, 1274, 1104, 1537, 2247},
                    {90, 91, 91, 92, 93, 94, 95, 100, 100, 100, 182, 194, 251, 336, 1279, 1109, 1542, 2252},
                    {119, 120, 120, 120, 120, 120, 120, 120, 133, 146, 224, 280, 362, 478, 1382, 1584, 2645, 3120},
                    {143, 151, 158, 163, 167, 171, 175, 191, 208, 225, 359, 503, 620, 833, 2522, 2925, 4884, 5754},
                    {204, 211, 218, 223, 225, 227, 230, 240, 258, 272, 451, 615, 729, 986, 3060, 3904, 7204, 10802},
                    {306, 324, 324, 351, 351, 351, 351, 351, 394, 436, 811, 1004, 1219, 1554, 4508, 6315, 11240, 13230},
                    {485, 496, 506, 512, 514, 516, 517, 524, 663, 802, 1224, 1628, 1967, 2595, 7803, 12229, 22462, 26432},
                    {692, 718, 744, 773, 803, 833, 864, 1000, 1195, 1390, 2406, 3162, 3857, 5160, 15626, 24459, 41721, 48082},
            };
        }
        if ("覆哑膜".equals(dto.getCraftMo())) {
            prices = new int[][]{
                    {125, 127, 127, 128, 129, 131, 132, 139, 139, 139, 258, 275, 357, 479, 1837, 1592, 2216, 3238},
                    {130, 132, 132, 133, 134, 136, 137, 144, 144, 144, 263, 280, 362, 484, 1842, 1597, 2221, 3243},
                    {172, 173, 173, 173, 173, 173, 173, 173, 192, 211, 323, 404, 522, 689, 1991, 2281, 3809, 4493},
                    {206, 218, 228, 235, 241, 247, 252, 276, 300, 324, 517, 725, 893, 1200, 3632, 4212, 7033, 8286},
                    {294, 304, 314, 322, 324, 327, 332, 346, 372, 392, 650, 886, 1050, 1420, 4407, 5622, 10374, 15555},
                    {441, 467, 467, 506, 506, 506, 506, 506, 568, 628, 1168, 1446, 1756, 2238, 6492, 9094, 16186, 19052},
                    {669, 715, 729, 738, 741, 744, 745, 755, 955, 1155, 1763, 2345, 2833, 3737, 11237, 17610, 32346, 38063},
                    {997, 1034, 1072, 1114, 1157, 1200, 1245, 1440, 1721, 2002, 3465, 4554, 5555, 7431, 22502, 35221, 60079, 69239},
            };
        }
        int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000, 20000};
        double[] areas = new double[]{4, 6, 8, 10, 12, 14, 16, 25, 35, 45, 84, 120, 150, 200, 600, 1000, 2000, 2520};
        double area = length * width;
        return getAreaCenterPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
    }

    private List<Product> normalSticker(Product dto, String kind, Integer number, Double area, Double width, Double
            length, int count, String oldKind, List<Product> stickersList) {
        //pvc
        if ("1".equals(kind)) {
            stickersList = getPVCStickerPrice(dto, width, length);
        }
        // 小于21cm的查询数据库-数量在500以上
        else if (width < 21 && length < 21) {
            dto.setCount(count);
            // 9*5.4以内价格一致（查询数据库）
            if ((length <= 9 && width > 5 && width <= 5.4) || (width <= 9 && length > 5 && length <= 5.4)) {
                dto.setLength(Math.floor(length));
                dto.setWidth(Math.floor(width));
            } else {
                // 小数向上取整
                dto.setLength(Math.ceil(length));
                dto.setWidth(Math.ceil(width));
            }
            switch (kind) {
                // 铜版纸不干胶
                case "0":
                    // 带1厘米的尺寸，都变成2
                    if (1 < length && length < 2) {
                        length = Math.ceil(length);
                    }
                    if (1 < width && width < 2) {
                        width = Math.ceil(width);
                    }
                    // 小数部分，四舍五入
                    length = (double) Math.round(length);
                    width = (double) Math.round(width);
                    // 尺寸小数部分四舍五入后的面积
                    double roundArea = length * width / 10000;
                    // 一个名片位内做特价:75折，价格在前端写死
                    if (length == 1 && width == 1) {
                        int priceArr[] = {30, 35, 50, 55, 100, 180, 270, 370, 470, 570};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if ((length == 2 && width == 1) || (length == 1 && width == 2)) {
                        int priceArr[] = {35, 40, 55, 60, 110, 190, 280, 380, 480, 580};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if ((length > 2 && length <= 5 && width == 1) || (width > 2 && width <= 5 && length == 1)) {
                        int priceArr[] = {35, 40, 55, 70, 120, 210, 308, 435, 555, 683};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if ((length > 1 && length <= 3 && width == 2) || (width > 1 && width <= 3 && length == 2)) {
                        int priceArr[] = {35, 40, 55, 70, 120, 210, 308, 435, 555, 683};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if ((length > 3 && length <= 5 && width == 2) || (width > 3 && width <= 5 && length == 2)) {
                        int priceArr[] = {35, 40, 55, 70, 120, 220, 348, 492, 642, 798};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if ((length >= 3 && length <= 5 && width == 3) || (length == 3 && width <= 5 && width >= 3)) {
                        int priceArr[] = {35, 40, 55, 70, 120, 220, 348, 492, 642, 798};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if (length == 4 && width == 4) {
                        int priceArr[] = {35, 40, 55, 70, 120, 220, 348, 492, 642, 798};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if ((length == 5 && width == 4) || (length == 4 && width == 5)) {
                        int priceArr[] = {35, 40, 55, 70, 150, 240, 420, 600, 790, 980};
                        stickersList = new AStickersPrice().f_getPrice(priceArr, count, dto.getCraftMo());
                    } else if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
                        stickersList = new AStickersPrice().oneCradPrice(count, dto.getRole());
                    } /*
                     * else if ((length == 1 && width <= 20) || (width == 1 && length <= 20)) { stickersList = new AStickersPrice().getPriceLess20(count); } else if ((length == 1 && width <= 48) || (width == 1 && length <= 48)) { stickersList = new AStickersPrice().getPriceLess48(count); } else if ((length == 1 && width <= 60) || (width == 1 && length <= 60)) { stickersList = new AStickersPrice().getPriceLess60(count); } else if ((length == 1 && width <= 70) || (width == 1 && length <= 70)) {
                     * stickersList = new AStickersPrice().getPriceLess70(count); } else if ((length == 1 && width <= 80) || (width == 1 && length <= 80)) { stickersList = new AStickersPrice().getPriceLess80(count); } else if ((length == 1 && width <= 90) || (width == 1 && length <= 90)) { stickersList = new AStickersPrice().getPriceLess90(count); } else if ((length == 1 && width <= 100) || (width == 1 && length <= 100)) { stickersList = new AStickersPrice().getPriceLess100(count); }
                     */ else if (area <= 0.003) {
                        // 未四舍五入的面积按照固定的。
                        stickersList = new AStickersPrice().getPrice(count);
                    } else {
                        stickersList = new AStickersPrice().getPrice(count, roundArea, dto.getRole());
                    }

                    break;
                // PVC.透明不干胶 亮膜
                case "1":
                case "2":
                    if (count <= 10000) {
                        // 透明和PVC的价格一致，数据库是pvc的价格，设置‘1’
                        dto.setKindValue("1");
                        stickersList = productMapper.getThanPrice(dto);
                    } else {
                        // 1*1,2*1 价格调整成和3*1一致
                        if (area < 0.0003) {
                            area = 0.0003;
                        }
                        stickersList = new PVCStickersPrice().getPrice(count, area);
                    }

                    break;
                // 复古牛皮纸
                case "3":
                    // 10*10以内，数量小于50000个查询数据库 || 10*10 - 20*20 之间的，10000以内查询数据库
                    if ((width <= 10 && length <= 10 && count <= 50000) || ((width > 10 || length > 10) && count <= 10000)) {
                        stickersList = productMapper.getThanPrice(dto);
                    } else if ((width <= 10 && length <= 10 && count > 50000) || ((width > 10 || length > 10) && count > 10000)) {
                        stickersList = new NiuStickersPrice().getPrice(count, area);
                    }

                    // PP合成纸覆亮膜是牛皮纸价格的0.8倍
                    if ("PP合成纸".equals(oldKind)) {
                        dto.setKindValue(oldKind);
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() * 0.8));
                        }

                        if (("覆哑膜".equals(dto.getCraftMo()))) {
                            for (Product product : stickersList) {
//                                if (product.getCount() <= 1000) {
//                                    product.setPrice(Math.ceil(product.getPrice() + 10));
//                                } else {
//                                    product.setPrice(Math.ceil(product.getPrice() + product.getCount() * 0.01));
//                                }
                            }
                        }
                    }
                    break;
                // 铜版纸不干胶覆哑膜
                case "4":
                    // 带1厘米的尺寸，都变成2
                    if (1 < length && length < 2) {
                        length = Math.ceil(length);
                    }
                    if (1 < width && width < 2) {
                        width = Math.ceil(width);
                    }
                    // 小数部分，四舍五入
                    length = (double) Math.round(length);
                    width = (double) Math.round(width);
                    // 尺寸小数部分四舍五入后的面积
                    roundArea = length * width / 10000;

                    // 调整成A级铜版纸覆亮膜价格*1.1
                    if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
                        stickersList = productMapper.getThanPrice(dto);
                    } else if ((length == 1 && width <= 20) || (width == 1 && length <= 20)) {
                        stickersList = new AStickersPrice().getPriceLess20(count);
                    } else if ((length == 1 && width <= 48) || (width == 1 && length <= 48)) {
                        stickersList = new AStickersPrice().getPriceLess48(count);
                    } else if ((length == 1 && width <= 60) || (width == 1 && length <= 60)) {
                        stickersList = new AStickersPrice().getPriceLess60(count);
                    } else if ((length == 1 && width <= 70) || (width == 1 && length <= 70)) {
                        stickersList = new AStickersPrice().getPriceLess70(count);
                    } else if ((length == 1 && width <= 80) || (width == 1 && length <= 80)) {
                        stickersList = new AStickersPrice().getPriceLess80(count);
                    } else if ((length == 1 && width <= 90) || (width == 1 && length <= 90)) {
                        stickersList = new AStickersPrice().getPriceLess90(count);
                    } else if ((length == 1 && width <= 100) || (width == 1 && length <= 100)) {
                        stickersList = new AStickersPrice().getPriceLess100(count);
                    } else if (area <= 0.003) {
                        // 未四舍五入的面积按照固定的。
                        stickersList = new AStickersPrice().getPrice(count);
                    } else {
                        stickersList = new AStickersPrice().getPrice(count, roundArea, dto.getRole());
                    }

                    // A级铜版纸覆亮膜价格*1.2
                    for (Product product : stickersList) {
                        if (length == 6 && width == 6) {
                            product.setPrice(Math.ceil(product.getPrice() * 1.2) + 35);
                        } else {
                            product.setPrice(Math.ceil(product.getPrice() * 1.2));
                        }
                        // 亮膜做特价，有“kindLabel”标识，哑膜把标识去掉
                        product.setKindLabel(null);
                    }
                    break;
                // 哑金不干胶
                case "5":
                    /*
                     * if ("印2色+凹凸".equals(dto.getAotu())) { // 6*5cm以下及10*3cm以下 int priceArr1[] = { 280, 300, 350, 460, 520, 660, 1100 }; // 6*5cm-8*8cm;10-3cm - 10*6cm以内 int priceArr2[] = { 280, 320, 450, 660, 780, 900, 1500 }; // 11*11cm内;12*8cm内;20*4cm以内 int priceArr3[] = { 340, 500, 850, 1100, 1550, 1700, 2500 }; stickersList = new YaJinStickersPrice().accountPriceBySize(width, length, count, priceArr1, priceArr2, priceArr3); } else if ("加凹凸".equals(dto.getAotu())) { // 6*5cm以下及10*3cm以下 int
                     * priceArr1[] = { 170, 200, 230, 310, 360, 420, 710 }; // 6*5cm-8*8cm;10-3cm - 10*6cm以内 int priceArr2[] = { 200, 240, 350, 440, 560, 670, 1000 }; // 11*11cm内;12*8cm内;20*4cm以内 int priceArr3[] = { 240, 380, 620, 800, 940, 1050, 1960 }; stickersList = new YaJinStickersPrice().accountPriceBySize(width, length, count, priceArr1, priceArr2, priceArr3); }else {
                     */
                    // stickersList = new YaJinStickersPrice().getPriceNoAoTu(length, width, count);
                    dto.setKindValue("1");
                    stickersList = productMapper.getThanPrice(dto);
                    if (("加凹凸".equals(dto.getAotu())) || ("纯烫金".equals(dto.getAotu()))) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() * 2.3));
                        }
                    } else if (("印2色".equals(dto.getAotu()))) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() * 2.1));
                        }
                    } /*
                     * else if ("印2色+凹凸".equals(dto.getAotu())){ for (Product product : stickersList) { product.setPrice(Math.ceil(product.getPrice() * 2.)); } }
                     */ else {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() * 2));
                        }
                    }
                    /* } */
                    if (stickersList == null)
                        return stickersList;
                    break;
                // 哑银不干胶-亮膜哑膜一样
                case "6":
                    dto.setKindValue("1");
                    stickersList = productMapper.getThanPrice(dto);
                    if ("加凹凸".equals(dto.getAotu()) || ("纯烫金".equals(dto.getAotu()))) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() * 2.3));
                        }
                    }
                    if ("印白墨".equals(dto.getYinbai())) {
                        stickersList = PriceUtils.getYinBaiPrice(stickersList, width, length);
                    }
                    /*
                     * if ("印2色+凹凸".equals(dto.getAotu())) { // 6*5cm以下及10*3cm以下 int priceArr1[] = { 280, 300, 350, 460, 520, 660, 1100 }; // 6*5cm-8*8cm;10-3cm - 10*6cm以内 int priceArr2[] = { 280, 320, 450, 660, 780, 900, 1500 }; // 11*11cm内;12*8cm内;20*4cm以内 int priceArr3[] = { 340, 500, 850, 1100, 1550, 1700, 2500 }; stickersList = new YaJinStickersPrice().accountPriceBySize(width, length, count, priceArr1, priceArr2, priceArr3); } else if ("加凹凸".equals(dto.getAotu())) { // 6*5cm以下及10*3cm以下 int
                     * priceArr1[] = { 170, 200, 230, 310, 360, 420, 710 }; // 6*5cm-8*8cm;10-3cm - 10*6cm以内 int priceArr2[] = { 200, 240, 350, 440, 560, 670, 1000 }; // 11*11cm内;12*8cm内;20*4cm以内 int priceArr3[] = { 240, 380, 620, 800, 940, 1050, 1960 }; stickersList = new YaJinStickersPrice().accountPriceBySize(width, length, count, priceArr1, priceArr2, priceArr3); } else if ("印2色".equals(dto.getAotu())) { // 6*5cm以下及10*3cm以下 int priceArr1[] = { 140, 170, 200, 280, 380, 420, 680 }; //
                     * 6*5cm-8*8cm;10-3cm - 10*6cm以内 int priceArr2[] = { 160, 200, 300, 400, 600, 640, 1000 }; // 11*11cm内;12*8cm内;20*4cm以内 int priceArr3[] = { 200, 300, 480, 700, 850, 1050, 1900 }; stickersList = new YaJinStickersPrice().accountPriceBySize(width, length, count, priceArr1, priceArr2, priceArr3); } else { if(count <= 10000) { dto.setKindValue("1"); stickersList = productMapper.getThanPrice(dto); } }
                     */
                    if (stickersList == null)
                        return stickersList;
                    break;
                case "易碎纸不干胶":
                    if ((length == 1.0 || width == 1.0) && length * width != 1.0) {
                        area = 0.0001;
                        stickersList = new YiSBStickersPrice().getPrice(count, area);
                        if (width == 1.0) {
                            for (Product product : stickersList) {
                                product.setPrice(product.getPrice() + (length > 1 ? (length - 1) : 1) * 10);
                            }
                        } else {
                            for (Product product : stickersList) {
                                product.setPrice(product.getPrice() + (width > 1 ? (width - 1) : 1) * 10);
                            }
                        }
                    } else {
                        stickersList = new YiSBStickersPrice().getPrice(count, area);
                    }
                    break;
                case "拉丝金":
                    if (length <= 5 && width <= 5) {
                        stickersList = new LaSiStickersPrice().acountPrice5x5(count);
                    } else if ((length <= 9 && width <= 5.5) || (length <= 5.5 && width <= 9)) {
                        stickersList = new LaSiStickersPrice().acountPrice9x5(count, area);
                    } else {
                        stickersList = new LaSiStickersPrice().acountPrice9xup(count, area);
                        /*
                         * stickersList2 = new LaSiStickersPrice().acountPrice9x5(count, area); // 对比价格，便宜的话替换 for (int i = 0; i < stickersList.size(); i++) { for (int j = 0; j < stickersList2.size(); j++) { if (stickersList.get(j).getPrice() < stickersList2.get(j).getPrice()) { stickersList.get(j).setPrice(stickersList2.get(j).getPrice() + 10); } } }
                         */
                    }
                    if ("覆哑膜".equals(dto.getCraftMo())) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() + product.getPrice() * 1 / 10));
                        }
                    }
                    break;
                case "拉丝银":
                    if (length <= 5 && width <= 5) {
                        stickersList = new LaSiStickersPrice().acountPrice5x5(count);
                    } else if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
                        stickersList = new LaSiStickersPrice().acountPrice9x5(count, area);
                    } else {
                        stickersList = new LaSiStickersPrice().acountPrice9xup(count, area);
                        /*
                         * stickersList2 = new LaSiStickersPrice().acountPrice9x5(count, area); // 对比价格，便宜的话替换 for (int i = 0; i < stickersList.size(); i++) { for (int j = 0; j < stickersList2.size(); j++) { if (stickersList.get(j).getPrice() < stickersList2.get(j).getPrice()) { stickersList.get(j).setPrice(stickersList2.get(j).getPrice() + 10); } } }
                         */
                    }
                    if ("覆哑膜".equals(dto.getCraftMo())) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() + product.getPrice() * 1 / 10));
                        }
                    }
                    if ("印白墨".equals(dto.getYinbai())) {
                        stickersList = PriceUtils.getYinBaiPrice(stickersList, width, length);
                    }
                    break;
                case "格底珠光膜":
                    if ("覆亮膜".equals(dto.getCraftMo())) {
                        if (length <= 5 && width <= 5) {
                            stickersList = new GDZGMStickersPrice().acountPrice5x5(count);
                        } else if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
                            stickersList = new GDZGMStickersPrice().acountPrice9x5(count, area);
                        } else {
                            stickersList = new GDZGMStickersPrice().acountPrice9xup(count, area);
                        }
                    } else {
                        if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
                            stickersList = new GDZGMStickersPrice().acountYaMoPrice9x5(count, area);
                        } else {
                            stickersList = new GDZGMStickersPrice().acountYamoPrice9xup(count, area);
                        }
                    }
                    break;
                case "美纹纸":
                    stickersList = new PriceUtils().getMeiWenZhiPrice(length, width, count, number, dto.getCraftQie());
                    break;
                case "银平光":
                    /*
                     * stickersList = new YinPGStickersPrice().getPrice(count, area); for (Product product : stickersList) { if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) { if (product.getCount() < 2000) { product.setPrice(Math.ceil(product.getPrice() * 1.3)); } else { product.setPrice(Math.ceil(product.getPrice() * 1.2)); } } else { product.setPrice(Math.ceil(product.getPrice() * 1.1)); } }
                     */
                    if (count <= 10000) {
                        // 银平光的价格与透明不干胶价格一致
                        dto.setKindValue("1");
                        stickersList = productMapper.getThanPrice(dto);
                        /*
                         * for(Product product : stickersList) { if(product.getCount() < 5000) { product.setPrice(Math.ceil(product.getPrice() + 30)); } }
                         */
                    } else {
                        // 1*1,2*1 价格调整成和3*1一致
                        if (area < 0.0003) {
                            area = 0.0003;
                        }
                        stickersList = new PVCStickersPrice().getPrice(count, area);
                    }
                    for (Product product : stickersList) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.5));
                    }
                    if ("印白墨".equals(dto.getYinbai())) {
                        stickersList = PriceUtils.getYinBaiPrice(stickersList, width, length);
                    }
                    break;
            }
        } else {
            // 大于21cm的用计算-数量在500以上
            if (!"易碎纸不干胶".equals(kind) && !"0".equals(kind)) {
                if (length == 1 || width == 1) {
                    area = 2 * area;
                }
            }
            switch (kind) {
                case "0":
                    // stickersList = new AStickersPrice().getPrice(count, area);

                    // 带1厘米的尺寸，都变成2
                    if (1 < length && length < 2) {
                        length = Math.ceil(length);
                    }
                    if (1 < width && width < 2) {
                        width = Math.ceil(width);
                    }
                    // 小数部分，四舍五入
                    length = (double) Math.round(length);
                    width = (double) Math.round(width);
                    // 尺寸小数部分四舍五入后的面积
                    double roundArea = length * width / 10000;
                    if ((length == 1 && width <= 48) || (width == 1 && length <= 48)) {
                        stickersList = new AStickersPrice().getPriceLess48(count);
                    } else if ((length == 1 && width <= 60) || (width == 1 && length <= 60)) {
                        stickersList = new AStickersPrice().getPriceLess60(count);
                    } else if ((length == 1 && width <= 70) || (width == 1 && length <= 70)) {
                        stickersList = new AStickersPrice().getPriceLess70(count);
                    } else if ((length == 1 && width <= 80) || (width == 1 && length <= 80)) {
                        stickersList = new AStickersPrice().getPriceLess80(count);
                    } else if ((length == 1 && width <= 90) || (width == 1 && length <= 90)) {
                        stickersList = new AStickersPrice().getPriceLess90(count);
                    } else if ((length == 1 && width <= 100) || (width == 1 && length <= 100)) {
                        stickersList = new AStickersPrice().getPriceLess100(count);
                    } else {
                        stickersList = new AStickersPrice().getPrice(count, roundArea, dto.getRole());
                    }

                    // 96 - 92 折
                    for (Product product : stickersList) {
                        product.setKindLabel("铜版纸不干胶3");
                    }
                    // 85折
                    // for (Product product : stickersList) {
                    // product.setKindLabel("铜版纸不干胶2");
                    // }
                    break;
                case "1":
                case "2":

                    stickersList = new PVCStickersPrice().getPrice(count, area);
                    break;
                case "3":
                    stickersList = new NiuStickersPrice().getPrice(count, area);
                    // PP合成纸覆亮膜是牛皮纸价格的0.8倍
                    if ("PP合成纸".equals(oldKind)) {
                        dto.setKindValue(oldKind);
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() * 0.8));
                        }
                        // PP合成纸覆哑膜价格比亮膜贵1分钱一张
                        if (("覆哑膜".equals(dto.getCraftMo()))) {
                            for (Product product : stickersList) {
//                                if (product.getCount() <= 1000) {
//                                    product.setPrice(Math.ceil(product.getPrice() + 10));
//                                } else {
//                                    product.setPrice(Math.ceil(product.getPrice() + product.getCount() * 0.01));
//                                }
                            }
                        }
                    }
                    break;
                case "4":

                    // 原A级铜版纸附哑膜价格
                    // stickersList = new AYaMoStickersPrice().getPrice(count, area);
                    // 带1厘米的尺寸，都变成2
                    if (1 < length && length < 2) {
                        length = Math.ceil(length);
                    }
                    if (1 < width && width < 2) {
                        width = Math.ceil(width);
                    }
                    // 小数部分，四舍五入
                    length = (double) Math.round(length);
                    width = (double) Math.round(width);
                    // 尺寸小数部分四舍五入后的面积
                    roundArea = length * width / 10000;

                    if ((length == 1 && width <= 48) || (width == 1 && length <= 48)) {
                        stickersList = new AStickersPrice().getPriceLess48(count);
                    } else if ((length == 1 && width <= 60) || (width == 1 && length <= 60)) {
                        stickersList = new AStickersPrice().getPriceLess60(count);
                    } else if ((length == 1 && width <= 70) || (width == 1 && length <= 70)) {
                        stickersList = new AStickersPrice().getPriceLess70(count);
                    } else if ((length == 1 && width <= 80) || (width == 1 && length <= 80)) {
                        stickersList = new AStickersPrice().getPriceLess80(count);
                    } else if ((length == 1 && width <= 90) || (width == 1 && length <= 90)) {
                        stickersList = new AStickersPrice().getPriceLess90(count);
                    } else if ((length == 1 && width <= 100) || (width == 1 && length <= 100)) {
                        stickersList = new AStickersPrice().getPriceLess100(count);
                    } else {
                        stickersList = new AStickersPrice().getPrice(count, roundArea, dto.getRole());
                    }
                    // A级铜版纸覆亮膜价格*1.2
                    for (Product product : stickersList) {
                        product.setPrice(Math.ceil(product.getPrice() * 1.2));
                        // 亮膜做特价，有“kindLabel”标识，哑膜把标识去掉
                        product.setKindLabel(null);
                    }
                    break;
                case "PVC覆哑膜":

                    stickersList = new PVCYaMoStickersPrice().getPrice(count, area);
                    break;
                case "5":
                    if (StringUtils.isEmpty(dto.getAotu()) || (width < 30 && length < 30)) {
                        stickersList = new YaJinStickersPrice().getPriceNoAoTu(length, width, count);
                        if (("加凹凸".equals(dto.getAotu())) && (width < 30 && length < 30)) {
                            for (Product product : stickersList) {
                                product.setPrice(product.getPrice() + Math.ceil(product.getPrice() * 0.3));
                            }
                        }
                        break;
                    }
                    return stickersList;
                case "6":
                    // 8.10
                    // if (StringUtils.isEmpty(dto.getAotu())) {
                    // stickersList = new YaYinStickersPrice().getPrice(count, area);
                    // break;
                    // }
                    if (StringUtils.isEmpty(dto.getAotu())) {
                        // 小数部分，四舍五入
                        length = (double) Math.round(length);
                        width = (double) Math.round(width);
                        // 尺寸小数部分四舍五入后的面积
                        roundArea = length * width / 10000;
                        if ((length == 1 && width <= 48) || (width == 1 && length <= 48)) {
                            stickersList = new AStickersPrice().getPriceLess48(count);
                        } else if ((length == 1 && width <= 60) || (width == 1 && length <= 60)) {
                            stickersList = new AStickersPrice().getPriceLess60(count);
                        } else if ((length == 1 && width <= 70) || (width == 1 && length <= 70)) {
                            stickersList = new AStickersPrice().getPriceLess70(count);
                        } else if ((length == 1 && width <= 80) || (width == 1 && length <= 80)) {
                            stickersList = new AStickersPrice().getPriceLess80(count);
                        } else if ((length == 1 && width <= 90) || (width == 1 && length <= 90)) {
                            stickersList = new AStickersPrice().getPriceLess90(count);
                        } else if ((length == 1 && width <= 100) || (width == 1 && length <= 100)) {
                            stickersList = new AStickersPrice().getPriceLess100(count);
                        } else {
                            stickersList = new AStickersPrice().getPrice(count, roundArea, dto.getRole());
                        }

                        // A级铜版纸覆亮膜价格 哑银的 5000张以下（不含5千张的*2.8 ） 5千张以上*2.3
                        for (Product product : stickersList) {
                            if (product.getCount() >= 5000) {
                                product.setPrice(Math.ceil(product.getPrice() * 2.3));
                            } else {
                                product.setPrice(Math.ceil(product.getPrice() * 2.8));
                            }
                        }

                        // 少数量，算一下打印的价格和印刷的对比
                        if (count < 500) {
                            double price = 65;
                            double addPrice = 12;
                            stickersList = new PriceUtils().getYy(kind, length, width, count, price, addPrice, number, dto.getCraftTang(), dto.getYinbai());
                        }
                        // 如果打印的价格比印刷的价格便宜，就使用Collections工具类对list进行排序（把打印的展示在第一位），否则打印的显示在最后一位，然后
                        if (stickersList.get(stickersList.size() - 1).getPrice() < stickersList.get(0).getPrice()) {
                            Collections.sort(stickersList, new Comparator<Product>() {

                                @Override
                                public int compare(Product o1, Product o2) {
                                    return o1.getCount() - o2.getCount();
                                }
                            });
                        }
                        if ("印白墨".equals(dto.getYinbai())) {
                            stickersList = PriceUtils.getYinBaiPrice(stickersList, width, length);
                        }
                        break;
                    }
                    return null;
                case "易碎纸不干胶":

                    double l = 42.0;
                    double w = 38.0;
                    // 最大印刷面积为42*38 CM
                    if ((length > l || width > w) && (length > w || width > l))
                        return null;
                    if ((length == 1.0 || width == 1.0) && length * width != 1.0) {
                        area = 0.0001;
                        stickersList = new YiSBStickersPrice().getPrice(count, area);
                        if (width == 1.0) {
                            for (Product product : stickersList) {
                                product.setPrice(product.getPrice() + (length > 1 ? (length - 1) : 1) * 10);
                            }
                        } else {
                            for (Product product : stickersList) {
                                product.setPrice(product.getPrice() + (width > 1 ? (width - 1) : 1) * 10);
                            }
                        }
                    } else {
                        stickersList = new YiSBStickersPrice().getPrice(count, area);
                    }
                    break;
                case "拉丝金":
                    l = 42.0;
                    w = 38.0;
                    // 最大印刷面积为42*38 CM
                    if ((length > l || width > w) && (length > w || width > l))
                        return null;
                    stickersList = new LaSiStickersPrice().acountPrice9xup(count, area);
                    if ("覆哑膜".equals(dto.getCraftMo())) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() + product.getPrice() * 1 / 10));
                        }
                    }
                    break;
                case "拉丝银":
                    l = 42.0;
                    w = 38.0;
                    // 最大印刷面积为42*38 CM
                    if ((length > l || width > w) && (length > w || width > l))
                        return null;
                    stickersList = new LaSiStickersPrice().acountPrice9xup(count, area);
                    // 覆哑膜多1/10价格
                    if ("覆哑膜".equals(dto.getCraftMo())) {
                        for (Product product : stickersList) {
                            product.setPrice(Math.ceil(product.getPrice() + product.getPrice() * 1 / 10));
                        }
                    }
                    if ("印白墨".equals(dto.getYinbai())) {
                        stickersList = PriceUtils.getYinBaiPrice(stickersList, width, length);
                    }
                    break;
                case "格底珠光膜":
                    l = 42.0;
                    w = 38.0;
                    // 最大印刷面积为42*38 CM
                    if ((length > l || width > w) && (length > w || width > l))
                        return null;
                    if ("覆亮膜".equals(dto.getCraftMo())) {
                        stickersList = new GDZGMStickersPrice().acountPrice9xup(count, area);
                    } else {
                        stickersList = new GDZGMStickersPrice().acountYamoPrice9xup(count, area);
                    }
                    break;
                case "美纹纸":
                    stickersList = new PriceUtils().getMeiWenZhiPrice(length, width, count, number, dto.getCraftQie());
                    break;
                case "银平光":
                    stickersList = new YinPGStickersPrice().getPrice(count, area);
                    for (Product product : stickersList) {
                        if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
                            if (product.getCount() < 2000) {
                                product.setPrice(Math.ceil(product.getPrice() * 1.3));
                            } else {
                                product.setPrice(Math.ceil(product.getPrice() * 1.2));
                            }
                        } else {
                            product.setPrice(Math.ceil(product.getPrice() * 1.1));
                        }
                    }
                    if ("印白墨".equals(dto.getYinbai())) {
                        stickersList = PriceUtils.getYinBaiPrice(stickersList, width, length);
                    }
                    break;
            }
        }
        if (dto.getCraftPai() != null && !"".equals(dto.getCraftPai())) {
            for (Product product : stickersList) {
                double price = 0;
                if ("半排废".equals(dto.getCraftPai())) {
                    price = price + product.getCount() * 0.1;
                }
                if ("全排废".equals(dto.getCraftPai())) {
                    price = price + product.getCount() * 0.13;
                }
                if ("1".equals(kind)) {
                    price = Math.ceil(price * number);
                }
                product.setPrice(Math.max(product.getPrice() + price, 80));
                product.setKindLabel(null);
            }
        }
        if (dto.getN_mq_num() != null && dto.getN_mq_num() > 1) {
            double base_price = 15;
            if (dto.getN_mq_num() >= 50 && dto.getN_mq_num() < 100) {
                base_price = 14;
            }
            if (dto.getN_mq_num() >= 100 && dto.getN_mq_num() < 150) {
                base_price = 13;
            }
            if (dto.getN_mq_num() >= 150 && dto.getN_mq_num() < 200) {
                base_price = 12;
            }
            if (dto.getN_mq_num() >= 200) {
                base_price = 10;
            }
            for (Product product : stickersList) {
                double price = ((dto.getN_mq_num() - 1) * base_price);
                if ("1".equals(kind)) {
                    price = Math.ceil(price * number);
                }
                product.setPrice(product.getPrice() + price);
            }
        }
        if ("彩色印刷+烫金/银".equals(dto.getCraftTang()) || "纯烫金".equals(dto.getCraftTang()) || "烫镭射银".equals(dto.getCraftTang())) {
            double[] basePrice = getStickersTanBasePrice(area * 10000);
            int[] bigCountArr = {500, 1000, 2000, 3000, 5000, 10000};
            if ("彩色印刷+烫金/银".equals(dto.getCraftTang())) {
                for (int i = 0; i < basePrice.length; i++) {
                    basePrice[i] = Math.ceil(basePrice[i] * 1.5);
                }
            }
            for (Product product : stickersList) {
                double productPrice = product.getPrice();
                double price = 0;
                for (int i = 0; i < bigCountArr.length; i++) {
                    if (product.getCount() >= bigCountArr[i]) {
                        price = productPrice + basePrice[i];
                        if ("1".equals(kind)) {
                            price = Math.ceil(productPrice + basePrice[i] * number);
                        }

                    }
                }
                product.setPrice(Math.max(price, productPrice));
            }
        }
        // 彩色印刷+烫金报价方式
//        if ("彩色印刷+烫金/银".equals(dto.getCraftTang())) {
//            if (width <= 15 && length <= 15) {
//                for (Product product : stickersList) {
//                    product.setPrice((product.getPrice()) + (product.getCount() * 0.16 + 200 > 240 ? product.getCount() * 0.16 + 200 : 240));
//                }
//            } else if (width > 15 || length > 15) {
//                for (Product product : stickersList) {
//                    product.setPrice((product.getPrice()) + (product.getCount() * 0.18 + 200 > 240 ? product.getCount() * 0.18 + 200 : 240));
//                }
//            }
//            // 彩色印刷烫金加上烫金版价格
//            // 烫金版面积（长*宽）平方CM
//            double areaTang = dto.getLengthTang() * dto.getWidthTang();
//            for (Product product : stickersList) {
//                product.setPrice(product.getPrice() + (areaTang * 0.2 > 50 ? areaTang * 0.2 : 50));
//                product.setKindLabel(null);
//            }
//        }

        if ("印白墨".equals(dto.getYinbai()) && !"6".equals(kind) && !"3".equals(kind) && !"拉丝银".equals(kind) && !"银平光".equals(kind)) {
            stickersList = new PVCStickersPrice().acountYinbaiPrice(length, width, stickersList);
        }
        if ("印白墨".equals(dto.getYinbai()) && "3".equals(kind)) {
            for (Product product : stickersList) {
                product.setPrice(Math.ceil(product.getPrice() + Math.max(150, 100 + 0.12 * product.getCount())));
            }
            //max(150, 0.5 * (长 + 出血 * 2) * (宽 + 出血 * 2) / 10000 * 数量) * 款数
        }
        // 价格*款数 铜版纸放到外面执行
        if (!"0".equals(dto.getKindValue()) && !"1".equals(kind)) {
            if (number > 1) {
                for (Product product : stickersList) {
                    product.setPrice(product.getPrice() * number);
                }
            }
        }


        return stickersList;
    }

    private double[] getStickersTanBasePrice(double area) {

        double[] priceArr = new double[6];
        if (area < 25) {
            return new double[]{124, 124, 236, 250, 250, 334};
        } else if (area >= 598.5) {
            return new double[]{704, 786, 1000, 1160, 1610, 2804};
        } else {
            double[][] areaRanges = {
                    {25, 48.6},
                    {48.6, 70},
                    {70, 81},
                    {81, 100},
                    {100, 144},
                    {144, 225},
                    {225, 300},
                    {300, 400},
                    {400, 441},
                    {441, 525},
                    {525, 598.5}
            };
            double[][] priceRanges = {
                    {124, 124, 236, 250, 250, 334},
                    {124, 124, 236, 250, 250, 334},
                    {210, 210, 210, 210, 224, 334},
                    {220, 220, 220, 220, 254, 418},
                    {238, 238, 238, 250, 308, 504},
                    {282, 282, 282, 316, 428, 708},
                    {358, 358, 394, 478, 648, 1014},
                    {428, 428, 518, 630, 850, 1376},
                    {520, 534, 680, 826, 1064, 1808},
                    {558, 586, 746, 906, 1168, 2040},
                    {636, 692, 880, 1024, 1380, 2476},
                    {704, 786, 1000, 1160, 1610, 2804}
            };

            for (int i = 0; i < areaRanges.length; i++) {
                if (area >= areaRanges[i][0] && area < areaRanges[i][1]) {
                    double rangeStart = areaRanges[i][0];
                    double rangeEnd = areaRanges[i][1];
                    double rangeSpan = rangeEnd - rangeStart;
                    for (int j = 0; j < priceArr.length; j++) {
                        double priceStart = priceRanges[i][j];
                        double priceEnd = priceRanges[i + 1][j];
                        priceArr[j] = Math.ceil(priceStart + (priceEnd - priceStart) * (area - rangeStart) / rangeSpan);
                    }
                    break;
                }
            }
        }
        return priceArr;
    }

    // 加上工艺的钱
    private synchronized void getCraft(Product dto, List<Product> priceList, Double length, Double width, int min) {
        if (!StringUtils.isEmpty(dto.getCraft())) {
            List<String> craftList = Arrays.asList(dto.getCraft());
            if (!("13".equals(dto.getKind()) && "4".equals(dto.getProTypeValue())) && craftList.contains("双面覆哑膜")) {
                for (Product product : priceList) {
                    if (min > 1) {
                        if (product.getCount() > 2000) {
                            product.setPrice(Math.ceil(product.getPrice() * 1.1));
                        } else {
                            product.setPrice(Math.ceil(product.getPrice() * 1.15));
                        }
                    } else {
                        product.setPrice(Math.ceil(product.getPrice() * 1.3));
                    }
                }
            }
            if (craftList.contains("压痕")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + Math.max(0.03 * product.getCount(), 20)));
                }
            }
            if (craftList.contains("压点线")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + 0.02 * product.getCount()));
                }
            }
            if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("打点线")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 30 ? 0.03 * product.getCount() : 30)));
                }
            }
            if (craftList.contains("倒圆角")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 30 ? 0.03 * product.getCount() : 30)));
                }
            }
            if (craftList.contains("打孔")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 20 ? 0.03 * product.getCount() : 20)));
                }
            }
            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("单面烫金")) {
                if (min < 2) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 50) + (0.1 * product.getCount() > 50 ? 0.1 * product.getCount() : 50));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 50) + (0.11 * product.getCount() > 50 ? 0.11 * product.getCount() : 50));
                    }
                }
                // 彩色印刷烫金加上烫金版价格
                // 烫金版面积（长*宽）平方CM
                double areaTang = dto.getLengthTang() * dto.getWidthTang();
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (areaTang * 0.2 > 10 ? areaTang * 0.2 : 10)));
                }
            }
            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("双面烫金")) {
                if (min < 2) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice()) + (0.2 * product.getCount() > 220 ? 0.2 * product.getCount() : 220));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice()) + (0.22 * product.getCount() > 220 ? 0.22 * product.getCount() : 220));
                    }
                }
                // 彩色印刷烫金加上烫金版价格
                // 烫金版面积（长*宽）平方CM
                double areaTang = dto.getLengthTang() * dto.getWidthTang();
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (areaTang * 0.2 > 10 ? areaTang * 0.2 : 10)));
                }
            }
            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("打码")) {
                double danjia = 0.0;
                // 5000张以上，一张10分
                if (dto.getCount() > 5000) {
                    danjia = 0.1;
                } else {
                    danjia = 0.1;
                }
                if (dto.getMaxian() == 3) {
                    danjia = 0.1 * 2;
                }
                if (dto.getPcount() == 3) {
                    danjia = 0.8;
                    if (dto.getMaxian() > 1) {
                        danjia = danjia * dto.getMaxian();
                    }
                }
                if ("上下编码".equals(dto.getBianma())) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + (danjia * product.getCount() * 2 > 120 ? danjia * product.getCount() * 2 : 120)));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + (danjia * product.getCount())));
                    }
                }
                if (craftList.contains("模切")) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + product.getPrice() * 1.6));
                    }
                }
            }
            if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("打码")) {
                double danjia = 0.0;
                if (dto.getMaxian() == 1) {
                    danjia = 0.4;
                }
                if (dto.getMaxian() == 2) {
                    danjia = 0.8;
                }
                if (dto.getMaxian() == 3) {
                    danjia = 1.2;
                }
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + product.getCount() * danjia));
                }

            }
            //(!"4".equals(dto.getProTypeValue()) || !"4".equals(dto.getKind()) || !"5".equals(dto.getKind())) &&
            if (craftList.contains("模切") && !craftList.contains("打码")) {// 3个位以下25,3-16:50; 16 上 80
                if (min < 3) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 25 + 0.04 * product.getCount()));
                    }
                } else if (min < 16) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 50 + 0.04 * product.getCount()));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + 30 + 50 + 0.04 * product.getCount()));
                    }
                }
            }
            if (craftList.contains("腰封模切")) {// 腰封200克/157克模切收费（起步价100）
                if (min < 3) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + (25 + 0.06 * product.getCount() > 100 ? 25 + 0.06 * product.getCount() : 100)));
                    }
                } else if (min < 16) {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + (50 + 0.06 * product.getCount() > 100 ? 50 + 0.06 * product.getCount() : 100)));
                    }
                } else {
                    for (Product product : priceList) {
                        product.setPrice(Math.ceil(product.getPrice() + (30 + 50 + 0.06 * product.getCount() > 100 ? 30 + 50 + 0.06 * product.getCount() : 100)));
                    }
                }
            }
            if (craftList.contains("单面覆膜")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (length / 1000 * width / 1000 * product.getCount() * 0.7 > 70 ? length / 1000 * width / 1000 * product.getCount() * 0.7 : 70)));
                }
            }
            if (craftList.contains("签名条") || craftList.contains("磁条")) {
                double danjia = 0.0;

                for (Product product : priceList) {
                    // 1000张以内，一张5分
                    if (product.getCount() <= 1000) {
                        danjia = 0.05;
                    } else if (product.getCount() == 2000) {
                        danjia = 0.03;
                    } else if (product.getCount() >= 3000) {
                        danjia = 0.02;
                    }
                    product.setPrice(Math.ceil(product.getPrice() + danjia * product.getCount()));
                }
            }
            if (craftList.contains("倒圆角")) {// 特种纸名片工艺
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 30 ? 0.03 * product.getCount() : 30)));
                }
            }
            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("圆角")) {// 特种纸名片工艺
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 10 ? 0.03 * product.getCount() : 10)));
                }
            } else if (craftList.contains("烫金/")) {
                for (Product product : priceList) {
                    if (product.getCount() <= 400) {
                        product.setPrice(product.getPrice() + 60);
                    } else {
                        product.setPrice(product.getPrice() + 100);
                    }
                }
            }
            if (!"服装吊牌".equals(dto.getProTypeValue()) && craftList.contains("击凸")) {
                for (Product product : priceList) {
                    if (product.getCount() <= 400) {
                        product.setPrice(product.getPrice() + 60);
                    } else {
                        product.setPrice(product.getPrice() + 100);
                    }
                }
            }
            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("异形模切")) {// 300克牛皮纸工艺
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + (0.05 * product.getCount() > 50 ? 0.05 * product.getCount() : 50)));
                }
            }
            if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("异形模切")) {// 200-500张按照原有的价格乘以3倍  1000-5000张按照原有的价格乘以2.4倍   5000-10000张按照原有的价格乘以2倍
                double[] prices = {112, 152, 208, 376, 552, 888, 1328};
                int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000};
                int num = getNum(width, length);
                if (num == 1) {
                } else if (num == 2) {
                    prices = new double[]{200, 280, 380, 688, 1000, 1620, 2420};
                } else if (num == 3) {
                    prices = new double[]{272, 376, 500, 912, 1320, 2140, 3100};
                } else if (num == 5) {
                    prices = new double[]{380, 520, 696, 1260, 1832, 2740, 4100};
                } else if (num == 6) {
                    prices = new double[]{480, 640, 880, 1520, 2040, 3200, 4800};
                } else {
                    prices = new double[]{600, 760, 1040, 2000, 2760, 3920, 5700};
                }
                for (Product product : priceList) {
                    for (int i = 0; i < counts.length; i++) {
                        if (counts[i] == product.getCount()) {
                            product.setPrice(prices[i] * dto.getNumber());
                        }
                    }
                }

            }
            if (craftList.contains("异形")) {// 广告扇工艺(选了异形，每把+3毛钱
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + 0.3 * product.getCount()));
                }
            }
            if (craftList.contains("单面局部烫金")) {// 合版封套/房卡套烫金价格
                for (Product product : priceList) {
                    if (product.getCount() >= 5000) {
                        product.setPrice(Math.ceil(product.getPrice() + (product.getCount() * 0.08 > 100 ? product.getCount() * 0.08 : 100)));
                    } else {
                        product.setPrice(Math.ceil(product.getPrice() + (product.getCount() * 0.1 > 100 ? product.getCount() * 0.1 : 100)));
                    }

                }
            }
            if (craftList.contains("糊成品")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + 0.1 * product.getCount()));
                }
            }
            if (craftList.contains("糊半成品")) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + 0.15 * product.getCount()));
                }
            }
            if (craftList.contains("流苏") && "4".equals(dto.getKind())) {
                for (Product product : priceList) {
                    product.setPrice(Math.ceil(product.getPrice() + 0.15 * product.getCount()));
                }
            }
        }
    }

    public List<Product> chucklePrice(String role, List<Product> list, Product dto) {
        //
        List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());

        if (craft_list.contains("抠图")) {
            for (Product product : list) {
                product.setPrice(Math.ceil(product.getPrice() + 5 * dto.getCropNumber()));
            }
        }
        List<String> roleList = Arrays.asList("1045", "1061", "1029", "1054", "1053", "1055");
        boolean isIn = false;
        for (String s : roleList) {
            if (role.indexOf(s) > -1) {
                isIn = true;
            }
        }
        //淘系的价格全部按照目前的价格乘以1.15
//        if (!isIn) {
//            for (Product product : list) {
//                product.setPrice(Math.ceil(product.getPrice() * 1.15));
//            }
//        }
        return list;
    }

    // 价格表上传
    public Msg ajaxUploadExcel(MultipartFile file) throws Exception {
        if (!file.isEmpty()) {
            InputStream in = null;
            List<List<Object>> listob = null;
            try {
                in = file.getInputStream();
                listob = new ExcelUtils().getBankListByExcel(in, file.getOriginalFilename());
            } catch (IOException e) {
                e.printStackTrace();
            }
            String filename = file.getOriginalFilename();
            System.out.println(filename);
            Product vo = new Product();
            for (int i = 0; i < listob.size(); i++) {
                synchronized (this) {
                    List<Object> lo = listob.get(i);
                    for (int j = 2; j < lo.size(); j++) {
                        if (StringUtils.isEmpty(String.valueOf(lo.get(0)).trim()) || StringUtils.isEmpty(String.valueOf(lo.get(1)).trim())) {
                            continue;
                        }
                        /*
                         * String size = String.valueOf(lo.get(0)).trim(); int count = Integer.valueOf(String.valueOf(lo.get(1)).trim()); Double price = Double.valueOf(String.valueOf(lo.get(2)).trim()); if (size.equals("竖版260*360*80MM尼龙绳子")) { vo.setKindValue("0"); vo.setKindLabel("竖版260*360*80MM尼龙绳子"); } else if (size.equals("竖版300*400*80MM尼龙绳子")) { vo.setKindValue("1"); vo.setKindLabel("竖版300*400*80MM尼龙绳子"); } else if (size.equals("竖版360*260*100")) { vo.setKindValue("2");
                         * vo.setKindLabel("竖版360*260*100"); } else if (size.equals("横版250*260*80MM尼龙绳子")) { vo.setKindValue("3"); vo.setKindLabel("横版250*260*80MM尼龙绳子"); } vo.setCount(count); vo.setPrice(price);
                         */

                        String other = String.valueOf(lo.get(j)).trim();
                        if ("另行报价".equals(other)) {
                            other = "0";
                        }
                        Integer count = Integer.valueOf(String.valueOf(lo.get(0)).trim());
                        Double length = Double.valueOf(String.valueOf(lo.get(1)).trim());
                        Double width = Double.valueOf(j - 1);
                        Double price = 0.0;
                        if (!StringUtils.isEmpty(other)) {
                            price = Double.valueOf(other);
                        }
                        vo.setCount(count);
                        vo.setLength(length);
                        vo.setWidth(width);
                        vo.setPrice(price);

                        // 不干胶 0 ---0:A级铜版不干胶 1:pvc不干胶 = 2:透明不干胶 3:牛皮纸不干胶 4:哑膜铜版纸不干胶
                        // 特殊不干胶 1---0:单色哑金哑银亮金亮银印刷 1:彩色哑金哑银亮金亮银印刷（不含白墨） 2:哑金哑银亮金亮银无印刷凹凸
                        // 3:单色烫金烫银（铜版纸哑膜亮膜pvc透明材质）
                        vo.setProTypeValue("0");
                        vo.setProTypeLabel("不干胶");
                        vo.setKindValue("1");
                        vo.setKindLabel("透明/PVC不干胶");
                        productMapper.insertSelective(vo);
                    }
                }
            }
        }
        return Msg.success();
    }
}
