package lingtao.net.util;

import java.util.ArrayList;
import java.util.List;

import lingtao.net.bean.Product;

/**
 * 拉丝金/银不干胶价格
 */
public class LaSiStickersPrice {

	int countArr[] = { 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000,
			60000, 70000, 80000, 90000, 100000 };

	/**
	 * 5*5cm以内（含）
	 * 
	 * @param count
	 * @return
	 */
	public List<Product> acountPrice5x5(int count) {
		int priceArr[] = { 190, 220, 280, 360, 420, 500, 580, 640, 700, 780, 860, 1400, 2000, 2500, 3000, 3500, 4000,
				4500, 5000, 5500 };
		Product pro = new Product();
		List<Product> list = new ArrayList<Product>();
		if (count > countArr[countArr.length - 1]) {
			pro.setCount(count);
			// 每一万张增加500元
			pro.setPrice((Math.ceil(count / 100000.0) - 1) * 500 + 5500);
			list.add(pro);
		}
		for (int i = 0; i < countArr.length; i++) {
			if (countArr[i] < count) {
				continue;
			}
			pro = new Product();
			pro.setCount(countArr[i]);
			pro.setPrice(Math.ceil(priceArr[i]));
			list.add(pro);
		}
		return list;
	}

	/**
	 * 9*5.4cm 以内
	 * 
	 * @param count
	 * @param area  单个产品的面积（平方米）
	 * @return
	 */
	public List<Product> acountPrice9x5(int count, Double area) {
		int priceArr[] = { 200, 260, 340, 420, 520, 630, 740, 850, 960, 1020, 1150, 2100, 3000, 4100, 5000, 5600, 6200,
				7300, 8000, 9000 };
		Product pro = new Product();
		List<Product> list = new ArrayList<Product>();
		if (count > countArr[countArr.length - 1]) {
			pro.setCount(count);
			// 每平方20元
			pro.setPrice(Math.ceil(area * count * 20));
			list.add(pro);
		}
		for (int i = 0; i < countArr.length; i++) {
			if (countArr[i] < count) {
				continue;
			}
			pro = new Product();
			pro.setCount(countArr[i]);
			pro.setPrice(Math.ceil(priceArr[i]));
			list.add(pro);
		}
		return list;
	}

	public List<Product> acountPrice9xup(int count, Double area) {
		Product pro = new Product();
		List<Product> list = new ArrayList<Product>();
		double price = 0.0;
		if (count > countArr[countArr.length - 1]) {
			pro.setCount(count);
			pro.setPrice(Math.ceil(area * count * 20));
			list.add(pro);
		}
		for (int i = 0; i < countArr.length; i++) {
			if (countArr[i] < count) {
				continue;
			}
			if (area * countArr[i] <= 3) {
				price = 90;
			} else if (area * countArr[i] > 3 && area * countArr[i] <= 5) {
				price = 70;
			} else if (area * countArr[i] > 5 && area * countArr[i] <= 8) {
				price = 50;
			} else if (area * countArr[i] > 8 && area * countArr[i] <= 10) {
				price = 37;
			} else if (area * countArr[i] > 10 && area * countArr[i] <= 15) {
				price = 35;
			} else if (area * countArr[i] > 15 && area * countArr[i] <= 25) {
				price = 30;
			} else if (area * countArr[i] > 25 && area * countArr[i] <= 30) {
				price = 26;
			} else if (area * countArr[i] > 30 && area * countArr[i] <= 100) {
				price = 25;
			} else if (area * countArr[i] > 100 && area * count <= 500) {
				price = 22;
			} else {
				price = 20;
			}
			pro = new Product();
			pro.setCount(countArr[i]);
			pro.setPrice(Math.ceil(countArr[i] * area * price));
			list.add(pro);
		}
		return list;
	}

}
