浏览代码

修改uv价格

zhuyiyi 5 月之前
父节点
当前提交
a45a852d96
共有 2 个文件被更改,包括 92 次插入6 次删除
  1. 2 6
      src/main/java/lingtao/net/service/ProductService.java
  2. 90 0
      src/main/java/lingtao/net/util/PriceUtils.java

+ 2 - 6
src/main/java/lingtao/net/service/ProductService.java

@@ -2592,11 +2592,7 @@ public class ProductService {
                     //if(role.indexOf("1000") > -1 || role.indexOf("1006") > -1) {//菇凉&卓胜uv单独报价 priceList = new PriceUtils().UVStickerLessPrice(length, width, count,number, dto.getCraft()); }else {
 
                     // 1006 1003 1005 1037 1058 1002 1033 1045 卓盛 航和 米笛儿 竹范 领淘文具 榆家 涛莱 拼多多uv单独报价
-                    if (role.indexOf("1045") > -1) {
-                        priceList = new PriceUtils().UVStickerSmallPrice(length, width, count, number, dto.getCraftMo(), dto.getCraft());
-                    } else {
-                        priceList = new PriceUtils().UVStickerPrice(length, width, count, number, dto.getCraftMo(), dto.getCraft());
-                    }
+                    priceList = new PriceUtils().UVStickerSmallPriceV2(length, width, count, number, dto.getCraftMo(), dto.getCraft(), role.indexOf("1045") > -1);
                     if (priceList.get(0).getCount() != count) {
                         priceList.get(0).setCount(count);
                     }
@@ -2674,7 +2670,7 @@ public class ProductService {
                         price += Math.max(count * 0.2, 10);
                     }
                     price = price * number;//款数翻倍
-                    price = Math.max(price, 80);
+                    price = Math.max(price, 60);
 
                     if (!StringUtils.isEmpty(dto.getSwitchz3Size())) {
                         price += 100;

+ 90 - 0
src/main/java/lingtao/net/util/PriceUtils.java

@@ -1499,6 +1499,96 @@ public class PriceUtils {
         return list;
     }
 
+    public Product getUVCenterPrice(double length, double width, int count, int number, String[] zhuan, Boolean isSmall) {
+
+        double areaArr[] = {0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 3, 5, 7, 9, 10, 20, 50, 100, 200, 500, 1000, 5000};
+        int priceArr[] = {50, 60, 76, 108, 136, 150, 225, 600, 875, 1190, 1350, 1450, 2500, 6000, 11000, 20000, 45000, 80000, 350000};
+        double areaArrSmall[] = {0.03, 0.1};
+        int priceArrSmall[] = {30, 50};
+
+        double mqPrice = 0;
+        double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
+        if (!StringUtils.isEmpty(zhuan)) {
+            //工艺价格另算
+            area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
+        }
+
+        double price = TablePrice(area, priceArr, areaArr);
+        price = price > 45 ? price : 45;
+        if (area < 0.1 && area > 0 && isSmall) {
+            price = TablePrice(area, priceArrSmall, areaArrSmall);
+            if (price == 0) {
+                price = Math.ceil(65 * area);
+            }
+        }
+        if (area <= 0.2 && area >= 0.1) {
+            mqPrice = count * 0.05;
+            mqPrice = mqPrice > 5 ? mqPrice : 5;
+            Math.ceil(price += mqPrice);
+        }
+
+        if (!StringUtils.isEmpty(zhuan)) {
+            if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
+                // 起步价+58元
+                price = price + (40 * area);
+                price = price > 80 ? price : 80;
+            } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
+                // 起步价+58元
+                price = price + (45 * area);
+                price = price > 103 ? price : 103;
+            } else if ("双面贴".equals(zhuan[0])) {
+                price = price + (40 * area);
+                price = price > 80 ? price : 80;
+            }
+        }
+        Product pro = new Product();
+        pro.setPrice(Math.ceil(price));
+        pro.setCount(count);
+        return pro;
+    }
+
+    public List<Product> UVStickerSmallPriceV2(double length, double width, int count, int number, String yinse, String[] zhuan, Boolean isSmall) {
+        List<Product> list = new ArrayList<>();
+        int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
+
+
+        int oldCount = count;
+        if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) && count < 100) {
+            // 烫金100个起
+            count = 100;
+        }
+        Product firstProduct = getUVCenterPrice(length, width, count, number, zhuan, isSmall);
+        firstProduct.setCount(oldCount);
+        list.add(firstProduct);
+        for (int i = 0; i < countArr.length; i++) {
+            if (list.size() > 3) {
+                break;
+            }
+            int currentCount = countArr[i];
+            if (currentCount < count) {
+                continue;
+            }
+            list.add(getUVCenterPrice(length, width, currentCount, number, zhuan, isSmall));
+        }
+
+        if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
+            for (Product product : list) {
+                product.setPrice(Math.ceil(product.getPrice() + 60));
+            }
+        }
+
+        if (length >= 44 || width >= 44) {
+            if (width > length) {
+                length = width;
+            }
+            for (Product product : list) {
+                product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
+            }
+        }
+
+        return list;
+    }
+
     /**
      * 小面积UV转印贴报价:
      *