新增弹弹乐

This commit is contained in:
2026-08-01 16:59:22 +08:00
parent 0442428487
commit c95d699292
2 changed files with 402 additions and 0 deletions
@@ -4454,12 +4454,112 @@ public class ProductService {
case "吧唧徽章":
priceList = getBiteBadgePrice(dto, width, length, height);
return chucklePrice(role, priceList, dto);
case "弹弹乐":
priceList = getPianoMusicPrice(dto, width, length, height);
return chucklePrice(role, priceList, dto);
default:
break;
}
return null;
}
private List<Product> getPianoMusicPrice(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();
double area = width * length;
int[] counts = {1, 5, 10, 20, 30, 50, 100, 200, 500, 1000, 3000, 5000, 10000, 30000, 50000, 100000};
double[] areas = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600};
double[][] prices_area = {
{30.00, 5.65, 3.00, 1.70, 1.60, 1.50, 1.40, 1.35, 1.30, 1.30, 1.25, 1.25, 1.20, 1.20, 1.20, 1.15},
{30.00, 5.65, 3.00, 1.90, 1.80, 1.70, 1.60, 1.50, 1.45, 1.45, 1.40, 1.40, 1.35, 1.35, 1.30, 1.25},
{30.00, 5.65, 3.00, 2.20, 2.10, 1.95, 1.85, 1.75, 1.70, 1.65, 1.65, 1.60, 1.55, 1.55, 1.50, 1.45},
{30.00, 5.65, 3.00, 2.60, 2.50, 2.35, 2.20, 2.10, 2.00, 2.00, 1.95, 1.90, 1.90, 1.85, 1.80, 1.75},
{30.00, 5.65, 3.60, 3.15, 3.00, 2.80, 2.65, 2.55, 2.45, 2.40, 2.35, 2.30, 2.25, 2.25, 2.20, 2.10},
{30.00, 5.65, 4.35, 3.85, 3.65, 3.40, 3.20, 3.05, 2.95, 2.90, 2.85, 2.80, 2.75, 2.70, 2.65, 2.55},
{30.00, 5.75, 5.30, 4.60, 4.40, 4.10, 3.85, 3.70, 3.55, 3.50, 3.45, 3.35, 3.30, 3.25, 3.20, 3.10},
{30.00, 6.90, 6.30, 5.55, 5.25, 4.90, 4.60, 4.45, 4.25, 4.20, 4.10, 4.05, 3.95, 3.90, 3.80, 3.70},
{30.00, 8.20, 7.50, 6.55, 6.25, 5.85, 5.50, 5.25, 5.05, 4.95, 4.85, 4.80, 4.70, 4.60, 4.55, 4.40},
{30.00, 9.65, 8.80, 7.70, 7.35, 6.85, 6.45, 6.20, 5.95, 5.85, 5.70, 5.60, 5.50, 5.40, 5.35, 5.15},
{30.00, 11.25, 10.30, 9.00, 8.55, 8.00, 7.50, 7.20, 6.95, 6.80, 6.65, 6.55, 6.45, 6.30, 6.20, 6.00},
{30.00, 13.00, 11.90, 10.40, 9.90, 9.25, 8.65, 8.30, 8.00, 7.85, 7.70, 7.55, 7.45, 7.30, 7.20, 6.95},
{30.00, 14.90, 13.60, 11.90, 11.35, 10.60, 9.95, 9.55, 9.15, 9.00, 8.85, 8.65, 8.50, 8.35, 8.20, 7.95},
{30.00, 16.95, 15.50, 13.55, 12.90, 12.05, 11.30, 10.85, 10.45, 10.25, 10.05, 9.85, 9.70, 9.50, 9.35, 9.05},
{30.00, 19.15, 17.50, 15.30, 14.60, 13.60, 12.75, 12.25, 11.80, 11.55, 11.35, 11.15, 10.95, 10.75, 10.55, 10.20},
{30.00, 21.50, 19.65, 17.20, 16.40, 15.30, 14.35, 13.75, 13.25, 13.00, 12.75, 12.50, 12.30, 12.10, 11.85, 11.50},
{30.00, 24.00, 21.95, 19.20, 18.30, 17.05, 16.00, 15.35, 14.80, 14.50, 14.25, 13.95, 13.75, 13.50, 13.25, 12.80},
{30.00, 26.65, 24.40, 21.35, 20.30, 18.95, 17.80, 17.05, 16.40, 16.10, 15.80, 15.50, 15.25, 15.00, 14.70, 14.25},
{31.45, 29.45, 26.95, 23.60, 22.45, 20.95, 19.65, 18.85, 18.15, 17.80, 17.45, 17.15, 16.85, 16.55, 16.25, 15.75},
{34.60, 32.45, 29.65, 25.95, 24.70, 23.05, 21.65, 20.75, 19.95, 19.60, 19.25, 18.90, 18.55, 18.20, 17.90, 17.30},
{37.90, 35.55, 32.50, 28.45, 27.10, 25.30, 23.70, 22.75, 21.90, 21.45, 21.10, 20.70, 20.30, 19.95, 19.60, 18.95},
{41.40, 38.80, 35.50, 31.05, 29.60, 27.60, 25.90, 24.85, 23.90, 23.45, 23.00, 22.60, 22.20, 21.80, 21.45, 20.70},
{45.05, 42.25, 38.60, 33.80, 32.20, 30.05, 28.15, 27.05, 26.00, 25.50, 25.05, 24.60, 24.15, 23.70, 23.30, 22.55},
{48.85, 45.80, 41.90, 36.65, 34.90, 32.60, 30.55, 29.30, 28.20, 27.65, 27.15, 26.65, 26.20, 25.70, 25.30, 24.45},
{52.85, 49.55, 45.30, 39.65, 37.75, 35.25, 33.05, 31.70, 30.50, 29.90, 29.35, 28.85, 28.30, 27.80, 27.35, 26.45},
{56.95, 53.40, 48.80, 42.70, 40.70, 38.00, 35.60, 34.20, 32.85, 32.25, 31.65, 31.10, 30.50, 30.00, 29.45, 28.50},
{61.25, 57.45, 52.50, 45.95, 43.75, 40.85, 38.30, 36.75, 35.35, 34.70, 34.05, 33.40, 32.85, 32.25, 31.70, 30.65},
{65.70, 61.60, 56.35, 49.30, 46.95, 43.80, 41.10, 39.45, 37.90, 37.20, 36.50, 35.85, 35.20, 34.60, 34.00, 32.85},
{70.35, 65.95, 60.30, 52.75, 50.25, 46.90, 43.95, 42.20, 40.60, 39.80, 39.10, 38.35, 37.70, 37.05, 36.40, 35.20},
{75.10, 70.40, 64.40, 56.35, 53.65, 50.10, 46.95, 45.05, 43.35, 42.50, 41.75, 41.00, 40.25, 39.55, 38.85, 37.55},
{80.05, 75.05, 68.60, 60.05, 57.20, 53.40, 50.05, 48.05, 46.20, 45.30, 44.50, 43.70, 42.90, 42.15, 41.40, 40.05},
{85.15, 79.85, 73.00, 63.85, 60.85, 56.80, 53.25, 51.10, 49.15, 48.20, 47.30, 46.45, 45.65, 44.85, 44.05, 42.60},
{90.40, 84.75, 77.50, 67.80, 64.60, 60.30, 56.50, 54.25, 52.20, 51.20, 50.25, 49.35, 48.45, 47.60, 46.80, 45.20},
{95.85, 89.85, 82.15, 71.90, 68.45, 63.90, 59.90, 57.50, 55.30, 54.25, 53.25, 52.30, 51.35, 50.45, 49.60, 47.95},
{101.45, 95.10, 86.95, 76.10, 72.45, 67.65, 63.40, 60.90, 58.55, 57.45, 56.35, 55.35, 54.35, 53.40, 52.50, 50.75},
{107.20, 100.50, 91.90, 80.40, 76.60, 71.45, 67.00, 64.35, 61.85, 60.70, 59.55, 58.50, 57.45, 56.45, 55.45, 53.60},
{113.10, 106.05, 96.95, 84.85, 80.80, 75.40, 70.70, 67.90, 65.25, 64.05, 62.85, 61.70, 60.60, 59.55, 58.50, 56.55},
{119.20, 111.75, 102.15, 89.40, 85.15, 79.45, 74.50, 71.50, 68.75, 67.50, 66.25, 65.00, 63.85, 62.75, 61.65, 59.60},
{125.45, 117.60, 107.50, 94.10, 89.60, 83.65, 78.40, 75.25, 72.35, 71.00, 69.70, 68.45, 67.20, 66.05, 64.90, 62.75},
{131.85, 123.60, 113.00, 98.90, 94.15, 87.90, 82.40, 79.10, 76.05, 74.65, 73.25, 71.90, 70.65, 69.40, 68.20, 65.95},
};
int area_index = 0;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
area_index = i;
break;
}
}
double base_price = 0;
for (int i = 0; i < counts.length; i++) {
if (priceList.size() > 2) {
break;
}
int item_count = counts[i];
if (item_count < count) {
continue;
}
double price = 0;
if (priceList.size() == 0) {
if (count != item_count) {
price = new PriceUtils().TableCountCenterPrice(count, prices_area[area_index], counts);
Product pro = new Product();
pro.setCount(count);
pro.setPrice(Math.max(Math.ceil(price * count), 30));
priceList.add(pro);
}
}
price = new PriceUtils().TableCountCenterPrice(item_count, prices_area[area_index], counts);
Product pro = new Product();
pro.setCount(item_count);
pro.setPrice(Math.max(Math.ceil(price * item_count), 30));
priceList.add(pro);
}
if (priceList.size() == 0) {
Product pro = new Product();
pro.setCount(count);
pro.setPrice(Math.ceil(prices_area[area_index][prices_area[area_index].length - 1] / counts[counts.length - 1] * count));
priceList.add(pro);
}
for (Product product : priceList) {
product.setPrice(Math.ceil(product.getPrice() * number));
}
return priceList;
}
private List<Product> getBiteBadgePrice(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<>();