From 03e4bf902918766b07abdc38e59a2a45f3fbe8fe Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Mon, 6 Jul 2026 10:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=BA=E7=BB=A3=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lingtao/net/service/ProductService.java | 60 ++++ .../resources/mapper/SysPermissionMapper.xml | 2 +- .../webapp/views/product/embroideredPatch.jsp | 312 ++++++++++++++++++ 3 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 src/main/webapp/views/product/embroideredPatch.jsp diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index f21fc2d..973e345 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4493,12 +4493,72 @@ public class ProductService { case "钥匙扣": priceList = getKeychain(dto, width, length); return chucklePrice(role, priceList, dto); + case "刺绣贴": + priceList = embroideredPatch(dto, width, length); + return chucklePrice(role, priceList, dto); default: break; } return null; } + private List embroideredPatch(Product dto, Double width, Double length) { + List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + + int count = dto.getCount(); + int number = dto.getNumber(); + double area = width * length; + double price = 0; + + int[] counts = {1, 5, 10, 20, 30, 50, 100, 200}; + double[] areas = {16, 25, 36, 49, 64, 100, 225, 400, 625, 900}; + + double[][] prices = { + {100, 28.8, 16.8, 13.2, 9.6, 7.2, 6, 4.8}, + {100, 28.8, 16.8, 13.2, 9.6, 7.2, 6, 4.8}, + {100, 28.8, 16.8, 13.2, 10.8, 8.4, 6.6, 5.4}, + {100, 28.8, 16.8, 13.2, 10.8, 8.4, 6.6, 5.4}, + {100, 33.6, 19.2, 14.4, 12, 9.6, 7.2, 6}, + {100, 40.8, 23.4, 17.4, 14.4, 11.52, 8.64, 7.2}, + {100, 50.4, 28.8, 21.6, 18, 14.4, 10.8, 9}, + {100, 50.4, 28.8, 21.6, 18, 14.4, 10.8, 9}, + {100, 67.2, 38.4, 28.8, 24, 19.2, 14.4, 12}, + {100, 67.2, 38.4, 28.8, 24, 19.2, 14.4, 12}, + }; + int area_index = 0; + for (int i = 0; i < areas.length; i++) { + if (area <= areas[i]) { + area_index = i; + break; + } + } + double base_price = 0; + for (int i = 0; i < counts.length; i++) { + if (count > counts[i]) { + continue; + } + if (priceList.size() > 2) { + break; + } + int itemCount = priceList.size() == 0 ? count : counts[i]; + base_price = prices[area_index][Math.max(itemCount == count ? i - 1 : i, 0)]; + Product pro = new Product(); + pro.setCount(itemCount); + pro.setNumber(dto.getNumber()); + pro.setPrice(Math.ceil(itemCount * base_price * number)); + priceList.add(pro); + } + if (priceList.size() == 0) { + Product pro = new Product(); + pro.setCount(count); + pro.setNumber(number); + pro.setPrice(Math.ceil(prices[area_index][prices[area_index].length - 1] * count * number)); + priceList.add(pro); + } + return priceList; + } + private List getKeychain(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/resources/mapper/SysPermissionMapper.xml b/src/main/resources/mapper/SysPermissionMapper.xml index 4e43dfa..302a0fc 100644 --- a/src/main/resources/mapper/SysPermissionMapper.xml +++ b/src/main/resources/mapper/SysPermissionMapper.xml @@ -55,6 +55,6 @@ select roleId from tbl_sys_user_role where userId = #{userId} ) ) - ORDER BY orderNo ASC + ORDER BY orderNo ASC,parentId ASC; \ No newline at end of file diff --git a/src/main/webapp/views/product/embroideredPatch.jsp b/src/main/webapp/views/product/embroideredPatch.jsp new file mode 100644 index 0000000..4afdbb5 --- /dev/null +++ b/src/main/webapp/views/product/embroideredPatch.jsp @@ -0,0 +1,312 @@ +<%@ 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