新增夹板

This commit is contained in:
2026-07-25 16:43:38 +08:00
parent 1f7adbb5e2
commit 1e056a10de
3 changed files with 361 additions and 4 deletions
@@ -4425,12 +4425,66 @@ public class ProductService {
case "标识牌":
priceList = getSignboardPrice(dto, width, length);
return chucklePrice(role, priceList, dto);
case "夹板":
priceList = getSplintPrice(dto, width, length);
return chucklePrice(role, priceList, dto);
default:
break;
}
return null;
}
private List<Product> getSplintPrice(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[] end_counts = {1, 5, 10, 50, 100, 200, 500, 1000, 3000, 5000, 10000};
int[] start_counts = {1, 1, 5, 10, 50, 100, 200, 500, 1000, 3000, 5000};
double[] height_price = {30.00, 30.00, 28.00, 27.00, 26.00, 25.00, 24.00, 23.00, 22.00, 21.00, 20.50};
double[] low_price = {30.00, 28.00, 27.00, 26.00, 25.00, 24.00, 23.00, 22.00, 21.00, 20.50, 19.50};
if (Math.max(width, length) == 32 && Math.min(width, length) == 22) {
height_price = new double[]{30.00, 30.00, 27.00, 25.00, 23.00, 21.00, 20.00, 19.00, 18.00, 17.50, 17.00};
low_price = new double[]{30.00, 27.00, 25.00, 23.00, 21.00, 20.00, 19.00, 18.00, 17.50, 17.00, 15.75};
}
double basePrice = 0;
if (count > end_counts[end_counts.length - 1]) {
if (craft_list.contains("带透明边")) {
basePrice = (low_price[low_price.length - 1] + 1) * count;
} else {
basePrice = low_price[low_price.length - 1] * count;
}
} else {
// 查找匹配的区间
for (int i = 0; i < end_counts.length; i++) {
if (count <= end_counts[i]) {
int startN = start_counts[i];
int endN = end_counts[i];
double highPrice = height_price[i];
double lowPrice = low_price[i];
if (craft_list.contains("带透明边")) {
highPrice += 1;
lowPrice += 1;
}
basePrice = new PriceUtils().calcByTargetN(startN, highPrice, endN, lowPrice, count);
break;
}
}
}
double design_price = Math.ceil((number) * 0);
Product pro = new Product();
pro.setCount(count);
pro.setNumber(number);
pro.setPrice(Math.ceil((Math.max(basePrice * number, 30) + design_price)));
priceList.add(pro);
return priceList;
}
private List<Product> getSignboardPrice(Product dto, Double width, Double length) {
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
List<Product> priceList = new ArrayList<>();