This commit is contained in:
2025-04-02 16:50:35 +08:00
parent b86df55577
commit 4334abb10e
2 changed files with 33 additions and 9 deletions
@@ -600,10 +600,13 @@ public class ProductService {
if (priceList.size() >= 4) { if (priceList.size() >= 4) {
priceList = priceList.subList(0, 4); priceList = priceList.subList(0, 4);
} }
List<String> crafts_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
// 根据款数重新算价格/计算重量 // 根据款数重新算价格/计算重量
for (Product product : priceList) { for (Product product : priceList) {
product.setPrice(Math.floor(product.getPrice() * number)); product.setPrice(Math.floor(product.getPrice() * number));
if (crafts_list.contains("弹力绳")) {
product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
}
product.setWeight(df.format(number * length * width * product.getCount() * 0.00003)); product.setWeight(df.format(number * length * width * product.getCount() * 0.00003));
} }
return priceList; return priceList;
@@ -646,6 +649,8 @@ public class ProductService {
} }
} else if ("13".equals(dto.getKind())) { } else if ("13".equals(dto.getKind())) {
int min = getNum(length, width); int min = getNum(length, width);
dto.setLength(length);
dto.setWidth(width);
int tempNumber = dto.getNumber(); int tempNumber = dto.getNumber();
List<String> craftList = null; List<String> craftList = null;
if (!StringUtils.isEmpty(dto.getCraft())) { if (!StringUtils.isEmpty(dto.getCraft())) {
@@ -654,8 +659,8 @@ public class ProductService {
if (craftList.contains("模切")) { if (craftList.contains("模切")) {
dto.setNumber(1); dto.setNumber(1);
} }
priceList = new CouponPrice().getCouponPrice(min, dto, priceList, count); priceList = new CouponPrice().getCouponPrice(min, dto, priceList, count, craftList);
getCraft(dto, priceList, length * 10, width * 10, min); //getCraft(dto, priceList, length * 10, width * 10, min);
if (craftList.contains("模切")) { if (craftList.contains("模切")) {
for (Product product : priceList) { for (Product product : priceList) {
@@ -668,7 +673,7 @@ public class ProductService {
area = length * width; area = length * width;
int[][] prices = { int[][] prices = {
{106, 106, 106, 106, 106, 107, 108, 109, 116, 130, 131, 133, 142, 193, 195, 198, 246, 430, 438, 557, 573}, {106, 106, 106, 106, 106, 107, 108, 109, 116, 130, 131, 133, 142, 193, 195, 198, 246, 430, 438, 557, 573},
{139, 139, 139, 139, 143, 145, 147, 160, 162, 171, 176, 179, 205, 255, 260, 266, 279, 490, 497, 628, 632,}, {139, 139, 139, 139, 143, 145, 147, 160, 162, 171, 176, 179, 205, 255, 260, 266, 279, 490, 497, 628, 632},
{226, 237, 245, 253, 255, 256, 258, 265, 269, 280, 290, 310, 325, 395, 410, 445, 453, 650, 721, 914, 920}, {226, 237, 245, 253, 255, 256, 258, 265, 269, 280, 290, 310, 325, 395, 410, 445, 453, 650, 721, 914, 920},
{313, 342, 343, 375, 380, 385, 390, 395, 398, 400, 405, 409, 418, 540, 545, 555, 620, 811, 836, 1056, 1128}, {313, 342, 343, 375, 380, 385, 390, 395, 398, 400, 405, 409, 418, 540, 545, 555, 620, 811, 836, 1056, 1128},
{465, 510, 515, 553, 559, 565, 571, 581, 587, 599, 610, 615, 629, 810, 820, 830, 921, 1200, 1250, 1580, 1685}, {465, 510, 515, 553, 559, 565, 571, 581, 587, 599, 610, 615, 629, 810, 820, 830, 921, 1200, 1250, 1580, 1685},
@@ -3,6 +3,7 @@ package lingtao.net.util;
import lingtao.net.bean.Product; import lingtao.net.bean.Product;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -90,7 +91,7 @@ public class CouponPrice {
private static final String compate = "basePrice + area*price"; private static final String compate = "basePrice + area*price";
private static final String moCompate = "chu*number"; private static final String moCompate = "chu*number";
public List<Product> getCouponPrice(int min, Product dto, List<Product> priceList, int count) { public List<Product> getCouponPrice(int min, Product dto, List<Product> priceList, int count, List<String> craftList) {
Product product = null; Product product = null;
List<Product> products = new ArrayList<>(); List<Product> products = new ArrayList<>();
int[] priceArr = {20, 28, 52, 100, 155, 165, 250}; int[] priceArr = {20, 28, 52, 100, 155, 165, 250};
@@ -108,7 +109,7 @@ public class CouponPrice {
if (count > countArr2[i] || products.size() >= 3) { if (count > countArr2[i] || products.size() >= 3) {
continue; continue;
} }
Double price = this.price(min, dto, countArr2[i], Double.valueOf(priceArr[i]), minPrice); Double price = this.price(min, dto, countArr2[i], Double.valueOf(priceArr[i]), minPrice, craftList);
product.setPrice(price); product.setPrice(price);
product.setCount(countArr2[i]); product.setCount(countArr2[i]);
@@ -117,7 +118,7 @@ public class CouponPrice {
return products; return products;
} }
private Double price(int min, Product dto, int count, double basePrice, double minPrice) { private Double price(int min, Product dto, int count, double basePrice, double minPrice, List<String> craftList) {
//200张以内16元/款/单,200张以上24元/款/单 //200张以内16元/款/单,200张以上24元/款/单
int price = count <= 200 ? 16 * dto.getNumber() : 20 * dto.getNumber(); int price = count <= 200 ? 16 * dto.getNumber() : 20 * dto.getNumber();
if (min == 1) { if (min == 1) {
@@ -127,7 +128,25 @@ public class CouponPrice {
if (minW > 1) { if (minW > 1) {
minW = minW - 0.5; minW = minW - 0.5;
} }
double v = basePrice * min * dto.getNumber() + ((dto.getAwards() - 1) * minW * price); double v = 0;
if (craftList.contains("模切")) {
int[][] prices = {
{73, 78, 83, 88, 90, 100, 110, 115, 120, 125, 130, 135, 142, 145, 160, 230, 420},
{78, 83, 88, 93, 95, 105, 115, 120, 132, 142, 152, 162, 172, 185, 198, 243, 435},
{125, 128, 130, 132, 135, 140, 145, 150, 159, 169, 189, 210, 220, 298, 358, 412, 525},
{220, 225, 228, 230, 236, 240, 245, 250, 280, 305, 325, 350, 370, 530, 610, 745, 950},
{320, 325, 330, 335, 340, 345, 350, 355, 396, 455, 480, 495, 528, 790, 880, 1120, 1390},
{415, 420, 425, 430, 440, 450, 460, 465, 520, 555, 600, 620, 670, 910, 990, 1265, 2100},
{700, 705, 710, 715, 725, 735, 745, 750, 800, 820, 870, 950, 1150, 1450, 1680, 2390, 3790}
};
double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 255, 289};
int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};
int count_index = Arrays.binarySearch(count_list, count);
double area = dto.getWidth() * dto.getLength();
v = new PriceUtils().TablePrice(area, prices[count_index], areas);
} else {
v = basePrice * min * dto.getNumber() + ((dto.getAwards() - 1) * minW * price);
}
String[] size_list = dto.getSize1().split(","); String[] size_list = dto.getSize1().split(",");
double chu = 0.00; double chu = 0.00;
double total_chu = 0.00; double total_chu = 0.00;
@@ -200,7 +219,7 @@ public class CouponPrice {
for (Double aDouble : chu_list) { for (Double aDouble : chu_list) {
if (total_chu > 0.00) { if (total_chu > 0.00) {
total_chu = total_chu + aDouble * dto.getNumber(); total_chu = total_chu + aDouble * dto.getNumber();
}else{ } else {
total_chu = Math.max(v + aDouble * dto.getNumber(), minPrice); total_chu = Math.max(v + aDouble * dto.getNumber(), minPrice);
} }
} }