diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 973e345..2d15eda 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4494,7 +4494,10 @@ public class ProductService { priceList = getKeychain(dto, width, length); return chucklePrice(role, priceList, dto); case "刺绣贴": - priceList = embroideredPatch(dto, width, length); + priceList = getEmbroideredPatchPrice(dto, width, length); + return chucklePrice(role, priceList, dto); + case "木浆棉": + priceList = getWoodPulpCottonPrice(dto, width, length); return chucklePrice(role, priceList, dto); default: break; @@ -4502,7 +4505,79 @@ public class ProductService { return null; } - private List embroideredPatch(Product dto, Double width, Double length) { + private List getWoodPulpCottonPrice(Product dto, Double width, Double length) { + 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 paperLength = 420; + double paperWith = 297; + + width = width * 10 + 4; + length = length * 10 + 4; + // 一张l/w 大的纸张能做多少个此类尺寸的产品 + double max = Math.max(Math.floor(paperLength / length) * Math.floor(paperWith / width), Math.floor(paperLength / width) * Math.floor(paperWith / length)); + // 报的数量需要多少张大纸 + // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个 + int num = (int) Math.ceil(count * number / Math.max(max, 1)); + double basePrice = 0; + if (num <= 100) { + basePrice = 40; + basePrice = new PriceUtils().calcByTargetN(100, 40, 100, 40, num); + } else if (num <= 300) { + basePrice = 35; + basePrice = new PriceUtils().calcByTargetN(100, 40, 300, 35, num); + } else if (num <= 500) { + basePrice = 30; + basePrice = new PriceUtils().calcByTargetN(300, 35, 500, 30, num); + } else if (num <= 1000) { + basePrice = 28; + basePrice = new PriceUtils().calcByTargetN(500, 35, 1000, 28, num); + } else if (num <= 2000) { + basePrice = 26; + basePrice = new PriceUtils().calcByTargetN(1000, 28, 2000, 26, num); + } else if (num <= 5000) { + basePrice = 24; + basePrice = new PriceUtils().calcByTargetN(2000, 26, 5000, 24, num); + } else if (num <= 10000) { + basePrice = 22; + basePrice = new PriceUtils().calcByTargetN(5000, 24, 10000, 22, num); + } else { + basePrice = 20*num; + //basePrice = new PriceUtils().calcByTargetN(10000, 20, 10000, 20, num); + } + double craftPrice = 0; + double craftBasePrice = 0; + double craftMiniPrice = 0; + if (craft_list.contains("装opp袋")) { + craftBasePrice = 0.20; + craftPrice += Math.max(craftBasePrice * count, 10); + } + if (craft_list.contains("穿绳子")) { + craftBasePrice = 0.20; + craftPrice += Math.max(craftBasePrice * count, 10); + } + + if (craft_list.contains("配opp袋")) { + craftBasePrice = 0.15; + craftPrice += Math.max(craftBasePrice * count, 5); + } + if (craft_list.contains("配绳子")) { + craftBasePrice = 0.15; + craftPrice += Math.max(craftBasePrice * count, 5); + } + Product pro = new Product(); + pro.setCount(count); + pro.setNumber(number); + pro.setPrice(Math.ceil((Math.max(basePrice, 80) + Math.max(craftPrice, craftMiniPrice)) * number)); + priceList.add(pro); + + return priceList; + } + + private List getEmbroideredPatchPrice(Product dto, Double width, Double length) { List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); diff --git a/src/main/java/lingtao/net/util/PriceUtils.java b/src/main/java/lingtao/net/util/PriceUtils.java index 08968ea..c12a17b 100644 --- a/src/main/java/lingtao/net/util/PriceUtils.java +++ b/src/main/java/lingtao/net/util/PriceUtils.java @@ -3673,6 +3673,9 @@ public class PriceUtils { public double calcByTargetN(int startN, double highPrice, int endN, double lowPrice, int targetN) { // 高价商品个数线性插值 + if (endN == startN) { + return highPrice * targetN; + } double a = startN * (double) (endN - targetN) / (endN - startN); double b = targetN - a; double total = a * highPrice + b * lowPrice; diff --git a/src/main/webapp/views/product/woodPulpCotton.jsp b/src/main/webapp/views/product/woodPulpCotton.jsp new file mode 100644 index 0000000..e081824 --- /dev/null +++ b/src/main/webapp/views/product/woodPulpCotton.jsp @@ -0,0 +1,349 @@ +<%@ 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