edit
This commit is contained in:
@@ -133,238 +133,183 @@ public class PosterPrice {
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice01(String kind2, Double area, int count, Integer number) {
|
||||
public List<Product> acountPrice01(String kind2, Double area, int count, Integer number, double width, double length) {
|
||||
// 最低收费
|
||||
double price = 0.0;
|
||||
// 单价
|
||||
double danjia = 0.0;
|
||||
String weight = "0";
|
||||
DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
|
||||
double[] areas = {};
|
||||
double[] prices = {};
|
||||
double last_price = 0;
|
||||
double min_price = 0;
|
||||
switch (kind2) {
|
||||
// 高精室内写真
|
||||
case "2":
|
||||
areas = new double[]{2, 5, 10, 20, 50};
|
||||
prices = new double[]{50, 45, 32, 28, 25};
|
||||
last_price = 23;
|
||||
min_price = 50;
|
||||
// 根据面积得到单价
|
||||
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;
|
||||
areas = new double[]{2, 5, 10};
|
||||
prices = new double[]{62, 45, 35};
|
||||
last_price = 28;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10};
|
||||
prices = new double[]{70, 55, 45};
|
||||
last_price = 40;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10};
|
||||
prices = new double[]{70, 60, 45};
|
||||
last_price = 40;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10};
|
||||
prices = new double[]{75, 65, 55};
|
||||
last_price = 45;
|
||||
min_price = 100;
|
||||
break;
|
||||
// 静电贴
|
||||
case "8":
|
||||
// 根据面积得到单价
|
||||
if (area > 0 && area <= 1) {
|
||||
danjia = 70;
|
||||
} else if (area > 1 && area <= 2) {
|
||||
danjia = 68;
|
||||
} else if (area > 2 && area <= 5) {
|
||||
danjia = 65;
|
||||
} else if (area > 5 && area <= 10) {
|
||||
danjia = 63;
|
||||
} else {
|
||||
danjia = 60;
|
||||
}
|
||||
price = area * danjia > 50 ? area * danjia : 50;
|
||||
areas = new double[]{1, 2, 5, 10};
|
||||
prices = new double[]{70, 68, 65, 63};
|
||||
last_price = 60;
|
||||
min_price = 50;
|
||||
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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{70, 65};
|
||||
last_price = 60;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{75, 65};
|
||||
last_price = 55;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{160, 150};
|
||||
last_price = 140;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{150, 140};
|
||||
last_price = 130;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{110, 100};
|
||||
last_price = 90;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{130, 130};
|
||||
last_price = 110;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{140, 130};
|
||||
last_price = 120;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{115, 105};
|
||||
last_price = 100;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{150, 140};
|
||||
last_price = 130;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10};
|
||||
prices = new double[]{120, 110};
|
||||
last_price = 100;
|
||||
min_price = 70;
|
||||
|
||||
break;
|
||||
case "24":
|
||||
price = area * 380 > 380 ? area * 380 : 380;
|
||||
break;
|
||||
}
|
||||
if (!"24".equals(kind2)) {
|
||||
if (width * length < 40 * 50) {
|
||||
price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
|
||||
} else {
|
||||
danjia = last_price;
|
||||
for (int i = 0; i < areas.length; i++) {
|
||||
if (area <= areas[i]) {
|
||||
danjia = prices[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
price = Math.max(area * danjia, min_price);
|
||||
}
|
||||
}
|
||||
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
// 价格 = 面积 * 单价 + (款数-1) * 40
|
||||
if (number > 1) {
|
||||
if (number > 1 && width * length >= 40 * 50) {
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
} else {
|
||||
pro.setPrice(Math.ceil(price));
|
||||
@@ -383,115 +328,96 @@ public class PosterPrice {
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public List<Product> acountPrice02(String kind2, Double area, int count, Integer number) {
|
||||
public List<Product> acountPrice02(String kind2, Double area, int count, Integer number, double width, double length) {
|
||||
double price = 0.0;
|
||||
double danjia = 0.0;
|
||||
String weight = "0";
|
||||
DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
|
||||
double[] areas = {};
|
||||
double[] prices = {};
|
||||
double last_price = 0;
|
||||
double min_price = 0;
|
||||
|
||||
switch (kind2) {
|
||||
// 户外写真白胶(国产)
|
||||
case "0":
|
||||
areas = new double[]{2, 5, 7, 8, 10, 20, 50};
|
||||
prices = new double[]{55, 45, 40, 37, 31, 29, 27};
|
||||
last_price = 26;
|
||||
min_price = 50;
|
||||
// 根据面积得到单价
|
||||
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;
|
||||
areas = new double[]{2, 5, 7, 8, 10, 20, 50};
|
||||
prices = new double[]{55, 45, 40, 37, 31, 29, 27};
|
||||
last_price = 26;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{60, 55, 50};
|
||||
last_price = 35;
|
||||
min_price = 50;
|
||||
|
||||
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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{65, 50, 45};
|
||||
last_price = 35;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{68, 50, 40};
|
||||
last_price = 30;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{50, 40, 30};
|
||||
last_price = 25;
|
||||
min_price = 80;
|
||||
|
||||
weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
|
||||
break;
|
||||
}
|
||||
|
||||
if (width * length < 40 * 50) {
|
||||
price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
|
||||
} else {
|
||||
danjia = last_price;
|
||||
for (int i = 0; i < areas.length; i++) {
|
||||
if (area <= areas[i]) {
|
||||
danjia = prices[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
price = Math.max(area * danjia, min_price);
|
||||
}
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
// 价格 = 面积 * 单价 + (款数-1) * 40
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
if (number > 1 && width * length >= 40 * 50) {
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
} else {
|
||||
pro.setPrice(Math.ceil(price));
|
||||
}
|
||||
pro.setWeight(weight);
|
||||
list.add(pro);
|
||||
return list;
|
||||
@@ -513,45 +439,38 @@ public class PosterPrice {
|
||||
Integer number, String craftBu) {
|
||||
double price = 0.0;
|
||||
double danjia = 0.0;
|
||||
double[] areas = {};
|
||||
double[] prices = {};
|
||||
double last_price = 0;
|
||||
double min_price = 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;
|
||||
areas = new double[]{5, 10,};
|
||||
prices = new double[]{30, 28};
|
||||
last_price = 25;
|
||||
min_price = 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;
|
||||
areas = new double[]{5, 10,};
|
||||
prices = new double[]{40, 34};
|
||||
last_price = 30;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{30, 28, 25};
|
||||
last_price = 23;
|
||||
min_price = 50;
|
||||
|
||||
break;
|
||||
// 双喷布
|
||||
case "7":
|
||||
@@ -588,30 +507,20 @@ public class PosterPrice {
|
||||
// 油画布
|
||||
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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{80, 75, 60};
|
||||
last_price = 35;
|
||||
min_price = 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;
|
||||
areas = new double[]{2, 5, 10,};
|
||||
prices = new double[]{70, 60, 50};
|
||||
last_price = 35;
|
||||
min_price = 105;
|
||||
|
||||
break;
|
||||
// 旗帜布
|
||||
case "10":
|
||||
@@ -671,10 +580,35 @@ public class PosterPrice {
|
||||
|
||||
break;
|
||||
}
|
||||
if (!"7".equals(kind2) && !"10".equals(kind2)) {
|
||||
if (width * length < 40 * 50) {
|
||||
price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
|
||||
} else {
|
||||
danjia = last_price;
|
||||
for (int i = 0; i < areas.length; i++) {
|
||||
if (area <= areas[i]) {
|
||||
danjia = prices[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
price = Math.max(area * danjia, min_price);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Product pro = new Product();
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
if (!"7".equals(kind2) && !"10".equals(kind2)) {
|
||||
if (number > 1 && width * length >= 40 * 50) {
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
} else {
|
||||
pro.setPrice(Math.ceil(price));
|
||||
}
|
||||
} else {
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
}
|
||||
|
||||
list.add(pro);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,11 @@ public class PriceUtils {
|
||||
* @param area
|
||||
* @param count
|
||||
* @param craft
|
||||
* @param tang
|
||||
* @param yinbai
|
||||
* @return
|
||||
*/
|
||||
public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai) {
|
||||
public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product pro = new Product();
|
||||
// 最低收费
|
||||
@@ -151,19 +152,30 @@ public class PriceUtils {
|
||||
if (!StringUtils.isEmpty(craft)) {
|
||||
if ("大雪花镭射膜".equals(craft[0])) {
|
||||
danjia = danjia + 1;
|
||||
} else if ("覆哑膜".equals(craft[0])) {
|
||||
danjia = danjia + 0.8;
|
||||
} else {
|
||||
danjia = danjia + 0.6;
|
||||
}
|
||||
}
|
||||
price = Math
|
||||
.ceil(area * danjia + yinrPrice + count * 0.01 > lowerPrice ? area * danjia + yinrPrice + count * 0.01
|
||||
: lowerPrice);
|
||||
price = Math.ceil(Math.max(area * danjia + yinrPrice + count * 0.01, lowerPrice));
|
||||
// 如果有印白工艺:2元一平方,最低收费200元
|
||||
if (!StringUtils.isEmpty(yinbai)) {
|
||||
price = price + (area * 2 > 200 ? area * 2 : 200);
|
||||
}
|
||||
double tang_price = 0;
|
||||
|
||||
if (!StringUtils.isEmpty(tang) && "烫金".equals(tang)) {
|
||||
int[] bigCountArr = {500, 1000, 2000, 3000, 5000, 10000};
|
||||
|
||||
for (int i = 0; i < bigCountArr.length; i++) {
|
||||
if (count >= bigCountArr[i]) {
|
||||
tang_price = price + tangPrices[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
pro.setCount(count);
|
||||
pro.setPrice(price);
|
||||
pro.setPrice(Math.max(tang_price, price));
|
||||
list.add(pro);
|
||||
|
||||
/*
|
||||
@@ -3008,6 +3020,60 @@ public class PriceUtils {
|
||||
return price;
|
||||
}
|
||||
|
||||
public double getTestPrice(double length, double width, int count, int number,
|
||||
double[] areas, double[] prices, double minPrice, double lastPrice) {
|
||||
final int total = count * number;
|
||||
|
||||
for (int i = 1; i <= total; i++) {
|
||||
double currentPrice = new PriceUtils().getOptimizedPrice(
|
||||
length,
|
||||
width,
|
||||
i, // 当前数量
|
||||
1, // number 参数固定为1
|
||||
areas,
|
||||
prices,
|
||||
minPrice,
|
||||
lastPrice
|
||||
);
|
||||
|
||||
if (currentPrice > minPrice) {
|
||||
// 计算累加价格:基础价 + 剩余项*6
|
||||
return minPrice + (total - i + 1) * 6;
|
||||
}
|
||||
}
|
||||
// 未触发条件时返回基础最低价
|
||||
return minPrice;
|
||||
}
|
||||
|
||||
public double getOptimizedPrice(double length, double width, int count, int number,
|
||||
double[] areas, double[] prices, double minPrice, double lastPrice) {
|
||||
final double area = length * width * count / 10000;
|
||||
final boolean isSmallArea = area <= 0.2;
|
||||
|
||||
// 计算调整后的面积值
|
||||
final double adjustedArea = isSmallArea ? area * number : area;
|
||||
|
||||
// 确定单价基准
|
||||
double unitPrice = isSmallArea ? minPrice : lastPrice;
|
||||
if (!isSmallArea) {
|
||||
for (int i = 0; i < areas.length; i++) {
|
||||
if (adjustedArea <= areas[i]) {
|
||||
unitPrice = prices[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 计算基础价格
|
||||
double basePrice = isSmallArea ? minPrice : adjustedArea * unitPrice;
|
||||
|
||||
// 应用数量系数
|
||||
double finalPrice = (area > 0.2) ? basePrice * number : basePrice;
|
||||
|
||||
// 确保最低价格并取整
|
||||
return Math.ceil(Math.max(finalPrice, minPrice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 亚克力计算
|
||||
*
|
||||
@@ -3124,50 +3190,54 @@ public class PriceUtils {
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public List<Product> getDbPrice(String kind, Double width, Double length, int count, List<Product> list) {
|
||||
public List<Product> getDbPrice(String kind, Double width, Double length, int count, List<Product> list, int number) {
|
||||
//11-550灯布 12-520灯布 13-550黑底灯布
|
||||
Product pro = new Product();
|
||||
double price = 0, dj = 0;
|
||||
double area = length * width * count;
|
||||
if (kind.equals("11")) {
|
||||
if (area <= 5) {
|
||||
dj = 20;
|
||||
} else if (area <= 10) {
|
||||
dj = 18;
|
||||
} else if (area > 10) {
|
||||
dj = 17;
|
||||
}
|
||||
} else if (kind.equals("12")) {
|
||||
if (area <= 5) {
|
||||
dj = 16;
|
||||
} else if (area <= 10) {
|
||||
dj = 12;
|
||||
} else if (area > 10) {
|
||||
dj = 10;
|
||||
}
|
||||
double area = length * width * count / 10000;
|
||||
double[] areas = {};
|
||||
double[] prices = {};
|
||||
double last_price = 0;
|
||||
double min_price = 0;
|
||||
|
||||
if ("11".equals(kind)) {
|
||||
areas = new double[]{5, 10,};
|
||||
prices = new double[]{20, 18};
|
||||
last_price = 17;
|
||||
min_price = 55;
|
||||
|
||||
} else if ("12".equals(kind)) {
|
||||
areas = new double[]{5, 10,};
|
||||
prices = new double[]{16, 12};
|
||||
last_price = 10;
|
||||
min_price = 50;
|
||||
|
||||
} else {
|
||||
if (area <= 5) {
|
||||
dj = 24;
|
||||
} else if (area <= 10) {
|
||||
dj = 20;
|
||||
} else if (area > 10) {
|
||||
dj = 18;
|
||||
}
|
||||
areas = new double[]{5, 10,};
|
||||
prices = new double[]{24, 20};
|
||||
last_price = 18;
|
||||
min_price = 60;
|
||||
|
||||
}
|
||||
|
||||
|
||||
price = area * dj;
|
||||
if (area >= 7 && area <= 10) {
|
||||
price = price * 0.9;
|
||||
}
|
||||
if (kind.equals("11")) {
|
||||
price = Math.ceil(price > 55 ? price : 55);
|
||||
} else if (kind.equals("12")) {
|
||||
price = Math.ceil(price > 50 ? price : 50);
|
||||
if (width * length < 40 * 50) {
|
||||
price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
|
||||
} else {
|
||||
price = Math.ceil(price > 60 ? price : 60);
|
||||
dj = last_price;
|
||||
for (int i = 0; i < areas.length; i++) {
|
||||
if (area <= areas[i]) {
|
||||
dj = prices[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
price = Math.max(area * dj, min_price);
|
||||
}
|
||||
|
||||
if (number > 1 && width * length >= 40 * 50) {
|
||||
pro.setPrice(Math.ceil(price * number));
|
||||
} else {
|
||||
pro.setPrice(Math.ceil(price));
|
||||
}
|
||||
pro.setPrice(price);
|
||||
pro.setCount(count);
|
||||
list.add(pro);
|
||||
|
||||
|
||||
@@ -62,8 +62,19 @@ public class ZsPrice {
|
||||
price += num * 10;
|
||||
}
|
||||
|
||||
|
||||
if (number > 1) {
|
||||
price += 10 * number;
|
||||
double desFee = 0;
|
||||
if (dto.getP() == 1 || dto.getP() == 2 || dto.getP() == 3) {
|
||||
desFee = 3;
|
||||
} else if (dto.getP() == 4) {
|
||||
desFee = 5;
|
||||
} else if (dto.getP() == 5) {
|
||||
desFee = 6;
|
||||
} else {
|
||||
desFee = 8;
|
||||
}
|
||||
price += desFee * (number - 1);
|
||||
}
|
||||
|
||||
Product pro = new Product();
|
||||
|
||||
Reference in New Issue
Block a user