diff --git a/src/main/java/lingtao/net/Factory/CanvasPricingStrategy.java b/src/main/java/lingtao/net/Factory/CanvasPricingStrategy.java new file mode 100644 index 0000000..c6acf94 --- /dev/null +++ b/src/main/java/lingtao/net/Factory/CanvasPricingStrategy.java @@ -0,0 +1,49 @@ +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; + +/** + * 提供画布产品的定价策略。 + * 该类主要用于计算画布类产品的价格列表,根据产品信息和用户角色进行价格计算。 + */ +public class CanvasPricingStrategy implements PricingStrategy { + /** + * 根据产品信息和用户角色计算画布产品的价格。 + * + * @param dto 产品信息对象,包含产品详细信息。 + * @param role 用户角色,用于确定价格策略。 + * @return 返回计算后的价格列表对象,如果未实现或无法计算则返回null。 + */ + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + double price = 0.0; + double basePrice = 0.0; + List resultList = new ArrayList<>(); + + + if ("领鸿".equals(plantName)) { + double area = Math.max(count * number * width * length / 10000, 0.2); + price = new BigDecimal(basePrice * area).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + + ProductVo pro = new ProductVo(); + pro.setCount(count); + pro.setPrice(price); + pro.setNumber(number); + pro.setWeight(BigDecimal.valueOf(width / 100 * length / 100 * count * 0.07).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); + resultList.add(pro); + return new PricingListVo(resultList); + } +} diff --git a/src/main/java/lingtao/net/Factory/CardPricingStrategy.java b/src/main/java/lingtao/net/Factory/CardPricingStrategy.java index 595322d..6d2a541 100644 --- a/src/main/java/lingtao/net/Factory/CardPricingStrategy.java +++ b/src/main/java/lingtao/net/Factory/CardPricingStrategy.java @@ -1,2 +1,398 @@ -package lingtao.net.Factory;public class CardPricingStrategy { +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; +import org.springframework.util.StringUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; + +public class CardPricingStrategy implements PricingStrategy { + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + String kindValue = dto.getProTypeLabel(); + + if ("菜单".equals(kindValue)) { + //return new PricingListVo(100, "暂无报价"); // 返回空列表表示不适用 +// String size = dto.getUi_menu_size(); +// dto.setLength(Double.valueOf(size.substring(0, size.indexOf("*")))); +// if (size.contains(",")) { +// size = size.split(",")[0]; +// } +// if (size.indexOf(("*"), size.indexOf("*") + 1) == -1) { +// dto.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1))); +// } else { +// dto.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1, size.indexOf(("*"), size.indexOf("*") + 1)))); +// dto.setLength(Math.abs(Double.parseDouble(size.substring(size.indexOf(("*"), size.indexOf("*") + 1) + 1)))); +// } + } + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + // 定义纸张尺寸(单位:毫米) + double paperLength = 280; // 纸张长度 + double paperWidth = 420; // 纸张宽度 + String basePrice = "0"; // 基础价格 + BigDecimal price = new BigDecimal(0); // 最终价格 + BigDecimal weight = BigDecimal.ZERO; + + length = convertToMillimetersWithMargin(length); + width = convertToMillimetersWithMargin(width); + String material = "1"; + if ("婚礼报纸".equals(kindValue)) { + material = "2";//157g铜版纸 + } else if ("特种纸名片".equals(kindValue)) { + material = dto.getKindValue6(); + } else if ("菜单".equals(kindValue) && "2".equals(dto.getKindValue5())) { + material = "pvc"; + } + String ggSize = dto.getSize1();//刮刮膜 + List resultList = new ArrayList<>(); + List craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); + if ("艾印".equals(plantName) && !"种子纸".equals(kindValue) && !"菜单".equals(kindValue)) { + if (craft_list.contains("烫金") || craft_list.contains("彩色印刷+烫金")) { + return new PricingListVo(100, "车间无烫金工艺"); // 返回空列表表示不适用 + } + + + Map> kindValuePrice = new HashMap<>(); + + // 统一键的类型为字符串 + kindValuePrice.put("1", createPriceMap("1", "3", "2", "3.3"));//300g铜版纸 + kindValuePrice.put("2", createPriceMap("1", "1.8", "2", "2.4"));//157g铜版纸 + kindValuePrice.put("皙贝", createPriceMap("1", "2.1", "2", "3.1"));//白卡 + kindValuePrice.put("琮纹", createPriceMap("1", "2.5", "2", "3.7"));//刚古 + kindValuePrice.put("玉蕊", createPriceMap("1", "2.7", "2", "3.8"));//蛋壳 + kindValuePrice.put("睿狐", createPriceMap("1", "2.7", "2", "3.8"));//莱尼 + kindValuePrice.put("溪雪", createPriceMap("1", "3.2", "2", "3.2"));//珠光 + if (!kindValuePrice.containsKey(material)) { + return new PricingListVo(100, "暂无报价"); // 返回空列表表示不适用 + } + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + int requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + //单双面单价不一致 + Map prices = kindValuePrice.get(material); + if ("双面印刷".equals(dto.getCraftShua())) { + basePrice = prices.get("2"); + } else { + basePrice = prices.get("1"); + } + price = new BigDecimal(basePrice).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP); + + if ("刮刮卡".equals(kindValue)) { + Map> ggmPrices = new HashMap>(); + ggmPrices.put("60*25", createPriceMap("50", "3", "100", "5")); + ggmPrices.put("48*15", createPriceMap("50", "2", "100", "3")); + ggmPrices.put("8*30", createPriceMap("50", "1", "100", "2")); + ggmPrices.put("6*22", createPriceMap("50", "0.8", "100", "1.6")); + if (!ggmPrices.containsKey(ggSize)) { + return new PricingListVo(100, "无该尺寸刮刮膜"); // 返回空列表表示不适用 + } + Map ggmPrice = ggmPrices.get(ggSize); + if (count <= 50) { + price = price.add(new BigDecimal(ggmPrice.get("50"))).setScale(2, RoundingMode.HALF_UP); + } else { + price = price.add(new BigDecimal(ggmPrice.get("100"))).setScale(2, RoundingMode.HALF_UP); + } + } + } + if ("即客".equals(plantName) && !"种子纸".equals(kindValue) && !"菜单".equals(kindValue)) { + if (craft_list.contains("烫金") || craft_list.contains("彩色印刷+烫金")) { + return new PricingListVo(100, "车间无烫金工艺"); // 返回空列表表示不适用 + } + + Map> kindValuePrice = new HashMap<>(); + + // 统一键的类型为字符串 + kindValuePrice.put("1", createPriceMap("1", "3", "2", "3.3"));//300g铜版纸 + kindValuePrice.put("2", createPriceMap("1", "1.8", "2", "2.4"));//157g铜版纸 + kindValuePrice.put("萱姿", createPriceMap("1", "3", "2", "3"));//雅柔 + kindValuePrice.put("芳怡", createPriceMap("1", "3", "2", "3"));//草香 + if (!kindValuePrice.containsKey(material)) { + return new PricingListVo(100, "暂无报价"); // 返回空列表表示不适用 + } + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + int requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + //单双面单价不一致 + Map prices = kindValuePrice.get(material); + if ("双面印刷".equals(dto.getCraftShua())) { + basePrice = prices.get("2"); + } else { + basePrice = prices.get("1"); + } + price = new BigDecimal(basePrice).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP); + + if ("刮刮卡".equals(kindValue)) { + Map> ggmPrices = new HashMap>(); + ggmPrices.put("60*25", createPriceMap("50", "3", "100", "6")); + ggmPrices.put("48*15", createPriceMap("50", "2", "100", "4")); + ggmPrices.put("8*30", createPriceMap("50", "1", "100", "2")); + ggmPrices.put("6*22", createPriceMap("50", "0.8", "100", "1.6")); + if (!ggmPrices.containsKey(ggSize)) { + return new PricingListVo(100, "无该尺寸刮刮膜"); // 返回空列表表示不适用 + } + Map ggmPrice = ggmPrices.get(ggSize); + if (count <= 50) { + price = price.add(new BigDecimal(ggmPrice.get("50"))).setScale(2, RoundingMode.HALF_UP); + } else { + price = price.add(new BigDecimal(ggmPrice.get("100"))).setScale(2, RoundingMode.HALF_UP); + } + } + } + if ("欣海信".equals(plantName) && !"种子纸".equals(kindValue)) { + paperLength = 272; // 纸张长度 + paperWidth = 390; // 纸张宽度 + Map> kindValuePrice = new HashMap<>(); + + // 统一键的类型为字符串 + kindValuePrice.put("1", createPriceMap("1", "3", "2", "3.3"));//300g铜版纸 + kindValuePrice.put("pvc", createPriceMap("1", "3", "2", "3.3"));//300g铜版纸 + kindValuePrice.put("2", createPriceMap("1", "1.8", "2", "2.4"));//157g铜版纸 + kindValuePrice.put("溪雪", createPriceMap("1", "4", "2", "6"));//珠光 + kindValuePrice.put("琮纹", createPriceMap("1", "4", "2", "6"));//刚古 + kindValuePrice.put("睿狐", createPriceMap("1", "4", "2", "6"));//莱尼 + kindValuePrice.put("玉蕊", createPriceMap("1", "4", "2", "6"));//蛋壳 + if (!kindValuePrice.containsKey(material)) { + return new PricingListVo(100, "暂无报价"); // 返回空列表表示不适用 + } + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + int requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + //单双面单价不一致 + Map prices = kindValuePrice.get(material); + if ("双面印刷".equals(dto.getCraftShua())) { + basePrice = prices.get("2"); + if (craft_list.contains("烫金") || craft_list.contains("彩色印刷+烫金")) { + basePrice = new BigDecimal(basePrice).add(new BigDecimal(prices.get("18"))).setScale(2, RoundingMode.HALF_UP).toString(); + } + } else { + basePrice = prices.get("1"); + if (craft_list.contains("烫金") || craft_list.contains("彩色印刷+烫金")) { + basePrice = new BigDecimal(basePrice).add(new BigDecimal(prices.get("9"))).setScale(2, RoundingMode.HALF_UP).toString(); + } + } + price = new BigDecimal(basePrice).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP); + + if ("刮刮卡".equals(kindValue)) { + price = price.add(new BigDecimal(0.3).multiply(new BigDecimal(count))).setScale(2, RoundingMode.HALF_UP); + } + } + if ("彩印通".equals(plantName) && !"种子纸".equals(kindValue) && !"菜单".equals(kindValue)) { + paperLength = 297; + paperWidth = 420; + if (craft_list.contains("烫金") || craft_list.contains("彩色印刷+烫金")) { + return new PricingListVo(100, "车间无烫金工艺"); // 返回空列表表示不适用 + } + Map> kindValuePrice = new HashMap<>(); + + // 统一键的类型为字符串 + kindValuePrice.put("1", createPriceMap("1", "2.5", "2", "3"));//300g铜版纸 + kindValuePrice.put("芳怡", createPriceMap("1", "5.5", "2", "5.5"));//草香 + kindValuePrice.put("溪雪", createPriceMap("1", "3.5", "2", "3.5"));//珠光 + kindValuePrice.put("萱姿", createPriceMap("1", "5", "2", "5"));//雅柔 + if (!kindValuePrice.containsKey(material)) { + return new PricingListVo(100, "暂无报价"); // 返回空列表表示不适用 + } + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + int requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + //单双面单价不一致 + Map prices = kindValuePrice.get(material); + if ("双面印刷".equals(dto.getCraftShua())) { + basePrice = prices.get("2"); + } else { + basePrice = prices.get("1"); + } + if (craft_list.contains("异形")) { + basePrice = new BigDecimal(basePrice).add(new BigDecimal("0.5")).setScale(2, RoundingMode.HALF_UP).toString(); + } + price = new BigDecimal(basePrice).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP); + + if ("刮刮卡".equals(kindValue)) { + BigDecimal ggPrice = new BigDecimal("0.02").multiply(new BigDecimal(count)); + price = price.add(ggPrice.compareTo(new BigDecimal("30")) > 0 ? ggPrice : new BigDecimal("30")).setScale(2, RoundingMode.HALF_UP); + } + } + if ("种子纸".equals(kindValue) && "鸿晟".equals(plantName)) { + if (!StringUtils.isEmpty(dto.getSwitchz3Size()) || "2".equals(dto.getZ3type())) { + count = Math.max(count, 300); + } + price = BigDecimal.valueOf((length * width * count * 70) / 1000000).setScale(2, RoundingMode.HALF_UP);//价格计算尺寸*数量*200/10000 + + if (craft_list.contains("编码")) {//起步价10 + price = price.add(max(new BigDecimal(count * 0.4), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.contains("打孔")) { + price = price.add(max(new BigDecimal(count * 0.1), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.contains("手撕线")) { + price = price.add(max(new BigDecimal(count * 0.2), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.contains("压痕")) { + price = price.add(max(new BigDecimal(count * 0.2), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + price = price.multiply(new BigDecimal(number));//款数翻倍 + price = max(price, new BigDecimal(80)).setScale(2, RoundingMode.HALF_UP); + + if (!StringUtils.isEmpty(dto.getSwitchz3Size())) { + price = price.add(new BigDecimal(100)).add(new BigDecimal(count * 0.1)).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.size() > 0 && craft_list.contains("绳子")) { + price = price.add(max(new BigDecimal(0.1 * number * count), new BigDecimal(5))).setScale(2, RoundingMode.HALF_UP); + } + } + if ("种子纸".equals(kindValue) && "驰远".equals(plantName)) { + if (!StringUtils.isEmpty(dto.getSwitchz3Size()) || "2".equals(dto.getZ3type())) { + count = Math.max(count, 300); + } + basePrice = "45"; + if (!StringUtils.isEmpty(dto.getSwitchz3Size())) { + basePrice = "65"; + if (length > 12 || width > 12) { + return new PricingListVo(100, "纸张尺寸超出"); + } + } + price = BigDecimal.valueOf((length * width * count) / 1000000).multiply(new BigDecimal(basePrice)).setScale(2, RoundingMode.HALF_UP);//价格计算尺寸*数量*200/10000 + + if (craft_list.contains("编码")) {//起步价10 + price = price.add(max(new BigDecimal(count * 0.4), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.contains("打孔")) { + price = price.add(max(new BigDecimal(count * 0.1), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.contains("手撕线")) { + price = price.add(max(new BigDecimal(count * 0.2), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + if (craft_list.contains("压痕")) { + price = price.add(max(new BigDecimal(count * 0.2), new BigDecimal(10))).setScale(2, RoundingMode.HALF_UP); + } + price = price.multiply(new BigDecimal(number));//款数翻倍 + price = max(price, new BigDecimal(80)).setScale(2, RoundingMode.HALF_UP); + + + if (craft_list.size() > 0 && craft_list.contains("绳子")) { + price = price.add(max(new BigDecimal(0.1 * number * count), new BigDecimal(5))).setScale(2, RoundingMode.HALF_UP); + } + } + weight = BigDecimal.valueOf(number * (length) / 1000 * (width) / 1000 * count * 0.25 * 1.15); + // 创建产品对象并添加到结果列表 + ProductVo pro = new ProductVo(); + pro.setPrice(price.doubleValue()); + pro.setCount(count); + pro.setWeight(weight.toString()); + resultList.add(pro); + return new PricingListVo(resultList); + } + + public static BigDecimal max(BigDecimal a, BigDecimal b) { + if (a == null) { + return b; + } + if (b == null) { + return a; + } + return a.compareTo(b) >= 0 ? a : b; + } + + /** + * 创建价格映射 + * + * @param keysAndValues 键值对数组 + * @return 初始化后的价格映射 + */ + private Map createPriceMap(String... keysAndValues) { + if (keysAndValues.length % 2 != 0) { + throw new IllegalArgumentException("键值对数量必须为偶数"); + } + Map priceMap = new HashMap<>(); + for (int i = 0; i < keysAndValues.length; i += 2) { + priceMap.put(keysAndValues[i], keysAndValues[i + 1]); + } + return priceMap; + } + + /** + * 将给定的尺寸转换为毫米,并在每边增加3毫米的边距 + * + * @param size 需要转换的原始尺寸 + * @return 转换后的尺寸,单位为毫米,包括边距 + */ + private double convertToMillimetersWithMargin(double size) { + return size * 10 + 2 * 2; // 换成毫米,每边+2 + } + + /** + * 检查给定的长度和宽度是否在纸张尺寸范围内 + * + * @param length 需要检查的长度 + * @param width 需要检查的宽度 + * @param paperLength 纸张的长度 + * @param paperWidth 纸张的宽度 + * @return 如果给定尺寸在纸张尺寸范围内,则返回true;否则返回false + */ + private boolean isWithinPaperSize(double length, double width, double paperLength, double paperWidth) { + return (length <= paperLength && width <= paperWidth) || (length <= paperWidth && width <= paperLength); + } + + /** + * 计算每张纸最多可以容纳的物品数量 + * + * @param length 物品的长度 + * @param width 物品的宽度 + * @param paperLength 纸张的长度 + * @param paperWidth 纸张的宽度 + * @return 每张纸最多可以容纳的物品数量 + */ + private double calculateMaxItemsPerSheet(double length, double width, double paperLength, double paperWidth) { + return Math.max( + Math.floor(paperLength / length) * Math.floor(paperWidth / width), + Math.floor(paperLength / width) * Math.floor(paperWidth / length) + ); + } + + /** + * 计算完成指定数量的物品所需的纸张数量 + * + * @param count 物品的总数量 + * @param number 每个物品需要的数量 + * @param maxItemsPerSheet 每张纸最多可以容纳的物品数量 + * @return 完成指定数量的物品所需的纸张数量 + */ + private int calculateRequiredSheets(int count, int number, double maxItemsPerSheet) { + return (int) Math.ceil((count * number) / maxItemsPerSheet); + } } diff --git a/src/main/java/lingtao/net/Factory/ClassFlagPricingStrategy.java b/src/main/java/lingtao/net/Factory/ClassFlagPricingStrategy.java new file mode 100644 index 0000000..ffe16fe --- /dev/null +++ b/src/main/java/lingtao/net/Factory/ClassFlagPricingStrategy.java @@ -0,0 +1,63 @@ +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * 班级标志定价策略类 + * 实现了PricingStrategy接口,用于根据用户角色计算产品价格 + * 此策略专注于处理与班级标志相关的产品价格计算 + */ +public class ClassFlagPricingStrategy implements PricingStrategy { + /** + * 根据用户角色计算产品价格 + * 此方法旨在根据不同用户角色计算产品的价格,但具体实现尚未完成 + * + * @param dto 产品信息对象,包含产品详细信息 + * @param role 用户角色,用于确定价格策略 + * @return 返回计算后的价格信息对象,当前实现返回null + */ + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + double price = 0.0; + double basePrice = 0.0; + List resultList = new ArrayList<>(); + List craft_list = Optional.ofNullable(dto) + .map(Product::getCraft) // 假设 dto 是 Dto 类型 + .map(Arrays::asList) + .orElseGet(ArrayList::new); + + // 确保 craftList 是可变的 + craft_list = new ArrayList<>(craft_list); + if ("领鸿".equals(plantName)) { + //旗帜布 + basePrice = 6.5; + double area = Math.max(count * number * width * length / 10000, 0.3); + price = new BigDecimal(basePrice * area).setScale(2, RoundingMode.HALF_UP).doubleValue(); + if (craft_list.contains("旗杆")) { + price = BigDecimal.valueOf(price).add(BigDecimal.valueOf(count * number * 15.0)).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + } + + ProductVo pro = new ProductVo(); + pro.setCount(count); + pro.setPrice(price); + pro.setNumber(number); + pro.setWeight(BigDecimal.valueOf(width / 100 * length / 100 * count * 0.07).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); + resultList.add(pro); + return new PricingListVo(resultList); + } +} diff --git a/src/main/java/lingtao/net/Factory/DossalPricingStrategy.java b/src/main/java/lingtao/net/Factory/DossalPricingStrategy.java new file mode 100644 index 0000000..4da72c3 --- /dev/null +++ b/src/main/java/lingtao/net/Factory/DossalPricingStrategy.java @@ -0,0 +1,60 @@ +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * 提供了一种特定的定价策略。 + * 该策略专门用于处理挂布产品的定价计算,根据产品信息和用户角色来确定最终价格。 + */ +public class DossalPricingStrategy implements PricingStrategy { + /** + * 根据产品信息和用户角色计算价格。 + * 此方法旨在根据不同类型的用户(如普通用户、会员等)对Dossal产品提供定制化的定价。 + * + * @param dto 产品信息对象,包含了需要计算价格的产品的所有必要信息。 + * @param role 用户角色,用于确定用户类型,进而影响最终的定价结果。 + * @return 返回计算后的价格列表视图对象,若不适用或未实现则返回null。 + */ + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + double price = 0.0; + double basePrice = 0.0; + List resultList = new ArrayList<>(); + List craft_list = Optional.ofNullable(dto) + .map(Product::getCraft) // 假设 dto 是 Dto 类型 + .map(Arrays::asList) + .orElseGet(ArrayList::new); + // 确保 craftList 是可变的 + craft_list = new ArrayList<>(craft_list); + if ("领鸿".equals(plantName)) { + if ("半透纱幔".equals(dto.getKindValue())) { + basePrice = 15.0; + double area = Math.max(count * number * width * length / 10000, 0.3); + + price = new BigDecimal(basePrice * area).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + } + + ProductVo pro = new ProductVo(); + pro.setCount(count); + pro.setPrice(price); + pro.setNumber(number); + pro.setWeight(BigDecimal.valueOf(width / 100 * length / 100 * count * 0.07).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); + resultList.add(pro); + return new PricingListVo(resultList); + } +} diff --git a/src/main/java/lingtao/net/Factory/HandFlagPricingStrategy.java b/src/main/java/lingtao/net/Factory/HandFlagPricingStrategy.java new file mode 100644 index 0000000..1504dd2 --- /dev/null +++ b/src/main/java/lingtao/net/Factory/HandFlagPricingStrategy.java @@ -0,0 +1,61 @@ +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; + +public class HandFlagPricingStrategy implements PricingStrategy { + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + double price = 0.0; + double basePrice = 0.0; + List resultList = new ArrayList<>(); + if ("领鸿".equals(plantName)) { + //春亚布 + if ("1".equals(dto.getKindValue())) { + + // 合并逻辑,减少嵌套层级 + if (width == 17 && length <= 20) { + basePrice = 2.5; + } else if (width == 24 && length <= 70) { + basePrice = 3; + } else if (length > 70) { + basePrice = 4; + } + + } + //贡缎布 + if ("2".equals(dto.getKindValue())) { + if (width == 17 && length <= 20) { + basePrice = 4; + } else if (width == 24 && length <= 70) { + basePrice = 5; + } else if (length > 70) { + basePrice = 6; + } + } + if (basePrice == 0) { + return new PricingListVo(100, "暂无报价。"); + } + + price = new BigDecimal(basePrice * count * number / 10000).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + ProductVo pro = new ProductVo(); + pro.setCount(count); + pro.setPrice(price); + pro.setNumber(number); + pro.setWeight(BigDecimal.valueOf(width / 100 * length / 100 * count * 0.07).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); + resultList.add(pro); + return new PricingListVo(resultList); + } +} diff --git a/src/main/java/lingtao/net/Factory/MetalTargetStrategy.java b/src/main/java/lingtao/net/Factory/MetalTargetStrategy.java index f0f84c3..fc0a453 100644 --- a/src/main/java/lingtao/net/Factory/MetalTargetStrategy.java +++ b/src/main/java/lingtao/net/Factory/MetalTargetStrategy.java @@ -1,2 +1,231 @@ -package lingtao.net.Factory;public class MetalTargetStrategy { +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.util.PriceUtils; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class MetalTargetStrategy implements PricingStrategy { + + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + + List resultList = new ArrayList<>(); + + // 定义纸张尺寸(单位:毫米) + double paperLength = 295; // 纸张长度 + double paperWidth = 195; // 纸张宽度 + double basePrice = 0; // 基础价格 + double minPrice = 0; // 起步价 + double price = 0; // 最终价格 + double colorPrice = 0; // 颜色附加费 + double moreColorPrice = 0; // 多颜色附加费 + int requiredSheets = 0; + BigDecimal weight = BigDecimal.ZERO; + // 转换尺寸为毫米并增加边距 + length = convertToMillimetersWithMargin(length); + width = convertToMillimetersWithMargin(width); + + if ("金大".equals(plantName) || "鑫灿".equals(plantName)) { + + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + + // 计算颜色附加费 + if (!"金色".equals(dto.getTcolor()) && !"银色".equals(dto.getTcolor()) && !"玫瑰金色".equals(dto.getTcolor())) { + colorPrice = 1; + } + + if ("金大".equals(plantName)) { + // 设置起步价 + minPrice = 45; + if ("双色".equals(dto.getCraftMo())) { + minPrice = 70; + moreColorPrice = 10; + } + if ("彩色(三色)".equals(dto.getCraftMo())) { + minPrice = 105; + moreColorPrice = 20; + + } + colorPrice += moreColorPrice; + // 根据数量计算基础价格 + if (requiredSheets <= 2) { + price = minPrice + colorPrice; + } else if (requiredSheets <= 9) { + price = minPrice + (requiredSheets - 2) * (12 + colorPrice); + } else if (requiredSheets <= 19) { + price = Math.ceil((13 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 29) { + price = Math.ceil((12 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 39) { + price = Math.ceil((11 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 49) { + price = Math.ceil((10 + colorPrice) * requiredSheets); + } else { + price = Math.ceil((9 + colorPrice) * requiredSheets); + } + } + if ("鑫灿".equals(plantName)) { + // 设置起步价 + minPrice = 45; + if ("双色".equals(dto.getCraftMo())) { + minPrice = 55; + moreColorPrice = 10; + } + if ("彩色(三色)".equals(dto.getCraftMo())) { + minPrice = 105; + moreColorPrice = 20; + + } + colorPrice += moreColorPrice; + // 根据数量计算基础价格 + if (requiredSheets <= 2) { + price = minPrice + colorPrice; + } else if (requiredSheets <= 9) { + price = minPrice + (requiredSheets - 2) * (10 + colorPrice); + } else if (requiredSheets <= 19) { + price = Math.ceil((13 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 29) { + price = Math.ceil((12 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 39) { + price = Math.ceil((11 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 49) { + price = Math.ceil((10 + colorPrice) * requiredSheets); + } else if (requiredSheets <= 100) { + price = Math.ceil((9 + colorPrice) * requiredSheets); + } else { + price = Math.ceil((8 + colorPrice) * requiredSheets); + } + + } + + } + if ("紫瑶".equals(plantName)) { + paperLength = 170; + paperWidth = 300; + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + // 计算颜色附加费 + if (!"银色".equals(dto.getTcolor())) { + colorPrice = 1; + } + // 设置起步价 + minPrice = 40; + if ("单色".equals(dto.getCraftMo())) { + if (requiredSheets == 1) { + price = colorPrice == 1 ? 45 : 40; + } else if (requiredSheets == 2) { + price = colorPrice == 1 ? 55 : 50; + } else if (requiredSheets == 3) { + price = colorPrice == 1 ? 65 : 55; + } else if (requiredSheets == 4) { + price = colorPrice == 1 ? 70 : 60; + } else if (requiredSheets == 5) { + price = colorPrice == 1 ? 75 : 65; + } else if (requiredSheets == 6) { + price = colorPrice == 1 ? 80 : 70; + } else { + price = colorPrice == 1 ? 80 + (requiredSheets - 6) * 9 : 70 + (requiredSheets - 6) * 8; + } + } + if ("双色".equals(dto.getCraftMo())) { + minPrice = 60; + moreColorPrice = 30; + + } + if ("彩色(三色)".equals(dto.getCraftMo())) { + minPrice = 70; + moreColorPrice = 40; + + } + if (price == 0) { + price = Math.ceil(minPrice + moreColorPrice * (requiredSheets - 1)); + } + } + // 创建产品对象并添加到结果列表 + ProductVo pro = new ProductVo(); + pro.setPrice(price); + pro.setCount(count); + pro.setWeight(BigDecimal.valueOf(requiredSheets / 30).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); + resultList.add(pro); + return new PricingListVo(resultList); + } + + /** + * 将给定的尺寸转换为毫米,并在每边增加3毫米的边距 + * + * @param size 需要转换的原始尺寸 + * @return 转换后的尺寸,单位为毫米,包括边距 + */ + private double convertToMillimetersWithMargin(double size) { + return size * 10 + 2 * 1.5; // 换成毫米,每边+3 + } + + /** + * 检查给定的长度和宽度是否在纸张尺寸范围内 + * + * @param length 需要检查的长度 + * @param width 需要检查的宽度 + * @param paperLength 纸张的长度 + * @param paperWidth 纸张的宽度 + * @return 如果给定尺寸在纸张尺寸范围内,则返回true;否则返回false + */ + private boolean isWithinPaperSize(double length, double width, double paperLength, double paperWidth) { + return (length <= paperLength && width <= paperWidth) || (length <= paperWidth && width <= paperLength); + } + + /** + * 计算每张纸最多可以容纳的物品数量 + * + * @param length 物品的长度 + * @param width 物品的宽度 + * @param paperLength 纸张的长度 + * @param paperWidth 纸张的宽度 + * @return 每张纸最多可以容纳的物品数量 + */ + private double calculateMaxItemsPerSheet(double length, double width, double paperLength, double paperWidth) { + return Math.max( + Math.floor(paperLength / length) * Math.floor(paperWidth / width), + Math.floor(paperLength / width) * Math.floor(paperWidth / length) + ); + } + + /** + * 计算完成指定数量的物品所需的纸张数量 + * + * @param count 物品的总数量 + * @param number 每个物品需要的数量 + * @param maxItemsPerSheet 每张纸最多可以容纳的物品数量 + * @return 完成指定数量的物品所需的纸张数量 + */ + private int calculateRequiredSheets(int count, int number, double maxItemsPerSheet) { + return (int) Math.ceil((count * number) / maxItemsPerSheet); + } } diff --git a/src/main/java/lingtao/net/Factory/PosterPricingStrategy.java b/src/main/java/lingtao/net/Factory/PosterPricingStrategy.java new file mode 100644 index 0000000..64672e2 --- /dev/null +++ b/src/main/java/lingtao/net/Factory/PosterPricingStrategy.java @@ -0,0 +1,200 @@ +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; + +public class PosterPricingStrategy implements PricingStrategy { + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + String kindValue = dto.getKindValue(); + String kinde2Value = dto.getKind2Value(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + List resultList = new ArrayList<>(); + + double price = 0; + double basePrice = 0; + + if ("佳达".equals(plantName)) { + //制度牌 + if ("0".equals(kindValue)) { + //室内写真裱冷板 + if ("0".equals(kinde2Value)) { + basePrice = 20; + } + //室内写真裱冷板装小C边(小金边/银边) + if ("3".equals(kinde2Value)) { + basePrice = 11; + } + //户外写真裱冷板装小C边(小金边/银边) + if ("8".equals(kinde2Value)) { + basePrice = 11; + } + } + //室内写真 + if ("1".equals(kindValue)) { + //pp纸(室内) + if ("3".equals(kinde2Value)) { + basePrice = 12; + } + //直喷PVC + if ("5".equals(kinde2Value)) { + basePrice = 11; + } + //软膜 + if ("14".equals(kinde2Value)) { + basePrice = 15; + } + //地贴(复防滑膜) + if ("15".equals(kinde2Value)) { + basePrice = 25; + } + } + //户外写真 + if ("2".equals(kindValue)) { + //户外写真白胶(国产) + if ("0".equals(kinde2Value)) { + basePrice = 11; + } + //户外写真黑胶(国产) + if ("1".equals(kinde2Value)) { + basePrice = 11; + } + //户外写真可移白胶、黑胶 + if ("2".equals(kinde2Value)) { + basePrice = 12; + } + //车贴(白胶) + if ("6".equals(kinde2Value)) { + basePrice = 22; + } + //摆摊软膜灯箱 + if ("24".equals(kinde2Value)) { + basePrice = 190; + } + } + //布 + if ("3".equals(kindValue)) { + //黑底布 + if ("2".equals(kinde2Value)) { + basePrice = 8; + } + //写真布 + if ("6".equals(kinde2Value)) { + basePrice = 0; + } + //油画布 + if ("8".equals(kinde2Value)) { + basePrice = 22; + } + //550灯布 + if ("11".equals(kinde2Value)) { + basePrice = 6.5; + } + //550黑底灯布 + if ("13".equals(kinde2Value)) { + basePrice = 8; + } + } + //展架 + if ("4".equals(kindValue)) { + //直喷PVC装美式展架180*80cm + if ("0".equals(kinde2Value)) { + basePrice = 28; + } + //直喷PVC装美式展架160*60cm + if ("1".equals(kinde2Value)) { + basePrice = 21; + } + //PP纸装美式展架180*80cm + if ("2".equals(kinde2Value)) { + basePrice = 28; + } + //PP纸装美式展架160*60cm + if ("3".equals(kinde2Value)) { + basePrice = 21; + } + //直喷PVC装门型展架180*80cm + if ("4".equals(kinde2Value)) { + basePrice = 40.5; + } + + //PP纸装门型展架180*80cm + if ("6".equals(kinde2Value)) { + basePrice = 40.5; + } + //PP纸装门型展架160*60cm + if ("7".equals(kinde2Value)) { + basePrice = 37; + } + //X展架180*80cm(不含画面) + if ("8".equals(kinde2Value)) { + basePrice = 12; + } + //X展架160*60cm(不含画面) + if ("9".equals(kinde2Value)) { + basePrice = 10; + } + //门型展架180*80cm(不含画面) + if ("10".equals(kinde2Value)) { + basePrice = 30; + } + //门型展架160*60cm(不含画面) + if ("11".equals(kinde2Value)) { + basePrice = 27; + } + //直喷pvc铝合金易拉宝202*78cm + if ("12".equals(kinde2Value)) { + basePrice = 40; + } + //直喷pvc塑钢易拉宝200*80cm + if ("13".equals(kinde2Value)) { + basePrice = 47; + } + } + if (basePrice == 0) { + return new PricingListVo(100, "暂无报价。"); + } + + if (!"4".equals(kindValue)) { + price = new BigDecimal(basePrice * count * number * width * length / 10000).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } else { + price = new BigDecimal(basePrice * count * number).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + } + if ("领鸿".equals(plantName)) { + //旗帜布 + if ("6".equals(dto.getKindValue())) { + basePrice = 6.5; + } + //贡缎布 + if ("7".equals(dto.getKindValue())) { + basePrice = 15; + } + if (basePrice == 0) { + return new PricingListVo(100, "暂无报价。"); + } + double area = Math.max(count * number * width * length / 10000, 0.3); + price = new BigDecimal(basePrice * area).setScale(2, RoundingMode.HALF_UP).doubleValue(); + //旗杆 + if (dto.getYaheng() != null && dto.getYaheng() > 0) { + price = BigDecimal.valueOf(price).add(BigDecimal.valueOf(dto.getYaheng() * 15.0)).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + } + ProductVo pro = new ProductVo(); + pro.setCount(count); + pro.setPrice(price); + pro.setNumber(number); + resultList.add(pro); + return new PricingListVo(resultList); + } +} diff --git a/src/main/java/lingtao/net/Factory/PricingStrategy.java b/src/main/java/lingtao/net/Factory/PricingStrategy.java index c6a2541..006ddca 100644 --- a/src/main/java/lingtao/net/Factory/PricingStrategy.java +++ b/src/main/java/lingtao/net/Factory/PricingStrategy.java @@ -1,2 +1,10 @@ -package lingtao.net.Factory;public interface PricingStrategy { +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; + +import java.util.List; + +public interface PricingStrategy { + PricingListVo calculatePrice(Product dto, String role); } diff --git a/src/main/java/lingtao/net/Factory/PricingStrategyFactory.java b/src/main/java/lingtao/net/Factory/PricingStrategyFactory.java index a5d4844..e6c2f3f 100644 --- a/src/main/java/lingtao/net/Factory/PricingStrategyFactory.java +++ b/src/main/java/lingtao/net/Factory/PricingStrategyFactory.java @@ -1,2 +1,31 @@ -package lingtao.net.Factory;public class PricingStrategyFactory { +package lingtao.net.Factory; + +public class PricingStrategyFactory { + public static PricingStrategy getStrategy(String proType) { + switch (proType) { + case "0": + return new StickerPricingStrategy(); + // 其他产品类型对应的策略 + case "金属标": + return new MetalTargetStrategy(); + // 其他产品类型对应的策略 + case "卡片少数量": + return new CardPricingStrategy(); + case "17": + return new PosterPricingStrategy(); + case "帆布": + return new CanvasPricingStrategy(); + case "班旗": + return new ClassFlagPricingStrategy(); + case "挂布": + return new DossalPricingStrategy(); + case "手拉旗": + return new HandFlagPricingStrategy(); + // 其他产品类型对应的策略 + default: + return null; + } + } + + } diff --git a/src/main/java/lingtao/net/Factory/StickerPricingStrategy.java b/src/main/java/lingtao/net/Factory/StickerPricingStrategy.java new file mode 100644 index 0000000..2c475ee --- /dev/null +++ b/src/main/java/lingtao/net/Factory/StickerPricingStrategy.java @@ -0,0 +1,246 @@ +package lingtao.net.Factory; + +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 提供不干胶产品的定价策略。 + * 该类主要用于处理贴纸产品价格的计算,根据不同的用户角色提供相应的价格策略。 + */ +public class StickerPricingStrategy implements PricingStrategy { + + /** + * 根据用户角色计算产品价格。 + * 此方法旨在根据不同用户的角色对产品进行定价,但当前实现尚未完成。 + * + * @param dto 产品信息的传输对象,包含需要计算价格的产品数据。 + * @param role 用户角色,用于确定适用的定价策略。 + * @return 返回经过计算价格更新后的产品列表,当前实现返回null。 + */ + @Override + public PricingListVo calculatePrice(Product dto, String role) { + String plantName = dto.getPlantName(); + double width = dto.getWidth(); + double length = dto.getLength(); + int count = dto.getCount(); + int number = dto.getNumber(); + // 定义纸张尺寸(单位:毫米) + double paperLength = 280; // 纸张长度 + double paperWidth = 420; // 纸张宽度 + String basePrice = "0"; // 基础价格 + BigDecimal price = new BigDecimal(0); // 最终价格 + length = convertToMillimetersWithMargin(length); + width = convertToMillimetersWithMargin(width); + int requiredSheets = 0; + List resultList = new ArrayList<>(); + + if ("艾印".equals(plantName) || "即客".equals(plantName)) { + Map kindValuePrice = new HashMap() {{ + put("0", "2.3"); //铜版纸不干胶 + put("1", "2.9"); //pvc不干胶 + put("2", "2.9"); //透明不干胶 + put("3", "2.3"); //牛皮纸 + put("5", "3.2"); //哑金不干胶 + put("6", "3.2"); //哑银不干胶 + put("7", "2.7"); //书写纸不干胶 + put("亮金", "3.2"); // + put("亮银", "3.2"); // + put("珠光冰白纸", "3.2"); // + put("美纹纸", "2.8"); // + put("拉丝金", "3.3"); // + put("拉丝银", "3.3"); // + put("易碎纸不干胶", "3.7"); // + put("PP合成纸", "2.9"); // + put("刚古水纹超白", "2.8"); // + }}; + if ("即客".equals(plantName)) { + kindValuePrice.put("树纹纸", "3.3"); + kindValuePrice.put("银平光", "3.6"); + kindValuePrice.put("白散金", "2.8"); + kindValuePrice.put("红洒金", "2.8"); + kindValuePrice.put("布纹纸超白", "5"); + kindValuePrice.put("草香纸", "3"); + } + if (!kindValuePrice.containsKey(dto.getKindValue())) { + return new PricingListVo(100, "暂不支持该产品"); + + } + basePrice = kindValuePrice.get(dto.getKindValue()); + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "超出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + + price = new BigDecimal(basePrice).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP); + + + } + if ("欣海信".equals(dto.getPlantName())) { + paperLength = 390; // 纸张长度 + paperWidth = 272; // 纸张宽度 + + // 检查是否超出纸张尺寸限制 + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "超出纸张尺寸限制"); // 返回空列表表示不适用 + } + + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + BigDecimal paperCount = new BigDecimal(requiredSheets); + BigDecimal yinbai = new BigDecimal("0"); + //铜版纸 + if ("0".equals(dto.getKindValue())) { + basePrice = "2.5"; + + } else { + basePrice = "4"; + } + if ("印白墨".equals(dto.getYinbai())) { + yinbai = "0".equals(dto.getKindValue()) ? new BigDecimal("20") : new BigDecimal("22"); + } + price = new BigDecimal(basePrice).multiply(paperCount).setScale(2, RoundingMode.HALF_UP); + price = price.add(yinbai.multiply(paperCount)).setScale(2, RoundingMode.HALF_UP); + if (dto.getN_mq_num() > 0) { + price = price.add(paperCount).setScale(2, RoundingMode.HALF_UP); + } + + } + if ("彩印通".equals(dto.getPlantName())) { + Map kindValuePrice = new HashMap() {{ + put("0", "2"); //铜版纸不干胶 + put("1", "3.2"); //pvc不干胶 + put("2", "3.2"); //透明不干胶 + put("3", "2.5"); //牛皮纸 + put("5", "3.5"); //哑金不干胶 + put("6", "3.5"); //哑银不干胶 + put("7", "3"); //书写纸不干胶 + put("亮金", "3.5"); // + put("亮银", "4"); // + put("珠光冰白纸", "3.5"); // + put("美纹纸", "2.5"); // + put("红洒金", "3.5"); // + put("布纹纸超白", "3.5"); // + put("刚古水纹超白", "3.5"); // + put("银平光", "4"); // + put("拉丝金", "3.5"); // + put("拉丝银", "3.5"); // + put("易碎纸不干胶", "4"); // + put("PP合成纸", "3.2"); // + put("草香纸", "3.5"); // + put("树纹纸", "3.5"); // + put("白散金", "3.5"); // + put("飘金超白不干胶", "3.5"); // + put("美纹纸散金", "3.5"); // + }}; + if ("0".equals(dto.getKindValue())) { + paperLength = 450; // 纸张长度 + paperWidth = 320; // 纸张宽度 + } else { + paperLength = 420; // 纸张长度 + paperWidth = 297; // 纸张宽度 + } + if (!kindValuePrice.containsKey(dto.getKindValue())) { + return new PricingListVo(100, "暂无报价"); // 返回空列表表示不适用 + } + if (!isWithinPaperSize(length, width, paperLength, paperWidth)) { + return new PricingListVo(100, "出纸张尺寸限制"); // 返回空列表表示不适用 + } + basePrice = kindValuePrice.get(dto.getKindValue()); + // 计算一张纸能容纳的最大金属标数量 + double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth); + + // 计算所需纸张数量 + requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet); + BigDecimal yinbai = new BigDecimal("0"); + if ("印白墨".equals(dto.getYinbai())) { + yinbai = "2".equals(dto.getKindValue()) ? new BigDecimal("6.2") : new BigDecimal("3"); + } + BigDecimal paperCount = new BigDecimal(requiredSheets); + price = new BigDecimal(basePrice).multiply(paperCount).setScale(2, RoundingMode.HALF_UP); + price = price.add(yinbai.multiply(paperCount)).setScale(2, RoundingMode.HALF_UP); + } + ProductVo pro = new ProductVo(); + pro.setPrice(price.doubleValue()); + pro.setCount(count); + +// if ("1".equals(dto.getKindValue())) { +// pro.setWeight(BigDecimal.valueOf(number * length / 100 * width / 100 * requiredSheets * 0.3).setScale(2, RoundingMode.HALF_UP).toString()); +// } else { +// pro.setWeight(BigDecimal.valueOf(number * length / 100 * width / 100 * requiredSheets * 0.24).setScale(2, RoundingMode.HALF_UP).toString()); +// } + + pro.setWeight(BigDecimal.valueOf(number * length / 1000 * width / 1000 * count * 0.21 * 1.16).setScale(2, RoundingMode.HALF_UP).toString()); + // 创建产品对象并添加到结果列表 + resultList.add(pro); + return new PricingListVo(resultList); + } + + /** + * 将给定的尺寸转换为毫米,并在每边增加3毫米的边距 + * + * @param size 需要转换的原始尺寸 + * @return 转换后的尺寸,单位为毫米,包括边距 + */ + private double convertToMillimetersWithMargin(double size) { + return size * 10 + 2 * 2; // 换成毫米,每边+2 + } + + /** + * 检查给定的长度和宽度是否在纸张尺寸范围内 + * + * @param length 需要检查的长度 + * @param width 需要检查的宽度 + * @param paperLength 纸张的长度 + * @param paperWidth 纸张的宽度 + * @return 如果给定尺寸在纸张尺寸范围内,则返回true;否则返回false + */ + private boolean isWithinPaperSize(double length, double width, double paperLength, double paperWidth) { + return (length <= paperLength && width <= paperWidth) || (length <= paperWidth && width <= paperLength); + } + + /** + * 计算每张纸最多可以容纳的物品数量 + * + * @param length 物品的长度 + * @param width 物品的宽度 + * @param paperLength 纸张的长度 + * @param paperWidth 纸张的宽度 + * @return 每张纸最多可以容纳的物品数量 + */ + private double calculateMaxItemsPerSheet(double length, double width, double paperLength, double paperWidth) { + return Math.max( + Math.floor(paperLength / length) * Math.floor(paperWidth / width), + Math.floor(paperLength / width) * Math.floor(paperWidth / length) + ); + } + + /** + * 计算完成指定数量的物品所需的纸张数量 + * + * @param count 物品的总数量 + * @param number 每个物品需要的数量 + * @param maxItemsPerSheet 每张纸最多可以容纳的物品数量 + * @return 完成指定数量的物品所需的纸张数量 + */ + private int calculateRequiredSheets(int count, int number, double maxItemsPerSheet) { + return (int) Math.ceil((count * number) / maxItemsPerSheet); + } +} diff --git a/src/main/java/lingtao/net/bean/Product.java b/src/main/java/lingtao/net/bean/Product.java index 778f1e0..ccbd0b9 100644 --- a/src/main/java/lingtao/net/bean/Product.java +++ b/src/main/java/lingtao/net/bean/Product.java @@ -54,6 +54,8 @@ public class Product { private String kind2Value; private String kindValue2; + private String kindValue6; + private String kindValue5; private String kind2Label; @@ -170,4 +172,8 @@ public class Product { private String shen_color; private String[] jtcolor;//击凸颜色 private String tcolor;//烫金颜色 + + private String plantName; + private String ui_menu_size; + private String address; } \ No newline at end of file diff --git a/src/main/java/lingtao/net/controller/ProductController.java b/src/main/java/lingtao/net/controller/ProductController.java index f6ce1ae..742a8af 100644 --- a/src/main/java/lingtao/net/controller/ProductController.java +++ b/src/main/java/lingtao/net/controller/ProductController.java @@ -2,12 +2,17 @@ package lingtao.net.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import lingtao.net.Factory.PricingStrategy; +import lingtao.net.Factory.PricingStrategyFactory; import lingtao.net.bean.Msg; import lingtao.net.bean.Product; import lingtao.net.bean.SysDictSearchPro; import lingtao.net.bean.SysUser; +import lingtao.net.service.PriceService; import lingtao.net.service.ProductService; import lingtao.net.service.QuoteLogService; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; @@ -18,9 +23,12 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; @RestController public class ProductController { @@ -31,6 +39,9 @@ public class ProductController { @Autowired private QuoteLogService quoteLogService; + @Autowired + private PriceService priceService; + // 价格跳转页面 @RequestMapping("/product/index") public void index(HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -52,8 +63,6 @@ public class ProductController { /** * 修改价格 - * - * @param customerData */ @RequestMapping("/updatePriceById") public Msg updatePriceById(@RequestParam(value = "proId") int proId, @RequestParam(value = "field") String field, @@ -70,10 +79,10 @@ public class ProductController { @RequestMapping("/getThanSum") public Msg thanPrice(Product product, HttpServletRequest request) { SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION"); - /*if (StringUtils.isEmpty(product.getWangwang().trim()) && user.getRole().contains("999") - && !user.getRole().contains("1049")) { - return Msg.fail("请填写客户旺旺!"); - }*/ + /*if (StringUtils.isEmpty(product.getWangwang().trim()) && user.getRole().contains("999") + && !user.getRole().contains("1049")) { + return Msg.fail("请填写客户旺旺!"); + }*/ if ("帆布".equals(product.getProTypeValue())) { if ("套餐".equals(product.getStickerKind())) { product.setCount(1); @@ -113,9 +122,9 @@ public class ProductController { } else { if (product.getNumber() != null && product.getNumber() > 1) { // if ("专版打印".equals(product.getStickerKind()) || "少数量".equals(product.getCouponKind())) { - if (request.getParameter("desType") != null && !"".equals(request.getParameter("desType"))) { - product.setP(Integer.valueOf(request.getParameter("desType"))); - } + if (request.getParameter("desType") != null && !"".equals(request.getParameter("desType"))) { + product.setP(Integer.valueOf(request.getParameter("desType"))); + } // } } } @@ -127,19 +136,19 @@ public class ProductController { //银瑾单独报价 if (user.getRole().indexOf("1010") > -1) { double otherPrice = 0; - /*if("5".equals(product.getKind())) { - for (Product list : proList) { - list.setPrice(list.getPrice() + 30); - } - }else if("帆布".equals(product.getProTypeValue())) { - for (Product list : proList) { - otherPrice = Math.floor(list.getPrice() + 5); - list.setPrice(otherPrice > 40 ? otherPrice : 40); - if(product.getNumber() > 1) { - list.setPrice(Math.floor(list.getPrice() + 2 * (product.getNumber()-1))); - } - } - }else */ + /*if("5".equals(product.getKind())) { + for (Product list : proList) { + list.setPrice(list.getPrice() + 30); + } + }else if("帆布".equals(product.getProTypeValue())) { + for (Product list : proList) { + otherPrice = Math.floor(list.getPrice() + 5); + list.setPrice(otherPrice > 40 ? otherPrice : 40); + if(product.getNumber() > 1) { + list.setPrice(Math.floor(list.getPrice() + 2 * (product.getNumber()-1))); + } + } + }else */ if ("22".equals(product.getProTypeValue())) { for (Product list : proList) { list.setPrice(list.getPrice() + 50); @@ -208,8 +217,8 @@ public class ProductController { if (StringUtils.isEmpty(product.getAotu())) { return Msg.fail("哑金不干胶该尺寸无法制作,最大做到 39*27 cm"); } /*else { - return Msg.fail("哑金不干胶带凹凸工艺该尺寸无法制作 (1*1CM至11*11CM;10*6至12*8CM;20*4以内)"); - }*/ + return Msg.fail("哑金不干胶带凹凸工艺该尺寸无法制作 (1*1CM至11*11CM;10*6至12*8CM;20*4以内)"); + }*/ } else if ("易碎纸不干胶".equals(product.getKindValue()) && proList == null) { return Msg.fail("易碎纸不干胶该尺寸无法制作,最大做到 42*38 cm"); } else if (("拉丝金".equals(product.getKindValue()) || "拉丝银".equals(product.getKindValue())) @@ -248,115 +257,175 @@ public class ProductController { } if (product.getKindValue() != null) {//判断是否大店报不干胶价格 - /*if(product.getKindValue().equals("0")) { - double width = 0, length = 0; - if(product.getWidth() != null) { - width = product.getWidth(); - } - if(product.getLength() != null) { - length = product.getLength(); - } - String role = user.getRole(); - if(length < width) { - length = product.getWidth(); - width = product.getLength(); - } - if(width == 0 && length == 0) { - }else if((length <= 5 && width <= 4)) { - String tang = product.getCraftTang(); - if(AStickersPrice.f_getRole(role) == 1 && tang == null) { - List price = new ArrayList(); - if(length == 1 && width == 1) { - int priceArr[] = {30, 35, 50, 55, 65, 90, 135, 185, 235, 285}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 2 && width == 1) { - int priceArr[] = {35, 40, 55, 60, 70, 95, 140, 190, 240, 290}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 3 && width == 1) { - int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 4 && width == 1) { - int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 5 && width == 1) { - int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 2 && width == 2) { - int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 3 && width == 2) { - int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 4 && width == 2) { - int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 5 && width == 2) { - int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 3 && width == 3) { - int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 4 && width == 3) { - int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 5 && width == 3) { - int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 4 && width == 4) { - int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - }else if(length == 5 && width == 4) { - int priceArr[] = {35, 40, 55, 70, 150, 240, 420, 600, 790, 980}; - price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); - } - - if (proList.size() >= 4) { - proList = proList.subList(0, 4); - } - - for(int i = 0; i < price.size(); i ++){ - if(product.getNumber() > 1) { - proList.get(i).setPrice(price.get(i).getPrice() * product.getNumber()); - }else { - proList.get(i).setPrice(price.get(i).getPrice()); - } - } - } - } - }elseif(user.getRole().indexOf("1033") > 0 && product.getProTypeValue().equals("17")) { - if(product.getKindValue().equals("6")) { - for (Product products : proList) { - products.setPrice(Math.floor(products.getPrice() * 0.88)); - } - } - } */ + /*if(product.getKindValue().equals("0")) { + double width = 0, length = 0; + if(product.getWidth() != null) { + width = product.getWidth(); + } + if(product.getLength() != null) { + length = product.getLength(); + } + String role = user.getRole(); + if(length < width) { + length = product.getWidth(); + width = product.getLength(); + } + if(width == 0 && length == 0) { + }else if((length <= 5 && width <= 4)) { + String tang = product.getCraftTang(); + if(AStickersPrice.f_getRole(role) == 1 && tang == null) { + List price = new ArrayList(); + if(length == 1 && width == 1) { + int priceArr[] = {30, 35, 50, 55, 65, 90, 135, 185, 235, 285}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 2 && width == 1) { + int priceArr[] = {35, 40, 55, 60, 70, 95, 140, 190, 240, 290}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 3 && width == 1) { + int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 4 && width == 1) { + int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 5 && width == 1) { + int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 2 && width == 2) { + int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 3 && width == 2) { + int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 4 && width == 2) { + int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 5 && width == 2) { + int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 3 && width == 3) { + int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 4 && width == 3) { + int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 5 && width == 3) { + int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 4 && width == 4) { + int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + }else if(length == 5 && width == 4) { + int priceArr[] = {35, 40, 55, 70, 150, 240, 420, 600, 790, 980}; + price = f_getPrice( priceArr, product.getCount(), product.getCraftMo()); + } + + if (proList.size() >= 4) { + proList = proList.subList(0, 4); + } + + for(int i = 0; i < price.size(); i ++){ + if(product.getNumber() > 1) { + proList.get(i).setPrice(price.get(i).getPrice() * product.getNumber()); + }else { + proList.get(i).setPrice(price.get(i).getPrice()); + } + } + } + } + }elseif(user.getRole().indexOf("1033") > 0 && product.getProTypeValue().equals("17")) { + if(product.getKindValue().equals("6")) { + for (Product products : proList) { + products.setPrice(Math.floor(products.getPrice() * 0.88)); + } + } + } */ } return Msg.success().add("proList", proList); } - - /*public List f_getPrice( int priceArr[], int count, String craftMo) { - List list = new ArrayList(); - Product p = new Product(); - int countArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000 }; - for(int i = 0; i < countArr.length; i++) { - if(countArr[i] < count || list.size() > 3) { - continue; - } - p = new Product(); - p.setCount(countArr[i]); - if(craftMo.equals("覆哑膜")) { - p.setPrice(Math.ceil(Double.valueOf(priceArr[i]) * 1.2)); - }else { - p.setPrice(Double.valueOf(priceArr[i])); - } - - list.add(p); - } - - return list; - }*/ + + @RequestMapping("/getProductPrice") + public Msg getProductPrice(Product product, HttpServletRequest request) { + SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION"); + + + if (StringUtils.isEmpty(product.getCount()) || product.getCount() <= 0) { + return Msg.fail("数量必须大于0"); + } + String size = product.getSize(); + + if (("17".equals(product.getProTypeValue()) && "6".equals(product.getKindValue())) || "手拉旗".equals(product.getProTypeValue())) { + if (!StringUtils.isEmpty(size)) { + String sizeList[] = size.split(","); + size = sizeList[0]; + } + product.setLength(Double.valueOf(size)); + } else if (!StringUtils.isEmpty(size)) { + product.setLength(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) { + product.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1))); + } else { + product.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1, size.indexOf(("*"), size.indexOf("*") + 1)))); + product.setLength(Math.abs(Double.parseDouble(size.substring(size.indexOf(("*"), size.indexOf("*") + 1) + 1)))); + } + } + product.setRole(user.getRole()); + PricingStrategy pricingStrategy = PricingStrategyFactory.getStrategy(product.getProTypeValue()); + PricingListVo listvo = pricingStrategy.calculatePrice(product, user.getRole()); + if (listvo.getCode() != 0) { + return Msg.fail(listvo.getMsg()); + } + List proList = listvo.getProList(); + if (proList == null || proList.size() == 0 || proList.get(0).getPrice() == 0) { + return Msg.fail("暂无报价"); + } + PricingListVo result = priceService.getAddressPrice(product, proList); + + if (result.getCode() != 0) { + return Msg.fail(result.getMsg()); + } + proList = result.getProList(); + + String log = quoteLogService.log(product, request, new ArrayList<>()); + + if ("登陆失效".equals(log)) { + return Msg.fail("登录信息失效~请刷新页面!"); + } + + // 把角色存入,前台判断,区分不同价格 + for (ProductVo p : proList) { + p.setRole(user.getRole()); + } + + return Msg.success().add("proList", proList); + } + + /*public List f_getPrice( int priceArr[], int count, String craftMo) { + List list = new ArrayList(); + Product p = new Product(); + int countArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000 }; + for(int i = 0; i < countArr.length; i++) { + if(countArr[i] < count || list.size() > 3) { + continue; + } + p = new Product(); + p.setCount(countArr[i]); + if(craftMo.equals("覆哑膜")) { + p.setPrice(Math.ceil(Double.valueOf(priceArr[i]) * 1.2)); + }else { + p.setPrice(Double.valueOf(priceArr[i])); + } + + list.add(p); + } + + return list; + }*/ /** * 根据产品种类获取材质 diff --git a/src/main/java/lingtao/net/service/PriceService.java b/src/main/java/lingtao/net/service/PriceService.java new file mode 100644 index 0000000..ee8b093 --- /dev/null +++ b/src/main/java/lingtao/net/service/PriceService.java @@ -0,0 +1,575 @@ +package lingtao.net.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lingtao.net.bean.Product; +import lingtao.net.vo.PricingListVo; +import lingtao.net.vo.ProductVo; +import lingtao.net.vo.ProvidePrice; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.math.BigDecimal; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +@Service +public class PriceService { + + public PricingListVo getAddressPrice(Product product, List proList) { + + Province province = parseAddress(product.getAddress()); + if (province == null) { + return new PricingListVo(100, "无效地址。"); + } + String plantName = product.getPlantName(); + if ("领鸿".equals(plantName) || "欣海信".equals(plantName)) { + List lyst = JSONObject.parseArray(ly_st, ProvincePriceVo.class); + List lyyt = JSONObject.parseArray(ly_yt, ProvincePriceVo.class); + List prices = getProvincePrice(lyst, province.province); + if (prices != null && prices.size() > 0) { + double firstPrice = StringtoDouble(prices.get(4).toString()); + double secPrice = StringtoDouble(prices.get(5).toString()); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double finalePrice = 0; + if (weight <= 0.5) { + finalePrice = StringtoDouble(prices.get(0).toString()); + } else if (weight <= 1) { + finalePrice = StringtoDouble(prices.get(1).toString()); + } else if (weight <= 2) { + finalePrice = StringtoDouble(prices.get(2).toString()); + } else if (weight <= 3) { + finalePrice = StringtoDouble(prices.get(3).toString()); + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + productVo.getProvidePrices().add(new ProvidePrice("申通快递", finalePrice)); + } + } + prices = getProvincePrice(lyyt, province.province); + if (prices != null && prices.size() > 0) { + double firstPrice = StringtoDouble(prices.get(5).toString()); + double secPrice = StringtoDouble(prices.get(6).toString()); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double finalePrice = 0; + if (weight <= 0.3 && StringtoDouble(prices.get(0).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(0).toString()); + } else if (weight <= 0.5 && StringtoDouble(prices.get(1).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(1).toString()); + } else if (weight <= 1 && StringtoDouble(prices.get(2).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(2).toString()); + } else if (weight <= 2 && StringtoDouble(prices.get(3).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(3).toString()); + } else if (weight <= 3 && StringtoDouble(prices.get(4).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(4).toString()); + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + productVo.getProvidePrices().add(new ProvidePrice("圆通快递", finalePrice)); + } + } + + } + if ("艾印".equals(plantName) || "即客".equals(plantName)) { + List list17 = Arrays.asList("新疆", "西藏", "甘肃", "宁夏", "青海"); + List list8 = Arrays.asList("内蒙古"); + double price = 0; + if (isInAddress(list17, province.getProvince())) { + price = 17; + } else if (isInAddress(list8, province.getProvince())) { + price = 8; + } else { + price = 3.5; + if ("即客".equals(plantName)) { + price = 4; + } + } + for (ProductVo productVo : proList) { + productVo.getProvidePrices().add(new ProvidePrice("EMS", price)); + } + } + + if ("彩印通".equals(plantName)) { + List cytzt = JSONObject.parseArray(cyt_zt, ProvincePriceVo.class); + List cytyt = JSONObject.parseArray(cyt_yt, ProvincePriceVo.class); + List sfsome = JSONObject.parseArray(cyt_sf_some, ProvincePriceVo2.class); + List sfmorning = JSONObject.parseArray(cyt_sf_morning, ProvincePriceVo2.class); + List sfnextDay = JSONObject.parseArray(cyt_sf_nextDay, ProvincePriceVo2.class); + List sftowDay = JSONObject.parseArray(cyt_sf_towDay, ProvincePriceVo2.class); + + calculateAndAddPrices(cytzt, "中通速递", province, proList, false); + calculateAndAddPrices(cytyt, "圆通速递", province, proList, false); + calculateAndAddPrices2(sfsome, "顺丰今日达", province, proList, false); + calculateAndAddPrices2(sfmorning, "顺丰次晨达", province, proList, false); + calculateAndAddPrices2(sfnextDay, "顺丰次日达", province, proList, false); + calculateAndAddPrices2(sftowDay, "顺丰隔日达", province, proList, true); + + } + if ("鸿晟".equals(plantName)) { + for (ProductVo productVo : proList) { + productVo.getProvidePrices().add(new ProvidePrice("Other", 3.5)); + } + double price = 0; + List list12 = Arrays.asList("浙江", "江苏", "上海", "安徽"); + List list16 = Arrays.asList("福建"); + if (isInAddress(list12, province.getProvince())) { + price = 12; + } else if (isInAddress(list16, province.getProvince())) { + price = 16; + } else { + price = 23; + } + for (ProductVo productVo : proList) { + productVo.getProvidePrices().add(new ProvidePrice("SF", price)); + } + } + if ("驰远".equals(plantName)) { + Map>> sf_bk = (Map>>) JSON.parse(cy_sf_bk); + Map>> sf_tk = (Map>>) JSON.parse(cy_sf_tk); + List yt_xiao = JSONObject.parseArray(cy_yt_xiao, ProvincePriceVo.class); + List yt_sd = JSONObject.parseArray(cy_yt_sd, ProvincePriceVo.class); + List ems = JSONObject.parseArray(cy_ems, ProvincePriceVo.class); + + String priceString = priceKey(sf_bk, province); + if (!StringUtils.isEmpty(priceString)) { + double firstPrice = StringtoDouble(priceString.split("_")[1]); + double secPrice = StringtoDouble(priceString.split("_")[2]); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double secWeightPrice = 0.0; + if (weight > 1) { + secWeightPrice = Math.ceil(weight - 1.0) * secPrice; + } + productVo.getProvidePrices().add(new ProvidePrice("顺丰标快", firstPrice + secWeightPrice)); + } + } + priceString = priceKey(sf_tk, province); + if (!StringUtils.isEmpty(priceString)) { + double firstPrice = StringtoDouble(priceString.split("_")[1]); + double secPrice = StringtoDouble(priceString.split("_")[2]); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double secWeightPrice = 0.0; + if (weight > 1) { + secWeightPrice = Math.ceil(weight - 1.0) * secPrice; + } + productVo.getProvidePrices().add(new ProvidePrice("顺丰特快", firstPrice + secWeightPrice)); + } + } + List prices = getProvincePrice(yt_xiao, province.province); + if (prices != null && prices.size() > 0) { + double firstPrice = StringtoDouble(prices.get(4).toString()); + double secPrice = StringtoDouble(prices.get(5).toString()); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double finalePrice = 0; + if (weight <= 0.5) { + finalePrice = StringtoDouble(prices.get(0).toString()); + } else if (weight <= 1) { + finalePrice = StringtoDouble(prices.get(1).toString()); + } else if (weight <= 2) { + finalePrice = StringtoDouble(prices.get(2).toString()); + } else if (weight <= 3) { + finalePrice = StringtoDouble(prices.get(3).toString()); + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + productVo.getProvidePrices().add(new ProvidePrice("圆通快递", finalePrice)); + } + } + + prices = getProvincePrice(yt_sd, province.province); + if (prices != null && prices.size() > 0) { + double firstPrice = StringtoDouble(prices.get(0).toString()); + double secPrice = StringtoDouble(prices.get(1).toString()); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double finalePrice = 0; + + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + productVo.getProvidePrices().add(new ProvidePrice("圆通速递", finalePrice)); + } + } + + prices = getProvincePrice(ems, province.province); + if (prices != null && prices.size() > 0) { + double firstPrice = StringtoDouble(prices.get(4).toString()); + double secPrice = StringtoDouble(prices.get(5).toString()); + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + + double finalePrice = 0; + if (weight <= 0.5 && StringtoDouble(prices.get(0).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(0).toString()); + } else if (weight <= 1 && StringtoDouble(prices.get(1).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(1).toString()); + } else if (weight <= 2 && StringtoDouble(prices.get(2).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(2).toString()); + } else if (weight <= 3 && StringtoDouble(prices.get(3).toString()) != 0) { + finalePrice = StringtoDouble(prices.get(3).toString()); + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + productVo.getProvidePrices().add(new ProvidePrice("邮政快递", finalePrice)); + } + } + + } + return new PricingListVo(proList); + } + + private static Double StringtoDouble(String str) { + try { + return new BigDecimal(str).doubleValue(); + } catch (Exception e) { + return 0.0; + } + } + + // 定义一个通用方法来处理价格计算逻辑 + private void calculateAndAddPrices(List priceData, String courierName, Province province, List proList, boolean hasThirdPrice) { + List prices = getProvincePrice(priceData, province.province); + List nofirst = Arrays.asList("内蒙古", "西藏", "新疆", "香港", "澳门", "台湾"); + if (prices == null || prices.size() < (hasThirdPrice ? 3 : 2)) { + return; // 如果价格数据不足,则直接返回 + } + try { + double firstPrice = StringtoDouble(prices.get(0).toString()); + double secPrice = StringtoDouble(prices.get(1).toString()); + double thrPrice = hasThirdPrice && prices.size() > 2 ? StringtoDouble(prices.get(2).toString()) : 0; + + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double finalePrice = 0; + + if (courierName.equals("中通速递") || courierName.equals("圆通速递")) { + if (weight <= 3 && !isInAddress(nofirst, province.getProvince())) { + finalePrice = firstPrice; + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + } else { + if (hasThirdPrice && weight > 30) { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * thrPrice; + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + } + + productVo.getProvidePrices().add(new ProvidePrice(courierName, finalePrice)); + } + } catch (Exception e) { + // 记录日志或采取其他措施处理异常 + System.err.println("Error parsing price data: " + e.getMessage()); + } + } + + private void calculateAndAddPrices2(List priceData, String courierName, Province province, List proList, boolean hasThirdPrice) { + List prices = getProvincePrice2(priceData, province); + List nofirst = Arrays.asList("内蒙古", "西藏", "新疆", "香港", "澳门", "台湾"); + if (prices == null || prices.size() < (hasThirdPrice ? 3 : 2)) { + return; // 如果价格数据不足,则直接返回 + } + try { + double firstPrice = StringtoDouble(prices.get(0).toString()); + double secPrice = StringtoDouble(prices.get(1).toString()); + double thrPrice = hasThirdPrice && prices.size() > 2 ? StringtoDouble(prices.get(2).toString()) : 0; + + for (ProductVo productVo : proList) { + double weight = StringtoDouble(productVo.getWeight()); + double finalePrice = 0; + + if (courierName.equals("中通速递") || courierName.equals("圆通速递")) { + if (weight <= 3 && !isInAddress(nofirst, province.getProvince())) { + finalePrice = firstPrice; + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + } else { + if (hasThirdPrice && weight > 30) { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * thrPrice; + } else { + finalePrice = firstPrice + Math.ceil(weight - 1.0) * secPrice; + } + } + + productVo.getProvidePrices().add(new ProvidePrice(courierName, finalePrice)); + } + } catch (Exception e) { + // 记录日志或采取其他措施处理异常 + System.err.println("Error parsing price data: " + e.getMessage()); + } + } + + private static List getProvincePrice2(List list, Province province) { + List prices = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + if (isInAddress(Arrays.asList(list.get(i).getProvince()), province.getProvince())) { + List cities = list.get(i).getCities(); + if (cities.size() == 0 || isInAddress(cities, province.getCity())) { + prices = list.get(i).getPrices(); + } else if (list.get(i).getOtherPrices().size() > 0) { + prices = list.get(i).getOtherPrices(); + } + } + } + return prices; + } + + private static List getProvincePrice(List list, String provinceName) { + List prices = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + if (isInAddress(list.get(i).getRegions(), provinceName)) { + prices = list.get(i).getPrice(); + } + } + return prices; + } + + /** + * 根据省份信息查找价格键 + * 该方法通过遍历一个复杂的映射结构来查找与给定省份信息相对应的价格键 + * 它首先遍历外层映射,然后遍历内层映射中的每个省份列表,检查是否有匹配的省份和城市 + * + * @param map 一个映射,其键是价格键,值是另一个映射;内层映射的键是省份名称,值是城市列表 + * @param province 省份对象,包含需要查找的省份和城市信息 + * @return 如果找到匹配的省份和城市,则返回对应的价格键;否则返回空字符串 + */ + private static String priceKey(Map>> map, Province province) { + // 初始化结果字符串 + String result = ""; + // 获取外层映射的条目迭代器 + Iterator>>> iterator = map.entrySet().iterator(); + // 遍历外层映射 + while (iterator.hasNext()) { + // 获取当前外层映射条目 + Map.Entry>> entry = iterator.next(); + // 获取内层映射 + Map> value = entry.getValue(); + // 获取内层映射的条目迭代器 + Iterator>> iteratorValue = value.entrySet().iterator(); + // 遍历内层映射 + while (iteratorValue.hasNext()) { + // 获取当前内层映射条目 + Map.Entry> provinces = iteratorValue.next(); + // 获取省份名称 + String provincesName = provinces.getKey(); + // 检查省份名称是否与给定的省份信息匹配 + if (isInAddress(Arrays.asList(provincesName), province.getProvince())) { + // 获取城市列表 + List citys = provinces.getValue(); + // 如果城市列表为空,则直接返回当前的价格键 + if (citys.size() == 0) { + result = entry.getKey(); + return result; + } else { + // 如果城市列表不为空,进一步检查城市是否匹配 + if (isInAddress(citys, province.getCity())) { + result = entry.getKey(); + return result; + } + } + } + } + } + // 如果没有找到匹配的省份和城市,返回空字符串 + return result; + } + + //驰远顺丰标快 + private static String cy_sf_bk = "{\"price_12_1\":{\"福建省\":[\"龙岩\"]},\"price_13_2\":{\"福建省\":[\"南平\",\"莆田\",\"福州\",\"泉州\",\"漳州\",\"厦门\",\"三明\",\"宁德\"]},\"price_16_6\":{\"广东省\":[\"河源\",\"韶关\",\"汕头\",\"清远\",\"深圳\",\"广州\",\"中山\",\"惠州\",\"揭阳\",\"东莞\",\"佛山\",\"汕尾\",\"潮州\",\"梅州\"],\"浙江省\":[\"台州\",\"温州\"]},\"price_18_5\":{\"北京市\":[],\"上海市\":[],\"天津市\":[],\"河北省\":[],\"河南省\":[],\"山东省\":[],\"浙江省\":[\"湖州\",\"宁波\",\"舟山\",\"丽水\",\"金华\",\"嘉兴\",\"衢州\",\"绍兴\",\"杭州\"],\"江西省\":[]},\"price_18_6\":{\"广西壮族自治区\":[\"河池\",\"防城港\",\"百色\",\"梧州/贺州\",\"钦州\",\"北海\",\"柳州\",\"来宾\",\"桂林\",\"玉林\",\"崇左\",\"贵港\",\"南宁\"],\"海南省\":[],\"重庆市\":[],\"辽宁省\":[],\"江苏省\":[],\"湖北省\":[],\"四川省\":[],\"陕西省\":[],\"贵州省\":[],\"云南省\":[],\"山西省\":[],\"内蒙古自治区\":[\"包头\",\"通辽\",\"呼和浩特\",\"乌海\",\"锡林郭勒盟\",\"赤峰\",\"鄂尔多斯\",\"乌兰察布\",\"阿拉善盟\",\"巴彦淖尔\"],\"安徽省\":[],\"广东省\":[\"江门\",\"茂名\",\"云浮\",\"湛江\",\"阳江\",\"珠海\",\"肇庆\"],\"湖南省\":[],\"甘肃省\":[],\"宁夏回族自治区\":[],\"青海省\":[\"海南藏族自治州\",\"果洛藏族自治州\",\"海东\",\"黄南藏族自治州\",\"海西蒙古族藏族自治州\",\"格尔木\",\"海北藏族自治州\",\"西宁\"]},\"price_18_9\":{\"吉林省\":[],\"黑龙江省\":[],\"内蒙古自治区\":[\"呼伦贝尔\",\"兴安盟\"]},\"price_20_10\":{\"新疆维吾尔自治区\":[]},\"price_21_12\":{\"青海省\":[\"玉树藏族自治州\"]},\"price_25_19\":{\"西藏自治区\":[\"拉萨\",\"日喀则\",\"那曲\",\"山南\",\"林芝\"]},\"price_26_21\":{\"西藏自治区\":[\"昌都\"]}}"; + //驰远顺丰特快 + private static String cy_sf_tk = "{\"price_18_8\":{\"广东省\":[\"汕头\",\"揭阳\",\"汕尾\",\"潮州\"]},\"price_20_8\":{\"广东省\":[\"河源\",\"茂名\",\"韶关\",\"清远\",\"深圳\",\"珠海\",\"广州\",\"肇庆\",\"中山\",\"江门\",\"云浮\",\"惠州\",\"湛江\",\"东莞\",\"阳江\",\"佛山\"],\"浙江省\":[\"宁波\",\"舟山\"]},\"price_22_10\":{\"上海市\":[],\"江苏省\":[],\"浙江省\":[\"湖州\",\"丽水\",\"金华\",\"嘉兴\",\"衢州\",\"绍兴\",\"杭州\"]},\"price_22_8\":{\"江西省\":[]},\"price_23_10\":{\"北京市\":[],\"天津市\":[],\"湖北省\":[],\"河北省\":[],\"河南省\":[],\"山东省\":[],\"安徽省\":[],\"湖南省\":[],\"广西壮族自治区\":[],\"海南省\":[]},\"price_23_13\":{\"重庆市\":[],\"辽宁省\":[],\"四川省\":[],\"陕西省\":[],\"贵州省\":[],\"云南省\":[],\"山西省\":[],\"甘肃省\":[],\"宁夏回族自治区\":[]},\"price_23_14\":{\"内蒙古自治区\":[\"包头\",\"通辽\",\"呼和浩特\",\"乌海\",\"锡林郭勒盟\",\"赤峰\",\"鄂尔多斯\",\"乌兰察布\",\"阿拉善盟\",\"巴彦淖尔\"],\"青海省\":[\"海南藏族自治州\",\"果洛藏族自治州\",\"海东\",\"黄南藏族自治州\",\"海西蒙古族藏族自治州\",\"格尔木\",\"玉树藏族自治州\",\"海北藏族自治州\",\"西宁\"]},\"price_23_18\":{\"吉林省\":[],\"黑龙江省\":[],\"内蒙古自治区\":[\"呼伦贝尔\",\"兴安盟\"]},\"price_26_21\":{\"西藏自治区\":[\"拉萨\",\"日喀则\",\"那曲\",\"山南\",\"林芝\",\"昌都\"],\"新疆维吾尔自治区\":[\"阿勒泰地区\",\"克孜勒苏柯尔克孜自治州\",\"哈密地区\",\"铁门关\",\"双河\",\"巴音郭楞蒙古自治州\",\"博尔塔拉蒙古自治州\",\"阿克苏地区\",\"昌吉回族自治州\",\"克拉玛依\",\"乌鲁木齐\",\"石河子\",\"喀什地区\",\"奎屯\",\"吐鲁番地区\",\"伊犁哈萨克自治州\",\"塔城地区\",\"和田地区\"]},\"price_20_10\":{\"新疆维吾尔自治区\":[\"乌鲁木齐\",\"石河子\",\"喀什地区\",\"奎屯\",\"吐鲁番地区\",\"伊犁哈萨克自治州\",\"塔城地区\",\"和田地区\"]},\"price_21_12\":{\"青海省\":[\"玉树藏族自治州\"]},\"price_25_19\":{\"西藏自治区\":[\"拉萨\",\"日喀则\",\"那曲\",\"山南\",\"林芝\"]}}"; + //驰远圆通快递 + private static String cy_yt_xiao = "[{\"price\":[2.7,3.2,3.7,4.7,4.5,0.8],\"regions\":[\"省内\"]},{\"price\":[2.7,3.2,3.7,4.7,5.0,1.2],\"regions\":[\"江苏\",\"浙江\",\"安徽\",\"广东\",\"江西\",\"湖南\"]},{\"price\":[3.7,4.2,4.7,5.7,7.0,1.4],\"regions\":[\"上海\"]},{\"price\":[2.7,3.2,3.7,4.7,5.5,1.8],\"regions\":[\"广西\",\"湖北\",\"河南省\",\"河北省\",\"天津市\",\"山西\"]},{\"price\":[2.7,3.2,3.7,4.7,6.0,2.3],\"regions\":[\"四川省\",\"重庆市\",\"云南\",\"贵州\"]},{\"price\":[2.7,3.2,3.7,4.7,6.0,1.8],\"regions\":[\"山东\"]},{\"price\":[2.7,3.2,3.7,4.7,6.0,2.1],\"regions\":[\"陕西省\"]},{\"price\":[4.2,4.7,5.2,6.2,8.0,2.0],\"regions\":[\"北京\"]},{\"price\":[8.3,8.3,14.3,20.3,8.0,6.0],\"regions\":[\"甘肃省\",\"宁夏\"]},{\"price\":[8.3,8.3,16.3,24.3,8.0,8.0],\"regions\":[\"青海省\"]},{\"price\":[10.3,10.3,18.3,26.3,10.0,8.0],\"regions\":[\"内蒙古\"]},{\"price\":[18.3,18.3,33.3,48.3,18.0,15.0],\"regions\":[\"新疆\"]},{\"price\":[22.3,22.3,40.3,58.3,22.0,18.0],\"regions\":[\"西藏\"]},{\"price\":[2.7,3.2,3.7,4.7,7.0,3.2],\"regions\":[\"黑龙江\",\"吉林\",\"辽宁\"]}]"; + //驰远邮政快递 + private static String cy_ems = "[{\"price\":[2.8,3.4,4.0,6.0,6.0,2.0],\"regions\":[\"福建\"]},{\"price\":[2.8,3.4,4.0,6.0,8.0,2.0],\"regions\":[\"江西省\",\"浙江省\",\"湖北省\",\"湖南省\",\"上海市\",\"广东省\",\"江苏省\",\"安徽省\"]},{\"price\":[2.8,3.4,6.0,8.0,10.0,3.0],\"regions\":[\"河南省\",\"贵州省\",\"山东省\",\"广西\",\"河北省\",\"陕西省\",\"海南省\",\"山西省\",\"天津市\",\"重庆市\",\"四川省\"]},{\"price\":[3.5,5.0,7.0,20.0,14.0,4.0],\"regions\":[\"云南省\",\"甘肃省\",\"内蒙\",\"辽宁省\",\"吉林省\",\"宁夏\",\"黑龙江省\"]},{\"price\":[8.0,0,0,0,10.0,3.0],\"regions\":[\"北京\"]},{\"price\":[12.0,0,0,0,16.0,12.0],\"regions\":[\"青海省\",\"新疆\",\"西藏\"]}]"; + //驰远圆通速递(重货) + private static String cy_yt_sd = "[{\"price\":[4.0,0.8],\"regions\":[\"福建\"]},{\"price\":[4.0,1.0],\"regions\":[\"广东\"]},{\"price\":[5.0,1.3],\"regions\":[\"上海\"]},{\"price\":[4.5,1.1],\"regions\":[\"浙江\",\"江西\",\"江苏\",\"安徽\",\"湖南\"]},{\"price\":[4.5,1.4],\"regions\":[\"湖北\",\"山东\",\"河南\",\"河北\",\"天津\"]},{\"price\":[5.5,1.7],\"regions\":[\"北京\"]},{\"price\":[5.5,1.6],\"regions\":[\"陕西\"]},{\"price\":[5.5,1.4],\"regions\":[\"广西\",\"山西\"]},{\"price\":[5.5,1.9],\"regions\":[\"贵州\",\"重庆\",\"云南\",\"四川\",\"海南\"]},{\"price\":[5.5,2.5],\"regions\":[\"辽宁\",\"黑龙江\",\"吉林\"]},{\"price\":[12.0,6.6],\"regions\":[\"甘肃\",\"宁夏\",\"青海\"]},{\"price\":[13.0,7.6],\"regions\":[\"内蒙古\"]},{\"price\":[20.0,15.6],\"regions\":[\"西藏\",\"新疆\"]}]"; + + //彩印通中通 + private static String cyt_zt = "[{\"price\":[3.5,1],\"regions\":[\"广东\"]},{\"price\":[3.5,2],\"regions\":[\"浙江\",\"湖南\",\"福建\",\"江苏\",\"湖北\",\"广西\",\"江西\",\"安徽\"]},{\"price\":[3.5,3],\"regions\":[\"天津\",\"河南\",\"河北\",\"山东\",\"四川\",\"重庆\",\"贵州\",\"海南\",\"云南\"]},{\"price\":[3.5,4],\"regions\":[\"山西\",\"陕西\",\"黑龙江\",\"吉林\",\"辽宁\"]},{\"price\":[6,2],\"regions\":[\"上海\"]},{\"price\":[4.5,3],\"regions\":[\"北京\"]},{\"price\":[6,6],\"regions\":[\"甘肃\",\"宁夏\",\"青海\",\"内蒙古\"]},{\"price\":[20,20],\"regions\":[\"澳门\",\"香港\",\"台湾\"]},{\"price\":[10,8],\"regions\":[\"新疆\",\"西藏\"]}]"; + //彩印通圆通 + private static String cyt_yt = "[{\"price\":[2.6,1],\"regions\":[\"广东\"]},{\"price\":[2.6,2],\"regions\":[\"江苏省\",\"浙江省\",\"安徽省\",\"上海\",\"广西壮族自治区\",\"福建省\",\"江西省\",\"湖南省\",\"湖北省\"]},{\"price\":[2.6,3],\"regions\":[\"贵州省\",\"云南省\",\"海南省\",\"河南省\",\"山东省\",\"四川省\",\"重庆市\",\"北京市\",\"河北省\",\"天津市\"]},{\"price\":[2.6,4],\"regions\":[\"黑龙江省\",\"辽宁省\",\"吉林省\",\"山西省\",\"陕西省\"]},{\"price\":[2.6,5],\"regions\":[\"宁夏回族自治区\",\"青海省\",\"甘肃省\"]},{\"price\":[6,6],\"regions\":[\"内蒙古自治区\"]},{\"price\":[10,8],\"regions\":[\"新疆维吾尔自治区\",\"西藏自治区\"]},{\"price\":[30,15],\"regions\":[\"台湾\",\"香港\",\"澳门\"]}]\n"; + //彩印通顺丰今日达 + private static String cyt_sf_some = "[{\"province\":\"广东\",\"cities\":[\"佛山\"],\"price\":[11,1]},{\"province\":\"广东\",\"cities\":[\"广州\",\"深圳\"],\"price\":[16,2]},{\"province\":\"广东\",\"cities\":[\"江门\",\"中山\",\"东莞\"],\"price\":[15,2]}]"; + //彩印通顺丰次晨达 + private static String cyt_sf_morning = "[{\"province\":\"广东\",\"cities\":[\"佛山\",\"肇庆\",\"云浮\"],\"price\":[11,1]},{\"province\":\"广东\",\"cities\":[\"广州\",\"深圳\"],\"price\":[13,2]},{\"province\":\"广东\",\"cities\":[\"江门\",\"中山\",\"东莞\",\"惠州\",\"珠海\",\"肇庆\",\"清远\",\"云浮\",\"阳江\",\"揭阳\",\"茂名\",\"韶关\",\"梅州\",\"汕头\",\"湛江\",\"河源\",\"潮州\",\"汕尾\"],\"price\":[12,2]},{\"province\":\"广西\",\"cities\":[\"贺州\",\"梧州\"],\"price\":[16,6]},{\"province\":\"福建\",\"cities\":[\"泉州\"],\"price\":[20,8]},{\"province\":\"江苏\",\"cities\":[\"南京\",\"无锡\",\"镇江\",\"苏州\",\"常州\"],\"price\":[25,13]},{\"province\":\"上海\",\"cities\":[\"上海\"],\"price\":[25,13]},{\"province\":\"浙江\",\"cities\":[\"杭州\",\"湖州\",\"嘉兴\",\"宁波\",\"绍兴\",\"台州\",\"温州\"],\"price\":[25,13]},{\"province\":\"北京\",\"cities\":[\"北京\"],\"price\":[25,14]}]"; + //彩印通次日达 + private static String cyt_sf_nextDay = "[{\"province\":\"广东\",\"cities\":[\"阳江\",\"揭阳\",\"茂名\",\"韶关\",\"梅州\",\"汕头\",\"湛江\",\"河源\",\"潮州\",\"汕尾\"],\"prices\":[22,8],\"otherPrices\":[0,0]},{\"province\":\"福建\",\"cities\":[],\"prices\":[20,8],\"otherPrices\":[0,0]},{\"province\":\"广西\",\"cities\":[\"贺州\",\"梧州\"],\"prices\":[16,6],\"otherPrices\":[22,8]},{\"province\":\"江西\",\"cities\":[],\"prices\":[22,8],\"otherPrices\":[0,0]},{\"province\":\"湖南\",\"cities\":[],\"prices\":[22,8],\"otherPrices\":[0,0]},{\"province\":\"海南\",\"cities\":[],\"prices\":[22,8],\"otherPrices\":[0,0]},{\"province\":\"贵州\",\"cities\":[],\"prices\":[23,12],\"otherPrices\":[0,0]},{\"province\":\"安徽\",\"cities\":[],\"prices\":[23,12],\"otherPrices\":[0,0]},{\"province\":\"湖北\",\"cities\":[],\"prices\":[23,12],\"otherPrices\":[0,0]},{\"province\":\"江苏\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"上海\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"浙江\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"重庆\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"四川\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"云南\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"河南\",\"cities\":[],\"prices\":[23,13],\"otherPrices\":[0,0]},{\"province\":\"北京\",\"cities\":[],\"prices\":[23,14],\"otherPrices\":[0,0]},{\"province\":\"天津\",\"cities\":[],\"prices\":[23,14],\"otherPrices\":[0,0]},{\"province\":\"辽宁\",\"cities\":[],\"prices\":[23,14],\"otherPrices\":[0,0]},{\"province\":\"陕西\",\"cities\":[],\"prices\":[23,14],\"otherPrices\":[0,0]},{\"province\":\"河北\",\"cities\":[],\"prices\":[23,14],\"otherPrices\":[0,0]},{\"province\":\"山东\",\"cities\":[],\"prices\":[23,14],\"otherPrices\":[0,0]},{\"province\":\"甘肃\",\"cities\":[],\"prices\":[23,18],\"otherPrices\":[0,0]},{\"province\":\"宁夏\",\"cities\":[],\"prices\":[23,18],\"otherPrices\":[0,0]},{\"province\":\"青海\",\"cities\":[],\"prices\":[23,18],\"otherPrices\":[0,0]},{\"province\":\"内蒙古\",\"cities\":[\"呼伦贝尔\",\"兴安盟\"],\"prices\":[25,20],\"otherPrices\":[23,18]},{\"province\":\"吉林\",\"cities\":[],\"prices\":[25,20],\"otherPrices\":[0,0]},{\"province\":\"黑龙江\",\"cities\":[],\"prices\":[25,20],\"otherPrices\":[0,0]},{\"province\":\"新疆\",\"cities\":[],\"prices\":[28,25],\"otherPrices\":[0,0]},{\"province\":\"西藏\",\"cities\":[],\"prices\":[28,25],\"otherPrices\":[0,0]}]"; + //彩印通隔日达 + private static String cyt_sf_towDay = "[{\"province\":\"江西\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"湖南\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"海南\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"贵州\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"安徽\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"湖北\",\"cities\":[],\"prices\":[18,8,8],\"otherPrices\":[0,0,0]},{\"province\":\"江苏\",\"cities\":[],\"prices\":[18,9,9],\"otherPrices\":[0,0,0]},{\"province\":\"上海\",\"cities\":[],\"prices\":[18,9,9],\"otherPrices\":[0,0,0]},{\"province\":\"浙江\",\"cities\":[],\"prices\":[18,9,9],\"otherPrices\":[0,0,0]},{\"province\":\"重庆\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"四川\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"云南\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"河南\",\"cities\":[],\"prices\":[18,6,6],\"otherPrices\":[0,0,0]},{\"province\":\"北京\",\"cities\":[],\"prices\":[18,7,7],\"otherPrices\":[0,0,0]},{\"province\":\"天津\",\"cities\":[],\"prices\":[18,7,7],\"otherPrices\":[0,0,0]},{\"province\":\"辽宁\",\"cities\":[],\"prices\":[18,7,7],\"otherPrices\":[0,0,0]},{\"province\":\"陕西\",\"cities\":[],\"prices\":[18,7,7],\"otherPrices\":[0,0,0]},{\"province\":\"河北\",\"cities\":[],\"prices\":[18,7,7],\"otherPrices\":[0,0,0]},{\"province\":\"山东\",\"cities\":[],\"prices\":[18,7,7],\"otherPrices\":[0,0,0]},{\"province\":\"甘肃\",\"cities\":[],\"prices\":[18,9,9],\"otherPrices\":[0,0,0]},{\"province\":\"宁夏\",\"cities\":[],\"prices\":[18,9,9],\"otherPrices\":[0,0,0]},{\"province\":\"青海\",\"cities\":[],\"prices\":[18,9,9],\"otherPrices\":[0,0,0]},{\"province\":\"内蒙古\",\"cities\":[\"呼伦贝尔\",\"兴安盟\"],\"prices\":[20,10,10],\"otherPrices\":[18,9,9]},{\"province\":\"吉林\",\"cities\":[],\"prices\":[20,10,10],\"otherPrices\":[0,0,0]},{\"province\":\"黑龙江\",\"cities\":[],\"prices\":[20,10,10],\"otherPrices\":[0,0,0]},{\"province\":\"新疆\",\"cities\":[],\"prices\":[22,12,12],\"otherPrices\":[0,0,0]},{\"province\":\"西藏\",\"cities\":[],\"prices\":[0,0,0],\"otherPrices\":[0,0,0]}]"; + //龙岩圆通 + private static String ly_yt = "[{\"price\":[1.9,2.2,2.9,3.5,4.5,4.9,0.6],\"regions\":[\"福建\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,4.9,1.2],\"regions\":[\"广东\",\"安徽\",\"浙江\",\"江苏\",\"江西\",\"湖北\",\"湖南\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,4.9,1.4],\"regions\":[\"上海\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,4.9,1.9],\"regions\":[\"北京\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,4.9,1.6],\"regions\":[\"河南\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,5.9,1.6],\"regions\":[\"山东\",\"天津\",\"河北\",\"陕西\",\"广西\",\"山西\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,5.9,2.1],\"regions\":[\"海南\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,5.9,2.0],\"regions\":[\"四川\",\"贵州\",\"云南\",\"重庆\"]},{\"price\":[1.9,2.2,2.9,3.5,4.5,6.9,2.5],\"regions\":[\"黑龙江\",\"吉林\",\"辽宁\"]},{\"price\":[0,0,0,0,0,8.4,6.0],\"regions\":[\"甘肃\",\"宁夏\",\"青海\"]},{\"price\":[0,0,0,0,0,9.4,7.0],\"regions\":[\"内蒙古\"]},{\"price\":[0,0,0,0,0,15.4,12.0],\"regions\":[\"新疆\"]},{\"price\":[0,0,0,0,0,19.4,17.0],\"regions\":[\"西藏\"]}]"; + //龙岩申通 + private static String ly_st = "[{\"price\":[2.4,3.2,3.5,4.5,4.5,0.8],\"regions\":[\"福建\"]},{\"price\":[2.4,3.2,3.5,4.5,4.5,1.2],\"regions\":[\"广东\",\"安徽\",\"浙江\",\"江苏\",\"上海\",\"江西\",\"湖北\",\"湖南\"]},{\"price\":[2.4,3.2,3.5,4.5,5.0,2.0],\"regions\":[\"北京\"]},{\"price\":[2.4,3.2,3.5,4.5,5.0,2.5],\"regions\":[\"河南\",\"山东\",\"陕西\",\"四川\",\"广西\",\"山西\",\"贵州\",\"云南\",\"重庆\"]},{\"price\":[2.4,3.2,3.5,4.5,5.0,2.0],\"regions\":[\"天津\",\"河北\",\"海南\"]},{\"price\":[2.4,3.2,3.5,4.5,5.5,4.0],\"regions\":[\"黑龙江\",\"吉林\",\"辽宁\"]},{\"price\":[10.0,10.0,20.0,30.0,10.0,10.0],\"regions\":[\"甘肃\",\"宁夏\",\"青海\",\"内蒙古\"]},{\"price\":[15.0,16.0,30.0,45.0,18.0,16.0],\"regions\":[\"新疆\",\"西藏\"]}]"; + + private static Boolean isInAddress(List list, String address) { + Boolean result = false; + for (int i = 0; i < list.size(); i++) { + if (address.contains(list.get(i))) { + result = true; + break; + } + } + return result; + } + + private static class ProvincePriceVo2 { + private List prices = new ArrayList<>(); + private List cities = new ArrayList<>(); + private List otherPrices = new ArrayList<>(); + private String province = ""; + + public List getPrices() { + return prices; + } + + public List getCities() { + return cities; + } + + public List getOtherPrices() { + return otherPrices; + } + + public String getProvince() { + return province; + } + + public void setPrices(List prices) { + this.prices = prices; + } + + public void setCities(List cities) { + this.cities = cities; + } + + public void setOtherPrices(List otherPrices) { + this.otherPrices = otherPrices; + } + + public void setProvince(String province) { + this.province = province; + } + + + } + + private static class ProvincePriceVo { + private List price = new ArrayList<>(); + private List regions = new ArrayList<>(); + private List otherPrices = new ArrayList<>(); + + public List getPrice() { + return price; + } + + public List getRegions() { + return regions; + } + + public List getOtherPrices() { + return otherPrices; + } + + public void setPrice(List price) { + this.price = price; + } + + public void setRegions(List regions) { + this.regions = regions; + } + + public void setOtherPrices(List otherPrices) { + this.otherPrices = otherPrices; + } + + } + + private static class Province { + private String province; + private String city; + private String district; + private String detailAddress; + + public Province(String province, String city, String district, String detailAddress) { + this.province = province; + this.city = city; + this.district = district; + this.detailAddress = detailAddress; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + public String getDetailAddress() { + return detailAddress; + } + + public void setDetailAddress(String detailAddress) { + this.detailAddress = detailAddress; + } + } + + private static Province parseAddress(String address) { + if (StringUtils.isEmpty(address)) { + return null; + } + String province = ""; + String city = ""; + String district = ""; + String detailAddress = ""; + // 匹配省级(省、自治区、直辖市) + String provinceRegex = "(?[^省]+省|.+自治区|北京市|上海市|天津市|重庆市)"; + Matcher provinceMatcher = Pattern.compile(provinceRegex).matcher(address); + if (provinceMatcher.find()) { + province = provinceMatcher.group("province"); + String remaining = address.substring(province.length()); + + // 匹配市级(市、自治州、地区、盟) + String cityRegex = "(?[^市]+市|.+自治州|.+地区|.+盟|市辖区)"; + Matcher cityMatcher = Pattern.compile(cityRegex).matcher(remaining); + if (cityMatcher.find()) { + city = cityMatcher.group("city"); + String districtPart = remaining.substring(city.length()); + + // 匹配区级(区、县、市、旗) + String districtRegex = "(?[^区]+区|.+县|.+市|.+旗)"; + Matcher districtMatcher = Pattern.compile(districtRegex).matcher(districtPart); + if (districtMatcher.find()) { + district = districtMatcher.group("district"); + detailAddress = districtPart.substring(district.length()); + } + } + } + return new Province(province, city, district, detailAddress); + } + +} diff --git a/src/main/java/lingtao/net/service/QuoteLogService.java b/src/main/java/lingtao/net/service/QuoteLogService.java index 4edd691..adeb74b 100644 --- a/src/main/java/lingtao/net/service/QuoteLogService.java +++ b/src/main/java/lingtao/net/service/QuoteLogService.java @@ -25,223 +25,226 @@ import lingtao.net.util.IPUtils; @Service public class QuoteLogService { - @Autowired - private QuoteLogMapper quoteLogMapper; + @Autowired + private QuoteLogMapper quoteLogMapper; - @Autowired - private QuoteDataMapper quoteDataMapper; + @Autowired + private QuoteDataMapper quoteDataMapper; - @Autowired - ProductImgMapper productImgMapper; + @Autowired + ProductImgMapper productImgMapper; - @Autowired - private SysRoleService sysRoleService; + @Autowired + private SysRoleService sysRoleService; - // 列表 - public List quoteLogs(QuoteLog quoteLog) { - quoteLog.setQuoteTimeEnd(new DateFormatUtils().formatEndTime(quoteLog.getQuoteTimeBegin())); - quoteLog.setQuoteTimeBegin(new DateFormatUtils().formatBeginTime(quoteLog.getQuoteTimeBegin())); - return quoteLogMapper.quoteLogs(quoteLog); - } + // 列表 + public List quoteLogs(QuoteLog quoteLog) { + quoteLog.setQuoteTimeEnd(new DateFormatUtils().formatEndTime(quoteLog.getQuoteTimeBegin())); + quoteLog.setQuoteTimeBegin(new DateFormatUtils().formatBeginTime(quoteLog.getQuoteTimeBegin())); + return quoteLogMapper.quoteLogs(quoteLog); + } - // 操作日志 - public String log(Product product, HttpServletRequest request, List proList) { - long startTime, endTime = 0; - startTime = System.currentTimeMillis(); - SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION"); - if (user == null) { - return "登陆失效"; - } - QuoteLog log = new QuoteLog(); - ProductImg productImg = new ProductImg(); + // 操作日志 + public String log(Product product, HttpServletRequest request, List proList) { + long startTime, endTime = 0; + startTime = System.currentTimeMillis(); + SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION"); + if (user == null) { + return "登陆失效"; + } + QuoteLog log = new QuoteLog(); + ProductImg productImg = new ProductImg(); - // product转productImg - BeanUtils.copyProperties(product, productImg); - // 根据value查询label - if ("13".equals(productImg.getProTypeValue()) || "15".equals(productImg.getProTypeValue()) - || "4".equals(productImg.getProTypeValue())) { - productImg.setKind2Value(null); - } - // 优惠券 - if ("4".equals(productImg.getProTypeValue())) { - productImg.setKindValue("0"); - productImg.setKind2Value(product.getKind()); - } - // 合版封套 - if ("6".equals(productImg.getProTypeValue())) { - if (product.getLengthSize() > 0) { - productImg.setKind2Value("0"); - } - } - // 根据value获取label - SysDictProduct label = productImgMapper.getLabel(productImg); + // product转productImg + BeanUtils.copyProperties(product, productImg); + // 根据value查询label + if ("13".equals(productImg.getProTypeValue()) || "15".equals(productImg.getProTypeValue()) + || "4".equals(productImg.getProTypeValue())) { + productImg.setKind2Value(null); + } + // 优惠券 + if ("4".equals(productImg.getProTypeValue())) { + productImg.setKindValue("0"); + productImg.setKind2Value(product.getKind()); + } + // 合版封套 + if ("6".equals(productImg.getProTypeValue())) { + if (product.getLengthSize() > 0) { + productImg.setKind2Value("0"); + } + } + // 根据value获取label + SysDictProduct label = productImgMapper.getLabel(productImg); - if (StringUtils.isEmpty(label)) { - return null; - } - String s = ""; - String remark_judge = ""; - String proTypeLabel = ""; - if ("常用种类".equals(product.getStickerKind())) { - s += "常用种类- "; - } - if ("少数量".equals(product.getStickerKind())) { - s += "少数量- "; - } - if ("专版打印".equals(product.getStickerKind())) { - s += "专版打印- "; - } - if (!StringUtils.isEmpty(label.getProTypeLabel())) { - if ("金属标".equals(label.getProTypeLabel()) && StringUtils.isEmpty(product.getCraftMo())) { - s += "UV转印贴 - "; - proTypeLabel = "UV转印贴"; - } else { - s += label.getProTypeLabel() + " - "; - proTypeLabel = label.getProTypeLabel(); - } - } - if ("少数量".equals(product.getCouponKind())) { - s += product.getProTypeLabel() + " - "; - } - if (!StringUtils.isEmpty(label.getKindLabel())) { - s += label.getKindLabel() + " - "; - } - if (!StringUtils.isEmpty(label.getKind2Label())) { - s += label.getKind2Label() + " - "; - } - if (!StringUtils.isEmpty(product.getKind3Value())) { - if ("0".equals(product.getKind3Value())) { - s += "骑马钉 - "; - } - } - String new_s = s; - new_s += "客户旺旺:" + product.getWangwang() + " - "; - // 产品 - 种类 - remark_judge = new_s; - // 不区分专版打印或者常用,3分钟内都不要 - if (remark_judge.contains("常用种类- ") || remark_judge.contains("专版打印- ")) { - remark_judge = remark_judge.substring(6); - } - // 画册P数 - if (!StringUtils.isEmpty(product.getPcount())) { - s += product.getPcount() + "P - "; - } - if (!StringUtils.isEmpty(product.getSize())) { - s += product.getSize() + " - "; - } - if (!StringUtils.isEmpty(product.getCraftMo())) { - s += product.getCraftMo() + " - "; - } - if (!StringUtils.isEmpty(product.getCraftTang())) { - s += product.getCraftTang() + " - "; - } - if (!StringUtils.isEmpty(product.getAotu())) { - s += product.getAotu() + " - "; - } - if (!StringUtils.isEmpty(product.getYinbai())) { - s += product.getYinbai() + " - "; - } - if (!StringUtils.isEmpty(product.getCraftSheng())) { - s += product.getCraftSheng() + " - "; - } - if (!StringUtils.isEmpty(product.getCraftShua())) { - s += product.getCraftShua() + " - "; - } - if (!StringUtils.isEmpty(product.getCraftBu())) { - s += product.getCraftBu() + " - "; - } - if (!StringUtils.isEmpty(product.getCraftJiao())) { - s += product.getCraftJiao() + " - "; - } + if (StringUtils.isEmpty(label)) { + return null; + } + if (proList.size() == 0) { + return null; + } + String s = ""; + String remark_judge = ""; + String proTypeLabel = ""; + if ("常用种类".equals(product.getStickerKind())) { + s += "常用种类- "; + } + if ("少数量".equals(product.getStickerKind())) { + s += "少数量- "; + } + if ("专版打印".equals(product.getStickerKind())) { + s += "专版打印- "; + } + if (!StringUtils.isEmpty(label.getProTypeLabel())) { + if ("金属标".equals(label.getProTypeLabel()) && StringUtils.isEmpty(product.getCraftMo())) { + s += "UV转印贴 - "; + proTypeLabel = "UV转印贴"; + } else { + s += label.getProTypeLabel() + " - "; + proTypeLabel = label.getProTypeLabel(); + } + } + if ("少数量".equals(product.getCouponKind())) { + s += product.getProTypeLabel() + " - "; + } + if (!StringUtils.isEmpty(label.getKindLabel())) { + s += label.getKindLabel() + " - "; + } + if (!StringUtils.isEmpty(label.getKind2Label())) { + s += label.getKind2Label() + " - "; + } + if (!StringUtils.isEmpty(product.getKind3Value())) { + if ("0".equals(product.getKind3Value())) { + s += "骑马钉 - "; + } + } + String new_s = s; + new_s += "客户旺旺:" + product.getWangwang() + " - "; + // 产品 - 种类 + remark_judge = new_s; + // 不区分专版打印或者常用,3分钟内都不要 + if (remark_judge.contains("常用种类- ") || remark_judge.contains("专版打印- ")) { + remark_judge = remark_judge.substring(6); + } + // 画册P数 + if (!StringUtils.isEmpty(product.getPcount())) { + s += product.getPcount() + "P - "; + } + if (!StringUtils.isEmpty(product.getSize())) { + s += product.getSize() + " - "; + } + if (!StringUtils.isEmpty(product.getCraftMo())) { + s += product.getCraftMo() + " - "; + } + if (!StringUtils.isEmpty(product.getCraftTang())) { + s += product.getCraftTang() + " - "; + } + if (!StringUtils.isEmpty(product.getAotu())) { + s += product.getAotu() + " - "; + } + if (!StringUtils.isEmpty(product.getYinbai())) { + s += product.getYinbai() + " - "; + } + if (!StringUtils.isEmpty(product.getCraftSheng())) { + s += product.getCraftSheng() + " - "; + } + if (!StringUtils.isEmpty(product.getCraftShua())) { + s += product.getCraftShua() + " - "; + } + if (!StringUtils.isEmpty(product.getCraftBu())) { + s += product.getCraftBu() + " - "; + } + if (!StringUtils.isEmpty(product.getCraftJiao())) { + s += product.getCraftJiao() + " - "; + } - if (!StringUtils.isEmpty(product.getCraft())) { - String[] craft = product.getCraft(); - for (int i = 0; i < craft.length; i++) { - if (StringUtils.isEmpty(craft[i])) - continue; - s += craft[i] + " - "; - } - } - if (!StringUtils.isEmpty(product.getNumber())) { - s += product.getNumber() + "款 - "; - } + if (!StringUtils.isEmpty(product.getCraft())) { + String[] craft = product.getCraft(); + for (int i = 0; i < craft.length; i++) { + if (StringUtils.isEmpty(craft[i])) + continue; + s += craft[i] + " - "; + } + } + if (!StringUtils.isEmpty(product.getNumber())) { + s += product.getNumber() + "款 - "; + } - if ("16".equals(product.getProTypeValue())) { - s += product.getCount() + "本 " + proList.get(0).getPrice() + "元 "; - } else { - s += product.getCount() + "个 " + proList.get(0).getPrice() + "元 "; - } + if ("16".equals(product.getProTypeValue())) { + s += product.getCount() + "本 " + proList.get(0).getPrice() + "元 "; + } else { + s += product.getCount() + "个 " + proList.get(0).getPrice() + "元 "; + } - log.setRemark(s); - log.setRealname(user.getRealname()); - log.setUsername(user.getUsername()); - log.setQuoteIp(IPUtils.getIpAddr(request));// 获取ip - log.setBrower(IPUtils.getBrowserName(request));// 获取浏览器名称 - log.setOs(IPUtils.getOsName(request)); // 获取操作系统名称 - log.setPrice(proList.get(0).getPrice()); - List allRoleNames = sysRoleService.getAllRoleName(null); - String roleName = ""; - String[] split = user.getRole().split(","); - for (SysRole sysRole : allRoleNames) { - for (int i = 0; i < split.length; i++) { - if (split[i].equals(String.valueOf(sysRole.getRoleId()))) { - roleName += sysRole.getRoleName() + "、"; - } - } - } - log.setShopname(roleName); - quoteLogMapper.insertSelective(log); + log.setRemark(s); + log.setRealname(user.getRealname()); + log.setUsername(user.getUsername()); + log.setQuoteIp(IPUtils.getIpAddr(request));// 获取ip + log.setBrower(IPUtils.getBrowserName(request));// 获取浏览器名称 + log.setOs(IPUtils.getOsName(request)); // 获取操作系统名称 + log.setPrice(proList.get(0).getPrice()); + List allRoleNames = sysRoleService.getAllRoleName(null); + String roleName = ""; + String[] split = user.getRole().split(","); + for (SysRole sysRole : allRoleNames) { + for (int i = 0; i < split.length; i++) { + if (split[i].equals(String.valueOf(sysRole.getRoleId()))) { + roleName += sysRole.getRoleName() + "、"; + } + } + } + log.setShopname(roleName); + quoteLogMapper.insertSelective(log); - endTime = System.currentTimeMillis(); - System.out.println("【insertSelective】使用的时间:" + (endTime - startTime)); + endTime = System.currentTimeMillis(); + System.out.println("【insertSelective】使用的时间:" + (endTime - startTime)); - long startTime2, endTime2 = 0; - startTime2 = System.currentTimeMillis(); - boolean flag = false; - // 查询3分钟内自己报的数据 - List remarkJudgeData = quoteDataMapper.getQuoteDataByMinutes(user.getUsername()); - endTime2 = System.currentTimeMillis(); - System.out.println("【getQuoteDataByMinutes】使用的时间:" + (endTime2 - startTime2)); - for (String remarkJudge : remarkJudgeData) { - if (remarkJudge.equals(remark_judge)) { - // 如果3分钟内报过相同数据 - flag = true; - break; - } - } - // 插入数据(给客服数据新增用的) - String role = user.getRole(); - // 客服报的且3分钟内没有同一个客户报的数据才插入 - if (role.contains("999,") && !flag) { - QuoteData quoteData = new QuoteData(); - quoteData.setUsername(user.getUsername()); - quoteData.setRealname(user.getRealname()); - quoteData.setPrice(proList.get(0).getPrice()); - quoteData.setRole(user.getRole()); - // 默认都是没选择店铺 - quoteData.setIsSelect("0"); + long startTime2, endTime2 = 0; + startTime2 = System.currentTimeMillis(); + boolean flag = false; + // 查询3分钟内自己报的数据 + List remarkJudgeData = quoteDataMapper.getQuoteDataByMinutes(user.getUsername()); + endTime2 = System.currentTimeMillis(); + System.out.println("【getQuoteDataByMinutes】使用的时间:" + (endTime2 - startTime2)); + for (String remarkJudge : remarkJudgeData) { + if (remarkJudge.equals(remark_judge)) { + // 如果3分钟内报过相同数据 + flag = true; + break; + } + } + // 插入数据(给客服数据新增用的) + String role = user.getRole(); + // 客服报的且3分钟内没有同一个客户报的数据才插入 + if (role.contains("999,") && !flag) { + QuoteData quoteData = new QuoteData(); + quoteData.setUsername(user.getUsername()); + quoteData.setRealname(user.getRealname()); + quoteData.setPrice(proList.get(0).getPrice()); + quoteData.setRole(user.getRole()); + // 默认都是没选择店铺 + quoteData.setIsSelect("0"); // role = role.replace("999,", "").replace(",1049", "").replace(",1011", ""); - // 规则:第一位客服,第二位主店铺 - String shopname = role.substring(role.indexOf(",") + 1); - if (shopname.indexOf(",") != -1) { - shopname = shopname.substring(0, shopname.indexOf(",")); - } - System.out.println(shopname); - quoteData.setShopname(shopname); - quoteData.setIsSelect("1"); - // 除去【客服】只有一个店铺,所属店铺就是剩下这个店铺 切 选择状态改为已选择 + // 规则:第一位客服,第二位主店铺 + String shopname = role.substring(role.indexOf(",") + 1); + if (shopname.indexOf(",") != -1) { + shopname = shopname.substring(0, shopname.indexOf(",")); + } + System.out.println(shopname); + quoteData.setShopname(shopname); + quoteData.setIsSelect("1"); + // 除去【客服】只有一个店铺,所属店铺就是剩下这个店铺 切 选择状态改为已选择 // if (!role.contains(",")) { // } - quoteData.setIsBuy("0"); - quoteData.setIsBuyToDay("0"); - quoteData.setRemark(s); - quoteData.setRemarkJudge(remark_judge); - // 默认都是填写旺旺号 - quoteData.setIsFillIn("1"); - quoteData.setWangwang(product.getWangwang().trim()); - quoteData.setProTypeLabel(proTypeLabel); - quoteDataMapper.addQuoteData(quoteData); - } - return null; - } + quoteData.setIsBuy("0"); + quoteData.setIsBuyToDay("0"); + quoteData.setRemark(s); + quoteData.setRemarkJudge(remark_judge); + // 默认都是填写旺旺号 + quoteData.setIsFillIn("1"); + quoteData.setWangwang(product.getWangwang().trim()); + quoteData.setProTypeLabel(proTypeLabel); + quoteDataMapper.addQuoteData(quoteData); + } + return null; + } } diff --git a/src/main/java/lingtao/net/vo/PricingListVo.java b/src/main/java/lingtao/net/vo/PricingListVo.java new file mode 100644 index 0000000..5105bc8 --- /dev/null +++ b/src/main/java/lingtao/net/vo/PricingListVo.java @@ -0,0 +1,27 @@ +package lingtao.net.vo; + +import lingtao.net.bean.Product; +import lombok.Data; + +import java.util.List; + +@Data +public class PricingListVo { + int code = 0; + + List proList = null; + + String msg = ""; + + public PricingListVo() { + } + + public PricingListVo(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public PricingListVo(List proList) { + this.proList = proList; + } +} diff --git a/src/main/java/lingtao/net/vo/ProductVo.java b/src/main/java/lingtao/net/vo/ProductVo.java new file mode 100644 index 0000000..fc2e821 --- /dev/null +++ b/src/main/java/lingtao/net/vo/ProductVo.java @@ -0,0 +1,24 @@ +package lingtao.net.vo; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class ProductVo { + // 价格 + private Double price; + // 重量 + private String weight; + // 款数 + private Integer number; + // 数量 + private Integer count; + + private String role; + + private List providePrices = new ArrayList<>(); + + +} diff --git a/src/main/java/lingtao/net/vo/ProvidePrice.java b/src/main/java/lingtao/net/vo/ProvidePrice.java new file mode 100644 index 0000000..3568e61 --- /dev/null +++ b/src/main/java/lingtao/net/vo/ProvidePrice.java @@ -0,0 +1,27 @@ +package lingtao.net.vo; + +public class ProvidePrice { + private String name; + private double price; + + public ProvidePrice(String name, double price) { + this.name = name; + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } +} diff --git a/src/main/webapp/views/priceView/angingCloth.jsp b/src/main/webapp/views/priceView/angingCloth.jsp new file mode 100644 index 0000000..b31cac1 --- /dev/null +++ b/src/main/webapp/views/priceView/angingCloth.jsp @@ -0,0 +1,292 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + + +
+
+

挂布

+
+
+

+ 地址 +

+ + +

+ 车间 +

+
+
+ +
+
+

+ 材质 +

+
+ +
+ + +

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 +

+
+ +
+

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 配件: +

+
+ +
+

+ 工艺 +

+
+ + + +
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ + +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/banqi.jsp b/src/main/webapp/views/priceView/banqi.jsp new file mode 100644 index 0000000..8cd3d8f --- /dev/null +++ b/src/main/webapp/views/priceView/banqi.jsp @@ -0,0 +1,292 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + +
+
+

班旗

+
+
+ +

+ 地址 +

+ + +

+ 车间 +

+
+
+ +
+
+

+ 材质 +

+
+ +
+

+ 尺寸(CM/厘米) +

+
+ +
+ +

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+

+ 工艺 旗杆长度是2.5米 +

+
+ + +
+ + + + <%-- --%> +
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/canvas.jsp b/src/main/webapp/views/priceView/canvas.jsp new file mode 100644 index 0000000..039983a --- /dev/null +++ b/src/main/webapp/views/priceView/canvas.jsp @@ -0,0 +1,357 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + +
+
+

帆布

+
+
+

+ 地址 +

+ + +

+ 车间 +

+
+
+ +
+
+ +
+ + +
+

+ 材质 +

+
+ +
+
+

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 + +

+
+ +
+ +

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+
+

+ 客户旺旺 +

+
+ +
+

+ 工艺木棍长度50cm +

+
+ + + + + + + + + +
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/coupon.jsp b/src/main/webapp/views/priceView/coupon.jsp new file mode 100644 index 0000000..5ba57e0 --- /dev/null +++ b/src/main/webapp/views/priceView/coupon.jsp @@ -0,0 +1,3347 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + +
+
+

卡片

+
+
+

+ 地址 +

+ + +

+ 车间 +

+
+
+ +
+
+
+ <%-- --%> + +
+
+
+

品种

+
+ + + + + + + + + + + + + + + + +
+ +
+
+
+

材质

+
+ + + +
+ + + + + + + + + + +
+
+

类型

+
+ + + +
+
+
+
+ + + +

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 +  200克、300克腰封模切最大尺寸100cm,200克腰封裁切最大尺寸118cm + 压1痕最小尺寸10.8*5.4cm,压2痕最小尺寸13.5*5.4CM,低于最小尺寸按异形模切报价 + +

+ + +
+ +
+ + + + + + + +

+ 刮刮卡最小尺寸75*50mm,最大尺寸170*170mm +

+

+ 刮刮膜尺寸(MM/毫米) +

+ +
+

+ 组合价:卡片内容尺寸一样 奖项 数量可以不一样 +

+
+
+ +
+ +
+ +
+ +

+ 输入奖项个数 +

+
+ +
+

+ 奖项最高30个,最低1个 +

+
+ +

+ 尺寸超过4个名片位请单独报价 +

+

+ 刮刮膜尺寸(MM/毫米) +

+ +

+ 同个客户下单多款,其中一款数量在200张以上请全部按照印刷报价
200张以上车间贴,200张以下客户自己贴
+

+
+

+ 数量(张) +

+
+
+ +
+
+
+
+ +
+
+ + +

款数

+
+ +
+ +

+ 客户旺旺 +

+
+ +
+
+
+
+
+
+

+ 工艺 优惠券异形模切+打码限于简单刀版(无法做圆形 椭圆机)最小9*5.4 +

+
+ +
+ +
+ + + +
+ +
x +
+ +
+
+
+
+ + + + + + + + + + + +
+ + + +
+ +
+
+ + <%-- + <%-- title="单面覆膜">--%> + + + + +
+
+ +
+
+
+
+ + + + + + +
+
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+ +
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/metal.jsp b/src/main/webapp/views/priceView/metal.jsp new file mode 100644 index 0000000..32b6aad --- /dev/null +++ b/src/main/webapp/views/priceView/metal.jsp @@ -0,0 +1,476 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + <%@include file="/views/common.jsp" %> + + + + +
+
+

金属标

+
+
+ +

+ 地址 +

+ +

+ 车间 +

+
+
+ +
+
+

+ 产品种类 +

+
+ + <%-- --%> +
+
+

+ 颜色 +

+
+ +
+

+ 印色 +

+
+ + + + +
+

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 +

+
+ +
+ 金属标尺寸不能超过29*19 cm +

+ 数量(个) +

+
+ +
+
+ +

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+ +
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+ +
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/poster.jsp b/src/main/webapp/views/priceView/poster.jsp new file mode 100644 index 0000000..9b52145 --- /dev/null +++ b/src/main/webapp/views/priceView/poster.jsp @@ -0,0 +1,1821 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + + +
+
+

海报

+
+
+

+ 地址 +

+ +

+ 车间 +

+
+
+ +
+
+ +

+ 类目 +

+
+ + + + + + + + + + + + +
+
+

+ 产品名称 +

+
+ +
+
+ + +
+

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 + +

+ +
+ +
+
+
+

+ 数量(个)一张起做 +

+
+ +
+
+ + + + + + + + + + + +

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ 工艺 +

+
+ +
+
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+ + +
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/slq.jsp b/src/main/webapp/views/priceView/slq.jsp new file mode 100644 index 0000000..aa6a7be --- /dev/null +++ b/src/main/webapp/views/priceView/slq.jsp @@ -0,0 +1,259 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + +
+
+

手拉旗

+
+
+ +

+ 地址 +

+ + +

+ 车间 +

+
+
+ +
+
+

+ 材质 +

+
+ +
+

+ 宽度 +

+
+ +
+

+ 长度(CM/厘米) +

+
+ +
+

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/priceView/stickers.jsp b/src/main/webapp/views/priceView/stickers.jsp new file mode 100644 index 0000000..a00efb7 --- /dev/null +++ b/src/main/webapp/views/priceView/stickers.jsp @@ -0,0 +1,1835 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + + +
+
+

不干胶

+

+ + 使用方法:选择对应的产品种类。输入正确的尺寸、数量后点击“计算”出价格(自动复制); + +
+

+ 地址 +

+ +

+ 车间 +

+
+
+ +
+
+
+ <%-- --%> + + + <%-- --%> + <%-- --%> + <%-- --%> +
+
+
+
+

+ 品种 +

+ +
+ + + +
+
+ +
+

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 +

+
+ +
+ +

+ 数量(个) +

+
+ +
+ + + +
+ + + +

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+
+
+
+

+ 工艺 +

+
+ + + + + + + |     + + + + |     + + + + + |     + + + + + |     + + + +
+
+ 排废 : + + +
+
+ + +
+
+ 烫金 : + + +
+
+ 凹凸 : + + + + + +
+
+
+ + + +
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+ +
+
+
+
+
+
+ +
+
+ + +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file