新增手提袋
This commit is contained in:
@@ -4758,12 +4758,62 @@ public class ProductService {
|
||||
return getMousePadPrice(dto, width, length);
|
||||
case "手环":
|
||||
return getWristBandPrice(dto, width, length);
|
||||
case "手提塑料袋":
|
||||
return getPlasticBagPrice(dto, width, length);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Product> getPlasticBagPrice(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[] counts = {200, 500, 1000};
|
||||
double[][] prices = {
|
||||
{80, 144, 255},
|
||||
{96, 169, 300},
|
||||
{145, 280, 510},
|
||||
};
|
||||
|
||||
if (craft_list.contains("双面相同")) {
|
||||
prices = new double[][]{
|
||||
{97, 184, 335},
|
||||
{112, 209, 380},
|
||||
{161, 320, 590},
|
||||
};
|
||||
}
|
||||
|
||||
if (craft_list.contains("双面不同")) {
|
||||
prices = new double[][]{
|
||||
{117, 204, 355},
|
||||
{132, 229, 400},
|
||||
{181, 340, 610},
|
||||
};
|
||||
}
|
||||
int sizeIndex = 0;
|
||||
if (width == 40 && length == 30) {
|
||||
sizeIndex = 1;
|
||||
}
|
||||
if (width == 55 && length == 45) {
|
||||
sizeIndex = 2;
|
||||
}
|
||||
for (int i = 0; i < counts.length; i++) {
|
||||
int itemCount = counts[i];
|
||||
if (itemCount < count) {
|
||||
continue;
|
||||
}
|
||||
Product pro = new Product();
|
||||
pro.setCount(itemCount);
|
||||
pro.setPrice(Math.ceil(prices[sizeIndex][i] * number));
|
||||
pro.setNumber(number);
|
||||
priceList.add(pro);
|
||||
}
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private List<Product> getWristBandPrice(Product dto, Double width, Double length) {
|
||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user