package lingtao.net.util;

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

import lingtao.net.bean.Product;

/**
 * 画册价格
 */
public class PictureAlbumPrice {

	int countArr[] = { 500, 1000, 2000, 3000, 5000, 10000, };

	/**
	 * 不干胶大数量遍历添加价格
	 */
	private List<Product> acountPrice(int count, List<Product> list, double[] priceArr) {
		Product pro = new Product();
		if (count > countArr[countArr.length - 1]) {
			pro.setCount(count);
			pro.setPrice(Math.ceil(count * priceArr[countArr.length - 1] / countArr[countArr.length - 1]));
			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(priceArr[i]);
			list.add(pro);
		}
		return list;
	}

	/**
	 * 
	 * @param count
	 * @param pcount 内页P数（含封面4P）
	 * @return
	 */
	public List<Product> getPrice00(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		if (8 == pcount) {
			double priceArr[] = { 403, 551, 864, 1206, 1998, 3873 };
			list = acountPrice(count, list, priceArr);
		} else if (12 == pcount) {
			double priceArr[] = { 490, 673, 1082, 1523, 2505, 4827 };
			list = acountPrice(count, list, priceArr);
		} else if (16 == pcount) {
			double priceArr[] = { 579, 794, 1311, 1839, 3012, 5783 };
			list = acountPrice(count, list, priceArr);
		} else if (20 == pcount) {
			double priceArr[] = { 665, 917, 1542, 2156, 3519, 6737 };
			list = acountPrice(count, list, priceArr);
		} else if (24 == pcount) {
			double priceArr[] = { 752, 1053, 1772, 2472, 4026, 7691 };
			list = acountPrice(count, list, priceArr);
		} else if (28 == pcount) {
			double priceArr[] = { 842, 1188, 2001, 2787, 4533, 8648 };
			list = acountPrice(count, list, priceArr);
		} else if (32 == pcount) {
			double priceArr[] = { 929, 1323, 2232, 3104, 5040, 9602 };
			list = acountPrice(count, list, priceArr);
		} else if (36 == pcount) {
			double priceArr[] = { 1016, 1460, 2462, 3419, 5549, 10556 };
			list = acountPrice(count, list, priceArr);
		} else if (40 == pcount) {
			double priceArr[] = { 1106, 1596, 2691, 3735, 6056, 11510 };
			list = acountPrice(count, list, priceArr);
		} else if (44 == pcount) {
			double priceArr[] = { 1200, 1724, 2922, 4053, 6563, 12464 };
			list = acountPrice(count, list, priceArr);
		} else if (48 == pcount) {
			double priceArr[] = { 1295, 1866, 3152, 4368, 7070, 13419 };
			list = acountPrice(count, list, priceArr);
		} else if (52 == pcount) {
			double priceArr[] = { 1391, 2005, 3383, 4685, 7577, 14373 };
			list = acountPrice(count, list, priceArr);
		}
		return list;
	}

	public List<Product> getPrice01(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		if (8 == pcount) {
			double priceArr[] = { 436, 589, 927, 1296, 2135, 4146 };
			list = acountPrice(count, list, priceArr);
		} else if (12 == pcount) {
			double priceArr[] = { 558, 747, 1209, 1701, 2778, 5376 };
			list = acountPrice(count, list, priceArr);
		} else if (16 == pcount) {
			double priceArr[] = { 678, 906, 1505, 2103, 2420, 6605 };
			list = acountPrice(count, list, priceArr);
		} else if (20 == pcount) {
			double priceArr[] = { 802, 1066, 1799, 2508, 4064, 7832 };
			list = acountPrice(count, list, priceArr);
		} else if (24 == pcount) {
			double priceArr[] = { 922, 1239, 2094, 2913, 4707, 9062 };
			list = acountPrice(count, list, priceArr);
		} else if (28 == pcount) {
			double priceArr[] = { 1043, 1412, 2390, 3318, 5351, 10290 };
			list = acountPrice(count, list, priceArr);
		} else if (32 == pcount) {
			double priceArr[] = { 1165, 1586, 2684, 3722, 5994, 11517 };
			list = acountPrice(count, list, priceArr);
		} else if (36 == pcount) {
			double priceArr[] = { 1285, 1761, 2979, 4127, 6636, 12746 };
			list = acountPrice(count, list, priceArr);
		} else if (40 == pcount) {
			double priceArr[] = { 1409, 1932, 3273, 4532, 7280, 13976 };
			list = acountPrice(count, list, priceArr);
		} else if (44 == pcount) {
			double priceArr[] = { 1538, 2105, 3567, 4937, 7923, 15203 };
			list = acountPrice(count, list, priceArr);
		} else if (48 == pcount) {
			double priceArr[] = { 1665, 2279, 3861, 5340, 8567, 16431 };
			list = acountPrice(count, list, priceArr);
		} else if (52 == pcount) {
			double priceArr[] = { 1663, 2454, 4157, 5745, 9209, 17661 };
			list = acountPrice(count, list, priceArr);
		}
		return list;
	}

