From d8eb05bb648a57693b1c01583cce14e2f4eb33ed Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Sat, 25 Jul 2026 10:41:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=8B=E6=8F=90=E8=A2=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lingtao/net/service/ProductService.java | 498 ++++++----- src/main/webapp/views/product/handBag.jsp | 829 +++++++++++------- 2 files changed, 801 insertions(+), 526 deletions(-) diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 170fa09..e32c228 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -2063,211 +2063,12 @@ public class ProductService { return chucklePrice(role, priceList, dto); // 牛皮纸手提袋 case "11": - List hanbagList = new ArrayList(); - craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); - // 没有尺寸,就是常规,查询数据库 - if (StringUtils.isEmpty(size) && !dto.getK().equals("4")) { - // 各常规尺寸展开的长宽--用于计算重量 - double danjia = 0.0; - if ("0".equals(dto.getKind2Value())) { - length = 640.0; - height = 385.0; - if (count <= 10000) { - danjia = 0.88; - } else { - danjia = 0.78; - } - } else if ("1".equals(dto.getKind2Value())) { - length = 720.0; - height = 400.0; - if (count <= 10000) { - danjia = 1.064; - } else { - danjia = 0.9; - } - } else if ("2".equals(dto.getKind2Value())) { - length = 780.0; - height = 385.0; - danjia = 1.11; - } - // 第一位添加自定义数量的价格 - if (dto.isDiyCount() && count > 3000) { - Product dto2 = new Product(); - dto2.setCount(count); - dto2.setPrice(Math.ceil(danjia * count)); - priceList.add(dto2); - } - if ("2".equals(dto.getKindValue())) { - dto.setKindValue("0"); - } - hanbagList = productMapper.getThanPrice(dto); - // 把查出来的价格跟在自定义数量价格后面 - for (int i = 0; i < hanbagList.size(); i++) { - if (priceList.size() > 0) { - if (count == hanbagList.get(i).getCount()) - continue; - } - priceList.add(hanbagList.get(i)); - } - // 给产品加上重量 - for (Product product : priceList) { - product.setWeight(df.format(product.getCount() * 0.03)); - } - } else { - if ("4".equals(dto.getK())) { - String kind2Value = dto.getKind2Value(); - String kindValue = dto.getKindValue(); - int[] base_count = null; - double[] base_price = null; - length = 0.0; - height = 0.0; - width = 0.0; - List kind2ValueList = Arrays.asList("11", "12", "31", "37", "38", "62"); - if ("0".equals(kindValue) && !kind2ValueList.contains(kind2Value)) { - base_count = new int[]{100, 500, 1000, 2000, 3000, 5000, 10000}; - } else { - base_count = new int[]{500, 1000, 2000, 3000, 5000, 10000}; - } - FunReturnVo funReturnVo = new PriceUtils().getBagTagPrice(kind2Value, kindValue); - if (funReturnVo.getBase_price() != null) { - base_price = funReturnVo.getBase_price(); - width = funReturnVo.getWidth(); - height = funReturnVo.getHeight(); - length = funReturnVo.getLength(); - } - Product pro = null; - double color_price = 0; - double bei_price = 0; - if (dto.getShen_type() == 0) { - if (!"白色".equals(dto.getShen_color()) && !"黄牛皮本色".equals(dto.getShen_color())) { - color_price = 0.02; - } - } - if (dto.getShen_type() == 1) { - color_price = 0.06; - if ("白色".equals(dto.getShen_color()) || "黄牛皮本色".equals(dto.getShen_color())) { - color_price = 0.03; - } - } - if (dto.getZheye() != null && dto.getZheye() == 0) { - bei_price = 0.4; - } - if (dto.getZheye() != null && dto.getZheye() == 1) { - bei_price = 0.6; - } - if (dto.getZheye() != null && dto.getZheye() == 2) { - bei_price = 0.3; - } - for (int i = 0; i < base_count.length; i++) { - if (base_count[i] < count) { - continue; - } - if (priceList.size() > 2) { - break; - } - pro = new Product(); - pro.setCount(base_count[i]); - pro.setPrice(Math.ceil(base_price[i] + (base_count[i] * color_price) + (base_count[i] * bei_price))); - priceList.add(pro); - } - - for (Product product : priceList) { - product.setPrice(product.getPrice() * number); - product.setWeight(df.format((width + height) * length * 2 * 0.25 * 1.5 * product.getCount() / 10000)); - } - - return chucklePrice(role, priceList, dto); - } - double sizeLength = 0.0; - double sizeWidth = 0.0; - // 厘米转成毫米 - sizeLength = length = length * 10; - sizeWidth = width = width * 10; - height = height * 10; - length = (length + width) * 2 + 20; - height = (height + (width / 2 + 20)) + 40; - double price = 0.0; - int ikai = 0; - String kai = ""; - String kaiDa = PriceUtils.getDa(length, height); - String kaiZheng = PriceUtils.getZheng(length, height); - int intDa = Integer.parseInt(kaiDa); - int intZheng = Integer.parseInt(kaiZheng); - int maxDa = intDa > intZheng ? intDa : intZheng; - if (intZheng >= intDa) { - kai = "+" + maxDa; - } - if (kai.contains("+")) { - kai = kai.replaceAll("[^(0-9)]", ""); - ikai = Integer.parseInt(kai); - // 140克牛皮纸 - if ("0".equals(kind)) { - price = 1.2; - // 250克牛皮纸 - } else { - price = 2.2; - } - } else { - ikai = maxDa; - if ("0".equals(kind)) { - price = 1.4; - } else { - price = 2.8; - } - } - // !福袋/礼品袋 - if (!"2".equals(dto.getK())) { - if (length >= 1000 || height >= 700) { - ikai = 1; - priceList = new PriceUtils().getPriceHanding(count, ikai, price, 2); - } else { - // 系数 5千-1万的*1.6 5千以下的*1.7 - if (count <= 5000) { - priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.7); - } else { - priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6); - } - } - } else { - if (length >= 1000 || height >= 700) { - ikai = 1; - } - // 数量超过1万个,系数*1.6 - if (count > 10000) { - priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6); - } else { - priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.8); - } - } - // 给产品加上重量 - if ("0".equals(kind)) { - for (Product product : priceList) { - product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.14 * 1.25)); - } - } else { - for (Product product : priceList) { - double craft_price = 0.0; - if (craft_list.contains("烫金")) { - craft_price = Math.ceil(300 + 0.5 * product.getCount()); - //craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number), 200); - } - if (craft_list.contains("双面")) { - craft_price = Math.ceil(300 + 0.5 * product.getCount()) * 2; - //craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number * 2), 200); - } - product.setPrice(Math.ceil(product.getPrice() + craft_price)); - product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25)); - } - } - } + priceList = getHandBagPrice(dto, width, length, height); if (priceList.size() >= 4) { priceList = priceList.subList(0, 4); } - // 根据款数重新算价格 - for (Product product : priceList) { - product.setPrice(Math.floor(product.getPrice() * number)); - } + return chucklePrice(role, priceList, dto); // 250克白牛皮纸 case "12": @@ -4627,6 +4428,301 @@ public class ProductService { return null; } + private List getHandBagPrice(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(); + String kind = dto.getKindValue(); + String size = dto.getSize(); + List hanbagList = new ArrayList(); + // 没有尺寸,就是常规,查询数据库 + if (StringUtils.isEmpty(size) && !dto.getK().equals("4") && !dto.getK().equals("5")) { + // 各常规尺寸展开的长宽--用于计算重量 + double danjia = 0.0; + if ("0".equals(dto.getKind2Value())) { + length = 640.0; + height = 385.0; + if (count <= 10000) { + danjia = 0.88; + } else { + danjia = 0.78; + } + } else if ("1".equals(dto.getKind2Value())) { + length = 720.0; + height = 400.0; + if (count <= 10000) { + danjia = 1.064; + } else { + danjia = 0.9; + } + } else if ("2".equals(dto.getKind2Value())) { + length = 780.0; + height = 385.0; + danjia = 1.11; + } + // 第一位添加自定义数量的价格 + if (dto.isDiyCount() && count > 3000) { + Product dto2 = new Product(); + dto2.setCount(count); + dto2.setPrice(Math.ceil(danjia * count)); + priceList.add(dto2); + } + if ("2".equals(dto.getKindValue())) { + dto.setKindValue("0"); + } + hanbagList = productMapper.getThanPrice(dto); + // 把查出来的价格跟在自定义数量价格后面 + for (int i = 0; i < hanbagList.size(); i++) { + if (priceList.size() > 0) { + if (count == hanbagList.get(i).getCount()) + continue; + } + priceList.add(hanbagList.get(i)); + } + // 给产品加上重量 + for (Product product : priceList) { + product.setWeight(df.format(product.getCount() * 0.03)); + } + } else { + if ("4".equals(dto.getK())) { + String kind2Value = dto.getKind2Value(); + String kindValue = dto.getKindValue(); + int[] base_count = null; + double[] base_price = null; + length = 0.0; + height = 0.0; + width = 0.0; + List kind2ValueList = Arrays.asList("11", "12", "31", "37", "38", "62"); + if ("0".equals(kindValue) && !kind2ValueList.contains(kind2Value)) { + base_count = new int[]{100, 500, 1000, 2000, 3000, 5000, 10000}; + } else { + base_count = new int[]{500, 1000, 2000, 3000, 5000, 10000}; + } + FunReturnVo funReturnVo = new PriceUtils().getBagTagPrice(kind2Value, kindValue); + if (funReturnVo.getBase_price() != null) { + base_price = funReturnVo.getBase_price(); + width = funReturnVo.getWidth(); + height = funReturnVo.getHeight(); + length = funReturnVo.getLength(); + } + + Product pro = null; + double color_price = 0; + double bei_price = 0; + if (dto.getShen_type() == 0) { + if (!"白色".equals(dto.getShen_color()) && !"黄牛皮本色".equals(dto.getShen_color())) { + color_price = 0.02; + } + } + if (dto.getShen_type() == 1) { + color_price = 0.06; + if ("白色".equals(dto.getShen_color()) || "黄牛皮本色".equals(dto.getShen_color())) { + color_price = 0.03; + } + } + if (dto.getZheye() != null && dto.getZheye() == 0) { + bei_price = 0.4; + } + if (dto.getZheye() != null && dto.getZheye() == 1) { + bei_price = 0.6; + } + if (dto.getZheye() != null && dto.getZheye() == 2) { + bei_price = 0.3; + } + for (int i = 0; i < base_count.length; i++) { + if (base_count[i] < count) { + continue; + } + if (priceList.size() > 2) { + break; + } + pro = new Product(); + pro.setCount(base_count[i]); + pro.setPrice(Math.ceil(base_price[i] + (base_count[i] * color_price) + (base_count[i] * bei_price))); + priceList.add(pro); + } + + for (Product product : priceList) { + product.setPrice(product.getPrice() * number); + product.setWeight(df.format((width + height) * length * 2 * 0.25 * 1.5 * product.getCount() / 10000)); + } + + return priceList; + } else if ("5".equals(dto.getK())) { + int[] counts = {100, 200, 500, 1000, 2000, 5000, 10000, 50000, 100000}; + double[][] prices = { + {140, 190, 380, 690, 1330, 3110, 5980, 27540, 51430}, + {150, 230, 460, 850, 1640, 3790, 7320, 34060, 64290}, + {160, 240, 500, 930, 1790, 4170, 8060, 36960, 70000}, + {170, 270, 560, 1040, 2000, 4700, 8960, 41310, 78580}, + }; + if (craft_list.contains("单色") && craft_list.contains("双面")) { + prices = new double[][]{ + {183, 241, 308, 443, 812, 1446, 3333, 6418, 30580, 60143}, + {200, 275, 358, 525, 969, 1754, 4091, 7910, 37826, 74429}, + {191, 291, 383, 566, 1047, 1908, 4470, 8657, 41449, 81572}, + {216, 316, 418, 631, 1156, 2123, 5000, 9701, 46522, 91572}, + {250, 366, 498, 754, 1406, 2615, 6212, 12090, 58116, 114429}, + }; + } + if (craft_list.contains("彩色") && craft_list.contains("单面")) { + prices = new double[][]{ + {150, 198, 363, 691, 1329, 3215, 6286, 30001, 57143}, + {166, 214, 439, 838, 1615, 3858, 7572, 36429, 70000}, + {175, 253, 477, 911, 1758, 4215, 8286, 39286, 75715}, + {183, 276, 537, 1014, 1958, 4715, 9286, 44286, 85715}, + }; + } + if (craft_list.contains("彩色") && craft_list.contains("双面")) { + prices = new double[][]{ + {233, 277, 454, 838, 1472, 3543, 6929, 33115, 63272}, + {316, 293, 530, 985, 1758, 4229, 8272, 39543, 75558}, + {325, 333, 568, 1058, 1901, 4572, 8943, 42758, 81700}, + {333, 355, 628, 1161, 2100, 5043, 9872, 47258, 90300}, + {366, 406, 740, 1397, 2558, 6143, 12029, 57543, 109958}, + }; + } + double baseRate = 0; + if (craft_list.contains("全彩")) { + baseRate = 1; + counts = new int[]{5000, 10000, 20000, 30000, 50000, 100000, 200000}; + prices = new double[][]{ + {3584, 6350, 11400, 16607, 27239, 51377, 98215}, + {4184, 7493, 13631, 19970, 32911, 62276, 119243}, + {4767, 8270, 15031, 22001, 36224, 68537, 131200}, + {5250, 9683, 17600, 25773, 42433, 80290, 153715}, + {6867, 12254, 22216, 32501, 53478, 101116, 193529}, + }; + } + double[] ban_price = {350, 270, 310, 350, 470}; + for (int i = 0; i < counts.length; i++) { + if (priceList.size() > 2) { + break; + } + int item_count = counts[i]; + + if (item_count < count) { + continue; + } + double price = 0; + if (priceList.size() == 0) { + if (count != item_count) { + price = new PriceUtils().TableCountCenterPrice(count, prices[Integer.parseInt(dto.getKind2Value())], counts); + Product pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.ceil(price)); + priceList.add(pro); + } + } + price = new PriceUtils().TableCountCenterPrice(item_count, prices[Integer.parseInt(dto.getKind2Value())], counts); + + Product pro = new Product(); + pro.setCount(item_count); + pro.setPrice(Math.ceil(price)); + priceList.add(pro); + } + if (priceList.size() == 0) { + Product pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.ceil(prices[Integer.parseInt(dto.getKind2Value())][prices[Integer.parseInt(dto.getKind2Value())].length - 1] / counts[counts.length - 1] * count)); + priceList.add(pro); + } + for (Product product : priceList) { + product.setPrice(Math.ceil(product.getPrice() * number + baseRate * ban_price[Integer.parseInt(dto.getKind2Value())] * dto.getCo_number())); + } + return priceList; + } + double sizeLength = 0.0; + double sizeWidth = 0.0; + // 厘米转成毫米 + sizeLength = length = length * 10; + sizeWidth = width = width * 10; + height = height * 10; + length = (length + width) * 2 + 20; + height = (height + (width / 2 + 20)) + 40; + double price = 0.0; + int ikai = 0; + String kai = ""; + String kaiDa = PriceUtils.getDa(length, height); + String kaiZheng = PriceUtils.getZheng(length, height); + int intDa = Integer.parseInt(kaiDa); + int intZheng = Integer.parseInt(kaiZheng); + int maxDa = intDa > intZheng ? intDa : intZheng; + if (intZheng >= intDa) { + kai = "+" + maxDa; + } + if (kai.contains("+")) { + kai = kai.replaceAll("[^(0-9)]", ""); + ikai = Integer.parseInt(kai); + // 140克牛皮纸 + if ("0".equals(kind)) { + price = 1.2; + // 250克牛皮纸 + } else { + price = 2.2; + } + } else { + ikai = maxDa; + if ("0".equals(kind)) { + price = 1.4; + } else { + price = 2.8; + } + } + // !福袋/礼品袋 + if (!"2".equals(dto.getK())) { + if (length >= 1000 || height >= 700) { + ikai = 1; + priceList = new PriceUtils().getPriceHanding(count, ikai, price, 2); + } else { + // 系数 5千-1万的*1.6 5千以下的*1.7 + if (count <= 5000) { + priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.7); + } else { + priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6); + } + } + } else { + if (length >= 1000 || height >= 700) { + ikai = 1; + } + // 数量超过1万个,系数*1.6 + if (count > 10000) { + priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6); + } else { + priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.8); + } + } + // 给产品加上重量 + if ("0".equals(kind)) { + for (Product product : priceList) { + product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.14 * 1.25)); + } + } else { + for (Product product : priceList) { + double craft_price = 0.0; + if (craft_list.contains("烫金")) { + craft_price = Math.ceil(300 + 0.5 * product.getCount()); + //craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number), 200); + } + if (craft_list.contains("双面")) { + craft_price = Math.ceil(300 + 0.5 * product.getCount()) * 2; + //craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number * 2), 200); + } + product.setPrice(Math.ceil(product.getPrice() + craft_price)); + product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25)); + } + } + } + // 根据款数重新算价格 + for (Product product : priceList) { + product.setPrice(Math.floor(product.getPrice() * number)); + } + return priceList; + } + private List getWorkPermitPrice(Product dto, Double width, Double length) { List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); diff --git a/src/main/webapp/views/product/handBag.jsp b/src/main/webapp/views/product/handBag.jsp index 4a78c52..a42abfb 100644 --- a/src/main/webapp/views/product/handBag.jsp +++ b/src/main/webapp/views/product/handBag.jsp @@ -30,6 +30,7 @@ +
@@ -109,6 +110,47 @@ +
+

材质

+
+ +
+

规格(CM/厘米) 格式: 长 * 宽 * 高

+
+ +
+

+ 数量(个) + 自定义数量 + +

+
+ +
+ +

款数

@@ -133,6 +175,39 @@ +