新增地垫

This commit is contained in:
2026-08-05 10:15:24 +08:00
parent 1fbdfc9215
commit d2df533f65
2 changed files with 444 additions and 0 deletions
@@ -4466,12 +4466,55 @@ public class ProductService {
case "扑克牌":
priceList = getPegSolitairePrice(dto, width, length, height);
return chucklePrice(role, priceList, dto);
case "地垫":
priceList = getFloorMatPrice(dto, width, length, height);
return chucklePrice(role, priceList, dto);
default:
break;
}
return null;
}
private List<Product> getFloorMatPrice(Product dto, Double width, Double length, Double height) {
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 = {1, 5, 10, 20, 50, 100};
double[][] prices_area = {
{171.5, 150.0, 133.4, 120.0, 109.1, 100.0},
{148.6, 130.0, 115.6, 104.0, 94.6, 86.7},
{171.5, 150.0, 133.4, 120.0, 109.1, 100.0}
};
double[][] base_prices_area = {
{51.5, 45.0, 40.1, 36.0, 32.8, 30.0},
{48.9, 42.8, 38.1, 34.2, 31.1, 28.6},
{51.5, 45.0, 40.1, 36.0, 32.8, 30.0}
};
double craft_price = 0;
int price_index = 0;
if (craft_list.contains("不锁边")) {
price_index = 1;
}
if (craft_list.contains("异形")) {
price_index = 2;
}
if (craft_list.contains("OPP袋")) {
craft_price = 1 * count * number;
}
double price = new PriceUtils().TableCountCenterPrice(count, prices_area[price_index], counts);
double mini_price = new PriceUtils().TableCountCenterPrice(count, base_prices_area[price_index], counts);
double design_price = 0;
Product pro = new Product();
pro.setCount(count);
pro.setPrice(Math.ceil(Math.max(price * length * width / 10000 * count, mini_price)) * number + design_price + craft_price);
priceList.add(pro);
return priceList;
}
private List<Product> getPegSolitairePrice(Product dto, Double width, Double length, Double height) {
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
List<Product> priceList = new ArrayList<>();