3467 lines
126 KiB
Java
3467 lines
126 KiB
Java
package lingtao.net.util;
|
|
|
|
import lingtao.net.bean.Product;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
public class PriceUtils {
|
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000};
|
|
|
|
/**
|
|
* 卷标标签价格
|
|
*
|
|
* @param kind
|
|
* @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, String tang, double[] tangPrices) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
// 最低收费
|
|
double lowerPrice = 0.0;
|
|
// 印工价格
|
|
double yinrPrice = 0.0;
|
|
// 平方单价
|
|
double danjia = 0.0;
|
|
// 总价
|
|
double price = 0.0;
|
|
// 根据报的尺寸、数量算面积(保留2位小数)
|
|
area = Double.valueOf(df.format(area * count));
|
|
if (area <= 20) {
|
|
yinrPrice = 260;
|
|
lowerPrice = 550;
|
|
} else if (area <= 150) {
|
|
yinrPrice = 300;
|
|
lowerPrice = 600;
|
|
}
|
|
|
|
switch (kind) {
|
|
/**
|
|
* 0:格底铜版纸卷标 1:格底PP合成纸 2:8丝光白PVC 3:5丝格底透明 4:格底哑金/哑银 5:格底银平光 6:单防热敏纸(底纸白色)
|
|
* 7:三防热敏纸(底纸蓝色)
|
|
*/
|
|
case "0":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 8;
|
|
} else if (area <= 150) {
|
|
danjia = 8;
|
|
} else if (area <= 200) {
|
|
danjia = 10.5;
|
|
} else {
|
|
danjia = 10.3;
|
|
}
|
|
break;
|
|
case "1":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 10;
|
|
} else if (area <= 150) {
|
|
danjia = 10;
|
|
} else if (area <= 200) {
|
|
danjia = 12.5;
|
|
} else {
|
|
danjia = 12.3;
|
|
}
|
|
break;
|
|
case "2":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 10;
|
|
} else if (area <= 150) {
|
|
danjia = 10;
|
|
} else if (area <= 200) {
|
|
danjia = 12.5;
|
|
} else {
|
|
danjia = 12.3;
|
|
}
|
|
break;
|
|
case "3":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 10;
|
|
} else if (area <= 150) {
|
|
danjia = 10;
|
|
} else if (area <= 200) {
|
|
danjia = 12.5;
|
|
} else {
|
|
danjia = 12.3;
|
|
}
|
|
break;
|
|
case "4":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 12;
|
|
} else if (area <= 150) {
|
|
danjia = 12;
|
|
} else if (area <= 200) {
|
|
danjia = 15;
|
|
} else {
|
|
danjia = 14.8;
|
|
}
|
|
break;
|
|
case "5":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 12;
|
|
} else if (area <= 150) {
|
|
danjia = 12;
|
|
} else if (area <= 200) {
|
|
danjia = 15;
|
|
} else {
|
|
danjia = 14.8;
|
|
}
|
|
break;
|
|
case "6":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 9;
|
|
} else if (area <= 150) {
|
|
danjia = 9;
|
|
} else if (area <= 200) {
|
|
danjia = 11;
|
|
} else {
|
|
danjia = 10.8;
|
|
}
|
|
break;
|
|
case "7":
|
|
// 根据面积得到单价
|
|
if (area <= 20) {
|
|
danjia = 9.5;
|
|
} else if (area <= 150) {
|
|
danjia = 9.5;
|
|
} else if (area <= 200) {
|
|
danjia = 11.5;
|
|
} else {
|
|
danjia = 11.3;
|
|
}
|
|
break;
|
|
}
|
|
// 加上覆膜的价格 (覆哑膜/亮膜 0.6元/平方, 镭射膜1元/平方)
|
|
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(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(Math.max(tang_price, price));
|
|
list.add(pro);
|
|
|
|
/*
|
|
* for (int i = 0; i < countArr.length; i++) { if (countArr[i] < count) {
|
|
* continue; } if (countArr[i] * area <= 150) { danjia = 15; } else if
|
|
* (countArr[i] * area <= 200) { danjia = 14.5; } else { danjia = 14; } if
|
|
* (!StringUtils.isEmpty(craft)) { if (!"大雪花镭射膜".equals(craft[0])) { danjia =
|
|
* danjia + 1; } else { danjia = danjia + 0.6; } } pro = new Product();
|
|
* pro.setCount(countArr[i]); pro.setPrice(Math.ceil(countArr[i] * area * danjia
|
|
* > 550 ? countArr[i] * area * danjia : 550)); list.add(pro); }
|
|
*/
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 合版封套自定义尺寸
|
|
*
|
|
* @param kind
|
|
* @param count
|
|
* @param min
|
|
* @param priceArr
|
|
* @return
|
|
*/
|
|
public List<Product> getEnvelope(String kind, int count, int min, int[] priceArr) {
|
|
int countArr[] = {200, 500, 1000, 2000, 5000, 10000};
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(Math.ceil(min * priceArr[i] + 80 + 0.05 * countArr[i] + 30 + 0.06 * countArr[i]));
|
|
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 房卡套特殊尺寸
|
|
*
|
|
* @param count
|
|
* @param min
|
|
* @return
|
|
*/
|
|
public List<Product> getRoomCard(int count, int min) {
|
|
int countArr[] = {200, 500, 1000, 2000, 5000, 10000};
|
|
int priceArr[] = {40, 50, 70, 90, 160, 300};
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
|
|
pro.setPrice(Math.ceil(min * priceArr[i] + 0.05 * countArr[i] + 60 + 30 + 0.06 * countArr[i]));
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 打印不干胶带纯烫金价格
|
|
*
|
|
* @param kind
|
|
* @param addPrice
|
|
* @param yinbai
|
|
*/
|
|
public Product getA(String kind, Double width, Double length, int count, double price, double addPrice,
|
|
Integer number, String craftTang, String yinbai) {
|
|
//List<Product> list = new ArrayList<Product>();
|
|
|
|
if ("印白墨".equals(yinbai)) {
|
|
price = 50;
|
|
addPrice = 30;
|
|
} else if ("黑白".equals(yinbai)) {
|
|
price = 40;
|
|
}
|
|
|
|
double l = 425;
|
|
double w = 285;
|
|
if ("0".equals(kind) || "4".equals(kind)) {
|
|
l = 430;
|
|
w = 290;
|
|
}
|
|
// 哑金不干胶
|
|
if ("5".equals(kind)) {
|
|
l = 390;
|
|
w = 270;
|
|
}
|
|
Product pro = new Product();
|
|
// 数量*款数就是张数
|
|
count = count * number;
|
|
// 换成毫米每边+2
|
|
length = length * 10 + 4;
|
|
width = width * 10 + 4;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸能做多少个此类尺寸的不干胶
|
|
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 = price + (num - 1) * addPrice;
|
|
|
|
if ("纯烫金".equals(craftTang) || "彩色印刷+烫金/银".equals(craftTang)) {
|
|
// 一张纸张价格+大纸张数*addPrice + 每张烫金+20块(1张起收)(5*5cm内30元一张)
|
|
if (width < 54 && length < 54) {
|
|
price += num * 60;
|
|
} else {
|
|
price += num * 40;
|
|
}
|
|
}
|
|
|
|
if ("彩色印刷+烫金/银".equals(craftTang)) {
|
|
price = price > 80 ? price : 80;
|
|
}
|
|
// if ("印白墨".equals(yinbai)) {
|
|
// // 透明不干胶,印白墨工艺,每张大纸+20(1张起收)
|
|
// price = price + num * 20;
|
|
// }
|
|
|
|
// if(number > 1) {
|
|
// price = price + (number - 1) * 15;
|
|
// }
|
|
pro.setCount(count / number);
|
|
pro.setPrice(Math.ceil(price));
|
|
|
|
return pro;
|
|
}
|
|
|
|
/**
|
|
* 哑银不干胶价格
|
|
*
|
|
* @param kind
|
|
* @param addPrice
|
|
* @param yinbai
|
|
*/
|
|
public List<Product> getYy(String kind, Double width, Double length, int count, double price, double addPrice,
|
|
Integer number, String craftTang, String yinbai) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
double l = 420;
|
|
double w = 285;
|
|
// 换成毫米每边+2
|
|
length = length * 10 + 4;
|
|
width = width * 10 + 4;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸能做多少个此类尺寸的不干胶
|
|
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
|
Math.floor(l / width) * Math.floor(w / length));
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
|
|
if ("印白墨".equals(yinbai)) {
|
|
price = 50;
|
|
addPrice = 30;
|
|
}
|
|
|
|
Product pro = new Product();
|
|
// 数量*款数就是张数
|
|
count = countArr[i] * number;
|
|
|
|
// 报的数量需要多少张大纸
|
|
int num = (int) Math.ceil(count / max);
|
|
if ("纯烫金".equals(craftTang)) {
|
|
// 一张纸张价格+大纸张数*addPrice + 每张烫金+20块(1张起收)(5*5cm内30元一张)
|
|
if (width < 54 && length < 54) {
|
|
price = price + (num - 1) * addPrice + num * 30;
|
|
} else {
|
|
price = price + (num - 1) * addPrice + num * 20;
|
|
}
|
|
} else if ("彩色印刷+烫金/银".equals(craftTang)) {
|
|
if (width <= 154 && length <= 154) {
|
|
price = price + (count * 0.15 + 200 > 200 ? count * 0.15 + 200 : 200);
|
|
} else if (width > 154 || length > 154) {
|
|
price = price + (count * 0.13 + 180 > 210 ? count * 0.13 + 180 : 210);
|
|
}
|
|
} else {
|
|
price = price + (num - 1) * addPrice;
|
|
}
|
|
if (number > 1) {
|
|
price = price + (number - 1) * 5;
|
|
}
|
|
// if ("印白墨".equals(yinbai)) {
|
|
// // 透明不干胶,印白墨工艺,每张大纸+20(1张起收)
|
|
// price = price + num * 20;
|
|
// }
|
|
pro.setCount(count / number);
|
|
/*if (length == 14.0 && width == 14.0) {
|
|
price = price * 2;
|
|
}*/
|
|
pro.setPrice(Math.ceil(price));
|
|
list.add(pro);
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
// 不干胶常规数量美纹纸价格计算
|
|
public List<Product> getMeiWenZhiPrice(Double length, Double width, int count, Integer number, String craftMo) {
|
|
double l = 420;
|
|
double w = 285;
|
|
Product pro = new Product();
|
|
List<Product> list = new ArrayList<Product>();
|
|
// 成本价 元/张
|
|
double danjia = 1.8;
|
|
if ("模切".equals(craftMo)) {
|
|
danjia = 2.2;
|
|
}
|
|
// 换成毫米每边+2
|
|
length = length * 10 + 4;
|
|
width = width * 10 + 4;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸能做多少个此类尺寸的不干胶
|
|
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
|
|
Math.floor(l / width) * Math.floor(w / length));
|
|
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
// 报的数量需要多少张大纸
|
|
int num = (int) Math.ceil(countArr[i] / max);
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(Math.ceil(num * danjia * 2.5 > 83 ? num * danjia * 2.5 : 83));
|
|
list.add(pro);
|
|
}
|
|
|
|
/*if(number > 1) {
|
|
for (Product product : list) {
|
|
product.setPrice(Math.ceil(product.getPrice() * number));
|
|
}
|
|
}*/
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 插卡遍历添加价格
|
|
*/
|
|
private List<Product> acountInsertCardPrice(int count, List<Product> list, Double[] priceArr) {
|
|
int countArr[] = {200, 500, 1000, 2000, 3000, 5000, 10000};
|
|
Product 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;
|
|
}
|
|
|
|
/**
|
|
* 菱形单面直角插排
|
|
*/
|
|
public List<Product> getInsertCard(String size, int count) {
|
|
List<Product> list = new ArrayList<>();
|
|
|
|
if ("4.5*4.5".equals(size)) {
|
|
Double priceArr[] = {40.0, 50.0, 80.0, 120.0, 160.0, 270.0, 480.0};
|
|
list = acountInsertCardPrice(count, list, priceArr);
|
|
} else if ("5*5".equals(size)) {
|
|
Double priceArr[] = {50.0, 60.0, 80.0, 130.0, 140.0, 300.0, 520.0};
|
|
list = acountInsertCardPrice(count, list, priceArr);
|
|
} else {
|
|
Double priceArr[] = {40.0, 50.0, 70.0, 110.0, 160.0, 260.0, 480.0};
|
|
list = acountInsertCardPrice(count, list, priceArr);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
// 9*5.4cm(一个名片位)以内价格
|
|
public List<Product> oneCradPrice(int count) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
int countArr[] = {1000, 2000, 5000, 10000, 20000};
|
|
int priceArr[] = {70, 110, 250, 500, 900};
|
|
if (count <= 20000) {
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(Math.ceil(priceArr[i]));
|
|
list.add(pro);
|
|
}
|
|
} else {
|
|
pro = new Product();
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(count * 0.045));
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 普通吊牌/服装吊牌 300/350克直角打孔吊牌价格
|
|
*
|
|
* @param dto
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param priceList
|
|
* @return
|
|
*/
|
|
public List<Product> tags300PriceCraftZhi(Product dto, Double width, Double length, int count,
|
|
List<Product> priceList) {
|
|
double l1;
|
|
double w1;
|
|
double l2;
|
|
double w2;
|
|
int min;
|
|
l1 = Math.ceil(length / 9);
|
|
w1 = Math.ceil(width / 5.4);
|
|
l2 = Math.ceil(width / 9);
|
|
w2 = Math.ceil(length / 5.4);
|
|
// 产品位数
|
|
min = (int) Math.min(l1 * w1, l2 * w2);
|
|
|
|
if (min == 1) {
|
|
double priceArr[] = {43, 52, 70, 110, 186, 242, 250, 500};
|
|
priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
} else if (min == 2) {
|
|
double priceArr[] = {48, 70, 75, 110, 180, 230, 270, 520};
|
|
priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
} else if (min == 3) {
|
|
double priceArr[] = {68, 93, 155, 276, 369, 484, 578, 1111};
|
|
priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
} else if (min == 4) {
|
|
double priceArr[] = {80, 100, 186, 333, 496, 617, 736, 1417};
|
|
priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
}
|
|
if (min > 1) {
|
|
for (Product product : priceList) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
if ("不覆膜".equals(dto.getCraftMo())) {
|
|
for (Product product : priceList) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
|
|
// 300克的模切材质才有第二尺寸
|
|
// 第二尺寸不为空
|
|
if (!StringUtils.isEmpty(dto.getSize1())) {
|
|
String size1 = dto.getSize1();
|
|
Double length1 = null;
|
|
Double width1 = null;
|
|
List<Product> priceListSecond = new ArrayList<Product>();
|
|
length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
|
|
if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
|
|
width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
|
|
} else {
|
|
width1 = Double
|
|
.valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
|
|
}
|
|
length1 = Math.abs(length1);
|
|
width1 = Math.abs(width1);
|
|
|
|
l1 = Math.ceil(length1 / 9);
|
|
w1 = Math.ceil(width1 / 5.4);
|
|
l2 = Math.ceil(width1 / 9);
|
|
w2 = Math.ceil(length1 / 5.4);
|
|
// 产品位数
|
|
min = (int) Math.min(l1 * w1, l2 * w2);
|
|
|
|
if (min == 1) {
|
|
double priceArr[] = {43, 52, 72, 128, 186, 242, 276, 526};
|
|
priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
} else if (min == 2) {
|
|
double priceArr[] = {48, 78, 110, 202, 283, 351, 419, 805};
|
|
priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
} else if (min == 3) {
|
|
double priceArr[] = {68, 93, 155, 276, 369, 484, 578, 1111};
|
|
priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
} else if (min == 4) {
|
|
double priceArr[] = {80, 100, 186, 333, 496, 617, 736, 1417};
|
|
priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
|
|
}
|
|
|
|
if (min > 1) {
|
|
for (Product product : priceListSecond) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
|
|
if ("不覆膜".equals(dto.getCraftMo())) {
|
|
for (Product product : priceListSecond) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
|
|
// 如果俩个价格一样,后一位价格+10
|
|
for (int i = 0; i < priceListSecond.size() - 1; i++) {
|
|
if (priceListSecond.get(i).getPrice().equals(priceListSecond.get(i + 1).getPrice())) {
|
|
priceListSecond.get(i + 1).setPrice(priceListSecond.get(i + 1).getPrice() + 10);
|
|
}
|
|
}
|
|
|
|
// 俩个尺寸的价格相加 再*0.96
|
|
for (int i = 0; i < priceList.size(); i++) {
|
|
priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
|
|
}
|
|
}
|
|
return priceList;
|
|
}
|
|
|
|
/**
|
|
* 吊牌300克直角打孔价格计算
|
|
*/
|
|
public List<Product> acountTags300PriceCraftZhi(int count, double[] priceArr) {
|
|
int countArr[] = {200, 500, 1000, 2000, 3000, 4000, 5000, 10000};
|
|
List<Product> list = new ArrayList<>();
|
|
Product pro = new Product();
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(priceArr[i]);
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 其他吊牌300克 异形模切价格
|
|
*
|
|
* @param dto
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param area
|
|
* @param count
|
|
* @param priceList
|
|
* @return
|
|
*/
|
|
public List<Product> tags300PriceCraftMo(Product dto, Integer number, Double width, Double length, Double area,
|
|
int count, List<Product> priceList) {
|
|
if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
|
|
length = 9.0;
|
|
width = 5.4;
|
|
area = length * width / 10000;
|
|
}
|
|
|
|
List<Product> priceList2 = new ArrayList<Product>();
|
|
// 有工艺(覆膜)
|
|
if ("双面覆哑膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {27, 18, 15, 14, 14, 14};
|
|
priceList = new PriceUtils().acountTags300PriceCraftMo(area, count, number, priceArr);
|
|
priceList2 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
|
|
} else if ("不覆膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {26, 17, 14, 13, 13, 13};
|
|
priceList = new PriceUtils().acountTags300PriceCraftMo(area, count, number, priceArr);
|
|
priceList2 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
|
|
}
|
|
// 自定义尺寸和固定尺寸对比价格。
|
|
for (int i = 0; i < priceList.size(); i++) {
|
|
for (int j = 0; j < priceList2.size(); j++) {
|
|
if (priceList.get(j).getPrice() < priceList2.get(j).getPrice()) {
|
|
priceList.get(j).setPrice(priceList2.get(j).getPrice() + 5);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 第二尺寸不为空
|
|
if (!StringUtils.isEmpty(dto.getSize1())) {
|
|
String size1 = dto.getSize1();
|
|
Double length1 = null;
|
|
Double width1 = null;
|
|
Double area1 = null;
|
|
List<Product> priceListSecond = new ArrayList<Product>();
|
|
length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
|
|
if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
|
|
width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
|
|
} else {
|
|
width1 = Double
|
|
.valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
|
|
}
|
|
length1 = Math.abs(length1);
|
|
width1 = Math.abs(width1);
|
|
if (((length1 <= 9 && width1 <= 5.4) || (length1 <= 5.4 && width1 <= 9))) {
|
|
length1 = 9.0;
|
|
width1 = 5.4;
|
|
area1 = length1 * width1 / 10000;
|
|
}
|
|
List<Product> priceList3 = new ArrayList<Product>();
|
|
// 有工艺(覆膜)
|
|
if ("双面覆哑膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {27, 18, 15, 14, 14, 14};
|
|
priceListSecond = new PriceUtils().acountTags300PriceCraftMo(area1, count, number, priceArr);
|
|
priceList3 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
|
|
} else if ("不覆膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {26, 17, 14, 13, 13, 13};
|
|
priceListSecond = new PriceUtils().acountTags300PriceCraftMo(area1, count, number, priceArr);
|
|
priceList3 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
|
|
}
|
|
// 自定义尺寸和固定尺寸对比价格。
|
|
for (int i = 0; i < priceListSecond.size(); i++) {
|
|
for (int j = 0; j < priceList3.size(); j++) {
|
|
if (priceListSecond.get(j).getPrice() < priceList3.get(j).getPrice()) {
|
|
priceListSecond.get(j).setPrice(priceList3.get(j).getPrice() + 5);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 俩个尺寸的价格相加 再*0.96
|
|
for (int i = 0; i < priceList.size(); i++) {
|
|
priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
|
|
}
|
|
}
|
|
return priceList;
|
|
}
|
|
|
|
/**
|
|
* 其他吊牌300克异形模切价格计算===》 不复膜的 计算方法:长*宽*数量500张*22+每款设计费7元+绳子10元
|
|
*
|
|
* @param area
|
|
* @param count
|
|
* @param number
|
|
* @param priceArr
|
|
* @return
|
|
*/
|
|
public List<Product> acountTags300PriceCraftMo(Double area, int count, Integer number, double[] priceArr) {
|
|
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
|
|
// 数量大于1万,单独报价;
|
|
List<Product> list = new ArrayList<>();
|
|
Product pro = new Product();
|
|
// 设计费 7元/款
|
|
double designFee = 7;
|
|
// 绳子 1分5一条
|
|
double shengzi = 0.015;
|
|
if (count > 10000) {
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(area * count * priceArr[priceArr.length - 1] + designFee + count * shengzi));
|
|
list.add(pro);
|
|
} else {
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + designFee + countArr[i] * shengzi));
|
|
list.add(pro);
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 服装吊牌 300克异形模切价格
|
|
*
|
|
* @param dto
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param area
|
|
* @param count
|
|
* @param priceList
|
|
* @return
|
|
*/
|
|
public List<Product> tagClothes300PriceCraftMo(Product dto, Integer number, Double width, Double length, Double area, int count, List<Product> priceList) {
|
|
if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
|
|
priceList = new PriceUtils().oneCradPrice(count);
|
|
if ("不覆膜".equals(dto.getCraftMo())) {
|
|
for (Product product : priceList) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
} else {
|
|
// 有工艺(覆膜)
|
|
if ("双面覆哑膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {18, 15, 14, 14};
|
|
// double priceArr[] = { 13, 12, 11.5, 10 };
|
|
priceList = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
|
|
} else if ("不覆膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {17, 14, 13, 13};
|
|
// double priceArr[] = { 12, 11, 10.5, 9 };
|
|
priceList = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
|
|
}
|
|
|
|
// 对比固定价格
|
|
/*List<Product> priceList2 = new PriceUtils().oneCradPrice(count);
|
|
if ("不覆膜".equals(dto.getCraftMo())) {
|
|
for (Product product : priceList2) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}*/
|
|
/*for (int i = 0; i < priceList.size(); i++) {
|
|
for (int j = 0; j < priceList2.size(); j++) {
|
|
if (priceList.get(j).getPrice() < priceList2.get(j).getPrice()) {
|
|
priceList.get(j).setPrice(priceList2.get(j).getPrice() + 10);
|
|
}
|
|
}
|
|
}*/
|
|
// 末尾变成0
|
|
/*for (Product product : priceList) {
|
|
product.setPrice(product.getPrice() - product.getPrice() % 10);
|
|
}*/
|
|
// 如果俩个价格一样,后一位价格+10
|
|
for (int i = 0; i < priceList.size() - 1; i++) {
|
|
if (priceList.get(i).getPrice().equals(priceList.get(i + 1).getPrice())) {
|
|
priceList.get(i + 1).setPrice(priceList.get(i + 1).getPrice() + 10);
|
|
}
|
|
if (width == 6 && length == 6 && priceList.get(i).getCount() == 1000) {
|
|
priceList.get(i).setPrice(priceList.get(i).getPrice() + 8);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 300克的材质才有第二尺寸
|
|
// 第二尺寸不为空
|
|
if (!StringUtils.isEmpty(dto.getSize1())) {
|
|
String size1 = dto.getSize1();
|
|
Double length1 = null;
|
|
Double width1 = null;
|
|
List<Product> priceListSecond = new ArrayList<Product>();
|
|
length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
|
|
if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
|
|
width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
|
|
} else {
|
|
width1 = Double
|
|
.valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
|
|
}
|
|
length1 = Math.abs(length1);
|
|
width1 = Math.abs(width1);
|
|
double area1 = length1 * width1 / 10000;
|
|
if (((length1 <= 10.5 && width1 <= 5.5) || (length1 <= 5.5 && width1 <= 10.5))) {
|
|
priceListSecond = new PriceUtils().oneCradPrice(count);
|
|
if ("不覆膜".equals(dto.getCraftMo())) {
|
|
for (Product product : priceListSecond) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
} else {
|
|
// 有工艺(覆膜)
|
|
if ("双面覆哑膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {18, 15, 14, 14};
|
|
// double priceArr[] = { 13, 12, 11.5, 10 };
|
|
priceListSecond = new PriceUtils().acountTagClothes300PriceCraftMo(area1, count, number, priceArr);
|
|
} else if ("不覆膜".equals(dto.getCraftMo())) {
|
|
double priceArr[] = {17, 14, 13, 13};
|
|
priceListSecond = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
|
|
}
|
|
|
|
// 对比固定价格
|
|
List<Product> priceList2 = new PriceUtils().oneCradPrice(count);
|
|
if ("不覆膜".equals(dto.getCraftMo())) {
|
|
for (Product product : priceList2) {
|
|
product.setPrice(Math.floor(product.getPrice() * 0.98));
|
|
}
|
|
}
|
|
for (int i = 0; i < priceListSecond.size(); i++) {
|
|
for (int j = 0; j < priceList2.size(); j++) {
|
|
if (priceListSecond.get(j).getPrice() < priceList2.get(j).getPrice()) {
|
|
priceListSecond.get(j).setPrice(priceList2.get(j).getPrice() + 10);
|
|
}
|
|
}
|
|
}
|
|
// 末尾变成0
|
|
for (Product product : priceListSecond) {
|
|
product.setPrice(product.getPrice() - product.getPrice() % 10);
|
|
}
|
|
// 如果俩个价格一样,后一位价格+10
|
|
for (int i = 0; i < priceListSecond.size() - 1; i++) {
|
|
if (priceListSecond.get(i).getPrice().equals(priceListSecond.get(i + 1).getPrice())) {
|
|
priceListSecond.get(i + 1).setPrice(priceListSecond.get(i + 1).getPrice() + 10);
|
|
}
|
|
}
|
|
}
|
|
// 俩个尺寸的价格相加 再*0.96
|
|
for (int i = 0; i < priceList.size(); i++) {
|
|
priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
|
|
}
|
|
}
|
|
return priceList;
|
|
}
|
|
|
|
/**
|
|
* 服装吊牌300克异形模切价格计算===》 不复膜的 计算方法:长*宽*数量500张*22+每款设计费7元+绳子10元
|
|
*
|
|
* @param area
|
|
* @param count
|
|
* @param number
|
|
* @param priceArr
|
|
* @return
|
|
*/
|
|
public List<Product> acountTagClothes300PriceCraftMo(Double area, int count, Integer number, double[] priceArr) {
|
|
int countArr[] = {1000, 2000, 5000, 10000};
|
|
// 数量大于1万,单独报价;
|
|
List<Product> list = new ArrayList<>();
|
|
Product pro = new Product();
|
|
// 设计费 7元/款
|
|
double designFee = 7;
|
|
// 绳子 1分5一条
|
|
double shengzi = 0.015;
|
|
if (count > 10000) {
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(area * count * priceArr[priceArr.length - 1] + number * designFee));
|
|
list.add(pro);
|
|
} else {
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
/* pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + number * designFee
|
|
+ countArr[i] * shengzi));*/
|
|
pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + designFee));
|
|
list.add(pro);
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 600克 吊牌
|
|
*
|
|
* @param dto
|
|
* @param kind
|
|
* @param kind2
|
|
* @param area
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> tags600Price(Product dto, String kind, String kind2, Double area, int count) {
|
|
List<Product> priceList;
|
|
priceList = new PriceUtils().getTag600PriceFirst(kind, kind2, area, count, true);
|
|
|
|
// 600克的材质才有第二尺寸
|
|
// 第二尺寸不为空
|
|
if (!StringUtils.isEmpty(dto.getSize1())) {
|
|
String size1 = dto.getSize1();
|
|
Double length1 = null;
|
|
Double width1 = null;
|
|
List<Product> priceList2 = new ArrayList<Product>();
|
|
length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
|
|
if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
|
|
width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
|
|
} else {
|
|
width1 = Double
|
|
.valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
|
|
}
|
|
length1 = Math.abs(length1);
|
|
width1 = Math.abs(width1);
|
|
double area1 = length1 * width1 / 10000;
|
|
priceList2 = new PriceUtils().getTag600PriceFirst(kind, kind2, area1, count, false);
|
|
// 俩个尺寸的价格相加
|
|
for (int i = 0; i < priceList.size(); i++) {
|
|
priceList.get(i).setPrice((priceList.get(i).getPrice() + priceList2.get(i).getPrice()) * 0.95);
|
|
}
|
|
}
|
|
return priceList;
|
|
}
|
|
|
|
/**
|
|
* 吊牌600/800克自定义尺寸价格
|
|
*
|
|
* @param kind 600克/800克
|
|
* @param kind2 种类
|
|
* @param area 单个产品的面积
|
|
* @param count 报的数量
|
|
* @param flag 是否要加绳子费用
|
|
* @return
|
|
*/
|
|
public List<Product> getTag600PriceFirst(String kind, String kind2, double area, int count, boolean flag) {
|
|
// 数量大于1万,单独报价;
|
|
if (count > 10000) {
|
|
return null;
|
|
}
|
|
List<Product> list = new ArrayList<>();
|
|
double shengzi = 0;
|
|
if ("4".equals(kind)) {
|
|
if ("无".equals(kind2)) {
|
|
double priceArr[] = {50, 34, 27, 27, 26, 25};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
} else if ("单面烫黄金".equals(kind2)) {
|
|
double priceArr[] = {68, 48, 37, 36, 35, 34};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
} else if ("单面凹凸".equals(kind2)) {
|
|
double priceArr[] = {75, 50, 40, 40, 39, 38};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
} else if ("单面烫黄金+凹凸".equals(kind2)) {
|
|
double priceArr[] = {93, 63, 48, 48, 47, 46};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
}
|
|
}
|
|
if ("6".equals(kind)) {
|
|
if ("无".equals(kind2)) {
|
|
double price = 0;
|
|
int[][] prices = {
|
|
{144, 148, 166, 188, 193, 210, 232, 249, 251, 273, 317, 392, 464, 476, 674, 1028, 1802},
|
|
{228, 238, 248, 255, 256, 258, 260, 268, 270, 278, 322, 397, 469, 481, 679, 1033, 1807},
|
|
{330, 345, 350, 380, 386, 390, 420, 428, 430, 465, 538, 665, 780, 800, 1108, 1665, 2920},
|
|
{480, 520, 530, 560, 568, 580, 591, 629, 633, 686, 791, 971, 1141, 1170, 1644, 2486, 4329},
|
|
{800, 820, 860, 870, 880, 900, 955, 1016, 1023, 1107, 1276, 1563, 1838, 1885, 2645, 3997, 6955},
|
|
{1400, 1430, 1450, 1527, 1560, 1690, 1852, 1969, 1982, 2145, 2470, 3022, 3549, 3640, 5102, 7702, 13390}
|
|
};
|
|
int[] count_list = {500, 1000, 2000, 3000, 5000, 10000};
|
|
double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.6, 49, 54, 64, 81, 97.2, 100, 145.8, 225, 400};
|
|
for (int i = 0; i < count_list.length; i++) {
|
|
int count_item = count_list[i];
|
|
if (list.size() > 2) {
|
|
break;
|
|
}
|
|
if (count > count_item) {
|
|
continue;
|
|
}
|
|
int count_index = Arrays.binarySearch(count_list, count_item);
|
|
price = 0;
|
|
if (count_index >= 0) {
|
|
price = new PriceUtils().TablePrice(area * 10000, prices[count_index], areas);
|
|
}
|
|
Product product = new Product();
|
|
product.setCount(count_item);
|
|
product.setPrice(Math.ceil(price));
|
|
list.add(product);
|
|
}
|
|
|
|
} else if ("单面烫黄金".equals(kind2)) {
|
|
double priceArr[] = {68, 48, 37, 36, 35, 34};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
} else if ("单面凹凸".equals(kind2)) {
|
|
double priceArr[] = {75, 50, 40, 40, 39, 38};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
} else if ("单面烫黄金+凹凸".equals(kind2)) {
|
|
double priceArr[] = {93, 63, 48, 48, 47, 46};
|
|
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 吊牌600/800克价格计算
|
|
*
|
|
* @param area
|
|
* @param count
|
|
* @param priceArr
|
|
* @param shengzi
|
|
* @param flag
|
|
* @return
|
|
*/
|
|
private List<Product> acountTag600Price(double area, int count, double[] priceArr, double shengzi, boolean flag,
|
|
List<Product> list) {
|
|
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
|
|
Product pro = new Product();
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
if (countArr[i] == 500) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
if (countArr[i] == 500) {
|
|
shengzi = 20;
|
|
} else if (countArr[i] == 1000) {
|
|
shengzi = 30;
|
|
} else if (countArr[i] == 2000) {
|
|
shengzi = 50;
|
|
} else {
|
|
shengzi = 0.03;
|
|
}
|
|
pro.setCount(countArr[i]);
|
|
if (flag) {
|
|
pro.setPrice(
|
|
Math.ceil(area * countArr[i] * priceArr[i] + (shengzi > 1 ? shengzi : shengzi * countArr[i])));
|
|
} else {
|
|
pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i]));
|
|
}
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 异形杯套价格计算
|
|
*
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getCupSetPrice(int count) {
|
|
List<Product> list = new ArrayList<>();
|
|
Product pro = new Product();
|
|
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
|
|
double priceArr[] = {700, 780, 820, 900, 1300, 1800};
|
|
if (count <= 10000) {
|
|
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);
|
|
}
|
|
} else {
|
|
pro = new Product();
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(count * 0.25));
|
|
list.add(pro);
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 手提袋价格计算
|
|
*
|
|
* @param
|
|
* @param kai 产品开数
|
|
* @return 报价:〔数量除以开数+*纸张《正度或者大度》+印工〔1千印X内150元,每超出1千印另加50元计算》+固定刀版收费200元+粘成品工钱.3*数量(小于200元按2⑾0元算〉〉*.5备注:以上报价展开尺寸最大为1000*700KM超出这个尺寸按以上报价*2倍计算
|
|
*/
|
|
public List<Product> getPriceHanding(int count, int kai, double price, double m) {
|
|
List<Product> list = new ArrayList<>();
|
|
int countArr[] = {500, 1000, 2000, 4000, 10000, 20000, 30000};
|
|
Product pro = new Product();
|
|
if (count >= 100) {
|
|
if (count < 670) {
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil((count / kai * price + 150 + 200 + 200) * m));
|
|
list.add(pro);
|
|
} else {
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(
|
|
(count / kai * price + (150 + Math.ceil((count - 1000) / 1000) * 50) + 200 + count * 0.3) * m));
|
|
list.add(pro);
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || countArr[i] == list.get(0).getCount()) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
if (countArr[i] == 500) {
|
|
pro.setPrice(Math.ceil(
|
|
(countArr[i] / kai * price + (150 + Math.ceil((countArr[i] - 1000) / 1000) * 50) + 200 + 200)
|
|
* m));
|
|
} else {
|
|
pro.setPrice(Math.ceil((countArr[i] / kai * price + (150 + Math.ceil((countArr[i] - 1000) / 1000) * 50)
|
|
+ 200 + countArr[i] * 0.3) * m));
|
|
}
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 计算手提袋大度开数
|
|
*
|
|
* @param length
|
|
* @param width
|
|
* @return
|
|
*/
|
|
public static String getDa(double length, double width) {
|
|
double l1 = Math.floor(1194 / length);
|
|
double w1 = Math.floor(889 / width);
|
|
double l2 = Math.floor(1194 / width);
|
|
double w2 = Math.floor(889 / length);
|
|
int maxDa = (int) Math.max(l1 * w1, l2 * w2);
|
|
if (w1 != 2) {
|
|
return "" + maxDa;
|
|
} else {
|
|
double ll1 = Math.floor(length / length);
|
|
double ww1 = Math.floor(889 / width);
|
|
double ll2 = Math.floor(length / width);
|
|
double ww2 = Math.floor(889 / length);
|
|
int maxxa = (int) Math.max(ll1 * ww1, ll2 * ww2);
|
|
|
|
double lll1 = Math.floor((1194 - length) / length);
|
|
double www1 = Math.floor(889 / width);
|
|
double lll2 = Math.floor(length / width);
|
|
double www2 = Math.floor(889 / length);
|
|
int maxxb = (int) Math.max(lll1 * www1, lll2 * www2);
|
|
maxDa = maxxb + maxxa;
|
|
return "" + maxDa;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 正度开数
|
|
*
|
|
* @param length
|
|
* @param width
|
|
* @return
|
|
*/
|
|
public static String getZheng(double length, double width) {
|
|
double l1 = Math.floor(1092 / length);
|
|
double w1 = Math.floor(787 / width);
|
|
double l2 = Math.floor(1092 / width);
|
|
double w2 = Math.floor(787 / length);
|
|
int maxZheng = (int) Math.max(l1 * w1, l2 * w2);
|
|
if (w1 != 2) {
|
|
return "+" + maxZheng;
|
|
} else {
|
|
double ll1 = Math.floor(length / length);
|
|
double ww1 = Math.floor(787 / width);
|
|
double ll2 = Math.floor(length / width);
|
|
double ww2 = Math.floor(787 / length);
|
|
int maxxa = (int) Math.max(ll1 * ww1, ll2 * ww2);
|
|
|
|
double lll1 = Math.floor((1092 - length) / length);
|
|
double www1 = Math.floor(787 / width);
|
|
double lll2 = Math.floor(length / width);
|
|
double www2 = Math.floor(787 / length);
|
|
int maxxb = (int) Math.max(lll1 * www1, lll2 * www2);
|
|
maxZheng = maxxb + maxxa;
|
|
return "" + maxZheng;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 金属标价格计算 ===>最大印刷面积290*190MM 成品尺寸一边加1.5MM 算大张要几张 起步价90元
|
|
* 10张以内不含10张100+25*(数量-2) 20张以内 数量*24 30张以内 数量*22 超过30张*20
|
|
*
|
|
* @param list
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param number
|
|
* @return
|
|
*/
|
|
public List<Product> getMetalPrice(List<Product> list, Double width, Double length, int count, Integer number) {
|
|
/*if (length == 1) {
|
|
length = 2.0;
|
|
}
|
|
if (width == 1) {
|
|
width = 2.0;
|
|
}*/
|
|
// 最大尺寸29*19cm ,加出血一边5mm
|
|
double l = 295;
|
|
double w = 195;
|
|
Product pro = new Product();
|
|
// 第一张大纸价格
|
|
double price = 0;
|
|
// 换成毫米每边+3
|
|
length = length * 10 + 2 * 1.5;
|
|
width = width * 10 + 2 * 1.5;
|
|
// 数量*款数就是张数
|
|
// count = count * number;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸29*19cm 能做多少个此类尺寸的金属标
|
|
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);
|
|
int numUnit = (int) Math.ceil((count) / max);
|
|
boolean isNumnber = false;
|
|
if (numUnit == 1) {
|
|
isNumnber = true;
|
|
}
|
|
double mulit = 1;
|
|
/*
|
|
* if (num > 2) { price = price + 25 * (num - 2); }
|
|
*/
|
|
double design = 0;
|
|
|
|
if (!isNumnber) {
|
|
if (numUnit <= 2) {
|
|
price = 80;
|
|
} else if (numUnit < 6) {
|
|
price = 80 + 24 * (numUnit - 2);
|
|
} else if (numUnit < 10) {
|
|
price = 80 + 23 * (numUnit - 2);
|
|
} else if (numUnit < 16) {
|
|
price = 80 + 21 * (numUnit - 2);
|
|
} else if (numUnit < 30) {
|
|
price = 200 + 12 * (numUnit - 2);
|
|
} else if (numUnit < 51) {
|
|
price = 280 + 9 * (numUnit - 2);
|
|
} else if (numUnit < 100) {
|
|
price = Math.ceil((numUnit * 9) / 0.64);
|
|
} else if (numUnit < 300) {
|
|
price = Math.ceil((numUnit * 9) / 0.645);
|
|
} else {
|
|
price = Math.ceil((numUnit * 9) / 0.646);
|
|
}
|
|
mulit = number;
|
|
} else {
|
|
price = 80;
|
|
mulit = Math.ceil(num / numUnit);
|
|
}
|
|
|
|
price = Math.ceil(price * mulit);
|
|
|
|
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price + design));
|
|
float d = (float) num / (float) 30;
|
|
if (number > 1) {
|
|
d = d * number;
|
|
}
|
|
pro.setWeight(String.valueOf(df.format(d)));
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* UV转印贴
|
|
*
|
|
* @param area
|
|
* @param type
|
|
* @return
|
|
*/
|
|
private double f_getUvPrice(double area, int type) {//根据面积获取价格
|
|
double price = 0, lastPrice = 0;
|
|
double areaArr[] = {0.1, 0.12, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 3, 5, 7, 9, 10, 20, 50, 100, 200, 500, 1000, 5000};
|
|
double priceArr[] = {450, 420, 400, 380, 360, 340, 300, 225, 200, 175, 170, 150, 145, 125, 120, 110, 100, 90, 80, 70};
|
|
double lessPriceArr[] = {215, 215, 215, 215, 215, 215, 215, 200, 170, 160, 150, 140, 135, 115, 110, 100, 90, 80, 70, 60};
|
|
double areaArrSmall[] = {0.03, 0.1};
|
|
double priceArrSmall[] = {30, 50};
|
|
for (int i = 0; i < areaArr.length; i++) {
|
|
if (areaArr[i] < area) {
|
|
continue;
|
|
}
|
|
if (i > 0) {
|
|
if (type == 2) {
|
|
lastPrice = Math.ceil(lessPriceArr[i - 1] * areaArr[i - 1]);
|
|
} else {
|
|
lastPrice = Math.ceil(priceArr[i - 1] * areaArr[i - 1]);
|
|
}
|
|
}
|
|
if (type == 2) {
|
|
price = Math.ceil(lessPriceArr[i] * area);
|
|
} else {
|
|
price = Math.ceil(priceArr[i] * area);
|
|
}
|
|
if (lastPrice > price) {
|
|
price = lastPrice;
|
|
}
|
|
break;
|
|
}
|
|
if (type == 3) {
|
|
for (int i = 0; i < areaArrSmall.length; i++) {
|
|
if (areaArrSmall[i] < area) {
|
|
continue;
|
|
}
|
|
if (i > 0) {
|
|
lastPrice = Math.ceil(priceArrSmall[i - 1]);
|
|
}
|
|
price = Math.ceil(priceArrSmall[i]);
|
|
if (lastPrice > price) {
|
|
price = lastPrice;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
//最低价65
|
|
if (price == 0) {
|
|
price = 65 * area;
|
|
}
|
|
return price;
|
|
}
|
|
|
|
public List<Product> UVStickerPrice(double length, double width, int count, int number, String yinse, String[] zhuan) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
|
|
Product pro;
|
|
int oldCount = count;
|
|
int isInArr = 0;
|
|
double price = 0, mqPrice = 0, lastPrice;
|
|
if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))
|
|
&& count < 100) {
|
|
// if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
|
|
// 烫金100个起
|
|
count = 100;
|
|
}
|
|
|
|
double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
//工艺价格另算
|
|
area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
|
|
}
|
|
double lastArea = 0;
|
|
int index = Arrays.binarySearch(countArr, oldCount);
|
|
if (index >= 0) {
|
|
isInArr = 1;
|
|
}
|
|
|
|
if (isInArr != 1) {
|
|
price = f_getUvPrice(area, 1);
|
|
price = price > 45 ? price : 45;
|
|
|
|
if (area <= 0.2) {
|
|
mqPrice = count * 0.05;
|
|
mqPrice = mqPrice > 5 ? mqPrice : 5;
|
|
Math.ceil(price += mqPrice);
|
|
}
|
|
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
} else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (45 * area);
|
|
price = price > 103 ? price : 103;
|
|
} else if ("双面贴".equals(zhuan[0])) {
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
}
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setPrice(Math.ceil(price));
|
|
pro.setWeight(String.valueOf(df.format(area)));
|
|
pro.setCount(oldCount);
|
|
list.add(pro);
|
|
}
|
|
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
if (list.size() > 2) {
|
|
break;
|
|
} else {
|
|
area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000 * number;
|
|
if (i > 0) {
|
|
lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000 * number;
|
|
}
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
//工艺价格另算
|
|
area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000;
|
|
if (i > 0) {
|
|
lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000;
|
|
}
|
|
}
|
|
// 报价面积,平方米(加一边3mm出血)
|
|
price = f_getUvPrice(area, 1);
|
|
price = price > 45 ? price : 45;
|
|
lastPrice = f_getUvPrice(lastArea, 1);
|
|
|
|
|
|
if (area <= 0.2) {
|
|
mqPrice = countArr[i] * 0.05;
|
|
mqPrice = mqPrice > 5 ? mqPrice : 5;
|
|
Math.ceil(price += mqPrice);
|
|
}
|
|
if (lastArea <= 0.2 && i > 0) {
|
|
mqPrice = countArr[i - 1] * 0.05;
|
|
mqPrice = mqPrice > 5 ? mqPrice : 5;
|
|
Math.ceil(lastPrice += mqPrice);
|
|
}
|
|
if (area > 0.1) {
|
|
if (lastPrice >= price) {//判断上一个尺寸
|
|
price = Math.ceil(lastPrice * 1.1);
|
|
}
|
|
}
|
|
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
// lastPrice = lastPrice + (45 * area);
|
|
// lastPrice = lastPrice > 103 ? lastPrice : 103;
|
|
} else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (45 * area);
|
|
price = price > 103 ? price : 103;
|
|
// lastPrice = lastPrice + (45 * area);
|
|
// lastPrice = lastPrice > 103 ? lastPrice : 103;
|
|
} else if ("双面贴".equals(zhuan[0])) {
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
}
|
|
}
|
|
|
|
|
|
pro = new Product();
|
|
pro.setPrice(Math.ceil(price));
|
|
pro.setWeight(String.valueOf(df.format(area)));
|
|
pro.setCount(countArr[i]);
|
|
list.add(pro);
|
|
}
|
|
}
|
|
|
|
// if (!StringUtils.isEmpty(zhuan) && ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))) {
|
|
// for (Product product : list) {
|
|
// product.setPrice(Math.ceil(product.getPrice() + 60));
|
|
// }
|
|
// }
|
|
if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
|
|
for (Product product : list) {
|
|
product.setPrice(Math.ceil(product.getPrice() + 80));
|
|
}
|
|
}
|
|
|
|
if (length >= 44 || width >= 44) {
|
|
if (width > length) {
|
|
length = width;
|
|
}
|
|
for (Product product : list) {
|
|
product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
|
|
}
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 小面积UV转印贴报价:
|
|
*
|
|
* @param length
|
|
* @param width
|
|
* @param count
|
|
* @param zhuan
|
|
* @param yinse 印色
|
|
* @return
|
|
*/
|
|
public List<Product> UVStickerSmallPrice(double length, double width, int count, int number, String yinse, String[] zhuan) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
|
|
Product pro;
|
|
int isInArr = 0;
|
|
int oldCount = count;
|
|
double price = 0, mqPrice = 0, lastPrice, list_lastPrice = 0;
|
|
if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))
|
|
&& count < 100) {
|
|
// if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
|
|
// 烫金100个起
|
|
count = 100;
|
|
}
|
|
double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
//工艺价格另算
|
|
area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
|
|
}
|
|
double lastArea = 0;
|
|
int index = Arrays.binarySearch(countArr, oldCount);
|
|
if (index >= 0) {
|
|
isInArr = 1;
|
|
}
|
|
|
|
if (isInArr != 1) {
|
|
price = f_getUvPrice(area, 1);
|
|
price = price > 45 ? price : 45;
|
|
if (area < 0.1 && area > 0) {
|
|
price = f_getUvPrice(area, 3);
|
|
}
|
|
|
|
if (area <= 0.2 && area >= 0.1) {
|
|
mqPrice = count * 0.05;
|
|
mqPrice = mqPrice > 5 ? mqPrice : 5;
|
|
Math.ceil(price += mqPrice);
|
|
}
|
|
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
} else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (45 * area);
|
|
price = price > 103 ? price : 103;
|
|
} else if ("双面贴".equals(zhuan[0])) {
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
}
|
|
}
|
|
|
|
pro = new Product();
|
|
list_lastPrice = Math.max(Math.ceil(price), list_lastPrice);
|
|
pro.setPrice(list_lastPrice);
|
|
pro.setWeight(String.valueOf(df.format(area)));
|
|
pro.setCount(oldCount);
|
|
list.add(pro);
|
|
}
|
|
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
if (list.size() > 2) {
|
|
break;
|
|
} else {
|
|
area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000 * number;
|
|
if (i > 0) {
|
|
lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000 * number;
|
|
}
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
//工艺价格另算
|
|
area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000;
|
|
if (i > 0) {
|
|
lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000;
|
|
}
|
|
}
|
|
// 报价面积,平方米(加一边3mm出血)
|
|
price = f_getUvPrice(area, 1);
|
|
price = price > 45 ? price : 45;
|
|
lastPrice = f_getUvPrice(lastArea, 1);
|
|
if (area < 0.1 && area > 0) {
|
|
price = f_getUvPrice(area, 3);
|
|
lastPrice = f_getUvPrice(lastArea, 3);
|
|
}
|
|
|
|
|
|
if (area <= 0.2 && area >= 0.1) {
|
|
mqPrice = countArr[i] * 0.05;
|
|
mqPrice = mqPrice > 5 ? mqPrice : 5;
|
|
Math.ceil(price += mqPrice);
|
|
}
|
|
if (lastArea <= 0.2 && area >= 0.1 && i > 0) {
|
|
mqPrice = countArr[i - 1] * 0.05;
|
|
mqPrice = mqPrice > 5 ? mqPrice : 5;
|
|
Math.ceil(lastPrice += mqPrice);
|
|
}
|
|
if (area > 0.1) {
|
|
if (lastPrice >= price) {//判断上一个尺寸
|
|
price = Math.ceil(lastPrice * 1.1);
|
|
}
|
|
}
|
|
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
// lastPrice = lastPrice + (45 * area);
|
|
// lastPrice = lastPrice > 103 ? lastPrice : 103;
|
|
} else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
|
|
// 起步价+58元
|
|
price = price + (45 * area);
|
|
price = price > 103 ? price : 103;
|
|
// lastPrice = lastPrice + (45 * area);
|
|
// lastPrice = lastPrice > 103 ? lastPrice : 103;
|
|
} else if ("双面贴".equals(zhuan[0])) {
|
|
price = price + (40 * area);
|
|
price = price > 80 ? price : 80;
|
|
}
|
|
}
|
|
|
|
pro = new Product();
|
|
list_lastPrice = Math.max(Math.ceil(price), list_lastPrice);
|
|
pro.setPrice(list_lastPrice);
|
|
pro.setWeight(String.valueOf(df.format(area)));
|
|
pro.setCount(countArr[i]);
|
|
list.add(pro);
|
|
}
|
|
}
|
|
|
|
// if (!StringUtils.isEmpty(zhuan) && ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))) {
|
|
// for (Product product : list) {
|
|
// product.setPrice(Math.ceil(product.getPrice() + 60));
|
|
// }
|
|
// }
|
|
if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
|
|
for (Product product : list) {
|
|
product.setPrice(Math.ceil(product.getPrice() + 60));
|
|
}
|
|
}
|
|
|
|
if (length >= 44 || width >= 44) {
|
|
if (width > length) {
|
|
length = width;
|
|
}
|
|
for (Product product : list) {
|
|
product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
|
|
}
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 少数量(小于10)UV转印贴报价:
|
|
*
|
|
* @param length
|
|
* @param width
|
|
* @param count
|
|
* @param zhuan
|
|
* @param number 印色
|
|
* @return
|
|
*/
|
|
public List<Product> UVStickerLessPrice(double length, double width, int count, int number, String[] zhuan) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
|
|
if (!StringUtils.isEmpty(zhuan) && count < 25) {
|
|
return list;
|
|
}
|
|
double price = f_getUvPrice(area, 2);
|
|
pro.setPrice(price > 80 ? price : 80);
|
|
pro.setCount(count);
|
|
list.add(pro);
|
|
|
|
if (!StringUtils.isEmpty(zhuan)) {
|
|
for (Product product : list) {
|
|
product.setPrice(Math.floor(product.getPrice() + 60 + (30 * area > 15 ? 30 * area : 15)));
|
|
}
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 条幅
|
|
*
|
|
* @param kind2
|
|
* @param number
|
|
*/
|
|
public static List<Product> bannerPrice(String kind2, double length, double width, int count, Integer number, String role) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
// 一条条幅的长度
|
|
length = length / 100.0;
|
|
width = width / 100.0;
|
|
double area = length * width * count;
|
|
double price = 0;
|
|
if ("彩色条幅".equals(kind2)) {
|
|
//拼多多价格
|
|
if (role.indexOf("1045") > -1) {
|
|
if (width == 0.5 || length == 0.5) {
|
|
double widthArr[] = {3, 4, 5, 6, 7, 8};
|
|
double unitArr[] = {19, 17.5, 17, 17, 17, 17};
|
|
double baseArr[] = {40, 50, 60, 75, 85, 96};
|
|
for (int i = 0; i < widthArr.length; i++) {
|
|
if (widthArr[i] < width || widthArr[i] < length) {
|
|
continue;
|
|
}
|
|
price = unitArr[i] * area;
|
|
price = price > baseArr[i] ? price : baseArr[i];
|
|
break;
|
|
}
|
|
} else {
|
|
if (area <= 1) {
|
|
price = 45;
|
|
} else if (area <= 2) {
|
|
price = 35 * area;
|
|
} else if (area <= 3) {
|
|
price = 33 * area;
|
|
} else if (area <= 4) {
|
|
price = 32 * area;
|
|
} else if (area <= 5) {
|
|
price = 30 * area;
|
|
} else if (area <= 10) {
|
|
price = 28 * area;
|
|
} else {
|
|
price = 25 * area;
|
|
}
|
|
}
|
|
price = price > 40 ? price : 40;
|
|
} else {
|
|
if (width == 0.5 && length == 3 || width == 3 && length == 0.5) {
|
|
price = 30 * area;
|
|
} else if (width == 0.5 && length == 5 || width == 5 && length == 0.5) {
|
|
price = 24 * area;
|
|
} else if (area <= 1) {
|
|
price = 45;
|
|
} else if (area <= 2) {
|
|
price = 35 * area;
|
|
} else if (area <= 3) {
|
|
price = 33 * area;
|
|
} else if (area <= 4) {
|
|
price = 32 * area;
|
|
} else if (area <= 5) {
|
|
price = 30 * area;
|
|
} else if (area <= 10) {
|
|
price = 28 * area;
|
|
} else {
|
|
price = 25 * area;
|
|
}
|
|
|
|
price = price > 45 ? price : 45;
|
|
}
|
|
|
|
} else {
|
|
if ((width == 0.5 && length == 3 && count == 1) || (width == 3 && length == 0.5 && count == 1)) {
|
|
price = 24 * area;
|
|
} else if (area <= 1) {
|
|
price = 35;
|
|
} else if (area <= 2) {
|
|
price = 30 * area;
|
|
} else if (area <= 3) {
|
|
price = 24 * area;
|
|
} else if (area <= 4) {
|
|
price = 21 * area;
|
|
} else if (area <= 5) {
|
|
price = 18 * area;
|
|
} else if (area <= 10) {
|
|
price = 16 * area;
|
|
} else {
|
|
price = 13 * area;
|
|
}
|
|
price = price > 40 ? price : 40;
|
|
}
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price));
|
|
list.add(pro);
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 桌贴0.38磨砂背胶价格计算 ======》 最大印刷尺寸40*45CM 最低起步价100元 每增加一张加30元 设计费每款加8元
|
|
* <p>
|
|
* 0.38桌贴(磨砂、哑光、亮光) 最大打印面积 395*445MM 成品最小做到1CM 每边加上1.5MM出血 起步价90元
|
|
* 单面印刷不带胶每增加一张单面加30元 双面打印不带胶每增加一张加36元, 带胶加40元一张 10张以上不分单双面带不带胶 均20元/张
|
|
* 款数不同的每款加上1元的设计费
|
|
*
|
|
* @param list
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param number
|
|
* @return
|
|
*/
|
|
public List<Product> getDeskSticker(List<Product> list, Double width, Double length, int count, Integer number,
|
|
String craftShua, String craftJiao) {
|
|
// 最大尺寸435*385mm ,加出血一边3mm
|
|
double l = 435;
|
|
double w = 385;
|
|
Product pro = new Product();
|
|
// 价格
|
|
double price = 0;
|
|
// 换成毫米每边+1.5
|
|
length = length * 10 + 2 * 1.5;
|
|
width = width * 10 + 2 * 1.5;
|
|
// 数量*款数就是张数
|
|
count = count * number;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸45*40cm 能做多少个此类尺寸的桌贴
|
|
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 ("单面".equals(craftShua)) {
|
|
if (num > 10) {
|
|
price = 70 + num * 28 + (number - 1);
|
|
} else {
|
|
price = 80 + num * 30 + (number - 1);
|
|
}
|
|
} else if ("双面".equals(craftShua)) {
|
|
if ("背胶".equals(craftJiao)) {
|
|
price = 100 + num * 40 + (number - 1);
|
|
} else {
|
|
price = 100 + num * 36 + (number - 1);
|
|
}
|
|
}
|
|
|
|
pro.setCount(count / number);
|
|
pro.setPrice(price > 90 ? price : 90);
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 桌贴0.38PVC亮光异型卡片 印刷价格
|
|
*
|
|
* @param list
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getDeskSticker(List<Product> list, Double width, Double length, int count) {
|
|
double danjia;
|
|
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
// 面积平方米
|
|
double area = width * length * countArr[i] / 10000;
|
|
Product pro = new Product();
|
|
if (area <= 0.45) {
|
|
danjia = 110;
|
|
} else if (area <= 0.9) {
|
|
danjia = 150;
|
|
} else if (area <= 5) {
|
|
danjia = 100;
|
|
} else if (area <= 10) {
|
|
danjia = 70;
|
|
} else if (area <= 15) {
|
|
danjia = 55;
|
|
} else if (area <= 20) {
|
|
danjia = 50;
|
|
} else if (area <= 30) {
|
|
danjia = 40;
|
|
} else {
|
|
danjia = 30;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(area * danjia > 120 ? area * danjia : 120);
|
|
list.add(pro);
|
|
}
|
|
for (int i = 0; i < list.size() - 1; i++) {
|
|
if (list.get(i + 1).getPrice() - list.get(i).getPrice() < 100) {
|
|
list.get(i + 1).setPrice(list.get(i + 1).getPrice() + 100);
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 桌贴0.38PVC亮光异型卡片 打印价格
|
|
*
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param craftJiao
|
|
* @return 不同款内容的报价:成本核算 有效打印面积 380*420MM 起步价120元 每增加一张单面加30元
|
|
* 双面打印在每增加一张加36元,带胶加每增加一张加40元 10张以上单双面均加22元/张
|
|
*/
|
|
public List<Product> getDeskStickerPrint(Double width, Double length, int count, int number, String craftJiao) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
// 有效打印面积 420*380MM,加出血一边3mm
|
|
double l = 426;
|
|
double w = 386;
|
|
Product pro = new Product();
|
|
// 第一张大纸价格
|
|
double price = 120;
|
|
// 换成毫米每边+3
|
|
length = length * 10 + 2 * 3;
|
|
width = width * 10 + 2 * 3;
|
|
// 数量 * 款数就是张数
|
|
count = count * number;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸420*380mm 能做多少个此类尺寸的桌贴
|
|
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 ("背胶".equals(craftJiao)) {
|
|
price = price + (num - 1) * 40;
|
|
} else {
|
|
if (num > 10) {
|
|
price = price + (num - 1) * 22;
|
|
} else {
|
|
// 单面
|
|
if ("单面".equals(craftJiao)) {
|
|
price = price + (num - 1) * 30;
|
|
} else if ("双面".equals(craftJiao)) {// 双面
|
|
price = price + (num - 1) * 36;
|
|
}
|
|
}
|
|
}
|
|
|
|
pro.setCount(count / number);
|
|
pro.setPrice(price);
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 滴塑价格计算======> 滴塑 出血位每边加1.5MM 滴塑最大印刷面积43*30CM 起步价80元 2张100元 3张120元 4张150元
|
|
* 5张180元 10张260元 11张以上*25元
|
|
*
|
|
* @param list
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param number
|
|
* @param dto
|
|
* @return
|
|
*/
|
|
public static List<Product> getDisuPrice(List<Product> list, Double width, Double length, int count, Integer number, Product dto) {
|
|
List<String> craft = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
|
|
// 最大尺寸43*30cm
|
|
double l = 430;
|
|
double w = 300;
|
|
Product pro = new Product();
|
|
// 第一张大纸价格
|
|
double price = 80;
|
|
if (craft.size() > 0) {//工艺起步价120
|
|
price = 120;
|
|
}
|
|
// 换成毫米每边+3
|
|
length = length * 10 + 2 * 1.5;
|
|
width = width * 10 + 2 * 1.5;
|
|
// 数量*款数就是张数
|
|
count = count * number;
|
|
if ((length > l || width > w) && (length > w || width > l)) {
|
|
return null;
|
|
}
|
|
// 一张大纸43*30 能做多少个此类尺寸的
|
|
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 (num <= 10) {
|
|
price = price + (num - 1) * 20;
|
|
} else if (num > 10) {
|
|
price = num * 25;
|
|
}
|
|
price += 10 * craft.size() * num;
|
|
if (dto.getN_mq_num() > 0) {
|
|
price += 10 * dto.getN_mq_num();
|
|
}
|
|
if (number > 1) {
|
|
price *= 1.3;
|
|
}
|
|
pro.setCount(count / number);
|
|
pro.setPrice(price);
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 毕业证书价格计算
|
|
*
|
|
* @param count
|
|
*/
|
|
public List<Product> getDiploma(int count) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
// 数量
|
|
int countArr[] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 500, 1000};
|
|
// 价格
|
|
double priceArray[] = {90, 110, 120, 140, 160, 190, 210, 230, 240, 270, 480, 740, 920, 1200};
|
|
Product pro = new Product();
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
if (list.size() == 4) {
|
|
return list;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(priceArray[i]);
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 复印纸价格计算
|
|
*
|
|
* @param count
|
|
* @param kind3
|
|
* @param kind2
|
|
* @param kind
|
|
* @param size
|
|
* @return
|
|
*/
|
|
public List<Product> getCopyPaper(String kind, String kind2, String kind3, int count, String size) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
double price = 0;
|
|
if ("彩色".equals(kind)) {
|
|
if ("80克双胶纸".equals(kind2)) {
|
|
if ("19*13".equals(size)) {
|
|
if (count == 10) {
|
|
price = 70;
|
|
} else if (count == 20) {
|
|
price = 90;
|
|
} else if (count == 50) {
|
|
price = 150;
|
|
}
|
|
} else if ("28.5*21".equals(size)) {
|
|
if (count == 10) {
|
|
price = 160;
|
|
} else if (count == 20) {
|
|
price = 320;
|
|
} else if (count == 50) {
|
|
price = 900;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if ("60克双胶纸".equals(kind2)) {
|
|
if ("19*13".equals(size)) {
|
|
if (count == 10) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 50;
|
|
} else {
|
|
price = 70;
|
|
}
|
|
} else if (count == 20) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 60;
|
|
} else {
|
|
price = 90;
|
|
}
|
|
} else if (count == 50) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 110;
|
|
} else {
|
|
price = 150;
|
|
}
|
|
}
|
|
} else if ("28.5*21".equals(size)) {
|
|
if (count == 10) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 110;
|
|
} else {
|
|
price = 150;
|
|
}
|
|
} else if (count == 20) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 160;
|
|
} else {
|
|
price = 220;
|
|
}
|
|
} else if (count == 50) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 380;
|
|
} else {
|
|
price = 520;
|
|
}
|
|
}
|
|
}
|
|
} else if ("80克双胶纸".equals(kind2)) {
|
|
if ("19*13".equals(size)) {
|
|
if (count == 10) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 60;
|
|
} else {
|
|
price = 90;
|
|
}
|
|
} else if (count == 20) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 80;
|
|
} else {
|
|
price = 120;
|
|
}
|
|
} else if (count == 50) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 180;
|
|
} else {
|
|
price = 220;
|
|
}
|
|
}
|
|
} else if ("28.5*21".equals(size)) {
|
|
if (count == 10) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 130;
|
|
} else {
|
|
price = 180;
|
|
}
|
|
} else if (count == 20) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 220;
|
|
} else {
|
|
price = 260;
|
|
}
|
|
} else if (count == 50) {
|
|
if ("单面".equals(kind3)) {
|
|
price = 520;
|
|
} else {
|
|
price = 780;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Product pro = new Product();
|
|
pro = new Product();
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price));
|
|
list.add(pro);
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 婚礼卡价格计算
|
|
*
|
|
* @param length
|
|
* @param width
|
|
* @param count
|
|
* @param number
|
|
* @param craftMo
|
|
* @param craftShua
|
|
* @return
|
|
*/
|
|
public List<Product> getWeddingCardPrice(Double length, Double width, int count, Integer number, String craftMo,
|
|
String craftShua) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
double weight = 0;
|
|
if ("直角".equals(craftMo) && count <= 300 && ((length == 13 && width == 5.4) || (length == 5.4 && width == 13))) {
|
|
if ("单面印刷".equals(craftShua)) {
|
|
// 数量
|
|
int countArr[] = {100, 200, 300};
|
|
// 价格
|
|
double priceArray[] = {70, 126, 183};
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
|
|
pro.setPrice(priceArray[i]);
|
|
list.add(pro);
|
|
}
|
|
// 根据款数重新算价格
|
|
for (Product product : list) {
|
|
product.setWeight(df.format(length * width * product.getCount() / 10000 * 0.3 * number));
|
|
product.setPrice(Math.floor(product.getPrice() * number));
|
|
}
|
|
} else if ("双面印刷".equals(craftShua)) {
|
|
// 数量
|
|
int countArr[] = {100, 200, 300};
|
|
// 价格
|
|
double priceArray[] = {108, 189, 275};
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
|
|
pro.setPrice(priceArray[i]);
|
|
list.add(pro);
|
|
}
|
|
// 根据款数重新算价格
|
|
for (Product product : list) {
|
|
product.setPrice(Math.floor(product.getPrice() * number));
|
|
}
|
|
}
|
|
} else {
|
|
// 转成毫米
|
|
weight = length * width * count / 10000 * 0.3 * number;
|
|
length = length * 10;
|
|
width = width * 10;
|
|
if (count <= 300) {
|
|
double l = 420;
|
|
double w = 285;
|
|
// 打印的加上出血(一边2毫米)
|
|
length = length + 4;
|
|
width = width + 4;
|
|
double price = 0.0;
|
|
|
|
// 5张以内价格
|
|
double fixPrice = 50;
|
|
// 每增加1张多少钱
|
|
double zhang = 6;
|
|
// 设计费
|
|
double designFee = 0.0;
|
|
|
|
// 婚礼卡,直角工艺每增加一张5元
|
|
if ("直角".equals(craftMo)) {
|
|
zhang = 5;
|
|
}
|
|
|
|
/*
|
|
* 婚礼卡设计费成品尺寸90X54MM以内每款收10元 140X100MM以内每款收15元 210X140MM以内30元 210X285MM以内40元
|
|
* 420X285MM以内60元 大于420X285MM80元
|
|
*/
|
|
// 设计费不带出血的尺寸
|
|
if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
|
|
designFee = 10;
|
|
} else if ((length - 4 <= 140 && width - 4 <= 100) || (length - 4 <= 140 && width - 4 <= 100)) {
|
|
designFee = 15;
|
|
} else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
|
|
designFee = 30;
|
|
} else if ((length - 4 <= 285 && width - 4 - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
|
|
designFee = 40;
|
|
} else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
|
|
designFee = 60;
|
|
} else {
|
|
designFee = 80;
|
|
}
|
|
|
|
// 一张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);
|
|
// 5张以内价格 + 每张费用(第6张起收)+ 设计费 * 款数 + 0.1 * 总数量 (排号费)
|
|
price = fixPrice + (num - 5 > 0 ? num - 5 : 0) * zhang + designFee * number + 0.1 * count * number;
|
|
Product dto = new Product();
|
|
dto.setCount(count);
|
|
dto.setPrice(price);
|
|
list.add(dto);
|
|
} else {
|
|
// 数量
|
|
int countArr[] = {500, 1000, 2000};
|
|
// 价格
|
|
double priceArray[] = {230, 400, 760};
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
|
|
pro.setPrice(priceArray[i]);
|
|
list.add(pro);
|
|
}
|
|
// 根据款数重新算价格
|
|
for (Product product : list) {
|
|
product.setWeight(df.format(weight));
|
|
product.setPrice(Math.floor(product.getPrice() * number));
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 贡缎布产品价格
|
|
*/
|
|
public static List<Product> satinClothPrice(String kind2, Double length, Double width, int count, Integer number) {
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
double area = length * width / 10000;
|
|
double price = 0, dj = 0;
|
|
if (area < 0.25) {
|
|
dj = 50;
|
|
} else {
|
|
dj = 40;
|
|
}
|
|
|
|
area *= count;
|
|
if ("6".equals(kind2)) {
|
|
price = price + 30;
|
|
}
|
|
price = Math.ceil(area * dj > 58 ? area * dj : 58);
|
|
pro.setCount(count);
|
|
pro.setPrice(price * number);
|
|
list.add(pro);
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 餐垫纸
|
|
*
|
|
* @param kind
|
|
* @param length
|
|
* @param width
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getPlaceMatPrice(String kind, Double length, Double width, int count) {
|
|
List<Product> list = new ArrayList<>();
|
|
length = length * 10;
|
|
width = width * 10;
|
|
// Double priceArr[] = { 40.0, 50.0, 80.0, 120.0, 160.0, 270.0, 480.0 };
|
|
// list = acountInsertCardPrice(count, list, priceArr);
|
|
if ((length <= 285 && width <= 210) || length <= 210 && width <= 285) {
|
|
Double priceArr[] = {46.0, 68.0, 117.0, 157.0, 236.0, 457.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 436 && width <= 285 || length <= 285 && width <= 436) {
|
|
Double priceArr[] = {88.0, 122.0, 191.0, 269.0, 457.0, 896.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 638 && width <= 285 || length <= 285 && width <= 638) {
|
|
Double priceArr[] = {137.0, 204.0, 350.0, 489.0, 810.0, 1482.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 852 && width <= 285 || length <= 285 && width <= 852) {
|
|
Double priceArr[] = {183.0, 272.0, 466.0, 652.0, 975.0, 1681.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 1050 && width <= 285 || length <= 285 && width <= 2050) {
|
|
Double priceArr[] = {229.0, 340.0, 582.0, 815.0, 1279.0, 2470.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 587 && width <= 428 || length <= 428 && width <= 587) {
|
|
Double priceArr[] = {195.0, 262.0, 408.0, 554.0, 869.0, 1659.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 638 && width <= 428 || length <= 428 && width <= 638) {
|
|
Double priceArr[] = {252.0, 352.0, 570.0, 755.0, 1191.0, 2263.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 779 && width <= 428 || length <= 428 && width <= 778) {
|
|
Double priceArr[] = {321.0, 430.0, 691.0, 951.0, 1434.0, 2765.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 880 && width <= 428 || length <= 428 && width <= 880) {
|
|
Double priceArr[] = {349.0, 484.0, 796.0, 1051.0, 1681.0, 3258.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 1050 && width <= 428 || length <= 428 && width <= 1050) {
|
|
Double priceArr[] = {419.0, 587.0, 900.0, 1191.0, 1985.0, 3748.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 638 && width <= 574 || length <= 574 && width <= 638) {
|
|
Double priceArr[] = {274.0, 408.0, 699.0, 927.0, 1535.0, 2964.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 779 && width <= 529 || length <= 529 && width <= 779) {
|
|
Double priceArr[] = {321.0, 430.0, 691.0, 951.0, 1434.0, 2765.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 880 && width <= 580 || length <= 580 && width <= 880) {
|
|
Double priceArr[] = {349.0, 484.0, 796.0, 1051.0, 1681.0, 3258.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
} else if (length <= 863 && width <= 638 || length <= 638 && width <= 863) {
|
|
Double priceArr[] = {411.0, 612.0, 993.0, 1390.0, 2303.0, 4446.0};
|
|
list = acountPlaceMatPrice(kind, count, list, priceArr);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 餐垫纸遍历添加价格
|
|
*/
|
|
private List<Product> acountPlaceMatPrice(String kind, int count, List<Product> list, Double[] priceArr) {
|
|
int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
|
|
Product pro;
|
|
double beishu = 1;
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
if (countArr[i] <= 500) {
|
|
beishu = 2.2;
|
|
} else if (countArr[i] <= 3000) {
|
|
beishu = 1.8;
|
|
} else {
|
|
beishu = 1.5;
|
|
}
|
|
// 55克 比80克便宜2分钱一张
|
|
if ("1".equals(kind)) {
|
|
pro.setPrice(Math.ceil(priceArr[i] * beishu - countArr[i] * 0.02));
|
|
} else if ("0".equals(kind)) {// 80克
|
|
pro.setPrice(Math.ceil(priceArr[i] * beishu));
|
|
}
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 硫酸纸吊牌价格
|
|
*
|
|
* @param count
|
|
*/
|
|
public List<Product> getAcidTagsPrice(Double length, Double width, String size1, int count) {
|
|
List<Product> list = new ArrayList<>();
|
|
int countArr[] = {1000, 2000, 5000, 10000};
|
|
if ((length > 6.8 || width > 3) && (length > 3 || width > 6.8)) {
|
|
int priceArr[] = {200, 360, 720, 1300};
|
|
list = acountAcidTagsPrice(count, list, countArr, priceArr);
|
|
} else {
|
|
int priceArr[] = {180, 320, 620, 1100};
|
|
list = acountAcidTagsPrice(count, list, countArr, priceArr);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 硫酸纸吊牌价格计算
|
|
*
|
|
* @param count
|
|
* @param list
|
|
* @param countArr
|
|
* @param priceArr
|
|
*/
|
|
private List<Product> acountAcidTagsPrice(int count, List<Product> list, int[] countArr, int[] priceArr) {
|
|
Product pro;
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(Math.ceil(priceArr[i]));
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 号码布价格计算
|
|
*
|
|
* @param kind
|
|
* @param num
|
|
* @param width
|
|
* @param length
|
|
* @param list
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getHmbPrice(String kind, int num, Double length, Double width, int count, List<Product> list) {
|
|
Product pro;
|
|
double price = 0;
|
|
if (length == 240 && width == 200 || length == 200 && width == 240) {
|
|
if (kind.equals("春亚布")) {
|
|
price = num * count * 1.8;
|
|
} else {
|
|
price = num * count * 2.5;
|
|
}
|
|
} else if (length == 200 && width == 140 || length == 140 && width == 200) {
|
|
if (kind.equals("春亚布")) {
|
|
price = num * count * 1.5;
|
|
} else {
|
|
price = num * count * 1.3;
|
|
}
|
|
} else {
|
|
if (kind.equals("春亚布")) {
|
|
price = num * count * 1.5;
|
|
} else {
|
|
price = num * count * 1.8;
|
|
}
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price) > 50 ? price : 50);
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 锦旗价格计算
|
|
*
|
|
* @param kind
|
|
* @param num
|
|
* @param width
|
|
* @param length
|
|
* @param list
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getJQPrice(String kind, int num, Double length, Double width, int count, List<Product> list) {
|
|
Product pro;
|
|
double price = 0;
|
|
if (length == 60 && width == 90 || length == 90 && width == 60) {
|
|
if (kind.equals("小龙须黄字")) {
|
|
price = num * count * 45;
|
|
} else if (kind.equals("小龙须3d镀金")) {
|
|
price = num * count * 86;
|
|
} else if (kind.equals("大龙须黄字")) {
|
|
price = num * count * 66;
|
|
} else if (kind.equals("大龙须3d镀金")) {
|
|
price = num * count * 88;
|
|
} else {
|
|
price = num * count * 130;
|
|
}
|
|
} else if (length == 70 && width == 110 || length == 110 && width == 70) {
|
|
if (kind.equals("小龙须黄字")) {
|
|
price = num * count * 47;
|
|
} else if (kind.equals("小龙须3d镀金")) {
|
|
price = num * count * 88;
|
|
} else if (kind.equals("大龙须黄字")) {
|
|
price = num * count * 80;
|
|
} else {
|
|
price = num * count * 98;
|
|
}
|
|
} else if (length == 80 && width == 120 || length == 120 && width == 80) {
|
|
if (kind.equals("小龙须黄字")) {
|
|
price = num * count * 85;
|
|
} else if (kind.equals("小龙须3d镀金")) {
|
|
price = num * count * 125;
|
|
} else if (kind.equals("大龙须黄字")) {
|
|
price = num * count * 90;
|
|
} else {
|
|
price = num * count * 140;
|
|
}
|
|
} else if (length == 70 && width == 120 || length == 120 && width == 70) {
|
|
price = num * count * 158;
|
|
} else {
|
|
price = num * count * 220;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price));
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 彩旗价格计算
|
|
*
|
|
* @param num
|
|
* @param width
|
|
* @param length
|
|
* @param list
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getCQPrice(int num, Double length, Double width, int count, List<Product> list) {
|
|
Product pro;
|
|
double price = 0;
|
|
if (length == 40 && width == 80 || length == 80 && width == 40) {
|
|
price = num * count * 80;
|
|
} else if (length == 60 && width == 90 || length == 90 && width == 60) {
|
|
price = num * count * 130;
|
|
} else if (length == 70 && width == 120 || length == 120 && width == 70) {
|
|
price = num * count * 158;
|
|
} else {
|
|
price = num * count * 220;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price));
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 封口贴铜板不干胶价格计算
|
|
*
|
|
* @param num
|
|
* @param list
|
|
* @return
|
|
*/
|
|
public List<Product> getFktPrice(int num, List<Product> list) {
|
|
Product pro;
|
|
double price = 0;
|
|
for (int i = 1; i < countArr.length; i++) {
|
|
if (countArr[i] == 1000) {
|
|
price = 50.0 * num;
|
|
} else if (countArr[i] == 2000) {
|
|
price = 80.0 * num;
|
|
} else if (countArr[i] == 3000) {
|
|
price = 150.0 * num;
|
|
} else if (countArr[i] == 5000) {
|
|
price = 175.0 * num;
|
|
} else if (countArr[i] == 10000) {
|
|
price = 240.0 * num;
|
|
} else {
|
|
price = 450.0 * num;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(Math.ceil(price));
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* PVC亮光异型卡片价格计算
|
|
*
|
|
* @param dto
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param area
|
|
* @param count
|
|
* @param priceList
|
|
* @return
|
|
*/
|
|
/*public List<Product> getPVCPrice(String kindValue,int count,double width, double length, List<Product> list) {
|
|
Product pro;
|
|
double price = 0,dj = 0, bz = 1;
|
|
double area = (width*length)/10000;
|
|
int countArr[] = { 500, 1000, 2000, 5000, 10000 };
|
|
|
|
if(area <= 0.0016) {
|
|
bz = 2.7;
|
|
}else if(area <= 0.0025) {
|
|
bz = 1.8;
|
|
}else if(area <= 0.0036) {
|
|
bz = 1.3;
|
|
}else if(area <= 0.0042) {
|
|
bz = 1.05;
|
|
}
|
|
|
|
for(int i = 0; i< countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
if(kindValue.equals("2")) {
|
|
if(countArr[i] == 500) {
|
|
dj = 45;
|
|
}else if(countArr[i] == 1000) {
|
|
dj = 34;
|
|
}else if(countArr[i] == 2000) {
|
|
dj = 31;
|
|
}else if(countArr[i] == 5000) {
|
|
dj = 29;
|
|
}else if(countArr[i] == 10000) {
|
|
dj = 28;
|
|
}
|
|
}else {
|
|
if(countArr[i] == 500) {
|
|
dj = 63;
|
|
}else if(countArr[i] == 1000) {
|
|
dj = 54;
|
|
}else if(countArr[i] == 2000) {
|
|
dj = 50;
|
|
}else if(countArr[i] == 5000) {
|
|
dj = 48;
|
|
}else if(countArr[i] == 10000) {
|
|
dj = 47;
|
|
}
|
|
}
|
|
|
|
price = bz*dj*countArr[i]*area;
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
pro.setPrice(price);
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}*/
|
|
|
|
/**
|
|
* 硫酸纸价格计算
|
|
*
|
|
* @param dto
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param list
|
|
* @return
|
|
*/
|
|
public List<Product> getLszPrice(Product dto, double width, double length, int count, List<Product> list) {
|
|
double price = 0, dj = 0, area = 0;
|
|
String craft[] = dto.getCraft();
|
|
int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
|
|
for (int i = 0; i < lszCountArr.length; i++) {
|
|
Product pro = new Product();
|
|
if (lszCountArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
if ((width <= 6.8 && length <= 3) || (width <= 6.8 && length <= 3)) {
|
|
if ("直角".equals(craft[0])) {
|
|
dj = 14.5;
|
|
} else {
|
|
dj = 36.5;
|
|
}
|
|
} else if ((width <= 9 && length <= 5) || (width <= 9 && length <= 5)) {
|
|
if ("直角".equals(craft[0])) {
|
|
dj = 14.5;
|
|
} else {
|
|
dj = 36.5;
|
|
}
|
|
} else if ((width <= 10 && length <= 14) || (width <= 14 && length <= 10)) {
|
|
if ("直角".equals(craft[0])) {
|
|
dj = 11.5;
|
|
} else {
|
|
dj = 17.5;
|
|
}
|
|
} else if ((width <= 21 && length <= 14) || (width <= 14 && length <= 21)) {
|
|
if ("直角".equals(craft[0])) {
|
|
dj = 9.6;
|
|
} else {
|
|
dj = 12.1;
|
|
}
|
|
} else if ((width <= 21 && length <= 28.5) || (width <= 28.5 && length <= 21)) {
|
|
if ("直角".equals(craft[0])) {
|
|
dj = 7.6;
|
|
} else {
|
|
dj = 11.1;
|
|
}
|
|
} else {
|
|
if ("直角".equals(craft[0])) {
|
|
dj = 7.2;
|
|
} else {
|
|
dj = 10.7;
|
|
}
|
|
}
|
|
|
|
dj *= 2;//按照供应商成本价2倍计算
|
|
if (lszCountArr[i] == 500) {
|
|
area = width * length * 800 / 10000;
|
|
} else {
|
|
area = width * length * lszCountArr[i] / 10000;
|
|
if ((width >= 21 && length >= 28.5) || (width >= 28.5 && length >= 21)) {
|
|
area *= 0.85;
|
|
}
|
|
}
|
|
|
|
price = Math.ceil(dj * area);
|
|
pro.setPrice(price > 80 ? price : 80);
|
|
|
|
//烫金工艺
|
|
if ("烫金".equals(dto.getCraftTang())) {
|
|
area = length * width / 10000;
|
|
double tangPrice = 0;
|
|
double tangPriceArr[] = new double[4];
|
|
if (area <= 0.005) {
|
|
tangPriceArr = new double[]{90.0, 135.0, 205.0, 255.0, 425, 850, 1700};
|
|
} else if (area <= 0.01) {
|
|
tangPriceArr = new double[]{95.0, 140.0, 225.0, 300.0, 500, 1000, 2000};
|
|
} else if (area <= 0.015) {
|
|
tangPriceArr = new double[]{100.0, 145.0, 245.0, 325.0, 545, 1090, 2180};
|
|
} else if (area <= 0.025) {
|
|
tangPriceArr = new double[]{115.0, 165.0, 280.0, 380.0, 635, 1270, 2540};
|
|
} else if (area <= 0.035) {
|
|
tangPriceArr = new double[]{135.0, 205.0, 335.0, 468.0, 780, 1560, 3120};
|
|
} else {
|
|
tangPriceArr = new double[]{145.0, 225.0, 380.0, 535.0, 895, 1790, 3580};
|
|
}
|
|
|
|
tangPrice = tangPriceArr[i] * 1.4 > 135 ? tangPriceArr[i] * 1.4 : 135;
|
|
pro.setPrice(Math.ceil(pro.getPrice() + tangPrice));
|
|
}
|
|
pro.setCount(lszCountArr[i]);
|
|
list.add(pro);
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 80克硫酸纸价格计算
|
|
*
|
|
* @param dto
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param list
|
|
* @return
|
|
*/
|
|
public List<Product> get80LszPrice(Product dto, double width, double length, int count, List<Product> list) {
|
|
double dj = 0;
|
|
double l = 420;
|
|
double w = 285;
|
|
length *= 10;
|
|
width *= 10;
|
|
Product pro = new Product();
|
|
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 (count <= 1000) {
|
|
// dj = 150;
|
|
// } else {
|
|
// dj = 150 + Math.ceil(count / 1000) * 20;
|
|
// }
|
|
if (dto.getKindValue().equals("2")) {
|
|
dj = 0.86;
|
|
} else {
|
|
dj = 0.5;
|
|
}
|
|
pro.setPrice(130 + Math.ceil((num + 100) * dj));
|
|
double area = 0;
|
|
if ("烫金".equals(dto.getCraftTang())) {
|
|
int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
|
|
int i = 0;
|
|
for (int j = 0; j < lszCountArr.length; j++) {
|
|
if (lszCountArr[i] > count) {
|
|
break;
|
|
}
|
|
i = j;
|
|
}
|
|
area = length * width / 10000;
|
|
double tangPrice = 0;
|
|
double tangPriceArr[] = new double[4];
|
|
if (area <= 0.005) {
|
|
tangPriceArr = new double[]{135, 189, 287, 357, 595, 1190, 2380};
|
|
} else if (area <= 0.01) {
|
|
tangPriceArr = new double[]{135, 196, 315, 420, 700, 1400, 2800};
|
|
} else if (area <= 0.015) {
|
|
tangPriceArr = new double[]{140, 203, 343, 455, 763, 1526, 3052};
|
|
} else if (area <= 0.025) {
|
|
tangPriceArr = new double[]{161, 231, 392, 532, 889, 1778, 3556};
|
|
} else if (area <= 0.035) {
|
|
tangPriceArr = new double[]{189, 287, 469, 655.2, 1092, 2184, 4368};
|
|
} else {
|
|
tangPriceArr = new double[]{203, 315, 532, 749, 1253, 2506, 5012};
|
|
}
|
|
|
|
tangPrice = tangPriceArr[i] * 1.4 > 135 ? tangPriceArr[i] * 1.4 : 135;
|
|
pro.setPrice(Math.ceil(pro.getPrice() + tangPrice));
|
|
}
|
|
pro.setCount(count);
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 常规刚古水纹超白不干胶计算
|
|
*
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @return
|
|
*/
|
|
public List<Product> getGgSwPrice(double length, double width, int count, int number) {
|
|
double price = 0, area = 0;
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = null;
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count || list.size() > 3) {
|
|
continue;
|
|
}
|
|
pro = new Product();
|
|
area = (length * width * countArr[i]) / 10000;
|
|
price = 70 * area * number;
|
|
pro.setPrice(Math.ceil(price > 80 ? price : 80));
|
|
pro.setCount(countArr[i]);
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 帆布计算
|
|
*
|
|
* @param dto
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param list
|
|
* @return
|
|
*/
|
|
public List<Product> getFbPrice(Product dto, Integer number, Double width, Double length, int count, List<Product> list) {
|
|
Product pro = new Product();
|
|
double price = 0, dj = 0;
|
|
String[] craft = dto.getCraft();
|
|
if (dto.getStickerKind().equals("套餐")) {
|
|
pro.setCount(count);
|
|
pro.setPrice(198.0);
|
|
list.add(pro);
|
|
} else {
|
|
|
|
double area = length * width * count / 10000;
|
|
double d = length * width * count / 10000;
|
|
if (length == 100 && width == 45) {
|
|
price = 40 * number * count;
|
|
if (craft != null) {
|
|
for (int i = 0; i < craft.length; i++) {
|
|
if (craft[i].equals("缝兜")) {
|
|
price += number * 10;
|
|
} else {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
pro.setCount(count);
|
|
pro.setPrice(price);
|
|
list.add(pro);
|
|
}/*else if(length == 45 && width == 45){
|
|
price = 30 * number * count;
|
|
if(craft != null) {
|
|
for(int i = 0; i< craft.length; i++) {
|
|
if(craft[i].equals("缝兜")) {
|
|
price += number * 10;
|
|
}else {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
pro.setPrice(price);
|
|
}*/ else {
|
|
if (d <= 0.2) {
|
|
area *= number;
|
|
}
|
|
|
|
if (area <= 0.2) {
|
|
price = 45;
|
|
} else if (area <= 0.5) {
|
|
dj = 80;
|
|
} else if (area <= 0.7) {
|
|
dj = 75;
|
|
} else if (area <= 0.9) {
|
|
dj = 70;
|
|
} else if (area <= 1) {
|
|
dj = 68;
|
|
} else if (area <= 1.9) {
|
|
dj = 65;
|
|
} else if (area <= 3) {
|
|
dj = 60;
|
|
} else {
|
|
dj = 55;
|
|
}
|
|
|
|
if (d > 0.2) {
|
|
price = area * dj * number;
|
|
} else {
|
|
if (area <= 0.2) {
|
|
price = 45;
|
|
} else {
|
|
price = area * dj;
|
|
}
|
|
}
|
|
|
|
if (craft != null) {
|
|
for (int i = 0; i < craft.length; i++) {
|
|
if (craft[i].equals("缝兜")) {
|
|
price += number * 10;
|
|
} else {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*if(d > 3 && number > 1) {
|
|
price += (number-1) * 20;
|
|
}*/
|
|
|
|
price = Math.ceil(price > 45 ? price : 45);
|
|
|
|
double other_price = 0;
|
|
if (length * width < 40 * 50) {
|
|
int total = count * number;
|
|
for (int i = 1; i <= total; i++) {
|
|
other_price = getFBPirce(width, length, i, 1);
|
|
if (other_price > 45) {
|
|
price = 45 + (total - i + 1) * 6;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
pro.setPrice(price);
|
|
pro.setCount(count);
|
|
pro.setWeight(df.format(area * 0.28 * number));
|
|
list.add(pro);
|
|
}
|
|
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public double getFBPirce(double length, double width, int count, int number) {
|
|
double area = length * width * count / 10000;
|
|
double d = length * width * count / 10000;
|
|
double price = 0, dj = 0;
|
|
if (length == 100 && width == 45) {
|
|
price = 40 * number * count;
|
|
} else {
|
|
if (d <= 0.2) {
|
|
area *= number;
|
|
}
|
|
|
|
if (area <= 0.2) {
|
|
price = 45;
|
|
} else if (area <= 0.5) {
|
|
dj = 80;
|
|
} else if (area <= 0.7) {
|
|
dj = 75;
|
|
} else if (area <= 0.9) {
|
|
dj = 70;
|
|
} else if (area <= 1) {
|
|
dj = 68;
|
|
} else if (area <= 1.9) {
|
|
dj = 65;
|
|
} else if (area <= 3) {
|
|
dj = 60;
|
|
} else {
|
|
dj = 55;
|
|
}
|
|
|
|
if (d > 0.2) {
|
|
price = area * dj * number;
|
|
} else {
|
|
if (area <= 0.2) {
|
|
price = 45;
|
|
} else {
|
|
price = area * dj;
|
|
}
|
|
}
|
|
|
|
price = Math.ceil(price > 45 ? price : 45);
|
|
}
|
|
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));
|
|
}
|
|
|
|
/**
|
|
* 亚克力计算
|
|
*
|
|
* @param dto
|
|
* @param number
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param list
|
|
* @return
|
|
*/
|
|
public List<Product> getYklPrice(Product dto, Integer number, Double width, Double length, int count, List<
|
|
Product> list) {
|
|
Product pro = new Product();
|
|
double price = 0, dj = 0;
|
|
double l = 1200;
|
|
double w = 2400;
|
|
double area = length * width * count / 10000;
|
|
String kind = dto.getKind2Value();
|
|
length = length * 10;
|
|
width = width * 10;
|
|
if ((length > l || width > w) && (length > w || width > l))
|
|
return null;
|
|
// 一张大纸能做多少个此类尺寸的不干胶
|
|
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 (num > 1) {
|
|
if (kind.equals("1")) {
|
|
dj = 317;
|
|
} else if (kind.equals("2")) {
|
|
dj = 357;
|
|
} else if (kind.equals("3")) {
|
|
dj = 477;
|
|
} else if (kind.equals("4")) {
|
|
dj = 375;
|
|
} else {
|
|
dj = 415;
|
|
}
|
|
|
|
price = dj * 1.8 + dj * 1.5 * (num - 1);
|
|
pro.setPrice(Math.ceil(price));
|
|
} else {
|
|
if (area <= 0.02) {
|
|
dj = 1800;
|
|
} else if (area <= 0.03) {
|
|
dj = 1300;
|
|
} else if (area <= 0.05) {
|
|
dj = 1000;
|
|
} else if (area <= 0.06) {
|
|
dj = 900;
|
|
} else if (area <= 0.07) {
|
|
dj = 800;
|
|
} else if (area <= 0.08) {
|
|
dj = 700;
|
|
} else if (area <= 0.16) {
|
|
dj = 650;
|
|
} else if (area <= 0.25) {
|
|
dj = 550;
|
|
} else if (area <= 0.4) {
|
|
dj = 500;
|
|
} else if (area <= 0.5) {
|
|
dj = 400;
|
|
} else if (area <= 0.6) {
|
|
dj = 350;
|
|
} else if (area <= 0.8) {
|
|
dj = 300;
|
|
} else if (area <= 1) {
|
|
dj = 280;
|
|
} else if (area <= 2) {
|
|
dj = 250;
|
|
} else if (area <= 3) {
|
|
dj = 240;
|
|
} else if (area <= 4) {
|
|
dj = 230;
|
|
} else if (area <= 5) {
|
|
dj = 225;
|
|
}
|
|
|
|
price = area * dj * 2.5;
|
|
if (kind.equals("5")) {
|
|
price = price * 1.2;
|
|
} else {
|
|
if (kind.equals("2")) {
|
|
price = price * 1.1;
|
|
} else if (kind.equals("3")) {
|
|
price = price * 1.3;
|
|
}
|
|
}
|
|
}
|
|
double weight = 0;
|
|
if (kind.equals("1") || kind.equals("4")) {
|
|
weight = area * number * 2.26;
|
|
} else if (kind.equals("2") || kind.equals("5")) {
|
|
weight = area * number * 3.06;
|
|
} else if (kind.equals("3")) {
|
|
weight = area * number * 5.11;
|
|
}
|
|
pro.setPrice(Math.ceil(price > 50 ? price : 50));
|
|
pro.setCount(count);
|
|
pro.setWeight(String.valueOf(df.format(weight)));
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 灯布计算
|
|
*
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param list
|
|
* @return
|
|
*/
|
|
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 / 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 + 15;
|
|
|
|
} else if ("12".equals(kind)) {
|
|
areas = new double[]{5, 10,};
|
|
prices = new double[]{16, 12};
|
|
last_price = 10;
|
|
min_price = 50 + 15;
|
|
|
|
} else {
|
|
areas = new double[]{5, 10,};
|
|
prices = new double[]{24, 20};
|
|
last_price = 18;
|
|
min_price = 60 + 15;
|
|
|
|
}
|
|
|
|
// if (width * length < 40 * 50) {
|
|
// price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
|
|
// } else {
|
|
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.setCount(count);
|
|
list.add(pro);
|
|
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 串旗计算
|
|
*
|
|
* @param width
|
|
* @param length
|
|
* @param count
|
|
* @param num
|
|
* @param list
|
|
* @return
|
|
*/
|
|
public List<Product> getCqPrice(Double width, Double length, int count, int num, List<Product> list) {
|
|
Product pro = new Product();
|
|
double price = 0, dj = 0;
|
|
double area = (width * length) / 10000;
|
|
if (area <= 0.042) {
|
|
price = 50 + 5 * count * num;
|
|
} else if (area <= 0.1125) {
|
|
dj = 120;
|
|
} else if (area <= 0.2) {
|
|
dj = 110;
|
|
} else if (area <= 0.5) {
|
|
dj = 100;
|
|
} else if (area <= 0.7) {
|
|
dj = 95;
|
|
} else if (area <= 0.9) {
|
|
dj = 90;
|
|
} else if (area <= 1) {
|
|
dj = 85;
|
|
} else {
|
|
dj = 80;
|
|
}
|
|
|
|
if (area > 0.042) {
|
|
price = dj * area * count * num;
|
|
}
|
|
|
|
price = Math.ceil(price > 50 ? price : 50);
|
|
double wei = area * 0.29 * count * num;
|
|
pro.setPrice(price);
|
|
pro.setCount(count);
|
|
pro.setWeight(df.format(wei));
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 桌布
|
|
*
|
|
* @param length
|
|
* @param width
|
|
* @param count
|
|
* @param number
|
|
* @return
|
|
*/
|
|
public List<Product> getTableClothPrice(Double length, Double width, int count, Integer
|
|
number, List<Product> priceList) {
|
|
double price = 0, dj = 0;
|
|
if (length <= 0.8 && width <= 0.8) {
|
|
dj = 77;
|
|
} else if ((length <= 0.8 && width <= 1.6) || (length <= 1.6 && width <= 0.8)) {
|
|
dj = 43;
|
|
} else if ((length <= 1.2 && width <= 1.6) || (length <= 1.6 && width <= 1.2)) {
|
|
dj = 29;
|
|
} else if ((length <= 1.4 && width <= 1.6) || (length <= 1.6 && width <= 1.4)) {
|
|
dj = 28;
|
|
} else if ((length <= 1.6 && width <= 2.0) || (length <= 2.0 && width <= 1.6)) {
|
|
dj = 27;
|
|
}/*else if((length <= 1.8 && width <= 2.0) || (length <= 2.0 && width <= 1.8)) {
|
|
dj = 26;
|
|
}else if((length <= 1.6 && width <= 2.5) || (length <= 2.5 && width <= 1.6)) {
|
|
dj = 26;
|
|
}*/ else {
|
|
dj = 26;
|
|
}
|
|
Product pro = new Product();
|
|
List<Product> list = new ArrayList<Product>();
|
|
price = length * width * count * number * dj;
|
|
pro.setCount(count);
|
|
pro.setPrice(Math.ceil(price > 50 ? price : 50));
|
|
pro.setWeight(df.format(0.3 * length * width * count * number));
|
|
list.add(pro);
|
|
return list;
|
|
}
|
|
|
|
public List<Product> getShkPrice(String size, int count, Integer number) {
|
|
int[] countArr = {200, 500, 1000, 2000, 5000, 10000};
|
|
double[] priceArr = {};
|
|
List<Product> list = new ArrayList<Product>();
|
|
Product pro = new Product();
|
|
if (size.equals("9*5.4")) {
|
|
priceArr = new double[]{25.0, 26.0, 27.0, 50.0, 110.0, 200.0};
|
|
} else if (size.equals("9*11")) {
|
|
priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
|
|
} else if (size.equals("8*11")) {
|
|
priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
|
|
} else if (size.equals("7*14")) {
|
|
priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
|
|
} else if (size.equals("8*14")) {
|
|
priceArr = new double[]{44.0, 46.0, 72.0, 120.0, 260.0, 500.0};
|
|
} else if (size.equals("10*15")) {
|
|
priceArr = new double[]{44.0, 66.0, 88.0, 150.0, 350.0, 600.0};
|
|
} else if (size.equals("11*18")) {
|
|
priceArr = new double[]{61.0, 83.0, 94.0, 160.0, 400.0, 650.0};
|
|
} else if (size.equals("9*9")) {
|
|
priceArr = new double[]{30.0, 41.0, 44.0, 75.0, 200.0, 400.0};
|
|
} else {
|
|
priceArr = new double[]{44.0, 66.0, 88.0, 120.0, 260.0, 500.0};
|
|
}
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
|
|
if (list.size() > 3) {
|
|
break;
|
|
}
|
|
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
|
|
pro.setPrice(Math.ceil(number * priceArr[i]));
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public List<Product> getSdkPrice(int count, Integer number) {
|
|
int[] countArr = {50, 100, 500, 1000, 2000, 5000, 10000};
|
|
double[] priceArr = new double[]{339, 599, 1800.0, 3000.0, 4800.0, 8000.0, 15000.0};
|
|
Product pro = new Product();
|
|
List<Product> list = new ArrayList<Product>();
|
|
for (int i = 0; i < countArr.length; i++) {
|
|
if (countArr[i] < count) {
|
|
continue;
|
|
}
|
|
|
|
if (list.size() > 3) {
|
|
break;
|
|
}
|
|
pro = new Product();
|
|
pro.setCount(countArr[i]);
|
|
|
|
pro.setPrice(Math.ceil(number * priceArr[i]));
|
|
list.add(pro);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public double TablePrice(double area, int[] price_list, double[] areas) {
|
|
double price = 0;
|
|
int startIndex = 0;
|
|
int endIndex = 0;
|
|
for (int i = 0; i < areas.length; i++) {
|
|
if (area > areas[i]) {
|
|
startIndex = endIndex;
|
|
endIndex = Math.min(i + 1, areas.length - 1);
|
|
}
|
|
}
|
|
if (startIndex == endIndex) {
|
|
price = (price_list[endIndex] / areas[endIndex]) * area;
|
|
} else {
|
|
price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
|
|
}
|
|
return price;
|
|
}
|
|
|
|
public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum) {
|
|
if (craft_list.contains("烫画")) {
|
|
return (int) count * 120;
|
|
}
|
|
double price = 0;
|
|
if (craft_list.contains("冷转印")) {
|
|
if (countNum == 1) {
|
|
price = 260 * Math.ceil(count / countNum) + (coNumber - 1) * 100;
|
|
|
|
} else {
|
|
if (count <= 5) {
|
|
price = 260;
|
|
} else if (count < 100) {
|
|
price = 14 * count + 200;
|
|
} else {
|
|
price = 12 * count;
|
|
}
|
|
price = price + (coNumber - 1) * 100;
|
|
}
|
|
}
|
|
|
|
return price;
|
|
}
|
|
}
|