|
|
@@ -790,77 +790,64 @@ public class ProductService {
|
|
|
return priceList;
|
|
|
}
|
|
|
int min = getNum(length, width);
|
|
|
- if ("1".equals(dto.getKind()) && "2".equals(dto.getKindValue())) {
|
|
|
- double l1 = Math.ceil(length / 21);
|
|
|
- double w1 = Math.ceil(width / 28.5);
|
|
|
- double l2 = Math.ceil(width / 21);
|
|
|
- double w2 = Math.ceil(length / 28.5);
|
|
|
- //min = (int) Math.min(l1 * w1, l2 * w2);
|
|
|
+ String[] kind_list = {"3", "4", "5", "7"};
|
|
|
+ priceList = getHekaPrice(min, dto, priceList, count);
|
|
|
|
|
|
- int[][] prices = {
|
|
|
- {245, 580, 798, 1100, 1425},
|
|
|
- {420, 965, 1315, 1850, 2400},
|
|
|
- {780, 1768, 2390, 3255, 4350},
|
|
|
- {1120, 2572, 3450, 4726, 6330},
|
|
|
- {1465, 3336, 4480, 6138, 8190},
|
|
|
- {1810, 4100, 5510, 7550, 10050},
|
|
|
- {2149, 4872, 6538, 8892, 11860},
|
|
|
- {2488, 5644, 7566, 10234, 13670},
|
|
|
- {2827, 6416, 8594, 11576, 15480},
|
|
|
- {3166, 7188, 9622, 12918, 17290},
|
|
|
- {3505, 7960, 10650, 14260, 19100}
|
|
|
+ if (Arrays.asList(kind_list).contains(dto.getKind()) && "2".equals(dto.getKindValue2())) {
|
|
|
+ if (dto.getCraft() != null && Arrays.asList(dto.getCraft()).contains("模切")) {
|
|
|
+ priceList = getOtherHekaPrice(dto, width, length);
|
|
|
+ for (int i = 0; i < dto.getCraft().length; i++) {
|
|
|
+ if ("模切".equals(dto.getCraft()[i])) {
|
|
|
+ dto.getCraft()[i] = "";
|
|
|
+ }
|
|
|
+ if ("双面覆哑膜".equals(dto.getCraft()[i])) {
|
|
|
+ dto.getCraft()[i] = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double moqiePrice = 0;
|
|
|
+
|
|
|
+ //腰封价格加上模板费
|
|
|
+ if ("1".equals(dto.getKind())) {
|
|
|
+ double[][] CATEGORIES = {
|
|
|
+ {105, 140}, // 第一档
|
|
|
+ {140, 210}, // 第二档
|
|
|
+ {210, 285}, // 第三档
|
|
|
+ {285, 420}, // 第四档选项1
|
|
|
+ {210, 570}, // 第四档选项2
|
|
|
+ {420, 580}, // 第五档选项1
|
|
|
+ {285, 840}, // 第五档选项2
|
|
|
+ {580, 880} // 第六档
|
|
|
};
|
|
|
- int[][] other_prices = {
|
|
|
- {335, 218, 302, 325, 1425},
|
|
|
- {545, 350, 535, 550, 2400},
|
|
|
- {988, 622, 865, 1095, 4350},
|
|
|
- {1452, 878, 1276, 1604, 6330},
|
|
|
- {1871, 1144, 1658, 2052, 8190},
|
|
|
- {2290, 1410, 2040, 2500, 10050},
|
|
|
- {2723, 1666, 2354, 2968, 11860},
|
|
|
- {3156, 1922, 2668, 3436, 13670},
|
|
|
- {3589, 2178, 2982, 3904, 15480},
|
|
|
- {4022, 2434, 3296, 4372, 17290},
|
|
|
- {4455, 2690, 3610, 4840, 19100}
|
|
|
+ int[] CATEGORY_PRICE = {
|
|
|
+ 80, 90, 100, 130, 130, 170, 170, 330
|
|
|
};
|
|
|
- int[] count_list = {500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000};
|
|
|
- area = width * length;
|
|
|
- for (int i = 0; i < count_list.length; i++) {
|
|
|
- int item_count = count_list[i];
|
|
|
- if (count > item_count) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (priceList.size() > 2) {
|
|
|
+ int mu_price = 330;
|
|
|
+ double min_width = Math.min(width * 10 + 4, length * 10 + 4);
|
|
|
+ double max_width = Math.max(width * 10 + 4, length * 10 + 4);
|
|
|
+ for (int i = 0; i < CATEGORIES.length; i++) {
|
|
|
+ double categoryMin = CATEGORIES[i][0];
|
|
|
+ double categoryMax = CATEGORIES[i][1];
|
|
|
+
|
|
|
+ // 比较尺寸(考虑浮点数精度问题)
|
|
|
+ if (min_width < categoryMin && max_width <= categoryMax) {
|
|
|
+ mu_price = CATEGORY_PRICE[i];
|
|
|
break;
|
|
|
}
|
|
|
- int count_index = Arrays.binarySearch(count_list, item_count);
|
|
|
- int[] prices_list = prices[count_index];
|
|
|
- int[] other_prices_list = other_prices[count_index];
|
|
|
-
|
|
|
- double price = 0;
|
|
|
- if (min >= 6) {
|
|
|
- price = Math.ceil(prices_list[0] * min + (prices_list[0] * area / (598.5 * min)));
|
|
|
- } else {
|
|
|
- price = Math.ceil(prices_list[min - 1] + (other_prices_list[min - 1] * area / (598.5 * min)));
|
|
|
- }
|
|
|
- double carft_price = 0;
|
|
|
- if (craft_list.contains("模切")) {
|
|
|
- carft_price += Math.max(item_count * 0.06, 100);
|
|
|
- }
|
|
|
- if (craft_list.contains("糊成品")) {
|
|
|
- carft_price += item_count * 0.1;
|
|
|
- }
|
|
|
- if (craft_list.contains("糊半成品")) {
|
|
|
- carft_price += item_count * 0.15;
|
|
|
+ }
|
|
|
+ if (dto.getCraft() != null && Arrays.asList(dto.getCraft()).contains("模切")) {
|
|
|
+ for (int i = 0; i < dto.getCraft().length; i++) {
|
|
|
+ if ("模切".equals(dto.getCraft()[i])) {
|
|
|
+ dto.getCraft()[i] = "";
|
|
|
+ }
|
|
|
}
|
|
|
- Product product = new Product();
|
|
|
- product.setCount(item_count);
|
|
|
- product.setPrice(Math.ceil((price + carft_price) * number));
|
|
|
-// priceList.add(product);
|
|
|
+ moqiePrice = 0.06;
|
|
|
+ }
|
|
|
+ for (Product product : priceList) {
|
|
|
+ product.setPrice(product.getPrice() + mu_price);
|
|
|
}
|
|
|
-// return priceList;
|
|
|
}
|
|
|
- priceList = getHekaPrice(min, dto, priceList, count);
|
|
|
//四个位拼多多价格调整
|
|
|
if (role.indexOf("1045") > -1 && min == 4) {
|
|
|
for (Product product : priceList) {
|
|
|
@@ -916,6 +903,9 @@ public class ProductService {
|
|
|
if (craft_list.contains("配弹力绳捆")) {
|
|
|
carft_price += 10 * Math.ceil(product.getCount() * 20.0 / 5000);
|
|
|
}
|
|
|
+ if (craft_list.contains("配棉绳")) {
|
|
|
+ carft_price += Math.max(Math.ceil(product.getCount() * 0.015), 15);
|
|
|
+ }
|
|
|
if (craft_list.contains("opp袋")) {
|
|
|
double carft_base_price = 0;
|
|
|
if ("8*5".equals(dto.getToothpick_size())) {
|
|
|
@@ -938,7 +928,8 @@ public class ProductService {
|
|
|
}
|
|
|
carft_price += carft_base_price * Math.ceil(product.getCount() / 1000.0);
|
|
|
}
|
|
|
- product.setPrice(Math.floor((product.getPrice() + carft_price) * number));
|
|
|
+ //腰封的模切费单独计算
|
|
|
+ product.setPrice(Math.ceil((product.getPrice() + carft_price) * number + Math.max(Math.ceil(moqiePrice * product.getCount() * number), moqiePrice > 0 ? 55 : 0)));
|
|
|
product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
|
|
|
}
|
|
|
|
|
|
@@ -1056,13 +1047,16 @@ public class ProductService {
|
|
|
getCraft(product1, priceList, length * 10, width * 10, min);
|
|
|
for (Product product : priceList) {
|
|
|
if ("击凸".equals(dto.getAotu()) || "压凹".equals(dto.getAotu())) {
|
|
|
- product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
|
|
|
+ product.setPrice(Math.ceil(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
|
|
|
}
|
|
|
if (craft.contains("弹力绳")) {
|
|
|
- product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
|
|
|
+ product.setPrice(Math.ceil(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
|
|
|
}
|
|
|
if (craft.contains("弹力绳捆")) {
|
|
|
- product.setPrice(Math.floor(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10));
|
|
|
+ product.setPrice(Math.ceil(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10));
|
|
|
+ }
|
|
|
+ if (craft.contains("配棉绳")) {
|
|
|
+ product.setPrice(Math.ceil(product.getPrice() + Math.max(Math.ceil(product.getCount() * 0.015), 15)));
|
|
|
}
|
|
|
}
|
|
|
// 根据款数重新算价格/计算重量
|
|
|
@@ -3033,10 +3027,13 @@ public class ProductService {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (count <= 10000)
|
|
|
+ if (count <= 10000) {
|
|
|
priceList = productMapper.getThanPrice(dto);
|
|
|
- else
|
|
|
+ } else {
|
|
|
+
|
|
|
priceList = productMapper.thanThousandPrice(dto);
|
|
|
+ }
|
|
|
+
|
|
|
// 数据库中是(成本价),需要*利润
|
|
|
for (Product product : priceList) {
|
|
|
if (product.getCount() <= 1000) {
|
|
|
@@ -3407,10 +3404,11 @@ public class ProductService {
|
|
|
dto.setKind1Value("2");
|
|
|
}
|
|
|
|
|
|
- if (count <= 10000)
|
|
|
+ if (count <= 10000) {
|
|
|
priceList = productMapper.getThanPrice(dto);
|
|
|
- else
|
|
|
+ } else {
|
|
|
priceList = productMapper.notePaperPrice(dto);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (priceList.size() >= 4) {
|
|
|
@@ -3560,10 +3558,11 @@ public class ProductService {
|
|
|
return priceList;
|
|
|
// 透明PVC名片
|
|
|
case "21":
|
|
|
- if (count <= 10000)
|
|
|
+ if (count <= 10000) {
|
|
|
priceList = productMapper.getThanPrice(dto);
|
|
|
- else
|
|
|
+ } else {
|
|
|
priceList = productMapper.thanThousandPrice(dto);
|
|
|
+ }
|
|
|
|
|
|
if (priceList.size() >= 4) {
|
|
|
priceList = priceList.subList(0, 4);
|
|
|
@@ -3793,10 +3792,11 @@ public class ProductService {
|
|
|
int min = getNum(length, width);
|
|
|
// 根据位数算价格(最多4个位)
|
|
|
dto.setKind2Value(String.valueOf(min));
|
|
|
- if (count <= 10000)
|
|
|
+ if (count <= 10000) {
|
|
|
priceList = productMapper.getThanPrice(dto);
|
|
|
- else
|
|
|
+ } else {
|
|
|
priceList = productMapper.thanThousandPrice(dto);
|
|
|
+ }
|
|
|
// 产品价格倍数
|
|
|
for (Product product : priceList) {
|
|
|
product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
|
|
|
@@ -3848,8 +3848,9 @@ public class ProductService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (count <= 10000)
|
|
|
+ if (count <= 10000) {
|
|
|
priceList = productMapper.getThanPrice(dto);
|
|
|
+ }
|
|
|
// 加工艺的价格 --有覆膜,带尺寸过去(毫米)
|
|
|
/*getCraft(dto, priceList, null, null, 0);*/
|
|
|
// 根据款数重新算价格
|
|
|
@@ -4683,6 +4684,22 @@ public class ProductService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ private List<Product> getOtherHekaPrice(Product dto, double length, double width) {
|
|
|
+ int[][] prices = {
|
|
|
+ {79, 79, 79, 79, 79, 79, 79, 79, 79, 91, 92, 92, 95, 96, 135, 139, 152, 186, 340, 345, 435, 450},
|
|
|
+ {97, 97, 97, 97, 97, 97, 97, 97, 97, 114, 115, 116, 118, 125, 162, 162, 185, 194, 358, 363, 459, 465},
|
|
|
+ {153, 153, 153, 153, 153, 153, 153, 153, 153, 169, 171, 172, 175, 180, 251, 256, 286, 291, 480, 490, 620, 635},
|
|
|
+ {250, 250, 250, 250, 250, 250, 250, 250, 250, 266, 273, 275, 278, 280, 360, 370, 429, 442, 640, 655, 825, 877},
|
|
|
+ {370, 370, 370, 370, 370, 370, 370, 370, 370, 371, 372, 373, 375, 378, 500, 515, 545, 632, 800, 886, 1030, 1240},
|
|
|
+ {510, 510, 510, 510, 510, 510, 510, 510, 510, 589, 600, 605, 610, 615, 800, 820, 932, 1022, 1160, 1458, 1488, 2000},
|
|
|
+ {945, 945, 945, 945, 945, 945, 945, 945, 945, 1030, 1040, 1045, 1050, 1055, 1440, 1460, 1798, 2202, 2400, 2950, 3012, 4000},
|
|
|
+ };
|
|
|
+ int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};
|
|
|
+ double[] areas = {4, 16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 172.8, 194.4, 224, 288, 294, 400};
|
|
|
+ //款数在外面处理
|
|
|
+ return getAreaCenterPrice(count_list, dto.getCount(), length * width, prices, areas, 1);
|
|
|
+ }
|
|
|
+
|
|
|
private List<Product> getPETPrice(Product dto, double length, double width) {
|
|
|
int[][] prices = new int[][]{
|
|
|
{136, 163, 177, 190, 197, 227, 257, 303, 333, 407, 430},
|