新增包装纸
This commit is contained in:
@@ -4882,12 +4882,57 @@ public class ProductService {
|
||||
return getWallPaintingPrice(dto, width, length);
|
||||
case "电线胶":
|
||||
return getWireTapePrice(dto, width, length);
|
||||
case "包装纸":
|
||||
return getWrappingPaper(dto, width, length);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Product> getWrappingPaper(Product dto, Double width, Double length) {
|
||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
int count = dto.getCount();
|
||||
int number = dto.getNumber();
|
||||
int min_count = 5;
|
||||
int[] prices = {60, 100, 190, 500, 800};
|
||||
int[] counts = {5, 10, 20, 50, 100};
|
||||
if ("1".equals(dto.getKind()) && (width == 490 || length == 490)) {
|
||||
prices = new int[]{50, 80, 140, 300, 450};
|
||||
}
|
||||
if ("2".equals(dto.getKind())) {
|
||||
prices = new int[]{50, 80, 140, 300, 450};
|
||||
}
|
||||
if ("3".equals(dto.getKind())) {
|
||||
prices = new int[]{50, 80, 140, 300, 450};
|
||||
}
|
||||
double craft_price = 0;
|
||||
if (craft_list.contains("双面胶")) {
|
||||
craft_price += Math.max(dto.getMaxian(), 1) * 1.5;
|
||||
}
|
||||
if (craft_list.contains("丝带")) {
|
||||
craft_price += Math.max(dto.getPcount(), 1) * 1.5;
|
||||
}
|
||||
for (int i = 0; i < counts.length; i++) {
|
||||
int countItem = counts[i];
|
||||
if (count >= countItem) {
|
||||
continue;
|
||||
}
|
||||
if (priceList.size() > 2) {
|
||||
break;
|
||||
}
|
||||
Boolean isFirst = priceList.size() == 0;
|
||||
int base_price = prices[isFirst ? Math.max(i - 1, 0) : i];
|
||||
Product pro = new Product();
|
||||
pro.setCount(isFirst ? count : countItem);
|
||||
pro.setNumber(number);
|
||||
pro.setPrice(Math.ceil((double) base_price / counts[isFirst ? Math.max(i - 1, 0) : i] * Math.max(min_count, isFirst ? count : countItem) + craft_price));
|
||||
priceList.add(pro);
|
||||
}
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private List<Product> getWireTapePrice(Product dto, Double width, Double length) {
|
||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
@@ -5734,13 +5779,13 @@ public class ProductService {
|
||||
if ("2".equals(dto.getKind())) {
|
||||
max_width = 420;
|
||||
max_length = 310;
|
||||
base_price = 35;
|
||||
base_price = 45;
|
||||
min_price = 60;
|
||||
}
|
||||
if ("3".equals(dto.getKind())) {
|
||||
max_width = 420;
|
||||
max_length = 310;
|
||||
base_price = 40;
|
||||
base_price = 48;
|
||||
min_price = 60;
|
||||
}
|
||||
width = width * 10 + 4;
|
||||
@@ -5953,7 +5998,7 @@ public class ProductService {
|
||||
double[] lengths = {1.2, 1.5, 1.8, 2, 2.4};
|
||||
if ("2".equals(dto.getKind())) {
|
||||
prices = new double[][]{
|
||||
{110, 236, 290, 587},
|
||||
{110, 210, 290, 587},
|
||||
{119, 240, 298, 587},
|
||||
{125, 240, 308, 587},
|
||||
{137, 240, 316, 630},
|
||||
|
||||
Reference in New Issue
Block a user