PosterPrice.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. package lingtao.net.util;
  2. import lingtao.net.bean.Product;
  3. import java.text.DecimalFormat;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. /**
  7. * 海报价格
  8. */
  9. public class PosterPrice {
  10. /**
  11. * 裱板
  12. *
  13. * @param kind2
  14. * @param area
  15. * @param count
  16. * @param number
  17. * @return
  18. */
  19. public List<Product> acountPrice00(String kind2, Double area, int count, Integer number) {
  20. double danjia = 0.0;
  21. // 最低收费
  22. double price = 0.0;
  23. String weight = "0";
  24. DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
  25. double areas = area;
  26. if (area < 40 * 50 / 10000.0) {
  27. areas = area * number;
  28. }
  29. double miniprice = 0;
  30. switch (kind2) {
  31. // 室内写真裱冷板
  32. case "0":
  33. // 根据面积得到单价
  34. if (area > 0 && area <= 5) {
  35. danjia = 64;
  36. } else if (area > 5 && area <= 10) {
  37. danjia = 60;
  38. } else {
  39. danjia = 52;
  40. }
  41. miniprice += 72;
  42. price = Math.max(areas * danjia, miniprice);
  43. break;
  44. // 室内写真对裱冷板
  45. case "1":
  46. // 根据面积得到单价
  47. if (area > 0 && area <= 5) {
  48. danjia = 90;
  49. } else if (area > 5 && area <= 10) {
  50. danjia = 85;
  51. } else {
  52. danjia = 80;
  53. }
  54. miniprice += 95;
  55. price = Math.max(areas * danjia, miniprice);
  56. break;
  57. // 室内写真裱冷板装小C边
  58. case "3":
  59. // 根据面积得到单价
  60. if (area > 0 && area <= 5) {
  61. danjia = 85;
  62. } else if (area > 5 && area <= 10) {
  63. danjia = 80;
  64. } else {
  65. danjia = 75;
  66. }
  67. miniprice += 90;
  68. price = Math.max(areas * danjia, miniprice);
  69. break;
  70. // 户外写真裱冷板
  71. case "6":
  72. // 根据面积得到单价
  73. if (area > 0 && area <= 5) {
  74. danjia = 85;
  75. } else if (area > 5 && area <= 10) {
  76. danjia = 80;
  77. } else {
  78. danjia = 75;
  79. }
  80. miniprice += 90;
  81. price = Math.max(areas * danjia, miniprice);
  82. break;
  83. // 户外写真对裱冷板
  84. case "7":
  85. // 根据面积得到单价
  86. if (area > 0 && area <= 5) {
  87. danjia = 95;
  88. } else if (area > 5 && area <= 10) {
  89. danjia = 90;
  90. } else {
  91. danjia = 85;
  92. }
  93. miniprice += 90;
  94. price = Math.max(areas * danjia, miniprice);
  95. break;
  96. // 户外写真裱冷板装小C边
  97. case "8":
  98. // 根据面积得到单价
  99. if (area > 0 && area <= 5) {
  100. danjia = 100;
  101. } else if (area > 5 && area <= 10) {
  102. danjia = 95;
  103. } else {
  104. danjia = 90;
  105. }
  106. miniprice += 90;
  107. price = Math.max(areas * danjia, miniprice);
  108. break;
  109. // 背胶单裱3mmPVC(户内高清)
  110. case "12":
  111. // 根据面积得到单价
  112. if (area > 0 && area <= 5) {
  113. danjia = 105;
  114. } else if (area > 5 && area <= 10) {
  115. danjia = 100;
  116. } else {
  117. danjia = 95;
  118. }
  119. miniprice += 105;
  120. price = Math.max(areas * danjia, miniprice);
  121. break;
  122. }
  123. Product pro = new Product();
  124. List<Product> list = new ArrayList<Product>();
  125. weight = String.valueOf(DecimalFormat.format(area * 0.2 * number));
  126. pro.setWeight(weight);
  127. pro.setCount(count);
  128. // 价格 = 面积 * 单价 + (款数-1) * 40
  129. if (number > 1 && area >= 40 * 50 / 10000.0) {
  130. pro.setPrice(Math.ceil(price * number));
  131. } else {
  132. pro.setPrice(Math.ceil(price));
  133. }
  134. list.add(pro);
  135. return list;
  136. }
  137. /**
  138. * 室内写真
  139. *
  140. * @param kind2
  141. * @param area
  142. * @param count
  143. * @param number
  144. * @return
  145. */
  146. public List<Product> acountPrice01(String kind2, Double area, int count, Integer number, double width, double length) {
  147. // 最低收费
  148. double price = 0.0;
  149. // 单价
  150. double danjia = 0.0;
  151. String weight = "0";
  152. DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
  153. double[] areas = {};
  154. double[] prices = {};
  155. double last_price = 0;
  156. double min_price = 0;
  157. switch (kind2) {
  158. // 高精室内写真
  159. case "2":
  160. areas = new double[]{2, 5, 10, 20, 50};
  161. prices = new double[]{50, 45, 32, 28, 25};
  162. last_price = 23;
  163. min_price += 50;
  164. // 根据面积得到单价
  165. break;
  166. // pp纸(室内)
  167. case "3":
  168. areas = new double[]{2, 5, 10};
  169. prices = new double[]{62, 45, 35};
  170. last_price = 28;
  171. min_price += 70;
  172. weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
  173. break;
  174. // 直喷PVC
  175. case "5":
  176. // 根据面积得到单价
  177. areas = new double[]{2, 5, 10};
  178. prices = new double[]{70, 55, 45};
  179. last_price = 40;
  180. min_price += 100;
  181. weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
  182. break;
  183. // 高精室内相纸
  184. case "6":
  185. // 根据面积得到单价
  186. areas = new double[]{2, 5, 10};
  187. prices = new double[]{70, 60, 45};
  188. last_price = 40;
  189. min_price += 90;
  190. break;
  191. // 单透
  192. case "7":
  193. // 根据面积得到单价
  194. areas = new double[]{2, 5, 10};
  195. prices = new double[]{75, 65, 55};
  196. last_price = 45;
  197. min_price += 100;
  198. break;
  199. // 静电贴
  200. case "8":
  201. // 根据面积得到单价
  202. areas = new double[]{1, 2, 5, 10};
  203. prices = new double[]{80, 68, 65, 63};
  204. last_price = 60;
  205. min_price += 50;
  206. break;
  207. // 软膜
  208. case "14":
  209. // 根据面积得到单价
  210. areas = new double[]{5, 10};
  211. prices = new double[]{70, 65};
  212. last_price = 60;
  213. min_price += 100;
  214. weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
  215. break;
  216. // 地贴(复防滑膜)
  217. case "15":
  218. // 根据面积得到单价
  219. areas = new double[]{5, 10};
  220. prices = new double[]{75, 65};
  221. last_price = 55;
  222. min_price += 100;
  223. weight = String.valueOf(DecimalFormat.format(area * 0.113 * number));
  224. break;
  225. // UV高透车贴(含白墨)
  226. case "16":
  227. // 根据面积得到单价
  228. areas = new double[]{5, 10};
  229. prices = new double[]{160, 150};
  230. last_price = 140;
  231. min_price += 160;
  232. break;
  233. // UV高透车贴(不含白墨)
  234. case "17":
  235. // 根据面积得到单价
  236. areas = new double[]{5, 10};
  237. prices = new double[]{150, 140};
  238. last_price = 130;
  239. min_price += 160;
  240. break;
  241. // 高透贴
  242. case "18":
  243. // 根据面积得到单价
  244. areas = new double[]{5, 10};
  245. prices = new double[]{110, 100};
  246. last_price = 90;
  247. min_price += 130;
  248. break;
  249. // 防撞条腰线UV透明喷膜(含白墨)
  250. case "19":
  251. // 根据面积得到单价
  252. areas = new double[]{5, 10};
  253. prices = new double[]{130, 130};
  254. last_price = 110;
  255. min_price += 80;
  256. break;
  257. // 防撞条腰线UV磨砂贴(含白墨)
  258. case "20":
  259. // 根据面积得到单价
  260. areas = new double[]{5, 10};
  261. prices = new double[]{140, 130};
  262. last_price = 120;
  263. min_price += 80;
  264. break;
  265. // 防撞条腰线粗哑膜磨砂贴(不含白墨)
  266. case "21":
  267. // 根据面积得到单价
  268. areas = new double[]{5, 10};
  269. prices = new double[]{115, 105};
  270. last_price = 100;
  271. min_price += 80;
  272. break;
  273. // 防撞条腰线磨砂镂空(粗哑膜刻字)
  274. case "22":
  275. // 根据面积得到单价
  276. areas = new double[]{5, 10};
  277. prices = new double[]{150, 140};
  278. last_price = 130;
  279. min_price += 100;
  280. break;
  281. // 防撞条腰线即时贴刻字
  282. case "23":
  283. // 根据面积得到单价
  284. areas = new double[]{5, 10};
  285. prices = new double[]{120, 110};
  286. last_price = 100;
  287. min_price += 70;
  288. break;
  289. case "24":
  290. price = area * 380 > 380 + 15 ? area * 380 : 380 + 15;
  291. break;
  292. }
  293. if (!"24".equals(kind2)) {
  294. double area_jis = area;
  295. if (width * length < 40 * 50) {
  296. area_jis = area_jis * number;
  297. }
  298. // if ("8".equals(kind2) && width * length < 40 * 50) {
  299. // price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
  300. // } else {
  301. danjia = last_price;
  302. for (int i = 0; i < areas.length; i++) {
  303. if (area <= areas[i]) {
  304. danjia = prices[i];
  305. break;
  306. }
  307. }
  308. price = Math.max(area_jis * danjia, min_price);
  309. // }
  310. }
  311. Product pro = new Product();
  312. List<Product> list = new ArrayList<Product>();
  313. pro.setCount(count);
  314. // 价格 = 面积 * 单价 + (款数-1) * 40
  315. if (number > 1 && width * length >= 40 * 50) {
  316. pro.setPrice(Math.ceil(price * number));
  317. } else {
  318. pro.setPrice(Math.ceil(price));
  319. }
  320. pro.setWeight(weight);
  321. list.add(pro);
  322. return list;
  323. }
  324. /**
  325. * 户外写真
  326. *
  327. * @param kind2
  328. * @param area
  329. * @param count
  330. * @param number
  331. * @return
  332. */
  333. public List<Product> acountPrice02(String kind2, Double area, int count, Integer number, double width, double length) {
  334. double price = 0.0;
  335. double danjia = 0.0;
  336. String weight = "0";
  337. DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
  338. double[] areas = {};
  339. double[] prices = {};
  340. double last_price = 0;
  341. double min_price = 0;
  342. switch (kind2) {
  343. // 户外写真白胶(国产)
  344. case "0":
  345. areas = new double[]{2, 5, 7, 8, 10, 20, 50};
  346. prices = new double[]{50, 40, 35, 32, 26, 24, 22};
  347. last_price = 26;
  348. min_price += 50 -5;
  349. // 根据面积得到单价
  350. weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
  351. break;
  352. // 户外写真黑胶(国产)
  353. case "1":
  354. // 根据面积得到单价
  355. areas = new double[]{2, 5, 7, 8, 10, 20, 50};
  356. prices = new double[]{50, 40, 35, 32, 26, 24, 22};
  357. last_price = 26;
  358. min_price += 50 - 5;
  359. weight = String.valueOf(DecimalFormat.format(area * 0.25 * number));
  360. break;
  361. // 户外写真可移白胶、黑胶
  362. case "2":
  363. // 根据面积得到单价
  364. areas = new double[]{2, 5, 10,};
  365. prices = new double[]{60, 55, 50};
  366. last_price = 35;
  367. min_price += 50 + 15;
  368. weight = String.valueOf(DecimalFormat.format(area * 0.14 * number));
  369. break;
  370. // 户外写真喷膜
  371. case "3":
  372. // 根据面积得到单价
  373. areas = new double[]{2, 5, 10,};
  374. prices = new double[]{65, 50, 45};
  375. last_price = 35;
  376. min_price += 80;
  377. break;
  378. // 户外写真灯片
  379. case "5":
  380. // 根据面积得到单价
  381. areas = new double[]{2, 5, 10,};
  382. prices = new double[]{68, 50, 40};
  383. last_price = 30;
  384. min_price += 90;
  385. break;
  386. // 车贴(白胶)
  387. case "6":
  388. // 根据面积得到单价
  389. areas = new double[]{2, 5, 10,};
  390. prices = new double[]{50, 40, 30};
  391. last_price = 25;
  392. min_price += 80;
  393. weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
  394. break;
  395. }
  396. if (width * length < 40 * 50) {
  397. price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
  398. } else {
  399. danjia = last_price;
  400. for (int i = 0; i < areas.length; i++) {
  401. if (area <= areas[i]) {
  402. danjia = prices[i];
  403. break;
  404. }
  405. }
  406. price = Math.max(area * danjia, min_price);
  407. }
  408. Product pro = new Product();
  409. List<Product> list = new ArrayList<Product>();
  410. pro.setCount(count);
  411. // 价格 = 面积 * 单价 + (款数-1) * 40
  412. if (number > 1 && width * length >= 40 * 50) {
  413. pro.setPrice(Math.ceil(price * number));
  414. } else {
  415. pro.setPrice(Math.ceil(price));
  416. }
  417. pro.setWeight(weight);
  418. list.add(pro);
  419. return list;
  420. }
  421. /**
  422. * 布
  423. *
  424. * @param kind2
  425. * @param area
  426. * @param length
  427. * @param width
  428. * @param count
  429. * @param number
  430. * @param craftBu
  431. * @return
  432. */
  433. public List<Product> acountPrice03(String kind2, Double length, Double width, Double area, int count,
  434. Integer number, String craftBu) {
  435. double price = 0.0;
  436. double danjia = 0.0;
  437. double[] areas = {};
  438. double[] prices = {};
  439. double last_price = 0;
  440. double min_price = 0;
  441. switch (kind2) {
  442. // 550灯布
  443. case "1":
  444. // 根据面积得到单价
  445. areas = new double[]{5, 10,};
  446. prices = new double[]{30, 28};
  447. last_price = 25;
  448. min_price = 60;
  449. break;
  450. // 黑底布
  451. case "2":
  452. // 根据面积得到单价
  453. areas = new double[]{5, 10,};
  454. prices = new double[]{40, 34};
  455. last_price = 30;
  456. min_price = 70;
  457. break;
  458. // 写真布
  459. case "6":
  460. // 根据面积得到单价
  461. areas = new double[]{2, 5, 10,};
  462. prices = new double[]{30, 28, 25};
  463. last_price = 23;
  464. min_price = 50 + 15;
  465. break;
  466. // 双喷布
  467. case "7":
  468. Product pro = new Product();
  469. List<Product> list = new ArrayList<Product>();
  470. double minSize = Math.min(length, width);
  471. double maxSize = Math.max(length, width);
  472. area = length * width * count * number;
  473. /*if (count == 1) {
  474. if (minSize < 1.52) {
  475. minSize = 1.52;
  476. area = maxSize * minSize * count * number;
  477. }
  478. }*/
  479. // 根据宽得到单价
  480. if (minSize <= 1.52) {
  481. danjia = 50;
  482. } else {
  483. danjia = 65;
  484. }
  485. price = area * danjia > 50 + 15 ? area * danjia : 50 + 15;
  486. // 挂轴 每米12元
  487. if ("挂轴".equals(craftBu)) {
  488. price = price + (maxSize * 12 > 12 ? maxSize * 12 : 12);
  489. }
  490. pro.setCount(count);
  491. // 价格 = 面积 * 单价 + 款数 * 20
  492. pro.setPrice(Math.ceil(price + number * 20));
  493. list.add(pro);
  494. return list;
  495. // 油画布
  496. case "8":
  497. // 根据面积得到单价
  498. areas = new double[]{2, 5, 10,};
  499. prices = new double[]{80, 75, 60};
  500. last_price = 35;
  501. min_price = 130;
  502. break;
  503. // 墙纸
  504. case "9":
  505. // 根据面积得到单价
  506. areas = new double[]{2, 5, 10,};
  507. prices = new double[]{70, 60, 50};
  508. last_price = 35;
  509. min_price = 105;
  510. break;
  511. // 旗帜布
  512. case "10":
  513. // 根据面积得到单价
  514. if ("双喷".equals(craftBu)) {
  515. if ((width == 50 && length == 300 || length == 50 && width == 300) && count == 1) {
  516. price = 53;
  517. } else if (area <= 1) {
  518. price = 53;
  519. } else if (area <= 2) {
  520. price = 43 * area;
  521. } else if (area <= 3) {
  522. price = 38 * area;
  523. } else if (area <= 4) {
  524. price = 33 * area;
  525. } else if (area <= 5) {
  526. price = 31 * area;
  527. } else if (area <= 10) {
  528. price = 28 * area;
  529. } else {
  530. price = 25 * area;
  531. }
  532. } else {
  533. if ((width == 50 && length == 300) && (length == 50 && width == 300) && count == 1) {
  534. price = 50;
  535. } else if (area <= 1) {
  536. price = 50;
  537. } else if (area <= 2) {
  538. price = 40 * area;
  539. } else if (area <= 3) {
  540. price = 35 * area;
  541. } else if (area <= 4) {
  542. price = 33 * area;
  543. } else if (area <= 5) {
  544. price = 28 * area;
  545. } else if (area <= 10) {
  546. price = 25 * area;
  547. } else {
  548. price = 23 * area;
  549. }
  550. }
  551. /*if (area > 0 && area <= 3) {
  552. danjia = 20;
  553. } else if (area > 3 && area <= 5) {
  554. danjia = 19;
  555. } else if (area > 5 && area <= 10) {
  556. danjia = 18;
  557. } else {
  558. danjia = 17;
  559. }
  560. if(area < 1.5) {
  561. price = area * danjia + (count * 10) > 35 ? area * danjia + (count * 10) : 35;
  562. }else {
  563. price = area * danjia * count > 35 ? area * danjia * count : 35;
  564. }*/
  565. break;
  566. }
  567. if (!"7".equals(kind2) && !"10".equals(kind2)) {
  568. if (width * length < 40 * 50) {
  569. price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
  570. } else {
  571. danjia = last_price;
  572. for (int i = 0; i < areas.length; i++) {
  573. if (area <= areas[i]) {
  574. danjia = prices[i];
  575. break;
  576. }
  577. }
  578. price = Math.max(area * danjia, min_price);
  579. }
  580. }
  581. Product pro = new Product();
  582. List<Product> list = new ArrayList<Product>();
  583. pro.setCount(count);
  584. if (!"7".equals(kind2) && !"10".equals(kind2)) {
  585. if (number > 1 && width * length >= 40 * 50) {
  586. pro.setPrice(Math.ceil(price * number));
  587. } else {
  588. pro.setPrice(Math.ceil(price));
  589. }
  590. } else {
  591. pro.setPrice(Math.ceil(price * number));
  592. }
  593. list.add(pro);
  594. return list;
  595. }
  596. /**
  597. * 展架
  598. *
  599. * @param kind2
  600. * @param count
  601. * @param number
  602. * @return
  603. */
  604. public List<Product> acountPrice04(String kind2, int count, Integer number) {
  605. double price = 0.0;
  606. String weight = "0";
  607. DecimalFormat DecimalFormat = new DecimalFormat("#.#####");
  608. switch (kind2) {
  609. // 直喷PVC装美式展架180*80
  610. case "0":
  611. price = 120;
  612. break;
  613. // 直喷PVC装美式展架160*60
  614. case "1":
  615. price = 115;
  616. break;
  617. // PP纸装美式展架180*80
  618. case "2":
  619. price = 115;
  620. break;
  621. // PP纸装美式展架160*60
  622. case "3":
  623. price = 110;
  624. break;
  625. // 直喷PVC装门型展架180*80
  626. case "4":
  627. price = 158;
  628. break;
  629. // PP纸装门型展架180*80
  630. case "6":
  631. price = 140;
  632. break;
  633. // PP纸装门型展架160*60
  634. case "7":
  635. price = 135;
  636. break;
  637. // X展架180*80(不含画面)
  638. case "8":
  639. price = 55;
  640. break;
  641. // X展架160*60(不含画面)
  642. case "9":
  643. price = 50;
  644. break;
  645. // 门型展架180*80(不含画面)
  646. case "10":
  647. price = 75;
  648. break;
  649. // 门型展架160*60(不含画面)
  650. case "11":
  651. price = 70;
  652. break;
  653. // 直喷pvc铝合金易拉宝
  654. case "12":
  655. price = 108;
  656. break;
  657. // 直喷pvc塑钢易拉宝
  658. case "13":
  659. price = 118;
  660. break;
  661. }
  662. Product pro = new Product();
  663. List<Product> list = new ArrayList<Product>();
  664. pro.setCount(count);
  665. // 价格 = 个数 * 款数 * 单价 ===================+ (款数-1) * 40
  666. pro.setPrice(Math.ceil(count * number * price));// + (number - 1) * 40
  667. list.add(pro);
  668. return list;
  669. }
  670. }