edit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
package lingtao.net.Factory;public class CardPricingStrategy {
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package lingtao.net.Factory;public class MetalTargetStrategy {
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package lingtao.net.Factory;public interface PricingStrategy {
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package lingtao.net.Factory;public class PricingStrategyFactory {
|
||||
}
|
||||
@@ -235,8 +235,8 @@ public class ProductService {
|
||||
// 款数
|
||||
Integer number = dto.getNumber();
|
||||
String size = dto.getSize();
|
||||
Double width = null;
|
||||
Double length = null;
|
||||
Double width = dto.getWidth();
|
||||
Double length = dto.getLength();
|
||||
Double height = null;
|
||||
Double area = null;
|
||||
String oldKind = "";
|
||||
@@ -734,6 +734,9 @@ public class ProductService {
|
||||
if (craft_list.contains("穿尼龙绳")) {
|
||||
carft_price += Math.max(0.2 * item_count, 40);
|
||||
}
|
||||
if (craft_list.contains("配弹力绳")) {
|
||||
carft_price += Math.max(0.1 * item_count, 10);
|
||||
}
|
||||
double tang_price = 0;
|
||||
if (craft_list.contains("单面烫金") || craft_list.contains("双面烫金")) {
|
||||
tang_price = new PriceUtils().TablePrice(area, tang_prices[count_index], tang_areas);
|
||||
@@ -886,10 +889,13 @@ public class ProductService {
|
||||
int min = getNum(length, width);
|
||||
priceList = getHekaPrice(min, product1, priceList, count);
|
||||
getCraft(product1, priceList, length * 10, width * 10, min);
|
||||
if ("凹凸".equals(dto.getAotu())) {
|
||||
for (Product product : priceList) {
|
||||
for (Product product : priceList) {
|
||||
if ("凹凸".equals(dto.getAotu())) {
|
||||
product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
|
||||
}
|
||||
if (craft.contains("弹力绳")) {
|
||||
product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
|
||||
}
|
||||
}
|
||||
// 根据款数重新算价格/计算重量
|
||||
for (Product product : priceList) {
|
||||
@@ -962,10 +968,13 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
// +棉绳钱 1分5一条
|
||||
if (!StringUtils.isEmpty(dto.getCraftSheng())) {
|
||||
for (Product product : priceList) {
|
||||
for (Product product : priceList) {
|
||||
if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("棉绳")) {
|
||||
product.setPrice(product.getPrice() + product.getCount() * 0.015);
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("弹力绳")) {
|
||||
product.setPrice(product.getPrice() + Math.max(product.getCount() * 0.1, 10));
|
||||
}
|
||||
}
|
||||
for (Product product : priceList) {
|
||||
product.setWeight(df.format(length * width * product.getCount() / 10000 * 0.6));
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package lingtao.net.service.price;
|
||||
|
||||
public interface ClothingTagService {
|
||||
|
||||
void inster();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package lingtao.net.service.price;
|
||||
|
||||
import lingtao.net.enums.ProductEnum;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
public interface ProductService<T> {
|
||||
|
||||
/**
|
||||
* 计算价格
|
||||
*/
|
||||
void getProduct(T t);
|
||||
|
||||
ProductEnum getEnum();
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package lingtao.net.service.price;
|
||||
|
||||
public interface SelfAdhesiveStickerService {
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package lingtao.net.service.price.impl;
|
||||
|
||||
import lingtao.net.entity.ClothingTag;
|
||||
import lingtao.net.enums.ProductEnum;
|
||||
import lingtao.net.service.price.ClothingTagService;
|
||||
import lingtao.net.service.price.ProductService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class ClothingTagServiceImpl implements ProductService<ClothingTag>, ClothingTagService {
|
||||
|
||||
@Override
|
||||
public void getProduct(ClothingTag clothingTag) {
|
||||
System.out.println("===========clothingTag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductEnum getEnum() {
|
||||
return ProductEnum.clothing_Tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inster() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package lingtao.net.service.price.impl;
|
||||
|
||||
import lingtao.net.enums.ProductEnum;
|
||||
import lingtao.net.service.price.ProductService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ProductContent implements ApplicationContextAware {
|
||||
|
||||
@Autowired(required = false)
|
||||
Map<ProductEnum, ProductService> productServiceMap;
|
||||
|
||||
public ProductService getService(ProductEnum productEnum) {
|
||||
return productServiceMap.get(productEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
Map<String, ProductService> map = applicationContext.getBeansOfType(ProductService.class);
|
||||
productServiceMap = new HashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
productServiceMap.put(value.getEnum(), value);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package lingtao.net.service.price.impl;
|
||||
|
||||
import lingtao.net.entity.SelfAdhesiveSticker;
|
||||
import lingtao.net.enums.ProductEnum;
|
||||
import lingtao.net.service.price.ProductService;
|
||||
import lingtao.net.service.price.SelfAdhesiveStickerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SelfAdhesiveStickerServiceImpl implements ProductService<SelfAdhesiveSticker>, SelfAdhesiveStickerService {
|
||||
@Override
|
||||
public void getProduct(SelfAdhesiveSticker selfAdhesiveSticker) {
|
||||
System.out.println("===========SelfAdhesiveSticker");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductEnum getEnum() {
|
||||
return ProductEnum.self_adhesive_sticker;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user