|
|
@@ -3,6 +3,7 @@ package lingtao.net.util;
|
|
|
import lingtao.net.bean.Product;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -90,7 +91,7 @@ public class CouponPrice {
|
|
|
private static final String compate = "basePrice + area*price";
|
|
|
private static final String moCompate = "chu*number";
|
|
|
|
|
|
- public List<Product> getCouponPrice(int min, Product dto, List<Product> priceList, int count) {
|
|
|
+ public List<Product> getCouponPrice(int min, Product dto, List<Product> priceList, int count, List<String> craftList) {
|
|
|
Product product = null;
|
|
|
List<Product> products = new ArrayList<>();
|
|
|
int[] priceArr = {20, 28, 52, 100, 155, 165, 250};
|
|
|
@@ -108,7 +109,7 @@ public class CouponPrice {
|
|
|
if (count > countArr2[i] || products.size() >= 3) {
|
|
|
continue;
|
|
|
}
|
|
|
- Double price = this.price(min, dto, countArr2[i], Double.valueOf(priceArr[i]), minPrice);
|
|
|
+ Double price = this.price(min, dto, countArr2[i], Double.valueOf(priceArr[i]), minPrice, craftList);
|
|
|
|
|
|
product.setPrice(price);
|
|
|
product.setCount(countArr2[i]);
|
|
|
@@ -117,7 +118,7 @@ public class CouponPrice {
|
|
|
return products;
|
|
|
}
|
|
|
|
|
|
- private Double price(int min, Product dto, int count, double basePrice, double minPrice) {
|
|
|
+ private Double price(int min, Product dto, int count, double basePrice, double minPrice, List<String> craftList) {
|
|
|
//200张以内16元/款/单,200张以上24元/款/单
|
|
|
int price = count <= 200 ? 16 * dto.getNumber() : 20 * dto.getNumber();
|
|
|
if (min == 1) {
|
|
|
@@ -127,7 +128,25 @@ public class CouponPrice {
|
|
|
if (minW > 1) {
|
|
|
minW = minW - 0.5;
|
|
|
}
|
|
|
- double v = basePrice * min * dto.getNumber() + ((dto.getAwards() - 1) * minW * price);
|
|
|
+ double v = 0;
|
|
|
+ if (craftList.contains("模切")) {
|
|
|
+ int[][] prices = {
|
|
|
+ {73, 78, 83, 88, 90, 100, 110, 115, 120, 125, 130, 135, 142, 145, 160, 230, 420},
|
|
|
+ {78, 83, 88, 93, 95, 105, 115, 120, 132, 142, 152, 162, 172, 185, 198, 243, 435},
|
|
|
+ {125, 128, 130, 132, 135, 140, 145, 150, 159, 169, 189, 210, 220, 298, 358, 412, 525},
|
|
|
+ {220, 225, 228, 230, 236, 240, 245, 250, 280, 305, 325, 350, 370, 530, 610, 745, 950},
|
|
|
+ {320, 325, 330, 335, 340, 345, 350, 355, 396, 455, 480, 495, 528, 790, 880, 1120, 1390},
|
|
|
+ {415, 420, 425, 430, 440, 450, 460, 465, 520, 555, 600, 620, 670, 910, 990, 1265, 2100},
|
|
|
+ {700, 705, 710, 715, 725, 735, 745, 750, 800, 820, 870, 950, 1150, 1450, 1680, 2390, 3790}
|
|
|
+ };
|
|
|
+ double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 255, 289};
|
|
|
+ int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};
|
|
|
+ int count_index = Arrays.binarySearch(count_list, count);
|
|
|
+ double area = dto.getWidth() * dto.getLength();
|
|
|
+ v = new PriceUtils().TablePrice(area, prices[count_index], areas);
|
|
|
+ } else {
|
|
|
+ v = basePrice * min * dto.getNumber() + ((dto.getAwards() - 1) * minW * price);
|
|
|
+ }
|
|
|
String[] size_list = dto.getSize1().split(",");
|
|
|
double chu = 0.00;
|
|
|
double total_chu = 0.00;
|
|
|
@@ -200,7 +219,7 @@ public class CouponPrice {
|
|
|
for (Double aDouble : chu_list) {
|
|
|
if (total_chu > 0.00) {
|
|
|
total_chu = total_chu + aDouble * dto.getNumber();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
total_chu = Math.max(v + aDouble * dto.getNumber(), minPrice);
|
|
|
}
|
|
|
}
|