新增立牌

This commit is contained in:
2026-07-27 15:25:34 +08:00
parent 67fdad896c
commit f2592686f8
2 changed files with 400 additions and 1 deletions
@@ -4431,12 +4431,82 @@ public class ProductService {
case "沙滩旗":
priceList = getBeachFlagPrice(dto, width, length);
return chucklePrice(role, priceList, dto);
case "立牌":
priceList = getStandingSignPrice(dto, width, length);
return chucklePrice(role, priceList, dto);
default:
break;
}
return null;
}
private List<Product> getStandingSignPrice(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();
double area = length * width;
int[] counts = {1, 5, 10, 20, 30, 50, 100};
double[] areas = {25, 36, 49, 64, 100, 144, 215, 400};
double[][] prices = {
{30.0, 30.0, 30.0, 65.0, 100.0, 170.0, 328.0},
{30.0, 30.0, 45.0, 83.0, 126.0, 205.0, 396.0},
{30.0, 30.0, 55.0, 103.0, 150.0, 255.0, 480.0},
{30.0, 40.0, 68.0, 123.0, 188.0, 305.0, 580.0},
{30.0, 48.0, 90.0, 165.0, 242.0, 405.0, 780.0},
{30.0, 65.0, 126.0, 245.0, 360.0, 580.0, 1073.0},
{30.0, 105.0, 205.0, 378.0, 562.0, 893.0, 1738.0},
{40.0, 190.0, 375.0, 740.0, 950.0, 1846.0, 3546.0}
};
if (craft_list.contains("双面")) {
prices = new double[][]{
{35.0, 35.0, 35.0, 65.0, 100.0, 170.0, 328.0},
{35.0, 35.0, 45.0, 83.0, 126.0, 205.0, 396.0},
{35.0, 35.0, 55.0, 103.0, 150.0, 255.0, 480.0},
{35.0, 45.0, 68.0, 123.0, 188.0, 305.0, 580.0},
{35.0, 48.0, 90.0, 165.0, 242.0, 405.0, 780.0},
{35.0, 65.0, 126.0, 245.0, 360.0, 580.0, 1073.0},
{35.0, 105.0, 205.0, 378.0, 562.0, 893.0, 1738.0},
{45.0, 190.0, 375.0, 740.0, 950.0, 1846.0, 3546.0}
};
}
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 (count > counts[i]) {
continue;
}
if (priceList.size() > 2) {
break;
}
int itemCount = priceList.size() == 0 ? count : counts[i];
base_price = prices[area_index][Math.max(i, 0)];
Product pro = new Product();
pro.setCount(itemCount);
pro.setNumber(dto.getNumber());
pro.setPrice(Math.ceil(base_price * number));
priceList.add(pro);
}
if (priceList.size() == 0) {
Product pro = new Product();
pro.setCount(count);
pro.setNumber(number);
pro.setPrice(Math.ceil(prices[area_index][prices[area_index].length - 1] / counts[counts.length - 1] * count * number));
priceList.add(pro);
}
return priceList;
}
private List<Product> getBeachFlagPrice(Product dto, Double width, Double length) {
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
List<Product> priceList = new ArrayList<>();
@@ -6643,7 +6713,7 @@ public class ProductService {
}
if (priceList.size() == 0) {
Product pro = new Product();
pro.setCount(count);
pro.setCount(dto.getCount());
pro.setNumber(number);
pro.setPrice(Math.ceil((double) prices[prices.length - 1] / counts[counts.length - 1] * Math.max(min_count, count) + craft_price));
priceList.add(pro);