first commit
This commit is contained in:
@@ -0,0 +1,212 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* PVC/透明不干胶价格
|
||||
*/
|
||||
public class PVCStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
/**
|
||||
* 透明不干胶加印白墨
|
||||
*/
|
||||
public List<Product> acountYinbaiPrice(Double length, Double width, List<Product> stickersList) {
|
||||
double price = 0;
|
||||
if (length <= 5 && width <= 5) {
|
||||
for (Product product : stickersList) {
|
||||
if (product.getCount() == 500 || product.getCount() == 1000) {
|
||||
price = 50;
|
||||
} else if (product.getCount() == 2000) {
|
||||
price = 75;
|
||||
} else if (product.getCount() == 3000) {
|
||||
price = 90;
|
||||
} else if (product.getCount() == 5000) {
|
||||
price = 100;
|
||||
} else if (product.getCount() == 10000 || product.getCount() == 20000) {
|
||||
price = 150;
|
||||
} else if (product.getCount() == 30000) {
|
||||
price = 200;
|
||||
} else if (product.getCount() == 40000) {
|
||||
price = 260;
|
||||
} else if (product.getCount() == 50000 || product.getCount() == 60000) {
|
||||
price = 300;
|
||||
} else if (product.getCount() == 70000) {
|
||||
price = 400;
|
||||
} else if (product.getCount() == 80000) {
|
||||
price = 500;
|
||||
} else if (product.getCount() == 90000) {
|
||||
price = 600;
|
||||
} else if (product.getCount() == 100000) {
|
||||
price = 700;
|
||||
}
|
||||
product.setPrice(product.getPrice() + price);
|
||||
}
|
||||
} else if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
|
||||
for (Product product : stickersList) {
|
||||
if (product.getCount() == 500 || product.getCount() == 1000) {
|
||||
price = 50;
|
||||
} else if (product.getCount() == 2000) {
|
||||
price = 90;
|
||||
} else if (product.getCount() == 3000) {
|
||||
price = 100;
|
||||
} else if (product.getCount() == 5000) {
|
||||
price = 120;
|
||||
} else if (product.getCount() == 10000) {
|
||||
price = 150;
|
||||
} else if (product.getCount() == 20000) {
|
||||
price = 220;
|
||||
} else if (product.getCount() == 30000) {
|
||||
price = 400;
|
||||
} else if (product.getCount() == 40000) {
|
||||
price = 500;
|
||||
} else if (product.getCount() == 50000) {
|
||||
price = 700;
|
||||
} else if (product.getCount() == 60000) {
|
||||
price = 900;
|
||||
} else if (product.getCount() == 70000) {
|
||||
price = 1000;
|
||||
} else if (product.getCount() == 80000) {
|
||||
price = 1200;
|
||||
} else if (product.getCount() == 90000) {
|
||||
price = 1300;
|
||||
} else if (product.getCount() == 100000) {
|
||||
price = 1500;
|
||||
}
|
||||
product.setPrice(product.getPrice() + price);
|
||||
}
|
||||
} else {
|
||||
for (Product product : stickersList) {
|
||||
// 产品面积(平方米)
|
||||
double area = product.getCount() * length * width / 10000;
|
||||
if (area <= 10) {
|
||||
area = 10;
|
||||
price = 11;
|
||||
} else if (area <= 20) {
|
||||
area = 20;
|
||||
price = 6;
|
||||
} else if (area <= 30) {
|
||||
area = 30;
|
||||
price = 4.5;
|
||||
} else if (area <= 50) {
|
||||
area = 50;
|
||||
price = 3.5;
|
||||
} else {
|
||||
price = 3;
|
||||
}
|
||||
product.setPrice(product.getPrice() + (price * area > 50 ? price * area : 50));
|
||||
}
|
||||
}
|
||||
return stickersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* PVC不干胶大数量遍历添加价格
|
||||
*/
|
||||
private List<Product> bigSizeAcountPrice(int count, Double area, List<Product> list, Double[] priceArr) {
|
||||
Product pro = new Product();
|
||||
if (count > bigCountArr[bigCountArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(area * count * priceArr[bigCountArr.length - 1]));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(area * bigCountArr[i] * priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 小尺寸 1万以上
|
||||
public List<Product> getPrice(int count, Double area) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (area <= 0.0004) {
|
||||
Double priceArrA[] = { 450.0, 300.0, 238.0, 184.0, 175.0, 158.0, 87.0, 70.0, 65.0, 59.0, 52.0, 48.0, 45.0,
|
||||
42.0, 39.0, 36.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0006) {
|
||||
Double priceArrA[] = { 300.0, 200.0, 158.0, 122.0, 117.0, 85.0, 60.0, 50.0, 45.0, 40.0, 38.0, 37.0, 36.0,
|
||||
35.0, 33.0, 32.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0008) {
|
||||
Double priceArrA[] = { 260.0, 171.0, 135.0, 105.0, 100.0, 73.0, 51.0, 45.0, 39.0, 33.0, 32.0, 31.0, 30.0,
|
||||
29.0, 28.0, 27.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.001) {
|
||||
Double priceArrA[] = { 200.0, 133.0, 105.0, 82.0, 78.0, 56.0, 42.0, 33.0, 28.0, 27.0, 26.0, 25.0, 24.0,
|
||||
23.0, 22.0, 21.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0012) {
|
||||
Double priceArrA[] = { 150.0, 92.0, 75.0, 62.0, 55.0, 48.0, 35.0, 29.0, 24.0, 23.0, 22.0, 21.0, 20.0, 19.0,
|
||||
18.0, 17.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0014) {
|
||||
Double priceArrA[] = { 138.0, 85.0, 70.0, 62.0, 54.0, 43.0, 31.0, 26.0, 22.0, 21.0, 20.0, 19.0, 18.0, 17.0,
|
||||
16.0, 15.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0016) {
|
||||
Double priceArrA[] = { 120.0, 80.0, 67.0, 54.0, 51.0, 43.0, 29.0, 23.0, 19.0, 19.0, 19.0, 18.0, 17.0, 16.0,
|
||||
15.0, 15.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0025) {
|
||||
Double priceArrA[] = { 118.0, 76.0, 68.0, 51.0, 48.0, 39.0, 20.0, 19.0, 18.0, 17.0, 16.0, 15.0, 14.0, 13.0,
|
||||
13.0, 13.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0035) {
|
||||
Double priceArrA[] = { 62.5, 60.0, 63.0, 47.0, 46.0, 38.0, 18.0, 18.0, 18.0, 16.0, 16.0, 15.0, 14.0, 13.0,
|
||||
12.0, 12.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0045) {
|
||||
Double priceArrA[] = { 84.0, 50.0, 44.0, 33.0, 25.0, 19.0, 15.0, 14.0, 14.0, 14.0, 13.0, 13.0, 12.0, 12.0,
|
||||
12.0, 12.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.0084) {
|
||||
Double priceArrA[] = { 56.0, 35.0, 29.0, 26.0, 19.0, 16.0, 15.0, 14.0, 14.0, 13.0, 12.0, 12.0, 12.0, 12.0,
|
||||
12.0, 12.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.012) {
|
||||
Double priceArrA[] = { 42.0, 26.0, 23.0, 18.0, 14.0, 12.0, 14.0, 13.0, 13.0, 12.0, 11.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.015) {
|
||||
Double priceArrA[] = { 36.0, 25.0, 22.0, 17.0, 15.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.02) {
|
||||
Double priceArrA[] = { 35.0, 24.0, 21.0, 17.0, 15.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area <= 0.06) {
|
||||
Double priceArr[] = { 32.0, 23.0, 21.0, 17.0, 15.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area <= 0.1) {
|
||||
Double priceArr[] = { 30.0, 20.0, 15.0, 13.0, 13.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area <= 0.2) {
|
||||
Double priceArr[] = { 17.0, 14.0, 13.0, 12.0, 12.0, 12.0, 12.0, 11.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0,
|
||||
10.0, 10.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} /*else if (area <= 0.3) {
|
||||
Double priceArr[] = { 15.0, 13.0, 12.0, 12.0, 11.0, 11.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0,
|
||||
10.0, 10.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}*/ else{
|
||||
Double priceArr[] = { 15.0, 13.0, 12.0, 12.0, 11.0, 11.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0,
|
||||
10.0, 10.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user