diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index bbdd99c..fd9db7d 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4451,12 +4451,99 @@ public class ProductService { case "无纺布手提袋": priceList = getNonwovensPrice(dto, width, length, height); return chucklePrice(role, priceList, dto); + case "吧唧徽章": + priceList = getBiteBadgePrice(dto, width, length, height); + return chucklePrice(role, priceList, dto); default: break; } return null; } + private List getBiteBadgePrice(Product dto, Double width, Double length, Double height) { + List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + + int count = dto.getCount(); + int number = dto.getNumber(); + double[] prices = {}; + List list1 = Arrays.asList("白底", "拉丝银", "镭射素面银", "玻璃碎", "镭射乱线", "镭射小米点银", "镭射马赛克", "镭射银丝", "闪粉色"); + List list2 = Arrays.asList("白瓷", "白葱", "七彩白"); + if (craft_list.contains("磁吸")) { + prices = new double[]{30.00, 5.65, 4.75, 4.15, 3.70, 3.45, 3.35, 3.20, 3.15, 3.10, 3.05, 3.00, 2.95, 2.90, 2.80}; + if (list1.contains(dto.getKind2Value())) { + prices = new double[]{30.00, 5.65, 3.95, 3.50, 3.10, 2.90, 2.80, 2.70, 2.65, 2.60, 2.55, 2.50, 2.45, 2.40, 2.35}; + } + if (list2.contains(dto.getKind2Value())) { + prices = new double[]{30.00, 6.00, 5.50, 4.85, 4.30, 4.05, 3.90, 3.75, 3.65, 3.60, 3.55, 3.45, 3.40, 3.35, 3.25}; + } + } else { + double[][] prices_area = { + {30.00, 5.65, 3.75, 3.30, 2.90, 2.75, 2.65, 2.55, 2.50, 2.45, 2.40, 2.35, 2.30, 2.25, 2.20}, + {30.00, 5.65, 4.25, 3.75, 3.30, 3.10, 3.00, 2.90, 2.85, 2.75, 2.70, 2.70, 2.65, 2.60, 2.50}, + {30.00, 5.65, 4.45, 3.90, 3.50, 3.25, 3.15, 3.00, 2.95, 2.90, 2.85, 2.80, 2.75, 2.70, 2.60} + }; + int currentIndex = 0; + if (width == 5.8 && length == 5.8) { + currentIndex = 0; + } + if (width == 7.5 && length == 7.5) { + currentIndex = 1; + } + if (width == 5 && length == 5) { + currentIndex = 2; + } + + if (list1.contains(dto.getKind2Value())) { + prices_area = new double[][]{ + {30.00, 5.65, 2.95, 2.60, 2.30, 2.20, 2.10, 2.00, 2.00, 1.95, 1.90, 1.85, 1.85, 1.80, 1.75}, + {30.00, 5.65, 3.50, 3.05, 2.70, 2.55, 2.45, 2.35, 2.30, 2.25, 2.25, 2.20, 2.15, 2.10, 2.05}, + {30.00, 5.65, 3.70, 3.25, 2.90, 2.70, 2.60, 2.50, 2.45, 2.40, 2.35, 2.30, 2.30, 2.25, 2.15} + }; + } + if (list2.contains(dto.getKind2Value())) { + prices_area = new double[][]{ + {30.00, 5.65, 4.50, 3.95, 3.50, 3.30, 3.15, 3.05, 3.00, 2.95, 2.90, 2.85, 2.80, 2.75, 2.65}, + {30.00, 5.65, 5.00, 4.40, 3.90, 3.70, 3.55, 3.40, 3.35, 3.25, 3.20, 3.15, 3.10, 3.05, 2.95}, + {30.00, 5.65, 5.20, 4.60, 4.10, 3.85, 3.70, 3.55, 3.45, 3.40, 3.35, 3.30, 3.25, 3.15, 3.05} + }; + } + prices = prices_area[currentIndex]; + + } + int[] end_counts = {1, 5, 10, 20, 50, 100, 200, 500, 1000, 3000, 5000, 10000, 30000, 50000, 100000}; + int[] start_counts = {1, 1, 5, 10, 20, 50, 100, 200, 500, 1000, 3000, 5000, 10000, 30000, 50000}; + double[] low_price = prices; + double[] height_price = new double[prices.length]; + height_price[0] = prices[0]; // 第一个 + height_price[1] = prices[0]; // 再次添加到第一位 + System.arraycopy(prices, 1, height_price, 2, prices.length - 2); // 复制原数组索引1~倒数第2个 + + double basePrice = 0; + if (count > end_counts[end_counts.length - 1]) { + basePrice = low_price[low_price.length - 1] * count; + } else { + // 查找匹配的区间 + for (int i = 0; i < end_counts.length; i++) { + if (count <= end_counts[i]) { + int startN = start_counts[i]; + int endN = end_counts[i]; + double highPrice = height_price[i]; + double lowPrice = low_price[i]; + basePrice = new PriceUtils().calcByTargetN(startN, highPrice, endN, lowPrice, count); + break; + } + } + } + double designPrice = 0; + Product product = new Product(); + product.setPrice(Math.ceil(Math.max(basePrice, 30) * number + designPrice)); + product.setCount(dto.getCount()); + product.setNumber(dto.getNumber()); + priceList.add(product); + return priceList; + } + private List getNonwovensPrice(Product dto, Double width, Double length, Double height) { List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); @@ -6048,49 +6135,45 @@ public class ProductService { requstVo.setCrafts(craft); if ("18".equals(dto.getKindValue())) { requstVo.setNum(base_count); -// rate_list = new double[]{0.70, 0.68, 0.65, 0.62, 0.58}; -// counts = new int[]{50, 100, 200, 500, 1000}; -// maxRate = 0.55; + rate_list = new double[]{0.7, 0.66, 0.62, 0.58, 0.54, 0.50, 0.45}; + counts = new int[]{20, 50, 100, 200, 300, 500, 1000}; + maxRate = 0.4; + if (count > 10) { + count = (int) (Math.ceil(count / 10.0) * 10); + } + + } + if ("19".equals(dto.getKindValue()) || "20".equals(dto.getKindValue())) { + rate_list = new double[]{0.75, 0.7, 0.6986, 0.6497, 0.6198, 0.5899, 0.5499, 0.4799}; + counts = new int[]{75, 200, 500, 1000, 2000, 3000, 5000, 10000}; + maxRate = 0.4; + if (count > 10) { + count = (int) (Math.ceil(count / 100.0) * 100); + } + requstVo.setNum(count); } ShengDaPriceResultVo result = ShengDaPriceUtils.getPrice(requstVo); double price = 0; - if ("18".equals(dto.getKindValue()) || "19".equals(dto.getKindValue()) || "20".equals(dto.getKindValue())) { - double rate_item = 1; - if (count <= 100) { - rate_item = 0.95; - } else if (count <= 200) { - rate_item = 0.93; - } else if (count <= 500) { - rate_item = 0.90; - } else if (count <= 1000) { - rate_item = 0.88; - } else if (count <= 2000) { - rate_item = 0.85; - } else if (count <= 5000) { - rate_item = 0.8; - } else { - rate_item = 0.75; + + for (int i = 0; i < counts.length; i++) { + if (counts[i] < count) { + continue; } - if ("18".equals(dto.getKindValue()) && count < 10) { - price = 150; - } else if ("19".equals(dto.getKindValue()) || "20".equals(dto.getKindValue())) { - price = Math.ceil(result.getData().getPrice() / (1 - 0.6)); - } else { - price = Math.ceil(result.getData().getPrice() / (1 - 0.7) / base_count * count * rate_item); - } - } else { - for (int i = 0; i < counts.length; i++) { - if (counts[i] < count) { - continue; - } - base_rate = rate_list[i]; - break; - } - if (base_rate == 0) { - base_rate = maxRate; - } - price = Math.ceil(result.getData().getPrice() / (1 - base_rate)); + base_rate = rate_list[i]; + break; } + if (base_rate == 0) { + base_rate = maxRate; + } + if ("18".equals(dto.getKindValue()) && count < 10) { + price = 150; + } else if ("18".equals(dto.getKindValue())) { + price = Math.ceil(result.getData().getPrice() / base_count * count / (1 - base_rate)); + } else { + price = Math.ceil(result.getData().getPrice() / (1 - base_rate)); + + } +// } double designPrice = (number - 1) * 8; Product product = new Product(); diff --git a/src/main/webapp/views/product/biteBadge.jsp b/src/main/webapp/views/product/biteBadge.jsp new file mode 100644 index 0000000..43edb62 --- /dev/null +++ b/src/main/webapp/views/product/biteBadge.jsp @@ -0,0 +1,336 @@ +<%@ 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