	public List<Product> getPrice02(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		if (8 == pcount) {
			double priceArr[] = { 455, 635, 975, 1382, 2274, 4409 };
			list = acountPrice(count, list, priceArr);
		} else if (12 == pcount) {
			double priceArr[] = { 597, 842, 1302, 1874, 3056, 5900 };
			list = acountPrice(count, list, priceArr);
		} else if (16 == pcount) {
			double priceArr[] = { 741, 1048, 1643, 2364, 3839, 7389 };
			list = acountPrice(count, list, priceArr);
		} else if (20 == pcount) {
			double priceArr[] = { 883, 1254, 1982, 2856, 4622, 8880 };
			list = acountPrice(count, list, priceArr);
		} else if (24 == pcount) {
			double priceArr[] = { 1026, 1473, 2324, 3348, 5403, 10371 };
			list = acountPrice(count, list, priceArr);
		} else if (28 == pcount) {
			double priceArr[] = { 1167, 1695, 2664, 3839, 6188, 11861 };
			list = acountPrice(count, list, priceArr);
		} else if (32 == pcount) {
			double priceArr[] = { 1308, 1912, 3005, 4329, 6971, 13352 };
			list = acountPrice(count, list, priceArr);
		} else if (36 == pcount) {
			double priceArr[] = { 1452, 2133, 3347, 4821, 7752, 14841 };
			list = acountPrice(count, list, priceArr);
		}
		return list;
	}

	/**
	 * ========285*210===========
	 */

	public List<Product> getPrice10(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		if (8 == pcount) {
			double priceArr[] = { 726, 1104, 1551, 2243, 3656, 7062 };
			list = acountPrice(count, list, priceArr);
		} else if (12 == pcount) {
			double priceArr[] = { 904, 1385, 1953, 2849, 4605, 8841 };
			list = acountPrice(count, list, priceArr);
		} else if (16 == pcount) {
			double priceArr[] = { 1084, 1666, 2373, 3453, 5555, 10622 };
			list = acountPrice(count, list, priceArr);
		} else if (20 == pcount) {
			double priceArr[] = { 1263, 1949, 2795, 4059, 6504, 12402 };
			list = acountPrice(count, list, priceArr);
		} else if (24 == pcount) {
			double priceArr[] = { 1443, 2252, 3215, 4664, 7454, 14181 };
			list = acountPrice(count, list, priceArr);
		} else if (28 == pcount) {
			double priceArr[] = { 1621, 2557, 3635, 5270, 8402, 15960 };
			list = acountPrice(count, list, priceArr);
		} else if (32 == pcount) {
			double priceArr[] = { 1800, 2860, 4055, 5874, 9351, 17741 };
			list = acountPrice(count, list, priceArr);
		} else if (36 == pcount) {
			double priceArr[] = { 2078, 2984, 4604, 6363, 10301, 19521 };
			list = acountPrice(count, list, priceArr);
		} else if (40 == pcount) {
			double priceArr[] = { 2271, 3301, 5037, 6956, 11250, 21299 };
			list = acountPrice(count, list, priceArr);
		} else if (44 == pcount) {
			double priceArr[] = { 2472, 3586, 5472, 7548, 12200, 23078 };
			list = acountPrice(count, list, priceArr);
		} else if (48 == pcount) {
			double priceArr[] = { 2675, 3868, 5906, 8144, 13149, 24858 };
			list = acountPrice(count, list, priceArr);
		} else if (52 == pcount) {
			double priceArr[] = { 2875, 4153, 5341, 8736, 14099, 26639 };
			list = acountPrice(count, list, priceArr);
		}
		return list;
	}

