first commit
This commit is contained in:
@@ -0,0 +1,432 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A级铜版纸不干胶价格
|
||||
*/
|
||||
public class AStickersPrice {
|
||||
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000};
|
||||
|
||||
double AreaArr[] = {0.004, 0.006, 0.008, 0.01, 0.012, 0.015, 0.017, 0.018, 0.02, 0.03, 0.04, 0.06, 0.1, 0.2, 0.3};
|
||||
|
||||
// 9*5.4cm(一个名片位)以内价格
|
||||
public List<Product> oneCradPrice(int count, String role) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000};
|
||||
int[] priceArr;
|
||||
priceArr = new int[]{60, 70, 95, 125, 175, 270, 510, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2200};
|
||||
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count || list.size() > 5) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 20*1以内
|
||||
public List<Product> getPriceLess20(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {80, 90, 150, 180, 200, 240, 400, 580, 720};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 150 + 720));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 48*1以内
|
||||
public List<Product> getPriceLess48(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {90, 100, 160, 190, 230, 420, 760, 1100, 1400};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 300 + 1400));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 60*1以内
|
||||
public List<Product> getPriceLess60(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {100, 120, 180, 230, 300, 550, 960, 1300, 1600};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 400 + 1600));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 70*1以内
|
||||
public List<Product> getPriceLess70(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {110, 130, 200, 270, 330, 580, 1100, 1500, 1900};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 400 + 1900));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 80*1以内
|
||||
public List<Product> getPriceLess80(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {130, 150, 240, 300, 380, 650, 1200, 1650, 2100};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 450 + 2100));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 90*1以内
|
||||
public List<Product> getPriceLess90(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {150, 170, 245, 320, 420, 750, 1300, 1750, 2200};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 450 + 2200));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 100*1以内
|
||||
public List<Product> getPriceLess100(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000};
|
||||
int priceArr[] = {170, 200, 260, 350, 480, 860, 1400, 2000, 2600};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 600 + 2600));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 面积在0.003内
|
||||
public List<Product> getPrice(int count) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000};
|
||||
int priceArr[] = {56, 63, 84, 108, 150, 240, 456, 684, 912, 1125, 1350, 1575, 1800, 2025, 2250};
|
||||
if (count <= 40000) {
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count || list.size() > 5) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else {
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil((Math.ceil(count / 10000.0) - 4) * 200 + 850));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> f_getPrice(int priceArr[], int count, String craftMo) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product p = new Product();
|
||||
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count || list.size() > 3) {
|
||||
continue;
|
||||
}
|
||||
p = new Product();
|
||||
p.setCount(countArr[i]);
|
||||
if ("覆哑膜".equals(craftMo)) {
|
||||
p.setPrice(Math.ceil(Double.valueOf(priceArr[i]) * 1.2));
|
||||
} else {
|
||||
p.setPrice(Double.valueOf(priceArr[i]));
|
||||
}
|
||||
|
||||
list.add(p);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
// 根据面积计算价格
|
||||
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 || list.size() > 3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double[] arrPrice = new double[16];
|
||||
if (bigCountArr[i] == 500) {
|
||||
arrPrice = new double[]{37, 33, 30, 26, 25, 21, 19, 18, 17, 19, 17, 12.8, 12.5, 12, 11.5, 11};
|
||||
} else if (bigCountArr[i] == 1000) {
|
||||
arrPrice = new double[]{21, 19, 17, 17, 15, 14, 14, 12, 12, 12.5, 13, 9, 9, 8, 8, 7.8};
|
||||
} else if (bigCountArr[i] == 2000) {
|
||||
arrPrice = new double[]{14, 13, 13, 12, 11, 11, 10, 10, 9, 10, 11, 7.8, 7.5, 7.5, 7.2, 7};
|
||||
} else if (bigCountArr[i] == 3000) {
|
||||
arrPrice = new double[]{12, 11, 11, 10, 9, 9.5, 9, 8, 8, 9, 10, 6.8, 6.5, 6.5, 6, 6.5};
|
||||
} else if (bigCountArr[i] == 5000) {
|
||||
arrPrice = new double[]{10, 9.5, 8, 7.8, 8.5, 9, 8.3, 7, 8, 6.5, 8, 6, 6, 6, 5.5, 5};
|
||||
} else if (bigCountArr[i] == 10000) {
|
||||
arrPrice = new double[]{8, 7.5, 6.5, 6.5, 7.6, 8, 7.3, 6, 7.5, 6, 6, 6, 6, 6, 5, 5};
|
||||
} else if (bigCountArr[i] == 20000) {
|
||||
arrPrice = new double[]{7.6, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 30000) {
|
||||
arrPrice = new double[]{7.6, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 40000) {
|
||||
arrPrice = new double[]{7.6, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 50000) {
|
||||
arrPrice = new double[]{7.5, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 60000) {
|
||||
arrPrice = new double[]{7.5, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 70000) {
|
||||
arrPrice = new double[]{7.5, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 80000) {
|
||||
arrPrice = new double[]{7.5, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 90000) {
|
||||
arrPrice = new double[]{7.5, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
} else if (bigCountArr[i] == 100000) {
|
||||
arrPrice = new double[]{7.5, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5, 4.5};
|
||||
}
|
||||
|
||||
double pirce = getPrcieInArea(bigCountArr[i], area, arrPrice);
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(pirce));
|
||||
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 判断小尺寸是否大于大尺寸价格
|
||||
private double getPrcieInArea(int count, Double area, double[] priceArr) {
|
||||
double lastPrice = 0, price = 0;
|
||||
if (area > AreaArr[AreaArr.length - 1]) {
|
||||
price = area * count * priceArr[AreaArr.length - 1];
|
||||
lastPrice = area * count * priceArr[AreaArr.length - 2];
|
||||
if (lastPrice > price) {
|
||||
price = lastPrice;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < AreaArr.length; i++) {
|
||||
if (AreaArr[i] < area) {
|
||||
continue;
|
||||
}
|
||||
double lastArea = 0;
|
||||
if (i > 0) {
|
||||
lastArea = AreaArr[i - 1];
|
||||
lastPrice = lastArea * count * priceArr[i - 1];
|
||||
}
|
||||
price = area * count * priceArr[i];
|
||||
if (lastPrice > price) {
|
||||
price = lastPrice;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
public List<Product> getPrice(int count, Double area, String role) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
double[] priceArrA = new double[16];
|
||||
|
||||
|
||||
if (area <= 0.004) {
|
||||
priceArrA = new double[]{37.0, 21.0, 14.0, 12.0, 10.0, 8.0, 7.6, 7.6, 7.6, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5};
|
||||
} else if (area <= 0.006) {
|
||||
priceArrA = new double[]{33.0, 19.0, 13.0, 11.0, 9.5, 7.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5};
|
||||
} else if (area <= 0.008) {
|
||||
priceArrA = new double[]{30.0, 17.0, 13.0, 11.0, 8, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.01) {
|
||||
priceArrA = new double[]{26.0, 17.0, 12.0, 10.0, 7.8, 6.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.012) {
|
||||
priceArrA = new double[]{25.0, 15.0, 11.0, 9.0, 8.5, 7.6, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.015) {
|
||||
priceArrA = new double[]{21.0, 14.0, 11.0, 9.5, 9, 8, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.017) {
|
||||
priceArrA = new double[]{19.0, 14.0, 10, 9, 8.3, 7.3, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.018) {
|
||||
priceArrA = new double[]{18.0, 12.0, 10.0, 8.0, 7.0, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.02) {
|
||||
priceArrA = new double[]{17.0, 12.0, 9.0, 8.0, 8.0, 7.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.03) {
|
||||
priceArrA = new double[]{19.0, 12.5, 10.0, 9.0, 6.5, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.04) {
|
||||
priceArrA = new double[]{17.0, 13.0, 11.0, 10.0, 6.0, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.06) {
|
||||
priceArrA = new double[]{12.8, 9.0, 7.8, 6.8, 6.0, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.1) {
|
||||
priceArrA = new double[]{12.5, 9.0, 7.5, 6.5, 6.0, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.2) {
|
||||
priceArrA = new double[]{12.0, 8.0, 7.5, 6.5, 6.0, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
|
||||
} else if (area <= 0.3) {
|
||||
priceArrA = new double[]{11.5, 8.0, 7.2, 6.0, 5.5, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0};
|
||||
} else if (area > 0.3) {
|
||||
priceArrA = new double[]{11.0, 7.8, 7.0, 6.5, 5.0, 5.0, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5};
|
||||
}
|
||||
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String memoStr = "(1988074200376066673)-80x54mm-1000张-铜版纸不干胶覆膜模切-ZS-马晓光123maxiaoguang-河南省-红红-[C2+1]";
|
||||
memoStr = memoStr.replace("(", "(");
|
||||
memoStr = memoStr.replace(")", ")");
|
||||
int sIndex = memoStr.indexOf("(");
|
||||
int eIndex = memoStr.indexOf(")");
|
||||
if (sIndex == -1 || eIndex == -1) {
|
||||
return;
|
||||
}
|
||||
String first = memoStr.substring(0, sIndex + 1);
|
||||
String memoCtid = "S_C1_1988074200376066673";
|
||||
if (memoCtid.indexOf("C") != -1) {
|
||||
String CIdx = midStrEx(memoStr, "[", "]"); //C1
|
||||
if (CIdx.indexOf("+") != -1) {
|
||||
CIdx = "C" + CIdx.split("\\+")[1];
|
||||
}
|
||||
memoCtid = memoCtid.replace(CIdx + "_", ""); //去掉C1
|
||||
}
|
||||
String last = memoStr.substring(eIndex, memoStr.length());
|
||||
String newMemo = first + memoCtid + last;
|
||||
System.out.println(newMemo);
|
||||
}
|
||||
|
||||
public static String midStrEx(String source, String startStr, String endStr) {
|
||||
String result = "";
|
||||
int startIndex, endIndex;
|
||||
try {
|
||||
startIndex = source.indexOf(startStr);
|
||||
if (startIndex == -1) {
|
||||
|
||||
return result;
|
||||
}
|
||||
String tmpStr = source.substring(startIndex + startStr.length());
|
||||
endIndex = tmpStr.indexOf(endStr);
|
||||
if (endIndex == -1) {
|
||||
return result;
|
||||
}
|
||||
result = tmpStr.substring(0, endIndex);
|
||||
} catch (Exception ex) {
|
||||
System.out.println("MidStrEx Err: " + ex.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 哑膜A级铜版纸不干胶价格
|
||||
*/
|
||||
public class AYaMoStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
/**
|
||||
* 不干胶大数量遍历添加价格
|
||||
*/
|
||||
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 && area <= 0.0004) {
|
||||
Double priceArrA[] = { 450.0, 275.0, 225.0, 183.0, 160.0, 100.0, 72.0, 70.0, 60.0, 55.0, 49.0, 43.0, 37.0,
|
||||
35.0, 34.0, 33.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0004 && area <= 0.0006) {
|
||||
Double priceArrA[] = { 300.0, 183.0, 150.0, 122.0, 106.0, 67.0, 62.0, 48.0, 42.0, 39.0, 38.0, 37.0, 36.0,
|
||||
35.0, 33.0, 33.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0006 && area <= 0.0008) {
|
||||
Double priceArrA[] = { 257.0, 157.0, 128.0, 105.0, 91.0, 57.0, 48.0, 40.0, 32.0, 32.0, 31.0, 30.0, 29.0,
|
||||
28.0, 27.0, 26.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0008 && area <= 0.001) {
|
||||
Double priceArrA[] = { 200.0, 122.0, 100.0, 81.0, 71.0, 45.0, 41.0, 32.0, 27.0, 26.0, 25.0, 24.0, 23.0,
|
||||
22.0, 21.0, 20.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.001 && area <= 0.0012) {
|
||||
Double priceArrA[] = { 150.0, 92.0, 75.0, 61.0, 53.0, 45.0, 35.0, 28.0, 23.0, 22.0, 21.0, 20.0, 19.0, 18.0,
|
||||
17.0, 16.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0012 && area <= 0.0014) {
|
||||
Double priceArrA[] = { 138.0, 85.0, 69.0, 62.0, 51.0, 38.0, 30.0, 25.0, 21.0, 20.0, 19.0, 18.0, 17.0, 16.0,
|
||||
15.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0014 && area <= 0.0016) {
|
||||
Double priceArrA[] = { 120.0, 73.0, 67.0, 53.0, 47.0, 33.0, 20.0, 19.0, 17.0, 17.0, 17.0, 16.0, 15.0, 14.0,
|
||||
13.0, 13.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0016 && area <= 0.0025) {
|
||||
Double priceArrA[] = { 117.0, 71.0, 67.0, 51.0, 44.0, 29.0, 14.0, 13.0, 12.5, 12.0, 11.0, 11.0, 10.5, 10.0,
|
||||
10.0, 9.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0025 && area <= 0.0035) {
|
||||
Double priceArrA[] = { 110.0, 65.0, 63.0, 46.0, 37.0, 27.0, 13.5, 11.5, 11.5, 11.5, 11.0, 11.0, 11.0, 10.0,
|
||||
9.5, 9.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0035 && area <= 0.0045) {
|
||||
Double priceArrA[] = { 84.0, 50.0, 44.0, 33.0, 25.0, 19.0, 12.0, 11.0, 11.0, 11.0, 10.0, 10.0, 10.0, 9.5,
|
||||
9.5, 9.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0045 && area <= 0.0084) {
|
||||
Double priceArrA[] = { 56.0, 35.0, 29.0, 26.0, 19.0, 16.0, 11.0, 11.0, 10.5, 10.5, 10.0, 10.0, 9.0, 9.0,
|
||||
9.0, 8.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0084 && area <= 0.012) {
|
||||
Double priceArrA[] = { 42.0, 26.0, 23.0, 18.0, 14.0, 12.0, 11.0, 11.0, 9.0, 8.0, 7.5, 7.5, 7.5, 7.5, 7.5,
|
||||
7.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.012 && area <= 0.015) {
|
||||
Double priceArrA[] = { 36.0, 25.0, 22.0, 17.0, 14.0, 12.0, 9.0, 9.0, 8.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0,
|
||||
7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.015 && area <= 0.02) {
|
||||
Double priceArrA[] = { 35.0, 24.0, 21.0, 17.0, 14.0, 12.0, 9.0, 9.0, 8.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0,
|
||||
7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.02 && area <= 0.06) {
|
||||
Double priceArr[] = { 32.0, 23.0, 21.0, 17.0, 14.0, 12.0, 9.0, 9.0, 8.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0,
|
||||
7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.06 && area <= 0.1) {
|
||||
Double priceArr[] = { 17.0, 12.0, 11.0, 10.0, 9.0, 9.0, 8.2, 8.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.1 && area <= 0.2) {
|
||||
Double priceArr[] = { 13.0, 10.0, 9.0, 8.0, 6.5, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.2 && area <= 0.3) {
|
||||
Double priceArr[] = { 11.0, 8.0, 7.5, 7.0, 6.5, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.3) {
|
||||
Double priceArr[] = { 10.0, 7.0, 6.5, 6.0, 6.0, 6.0, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AngClothUtil {
|
||||
|
||||
public static List<Product> getPrice(Double area, int count, List<Product> priceList, String[] craft) {
|
||||
area = area * count;
|
||||
Product pro = null;
|
||||
double basePrice = 0;
|
||||
double price = 0;
|
||||
double mince = 45;
|
||||
if (area <= 1) {
|
||||
basePrice = 60;
|
||||
} else if (area <= 2) {
|
||||
basePrice = 55;
|
||||
} else if (area <= 3) {
|
||||
basePrice = 50;
|
||||
} else if (area <= 4) {
|
||||
basePrice = 45;
|
||||
} else if (area <= 5) {
|
||||
basePrice = 40;
|
||||
} else if (area <= 10) {
|
||||
basePrice = 36;
|
||||
} else {
|
||||
basePrice = 33;
|
||||
}
|
||||
price = Math.ceil(basePrice * area);
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.max(price, mince));
|
||||
priceList.add(pro);
|
||||
return priceList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BqPrice {
|
||||
public List<Product> getPrice(int count, Double length, List<Product> list, Integer number, String craftShua, String[] craft) {
|
||||
double dj = 0;
|
||||
if (length == 96 || length == 120) {
|
||||
if (craftShua.equals("单面印刷")) {
|
||||
dj = 45;
|
||||
} else {
|
||||
dj = 60;
|
||||
}
|
||||
} else if (length == 192) {
|
||||
if (craftShua.equals("单面印刷")) {
|
||||
dj = 57;
|
||||
} else {
|
||||
dj = 75;
|
||||
}
|
||||
} else if (length == 144) {
|
||||
if (craftShua.equals("单面印刷")) {
|
||||
dj = 49;
|
||||
} else {
|
||||
dj = 70;
|
||||
}
|
||||
} else if (length == 240) {
|
||||
if (craftShua.equals("单面印刷")) {
|
||||
dj = 96;
|
||||
} else {
|
||||
dj = 125;
|
||||
}
|
||||
} else {
|
||||
if (craftShua.equals("单面印刷")) {
|
||||
dj = 111;
|
||||
} else {
|
||||
dj = 144;
|
||||
}
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(craft) && craft[0].equals("旗杆")) {
|
||||
dj += 15;
|
||||
}
|
||||
dj += 5;
|
||||
Product pro = new Product();
|
||||
pro.setPrice(Math.ceil(dj * count * number * 1.2));
|
||||
pro.setCount(count);
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CanopyUtil {
|
||||
|
||||
public static List<Product> getPrice(Double area, int count, List<Product> priceList, String kindvalue, String craft) {
|
||||
Product pro = null;
|
||||
double price = 0;
|
||||
area = area * count;//计算总面积
|
||||
double basePrice = 0;
|
||||
double[] priceArr = getBasePrice(kindvalue, craft);
|
||||
if (priceArr.length == 0) {
|
||||
return priceList;
|
||||
}
|
||||
if (area <= 4) {
|
||||
basePrice = priceArr[0];
|
||||
} else if (area <= 6) {
|
||||
basePrice = priceArr[1];
|
||||
} else if (area <= 9) {
|
||||
basePrice = priceArr[2];
|
||||
} else {
|
||||
basePrice = priceArr[3];
|
||||
}
|
||||
double mince = getMinPrice(kindvalue, craft);
|
||||
price = Math.ceil(basePrice * area);
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.max(price, mince));
|
||||
pro.setWeight(String.valueOf(area * 0.18));
|
||||
priceList.add(pro);
|
||||
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private static double[] getBasePrice(String kindvalue, String craft) {
|
||||
List<String> craftList = craft != null ? Collections.singletonList(craft) : new ArrayList<>();
|
||||
if ("银胶涤纶布".equals(kindvalue)) {
|
||||
if (craftList.contains("定制")) {
|
||||
return new double[]{27, 26, 25, 24.5};
|
||||
} else {
|
||||
return new double[]{12.5, 11.5, 11, 10};
|
||||
}
|
||||
}
|
||||
if ("黑胶涤纶布".equals(kindvalue)) {
|
||||
if (craftList.contains("定制")) {
|
||||
return new double[]{29, 28, 27, 26};
|
||||
} else {
|
||||
return new double[]{14.5, 13.5, 13, 12};
|
||||
}
|
||||
}
|
||||
return new double[]{};
|
||||
}
|
||||
|
||||
private static double getMinPrice(String kindvalue, String craft) {
|
||||
List<String> craftList = craft != null ? Collections.singletonList(craft) : new ArrayList<>();
|
||||
if ("银胶涤纶布".equals(kindvalue)) {
|
||||
if (craftList.contains("定制")) {
|
||||
return 80;
|
||||
} else {
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
if ("黑胶涤纶布".equals(kindvalue)) {
|
||||
if (craftList.contains("定制")) {
|
||||
return 80;
|
||||
} else {
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
public class CardPrice {
|
||||
int countArr[] = { 500, 1000, 2000, 3000, 5000, 10000};
|
||||
|
||||
public List<Product> getCardPrice(int count, Double area, List<Product> list, Double[] priceArr, String kind) {
|
||||
Product pro = new Product();
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
if(kind.equals("1")) {
|
||||
priceArr[i] += 2;
|
||||
}
|
||||
if(area == 0.0012) {
|
||||
pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i])+20);
|
||||
}else {
|
||||
pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i]));
|
||||
}
|
||||
|
||||
list.add(pro);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//1万以上报价
|
||||
public List<Product> getMorePrice(int count, Double area) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
double dj = 0;
|
||||
if (area <= 0.0016) {
|
||||
dj = 76.0;
|
||||
} else if (area <= 0.0024) {
|
||||
dj = 43.0;
|
||||
} else if (area <= 0.0028) {
|
||||
dj = 38.0;
|
||||
} else if (area <= 0.0032) {
|
||||
dj = 37.0;
|
||||
} else if (area <= 0.0036) {
|
||||
dj = 30.0;
|
||||
} else if (area <= 0.005) {
|
||||
dj = 29.0;
|
||||
} else if (area <= 0.006) {
|
||||
dj = 28.0;
|
||||
} else if (area <= 0.009) {
|
||||
dj = 27.0;
|
||||
} else if (area <= 0.014) {
|
||||
dj = 20.0;
|
||||
} else if (area <= 0.021) {
|
||||
dj = 20.0;
|
||||
} else if (area <= 0.025) {
|
||||
dj = 19.0;
|
||||
} else if (area <= 0.12) {
|
||||
dj = 17.0;
|
||||
}
|
||||
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(dj * 10000 * area * 1.6));
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
// 1万以下报价
|
||||
public List<Product> getPrice(int count, Double area, String kind) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (area <= 0.0009) {
|
||||
Double priceArrA[] = { 226.0, 142.0, 110.0, 86.0, 92.0, 76.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0016) {
|
||||
Double priceArrA[] = { 158.0, 106.0, 82.0, 86.0, 84.0, 76.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0024) {
|
||||
Double priceArrA[] = { 80.0, 56.0, 56.0, 45.0, 43.0, 43.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0028) {
|
||||
Double priceArrA[] = { 76.0, 52.0, 50.0, 45.0, 43.0, 38.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0032) {
|
||||
Double priceArrA[] = { 69.0, 51.0, 49.0, 44.0, 42.0, 37.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0036) {
|
||||
Double priceArrA[] = { 60.0, 48.0, 45.0, 40.0, 35.0, 35.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0039) {
|
||||
Double priceArrA[] = { 50.0, 45.0, 40.0, 35.0, 30.0, 30.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0044) {
|
||||
Double priceArrA[] = { 75.0, 70.0, 60.0, 58.0, 56.0, 55.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.0048) {
|
||||
Double priceArrA[] = { 48.0, 44.0, 34.0, 35.0, 30.0, 30.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.005) {
|
||||
Double priceArrA[] = { 45.0, 40.0, 34.0, 35.0, 30.0, 30.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.006) {
|
||||
Double priceArrA[] = { 40.0, 35.0, 33.0, 32.0, 28.0, 28.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.009) {
|
||||
Double priceArrA[] = { 39.0, 34.0, 32.0, 31.0, 27.0, 37.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.014) {
|
||||
Double priceArrA[] = { 33.0, 28.0, 25.0, 23.0, 20.0, 20.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.021) {
|
||||
Double priceArrA[] = { 32.0, 28.0, 24.0, 22.0, 20.0, 20.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.025) {
|
||||
Double priceArrA[] = { 30.0, 26.0, 22.0, 20.0, 19.0, 19.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
} else if (area <= 0.12) {
|
||||
Double priceArrA[] = { 26.0, 23.0, 20.0, 18.0, 17.0, 17.0};
|
||||
list = getCardPrice(count, area, list, priceArrA, kind);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/*菜单报价
|
||||
* kind 材质
|
||||
* size 尺寸
|
||||
* count 数量
|
||||
* number 款数
|
||||
* craft 工艺
|
||||
* */
|
||||
public List<Product> getMenuPrice(String kind, String size, int count, int number, String[] craft) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
double price = 0;
|
||||
int type = 0;
|
||||
int num = count * number;
|
||||
for(int i = 0;i < craft.length; i++) {
|
||||
if(craft[i].equals("单面过塑")) {
|
||||
type = 1;
|
||||
}else if(craft[i].equals("双面过塑")) {
|
||||
type = 2;
|
||||
}
|
||||
}
|
||||
if(kind.equals("1")) {//300克铜版纸菜单
|
||||
if(size.equals("21*14")) {
|
||||
if(type == 1) {
|
||||
price = 110 + 15 * num;
|
||||
}else {
|
||||
price = 110 + 16 * num;
|
||||
}
|
||||
}else if(size.equals("21*28.5")) {
|
||||
if(type == 1) {
|
||||
price = 120 + 15 * num;
|
||||
}else {
|
||||
price = 120 + 16 * num;
|
||||
}
|
||||
}else {
|
||||
if(type == 1) {
|
||||
price = 130 + 20 * num;
|
||||
}else {
|
||||
price = 130 + 22 * num;
|
||||
}
|
||||
}
|
||||
}else {//pvc菜单
|
||||
if(size.equals("21*14")) {
|
||||
if(type == 1) {
|
||||
price = 120 + 18 * num;
|
||||
}else {
|
||||
price = 120 + 20 * num;
|
||||
}
|
||||
}else {
|
||||
if(type == 1) {
|
||||
price = 125 + 20 * num;
|
||||
}else {
|
||||
price = 125 + 30 * num;
|
||||
}
|
||||
}
|
||||
}
|
||||
Product pro = new Product();
|
||||
pro.setPrice(Math.ceil(price));
|
||||
pro.setCount(count);
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券/贺卡价格
|
||||
*/
|
||||
public class CouponPrice {
|
||||
|
||||
int countArr[] = {200, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000};
|
||||
|
||||
int countArr2[] = {200, 500, 1000, 2000, 3000, 5000, 10000};
|
||||
|
||||
|
||||
/**
|
||||
* 遍历添加价格
|
||||
*/
|
||||
private List<Product> setPrice(int count, int min, List<Product> list, Double[] priceArr) {
|
||||
Product pro = new Product();
|
||||
if (min <= 4) {
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
} else if (min > 4) {
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(priceArr[i] * min);
|
||||
list.add(pro);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice(int count, int min) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (min == 1) {
|
||||
Double priceArrA[] = {35.0, 40.0, 60.0, 100.0, 150.0, 180.0, 200.0, 240.0, 280.0, 320.0, 360.0, 380.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 2) {
|
||||
Double priceArrA[] = {65.0, 70.0, 80.0, 130.0, 180.0, 240.0, 320.0, 380.0, 440.0, 500.0, 520.0, 540.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 3) {
|
||||
Double priceArrA[] = {90.0, 100.0, 120.0, 180.0, 280.0, 380.0, 480.0, 570.0, 670.0, 780.0, 840.0, 880.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 4) {
|
||||
Double priceArrA[] = {120.0, 120.0, 150.0, 240.0, 320.0, 400.0, 480.0, 600.0, 680.0, 800.0, 1040.0, 1080.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 5) {
|
||||
Double priceArrA[] = {26.0, 32.0, 36.0, 52.0, 76.0, 90.0, 116.0, 136.0, 150.0, 180.0, 220.0, 225.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min > 5 && min <= 9) {
|
||||
Double priceArrA[] = {24.0, 25.0, 30.0, 50.0, 70.0, 85.0, 105.0, 135.0, 150.0, 180.0, 200.0, 210.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 10) {
|
||||
Double priceArrA[] = {22.0, 23.0, 30.0, 50.0, 70.0, 85.0, 105.0, 135.0, 150.0, 180.0, 200.0, 210.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min > 10 && min <= 20) {
|
||||
Double priceArrA[] = {20.0, 20.0, 28.0, 48.0, 70.0, 85.0, 100.0, 135.0, 150.0, 180.0, 200.0, 200.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min > 20 && min < 30) {
|
||||
Double priceArrA[] = {15.0, 18.0, 24.0, 45.0, 70.0, 85.0, 95.0, 135.0, 150.0, 180.0, 190.0, 190.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 30) {
|
||||
Double priceArrA[] = {14.0, 17.0, 23.0, 44.0, 69.0, 84.0, 92.0, 132.0, 147.0, 176.0, 185.0, 185.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 40) {
|
||||
Double priceArrA[] = {13.0, 16.0, 22.0, 43.0, 68.0, 83.0, 90.0, 130.0, 145.0, 174.0, 180.0, 180.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
} else if (min == 50) {
|
||||
Double priceArrA[] = {12.0, 15.0, 21.0, 42.0, 66.0, 83.0, 88.0, 128.0, 143.0, 170.0, 175.0, 175.0};
|
||||
list = setPrice(count, min, list, priceArrA);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
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) {
|
||||
Product product = null;
|
||||
List<Product> products = new ArrayList<>();
|
||||
int[] priceArr = {20, 28, 52, 100, 155, 165, 250};
|
||||
|
||||
double minPrice = 0.00;
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
minPrice = 60.00;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
minPrice = 55.00;
|
||||
}
|
||||
dto.setNumber(dto.getNumber() == null || dto.getNumber() == 0 ? 1 : dto.getNumber());
|
||||
for (int i = 0; i < countArr2.length; i++) {
|
||||
product = new Product();
|
||||
if (count > countArr2[i] || products.size() >= 3) {
|
||||
continue;
|
||||
}
|
||||
Double price = this.price(min, dto, countArr2[i], Double.valueOf(priceArr[i]), minPrice);
|
||||
|
||||
product.setPrice(price);
|
||||
product.setCount(countArr2[i]);
|
||||
products.add(product);
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
private Double price(int min, Product dto, int count, double basePrice, double minPrice) {
|
||||
//200张以内16元/款/单,200张以上24元/款/单
|
||||
int price = count <= 200 ? 16 * dto.getNumber() : 20 * dto.getNumber();
|
||||
if (min == 1) {
|
||||
price = count <= 200 ? 19 * dto.getNumber() : 25 * dto.getNumber();
|
||||
}
|
||||
double minW = min;
|
||||
if (minW > 1) {
|
||||
minW = minW - 0.5;
|
||||
}
|
||||
double 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;
|
||||
List<Double> chu_list = new ArrayList<>();
|
||||
|
||||
//0贴膜1配膜
|
||||
for (int i = 0; i < size_list.length; i++) {
|
||||
if ("60*25".equals(size_list[i])) {
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
chu = 0.12 * count;
|
||||
chu = chu < 30 ? 30 : chu;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
chu = 0.08 * count;
|
||||
chu = chu < 20 ? 20 : chu;
|
||||
}
|
||||
} else if ("8*36".equals(size_list[i]) || "18*32".equals(size_list[i]) || "15*48".equals(size_list[i])) {
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
chu = 0.1 * count;
|
||||
chu = chu < 30 ? 30 : chu;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
chu = 0.07 * count;
|
||||
chu = chu < 20 ? 20 : chu;
|
||||
}
|
||||
} else if ("35*58".equals(size_list[i])) {
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
chu = 0.22 * count;
|
||||
chu = chu < 100 ? 100 : chu;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
chu = 0.14 * count;
|
||||
chu = chu < 50 ? 50 : chu;
|
||||
}
|
||||
} else if ("41*72".equals(size_list[i])) {
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
chu = 0.24 * count;
|
||||
chu = chu < 100 ? 100 : chu;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
chu = 0.16 * count;
|
||||
chu = chu < 50 ? 50 : chu;
|
||||
}
|
||||
} else if ("70*50".equals(size_list[i])) {
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
chu = 0.26 * count;
|
||||
chu = chu < 100 ? 100 : chu;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
chu = 0.18 * count;
|
||||
chu = chu < 50 ? 50 : chu;
|
||||
}
|
||||
} else {
|
||||
//正常规格
|
||||
if ("0".equals(dto.getFmType())) {
|
||||
chu = count <= 10000 ? 0.05 * count : 0.03 * count;
|
||||
chu = chu < 30 ? 30 : chu;
|
||||
}
|
||||
if ("1".equals(dto.getFmType())) {
|
||||
chu = 0.04 * count;
|
||||
chu = chu < 20 ? 20 : chu;
|
||||
}
|
||||
}
|
||||
chu_list.add(chu);
|
||||
}
|
||||
if (dto.getAwards() == 1 && count == 500) {//只有一个奖项时500和200价格相同 500+5
|
||||
minPrice = minPrice + 5;
|
||||
}
|
||||
Collections.sort(chu_list);
|
||||
for (Double aDouble : chu_list) {
|
||||
if (total_chu > 0.00) {
|
||||
total_chu = total_chu + aDouble * dto.getNumber();
|
||||
}else{
|
||||
total_chu = Math.max(v + aDouble * dto.getNumber(), minPrice);
|
||||
}
|
||||
}
|
||||
total_chu = Math.round(total_chu);
|
||||
|
||||
return total_chu;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class DateFormatUtils {
|
||||
|
||||
// 开始日期
|
||||
public String formatBeginTime(String add_time_begin) {
|
||||
// 按日期范围统计
|
||||
if (add_time_begin.length() > 20 && !add_time_begin.contains("~")) {
|
||||
return add_time_begin.substring(0, 10);
|
||||
}
|
||||
// 按周统计
|
||||
if (add_time_begin.contains("~")) {
|
||||
String[] dates = add_time_begin.split("~");
|
||||
return dates[0];
|
||||
} // 按月统计
|
||||
else if (add_time_begin.length() == 7) {
|
||||
return add_time_begin + "-01";
|
||||
} // 按季度统计
|
||||
else if (add_time_begin.length() == 6) {
|
||||
String subYear = add_time_begin.substring(0, 4);
|
||||
if (add_time_begin.contains("-1")) {
|
||||
return subYear + "-01-01";
|
||||
} else if (add_time_begin.contains("-2")) {
|
||||
return subYear + "-04-01";
|
||||
} else if (add_time_begin.contains("-3")) {
|
||||
return subYear + "-07-01";
|
||||
} else {
|
||||
return subYear + "-10-01";
|
||||
}
|
||||
} // 按年统计
|
||||
else if (add_time_begin.length() == 4) {
|
||||
return add_time_begin + "-01-01";
|
||||
} else { // 按日统计
|
||||
return add_time_begin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 结束日期
|
||||
public String formatEndTime(String add_time_begin) {
|
||||
// 按日期范围统计
|
||||
if (add_time_begin.length() > 20 && !add_time_begin.contains("~")) {
|
||||
return add_time_begin.substring(13) + " 23:59:59";
|
||||
}
|
||||
// 按周统计
|
||||
if (add_time_begin.contains("~")) {
|
||||
String[] dates = add_time_begin.split("~");
|
||||
return dates[1];
|
||||
}
|
||||
// 按月统计
|
||||
else if (add_time_begin.length() == 7) {
|
||||
return add_time_begin + "-31";
|
||||
}
|
||||
// 按季度统计
|
||||
else if (add_time_begin.length() == 6) {
|
||||
String subYear = add_time_begin.substring(0, 4);
|
||||
if (add_time_begin.contains("-1")) {
|
||||
return subYear + "-03-31";
|
||||
} else if (add_time_begin.contains("-2")) {
|
||||
return subYear + "-06-30";
|
||||
} else if (add_time_begin.contains("-3")) {
|
||||
return subYear + "-09-30";
|
||||
} else {
|
||||
return subYear + "-12-31";
|
||||
}
|
||||
}
|
||||
// 按年统计
|
||||
else if (add_time_begin.length() == 4) {
|
||||
return add_time_begin + "-12-31";
|
||||
} else {// 按日统计
|
||||
if (StringUtils.isEmpty(add_time_begin))
|
||||
return add_time_begin;
|
||||
return add_time_begin + " 23:59:59";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算俩个日期间隔的时间
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static long getSubtractiveDays(Date date1, Date date2) {
|
||||
long nano = (Date
|
||||
.from(LocalDateTime.ofInstant(date2.toInstant(), ZoneId.systemDefault()).atZone(ZoneId.systemDefault())
|
||||
.withHour(0).withMinute(0).withSecond(0).withNano(0).toInstant())
|
||||
.getTime()
|
||||
- Date.from(LocalDateTime.ofInstant(date1.toInstant(), ZoneId.systemDefault())
|
||||
.atZone(ZoneId.systemDefault()).withHour(0).withMinute(0).withSecond(0).withNano(0).toInstant())
|
||||
.getTime());
|
||||
return nano / (1000 * 3600 * 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算俩个日期间隔的时间
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static int getDay(Date date1, Date date2) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date1);
|
||||
long time1 = cal.getTimeInMillis();
|
||||
cal.setTime(date2);
|
||||
long time2 = cal.getTimeInMillis();
|
||||
long between_days = (time2 - time1) / (1000 * 3600 * 24);
|
||||
return Integer.parseInt(String.valueOf(between_days));
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算俩个日期间隔的时间
|
||||
*
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static String getDatePoor(Date endDate, Date nowDate) {
|
||||
|
||||
long nd = 1000 * 24 * 60 * 60;// 每天毫秒数
|
||||
|
||||
long nh = 1000 * 60 * 60;// 每小时毫秒数
|
||||
|
||||
long nm = 1000 * 60;// 每分钟毫秒数
|
||||
|
||||
long diff = endDate.getTime() - nowDate.getTime(); // 获得两个时间的毫秒时间差异
|
||||
|
||||
long day = diff / nd; // 计算差多少天
|
||||
|
||||
long hour = diff % nd / nh; // 计算差多少小时
|
||||
|
||||
long min = diff % nd % nh / nm; // 计算差多少分钟
|
||||
|
||||
return day + "天" + hour + "小时" + min + "分钟";
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算俩个日期间隔的时间
|
||||
*
|
||||
* @param date1 字符串日期
|
||||
* @param date2 字符串日期
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static String getDay(String date1, String date2) throws ParseException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date d1 = sdf.parse(date1);
|
||||
Date d2 = sdf.parse(date2);
|
||||
|
||||
long daysBetween = (long) ((d1.getTime() - d2.getTime()) / (60 * 60 * 24 * 1000));
|
||||
System.out.println(date1 + " 与 " + date2 + "间隔 " + daysBetween + " 天");
|
||||
return date1 + " 与 " + date2 + "间隔 " + daysBetween + " 天";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
||||
import lingtao.net.bean.SysUser;
|
||||
|
||||
public class ExcelUtils {
|
||||
|
||||
private final static String excel2003L = ".xls"; // 2003- 版本的excel
|
||||
private final static String excel2007U = ".xlsx"; // 2007+ 版本的excel
|
||||
|
||||
/**
|
||||
* 描述:获取IO流中的数据,组装成List<List<Object>>对象
|
||||
*
|
||||
* @param in,fileName
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public List<List<Object>> getBankListByExcel(InputStream in, String fileName) throws Exception {
|
||||
List<List<Object>> list = null;
|
||||
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// 创建Excel工作薄
|
||||
Workbook work = this.getWorkbook(in, fileName);
|
||||
if (null == work) {
|
||||
throw new Exception("创建Excel工作薄为空!");
|
||||
}
|
||||
Sheet sheet = null; // 页数
|
||||
Row row = null; // 行数
|
||||
Cell cell = null; // 列数
|
||||
|
||||
list = new ArrayList<List<Object>>();
|
||||
// 遍历Excel中所有的sheet
|
||||
for (int i = 0; i < work.getNumberOfSheets(); i++) {
|
||||
sheet = work.getSheetAt(i);
|
||||
if (sheet == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 遍历当前sheet中的所有行
|
||||
for (int j = sheet.getFirstRowNum(); j <= sheet.getLastRowNum(); j++) {
|
||||
row = sheet.getRow(j);
|
||||
if (user.getRole().contains("1050")) {
|
||||
if (row == null || row.getFirstCellNum() == j) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (row == null) {// ||row.getFirstCellNum()==j 第一行不要
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历所有的列
|
||||
List<Object> li = new ArrayList<Object>();
|
||||
for (int y = row.getFirstCellNum(); y < row.getLastCellNum(); y++) {
|
||||
cell = row.getCell(y);
|
||||
li.add(this.getValue(cell));
|
||||
}
|
||||
list.add(li);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:根据文件后缀,自适应上传文件的版本
|
||||
*
|
||||
* @param inStr,fileName
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Workbook getWorkbook(InputStream inStr, String fileName) throws Exception {
|
||||
Workbook wb = null;
|
||||
String fileType = fileName.substring(fileName.lastIndexOf("."));
|
||||
if (excel2003L.equals(fileType)) {
|
||||
wb = new HSSFWorkbook(inStr); // 2003-
|
||||
} else if (excel2007U.equals(fileType)) {
|
||||
wb = new XSSFWorkbook(inStr); // 2007+
|
||||
} else {
|
||||
throw new Exception("解析的文件格式有误!");
|
||||
}
|
||||
return wb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:对表格中数值进行格式化
|
||||
*
|
||||
* @param cell
|
||||
* @return
|
||||
*/
|
||||
// 解决excel类型问题,获得数值
|
||||
public String getValue(Cell cell) {
|
||||
String value = "";
|
||||
if (null == cell) {
|
||||
return value;
|
||||
}
|
||||
switch (cell.getCellType()) {
|
||||
// 数值型
|
||||
case Cell.CELL_TYPE_NUMERIC:
|
||||
if (HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
// 如果是date类型则 ,获取该cell的date值
|
||||
Date date = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
value = format.format(date);
|
||||
;
|
||||
} else {// 纯数字
|
||||
BigDecimal big = new BigDecimal(cell.getNumericCellValue());
|
||||
value = big.toString();
|
||||
// 解决1234.0 去掉后面的.0
|
||||
if (null != value && !"".equals(value.trim())) {
|
||||
String[] item = value.split("[.]");
|
||||
if (1 < item.length && "0".equals(item[1])) {
|
||||
value = item[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// 字符串类型
|
||||
case Cell.CELL_TYPE_STRING:
|
||||
value = cell.getStringCellValue().toString();
|
||||
break;
|
||||
// 公式类型
|
||||
case Cell.CELL_TYPE_FORMULA:
|
||||
// 读公式计算值
|
||||
value = String.valueOf(cell.getNumericCellValue());
|
||||
if (value.equals("NaN")) {// 如果获取的数据值为非法值,则转换为获取字符串
|
||||
value = cell.getStringCellValue().toString();
|
||||
}
|
||||
break;
|
||||
// 布尔类型
|
||||
case Cell.CELL_TYPE_BOOLEAN:
|
||||
value = " " + cell.getBooleanCellValue();
|
||||
break;
|
||||
default:
|
||||
value = cell.getStringCellValue().toString();
|
||||
}
|
||||
if ("null".endsWith(value.trim())) {
|
||||
value = "";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
public class FerruleUtil {//会员卡卡套
|
||||
int countList[] = {100, 200, 300, 500, 1000};
|
||||
double priceList[] = new double[5];
|
||||
public List<Product> getPrice(double length, int count, List<Product> list) {
|
||||
|
||||
if(length == 19.5) {
|
||||
priceList = new double[]{800, 1500, 1950, 2500, 4000};
|
||||
}else if(length == 15.5) {
|
||||
priceList = new double[]{600, 1100, 1500, 2000, 3000};
|
||||
}else{
|
||||
priceList = new double[]{600, 1000, 1180, 1680, 2800};
|
||||
}
|
||||
|
||||
for(int i = 0;i< countList.length;i++) {
|
||||
if(countList[i] < count || list.size() > 2) {
|
||||
continue;
|
||||
}
|
||||
Product pro = new Product();
|
||||
pro.setPrice(priceList[i]);
|
||||
pro.setCount(countList[i]);
|
||||
list.add(pro);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
public class FgqPrice {
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
/**仿古旗报价*/
|
||||
public List<Product> getPrice(int count, Double area, List<Product> list,String[] craftList, String kind, int num) {
|
||||
Product pro = new Product();
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
String craft = craftList[0];
|
||||
double dj = 0,wei = 0;
|
||||
if(kind.equals("1")) {
|
||||
if(craft.equals("单面")) {
|
||||
dj = 90;
|
||||
wei = 0.065;
|
||||
}else {
|
||||
dj = 100;
|
||||
wei = 0.195;
|
||||
}
|
||||
}else {
|
||||
if(craft.equals("单面")) {
|
||||
dj = 100;
|
||||
wei = 0.165;
|
||||
}else {
|
||||
dj = 135;
|
||||
wei = 0.33;
|
||||
}
|
||||
}
|
||||
|
||||
double price = Math.ceil(area * dj);
|
||||
pro.setPrice(price);
|
||||
pro.setWeight(df.format(area * wei * num));
|
||||
list.add(pro);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**手拉旗报价*/
|
||||
public List<Product> getSlqPrice(int count, List<Product> list) {
|
||||
Product pro = new Product();
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(30 * count));
|
||||
list.add(pro);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getSlqSpeicPrice(int count, List<Product> list, int type) {
|
||||
Product pro = new Product();
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
if(type == 1) {
|
||||
pro.setPrice(Math.ceil(16 * count));
|
||||
}else {
|
||||
pro.setPrice(Math.ceil(12 * count));
|
||||
}
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 格底珠光膜不干胶价格
|
||||
*/
|
||||
public class GDZGMStickersPrice {
|
||||
|
||||
int countArr[] = { 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000,
|
||||
60000, 70000, 80000, 90000, 100000 };
|
||||
|
||||
/**
|
||||
* 5*5cm以内(含)
|
||||
*
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice5x5(int count) {
|
||||
int priceArr[] = { 180, 200, 240, 280, 320, 380, 420, 460, 500, 540, 620, 1000, 1600, 2100, 2500, 3000, 3500,
|
||||
4000, 4500, 5000 };
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
// 每一万张增加500元
|
||||
pro.setPrice((Math.ceil(count / 100000.0) - 1) * 450 + 5000);
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 9*5.4cm 以内
|
||||
*
|
||||
* @param count
|
||||
* @param area 单个产品的面积(平方米)
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice9x5(int count, Double area) {
|
||||
int priceArr[] = { 200, 240, 320, 380, 440, 500, 620, 700, 800, 900, 1000, 1750, 2400, 3200, 4000, 4800, 5400,
|
||||
6000, 6600, 7200 };
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
// 每平方17元
|
||||
pro.setPrice(Math.ceil(area * count * 17));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> acountPrice9xup(int count, Double area) {
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
double price = 0.0;
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(area * count * 20));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
if (area * countArr[i] <= 3) {
|
||||
price = 85;
|
||||
} else if (area * countArr[i] > 3 && area * countArr[i] <= 5) {
|
||||
price = 70;
|
||||
} else if (area * countArr[i] > 5 && area * countArr[i] <= 8) {
|
||||
price = 50;
|
||||
} else if (area * countArr[i] > 8 && area * countArr[i] <= 10) {
|
||||
price = 37;
|
||||
} else if (area * countArr[i] > 10 && area * countArr[i] <= 15) {
|
||||
price = 35;
|
||||
} else if (area * countArr[i] > 15 && area * countArr[i] <= 25) {
|
||||
price = 30;
|
||||
} else if (area * countArr[i] > 25 && area * countArr[i] <= 30) {
|
||||
price = 26;
|
||||
} else if (area * countArr[i] > 30 && area * countArr[i] <= 100) {
|
||||
price = 25;
|
||||
} else if (area * countArr[i] > 100 && area * countArr[i] <= 500) {
|
||||
price = 22;
|
||||
} else {
|
||||
price = 20;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(countArr[i] * area * price));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> acountYaMoPrice9x5(int count, Double area) {
|
||||
int priceArr[] = { 520, 540, 560, 600, 640, 680, 740, 800, 860, 940, 1100, 1800, 2500, 3300, 4100, 4900, 5500,
|
||||
6100, 6700, 7400 };
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
// 每平方18元
|
||||
pro.setPrice(Math.ceil(area * count * 18));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> acountYamoPrice9xup(int count, Double area) {
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
double price = 0.0;
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(area * count * 20));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
if (area * countArr[i] <= 15) {
|
||||
price = 0;
|
||||
} else if (area * countArr[i] > 15 && area * countArr[i] <= 25) {
|
||||
price = 32;
|
||||
} else if (area * countArr[i] > 25 && area * countArr[i] <= 30) {
|
||||
price = 28;
|
||||
} else if (area * countArr[i] > 30 && area * countArr[i] <= 100) {
|
||||
price = 27;
|
||||
} else if (area * countArr[i] > 100 && area * countArr[i] <= 500) {
|
||||
price = 24;
|
||||
} else {
|
||||
price = 22;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(countArr[i] * area * price) > 600 ? Math.ceil(countArr[i] * area * price) : 600);
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import eu.bitwalker.useragentutils.Browser;
|
||||
import eu.bitwalker.useragentutils.OperatingSystem;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
import eu.bitwalker.useragentutils.Version;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class IPUtils {
|
||||
/**
|
||||
* 获取登录用户的IP地址
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static String getIpAddr(HttpServletRequest request) {
|
||||
if (request == null) {
|
||||
return "unknown";
|
||||
}
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("X-Forwarded-For");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("X-Real-IP");
|
||||
}
|
||||
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从多级反向代理中获得第一个非unknown IP地址
|
||||
*
|
||||
* @param ip 获得的IP地址
|
||||
* @return 第一个非unknown IP地址
|
||||
*/
|
||||
public static String getMultistageReverseProxyIp(String ip) {
|
||||
// 多级反向代理检测
|
||||
if (ip != null && ip.indexOf(",") > 0) {
|
||||
final String[] ips = ip.trim().split(",");
|
||||
for (String subIp : ips) {
|
||||
if (false == isUnknown(subIp)) {
|
||||
ip = subIp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.substring(ip, 0, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测给定字符串是否为未知,多用于检测HTTP请求相关
|
||||
*
|
||||
* @param checkString 被检测的字符串
|
||||
* @return 是否未知
|
||||
*/
|
||||
public static boolean isUnknown(String checkString) {
|
||||
return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发起请求的浏览器名称
|
||||
*/
|
||||
public static String getBrowserName(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(header);
|
||||
Browser browser = userAgent.getBrowser();
|
||||
return browser.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发起请求的浏览器版本号
|
||||
*/
|
||||
public static String getBrowserVersion(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(header);
|
||||
// 获取浏览器信息
|
||||
Browser browser = userAgent.getBrowser();
|
||||
// 获取浏览器版本号
|
||||
Version version = browser.getVersion(header);
|
||||
return version.getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发起请求的操作系统名称
|
||||
*/
|
||||
public static String getOsName(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(header);
|
||||
OperatingSystem operatingSystem = userAgent.getOperatingSystem();
|
||||
return operatingSystem.getName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过IP获取地址(需要联网,调用淘宝的IP库)
|
||||
*
|
||||
* @param ip
|
||||
* @return
|
||||
*/
|
||||
/*
|
||||
* public static String getIpInfo(String ip) { if ("127.0.0.1".equals(ip)) { ip
|
||||
* = "127.0.0.1"; } String info = ""; try { URL url = new
|
||||
* URL("http://ip.taobao.com/service/getIpInfo.php?ip=" + ip); HttpURLConnection
|
||||
* htpcon = (HttpURLConnection) url.openConnection();
|
||||
* htpcon.setRequestMethod("GET"); htpcon.setDoOutput(true);
|
||||
* htpcon.setDoInput(true); htpcon.setUseCaches(false);
|
||||
*
|
||||
* InputStream in = htpcon.getInputStream(); BufferedReader bufferedReader = new
|
||||
* BufferedReader(new InputStreamReader(in)); StringBuffer temp = new
|
||||
* StringBuffer(); String line = bufferedReader.readLine(); while (line != null)
|
||||
* { temp.append(line).append("\r\n"); line = bufferedReader.readLine(); }
|
||||
* bufferedReader.close(); JSONObject obj = (JSONObject)
|
||||
* JSON.parse(temp.toString()); if (obj.getIntValue("code") == 0) { JSONObject
|
||||
* data = obj.getJSONObject("data"); info += data.getString("country") + " ";
|
||||
* info += data.getString("region") + " "; info += data.getString("city") + " ";
|
||||
* info += data.getString("isp"); } } catch (MalformedURLException e) {
|
||||
* e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); }
|
||||
* catch (IOException e) { e.printStackTrace(); } return info; }
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
public class KztPrice {
|
||||
public List<Product> getPrice(int count, Double length, List<Product> list) {
|
||||
Product pro = new Product();
|
||||
pro = new Product();
|
||||
pro.setCount(count);
|
||||
double price = 0;
|
||||
|
||||
if(length < 24) {
|
||||
if(count == 5000) {
|
||||
price = 310;
|
||||
}else {
|
||||
price = 520;
|
||||
}
|
||||
}else {
|
||||
if(count == 5000) {
|
||||
price = 450;
|
||||
}else {
|
||||
price = 730;
|
||||
}
|
||||
}
|
||||
pro.setPrice(price);
|
||||
pro.setCount(count);
|
||||
list.add(pro);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 拉丝金/银不干胶价格
|
||||
*/
|
||||
public class LaSiStickersPrice {
|
||||
|
||||
int countArr[] = { 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000,
|
||||
60000, 70000, 80000, 90000, 100000 };
|
||||
|
||||
/**
|
||||
* 5*5cm以内(含)
|
||||
*
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice5x5(int count) {
|
||||
int priceArr[] = { 190, 220, 280, 360, 420, 500, 580, 640, 700, 780, 860, 1400, 2000, 2500, 3000, 3500, 4000,
|
||||
4500, 5000, 5500 };
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
// 每一万张增加500元
|
||||
pro.setPrice((Math.ceil(count / 100000.0) - 1) * 500 + 5500);
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 9*5.4cm 以内
|
||||
*
|
||||
* @param count
|
||||
* @param area 单个产品的面积(平方米)
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice9x5(int count, Double area) {
|
||||
int priceArr[] = { 200, 260, 340, 420, 520, 630, 740, 850, 960, 1020, 1150, 2100, 3000, 4100, 5000, 5600, 6200,
|
||||
7300, 8000, 9000 };
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
// 每平方20元
|
||||
pro.setPrice(Math.ceil(area * count * 20));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> acountPrice9xup(int count, Double area) {
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
double price = 0.0;
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(area * count * 20));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
if (area * countArr[i] <= 3) {
|
||||
price = 90;
|
||||
} else if (area * countArr[i] > 3 && area * countArr[i] <= 5) {
|
||||
price = 70;
|
||||
} else if (area * countArr[i] > 5 && area * countArr[i] <= 8) {
|
||||
price = 50;
|
||||
} else if (area * countArr[i] > 8 && area * countArr[i] <= 10) {
|
||||
price = 37;
|
||||
} else if (area * countArr[i] > 10 && area * countArr[i] <= 15) {
|
||||
price = 35;
|
||||
} else if (area * countArr[i] > 15 && area * countArr[i] <= 25) {
|
||||
price = 30;
|
||||
} else if (area * countArr[i] > 25 && area * countArr[i] <= 30) {
|
||||
price = 26;
|
||||
} else if (area * countArr[i] > 30 && area * countArr[i] <= 100) {
|
||||
price = 25;
|
||||
} else if (area * countArr[i] > 100 && area * count <= 500) {
|
||||
price = 22;
|
||||
} else {
|
||||
price = 20;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(countArr[i] * area * price));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* 工具类,实现阴阳历互转
|
||||
*/
|
||||
public class LunarCalendarUtil {
|
||||
/**
|
||||
* 支持转换的最小农历年份
|
||||
*/
|
||||
public static final int MIN_YEAR = 1900;
|
||||
|
||||
/**
|
||||
* 支持转换的最大农历年份
|
||||
*/
|
||||
public static final int MAX_YEAR = 2099;
|
||||
|
||||
/**
|
||||
* 公历每月前的天数
|
||||
*/
|
||||
private static final int[] DAYS_BEFORE_MONTH = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
|
||||
/**
|
||||
* 用来表示1900年到2099年间农历年份的相关信息,共24位bit的16进制表示,其中: 1. 前4位表示该年闰哪个月; 2.
|
||||
* 5-17位表示农历年份13个月的大小月分布,0表示小,1表示大; 3. 最后7位表示农历年首(正月初一)对应的公历日期。
|
||||
* 以2014年的数据0x955ABF为例说明: 1001 0101 0101 1010 1011 1111 闰九月 农历正月初一对应公历1月31号
|
||||
*/
|
||||
private static final int[] LUNAR_INFO = {
|
||||
/* 1900 */
|
||||
0x84B6BF,
|
||||
/* 1901-1910 */
|
||||
0x04AE53, 0x0A5748, 0x5526BD, 0x0D2650, 0x0D9544, 0x46AAB9, 0x056A4D, 0x09AD42, 0x24AEB6, 0x04AE4A,
|
||||
/* 1911-1920 */
|
||||
0x6A4DBE, 0x0A4D52, 0x0D2546, 0x5D52BA, 0x0B544E, 0x0D6A43, 0x296D37, 0x095B4B, 0x749BC1, 0x049754,
|
||||
/* 1921-1930 */
|
||||
0x0A4B48, 0x5B25BC, 0x06A550, 0x06D445, 0x4ADAB8, 0x02B64D, 0x095742, 0x2497B7, 0x04974A, 0x664B3E,
|
||||
/* 1931-1940 */
|
||||
0x0D4A51, 0x0EA546, 0x56D4BA, 0x05AD4E, 0x02B644, 0x393738, 0x092E4B, 0x7C96BF, 0x0C9553, 0x0D4A48,
|
||||
/* 1941-1950 */
|
||||
0x6DA53B, 0x0B554F, 0x056A45, 0x4AADB9, 0x025D4D, 0x092D42, 0x2C95B6, 0x0A954A, 0x7B4ABD, 0x06CA51,
|
||||
/* 1951-1960 */
|
||||
0x0B5546, 0x555ABB, 0x04DA4E, 0x0A5B43, 0x352BB8, 0x052B4C, 0x8A953F, 0x0E9552, 0x06AA48, 0x6AD53C,
|
||||
/* 1961-1970 */
|
||||
0x0AB54F, 0x04B645, 0x4A5739, 0x0A574D, 0x052642, 0x3E9335, 0x0D9549, 0x75AABE, 0x056A51, 0x096D46,
|
||||
/* 1971-1980 */
|
||||
0x54AEBB, 0x04AD4F, 0x0A4D43, 0x4D26B7, 0x0D254B, 0x8D52BF, 0x0B5452, 0x0B6A47, 0x696D3C, 0x095B50,
|
||||
/* 1981-1990 */
|
||||
0x049B45, 0x4A4BB9, 0x0A4B4D, 0xAB25C2, 0x06A554, 0x06D449, 0x6ADA3D, 0x0AB651, 0x095746, 0x5497BB,
|
||||
/* 1991-2000 */
|
||||
0x04974F, 0x064B44, 0x36A537, 0x0EA54A, 0x86B2BF, 0x05AC53, 0x0AB647, 0x5936BC, 0x092E50, 0x0C9645,
|
||||
/* 2001-2010 */
|
||||
0x4D4AB8, 0x0D4A4C, 0x0DA541, 0x25AAB6, 0x056A49, 0x7AADBD, 0x025D52, 0x092D47, 0x5C95BA, 0x0A954E,
|
||||
/* 2011-2020 */
|
||||
0x0B4A43, 0x4B5537, 0x0AD54A, 0x955ABF, 0x04BA53, 0x0A5B48, 0x652BBC, 0x052B50, 0x0A9345, 0x474AB9,
|
||||
/* 2021-2030 */
|
||||
0x06AA4C, 0x0AD541, 0x24DAB6, 0x04B64A, 0x6a573D, 0x0A4E51, 0x0D2646, 0x5E933A, 0x0D534D, 0x05AA43,
|
||||
/* 2031-2040 */
|
||||
0x36B537, 0x096D4B, 0xB4AEBF, 0x04AD53, 0x0A4D48, 0x6D25BC, 0x0D254F, 0x0D5244, 0x5DAA38, 0x0B5A4C,
|
||||
/* 2041-2050 */
|
||||
0x056D41, 0x24ADB6, 0x049B4A, 0x7A4BBE, 0x0A4B51, 0x0AA546, 0x5B52BA, 0x06D24E, 0x0ADA42, 0x355B37,
|
||||
/* 2051-2060 */
|
||||
0x09374B, 0x8497C1, 0x049753, 0x064B48, 0x66A53C, 0x0EA54F, 0x06AA44, 0x4AB638, 0x0AAE4C, 0x092E42,
|
||||
/* 2061-2070 */
|
||||
0x3C9735, 0x0C9649, 0x7D4ABD, 0x0D4A51, 0x0DA545, 0x55AABA, 0x056A4E, 0x0A6D43, 0x452EB7, 0x052D4B,
|
||||
/* 2071-2080 */
|
||||
0x8A95BF, 0x0A9553, 0x0B4A47, 0x6B553B, 0x0AD54F, 0x055A45, 0x4A5D38, 0x0A5B4C, 0x052B42, 0x3A93B6,
|
||||
/* 2081-2090 */
|
||||
0x069349, 0x7729BD, 0x06AA51, 0x0AD546, 0x54DABA, 0x04B64E, 0x0A5743, 0x452738, 0x0D264A, 0x8E933E,
|
||||
/* 2091-2099 */
|
||||
0x0D5252, 0x0DAA47, 0x66B53B, 0x056D4F, 0x04AE45, 0x4A4EB9, 0x0A4D4C, 0x0D1541, 0x2D92B5 };
|
||||
|
||||
/**
|
||||
* 将农历日期转换为公历日期
|
||||
*
|
||||
* @param year 农历年份
|
||||
* @param month 农历月
|
||||
* @param monthDay 农历日
|
||||
* @param isLeapMonth 该月是否是闰月(该参数可以根据本类中leapMonth()方法,先判断一下要查询的年份是否有闰月,并且闰的几月)
|
||||
* @return 返回农历日期对应的公历日期,year0, month1, day2.
|
||||
*/
|
||||
public static final int[] lunarToSolar(int year, int month, int monthDay, boolean isLeapMonth) {
|
||||
int dayOffset;
|
||||
int leapMonth;
|
||||
int i;
|
||||
if (year < MIN_YEAR || year > MAX_YEAR || month < 1 || month > 12 || monthDay < 1 || monthDay > 30) {
|
||||
throw new IllegalArgumentException("Illegal lunar date, must be like that:\n\t" + "year : 1900~2099\n\t"
|
||||
+ "month : 1~12\n\t" + "day : 1~30");
|
||||
}
|
||||
dayOffset = (LUNAR_INFO[year - MIN_YEAR] & 0x001F) - 1;
|
||||
if (((LUNAR_INFO[year - MIN_YEAR] & 0x0060) >> 5) == 2) {
|
||||
dayOffset += 31;
|
||||
}
|
||||
for (i = 1; i < month; i++) {
|
||||
if ((LUNAR_INFO[year - MIN_YEAR] & (0x80000 >> (i - 1))) == 0) {
|
||||
dayOffset += 29;
|
||||
} else {
|
||||
dayOffset += 30;
|
||||
}
|
||||
}
|
||||
dayOffset += monthDay;
|
||||
leapMonth = (LUNAR_INFO[year - MIN_YEAR] & 0xf00000) >> 20;
|
||||
// 这一年有闰月
|
||||
if (leapMonth != 0) {
|
||||
if (month > leapMonth || (month == leapMonth && isLeapMonth)) {
|
||||
if ((LUNAR_INFO[year - MIN_YEAR] & (0x80000 >> (month - 1))) == 0) {
|
||||
dayOffset += 29;
|
||||
} else {
|
||||
dayOffset += 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dayOffset > 366 || (year % 4 != 0 && dayOffset > 365)) {
|
||||
year += 1;
|
||||
if (year % 4 == 1) {
|
||||
dayOffset -= 366;
|
||||
} else {
|
||||
dayOffset -= 365;
|
||||
}
|
||||
}
|
||||
int[] solarInfo = new int[3];
|
||||
for (i = 1; i < 13; i++) {
|
||||
int iPos = DAYS_BEFORE_MONTH[i];
|
||||
if (year % 4 == 0 && i > 2) {
|
||||
iPos += 1;
|
||||
}
|
||||
if (year % 4 == 0 && i == 2 && iPos + 1 == dayOffset) {
|
||||
solarInfo[1] = i;
|
||||
solarInfo[2] = dayOffset - 31;
|
||||
break;
|
||||
}
|
||||
if (iPos >= dayOffset) {
|
||||
solarInfo[1] = i;
|
||||
iPos = DAYS_BEFORE_MONTH[i - 1];
|
||||
if (year % 4 == 0 && i > 2) {
|
||||
iPos += 1;
|
||||
}
|
||||
if (dayOffset > iPos) {
|
||||
solarInfo[2] = dayOffset - iPos;
|
||||
} else if (dayOffset == iPos) {
|
||||
if (year % 4 == 0 && i == 2) {
|
||||
solarInfo[2] = DAYS_BEFORE_MONTH[i] - DAYS_BEFORE_MONTH[i - 1] + 1;
|
||||
} else {
|
||||
solarInfo[2] = DAYS_BEFORE_MONTH[i] - DAYS_BEFORE_MONTH[i - 1];
|
||||
}
|
||||
} else {
|
||||
solarInfo[2] = dayOffset;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
solarInfo[0] = year;
|
||||
return solarInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将公历日期转换为农历日期,且标识是否是闰月 (如果当年有闰月,被闰的阴历月份所对应的阳历日期计算出来不对,后期自己根据本方法leap3
|
||||
* 返回值判断如果为1,给月份+1,如果为0就是正确的,不用在操作,阴历闰月对应的阳历日期计算出来的阴历闰月日期正确,leap3为0)
|
||||
*
|
||||
* @param year
|
||||
* @param month 传入需要为单数如 08 为8
|
||||
* @param monthDay
|
||||
* @return 返回公历日期对应的农历日期,year0,month1,day2,leap3(0 为计算正常 1 月份会比正确少一个月,需要月份+1)
|
||||
*/
|
||||
public static final int[] solarToLunar(int year, int month, int monthDay) {
|
||||
int[] lunarDate = new int[4];
|
||||
Date baseDate = new GregorianCalendar(1900, 0, 31).getTime();
|
||||
Date objDate = new GregorianCalendar(year, month - 1, monthDay).getTime();
|
||||
int offset = (int) ((objDate.getTime() - baseDate.getTime()) / 86400000L);
|
||||
// 用offset减去每农历年的天数计算当天是农历第几天
|
||||
// iYear最终结果是农历的年份, offset是当年的第几天
|
||||
int iYear, daysOfYear = 0;
|
||||
for (iYear = MIN_YEAR; iYear <= MAX_YEAR && offset > 0; iYear++) {
|
||||
daysOfYear = daysInLunarYear(iYear);
|
||||
offset -= daysOfYear;
|
||||
}
|
||||
if (offset < 0) {
|
||||
offset += daysOfYear;
|
||||
iYear--;
|
||||
}
|
||||
// 农历年份
|
||||
lunarDate[0] = iYear;
|
||||
int leapMonth = leapMonth(iYear);
|
||||
// 闰哪个月,1-12
|
||||
boolean isLeap = false;
|
||||
// 用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天
|
||||
int iMonth, daysOfMonth = 0;
|
||||
for (iMonth = 1; iMonth <= 13 && offset > 0; iMonth++) {
|
||||
daysOfMonth = daysInLunarMonth(iYear, iMonth);
|
||||
offset -= daysOfMonth;
|
||||
}
|
||||
// 当前月超过闰月,要校正
|
||||
if (leapMonth != 0 && iMonth > leapMonth) {
|
||||
--iMonth;
|
||||
if (iMonth == leapMonth) {
|
||||
isLeap = true;
|
||||
}
|
||||
}
|
||||
// offset小于0时,也要校正
|
||||
if (offset < 0) {
|
||||
offset += daysOfMonth;
|
||||
--iMonth;
|
||||
}
|
||||
lunarDate[1] = iMonth;
|
||||
lunarDate[2] = offset + 1;
|
||||
lunarDate[3] = isLeap ? 1 : 0;
|
||||
return lunarDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传回农历year年month月的总天数
|
||||
*
|
||||
* @param year 要计算的年份
|
||||
* @param month 要计算的月
|
||||
* @return 传回天数
|
||||
*/
|
||||
final public static int daysInMonth(int year, int month) {
|
||||
return daysInMonth(year, month, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 传回农历year年month月的总天数
|
||||
*
|
||||
* @param year 要计算的年份
|
||||
* @param month 要计算的月
|
||||
* @param leap 当月是否是闰月
|
||||
* @return 传回天数,如果闰月是错误的,返回0.
|
||||
*/
|
||||
public static final int daysInMonth(int year, int month, boolean leap) {
|
||||
int leapMonth = leapMonth(year);
|
||||
int offset = 0;
|
||||
// 如果本年有闰月且month大于闰月时,需要校正
|
||||
if (leapMonth != 0 && month > leapMonth) {
|
||||
offset = 1;
|
||||
}
|
||||
// 不考虑闰月
|
||||
if (!leap) {
|
||||
return daysInLunarMonth(year, month + offset);
|
||||
} else {
|
||||
// 传入的闰月是正确的月份
|
||||
if (leapMonth != 0 && leapMonth == month) {
|
||||
return daysInLunarMonth(year, month + 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传回农历 year年的总天数
|
||||
*
|
||||
* @param year 将要计算的年份
|
||||
* @return 返回传入年份的总天数
|
||||
*/
|
||||
private static int daysInLunarYear(int year) {
|
||||
int i, sum = 348;
|
||||
if (leapMonth(year) != 0) {
|
||||
sum = 377;
|
||||
}
|
||||
int monthInfo = LUNAR_INFO[year - MIN_YEAR] & 0x0FFF80;
|
||||
for (i = 0x80000; i > 0x7; i >>= 1) {
|
||||
if ((monthInfo & i) != 0) {
|
||||
sum += 1;
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传回农历 year年month月的总天数,总共有13个月包括闰月
|
||||
*
|
||||
* @param year 将要计算的年份
|
||||
* @param month 将要计算的月份
|
||||
* @return 传回农历 year年month月的总天数
|
||||
*/
|
||||
private static int daysInLunarMonth(int year, int month) {
|
||||
if ((LUNAR_INFO[year - MIN_YEAR] & (0x100000 >> month)) == 0) {
|
||||
return 29;
|
||||
} else {
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 传回农历 year年闰哪个月 1-12 , 没闰传回 0
|
||||
*
|
||||
* @param year 将要计算的年份
|
||||
* @return 传回农历 year年闰哪个月1-12, 没闰传回 0
|
||||
*/
|
||||
public static int leapMonth(int year) {
|
||||
return ((LUNAR_INFO[year - MIN_YEAR] & 0xF00000)) >> 20;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 计算录入年份是否有闰月
|
||||
System.out.println(leapMonth(2020));
|
||||
// 传回农历 year年month月的总天数,总共有13个月包括闰月
|
||||
System.out.println(daysInLunarMonth(2017, 6));
|
||||
// 传回农历year年month月的总天数
|
||||
System.out.println(daysInMonth(2017, 6, false));
|
||||
// 阳历转阴历 9.25 10.23 有问题
|
||||
System.out.println(Arrays.toString(solarToLunar(2020, 3, 2)));
|
||||
// 阴历转阳历
|
||||
System.out.println(Arrays.toString(lunarToSolar(2020, 2, 9, true)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import org.apache.shiro.crypto.hash.Md5Hash;
|
||||
|
||||
public class MD5Util {
|
||||
|
||||
/**
|
||||
* md5加密
|
||||
* @param str
|
||||
* @param salt
|
||||
* @return
|
||||
*/
|
||||
public String md5(String str,String salt) {
|
||||
return new Md5Hash(str,salt).toString();
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new MD5Util().md5("123456", "lingtao"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* A级铜版纸不干胶价格
|
||||
*/
|
||||
public class NiuStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
/**
|
||||
* 不干胶大数量遍历添加价格
|
||||
*/
|
||||
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万以上或 5万以上
|
||||
public List<Product> getPrice(int count, Double area) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (area > 0 && area <= 0.0004) {
|
||||
Double priceArrA[] = { 300.0, 200.0, 137.5, 130.0, 125.0, 90.0, 69.0, 68.0, 58.0, 52.5, 50.0, 48.0, 46.0,
|
||||
44.0, 42.0, 40.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0004 && area <= 0.0006) {
|
||||
Double priceArrA[] = { 200.0, 133.0, 92.0, 90.0, 87.0, 65.0, 60.0, 46.0, 39.0, 37.0, 40.0, 38.0, 36.0, 34.0,
|
||||
32.0, 30.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0006 && area <= 0.0008) {
|
||||
Double priceArrA[] = { 150.0, 100.0, 81.0, 79.0, 70.0, 50.0, 46.0, 38.0, 30.0, 30.0, 38.0, 36.0, 34.0, 32.0,
|
||||
30.0, 29.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0008 && area <= 0.001) {
|
||||
Double priceArrA[] = { 120.0, 80.0, 65.0, 63.0, 60.0, 39.0, 39.0, 30.0, 25.0, 24.0, 38.0, 36.0, 34.0, 32.0,
|
||||
30.0, 29.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.001 && area <= 0.0012) {
|
||||
Double priceArrA[] = { 100.0, 67.0, 54.0, 53.0, 50.0, 43.0, 26.0, 21.0, 21.0, 20.0, 20.0, 19.0, 18.0, 18.0,
|
||||
18.0, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0012 && area <= 0.0014) {
|
||||
Double priceArrA[] = { 86.0, 57.0, 46.0, 45.0, 40.0, 30.0, 26.0, 21.0, 21.0, 20.0, 18.0, 17.0, 16.0, 16.0,
|
||||
16.0, 16.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0014 && area <= 0.0016) {
|
||||
Double priceArrA[] = { 75.0, 50.0, 44.0, 40.0, 36.0, 28.0, 26.0, 21.0, 21.0, 20.0, 16.0, 16.0, 15.0, 14.0,
|
||||
14.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0016 && area <= 0.0025) {
|
||||
Double priceArrA[] = { 118.0, 71.0, 68.0, 51.0, 42.0, 30.0, 20.0, 16.0, 16.0, 16.0, 16.0, 16.0, 15.0, 14.0,
|
||||
14.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0025 && area <= 0.0035) {
|
||||
Double priceArrA[] = { 62.5, 38.0, 36.0, 30.0, 22.0, 22.0, 19.0, 19.0, 19.0, 18.0, 16.0, 16.0, 15.0, 14.0,
|
||||
14.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0035 && area <= 0.0045) {
|
||||
Double priceArrA[] = { 56.0, 34.0, 32.0, 26.0, 20.0, 19.0, 18.0, 18.0, 18.0, 17.0, 15.0, 14.0, 13.0, 13.0,
|
||||
13.0, 13.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0045 && area <= 0.0084) {
|
||||
Double priceArrA[] = { 46.0, 32.0, 24.0, 20.0, 18.0, 17.0, 13.0, 13.0, 13.0, 12.0, 11.0, 10.0, 9.0, 8.0,
|
||||
8.0, 8.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0084 && area <= 0.012) {
|
||||
Double priceArrA[] = { 42.0, 26.0, 23.0, 18.0, 18.0, 17.0, 13.0, 13.0, 13.0, 12.0, 10.5, 10.0, 9.3, 7.5,
|
||||
8.0, 8.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.012 && area <= 0.015) {
|
||||
Double priceArrA[] = { 40.0, 25.0, 22.0, 17.0, 17.0, 16.0, 10.0, 9.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0,
|
||||
7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.015 && area <= 0.02) {
|
||||
Double priceArrA[] = { 35.0, 24.0, 21.0, 17.0, 16.0, 15.0, 10.0, 9.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0,
|
||||
7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.02 && area <= 0.06) {
|
||||
Double priceArr[] = { 32.0, 23.0, 21.0, 16.5, 15.0, 14.0, 9.5, 9.5, 8.5, 8.5, 8.5, 8.0, 8.0, 7.5, 7.5, 7.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.06 && area <= 0.1) {
|
||||
Double priceArr[] = { 30.0, 22.0, 19.0, 15.0, 14.0, 13.0, 8.5, 8.5, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 7.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.1 && area <= 0.2) {
|
||||
Double priceArr[] = { 29.0, 20.0, 18.0, 14.0, 13.0, 12.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.2 && area <= 0.3) {
|
||||
Double priceArr[] = { 23.0, 18.0, 16.0, 12.0, 10.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.3) {
|
||||
Double priceArr[] = { 20.0, 15.0, 14.0, 11.0, 8.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* PVC/透明哑膜不干胶价格
|
||||
*/
|
||||
public class PVCYaMoStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
/**
|
||||
* 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 && area <= 0.0004) {
|
||||
Double priceArrA[] = { 500.0, 400.0, 220.0, 180.0, 150.0, 120.0, 80.0, 72.0, 67.0, 61.0, 53.0, 49.0, 46.0,
|
||||
43.0, 40.0, 37.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0004 && area <= 0.0006) {
|
||||
Double priceArrA[] = { 360.0, 243.0, 144.0, 126.0, 108.0, 81.0, 59.0, 50.0, 41.0, 37.0, 35.0, 34.0, 33.0,
|
||||
32.0, 31.0, 30.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0006 && area <= 0.0008) {
|
||||
Double priceArrA[] = { 266.0, 168.0, 98.0, 84.0, 74.0, 56.0, 42.0, 35.0, 28.0, 24.0, 23.0, 22.0, 22.0,
|
||||
21.0, 20.0, 20.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0008 && area <= 0.001) {
|
||||
Double priceArrA[] = { 231.0, 133.0, 84.0, 70.0, 63.0, 49.0, 35.0, 25.0, 21.0, 20.0, 19.0, 18.0, 17.0,
|
||||
17.0, 15.0, 15.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.001 && area <= 0.0012) {
|
||||
Double priceArrA[] = { 130.0, 125.0, 45.0, 40.0, 35.0, 27.0, 20.0, 15.0, 12.0, 12.0, 11.0, 11.0, 10.0, 10.0,
|
||||
9.0, 9.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0012 && area <= 0.0014) {
|
||||
Double priceArrA[] = { 125.0, 70.0, 42.0, 37.0, 32.0, 26.0, 19.0, 13.0, 11.0, 11.0, 10.0, 10.0, 9.0, 9.0,
|
||||
8.0, 8.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0014 && area <= 0.0016) {
|
||||
Double priceArrA[] = { 110.0, 62.0, 35.0, 32.0, 30.0, 23.0, 17.0, 12.0, 10.0, 10.0, 10.0, 9.0, 9.0, 8.0,
|
||||
8.0, 8.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0016 && area <= 0.0025) {
|
||||
Double priceArrA[] = { 100.0, 55.0, 34.0, 30.0, 27.0, 21.0, 13.0, 11.0, 8.0, 8.0, 7.0, 7.0, 7.0, 7.0,
|
||||
7.0, 7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0025 && area <= 0.0035) {
|
||||
Double priceArrA[] = { 75.0, 51.0, 30.0, 24.0, 20.0, 16.0, 12.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 7.0,
|
||||
7.0, 7.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0035 && area <= 0.0045) {
|
||||
Double priceArrA[] = { 75.0, 47.0, 27.0, 22.0, 19.0, 15.0, 9.0, 7.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0045 && area <= 0.0084) {
|
||||
Double priceArrA[] = { 75.0, 40.0, 24.0, 18.0, 15.0, 12.0, 8.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0084 && area <= 0.012) {
|
||||
Double priceArrA[] = { 55.0, 32.0, 20.0, 15.0, 12.0, 11.0, 8.0, 7.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.012 && area <= 0.015) {
|
||||
Double priceArrA[] = { 17.0, 10.0, 8.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.015 && area <= 0.02) {
|
||||
Double priceArrA[] = { 15.0, 9.0, 7.0, 7.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.02 && area <= 0.04) {
|
||||
Double priceArr[] = { 13.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.02 && area <= 0.06) {
|
||||
Double priceArr[] = { 12.0, 8.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.06 && area <= 0.1) {
|
||||
Double priceArr[] = { 12.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0,
|
||||
6.0, 6.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.1 && area <= 0.2) {
|
||||
Double priceArr[] = { 11.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
|
||||
5.0, 5.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else {
|
||||
Double priceArr[] = { 8.0, 7.0, 6.0, 6.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
|
||||
5.0, 5.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
public class PaperCupPrice {
|
||||
public List<Product> getPrice(int count, List<Product> list) {
|
||||
int[] countArr = {1000, 2000, 3000, 5000, 10000, 20000, 30000, 50000};
|
||||
for(int i = 0;i<countArr.length; i++) {
|
||||
if(countArr[i] < count || list.size() > 4) {
|
||||
continue;
|
||||
}
|
||||
Product pro = new Product();
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(countArr[i] * 0.108);
|
||||
list.add(pro);
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 画册价格
|
||||
*/
|
||||
public class PictureAlbumPrice {
|
||||
|
||||
int countArr[] = { 500, 1000, 2000, 3000, 5000, 10000, };
|
||||
|
||||
/**
|
||||
* 不干胶大数量遍历添加价格
|
||||
*/
|
||||
private List<Product> acountPrice(int count, List<Product> list, double[] priceArr) {
|
||||
Product pro = new Product();
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(count * priceArr[countArr.length - 1] / countArr[countArr.length - 1]));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(priceArr[i]);
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param count
|
||||
* @param pcount 内页P数(含封面4P)
|
||||
* @return
|
||||
*/
|
||||
public List<Product> getPrice00(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (8 == pcount) {
|
||||
double priceArr[] = { 403, 551, 864, 1206, 1998, 3873 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (12 == pcount) {
|
||||
double priceArr[] = { 490, 673, 1082, 1523, 2505, 4827 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (16 == pcount) {
|
||||
double priceArr[] = { 579, 794, 1311, 1839, 3012, 5783 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (20 == pcount) {
|
||||
double priceArr[] = { 665, 917, 1542, 2156, 3519, 6737 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (24 == pcount) {
|
||||
double priceArr[] = { 752, 1053, 1772, 2472, 4026, 7691 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (28 == pcount) {
|
||||
double priceArr[] = { 842, 1188, 2001, 2787, 4533, 8648 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (32 == pcount) {
|
||||
double priceArr[] = { 929, 1323, 2232, 3104, 5040, 9602 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (36 == pcount) {
|
||||
double priceArr[] = { 1016, 1460, 2462, 3419, 5549, 10556 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (40 == pcount) {
|
||||
double priceArr[] = { 1106, 1596, 2691, 3735, 6056, 11510 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (44 == pcount) {
|
||||
double priceArr[] = { 1200, 1724, 2922, 4053, 6563, 12464 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (48 == pcount) {
|
||||
double priceArr[] = { 1295, 1866, 3152, 4368, 7070, 13419 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (52 == pcount) {
|
||||
double priceArr[] = { 1391, 2005, 3383, 4685, 7577, 14373 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice01(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (8 == pcount) {
|
||||
double priceArr[] = { 436, 589, 927, 1296, 2135, 4146 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (12 == pcount) {
|
||||
double priceArr[] = { 558, 747, 1209, 1701, 2778, 5376 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (16 == pcount) {
|
||||
double priceArr[] = { 678, 906, 1505, 2103, 2420, 6605 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (20 == pcount) {
|
||||
double priceArr[] = { 802, 1066, 1799, 2508, 4064, 7832 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (24 == pcount) {
|
||||
double priceArr[] = { 922, 1239, 2094, 2913, 4707, 9062 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (28 == pcount) {
|
||||
double priceArr[] = { 1043, 1412, 2390, 3318, 5351, 10290 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (32 == pcount) {
|
||||
double priceArr[] = { 1165, 1586, 2684, 3722, 5994, 11517 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (36 == pcount) {
|
||||
double priceArr[] = { 1285, 1761, 2979, 4127, 6636, 12746 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (40 == pcount) {
|
||||
double priceArr[] = { 1409, 1932, 3273, 4532, 7280, 13976 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (44 == pcount) {
|
||||
double priceArr[] = { 1538, 2105, 3567, 4937, 7923, 15203 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (48 == pcount) {
|
||||
double priceArr[] = { 1665, 2279, 3861, 5340, 8567, 16431 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (52 == pcount) {
|
||||
double priceArr[] = { 1663, 2454, 4157, 5745, 9209, 17661 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice02(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (8 == pcount) {
|
||||
double priceArr[] = { 455, 635, 975, 1382, 2274, 4409 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (12 == pcount) {
|
||||
double priceArr[] = { 597, 842, 1302, 1874, 3056, 5900 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (16 == pcount) {
|
||||
double priceArr[] = { 741, 1048, 1643, 2364, 3839, 7389 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (20 == pcount) {
|
||||
double priceArr[] = { 883, 1254, 1982, 2856, 4622, 8880 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (24 == pcount) {
|
||||
double priceArr[] = { 1026, 1473, 2324, 3348, 5403, 10371 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (28 == pcount) {
|
||||
double priceArr[] = { 1167, 1695, 2664, 3839, 6188, 11861 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (32 == pcount) {
|
||||
double priceArr[] = { 1308, 1912, 3005, 4329, 6971, 13352 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (36 == pcount) {
|
||||
double priceArr[] = { 1452, 2133, 3347, 4821, 7752, 14841 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* ========285*210===========
|
||||
*/
|
||||
|
||||
public List<Product> getPrice10(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (8 == pcount) {
|
||||
double priceArr[] = { 726, 1104, 1551, 2243, 3656, 7062 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (12 == pcount) {
|
||||
double priceArr[] = { 904, 1385, 1953, 2849, 4605, 8841 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (16 == pcount) {
|
||||
double priceArr[] = { 1084, 1666, 2373, 3453, 5555, 10622 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (20 == pcount) {
|
||||
double priceArr[] = { 1263, 1949, 2795, 4059, 6504, 12402 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (24 == pcount) {
|
||||
double priceArr[] = { 1443, 2252, 3215, 4664, 7454, 14181 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (28 == pcount) {
|
||||
double priceArr[] = { 1621, 2557, 3635, 5270, 8402, 15960 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (32 == pcount) {
|
||||
double priceArr[] = { 1800, 2860, 4055, 5874, 9351, 17741 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (36 == pcount) {
|
||||
double priceArr[] = { 2078, 2984, 4604, 6363, 10301, 19521 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (40 == pcount) {
|
||||
double priceArr[] = { 2271, 3301, 5037, 6956, 11250, 21299 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (44 == pcount) {
|
||||
double priceArr[] = { 2472, 3586, 5472, 7548, 12200, 23078 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (48 == pcount) {
|
||||
double priceArr[] = { 2675, 3868, 5906, 8144, 13149, 24858 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (52 == pcount) {
|
||||
double priceArr[] = { 2875, 4153, 5341, 8736, 14099, 26639 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice11(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (8 == pcount) {
|
||||
double priceArr[] = { 723, 1076, 1665, 2372, 3929, 7610 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (12 == pcount) {
|
||||
double priceArr[] = { 947, 1404, 2180, 3107, 5150, 9938 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (16 == pcount) {
|
||||
double priceArr[] = { 1173, 1734, 2714, 3842, 6371, 12264 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (20 == pcount) {
|
||||
double priceArr[] = { 1398, 2063, 3248, 4575, 7592, 14592 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (24 == pcount) {
|
||||
double priceArr[] = { 1624, 2412, 3782, 5175, 8814, 16919 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (28 == pcount) {
|
||||
double priceArr[] = { 1848, 2760, 4316, 6044, 10035, 19247 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (32 == pcount) {
|
||||
double priceArr[] = { 2074, 3110, 4848, 6779, 11256, 21575 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (36 == pcount) {
|
||||
double priceArr[] = { 2429, 3345, 5639, 7778, 12479, 23901 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (40 == pcount) {
|
||||
double priceArr[] = { 2673, 3676, 6203, 8549, 13700, 26229 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (44 == pcount) {
|
||||
double priceArr[] = { 2922, 4010, 6765, 9318, 14921, 28557 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (48 == pcount) {
|
||||
double priceArr[] = { 3171, 4340, 7328, 10089, 16143, 30884 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (52 == pcount) {
|
||||
double priceArr[] = { 3422, 4673, 7892, 10859, 17364, 33212 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice12(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (8 == pcount) {
|
||||
double priceArr[] = { 723, 1092, 1718, 2489, 4206, 8135 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (12 == pcount) {
|
||||
double priceArr[] = { 947, 1439, 2288, 3339, 5706, 10986 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (16 == pcount) {
|
||||
double priceArr[] = { 1173, 1785, 2874, 4191, 7206, 13838 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (20 == pcount) {
|
||||
double priceArr[] = { 1398, 2132, 3462, 5042, 8708, 16689 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (24 == pcount) {
|
||||
double priceArr[] = { 1624, 2498, 4049, 5892, 10209, 19539 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (28 == pcount) {
|
||||
double priceArr[] = { 1848, 2864, 4637, 6744, 11709, 22391 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (32 == pcount) {
|
||||
double priceArr[] = { 2074, 3231, 5223, 7595, 13209, 25242 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
} else if (36 == pcount) {
|
||||
double priceArr[] = { 2757, 4092, 6372, 9165, 14709, 28094 };
|
||||
list = acountPrice(count, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/* ===============少数量相册================ */
|
||||
/**
|
||||
*
|
||||
* @param count
|
||||
* @param pcount 内页P数(含封面4P)
|
||||
* @return
|
||||
*/
|
||||
public List<Product> getLessPrice(int count, int pcount) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
double price = 0;
|
||||
if (count <= 10) {
|
||||
price = pcount * count * 2;
|
||||
} else if (count <= 50) {
|
||||
price = pcount * count * 1.5;
|
||||
} else if (count <= 100) {
|
||||
price = pcount * count * 1;
|
||||
} else {
|
||||
price = pcount * count * 0.8;
|
||||
}
|
||||
price += count * 4;
|
||||
;
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(price = price > 120 ? price : 120));
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,754 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 海报价格
|
||||
*/
|
||||
public class PosterPrice {
|
||||
|
||||
/**
|
||||
* 裱板
|
||||
*
|
||||
* @param kind2
|
||||
* @param area
|
||||
* @param count
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice00(String kind2, Double area, int count, Integer number) {
|
||||
double danjia = 0.0;
|
||||
// 最低收费
|
||||
double price = 0.0;
|
||||
String weight = "0";
|
||||
DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
|
||||
switch (kind2) {
|
||||
// 室内写真裱冷板
|
||||
case "0":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 64;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 60;
|
||||
} else {
|
||||
danjia = 52;
|
||||
}
|
||||
price = area * danjia > 72 ? area * danjia : 72;
|
||||
|
||||
break;
|
||||
// 室内写真对裱冷板
|
||||
case "1":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 90;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 85;
|
||||
} else {
|
||||
danjia = 80;
|
||||
}
|
||||
price = area * danjia > 95 ? area * danjia : 95;
|
||||
break;
|
||||
// 室内写真裱冷板装小C边
|
||||
case "3":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 85;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 80;
|
||||
} else {
|
||||
danjia = 75;
|
||||
}
|
||||
price = area * danjia > 90 ? area * danjia : 90;
|
||||
break;
|
||||
// 户外写真裱冷板
|
||||
case "6":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 85;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 80;
|
||||
} else {
|
||||
danjia = 75;
|
||||
}
|
||||
price = area * danjia > 90 ? area * danjia : 90;
|
||||
break;
|
||||
// 户外写真对裱冷板
|
||||
case "7":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 95;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 90;
|
||||
} else {
|
||||
danjia = 85;
|
||||
}
|
||||
price = area * danjia > 90 ? area * danjia : 90;
|
||||
break;
|
||||
// 户外写真裱冷板装小C边
|
||||
case "8":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 100;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 95;
|
||||
} else {
|
||||
danjia = 90;
|
||||
}
|
||||
price = area * danjia > 90 ? area * danjia : 90;
|
||||
break;
|
||||
// 背胶单裱3mmPVC(户内高清)
|
||||
case "12":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 105;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 100;
|
||||
} else {
|
||||
danjia = 95;
|
||||
}
|
||||
price = area * danjia > 105 ? area * danjia : 105;
|
||||
break;
|
||||
}
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.2 * number));
|
||||
pro.setWeight(weight);
|
||||
pro.setCount(count);
|
||||
// 价格 = 面积 * 单价 + (款数-1) * 40
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 室内写真
|
||||
*
|
||||
* @param kind2
|
||||
* @param area
|
||||
* @param count
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice01(String kind2, Double area, int count, Integer number) {
|
||||
// 最低收费
|
||||
double price = 0.0;
|
||||
// 单价
|
||||
double danjia = 0.0;
|
||||
String weight = "0";
|
||||
DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
|
||||
switch (kind2) {
|
||||
// 高精室内写真
|
||||
case "2":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 50;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 45;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 32;
|
||||
} else if (area > 10 && area <= 20) {
|
||||
danjia = 28;
|
||||
} else if (area > 20 && area <= 50) {
|
||||
danjia = 25;
|
||||
} else {
|
||||
danjia = 23;
|
||||
}
|
||||
price = area * danjia > 50 ? area * danjia : 50;
|
||||
break;
|
||||
// pp纸(室内)
|
||||
case "3":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 62;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 45;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 35;
|
||||
} else {
|
||||
danjia = 28;
|
||||
}
|
||||
price = area * danjia > 70 ? area * danjia : 70;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
|
||||
break;
|
||||
// 直喷PVC
|
||||
case "5":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 70;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 55;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 45;
|
||||
} else {
|
||||
danjia = 40;
|
||||
}
|
||||
price = area * danjia > 100 ? area * danjia : 100;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
|
||||
break;
|
||||
// 高精室内相纸
|
||||
case "6":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 70;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 60;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 45;
|
||||
} else {
|
||||
danjia = 40;
|
||||
}
|
||||
price = area * danjia > 90 ? area * danjia : 90;
|
||||
break;
|
||||
// 单透
|
||||
case "7":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 75;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 65;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 55;
|
||||
} else {
|
||||
danjia = 45;
|
||||
}
|
||||
price = area * danjia > 100 ? area * danjia : 100;
|
||||
break;
|
||||
// 静电贴
|
||||
case "8":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 80;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 70;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 60;
|
||||
} else {
|
||||
danjia = 45;
|
||||
}
|
||||
price = area * danjia > 105 ? area * danjia : 105;
|
||||
break;
|
||||
// 软膜
|
||||
case "14":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 70;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 65;
|
||||
} else {
|
||||
danjia = 60;
|
||||
}
|
||||
price = area * danjia > 100 ? area * danjia : 100;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
|
||||
break;
|
||||
// 地贴(复防滑膜)
|
||||
case "15":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 75;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 65;
|
||||
} else {
|
||||
danjia = 55;
|
||||
}
|
||||
price = area * danjia > 100 ? area * danjia : 100;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
|
||||
break;
|
||||
// UV高透车贴(含白墨)
|
||||
case "16":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 160;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 150;
|
||||
} else {
|
||||
danjia = 140;
|
||||
}
|
||||
price = area * danjia > 160 ? area * danjia : 160;
|
||||
break;
|
||||
// UV高透车贴(不含白墨)
|
||||
case "17":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 150;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 140;
|
||||
} else {
|
||||
danjia = 130;
|
||||
}
|
||||
price = area * danjia > 160 ? area * danjia : 160;
|
||||
break;
|
||||
// 高透贴
|
||||
case "18":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 110;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 100;
|
||||
} else {
|
||||
danjia = 90;
|
||||
}
|
||||
price = area * danjia > 130 ? area * danjia : 130;
|
||||
break;
|
||||
// 防撞条腰线UV透明喷膜(含白墨)
|
||||
case "19":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 130;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 130;
|
||||
} else {
|
||||
danjia = 110;
|
||||
}
|
||||
price = area * danjia > 80 ? area * danjia : 80;
|
||||
break;
|
||||
// 防撞条腰线UV磨砂贴(含白墨)
|
||||
case "20":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 140;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 130;
|
||||
} else {
|
||||
danjia = 120;
|
||||
}
|
||||
price = area * danjia > 80 ? area * danjia : 80;
|
||||
break;
|
||||
// 防撞条腰线粗哑膜磨砂贴(不含白墨)
|
||||
case "21":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 115;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 105;
|
||||
} else {
|
||||
danjia = 100;
|
||||
}
|
||||
price = area * danjia > 80 ? area * danjia : 80;
|
||||
break;
|
||||
// 防撞条腰线磨砂镂空(粗哑膜刻字)
|
||||
case "22":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 150;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 140;
|
||||
} else {
|
||||
danjia = 130;
|
||||
}
|
||||
price = area * danjia > 100 ? area * danjia : 100;
|
||||
break;
|
||||
// 防撞条腰线即时贴刻字
|
||||
case "23":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 120;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 110;
|
||||
} else {
|
||||
danjia = 100;
|
||||
}
|
||||
price = area * danjia > 70 ? area * danjia : 70;
|
||||
break;
|
||||
case "24":
|
||||
price = area * 380 > 380 ? area * 380 : 380;
|
||||
break;
|
||||
}
|
||||
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
// 价格 = 面积 * 单价 + (款数-1) * 40
|
||||
if (number > 1) {
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
} else {
|
||||
pro.setPrice(Math.ceil(price));
|
||||
}
|
||||
pro.setWeight(weight);
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 户外写真
|
||||
*
|
||||
* @param kind2
|
||||
* @param area
|
||||
* @param count
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice02(String kind2, Double area, int count, Integer number) {
|
||||
double price = 0.0;
|
||||
double danjia = 0.0;
|
||||
String weight = "0";
|
||||
DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
|
||||
switch (kind2) {
|
||||
// 户外写真白胶(国产)
|
||||
case "0":
|
||||
// 根据面积得到单价
|
||||
if (area <= 2) {
|
||||
danjia = 55;
|
||||
} else if (area <= 5) {
|
||||
danjia = 45;
|
||||
} else if (area <= 7) {
|
||||
danjia = 40;
|
||||
} else if (area <= 8) {
|
||||
danjia = 37;
|
||||
} else if (area <= 10) {
|
||||
danjia = 31;
|
||||
} else if (area <= 20) {
|
||||
danjia = 29;
|
||||
} else if (area <= 50) {
|
||||
danjia = 27;
|
||||
} else {
|
||||
danjia = 26;
|
||||
}
|
||||
price = area * danjia > 50 ? area * danjia : 50;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
|
||||
break;
|
||||
// 户外写真黑胶(国产)
|
||||
case "1":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 56;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 45;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 36;
|
||||
} else {
|
||||
danjia = 30;
|
||||
}
|
||||
price = area * danjia > 50 ? area * danjia : 50;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.25 * number));
|
||||
break;
|
||||
// 户外写真可移白胶、黑胶
|
||||
case "2":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 60;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 55;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 50;
|
||||
} else {
|
||||
danjia = 35;
|
||||
}
|
||||
price = area * danjia > 85 ? area * danjia : 85;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.14 * number));
|
||||
break;
|
||||
// 户外写真喷膜
|
||||
case "3":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 65;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 50;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 45;
|
||||
} else {
|
||||
danjia = 35;
|
||||
}
|
||||
price = area * danjia > 80 ? area * danjia : 80;
|
||||
break;
|
||||
// 户外写真灯片
|
||||
case "5":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 68;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 50;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 40;
|
||||
} else {
|
||||
danjia = 30;
|
||||
}
|
||||
price = area * danjia > 90 ? area * danjia : 90;
|
||||
break;
|
||||
// 车贴(白胶)
|
||||
case "6":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 50;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 40;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 30;
|
||||
} else {
|
||||
danjia = 25;
|
||||
}
|
||||
price = area * danjia > 80 ? area * danjia : 80;
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
|
||||
break;
|
||||
}
|
||||
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
// 价格 = 面积 * 单价 + (款数-1) * 40
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
pro.setWeight(weight);
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布
|
||||
*
|
||||
* @param kind2
|
||||
* @param area
|
||||
* @param length
|
||||
* @param width
|
||||
* @param count
|
||||
* @param number
|
||||
* @param craftBu
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice03(String kind2, Double length, Double width, Double area, int count,
|
||||
Integer number, String craftBu) {
|
||||
double price = 0.0;
|
||||
double danjia = 0.0;
|
||||
switch (kind2) {
|
||||
// 550灯布
|
||||
case "1":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 30;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 28;
|
||||
} else {
|
||||
danjia = 25;
|
||||
}
|
||||
price = area * danjia > 60 ? area * danjia : 60;
|
||||
break;
|
||||
// 黑底布
|
||||
case "2":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 5) {
|
||||
danjia = 40;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 34;
|
||||
} else {
|
||||
danjia = 30;
|
||||
}
|
||||
price = area * danjia > 70 ? area * danjia : 70;
|
||||
break;
|
||||
|
||||
// 写真布
|
||||
case "6":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 30;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 28;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 25;
|
||||
} else {
|
||||
danjia = 23;
|
||||
}
|
||||
price = area * danjia > 50 ? area * danjia : 50;
|
||||
break;
|
||||
// 双喷布
|
||||
case "7":
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
double minSize = Math.min(length, width);
|
||||
double maxSize = Math.max(length, width);
|
||||
area = length * width * count * number;
|
||||
/*if (count == 1) {
|
||||
if (minSize < 1.52) {
|
||||
minSize = 1.52;
|
||||
area = maxSize * minSize * count * number;
|
||||
}
|
||||
}*/
|
||||
|
||||
// 根据宽得到单价
|
||||
if (minSize <= 1.52) {
|
||||
danjia = 50;
|
||||
} else {
|
||||
danjia = 65;
|
||||
}
|
||||
price = area * danjia > 50 ? area * danjia : 50;
|
||||
|
||||
// 挂轴 每米12元
|
||||
if ("挂轴".equals(craftBu)) {
|
||||
price = price + (maxSize * 12 > 12 ? maxSize * 12 : 12);
|
||||
}
|
||||
|
||||
pro.setCount(count);
|
||||
// 价格 = 面积 * 单价 + 款数 * 20
|
||||
pro.setPrice(Math.ceil(price + number * 20));
|
||||
list.add(pro);
|
||||
return list;
|
||||
// 油画布
|
||||
case "8":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 80;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 75;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 60;
|
||||
} else {
|
||||
danjia = 35;
|
||||
}
|
||||
price = area * danjia > 130 ? area * danjia : 130;
|
||||
break;
|
||||
// 墙纸
|
||||
case "9":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 2) {
|
||||
danjia = 70;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 60;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 50;
|
||||
} else {
|
||||
danjia = 35;
|
||||
}
|
||||
price = area * danjia > 105 ? area * danjia : 105;
|
||||
break;
|
||||
// 旗帜布
|
||||
case "10":
|
||||
// 根据面积得到单价
|
||||
if ("双喷".equals(craftBu)) {
|
||||
if ((width == 50 && length == 300 || length == 50 && width == 300) && count == 1) {
|
||||
price = 53;
|
||||
} else if (area <= 1) {
|
||||
price = 53;
|
||||
} else if (area <= 2) {
|
||||
price = 43 * area;
|
||||
} else if (area <= 3) {
|
||||
price = 38 * area;
|
||||
} else if (area <= 4) {
|
||||
price = 33 * area;
|
||||
} else if (area <= 5) {
|
||||
price = 31 * area;
|
||||
} else if (area <= 10) {
|
||||
price = 28 * area;
|
||||
} else {
|
||||
price = 25 * area;
|
||||
}
|
||||
} else {
|
||||
if ((width == 50 && length == 300) && (length == 50 && width == 300) && count == 1) {
|
||||
price = 50;
|
||||
} else if (area <= 1) {
|
||||
price = 50;
|
||||
} else if (area <= 2) {
|
||||
price = 40 * area;
|
||||
} else if (area <= 3) {
|
||||
price = 35 * area;
|
||||
} else if (area <= 4) {
|
||||
price = 33 * area;
|
||||
} else if (area <= 5) {
|
||||
price = 28 * area;
|
||||
} else if (area <= 10) {
|
||||
price = 25 * area;
|
||||
} else {
|
||||
price = 23 * area;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (area > 0 && area <= 3) {
|
||||
danjia = 20;
|
||||
} else if (area > 3 && area <= 5) {
|
||||
danjia = 19;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 18;
|
||||
} else {
|
||||
danjia = 17;
|
||||
}
|
||||
if(area < 1.5) {
|
||||
price = area * danjia + (count * 10) > 35 ? area * danjia + (count * 10) : 35;
|
||||
}else {
|
||||
price = area * danjia * count > 35 ? area * danjia * count : 35;
|
||||
}*/
|
||||
|
||||
break;
|
||||
}
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 展架
|
||||
*
|
||||
* @param kind2
|
||||
* @param count
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice04(String kind2, int count, Integer number) {
|
||||
double price = 0.0;
|
||||
String weight = "0";
|
||||
DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
|
||||
switch (kind2) {
|
||||
// 直喷PVC装美式展架180*80
|
||||
case "0":
|
||||
price = 120;
|
||||
break;
|
||||
// 直喷PVC装美式展架160*60
|
||||
case "1":
|
||||
price = 115;
|
||||
break;
|
||||
// PP纸装美式展架180*80
|
||||
case "2":
|
||||
price = 115;
|
||||
break;
|
||||
// PP纸装美式展架160*60
|
||||
case "3":
|
||||
price = 110;
|
||||
break;
|
||||
// 直喷PVC装门型展架180*80
|
||||
case "4":
|
||||
price = 158;
|
||||
break;
|
||||
// PP纸装门型展架180*80
|
||||
case "6":
|
||||
price = 140;
|
||||
break;
|
||||
// PP纸装门型展架160*60
|
||||
case "7":
|
||||
price = 135;
|
||||
break;
|
||||
// X展架180*80(不含画面)
|
||||
case "8":
|
||||
price = 55;
|
||||
break;
|
||||
// X展架160*60(不含画面)
|
||||
case "9":
|
||||
price = 50;
|
||||
break;
|
||||
// 门型展架180*80(不含画面)
|
||||
case "10":
|
||||
price = 75;
|
||||
break;
|
||||
// 门型展架160*60(不含画面)
|
||||
case "11":
|
||||
price = 70;
|
||||
break;
|
||||
// 直喷pvc铝合金易拉宝
|
||||
case "12":
|
||||
price = 108;
|
||||
break;
|
||||
// 直喷pvc塑钢易拉宝
|
||||
case "13":
|
||||
price = 118;
|
||||
break;
|
||||
}
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
// 价格 = 个数 * 款数 * 单价 ===================+ (款数-1) * 40
|
||||
pro.setPrice(Math.ceil(count * number * price));// + (number - 1) * 40
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
||||
import lingtao.net.bean.SysUser;
|
||||
|
||||
public class PublicMethods {
|
||||
|
||||
// 是否有【超管】或者【组长】身份
|
||||
public boolean isSuperOrManager() {
|
||||
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String role = user.getRole();
|
||||
boolean flag = false;
|
||||
if (role.contains(",")) {
|
||||
String[] split = role.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if ("1011".equals(split[i]) || "1".equals(split[i])) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ("1011".equals(role) || "1".equals(role)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// 是否有【超管】身份
|
||||
public boolean isSuper() {
|
||||
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String role = user.getRole();
|
||||
boolean flag = false;
|
||||
if (role.contains(",")) {
|
||||
String[] split = role.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if ("1".equals(split[i]) || "2".equals(split[i])) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ("1".equals(role) || "2".equals(role)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A级铜版纸不干胶价格
|
||||
*/
|
||||
public class StickersDoublePrice {
|
||||
|
||||
static int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000};
|
||||
|
||||
// 双面印刷不干胶报价
|
||||
public static List<Product> getPrice(double length, double width, int count, int number) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
double area = length * width;
|
||||
double[] priceArr = getBasePrice(area);
|
||||
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count || list.size() > 3) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(priceArr[i]);//不够140元按照140元算
|
||||
list.add(pro);
|
||||
}
|
||||
|
||||
//多款计算
|
||||
if (number > 1) {
|
||||
for (Product product : list) {
|
||||
product.setPrice(product.getPrice() * number);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static double[] getBasePrice(double area) {
|
||||
double[] startPriceArr = null;
|
||||
double[] endPriceArr = null;
|
||||
double avgArea = 0;
|
||||
if (area < 25) {
|
||||
return new double[]{70, 92, 164, 236, 370, 740, 1480};
|
||||
} else if (area >= 25 && area < 48.6) {
|
||||
if (area == 25) {
|
||||
return new double[]{70, 92, 164, 236, 370, 740, 1480};
|
||||
}
|
||||
avgArea = 25 + 48.6;
|
||||
startPriceArr = new double[]{70, 92, 164, 236, 370, 740, 1480};
|
||||
endPriceArr = new double[]{130, 180, 320, 440, 700, 1400, 2700};
|
||||
} else if (area >= 48.6 && area < 81) {
|
||||
if (area == 48.6) {
|
||||
return new double[]{130, 180, 320, 440, 700, 1400, 2700};
|
||||
}
|
||||
avgArea = 81 + 48.6;
|
||||
startPriceArr = new double[]{130, 180, 320, 440, 700, 1400, 2700};
|
||||
endPriceArr = new double[]{220, 310, 572, 824, 1230, 2400, 4710};
|
||||
} else if (area >= 81 && area < 126) {
|
||||
if (area == 81) {
|
||||
return new double[]{220, 310, 572, 824, 1230, 2400, 4710};
|
||||
}
|
||||
avgArea = 81 + 126;
|
||||
startPriceArr = new double[]{220, 310, 572, 824, 1230, 2400, 4710};
|
||||
endPriceArr = new double[]{370, 436, 760, 1086, 1740, 3460, 6920};
|
||||
} else if (area >= 126 && area < 170) {
|
||||
if (area == 126) {
|
||||
return new double[]{370, 436, 760, 1086, 1740, 3460, 6920};
|
||||
}
|
||||
avgArea = 126 + 170;
|
||||
startPriceArr = new double[]{370, 436, 760, 1086, 1740, 3460, 6920};
|
||||
endPriceArr = new double[]{516, 594, 1050, 1500, 2400, 4800, 9600};
|
||||
} else if (area >= 170 && area < 210) {
|
||||
if (area == 170) {
|
||||
return new double[]{516, 594, 1050, 1500, 2400, 4800, 9600};
|
||||
}
|
||||
avgArea = 170 + 210;
|
||||
startPriceArr = new double[]{516, 594, 1050, 1500, 2400, 4800, 9600};
|
||||
endPriceArr = new double[]{630, 772, 1360, 1948, 3124, 6248, 12496};
|
||||
} else if (area >= 210 && area < 230) {
|
||||
if (area == 210) {
|
||||
return new double[]{630, 772, 1360, 1948, 3124, 6248, 12496};
|
||||
}
|
||||
avgArea = 210 + 230;
|
||||
startPriceArr = new double[]{630, 772, 1360, 1948, 3124, 6248, 12496};
|
||||
endPriceArr = new double[]{770, 860, 1512, 2170, 3470, 4940, 11880};
|
||||
} else if (area >= 230 && area < 294) {
|
||||
if (area == 230) {
|
||||
return new double[]{770, 860, 1512, 2170, 3470, 4940, 11880};
|
||||
}
|
||||
avgArea = 230 + 294;
|
||||
startPriceArr = new double[]{770, 860, 1512, 2170, 3470, 4940, 11880};
|
||||
endPriceArr = new double[]{840, 970, 1700, 2434, 3904, 7800, 15600};
|
||||
} else {
|
||||
return new double[]{840, 970, 1700, 2434, 3904, 7800, 15600};
|
||||
}
|
||||
double[] priceArr = new double[bigCountArr.length];
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
priceArr[i] = Math.ceil((startPriceArr[i] + endPriceArr[i]) / avgArea * area);
|
||||
}
|
||||
|
||||
return priceArr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* 常规-树纹纸报价*/
|
||||
public class SwzStickersPrice {
|
||||
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000};
|
||||
|
||||
/*
|
||||
* 根据供应商报价,按照利润算出报价*/
|
||||
public double setPrice(int count, double length, double width, int number, String kind) {
|
||||
double price = 0;
|
||||
if (kind.equals("浮雕烫金")) {
|
||||
double max = Math.max(length, width);
|
||||
double min = Math.min(length, width);
|
||||
if (max <= 6) {
|
||||
//长=length+0.3cm(间隔)+length+1cm(出血)
|
||||
price = (max * 2 + 1.3) * (min + 1) * 1.8;
|
||||
} else {
|
||||
//长=length+1cm(间隔)+length+1cm(出血)
|
||||
price = (max * 2 + 2) * (min + 1) * 1.8;
|
||||
}
|
||||
//20刀模费,5mm出血,9元/平方
|
||||
price += 20 + (length + 0.5) * (width + 0.5) * count / 10000 * 9;
|
||||
price = Math.ceil(2 * price * 2);//50%利润
|
||||
price = price < 480 ? 480 : price;
|
||||
} else if (kind.equals("彩色印刷")) {
|
||||
double l = 425;
|
||||
double w = 285;
|
||||
// 换成毫米每边+2
|
||||
length = length * 10 + 4;
|
||||
width = width * 10 + 4;
|
||||
if ((length > l || width > w) && (length > w || width > l))
|
||||
return 0;
|
||||
// 一张大纸能做多少个此类尺寸的不干胶
|
||||
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
||||
Math.floor(l / width) * Math.floor(w / length));
|
||||
|
||||
// 报的数量需要多少张大纸
|
||||
int num = (int) Math.ceil(count / max);
|
||||
price = 50 + (num - 1) * 5.5;
|
||||
} else {//激凸、烫金工艺一样价格
|
||||
//20刀模费,20版费,5mm出血,7.5元/平方
|
||||
price = (length + 0.5) * (width + 0.5) * count / 10000 * 7.5 + 40;
|
||||
price = Math.ceil(2 * price);
|
||||
price /= 0.4;//60%利润
|
||||
}
|
||||
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
public List<Product> getPrice(int count, double length, double width, int number, String craft) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (bigCountArr[i] < count || list.size() > 3) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(bigCountArr[i]);
|
||||
pro.setPrice(Math.ceil(setPrice(bigCountArr[i], length, width, number, craft)));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 哑金/哑银不干胶价格
|
||||
*/
|
||||
public class YaJinStickersPrice {
|
||||
|
||||
int countArr[] = { 500, 1000, 2000, 3000, 4000, 5000, 10000 };
|
||||
|
||||
// 根据尺寸计算价格
|
||||
public List<Product> accountPriceBySize(Double width, Double length, int count, int[] priceArr1, int[] priceArr2,
|
||||
int[] priceArr3) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if ((length <= 6 && width <= 5) || (length <= 5 && width <= 6) || (length <= 10 && width <= 3)
|
||||
|| (length <= 3 && width <= 10)) {
|
||||
list = getPrice(count, priceArr1);
|
||||
} else if ((length <= 8 && width <= 8) || (length <= 10 && width <= 6) || (length <= 6 && width <= 10)) {
|
||||
list = getPrice(count, priceArr2);
|
||||
} else if ((length <= 11 && width <= 11) || (length <= 12 && width <= 8) || (length <= 8 && width <= 12)
|
||||
|| (length <= 20) && (width <= 4) || (width <= 20) && (length <= 4)) {
|
||||
list = getPrice(count, priceArr3);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 6*5cm以下及10*3cm以下
|
||||
// 6*5cm-8*8cm;10-3cm-10*6cm以内
|
||||
// 8*8cm-11*11cm;10*6-12*8CM;20*4以内
|
||||
private List<Product> getPrice(int count, int[] priceArr) {
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
// 数量大于10000
|
||||
if (count > countArr[countArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
// 10000个的单价*数量
|
||||
pro.setPrice(Math.ceil(count * priceArr[countArr.length - 1] / countArr[countArr.length - 1]));
|
||||
list.add(pro);
|
||||
}
|
||||
for (int i = 0; i < countArr.length; i++) {
|
||||
if (countArr[i] < count) {
|
||||
continue;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(countArr[i]);
|
||||
pro.setPrice(Math.ceil(priceArr[i]));
|
||||
list.add(pro);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// 哑金不干胶不带凹凸
|
||||
public List<Product> getPriceNoAoTu(Double length, Double width, int count) {
|
||||
double l = 404;
|
||||
double w = 289;
|
||||
double price = 0.0;
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
// 换成毫米每边+2
|
||||
length = length * 10 + 4;
|
||||
width = width * 10 + 4;
|
||||
if ((length > l || width > w) && (length > w || width > l))
|
||||
return null;
|
||||
// 一张A4纸 大的400*285 能做多少个此类尺寸的不干胶
|
||||
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
||||
Math.floor(l / width) * Math.floor(w / length));
|
||||
// 报的数量需要多少张大纸
|
||||
int num = (int) Math.ceil(count / max);
|
||||
if (max <= 20) {
|
||||
price = 65;
|
||||
} else if (max <= 50) {
|
||||
price = 75;
|
||||
} else if (max <= 100) {
|
||||
price = 85;
|
||||
} else if (max <= 200) {
|
||||
price = 100;
|
||||
} else if (max <= 300) {
|
||||
price = 110;
|
||||
} else {
|
||||
price = 150;
|
||||
}
|
||||
if (max <= 200) {
|
||||
/*price = price + (num - 1) * 12;
|
||||
// if (num > 10) {
|
||||
// price = price + (num - 1) * 10;
|
||||
// } else {
|
||||
// price = price + (num - 1) * 20;
|
||||
// }*/
|
||||
if(num < 50) {
|
||||
price = price + (num - 1 ) * 12;
|
||||
}else if(num <= 100) {
|
||||
price = price + (num - 1 ) * 10;
|
||||
}else {
|
||||
price = price + (num - 1 ) * 6;
|
||||
}
|
||||
} else {
|
||||
if (num > 10) {
|
||||
price = price + (num - 1) * 10;
|
||||
} else {
|
||||
price = price + (num - 1) * 30;
|
||||
}
|
||||
}
|
||||
|
||||
pro.setCount(count);
|
||||
pro.setPrice(price);
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 哑银不干胶价格
|
||||
*/
|
||||
public class YaYinStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
public List<Product> bigSizeAcountPrice(int count, Double area, Double[] priceArr) {
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
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;
|
||||
}
|
||||
|
||||
public List<Product> getPrice(int count, Double area) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (area <= 0.0004) {
|
||||
Double priceArrA[] = { 800.0, 525.0, 363.0, 300.0, 275.0, 255.0, 180.0, 100.0, 75.0, 70.0, 65.0, 60.0, 60.0,
|
||||
55.0, 50.0, 50.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0006) {
|
||||
Double priceArrA[] = { 535.0, 350.0, 242.0, 200.0, 184.0, 170.0, 100.0, 80.0, 70.0, 65.0, 60.0, 57.0, 55.0,
|
||||
52.0, 50.0, 49.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0008) {
|
||||
Double priceArrA[] = { 460.0, 300.0, 207.0, 172.0, 157.0, 146.0, 90.0, 70.0, 60.0, 54.0, 53.0, 52.0, 51.0,
|
||||
50.0, 49.0, 48.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.001) {
|
||||
Double priceArrA[] = { 355.0, 233.0, 161.0, 134.0, 122.0, 113.0, 80.0, 40.0, 30.0, 29.0, 27.0, 26.0, 25.0,
|
||||
24.0, 22.0, 22.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0012) {
|
||||
Double priceArrA[] = { 267.0, 175.0, 121.0, 100.0, 92.0, 85.0, 70.0, 40.0, 30.0, 25.0, 24.0, 23.0, 22.0,
|
||||
21.0, 20.0, 19.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0014) {
|
||||
Double priceArrA[] = { 246.0, 162.0, 116.0, 92.0, 85.0, 78.0, 60.0, 40.0, 30.0, 25.0, 24.0, 23.0, 22.0,
|
||||
21.0, 20.0, 19.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0016) {
|
||||
Double priceArrA[] = { 220.0, 140.0, 97.0, 80.0, 74.0, 68.0, 50.0, 38.0, 30.0, 25.0, 24.0, 22.0, 21.0, 20.0,
|
||||
19.0, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0025) {
|
||||
Double priceArrA[] = { 190.0, 124.0, 86.0, 71.0, 65.0, 60.0, 50.0, 38.0, 30.0, 26.0, 23.0, 21.0, 20.0, 19.0,
|
||||
18.0, 17.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0035) {
|
||||
Double priceArrA[] = { 150.0, 100.0, 70.0, 55.5, 45.0, 42.0, 40.0, 33.0, 28.0, 23.0, 19.0, 18.0, 17.0, 16.0,
|
||||
14.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0045) {
|
||||
Double priceArrA[] = { 90.0, 59.0, 40.0, 34.0, 31.0, 28.0, 22.0, 19.0, 16.0, 15.0, 14.0, 14.0, 14.0, 14.0,
|
||||
14.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.0084) {
|
||||
Double priceArrA[] = { 66.0, 43.0, 30.0, 26.0, 23.0, 17.0, 15.0, 14.5, 14.0, 14.0, 14.0, 14.0, 14.0, 14.0,
|
||||
14.0, 14.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.012) {
|
||||
Double priceArrA[] = { 50.0, 40.0, 30.0, 26.0, 20.0, 16.0, 13.0, 13.0, 13.0, 13.0, 13.0, 13.0, 13.0, 13.0,
|
||||
13.0, 13.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.015) {
|
||||
Double priceArrA[] = { 48.0, 38.0, 29.0, 25.0, 18.0, 15.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0,
|
||||
12.0, 12.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.02) {
|
||||
Double priceArrA[] = { 40.0, 30.0, 25.0, 22.0, 18.0, 13.0, 12.0, 12.0, 12.0, 12.0, 12.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.04) {
|
||||
Double priceArrA[] = { 38.0, 26.0, 23.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 };
|
||||
list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
} else if (area <= 0.06) {
|
||||
Double priceArr[] = { 35.0, 24.0, 21.0, 19.0, 14.0, 13.0, 13.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArr);
|
||||
} else if (area <= 0.1) {
|
||||
Double priceArr[] = { 34.0, 22.0, 19.0, 18.0, 14.0, 13.0, 13.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArr);
|
||||
} else if (area <= 0.2) {
|
||||
Double priceArr[] = { 34.0, 21.0, 18.0, 17.0, 14.0, 13.0, 13.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArr);
|
||||
} else if (area > 0.2) {
|
||||
Double priceArr[] = { 34.0, 20.0, 17.0, 16.0, 14.0, 12.0, 12.0, 12.0, 12.0, 11.5, 11.5, 11.0, 11.0, 11.0,
|
||||
11.0, 11.0 };
|
||||
list = bigSizeAcountPrice(count, area, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* public List<Product> getPrice(int count, Double area, int areaArrIndex) {
|
||||
* List<Product> list = new ArrayList<Product>(); if (areaArrIndex == 1) {
|
||||
* Double priceArrA[] = { 800.0, 460.0, 363.0, 300.0, 275.0, 255.0, 145.0,
|
||||
* 110.0, 85.0, 70.0, 65.0, 60.0, 55.0, 53.0, 51.0, 50.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 2) {
|
||||
* Double priceArrA[] = { 555.0, 350.0, 272.0, 220.0, 200.0, 185.0, 110.0, 80.0,
|
||||
* 62.0, 55.0, 55.0, 55.0, 55.0, 52.0, 50.0, 49.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 3) {
|
||||
* Double priceArrA[] = { 460.0, 300.0, 207.0, 172.0, 157.0, 146.0, 90.0, 63.0,
|
||||
* 50.0, 45.0, 45.0, 45.0, 43.0, 43.0, 41.0, 40.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 4) {
|
||||
* Double priceArrA[] = { 375.0, 250.0, 170.0, 140.0, 130.0, 120.0, 80.0, 55.0,
|
||||
* 45.0, 40.0, 40.0, 40.0, 39.0, 38.0, 36.0, 35.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 5) {
|
||||
* Double priceArrA[] = { 320.0, 230.0, 150.0, 130.0, 115.0, 110.0, 73.0, 50.0,
|
||||
* 40.0, 35.0, 35.0, 35.0, 34.0, 33.0, 32.0, 31.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 6) {
|
||||
* Double priceArrA[] = { 276.0, 200.0, 136.0, 120.0, 100.0, 100.0, 65.0, 48.0,
|
||||
* 38.0, 33.0, 32.0, 32.0, 31.0, 30.0, 29.0, 28.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 7) {
|
||||
* Double priceArrA[] = { 250.0, 180.0, 125.0, 110.0, 90.0, 90.0, 60.0, 45.0,
|
||||
* 36.0, 32.0, 29.0, 29.0, 28.0, 27.0, 26.0, 26.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 8) {
|
||||
* Double priceArrA[] = { 225.0, 163.0, 113.0, 100.0, 81.0, 80.0, 55.0, 40.0,
|
||||
* 33.0, 30.0, 26.0, 26.0, 26.0, 25.0, 25.0, 24.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 9) {
|
||||
* Double priceArrA[] = { 210.0, 150.0, 105.0, 92.5, 75.0, 73.7, 50.7, 38.0,
|
||||
* 30.5, 28.0, 24.5, 24.2, 24.2, 23.3, 23.2, 22.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 10) {
|
||||
* Double priceArrA[] = { 200.0, 145.0, 100.0, 88.0, 70.0, 70.0, 48.5, 36.0,
|
||||
* 28.0, 26.0, 22.0, 22.0, 22.0, 21.0, 20.0, 20.0 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 11) {
|
||||
* Double priceArrA[] = { 190.0, 133.0, 90.0, 76.0, 65.0, 65.0, 45.0, 34.5,
|
||||
* 24.0, 23.0, 22.0, 21.0, 20.0, 20.0, 19.0, 18.5 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 12) {
|
||||
* Double priceArrA[] = { 170.0, 40.0, 30.0, 26.0, 20.0, 16.0, 13.0, 13.0, 13.0,
|
||||
* 13.0, 13.0, 13.0, 13.0, 13.0, 13.0, 13.0 }; list = bigSizeAcountPrice(count,
|
||||
* area, priceArrA); } else if (areaArrIndex == 13) { Double priceArrA[] = {
|
||||
* 160.0, 38.0, 29.0, 25.0, 18.0, 15.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0,
|
||||
* 12.0, 12.0, 12.0, 12.0 }; list = bigSizeAcountPrice(count, area, priceArrA);
|
||||
* } else if (areaArrIndex == 14) { Double priceArrA[] = { 150.0, 30.0, 25.0,
|
||||
* 22.0, 18.0, 13.0, 12.0, 12.0, 12.0, 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0
|
||||
* }; list = bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex
|
||||
* == 15) { Double priceArrA[] = { 138.0, 26.0, 23.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 }; list =
|
||||
* bigSizeAcountPrice(count, area, priceArrA); } else if (areaArrIndex == 16) {
|
||||
* Double priceArr[] = { 135.0, 24.0, 21.0, 19.0, 14.0, 13.0, 13.0, 13.0, 13.0,
|
||||
* 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0 }; list = bigSizeAcountPrice(count,
|
||||
* area, priceArr); } else if (areaArrIndex == 17) { Double priceArr[] = {
|
||||
* 124.0, 22.0, 19.0, 18.0, 14.0, 13.0, 13.0, 13.0, 13.0, 12.0, 12.0, 11.0,
|
||||
* 11.0, 11.0, 11.0, 11.0 }; list = bigSizeAcountPrice(count, area, priceArr); }
|
||||
* else if (areaArrIndex == 18) { Double priceArr[] = { 120.0, 21.0, 18.0, 17.0,
|
||||
* 14.0, 13.0, 13.0, 13.0, 13.0, 12.0, 12.0, 11.0, 11.0, 11.0, 11.0, 11.0 };
|
||||
* list = bigSizeAcountPrice(count, area, priceArr); } else { Double priceArr[]
|
||||
* = { 110.0, 20.0, 17.0, 16.0, 14.0, 12.0, 12.0, 12.0, 12.0, 11.5, 11.5, 11.0,
|
||||
* 11.0, 11.0, 11.0, 11.0 }; list = bigSizeAcountPrice(count, area, priceArr); }
|
||||
* return list; }
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 易碎标价格
|
||||
*/
|
||||
public class YiSBStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
/**
|
||||
* 易碎标遍历添加价格
|
||||
*/
|
||||
private List<Product> bigSizeAcountPrice(int count, Double area, List<Product> list, Double[] priceArr) {
|
||||
Product pro = new Product();
|
||||
if (area > 0.0001) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
if (count > bigCountArr[bigCountArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(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(priceArr[i]);
|
||||
list.add(pro);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice(int count, Double area) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (area > 0 && area <= 0.0001) {
|
||||
Double priceArrA[] = { 150.0, 160.0, 170.0, 180.0, 200.0, 260.0, 320.0, 360.0, 400.0, 480.0, 550.0, 620.0,
|
||||
680.0, 740.0, 820.0, 880.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0001 && area <= 0.0004) {
|
||||
Double priceArrA[] = { 650.0, 400.0, 260.0, 200.0, 150.0, 110.0, 80.0, 70.0, 65.0, 62.0, 60.0, 58.0, 56.0,
|
||||
54.0, 52.0, 50.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0004 && area <= 0.0006) {
|
||||
Double priceArrA[] = { 440.0, 280.0, 175.0, 135.0, 103.0, 75.0, 56.0, 49.5, 46.0, 44.0, 42.5, 41.5, 40.5,
|
||||
39.5, 38.5, 38.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0006 && area <= 0.0008) {
|
||||
Double priceArrA[] = { 372.0, 230.0, 159.0, 130.0, 105.0, 87.0, 65.0, 57.5, 53.5, 51.0, 49.0, 47.0, 46.0,
|
||||
45.0, 44.0, 43.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0008 && area <= 0.001) {
|
||||
Double priceArrA[] = { 320.0, 200.0, 135.0, 111.0, 92.6, 77.0, 61.5, 56.0, 53.0, 51.0, 49.5, 49.0, 48.0,
|
||||
47.0, 46.0, 46.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.001 && area <= 0.0012) {
|
||||
Double priceArrA[] = { 277.0, 171.0, 115.0, 95.0, 80.0, 65.8, 52.5, 48.0, 45.8, 44.3, 43.4, 42.7, 42.2, 41.8,
|
||||
41.5, 41.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0012 && area <= 0.0014) {
|
||||
Double priceArrA[] = { 243.0, 150.0, 101.0, 83.3, 75.0, 61.8, 48.8, 44.4, 42.1, 40.6, 39.7, 39.0, 38.5, 38.0,
|
||||
37.6, 37.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0014 && area <= 0.0016) {
|
||||
Double priceArrA[] = { 220.0, 135.0, 91.0, 75.0, 64.0, 56.2, 45.3, 41.6, 39.8, 38.8, 37.9, 37.4, 37.0, 36.6,
|
||||
36.4, 36.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0016 && area <= 0.0025) {
|
||||
Double priceArrA[] = { 210.0, 130.0, 86.0, 70.0, 58.6, 51.5, 41.8, 38.1, 36.3, 35.2, 34.5, 33.9, 33.5, 33.1,
|
||||
33.0, 33.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0025 && area <= 0.0035) {
|
||||
Double priceArrA[] = { 200.0, 123.0, 81.0, 65.3, 55.0, 50.0, 39.2, 35.5, 33.7, 32.5, 31.8, 31.2, 30.8, 30.5,
|
||||
30.4, 30.3 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0035 && area <= 0.0045) {
|
||||
Double priceArrA[] = { 195.0, 121.0, 79.0, 63.9, 53.4, 48.7, 37.5, 33.75, 31.9, 30.75, 30.0, 29.4, 29.0, 28.7,
|
||||
28.5, 28.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0045 && area <= 0.0084) {
|
||||
Double priceArrA[] = { 195.0, 119.6, 79.0, 63.0, 53.0, 48.5, 37.0, 33.0, 31.4, 30.0, 30.0, 29.0, 28.6, 28.2,
|
||||
28.3, 28.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0084 && area <= 0.012) {
|
||||
Double priceArrA[] = { 90.0, 60.0, 50.0, 45.0, 38.0, 38.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0,
|
||||
35.0, 35.0, };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.012 && area <= 0.015) {
|
||||
Double priceArrA[] = { 80.0, 55.0, 45.0, 40.0, 35.0, 35.0, 34.0, 34.0, 34.0, 34.0, 34.0, 34.0, 34.0, 34.0,
|
||||
34.0, 34.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.015 && area <= 0.02) {
|
||||
Double priceArrA[] = { 65.0, 50.0, 40.0, 36.0, 33.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
|
||||
30.0, 30.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.02 && area <= 0.04) {
|
||||
Double priceArr[] = { 55.0, 45.0, 35.0, 35.0, 32.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
|
||||
30.0, 30.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.04 && area <= 0.06) {
|
||||
Double priceArr[] = { 50.0, 40.0, 35.0, 35.0, 30.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0,
|
||||
26.0, 26.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.06 && area <= 0.1) {
|
||||
Double priceArr[] = { 45.0, 37.0, 35.0, 35.0, 30.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0,
|
||||
26.0, 26.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.1 && area <= 0.2) {
|
||||
Double priceArr[] = { 40.0, 35.0, 30.0, 30.0, 27.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0,
|
||||
26.0, 26.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
|
||||
/**
|
||||
* 易碎标价格
|
||||
*/
|
||||
public class YinPGStickersPrice {
|
||||
|
||||
int bigCountArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
|
||||
100000 };
|
||||
|
||||
/**
|
||||
* 易碎标遍历添加价格
|
||||
*/
|
||||
private List<Product> bigSizeAcountPrice(int count, Double area, List<Product> list, Double[] priceArr) {
|
||||
Product pro = new Product();
|
||||
if (area > 0.0001) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
if (count > bigCountArr[bigCountArr.length - 1]) {
|
||||
pro.setCount(count);
|
||||
pro.setPrice(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(priceArr[i]);
|
||||
list.add(pro);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Product> getPrice(int count, Double area) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
if (area > 0 && area <= 0.0001) {
|
||||
Double priceArrA[] = { 150.0, 160.0, 170.0, 180.0, 200.0, 260.0, 320.0, 360.0, 400.0, 480.0, 550.0, 620.0,
|
||||
680.0, 740.0, 820.0, 880.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0001 && area <= 0.0004) {
|
||||
Double priceArrA[] = { 550.0, 285.0, 158.0, 110.0, 73.0, 46.0, 32.0, 28.0, 25.0, 24.0, 23.0, 22.0, 21.0,
|
||||
21.0, 20.0, 20.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0004 && area <= 0.0006) {
|
||||
Double priceArrA[] = { 393.0, 205.0, 111.0, 80.0, 55.0, 37.0, 28.0, 25.0, 23.0, 22.0, 22.5, 21.5, 20.5,
|
||||
20.5, 20.0, 19.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0006 && area <= 0.0008) {
|
||||
Double priceArrA[] = { 303.0, 160.0, 90.0, 66.0, 46.0, 33.0, 26.0, 24.5, 22.5, 21.0, 21.0, 20.5, 20.5, 20.0,
|
||||
20.0, 19.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0008 && area <= 0.001) {
|
||||
Double priceArrA[] = { 248.0, 133.0, 77.0, 56.0, 41.6, 30.0, 24.5, 22.5, 21.5, 21.0, 20.5, 20.0, 19.5, 19.5,
|
||||
19.0, 19.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.001 && area <= 0.0012) {
|
||||
Double priceArrA[] = { 212.0, 115.0, 68.0, 51.0, 37.0, 28.0, 23.5, 22.0, 21.8, 21.0, 20.4, 20.0, 19.5, 19.3,
|
||||
19.0, 19.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0012 && area <= 0.0014) {
|
||||
Double priceArrA[] = { 186.0, 102.0, 61.0, 46.3, 34.0, 27.0, 23.3, 22.0, 21.1, 21.0, 20.0, 19.8, 19.5, 19.0,
|
||||
18.6, 18.5 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0014 && area <= 0.0016) {
|
||||
Double priceArrA[] = { 167.0, 92.0, 56.0, 43.0, 33.0, 26.2, 22.3, 21.6, 21.0, 20.8, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0016 && area <= 0.0025) {
|
||||
Double priceArrA[] = { 118.0, 68.0, 44.0, 35.0, 28.6, 23.5, 21.8, 21.1, 21.0, 20.8, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0025 && area <= 0.0035) {
|
||||
Double priceArrA[] = { 93.0, 56.0, 38.0, 31.3, 25.0, 22.0, 21.2, 21.1, 21.0, 20.8, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0035 && area <= 0.0045) {
|
||||
Double priceArrA[] = { 78.0, 48.0, 34.0, 28.5, 34.4, 21.7, 21.2, 21.1, 21.0, 20.8, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0045 && area <= 0.0084) {
|
||||
Double priceArrA[] = { 56.0, 37.6, 29.0, 25.0, 22.0, 21.5, 21.0, 20.5, 20.4, 20.0, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.0084 && area <= 0.012) {
|
||||
Double priceArrA[] = { 48.0, 34.0, 27.0, 23.0, 22.0, 21.3, 21.0, 20.5, 20.4, 20.0, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.012 && area <= 0.015) {
|
||||
Double priceArrA[] = { 45.0, 35.0, 26.0, 23.0, 22.0, 21.0, 21.0, 20.5, 20.4, 20.0, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.015 && area <= 0.02) {
|
||||
Double priceArrA[] = { 41.0, 30.0, 25.0, 23.0, 22.0, 21.0, 21.0, 20.5, 20.4, 20.0, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArrA);
|
||||
} else if (area > 0.02 && area <= 0.04) {
|
||||
Double priceArr[] = { 36.0, 27.0, 25.0, 22.0, 21.0, 21.0, 21.0, 20.5, 20.4, 20.0, 19.9, 19.4, 19.0, 18.6,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.04 && area <= 0.06) {
|
||||
Double priceArr[] = { 34.0, 27.0, 24.0, 22.0, 20.0, 20.0, 19.5, 19.5, 19.4, 19.0, 19.0, 18.6, 18.6, 18.4,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.06 && area <= 0.1) {
|
||||
Double priceArr[] = { 32.0, 26.0, 24.0, 22.0, 20.0, 20.0, 19.5, 19.5, 19.4, 19.0, 19.0, 18.6, 18.6, 18.4,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
} else if (area > 0.1 && area <= 0.2) {
|
||||
Double priceArr[] = { 30.0, 25.0, 23.0, 21.0, 20.0, 20.0, 19.5, 19.5, 19.4, 19.0, 19.0, 18.6, 18.6, 18.4,
|
||||
18.4, 18.0 };
|
||||
list = bigSizeAcountPrice(count, area, list, priceArr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import lingtao.net.bean.Product;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ZsPrice {
|
||||
public List<Product> getPrice(int count, double length, double width, List<Product> list, int number, String shenzi) {
|
||||
double price = 50;
|
||||
double l = 438.0;
|
||||
double w = 304.0;
|
||||
length += 3;
|
||||
width += 3;
|
||||
// 一张l/w 大的纸张能做多少个此类尺寸的产品
|
||||
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
||||
Math.floor(l / width) * Math.floor(w / length));
|
||||
// 报的数量需要多少张大纸
|
||||
// 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
|
||||
int num = (int) Math.ceil(count * number / max);
|
||||
price += (num - 1) * 15;
|
||||
if ("绳子".equals(shenzi)) {
|
||||
price += 1 * count * number;
|
||||
}
|
||||
|
||||
if (number > 1) {//多款算设计费
|
||||
price += 10 * number;
|
||||
}
|
||||
|
||||
Product pro = new Product();
|
||||
pro.setPrice(Math.ceil(price));
|
||||
pro.setCount(count);
|
||||
list.add(pro);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<Product> getSmPrice(int count, Double length, Double width, List<Product> list, Integer number, String[] craft, Product dto) {
|
||||
double price = 60;
|
||||
double l = 438.0;
|
||||
double w = 304.0;
|
||||
if ((length < 8.55 && width < 5.4) || (width < 8.55 && length < 5.4)) {
|
||||
length = 8.55;
|
||||
width = 5.4;
|
||||
}
|
||||
length = length * 10 + 3;
|
||||
width = width * 10 + 3;
|
||||
// 一张l/w 大的纸张能做多少个此类尺寸的产品
|
||||
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
||||
Math.floor(l / width) * Math.floor(w / length));
|
||||
// 报的数量需要多少张大纸
|
||||
// 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
|
||||
int num = (int) Math.ceil(count * number / max);
|
||||
if ("10".equals(dto.getKindValue())) {
|
||||
price += (num - 1) * 25;
|
||||
} else {
|
||||
price += (num - 1) * 15;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(craft) && craft[0].equals("背胶")) {
|
||||
price += num * 10;
|
||||
}
|
||||
|
||||
if (number > 1) {
|
||||
price += 10 * number;
|
||||
}
|
||||
|
||||
Product pro = new Product();
|
||||
pro.setPrice(Math.ceil(price));
|
||||
pro.setCount(count);
|
||||
list.add(pro);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
public int[] twoSum(int[] nums, int target) {
|
||||
|
||||
List<Integer> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < nums.length; i++) {
|
||||
if (list.get(target - nums[i]) != null) {
|
||||
return new int[]{list.get(target - nums[i]), i};
|
||||
}
|
||||
|
||||
list.add(target - nums[i], nums[i]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user