新增金属徽章工艺

This commit is contained in:
2025-11-27 10:36:52 +08:00
parent 58a1eecc62
commit 6ce28bae01
3 changed files with 152 additions and 43 deletions
@@ -4783,44 +4783,89 @@ public class ProductService {
List<Product> priceList = new ArrayList<>();
int count = dto.getCount();
int number = dto.getNumber();
double[][] prices_list = {
{450, 880, 1700, 3250, 5380, 10000, 14728, 23685, 43103},
};
int[] count_list = {
50, 100, 200, 500, 1000, 2000, 3000, 5000, 10000
};
int pre_count = 0;
for (int i = 0; i < count_list.length; i++) {
double price = prices_list[0][i];
if (carft_list.contains("PET印刷")) {
double[][] prices_list = {
{450, 880, 1700, 3250, 5380, 10000, 14728, 23685, 43103},
};
int item_count = count_list[i];
if (item_count < count) {
pre_count = item_count;
continue;
}
if (priceList.size() > 2) {
break;
}
//数量小于50
Product pro = new Product();
if (pre_count > 0 && count > pre_count) {
double base_price = prices_list[0][i - 1] / pre_count;
int pre_count = 0;
for (int i = 0; i < count_list.length; i++) {
double price = prices_list[0][i];
int item_count = count_list[i];
if (item_count < count) {
pre_count = item_count;
continue;
}
if (priceList.size() > 2) {
break;
}
//数量小于50
Product pro = new Product();
if (pre_count > 0 && count > pre_count) {
double base_price = prices_list[0][i - 1] / pre_count;
pro = new Product();
pro.setCount(count);
pro.setWeight(df.format(0.005 * count * dto.getNumber()));
pro.setPrice(Math.ceil(base_price * count * dto.getNumber()));
priceList.add(pro);
}
pro = new Product();
pro.setCount(count);
pro.setWeight(df.format(0.005 * count * dto.getNumber()));
pro.setPrice(Math.ceil(base_price * count * dto.getNumber()));
pro.setCount(item_count);
pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
pro.setPrice(Math.ceil(price * dto.getNumber()));
priceList.add(pro);
pre_count = item_count;
}
}
if (carft_list.contains("UV印刷")) {
int pre_count = 0;
double miniprice = 400;
double mo_price = 250;
double base_price = 4.5;
if (width <= 4 && length <= 4) {
base_price = 4;
}
if (base_price < 4.5) {
if (count > 100 && count <= 500) {
base_price = 3.5;
} else if (count > 500) {
base_price = 3;
}
}
Product pro = new Product();
pro.setCount(count);
pro.setWeight(df.format(0.005 * count * dto.getNumber()));
pro.setPrice(Math.max(Math.ceil(base_price * count * dto.getNumber() + mo_price * dto.getNumber()), miniprice));
priceList.add(pro);
for (int i = 0; i < count_list.length; i++) {
int item_count = count_list[i];
if (item_count < count || count == item_count) {
continue;
}
if (priceList.size() > 2) {
break;
}
pro = new Product();
if (base_price < 4.5) {
if (item_count > 100 && item_count <= 500) {
base_price = 3.5;
} else if (item_count > 500) {
base_price = 3;
}
}
pro = new Product();
pro.setCount(item_count);
pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
pro.setPrice(Math.max(Math.ceil(base_price * item_count * dto.getNumber() + mo_price * dto.getNumber()), miniprice));
priceList.add(pro);
}
pro = new Product();
pro.setCount(item_count);
pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
pro.setPrice(Math.ceil(price * dto.getNumber()));
priceList.add(pro);
pre_count = item_count;
}
return priceList;
}