新增手环价格

This commit is contained in:
2025-12-05 16:00:27 +08:00
parent b5cb6cd1b0
commit d24a4b9ee9
3 changed files with 436 additions and 4 deletions
@@ -4754,12 +4754,77 @@ public class ProductService {
return getHandkerPrice(dto, width, length);
case "鼠标垫":
return getMousePadPrice(dto, width, length);
case "手环":
return getWristBandPrice(dto, width, length);
default:
break;
}
return null;
}
private List<Product> getWristBandPrice(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[] counts = {50, 100, 200, 300, 400, 500, 1000, 2000, 3000, 5000, 7000, 10000, 30000, 50000, 100000};
double[][] prices = {
{60, 70, 90, 100, 105, 110, 150, 200, 260, 430, 550, 690, 2020, 3080, 5950},
{60, 70, 90, 100, 105, 110, 150, 200, 260, 430, 550, 690, 2020, 3080, 5950},
{83, 93, 113, 120, 124, 128, 200, 300, 371, 595, 779, 1041, 3108, 4866, 9669},
{83, 93, 113, 120, 124, 128, 200, 300, 371, 595, 779, 1041, 3108, 4866, 9669},
{153, 163, 203, 200, 200, 202, 250, 350, 450, 650, 850, 1150, 3250, 4950, 9990},
};
int j = 0;
if ("1".equals(dto.getKind())) {
if (length == 19 && width == 250) {
j = 0;
}
if (length == 19 && width == 200) {
j = 1;
}
}
if ("2".equals(dto.getKind())) {
if (length == 19 && width == 250) {
j = 2;
}
if (length == 19 && width == 200) {
j = 3;
}
if (length == 25 && width == 250) {
j = 4;
}
}
for (int i = 0; i < counts.length; i++) {
int itemCount = counts[i];
if (itemCount < count) {
continue;
}
if (priceList.size() > 2) {
break;
}
double craftPrice = 0;
if (craft_list.contains("可变二维码") || craft_list.contains("序列号")) {
craftPrice = 0.02 * itemCount;
}
if (craft_list.contains("可变二维码+序列号")) {
craftPrice = 0.03 * itemCount;
}
Product pro = new Product();
pro.setCount(itemCount);
if (priceList.size() == 0) {
pro.setCount(count);
}
pro.setPrice(Math.ceil((prices[j][i] + craftPrice) * number));
pro.setNumber(number);
priceList.add(pro);
if (priceList.size() == 1 && itemCount != count) {
break;
}
}
return priceList;
}
private List<Product> getMousePadPrice(Product dto, Double width, Double length) {
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
List<Product> priceList = new ArrayList<>();