新增挂画

This commit is contained in:
2025-12-26 17:40:15 +08:00
parent d622d5b937
commit 8e1d6b5185
4 changed files with 456 additions and 9 deletions
@@ -8,6 +8,7 @@ import lingtao.net.dao.ProductMapper;
import lingtao.net.dao.QuoteLogMapper;
import lingtao.net.util.*;
import lingtao.net.vo.FunReturnVo;
import org.apache.commons.collections.map.HashedMap;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -2978,7 +2979,7 @@ public class ProductService {
designFee = 50;
designFee9 = 60;
} else {
designFee = 80;
designFee = 50;
designFee9 = 80;
}
if ("腰封".equals(dto.getKind())) {
@@ -4788,12 +4789,111 @@ public class ProductService {
return getPlasticBagPrice(dto, width, length);
case "纸碗":
return getPaperBowlPrice(dto, width, length);
case "挂画":
return getWallPaintingPrice(dto, width, length);
default:
break;
}
return null;
}
private List<Product> getWallPaintingPrice(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();
double[][] prices = {
{45, 45, 55, 75},
{40, 40, 45, 65}
};
double area = length * width / 10000;
double price = 0, dj = 0;
double craft_price = 0;
int index = 0;
String product_weight = "";
Map<String, Double> craft_weight_map = new HashMap<>();
craft_weight_map.put("30", 0.055);
craft_weight_map.put("40", 0.08);
craft_weight_map.put("50", 0.095);
craft_weight_map.put("60", 0.12);
craft_weight_map.put("70", 0.14);
craft_weight_map.put("80", 0.16);
craft_weight_map.put("90", 0.18);
craft_weight_map.put("100", 0.2);
long key = Math.round(length);
if ("贡缎布".equals(dto.getKind())) {
index = 1;
}
if ("30*50".equals(dto.getSize())) {
dj = prices[index][0];
price = Math.ceil(count * dj);
} else if ("50*80".equals(dto.getSize())) {
dj = prices[index][1];
price = Math.ceil(count * dj);
} else if ("60*100".equals(dto.getSize())) {
dj = prices[index][2];
price = Math.ceil(count * dj);
} else if ("80*120".equals(dto.getSize())) {
dj = prices[index][3];
price = Math.ceil(count * dj);
} else {
if ("贡缎布".equals(dto.getKind())) {
if (area < 0.25) {
dj = 40;
} else {
dj = 35;
}
area *= count;
price = Math.max(Math.ceil(area * dj), 40);
}
if ("帆布".equals(dto.getKind())) {
dto.setStickerKind("");
priceList = new PriceUtils().getFbPrice(dto, number, width, length, count, priceList);
}
Map<String, Double> craft_price_map = new HashMap<>();
craft_price_map.put("30", 5.0);
craft_price_map.put("40", 6.0);
craft_price_map.put("50", 7.0);
craft_price_map.put("60", 8.0);
craft_price_map.put("70", 9.0);
craft_price_map.put("80", 10.0);
craft_price_map.put("90", 11.0);
craft_price_map.put("100", 12.0);
if (craft_price_map.containsKey(String.valueOf(key))) {
craft_price = craft_price_map.get(String.valueOf(key));
if (craft_price > 0) {
craft_price = Math.ceil(craft_price * count * number);
}
}
}
if (price > 0) {
Product pro = new Product();
pro.setCount(count);
pro.setPrice(price * number);
priceList.add(pro);
}
if (craft_weight_map.containsKey(String.valueOf(key))) {
double weight = craft_weight_map.get(String.valueOf(key));
if ("贡缎布".equals(dto.getKind())) {
product_weight = (df.format(0.165 * length * width * count / 10000 * number + weight * count * number));
}
if ("帆布".equals(dto.getKind())) {
product_weight = (df.format(length * width * count / 10000 * 0.28 * number + weight * count * number));
}
}
for (Product product : priceList) {
product.setPrice(product.getPrice() + craft_price);
product.setWeight(product_weight);
}
return priceList;
}
private List<Product> getPaperBowlPrice(Product dto, Double width, Double length) {
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
List<Product> priceList = new ArrayList<>();
@@ -5197,18 +5297,26 @@ public class ProductService {
int number = dto.getNumber();
//布钱 +人工+印刷+手提
Product pro = null;
double lastPrice = 0;
for (int i = 0; i < counts.length; i++) {
int itemCount = counts[i];
double basePrice = unit_prices[base][i];
if (itemCount < count) {
lastPrice = basePrice;
continue;
}
if (priceList.size() > 2) {
break;
}
if (priceList.size() == 0 && itemCount != count) {
if (lastPrice > 0) {
basePrice = (lastPrice + basePrice) / 2;
}
pro = new Product();
pro.setCount(count);
pro.setPrice(Math.ceil(unit_prices[base][i] * count * number));
pro.setPrice(Math.ceil(basePrice * count * number));
priceList.add(pro);
}
pro = new Product();
@@ -5216,6 +5324,7 @@ public class ProductService {
pro.setPrice(Math.ceil(unit_prices[base][i] * itemCount * number));
pro.setWeight(df.format(width * length * 1.8 * itemCount / 10000));
priceList.add(pro);
lastPrice = basePrice;
}
return priceList;
@@ -2485,16 +2485,16 @@ public class PriceUtils {
double area = length * width / 10000;
double price = 0, dj = 0;
if (area < 0.25) {
dj = 50;
} else {
dj = 40;
} else {
dj = 35;
}
area *= count;
if ("6".equals(kind2)) {
price = price + 30;
}
price = Math.ceil(area * dj > 58 ? area * dj : 58);
price = Math.ceil(area * dj > 40 ? area * dj : 40);
pro.setCount(count);
pro.setPrice(price * number);
list.add(pro);
@@ -3075,12 +3075,11 @@ public class PriceUtils {
Product pro = new Product();
double price = 0, dj = 0;
String[] craft = dto.getCraft();
if (dto.getStickerKind().equals("套餐")) {
if ("套餐".equals(dto.getStickerKind())) {
pro.setCount(count);
pro.setPrice(198.0);
list.add(pro);
} else {
double area = length * width * count / 10000;
double d = length * width * count / 10000;
if (length == 100 && width == 45) {