first commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CupHolderUtil {
|
||||
static int countArr[] = {200, 500, 1000, 2000, 3000, 5000, 8000, 10000};
|
||||
static double priceArr[] = {98.8, 57, 30.4, 22.8, 16, 14.8, 14.8, 12.8};
|
||||
static double priceLess[] = {532, 570, 760, 950, 1080, 1600, 1920, 2112};
|
||||
|
||||
public static List<Product> getPrice(Double area, int count, List<Product> priceList) {
|
||||
Product pro = new Product();
|
||||
double price = 0;
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count || priceList.size() > 3) {
|
||||
continue;
|
||||
}
|
||||
price = Math.ceil(priceArr[i] * area * countArr[i]);
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(price > priceLess[i] ? price : priceLess[i]);
|
||||
priceList.add(pro);
|
||||
}
|
||||
|
||||
return priceList;
|
||||
}
|
||||
|
||||
static int pvcCountArr[] = {500, 1000, 2000, 3000, 5000, 10000};
|
||||
|
||||
public static List<Product> getPvcPrice(String size, String kind, int count, List<Product> priceList) {
|
||||
double[] price = {};
|
||||
if ("0.18mm哑白PVC".equals(kind)) {
|
||||
if ("14*44".equals(size)) {
|
||||
price = new double[]{546, 910, 1594, 2318, 3148, 6022};
|
||||
}
|
||||
if ("27.8*44".equals(size)) {
|
||||
price = new double[]{1094, 1820, 3190, 4636, 6298, 12046};
|
||||
}
|
||||
}
|
||||
if ("0.32mm哑白PVC".equals(kind)) {
|
||||
if ("14*44".equals(size)) {
|
||||
price = new double[]{712, 1242, 2242, 3286, 4500, 8700};
|
||||
}
|
||||
if ("27.8*44".equals(size)) {
|
||||
price = new double[]{1422, 2484, 4482, 6570, 9000, 17400};
|
||||
}
|
||||
}
|
||||
Product pro = new Product();
|
||||
for (int i = 0; i < pvcCountArr.length; i++) {
|
||||
if (pvcCountArr[i] < count || priceList.size() > 3) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(pvcCountArr[i]);
|
||||
pro.setPrice(price[i]);
|
||||
priceList.add(pro);
|
||||
}
|
||||
|
||||
return priceList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user