	public List<Product> getPrice11(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		if (8 == pcount) {
			double priceArr[] = { 723, 1076, 1665, 2372, 3929, 7610 };
			list = acountPrice(count, list, priceArr);
		} else if (12 == pcount) {
			double priceArr[] = { 947, 1404, 2180, 3107, 5150, 9938 };
			list = acountPrice(count, list, priceArr);
		} else if (16 == pcount) {
			double priceArr[] = { 1173, 1734, 2714, 3842, 6371, 12264 };
			list = acountPrice(count, list, priceArr);
		} else if (20 == pcount) {
			double priceArr[] = { 1398, 2063, 3248, 4575, 7592, 14592 };
			list = acountPrice(count, list, priceArr);
		} else if (24 == pcount) {
			double priceArr[] = { 1624, 2412, 3782, 5175, 8814, 16919 };
			list = acountPrice(count, list, priceArr);
		} else if (28 == pcount) {
			double priceArr[] = { 1848, 2760, 4316, 6044, 10035, 19247 };
			list = acountPrice(count, list, priceArr);
		} else if (32 == pcount) {
			double priceArr[] = { 2074, 3110, 4848, 6779, 11256, 21575 };
			list = acountPrice(count, list, priceArr);
		} else if (36 == pcount) {
			double priceArr[] = { 2429, 3345, 5639, 7778, 12479, 23901 };
			list = acountPrice(count, list, priceArr);
		} else if (40 == pcount) {
			double priceArr[] = { 2673, 3676, 6203, 8549, 13700, 26229 };
			list = acountPrice(count, list, priceArr);
		} else if (44 == pcount) {
			double priceArr[] = { 2922, 4010, 6765, 9318, 14921, 28557 };
			list = acountPrice(count, list, priceArr);
		} else if (48 == pcount) {
			double priceArr[] = { 3171, 4340, 7328, 10089, 16143, 30884 };
			list = acountPrice(count, list, priceArr);
		} else if (52 == pcount) {
			double priceArr[] = { 3422, 4673, 7892, 10859, 17364, 33212 };
			list = acountPrice(count, list, priceArr);
		}
		return list;
	}

	public List<Product> getPrice12(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		if (8 == pcount) {
			double priceArr[] = { 723, 1092, 1718, 2489, 4206, 8135 };
			list = acountPrice(count, list, priceArr);
		} else if (12 == pcount) {
			double priceArr[] = { 947, 1439, 2288, 3339, 5706, 10986 };
			list = acountPrice(count, list, priceArr);
		} else if (16 == pcount) {
			double priceArr[] = { 1173, 1785, 2874, 4191, 7206, 13838 };
			list = acountPrice(count, list, priceArr);
		} else if (20 == pcount) {
			double priceArr[] = { 1398, 2132, 3462, 5042, 8708, 16689 };
			list = acountPrice(count, list, priceArr);
		} else if (24 == pcount) {
			double priceArr[] = { 1624, 2498, 4049, 5892, 10209, 19539 };
			list = acountPrice(count, list, priceArr);
		} else if (28 == pcount) {
			double priceArr[] = { 1848, 2864, 4637, 6744, 11709, 22391 };
			list = acountPrice(count, list, priceArr);
		} else if (32 == pcount) {
			double priceArr[] = { 2074, 3231, 5223, 7595, 13209, 25242 };
			list = acountPrice(count, list, priceArr);
		} else if (36 == pcount) {
			double priceArr[] = { 2757, 4092, 6372, 9165, 14709, 28094 };
			list = acountPrice(count, list, priceArr);
		}
		return list;
	}

	/* ===============少数量相册================ */
	/**
	 * 
	 * @param count
	 * @param pcount 内页P数（含封面4P）
	 * @return
	 */
	public List<Product> getLessPrice(int count, int pcount) {
		List<Product> list = new ArrayList<Product>();
		Product pro = new Product();
		double price = 0;
		if (count <= 10) {
			price = pcount * count * 2;
		} else if (count <= 50) {
			price = pcount * count * 1.5;
		} else if (count <= 100) {
			price = pcount * count * 1;
		} else {
			price = pcount * count * 0.8;
		}
		price += count * 4;
		;
		pro.setCount(count);
		pro.setPrice(Math.ceil(price = price > 120 ? price : 120));
		list.add(pro);
		return list;
	}

}
