Quellcode durchsuchen

修改冷转印价格

zhuyiyi vor 22 Stunden
Ursprung
Commit
1929ebbfa3

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

@@ -2675,7 +2675,6 @@ public class ProductService {
                             num = Math.max(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length));
 
                         }
-
                         double baseCount = Math.max(Math.ceil(dto.getCount() * dto.getNumber() / num), 1);
                         double countNum = Math.max(Math.ceil(dto.getNumber() / num), 1);
                         int coNumber = dto.getCo_number() == null ? 1 : dto.getCo_number();
@@ -2683,7 +2682,7 @@ public class ProductService {
                             coNumber = 1;
                         }
 
-                        double price = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum, width * length * dto.getCount() * number);
+                        double price = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum, width * length * dto.getCount() * number, number);
 
                         Product pro = new Product();
                         pro.setCount(dto.getCount());
@@ -2698,7 +2697,7 @@ public class ProductService {
                             }
                             baseCount = Math.max(Math.ceil(quantitySteps[i] * dto.getNumber() / num), 1);
                             countNum = Math.max(Math.ceil(dto.getNumber() / num), 1);
-                            double currentPrice = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum, width * length * quantitySteps[i] * number);
+                            double currentPrice = new PriceUtils().CalculatePrice(craft_list, baseCount, coNumber, countNum, width * length * quantitySteps[i] * number, number);
 
                             pro = new Product();
 

+ 24 - 18
src/main/java/lingtao/net/util/PriceUtils.java

@@ -3685,7 +3685,7 @@ public class PriceUtils {
     }
 
 
-    public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum, double area) {
+    public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum, double area, int number) {
         if (craft_list.contains("烫画")) {
             double basePrice = 0;
             area = area / 10000;
@@ -3699,29 +3699,35 @@ public class PriceUtils {
         double price = 0;
         if (craft_list.contains("冷转印")) {
             double banfei = 200;
-            if (countNum > 1) {
-                price = 200 * countNum;
-                banfei = 0;
-                count = Math.abs(count - countNum);
-
-            }
-            if (count > 0) {
-                if (count <= 5) {
-                    price += 200;
-                } else if (count < 75) {
-                    price += 14 * count + banfei;
-                } else {
-                    if (count < 89) {
-                        count = 89;
+            double numCount = Math.max(Math.ceil(count / number), 1);
+            //单款数量少于5张的直接版费乘款数
+            if (numCount > 5) {
+                if (countNum > 1) {
+                    price = 200 * countNum;
+                    banfei = 0;
+                    count = Math.abs(count - countNum);
+
+                }
+                if (count > 0) {
+                    if (count <= 5) {
+                        price += 200;
+                    } else if (count < 75) {
+                        price += 14 * count + banfei;
+                    } else {
+                        if (count < 89) {
+                            count = 89;
+                        }
+                        price += 14 * count;
                     }
-                    price += 14 * count;
                 }
-            }
 
+            } else {
+                price = 200 * countNum;
+            }
             price = price + (coNumber - 1) * 100;
         }
 
-        return price;
+        return Math.ceil(price);
     }
 
     public static List<Product> getYinBaiPrice(List<Product> productList, double width, double length) {