修改插旗价格

This commit is contained in:
2025-03-14 16:27:50 +08:00
parent 36e32b7c59
commit 159d1c881d
3 changed files with 1986 additions and 32 deletions
@@ -306,22 +306,79 @@ public class ProductService {
priceList = StickersDoublePrice.getPrice(length, width, count, number);
return priceList;
} else if ("插旗".equals(dto.getStickerKind())) {
dto.setKindValue("0");
dto.setLength(length);
dto.setWidth(width);
area = length * width / 10000;
if (length > 20 && length < 21) {
length = Math.ceil(length);
if (!"250克白卡纸对裱".equals(kind)) {
dto.setKindValue("0");
dto.setLength(length);
dto.setWidth(width);
area = length * width / 10000;
}
if (width > 20 && width < 21) {
width = Math.ceil(width);
area = length * width / 10000;
}
priceList = normalSticker(dto, "0", number, area, width, length, count, oldKind, priceList);
if (length > 20 && length < 21) {
length = Math.ceil(length);
area = length * width / 10000;
}
if (width > 20 && width < 21) {
width = Math.ceil(width);
area = length * width / 10000;
}
priceList = normalSticker(dto, "0", number, area, width, length, count, oldKind, priceList);
if (priceList.size() >= 3) {
priceList = priceList.subList(0, 3);
if (priceList.size() >= 3) {
priceList = priceList.subList(0, 3);
}
} else {
area = length * width;
int[] count_list = {500, 1000, 2000, 3000, 5000, 10000, 20000};
int[][] prices = {
{172, 209, 209, 209, 209, 209, 209, 209, 313, 365, 382, 400, 435},
{192, 209, 209, 209, 209, 209, 261, 278, 400, 504, 522, 556, 609},
{382, 418, 418, 418, 418, 418, 418, 418, 678, 800, 835, 922, 1009},
{470, 504, 504, 539, 556, 556, 591, 626, 887, 1078, 1130, 1252, 1373},
{556, 591, 591, 696, 747, 922, 973, 1078, 1443, 1721, 1843, 2017, 2208},
{783, 817, 817, 1009, 1199, 1495, 1582, 1947, 2625, 3199, 3477, 3703, 4085},
{1217, 1287, 1287, 1599, 1982, 2486, 2921, 3651, 5007, 6119, 6259, 7197, 7910},
};
double[] areas = {1, 4, 6, 9, 12, 16, 20, 25, 36, 45, 48.6, 54, 60};
for (int j = 0; j < count_list.length; j++) {
if (priceList.size() > 2) {
break;
}
int item_count = count_list[j];
if (count > item_count) {
continue;
}
int count_index = Arrays.binarySearch(count_list, item_count);
int startIndex = 0;
int endIndex = 0;
for (int i = 0; i < areas.length; i++) {
if (area > areas[i]) {
startIndex = endIndex;
endIndex = Math.min(i + 1, areas.length - 1);
}
}
if (count_index >= 0) {
Product pro = new Product();
double price = 0;
int[] price_list = prices[count_index];
if (startIndex == endIndex) {
price = (price_list[endIndex] / areas[endIndex]) * area;
} else {
price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
}
if ("6.5".equals(dto.getToothpick_size())) {
price = price + (item_count * 0.1);
}
if ("10".equals(dto.getToothpick_size())) {
price = price + (item_count * 0.1);
}
if ("12".equals(dto.getToothpick_size())) {
price = price + (item_count * 0.14);
}
pro.setCount(item_count);
pro.setPrice(Math.ceil(price * number));
priceList.add(pro);
}
}
return priceList;
}
// return priceList;
@@ -571,10 +628,10 @@ public class ProductService {
} else if ("10".equals(dto.getKind())) {// 吸管套
int min = getNum(length, width);
// if (min > 1) {
String[] xgtCraft = {"模切"};
dto.setCraft(xgtCraft);
priceList = getHekaPrice(min, dto, priceList, count);
getCraft(dto, priceList, length * 10, width * 10, min);
String[] xgtCraft = {"模切"};
dto.setCraft(xgtCraft);
priceList = getHekaPrice(min, dto, priceList, count);
getCraft(dto, priceList, length * 10, width * 10, min);
/*} else {
if ("6.5*5.4".equals(dto.getSize())) {
dto.setKindValue("0");
@@ -2822,23 +2879,28 @@ public class ProductService {
product.setWeight(df.format(wei * product.getCount() * number));
}
}
if ("1".equals(kind) || "2".equals(kind) || "3".equals(kind)) {
//priceList = new PriceUtils().getFbPrice(dto, number, width, length, count, priceList);
}
}
return priceList;
// 扇子
case "18":
if (dto.getKindValue().equals("5")) {
dto.setKindValue("0");
if (count <= 10000)
if (count <= 10000) {
priceList = productMapper.getThanPrice(dto);
else
} else {
priceList = productMapper.thanThousandPrice(dto);
}
dto.setKindValue("5");
} else if (!dto.getKindValue().equals("4")) {
if (count <= 10000)
if (count <= 10000) {
priceList = productMapper.getThanPrice(dto);
else
} else {
priceList = productMapper.thanThousandPrice(dto);
}
} else {
String[] list = dto.getCraft();
if (list == null) {