新增产品
This commit is contained in:
@@ -103,7 +103,9 @@ public class ProductController {
|
||||
product.setRole(user.getRole());
|
||||
|
||||
if ("菜单".equals(product.getProTypeLabel())) {
|
||||
product.setSize(product.getSize1().replace(",", ""));
|
||||
if (product.getSize1() != null) {
|
||||
product.setSize(product.getSize1().replace(",", ""));
|
||||
}
|
||||
String s = request.getParameter("kindValue5");
|
||||
product.setKind1Value(s);
|
||||
product.setSize(request.getParameter("ui_menu_size"));
|
||||
|
||||
@@ -4623,70 +4623,140 @@ public class ProductService {
|
||||
}
|
||||
return priceList;
|
||||
case "透卡":
|
||||
|
||||
return getPETPrice(dto, width, length);
|
||||
case "澜达海报":
|
||||
//铜版纸200g (售价)
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 94, 94, 94, 94},
|
||||
{100, 100, 100, 100, 100, 187, 187, 187, 187},
|
||||
{140, 140, 140, 140, 140, 280, 280, 280, 280},
|
||||
{187, 187, 187, 187, 187, 374, 374, 374, 374},
|
||||
{234, 234, 234, 234, 234, 467, 467, 467, 467},
|
||||
{467, 467, 467, 467, 467, 934, 934, 934, 934},
|
||||
{934, 934, 934, 934, 934, 1867, 1867, 1867, 1867},
|
||||
{2334, 2334, 2334, 2334, 2334, 4667, 4667, 4667, 4667},
|
||||
{4667, 4667, 4667, 4667, 4667, 9334, 9334, 9334, 9334},
|
||||
{9334, 9334, 9334, 9334, 9334, 18667, 18667, 18667, 18667},
|
||||
{23334, 23334, 23334, 23334, 23334, 46667, 46667, 46667, 46667},
|
||||
};
|
||||
if ("2".equals(dto.getKind())) {
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 107, 107, 107, 107},
|
||||
{100, 107, 107, 107, 107, 213, 213, 213, 213},
|
||||
{120, 160, 160, 160, 160, 320, 320, 320, 320},
|
||||
{150, 213, 213, 213, 213, 427, 427, 427, 427},
|
||||
{139, 267, 267, 267, 267, 533, 533, 533, 533},
|
||||
{267, 533, 533, 533, 533, 1067, 1067, 1067, 1067},
|
||||
{533, 1067, 1067, 1067, 1067, 2133, 2133, 2133, 2133},
|
||||
{1333, 2667, 2667, 2667, 2667, 5333, 5333, 5333, 5333},
|
||||
{2667, 5333, 5333, 5333, 5333, 10667, 10667, 10667, 10667},
|
||||
{5333, 10667, 10667, 10667, 10667, 21333, 21333, 21333, 21333},
|
||||
{13333, 26667, 26667, 26667, 26667, 53333, 53333, 53333, 53333},
|
||||
};
|
||||
}
|
||||
if ("3".equals(dto.getKind())) {
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 150, 150, 150, 150},
|
||||
{100, 140, 140, 150, 150, 300, 300, 300, 300},
|
||||
{110, 207, 207, 223, 223, 447, 447, 447, 447},
|
||||
{140, 277, 277, 300, 300, 597, 597, 597, 597},
|
||||
{180, 347, 347, 373, 373, 747, 747, 747, 747},
|
||||
{347, 693, 693, 747, 747, 1493, 1493, 1493, 1493},
|
||||
{693, 1387, 1387, 1493, 1493, 2987, 2987, 2987, 2987},
|
||||
{1733, 3467, 3467, 3733, 3733, 7467, 7467, 7467, 7467},
|
||||
{3467, 6933, 6933, 7467, 7467, 14933, 14933, 14933, 14933},
|
||||
{6933, 13867, 13867, 14933, 14933, 29867, 29867, 29867, 29867},
|
||||
{17333, 34667, 34667, 37333, 37333, 74667, 74667, 74667, 74667},
|
||||
};
|
||||
}
|
||||
count_list = new int[]{10, 20, 30, 40, 50, 100, 200, 500, 1000, 2000, 5000};
|
||||
areas = new double[]{1197, 1716, 2394, 2596, 3430, 3467.1, 4788, 5192, 6860};
|
||||
area = length * width;
|
||||
|
||||
return getAreaCenterPrice(count_list, count, area, prices, areas, number);
|
||||
return getDalanPrice(dto, width, length);
|
||||
case "水标":
|
||||
return getShuibiaoPrice(dto, length, width);
|
||||
case "镭射吊牌":
|
||||
return getLeiseDiaoPrice(dto, length, width);
|
||||
case "刻字车贴":
|
||||
return getCheTiePrice(dto, length, width);
|
||||
case "胶带":
|
||||
return getJiadaoPrice(dto, length, width);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Product> getDalanPrice(Product dto, Double width, Double length) {
|
||||
//铜版纸200g (售价)
|
||||
int[][] prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 94, 94, 94, 94},
|
||||
{100, 100, 100, 100, 100, 187, 187, 187, 187},
|
||||
{140, 140, 140, 140, 140, 280, 280, 280, 280},
|
||||
{187, 187, 187, 187, 187, 374, 374, 374, 374},
|
||||
{234, 234, 234, 234, 234, 467, 467, 467, 467},
|
||||
{467, 467, 467, 467, 467, 934, 934, 934, 934},
|
||||
{934, 934, 934, 934, 934, 1867, 1867, 1867, 1867},
|
||||
{2334, 2334, 2334, 2334, 2334, 4667, 4667, 4667, 4667},
|
||||
{4667, 4667, 4667, 4667, 4667, 9334, 9334, 9334, 9334},
|
||||
{9334, 9334, 9334, 9334, 9334, 18667, 18667, 18667, 18667},
|
||||
{23334, 23334, 23334, 23334, 23334, 46667, 46667, 46667, 46667},
|
||||
};
|
||||
if ("2".equals(dto.getKind())) {
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 107, 107, 107, 107},
|
||||
{100, 107, 107, 107, 107, 213, 213, 213, 213},
|
||||
{120, 160, 160, 160, 160, 320, 320, 320, 320},
|
||||
{150, 213, 213, 213, 213, 427, 427, 427, 427},
|
||||
{139, 267, 267, 267, 267, 533, 533, 533, 533},
|
||||
{267, 533, 533, 533, 533, 1067, 1067, 1067, 1067},
|
||||
{533, 1067, 1067, 1067, 1067, 2133, 2133, 2133, 2133},
|
||||
{1333, 2667, 2667, 2667, 2667, 5333, 5333, 5333, 5333},
|
||||
{2667, 5333, 5333, 5333, 5333, 10667, 10667, 10667, 10667},
|
||||
{5333, 10667, 10667, 10667, 10667, 21333, 21333, 21333, 21333},
|
||||
{13333, 26667, 26667, 26667, 26667, 53333, 53333, 53333, 53333},
|
||||
};
|
||||
}
|
||||
if ("3".equals(dto.getKind())) {
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 150, 150, 150, 150},
|
||||
{100, 140, 140, 150, 150, 300, 300, 300, 300},
|
||||
{110, 207, 207, 223, 223, 447, 447, 447, 447},
|
||||
{140, 277, 277, 300, 300, 597, 597, 597, 597},
|
||||
{180, 347, 347, 373, 373, 747, 747, 747, 747},
|
||||
{347, 693, 693, 747, 747, 1493, 1493, 1493, 1493},
|
||||
{693, 1387, 1387, 1493, 1493, 2987, 2987, 2987, 2987},
|
||||
{1733, 3467, 3467, 3733, 3733, 7467, 7467, 7467, 7467},
|
||||
{3467, 6933, 6933, 7467, 7467, 14933, 14933, 14933, 14933},
|
||||
{6933, 13867, 13867, 14933, 14933, 29867, 29867, 29867, 29867},
|
||||
{17333, 34667, 34667, 37333, 37333, 74667, 74667, 74667, 74667},
|
||||
};
|
||||
}
|
||||
int[] count_list = new int[]{10, 20, 30, 40, 50, 100, 200, 500, 1000, 2000, 5000};
|
||||
double[] areas = new double[]{1197, 1716, 2394, 2596, 3430, 3467.1, 4788, 5192, 6860};
|
||||
double area = length * width;
|
||||
|
||||
return getAreaCenterPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
|
||||
}
|
||||
|
||||
private List<Product> getJiadaoPrice(Product dto, Double length, Double width) {
|
||||
double[][] prices = {
|
||||
{90, 148, 240, 550},
|
||||
{100, 160, 250, 550},
|
||||
{110, 175, 258, 550},
|
||||
{120, 180, 266, 595},
|
||||
{130, 203, 290, 648},
|
||||
};
|
||||
int[] count_list = new int[]{12, 20, 40, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
|
||||
double[] lengths = {1.2, 1.5, 1.8, 2, 2.4};
|
||||
if ("2".equals(dto.getKind())) {
|
||||
prices = new double[][]{
|
||||
{110, 236, 290, 587},
|
||||
{119, 240, 298, 587},
|
||||
{125, 240, 308, 587},
|
||||
{137, 240, 316, 630},
|
||||
{146, 254, 340, 681},
|
||||
};
|
||||
}
|
||||
if ("3".equals(dto.getKind())) {
|
||||
prices = new double[][]{
|
||||
{91, 158, 210, 234, 514},
|
||||
{91, 158, 210, 234, 514},
|
||||
{100, 168, 230, 242, 542},
|
||||
{100, 168, 230, 251, 550},
|
||||
{110, 175, 250, 275, 564},
|
||||
};
|
||||
count_list = new int[]{12, 20, 30, 40, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
|
||||
}
|
||||
List<Product> list = new ArrayList<>();
|
||||
double last_price = 0;
|
||||
int last_count = 0;
|
||||
int current_int = Arrays.binarySearch(lengths, length);
|
||||
double[] prices_list = prices[current_int];
|
||||
List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
double craft_price = 0;
|
||||
if (carftList.contains("切割机")) {
|
||||
craft_price = Math.ceil(dto.getStickNum() * 15);
|
||||
}
|
||||
for (int i = 0; i < count_list.length; i++) {
|
||||
double price = 0;
|
||||
|
||||
int item_count = count_list[i];
|
||||
if (i < prices_list.length) {
|
||||
price = last_price = prices_list[i];
|
||||
last_count = item_count;
|
||||
} else {
|
||||
price = last_price * Math.ceil(1.0 * item_count / last_count);
|
||||
}
|
||||
|
||||
if (item_count < dto.getCount()) {
|
||||
continue;
|
||||
}
|
||||
if (list.size() > 2) {
|
||||
break;
|
||||
}
|
||||
Product pro = new Product();
|
||||
pro.setCount(item_count);
|
||||
pro.setPrice(Math.ceil(price * dto.getNumber() + craft_price));
|
||||
list.add(pro);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
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},
|
||||
|
||||
Reference in New Issue
Block a user