PriceUtils.java 131 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587
  1. package lingtao.net.util;
  2. import lingtao.net.bean.Product;
  3. import org.springframework.util.StringUtils;
  4. import java.text.DecimalFormat;
  5. import java.util.ArrayList;
  6. import java.util.Arrays;
  7. import java.util.List;
  8. public class PriceUtils {
  9. DecimalFormat df = new DecimalFormat("0.00");
  10. int countArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000};
  11. /**
  12. * 卷标标签价格
  13. *
  14. * @param kind
  15. * @param area
  16. * @param count
  17. * @param craft
  18. * @param tang
  19. * @param yinbai
  20. * @return
  21. */
  22. public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices) {
  23. List<Product> list = new ArrayList<Product>();
  24. Product pro = new Product();
  25. // 最低收费
  26. double lowerPrice = 0.0;
  27. // 印工价格
  28. double yinrPrice = 0.0;
  29. // 平方单价
  30. double danjia = 0.0;
  31. // 总价
  32. double price = 0.0;
  33. // 根据报的尺寸、数量算面积(保留2位小数)
  34. area = Double.valueOf(df.format(area * count));
  35. if (area <= 20) {
  36. yinrPrice = 260;
  37. lowerPrice = 550;
  38. } else if (area <= 150) {
  39. yinrPrice = 300;
  40. lowerPrice = 600;
  41. }
  42. switch (kind) {
  43. /**
  44. * 0:格底铜版纸卷标 1:格底PP合成纸 2:8丝光白PVC 3:5丝格底透明 4:格底哑金/哑银 5:格底银平光 6:单防热敏纸(底纸白色)
  45. * 7:三防热敏纸(底纸蓝色)
  46. */
  47. case "0":
  48. // 根据面积得到单价
  49. if (area <= 20) {
  50. danjia = 8;
  51. } else if (area <= 150) {
  52. danjia = 8;
  53. } else if (area <= 200) {
  54. danjia = 10.5;
  55. } else {
  56. danjia = 10.3;
  57. }
  58. break;
  59. case "1":
  60. // 根据面积得到单价
  61. if (area <= 20) {
  62. danjia = 10;
  63. } else if (area <= 150) {
  64. danjia = 10;
  65. } else if (area <= 200) {
  66. danjia = 12.5;
  67. } else {
  68. danjia = 12.3;
  69. }
  70. break;
  71. case "2":
  72. // 根据面积得到单价
  73. if (area <= 20) {
  74. danjia = 10;
  75. } else if (area <= 150) {
  76. danjia = 10;
  77. } else if (area <= 200) {
  78. danjia = 12.5;
  79. } else {
  80. danjia = 12.3;
  81. }
  82. break;
  83. case "3":
  84. // 根据面积得到单价
  85. if (area <= 20) {
  86. danjia = 10;
  87. } else if (area <= 150) {
  88. danjia = 10;
  89. } else if (area <= 200) {
  90. danjia = 12.5;
  91. } else {
  92. danjia = 12.3;
  93. }
  94. break;
  95. case "4":
  96. // 根据面积得到单价
  97. if (area <= 20) {
  98. danjia = 12;
  99. } else if (area <= 150) {
  100. danjia = 12;
  101. } else if (area <= 200) {
  102. danjia = 15;
  103. } else {
  104. danjia = 14.8;
  105. }
  106. break;
  107. case "5":
  108. // 根据面积得到单价
  109. if (area <= 20) {
  110. danjia = 12;
  111. } else if (area <= 150) {
  112. danjia = 12;
  113. } else if (area <= 200) {
  114. danjia = 15;
  115. } else {
  116. danjia = 14.8;
  117. }
  118. break;
  119. case "6":
  120. // 根据面积得到单价
  121. if (area <= 20) {
  122. danjia = 9;
  123. } else if (area <= 150) {
  124. danjia = 9;
  125. } else if (area <= 200) {
  126. danjia = 11;
  127. } else {
  128. danjia = 10.8;
  129. }
  130. break;
  131. case "7":
  132. // 根据面积得到单价
  133. if (area <= 20) {
  134. danjia = 9.5;
  135. } else if (area <= 150) {
  136. danjia = 9.5;
  137. } else if (area <= 200) {
  138. danjia = 11.5;
  139. } else {
  140. danjia = 11.3;
  141. }
  142. break;
  143. }
  144. // 加上覆膜的价格 (覆哑膜/亮膜 0.6元/平方, 镭射膜1元/平方)
  145. if (!StringUtils.isEmpty(craft)) {
  146. if ("大雪花镭射膜".equals(craft[0])) {
  147. danjia = danjia + 1;
  148. } else if ("覆哑膜".equals(craft[0])) {
  149. danjia = danjia + 0.8;
  150. } else {
  151. danjia = danjia + 0.6;
  152. }
  153. }
  154. price = Math.ceil(Math.max(area * danjia + yinrPrice + count * 0.01, lowerPrice));
  155. // 如果有印白工艺:2元一平方,最低收费200元
  156. if (!StringUtils.isEmpty(yinbai)) {
  157. price = price + (area * 2 > 200 ? area * 2 : 200);
  158. }
  159. double tang_price = 0;
  160. if (!StringUtils.isEmpty(tang) && "烫金".equals(tang)) {
  161. int[] bigCountArr = {500, 1000, 2000, 3000, 5000, 10000};
  162. for (int i = 0; i < bigCountArr.length; i++) {
  163. if (count >= bigCountArr[i]) {
  164. tang_price = price + tangPrices[i];
  165. }
  166. }
  167. }
  168. pro.setCount(count);
  169. pro.setPrice(Math.max(tang_price, price));
  170. list.add(pro);
  171. /*
  172. * for (int i = 0; i < countArr.length; i++) { if (countArr[i] < count) {
  173. * continue; } if (countArr[i] * area <= 150) { danjia = 15; } else if
  174. * (countArr[i] * area <= 200) { danjia = 14.5; } else { danjia = 14; } if
  175. * (!StringUtils.isEmpty(craft)) { if (!"大雪花镭射膜".equals(craft[0])) { danjia =
  176. * danjia + 1; } else { danjia = danjia + 0.6; } } pro = new Product();
  177. * pro.setCount(countArr[i]); pro.setPrice(Math.ceil(countArr[i] * area * danjia
  178. * > 550 ? countArr[i] * area * danjia : 550)); list.add(pro); }
  179. */
  180. return list;
  181. }
  182. /**
  183. * 合版封套自定义尺寸
  184. *
  185. * @param kind
  186. * @param count
  187. * @param min
  188. * @param priceArr
  189. * @return
  190. */
  191. public List<Product> getEnvelope(String kind, int count, int min, int[] priceArr) {
  192. int countArr[] = {200, 500, 1000, 2000, 5000, 10000};
  193. List<Product> list = new ArrayList<Product>();
  194. Product pro = new Product();
  195. for (int i = 0; i < countArr.length; i++) {
  196. if (countArr[i] < count || list.size() > 3) {
  197. continue;
  198. }
  199. pro = new Product();
  200. pro.setCount(countArr[i]);
  201. pro.setPrice(Math.ceil(min * priceArr[i] + 80 + 0.05 * countArr[i] + 30 + 0.06 * countArr[i]));
  202. list.add(pro);
  203. }
  204. return list;
  205. }
  206. /**
  207. * 房卡套特殊尺寸
  208. *
  209. * @param count
  210. * @param min
  211. * @return
  212. */
  213. public List<Product> getRoomCard(int count, int min) {
  214. int countArr[] = {200, 500, 1000, 2000, 5000, 10000};
  215. int priceArr[] = {40, 50, 70, 90, 160, 300};
  216. List<Product> list = new ArrayList<Product>();
  217. Product pro = new Product();
  218. for (int i = 0; i < countArr.length; i++) {
  219. if (countArr[i] < count) {
  220. continue;
  221. }
  222. pro = new Product();
  223. pro.setCount(countArr[i]);
  224. pro.setPrice(Math.ceil(min * priceArr[i] + 0.05 * countArr[i] + 60 + 30 + 0.06 * countArr[i]));
  225. list.add(pro);
  226. }
  227. return list;
  228. }
  229. /**
  230. * 打印不干胶带纯烫金价格
  231. *
  232. * @param kind
  233. * @param addPrice
  234. * @param yinbai
  235. */
  236. public Product getA(String kind, Double width, Double length, int count, double price, double addPrice,
  237. Integer number, String craftTang, String yinbai) {
  238. //List<Product> list = new ArrayList<Product>();
  239. if ("印白墨".equals(yinbai)) {
  240. price = 50;
  241. addPrice = 30;
  242. } else if ("黑白".equals(yinbai)) {
  243. price = 40;
  244. }
  245. double l = 425;
  246. double w = 285;
  247. if ("0".equals(kind) || "4".equals(kind)) {
  248. l = 430;
  249. w = 290;
  250. }
  251. // 哑金不干胶
  252. if ("5".equals(kind)) {
  253. l = 390;
  254. w = 270;
  255. }
  256. Product pro = new Product();
  257. // 数量*款数就是张数
  258. count = count * number;
  259. // 换成毫米每边+2
  260. length = length * 10 + 4;
  261. width = width * 10 + 4;
  262. if ((length > l || width > w) && (length > w || width > l))
  263. return null;
  264. // 一张大纸能做多少个此类尺寸的不干胶
  265. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  266. Math.floor(l / width) * Math.floor(w / length));
  267. // 报的数量需要多少张大纸
  268. int num = (int) Math.ceil(count / max);
  269. price = price + (num - 1) * addPrice;
  270. if ("纯烫金".equals(craftTang) || "彩色印刷+烫金/银".equals(craftTang)) {
  271. // 一张纸张价格+大纸张数*addPrice + 每张烫金+20块(1张起收)(5*5cm内30元一张)
  272. if (width < 54 && length < 54) {
  273. price += num * 60;
  274. } else {
  275. price += num * 40;
  276. }
  277. }
  278. if ("彩色印刷+烫金/银".equals(craftTang)) {
  279. price = price > 80 ? price : 80;
  280. }
  281. // if ("印白墨".equals(yinbai)) {
  282. // // 透明不干胶,印白墨工艺,每张大纸+20(1张起收)
  283. // price = price + num * 20;
  284. // }
  285. // if(number > 1) {
  286. // price = price + (number - 1) * 15;
  287. // }
  288. pro.setCount(count / number);
  289. pro.setPrice(Math.ceil(price));
  290. return pro;
  291. }
  292. /**
  293. * 哑银不干胶价格
  294. *
  295. * @param kind
  296. * @param addPrice
  297. * @param yinbai
  298. */
  299. public List<Product> getYy(String kind, Double width, Double length, int count, double price, double addPrice,
  300. Integer number, String craftTang, String yinbai) {
  301. List<Product> list = new ArrayList<Product>();
  302. double l = 420;
  303. double w = 285;
  304. // 换成毫米每边+2
  305. length = length * 10 + 4;
  306. width = width * 10 + 4;
  307. if ((length > l || width > w) && (length > w || width > l))
  308. return null;
  309. // 一张大纸能做多少个此类尺寸的不干胶
  310. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  311. Math.floor(l / width) * Math.floor(w / length));
  312. for (int i = 0; i < countArr.length; i++) {
  313. if (countArr[i] < count) {
  314. continue;
  315. }
  316. if ("印白墨".equals(yinbai)) {
  317. price = 50;
  318. addPrice = 30;
  319. }
  320. Product pro = new Product();
  321. // 数量*款数就是张数
  322. count = countArr[i] * number;
  323. // 报的数量需要多少张大纸
  324. int num = (int) Math.ceil(count / max);
  325. if ("纯烫金".equals(craftTang)) {
  326. // 一张纸张价格+大纸张数*addPrice + 每张烫金+20块(1张起收)(5*5cm内30元一张)
  327. if (width < 54 && length < 54) {
  328. price = price + (num - 1) * addPrice + num * 30;
  329. } else {
  330. price = price + (num - 1) * addPrice + num * 20;
  331. }
  332. } else if ("彩色印刷+烫金/银".equals(craftTang)) {
  333. if (width <= 154 && length <= 154) {
  334. price = price + (count * 0.15 + 200 > 200 ? count * 0.15 + 200 : 200);
  335. } else if (width > 154 || length > 154) {
  336. price = price + (count * 0.13 + 180 > 210 ? count * 0.13 + 180 : 210);
  337. }
  338. } else {
  339. price = price + (num - 1) * addPrice;
  340. }
  341. if (number > 1) {
  342. price = price + (number - 1) * 5;
  343. }
  344. // if ("印白墨".equals(yinbai)) {
  345. // // 透明不干胶,印白墨工艺,每张大纸+20(1张起收)
  346. // price = price + num * 20;
  347. // }
  348. pro.setCount(count / number);
  349. /*if (length == 14.0 && width == 14.0) {
  350. price = price * 2;
  351. }*/
  352. pro.setPrice(Math.ceil(price));
  353. list.add(pro);
  354. }
  355. return list;
  356. }
  357. // 不干胶常规数量美纹纸价格计算
  358. public List<Product> getMeiWenZhiPrice(Double length, Double width, int count, Integer number, String craftMo) {
  359. List<Product> priceList = new ArrayList<>();
  360. int[][] prices = new int[][]{
  361. {79, 107, 134, 272, 343, 685, 1030, 1374, 1787, 2322, 2748, 3302, 4351},
  362. {84, 112, 139, 277, 348, 690, 1035, 1379, 1792, 2327, 2753, 3307, 4356},
  363. {161, 222, 278, 553, 690, 1377, 2065, 2748, 3584, 4653, 5505, 6614, 8712},
  364. {318, 443, 552, 1101, 1377, 2753, 4119, 5475, 7128, 9108, 10613, 12435, 13068},
  365. {475, 661, 828, 1652, 2066, 4129, 6178, 8213, 10692, 13662, 15920, 18652, 19602},
  366. {788, 1099, 1380, 2743, 3430, 6856, 10272, 13613, 17721, 22275, 25542, 29700, 32670},
  367. {1575, 2188, 2747, 5485, 6859, 13712, 20543, 27225, 35442, 44550, 51084, 59400, 65340},
  368. {3150, 4355, 5494, 10930, 13662, 27324, 40887, 54054, 69894, 87120, 99000, 114444, 121968},
  369. };
  370. int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000, 20000};
  371. double[] areas = new double[]{26, 37, 49.6, 82, 127, 171, 231, 295, 361, 451, 600.5, 902, 1199};
  372. double area = length * width;
  373. for (int i = 0; i < count_list.length; i++) {
  374. int count_item = count_list[i];
  375. if (priceList.size() > 2) {
  376. break;
  377. }
  378. if (count > count_item) {
  379. continue;
  380. }
  381. int count_index = Arrays.binarySearch(count_list, count_item);
  382. double price = 0;
  383. if (count_index >= 0) {
  384. price = new PriceUtils().TablePrice(area, prices[count_index], areas);
  385. }
  386. Product product = new Product();
  387. product.setCount(count_item);
  388. product.setPrice(Math.ceil(price));
  389. priceList.add(product);
  390. }
  391. return priceList;
  392. }
  393. /**
  394. * 插卡遍历添加价格
  395. */
  396. private List<Product> acountInsertCardPrice(int count, List<Product> list, Double[] priceArr) {
  397. int countArr[] = {200, 500, 1000, 2000, 3000, 5000, 10000};
  398. Product pro;
  399. for (int i = 0; i < countArr.length; i++) {
  400. if (countArr[i] < count) {
  401. continue;
  402. }
  403. pro = new Product();
  404. pro.setCount(countArr[i]);
  405. pro.setPrice(priceArr[i]);
  406. list.add(pro);
  407. }
  408. return list;
  409. }
  410. /**
  411. * 菱形单面直角插排
  412. */
  413. public List<Product> getInsertCard(String size, int count) {
  414. List<Product> list = new ArrayList<>();
  415. if ("4.5*4.5".equals(size)) {
  416. Double priceArr[] = {40.0, 50.0, 80.0, 120.0, 160.0, 270.0, 480.0};
  417. list = acountInsertCardPrice(count, list, priceArr);
  418. } else if ("5*5".equals(size)) {
  419. Double priceArr[] = {50.0, 60.0, 80.0, 130.0, 140.0, 300.0, 520.0};
  420. list = acountInsertCardPrice(count, list, priceArr);
  421. } else {
  422. Double priceArr[] = {40.0, 50.0, 70.0, 110.0, 160.0, 260.0, 480.0};
  423. list = acountInsertCardPrice(count, list, priceArr);
  424. }
  425. return list;
  426. }
  427. // 9*5.4cm(一个名片位)以内价格
  428. public List<Product> oneCradPrice(int count) {
  429. List<Product> list = new ArrayList<Product>();
  430. Product pro = new Product();
  431. int countArr[] = {1000, 2000, 5000, 10000, 20000};
  432. int priceArr[] = {70, 110, 250, 500, 900};
  433. if (count <= 20000) {
  434. for (int i = 0; i < countArr.length; i++) {
  435. if (countArr[i] < count || list.size() > 3) {
  436. continue;
  437. }
  438. pro = new Product();
  439. pro.setCount(countArr[i]);
  440. pro.setPrice(Math.ceil(priceArr[i]));
  441. list.add(pro);
  442. }
  443. } else {
  444. pro = new Product();
  445. pro.setCount(count);
  446. pro.setPrice(Math.ceil(count * 0.045));
  447. list.add(pro);
  448. }
  449. return list;
  450. }
  451. /**
  452. * 普通吊牌/服装吊牌 300/350克直角打孔吊牌价格
  453. *
  454. * @param dto
  455. * @param width
  456. * @param length
  457. * @param count
  458. * @param priceList
  459. * @return
  460. */
  461. public List<Product> tags300PriceCraftZhi(Product dto, Double width, Double length, int count,
  462. List<Product> priceList) {
  463. double l1;
  464. double w1;
  465. double l2;
  466. double w2;
  467. int min;
  468. l1 = Math.ceil(length / 9);
  469. w1 = Math.ceil(width / 5.4);
  470. l2 = Math.ceil(width / 9);
  471. w2 = Math.ceil(length / 5.4);
  472. // 产品位数
  473. min = (int) Math.min(l1 * w1, l2 * w2);
  474. if (min == 1) {
  475. double priceArr[] = {43, 52, 70, 110, 186, 242, 250, 500};
  476. priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  477. } else if (min == 2) {
  478. double priceArr[] = {48, 70, 75, 110, 180, 230, 270, 520};
  479. priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  480. } else if (min == 3) {
  481. double priceArr[] = {68, 93, 155, 276, 369, 484, 578, 1111};
  482. priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  483. } else if (min == 4) {
  484. double priceArr[] = {80, 100, 186, 333, 496, 617, 736, 1417};
  485. priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  486. }
  487. if (min > 1) {
  488. for (Product product : priceList) {
  489. product.setPrice(Math.floor(product.getPrice() * 0.98));
  490. }
  491. }
  492. if ("不覆膜".equals(dto.getCraftMo())) {
  493. for (Product product : priceList) {
  494. product.setPrice(Math.floor(product.getPrice() * 0.98));
  495. }
  496. }
  497. // 300克的模切材质才有第二尺寸
  498. // 第二尺寸不为空
  499. if (!StringUtils.isEmpty(dto.getSize1())) {
  500. String size1 = dto.getSize1();
  501. Double length1 = null;
  502. Double width1 = null;
  503. List<Product> priceListSecond = new ArrayList<Product>();
  504. length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
  505. if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
  506. width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
  507. } else {
  508. width1 = Double
  509. .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
  510. }
  511. length1 = Math.abs(length1);
  512. width1 = Math.abs(width1);
  513. l1 = Math.ceil(length1 / 9);
  514. w1 = Math.ceil(width1 / 5.4);
  515. l2 = Math.ceil(width1 / 9);
  516. w2 = Math.ceil(length1 / 5.4);
  517. // 产品位数
  518. min = (int) Math.min(l1 * w1, l2 * w2);
  519. if (min == 1) {
  520. double priceArr[] = {43, 52, 72, 128, 186, 242, 276, 526};
  521. priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  522. } else if (min == 2) {
  523. double priceArr[] = {48, 78, 110, 202, 283, 351, 419, 805};
  524. priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  525. } else if (min == 3) {
  526. double priceArr[] = {68, 93, 155, 276, 369, 484, 578, 1111};
  527. priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  528. } else if (min == 4) {
  529. double priceArr[] = {80, 100, 186, 333, 496, 617, 736, 1417};
  530. priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
  531. }
  532. if (min > 1) {
  533. for (Product product : priceListSecond) {
  534. product.setPrice(Math.floor(product.getPrice() * 0.98));
  535. }
  536. }
  537. if ("不覆膜".equals(dto.getCraftMo())) {
  538. for (Product product : priceListSecond) {
  539. product.setPrice(Math.floor(product.getPrice() * 0.98));
  540. }
  541. }
  542. // 如果俩个价格一样,后一位价格+10
  543. for (int i = 0; i < priceListSecond.size() - 1; i++) {
  544. if (priceListSecond.get(i).getPrice().equals(priceListSecond.get(i + 1).getPrice())) {
  545. priceListSecond.get(i + 1).setPrice(priceListSecond.get(i + 1).getPrice() + 10);
  546. }
  547. }
  548. // 俩个尺寸的价格相加 再*0.96
  549. for (int i = 0; i < priceList.size(); i++) {
  550. priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
  551. }
  552. }
  553. return priceList;
  554. }
  555. /**
  556. * 吊牌300克直角打孔价格计算
  557. */
  558. public List<Product> acountTags300PriceCraftZhi(int count, double[] priceArr) {
  559. int countArr[] = {200, 500, 1000, 2000, 3000, 4000, 5000, 10000};
  560. List<Product> list = new ArrayList<>();
  561. Product pro = new Product();
  562. for (int i = 0; i < countArr.length; i++) {
  563. if (countArr[i] < count || list.size() > 3) {
  564. continue;
  565. }
  566. pro = new Product();
  567. pro.setCount(countArr[i]);
  568. pro.setPrice(priceArr[i]);
  569. list.add(pro);
  570. }
  571. return list;
  572. }
  573. /**
  574. * 其他吊牌300克 异形模切价格
  575. *
  576. * @param dto
  577. * @param number
  578. * @param width
  579. * @param length
  580. * @param area
  581. * @param count
  582. * @param priceList
  583. * @return
  584. */
  585. public List<Product> tags300PriceCraftMo(Product dto, Integer number, Double width, Double length, Double area,
  586. int count, List<Product> priceList) {
  587. if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
  588. length = 9.0;
  589. width = 5.4;
  590. area = length * width / 10000;
  591. }
  592. List<Product> priceList2 = new ArrayList<Product>();
  593. // 有工艺(覆膜)
  594. if ("双面覆哑膜".equals(dto.getCraftMo())) {
  595. double priceArr[] = {27, 18, 15, 14, 14, 14};
  596. priceList = new PriceUtils().acountTags300PriceCraftMo(area, count, number, priceArr);
  597. priceList2 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
  598. } else if ("不覆膜".equals(dto.getCraftMo())) {
  599. double priceArr[] = {26, 17, 14, 13, 13, 13};
  600. priceList = new PriceUtils().acountTags300PriceCraftMo(area, count, number, priceArr);
  601. priceList2 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
  602. }
  603. // 自定义尺寸和固定尺寸对比价格。
  604. for (int i = 0; i < priceList.size(); i++) {
  605. for (int j = 0; j < priceList2.size(); j++) {
  606. if (priceList.get(j).getPrice() < priceList2.get(j).getPrice()) {
  607. priceList.get(j).setPrice(priceList2.get(j).getPrice() + 5);
  608. }
  609. }
  610. }
  611. // 第二尺寸不为空
  612. if (!StringUtils.isEmpty(dto.getSize1())) {
  613. String size1 = dto.getSize1();
  614. Double length1 = null;
  615. Double width1 = null;
  616. Double area1 = null;
  617. List<Product> priceListSecond = new ArrayList<Product>();
  618. length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
  619. if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
  620. width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
  621. } else {
  622. width1 = Double
  623. .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
  624. }
  625. length1 = Math.abs(length1);
  626. width1 = Math.abs(width1);
  627. if (((length1 <= 9 && width1 <= 5.4) || (length1 <= 5.4 && width1 <= 9))) {
  628. length1 = 9.0;
  629. width1 = 5.4;
  630. area1 = length1 * width1 / 10000;
  631. }
  632. List<Product> priceList3 = new ArrayList<Product>();
  633. // 有工艺(覆膜)
  634. if ("双面覆哑膜".equals(dto.getCraftMo())) {
  635. double priceArr[] = {27, 18, 15, 14, 14, 14};
  636. priceListSecond = new PriceUtils().acountTags300PriceCraftMo(area1, count, number, priceArr);
  637. priceList3 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
  638. } else if ("不覆膜".equals(dto.getCraftMo())) {
  639. double priceArr[] = {26, 17, 14, 13, 13, 13};
  640. priceListSecond = new PriceUtils().acountTags300PriceCraftMo(area1, count, number, priceArr);
  641. priceList3 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
  642. }
  643. // 自定义尺寸和固定尺寸对比价格。
  644. for (int i = 0; i < priceListSecond.size(); i++) {
  645. for (int j = 0; j < priceList3.size(); j++) {
  646. if (priceListSecond.get(j).getPrice() < priceList3.get(j).getPrice()) {
  647. priceListSecond.get(j).setPrice(priceList3.get(j).getPrice() + 5);
  648. }
  649. }
  650. }
  651. // 俩个尺寸的价格相加 再*0.96
  652. for (int i = 0; i < priceList.size(); i++) {
  653. priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
  654. }
  655. }
  656. return priceList;
  657. }
  658. /**
  659. * 其他吊牌300克异形模切价格计算===》 不复膜的 计算方法:长*宽*数量500张*22+每款设计费7元+绳子10元
  660. *
  661. * @param area
  662. * @param count
  663. * @param number
  664. * @param priceArr
  665. * @return
  666. */
  667. public List<Product> acountTags300PriceCraftMo(Double area, int count, Integer number, double[] priceArr) {
  668. int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
  669. // 数量大于1万,单独报价;
  670. List<Product> list = new ArrayList<>();
  671. Product pro = new Product();
  672. // 设计费 7元/款
  673. double designFee = 7;
  674. // 绳子 1分5一条
  675. double shengzi = 0.015;
  676. if (count > 10000) {
  677. pro.setCount(count);
  678. pro.setPrice(Math.ceil(area * count * priceArr[priceArr.length - 1] + designFee + count * shengzi));
  679. list.add(pro);
  680. } else {
  681. for (int i = 0; i < countArr.length; i++) {
  682. if (countArr[i] < count || list.size() > 3) {
  683. continue;
  684. }
  685. pro = new Product();
  686. pro.setCount(countArr[i]);
  687. pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + designFee + countArr[i] * shengzi));
  688. list.add(pro);
  689. }
  690. }
  691. return list;
  692. }
  693. /**
  694. * 服装吊牌 300克异形模切价格
  695. *
  696. * @param dto
  697. * @param number
  698. * @param width
  699. * @param length
  700. * @param area
  701. * @param count
  702. * @param priceList
  703. * @return
  704. */
  705. public List<Product> tagClothes300PriceCraftMo(Product dto, Integer number, Double width, Double length, Double area, int count, List<Product> priceList) {
  706. if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
  707. priceList = new PriceUtils().oneCradPrice(count);
  708. if ("不覆膜".equals(dto.getCraftMo())) {
  709. for (Product product : priceList) {
  710. product.setPrice(Math.floor(product.getPrice() * 0.98));
  711. }
  712. }
  713. } else {
  714. // 有工艺(覆膜)
  715. if ("双面覆哑膜".equals(dto.getCraftMo())) {
  716. double priceArr[] = {18, 15, 14, 14};
  717. // double priceArr[] = { 13, 12, 11.5, 10 };
  718. priceList = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
  719. } else if ("不覆膜".equals(dto.getCraftMo())) {
  720. double priceArr[] = {17, 14, 13, 13};
  721. // double priceArr[] = { 12, 11, 10.5, 9 };
  722. priceList = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
  723. }
  724. // 对比固定价格
  725. /*List<Product> priceList2 = new PriceUtils().oneCradPrice(count);
  726. if ("不覆膜".equals(dto.getCraftMo())) {
  727. for (Product product : priceList2) {
  728. product.setPrice(Math.floor(product.getPrice() * 0.98));
  729. }
  730. }*/
  731. /*for (int i = 0; i < priceList.size(); i++) {
  732. for (int j = 0; j < priceList2.size(); j++) {
  733. if (priceList.get(j).getPrice() < priceList2.get(j).getPrice()) {
  734. priceList.get(j).setPrice(priceList2.get(j).getPrice() + 10);
  735. }
  736. }
  737. }*/
  738. // 末尾变成0
  739. /*for (Product product : priceList) {
  740. product.setPrice(product.getPrice() - product.getPrice() % 10);
  741. }*/
  742. // 如果俩个价格一样,后一位价格+10
  743. for (int i = 0; i < priceList.size() - 1; i++) {
  744. if (priceList.get(i).getPrice().equals(priceList.get(i + 1).getPrice())) {
  745. priceList.get(i + 1).setPrice(priceList.get(i + 1).getPrice() + 10);
  746. }
  747. if (width == 6 && length == 6 && priceList.get(i).getCount() == 1000) {
  748. priceList.get(i).setPrice(priceList.get(i).getPrice() + 8);
  749. }
  750. }
  751. }
  752. // 300克的材质才有第二尺寸
  753. // 第二尺寸不为空
  754. if (!StringUtils.isEmpty(dto.getSize1())) {
  755. String size1 = dto.getSize1();
  756. Double length1 = null;
  757. Double width1 = null;
  758. List<Product> priceListSecond = new ArrayList<Product>();
  759. length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
  760. if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
  761. width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
  762. } else {
  763. width1 = Double
  764. .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
  765. }
  766. length1 = Math.abs(length1);
  767. width1 = Math.abs(width1);
  768. double area1 = length1 * width1 / 10000;
  769. if (((length1 <= 10.5 && width1 <= 5.5) || (length1 <= 5.5 && width1 <= 10.5))) {
  770. priceListSecond = new PriceUtils().oneCradPrice(count);
  771. if ("不覆膜".equals(dto.getCraftMo())) {
  772. for (Product product : priceListSecond) {
  773. product.setPrice(Math.floor(product.getPrice() * 0.98));
  774. }
  775. }
  776. } else {
  777. // 有工艺(覆膜)
  778. if ("双面覆哑膜".equals(dto.getCraftMo())) {
  779. double priceArr[] = {18, 15, 14, 14};
  780. // double priceArr[] = { 13, 12, 11.5, 10 };
  781. priceListSecond = new PriceUtils().acountTagClothes300PriceCraftMo(area1, count, number, priceArr);
  782. } else if ("不覆膜".equals(dto.getCraftMo())) {
  783. double priceArr[] = {17, 14, 13, 13};
  784. priceListSecond = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
  785. }
  786. // 对比固定价格
  787. List<Product> priceList2 = new PriceUtils().oneCradPrice(count);
  788. if ("不覆膜".equals(dto.getCraftMo())) {
  789. for (Product product : priceList2) {
  790. product.setPrice(Math.floor(product.getPrice() * 0.98));
  791. }
  792. }
  793. for (int i = 0; i < priceListSecond.size(); i++) {
  794. for (int j = 0; j < priceList2.size(); j++) {
  795. if (priceListSecond.get(j).getPrice() < priceList2.get(j).getPrice()) {
  796. priceListSecond.get(j).setPrice(priceList2.get(j).getPrice() + 10);
  797. }
  798. }
  799. }
  800. // 末尾变成0
  801. for (Product product : priceListSecond) {
  802. product.setPrice(product.getPrice() - product.getPrice() % 10);
  803. }
  804. // 如果俩个价格一样,后一位价格+10
  805. for (int i = 0; i < priceListSecond.size() - 1; i++) {
  806. if (priceListSecond.get(i).getPrice().equals(priceListSecond.get(i + 1).getPrice())) {
  807. priceListSecond.get(i + 1).setPrice(priceListSecond.get(i + 1).getPrice() + 10);
  808. }
  809. }
  810. }
  811. // 俩个尺寸的价格相加 再*0.96
  812. for (int i = 0; i < priceList.size(); i++) {
  813. priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
  814. }
  815. }
  816. return priceList;
  817. }
  818. /**
  819. * 服装吊牌300克异形模切价格计算===》 不复膜的 计算方法:长*宽*数量500张*22+每款设计费7元+绳子10元
  820. *
  821. * @param area
  822. * @param count
  823. * @param number
  824. * @param priceArr
  825. * @return
  826. */
  827. public List<Product> acountTagClothes300PriceCraftMo(Double area, int count, Integer number, double[] priceArr) {
  828. int countArr[] = {1000, 2000, 5000, 10000};
  829. // 数量大于1万,单独报价;
  830. List<Product> list = new ArrayList<>();
  831. Product pro = new Product();
  832. // 设计费 7元/款
  833. double designFee = 7;
  834. // 绳子 1分5一条
  835. double shengzi = 0.015;
  836. if (count > 10000) {
  837. pro.setCount(count);
  838. pro.setPrice(Math.ceil(area * count * priceArr[priceArr.length - 1] + number * designFee));
  839. list.add(pro);
  840. } else {
  841. for (int i = 0; i < countArr.length; i++) {
  842. if (countArr[i] < count || list.size() > 3) {
  843. continue;
  844. }
  845. pro = new Product();
  846. pro.setCount(countArr[i]);
  847. /* pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + number * designFee
  848. + countArr[i] * shengzi));*/
  849. pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + designFee));
  850. list.add(pro);
  851. }
  852. }
  853. return list;
  854. }
  855. /**
  856. * 600克 吊牌
  857. *
  858. * @param dto
  859. * @param kind
  860. * @param kind2
  861. * @param area
  862. * @param count
  863. * @return
  864. */
  865. public List<Product> tags600Price(Product dto, String kind, String kind2, Double area, int count) {
  866. List<Product> priceList;
  867. priceList = new PriceUtils().getTag600PriceFirst(kind, kind2, area, count, true);
  868. // 600克的材质才有第二尺寸
  869. // 第二尺寸不为空
  870. if (!StringUtils.isEmpty(dto.getSize1())) {
  871. String size1 = dto.getSize1();
  872. Double length1 = null;
  873. Double width1 = null;
  874. List<Product> priceList2 = new ArrayList<Product>();
  875. length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
  876. if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
  877. width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
  878. } else {
  879. width1 = Double
  880. .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
  881. }
  882. length1 = Math.abs(length1);
  883. width1 = Math.abs(width1);
  884. double area1 = length1 * width1 / 10000;
  885. priceList2 = new PriceUtils().getTag600PriceFirst(kind, kind2, area1, count, false);
  886. // 俩个尺寸的价格相加
  887. for (int i = 0; i < priceList.size(); i++) {
  888. priceList.get(i).setPrice((priceList.get(i).getPrice() + priceList2.get(i).getPrice()) * 0.95);
  889. }
  890. }
  891. return priceList;
  892. }
  893. /**
  894. * 吊牌600/800克自定义尺寸价格
  895. *
  896. * @param kind 600克/800克
  897. * @param kind2 种类
  898. * @param area 单个产品的面积
  899. * @param count 报的数量
  900. * @param flag 是否要加绳子费用
  901. * @return
  902. */
  903. public List<Product> getTag600PriceFirst(String kind, String kind2, double area, int count, boolean flag) {
  904. // 数量大于1万,单独报价;
  905. if (count > 10000) {
  906. return null;
  907. }
  908. List<Product> list = new ArrayList<>();
  909. double shengzi = 0;
  910. if ("4".equals(kind)) {
  911. if ("无".equals(kind2)) {
  912. double priceArr[] = {50, 34, 27, 27, 26, 25};
  913. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  914. } else if ("单面烫黄金".equals(kind2)) {
  915. double priceArr[] = {68, 48, 37, 36, 35, 34};
  916. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  917. } else if ("击凸".equals(kind2) || "压凹".equals(kind2)) {
  918. double priceArr[] = {75, 50, 40, 40, 39, 38};
  919. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  920. } else if ("单面烫黄金+凹凸".equals(kind2)) {
  921. double priceArr[] = {93, 63, 48, 48, 47, 46};
  922. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  923. }
  924. }
  925. if ("6".equals(kind)) {
  926. if ("无".equals(kind2)) {
  927. double price = 0;
  928. int[][] prices = {
  929. {144, 148, 166, 188, 193, 210, 232, 249, 251, 273, 317, 392, 464, 476, 674, 1028, 1802},
  930. {228, 238, 248, 255, 256, 258, 260, 268, 270, 278, 322, 397, 469, 481, 679, 1033, 1807},
  931. {330, 345, 350, 380, 386, 390, 420, 428, 430, 465, 538, 665, 780, 800, 1108, 1665, 2920},
  932. {480, 520, 530, 560, 568, 580, 591, 629, 633, 686, 791, 971, 1141, 1170, 1644, 2486, 4329},
  933. {800, 820, 860, 870, 880, 900, 955, 1016, 1023, 1107, 1276, 1563, 1838, 1885, 2645, 3997, 6955},
  934. {1400, 1430, 1450, 1527, 1560, 1690, 1852, 1969, 1982, 2145, 2470, 3022, 3549, 3640, 5102, 7702, 13390}
  935. };
  936. int[] count_list = {500, 1000, 2000, 3000, 5000, 10000};
  937. double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.6, 49, 54, 64, 81, 97.2, 100, 145.8, 225, 400};
  938. for (int i = 0; i < count_list.length; i++) {
  939. int count_item = count_list[i];
  940. if (list.size() > 2) {
  941. break;
  942. }
  943. if (count > count_item) {
  944. continue;
  945. }
  946. int count_index = Arrays.binarySearch(count_list, count_item);
  947. price = 0;
  948. if (count_index >= 0) {
  949. price = new PriceUtils().TablePrice(area * 10000, prices[count_index], areas);
  950. }
  951. Product product = new Product();
  952. product.setCount(count_item);
  953. product.setPrice(Math.ceil(price));
  954. list.add(product);
  955. }
  956. } else if ("单面烫黄金".equals(kind2)) {
  957. double priceArr[] = {68, 48, 37, 36, 35, 34};
  958. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  959. } else if ("击凸".equals(kind2) || "压凹".equals(kind2)) {
  960. double priceArr[] = {75, 50, 40, 40, 39, 38};
  961. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  962. } else if ("单面烫黄金+凹凸".equals(kind2)) {
  963. double priceArr[] = {93, 63, 48, 48, 47, 46};
  964. list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
  965. }
  966. }
  967. return list;
  968. }
  969. /**
  970. * 吊牌600/800克价格计算
  971. *
  972. * @param area
  973. * @param count
  974. * @param priceArr
  975. * @param shengzi
  976. * @param flag
  977. * @return
  978. */
  979. private List<Product> acountTag600Price(double area, int count, double[] priceArr, double shengzi, boolean flag,
  980. List<Product> list) {
  981. int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
  982. Product pro = new Product();
  983. for (int i = 0; i < countArr.length; i++) {
  984. if (countArr[i] < count || list.size() > 3) {
  985. continue;
  986. }
  987. if (countArr[i] == 500) {
  988. continue;
  989. }
  990. pro = new Product();
  991. if (countArr[i] == 500) {
  992. shengzi = 20;
  993. } else if (countArr[i] == 1000) {
  994. shengzi = 30;
  995. } else if (countArr[i] == 2000) {
  996. shengzi = 50;
  997. } else {
  998. shengzi = 0.03;
  999. }
  1000. pro.setCount(countArr[i]);
  1001. if (flag) {
  1002. pro.setPrice(
  1003. Math.ceil(area * countArr[i] * priceArr[i] + (shengzi > 1 ? shengzi : shengzi * countArr[i])));
  1004. } else {
  1005. pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i]));
  1006. }
  1007. list.add(pro);
  1008. }
  1009. return list;
  1010. }
  1011. /**
  1012. * 异形杯套价格计算
  1013. *
  1014. * @param count
  1015. * @return
  1016. */
  1017. public List<Product> getCupSetPrice(int count) {
  1018. List<Product> list = new ArrayList<>();
  1019. Product pro = new Product();
  1020. int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
  1021. double priceArr[] = {700, 780, 820, 900, 1300, 1800};
  1022. if (count <= 10000) {
  1023. for (int i = 0; i < countArr.length; i++) {
  1024. if (countArr[i] < count) {
  1025. continue;
  1026. }
  1027. pro = new Product();
  1028. pro.setCount(countArr[i]);
  1029. pro.setPrice(priceArr[i]);
  1030. list.add(pro);
  1031. }
  1032. } else {
  1033. pro = new Product();
  1034. pro.setCount(count);
  1035. pro.setPrice(Math.ceil(count * 0.25));
  1036. list.add(pro);
  1037. }
  1038. return list;
  1039. }
  1040. /**
  1041. * 手提袋价格计算
  1042. *
  1043. * @param
  1044. * @param kai 产品开数
  1045. * @return 报价:〔数量除以开数+*纸张《正度或者大度》+印工〔1千印X内150元,每超出1千印另加50元计算》+固定刀版收费200元+粘成品工钱.3*数量(小于200元按2⑾0元算〉〉*.5备注:以上报价展开尺寸最大为1000*700KM超出这个尺寸按以上报价*2倍计算
  1046. */
  1047. public List<Product> getPriceHanding(int count, int kai, double price, double m) {
  1048. List<Product> list = new ArrayList<>();
  1049. int countArr[] = {500, 1000, 2000, 4000, 10000, 20000, 30000};
  1050. Product pro = new Product();
  1051. if (count >= 100) {
  1052. if (count < 670) {
  1053. pro.setCount(count);
  1054. pro.setPrice(Math.ceil((count / kai * price + 150 + 200 + 200) * m));
  1055. list.add(pro);
  1056. } else {
  1057. pro.setCount(count);
  1058. pro.setPrice(Math.ceil(
  1059. (count / kai * price + (150 + Math.ceil((count - 1000) / 1000) * 50) + 200 + count * 0.3) * m));
  1060. list.add(pro);
  1061. }
  1062. }
  1063. for (int i = 0; i < countArr.length; i++) {
  1064. if (countArr[i] < count || countArr[i] == list.get(0).getCount()) {
  1065. continue;
  1066. }
  1067. pro = new Product();
  1068. pro.setCount(countArr[i]);
  1069. if (countArr[i] == 500) {
  1070. pro.setPrice(Math.ceil(
  1071. (countArr[i] / kai * price + (150 + Math.ceil((countArr[i] - 1000) / 1000) * 50) + 200 + 200)
  1072. * m));
  1073. } else {
  1074. pro.setPrice(Math.ceil((countArr[i] / kai * price + (150 + Math.ceil((countArr[i] - 1000) / 1000) * 50)
  1075. + 200 + countArr[i] * 0.3) * m));
  1076. }
  1077. list.add(pro);
  1078. }
  1079. return list;
  1080. }
  1081. /**
  1082. * 计算手提袋大度开数
  1083. *
  1084. * @param length
  1085. * @param width
  1086. * @return
  1087. */
  1088. public static String getDa(double length, double width) {
  1089. double l1 = Math.floor(1194 / length);
  1090. double w1 = Math.floor(889 / width);
  1091. double l2 = Math.floor(1194 / width);
  1092. double w2 = Math.floor(889 / length);
  1093. int maxDa = (int) Math.max(l1 * w1, l2 * w2);
  1094. if (w1 != 2) {
  1095. return "" + maxDa;
  1096. } else {
  1097. double ll1 = Math.floor(length / length);
  1098. double ww1 = Math.floor(889 / width);
  1099. double ll2 = Math.floor(length / width);
  1100. double ww2 = Math.floor(889 / length);
  1101. int maxxa = (int) Math.max(ll1 * ww1, ll2 * ww2);
  1102. double lll1 = Math.floor((1194 - length) / length);
  1103. double www1 = Math.floor(889 / width);
  1104. double lll2 = Math.floor(length / width);
  1105. double www2 = Math.floor(889 / length);
  1106. int maxxb = (int) Math.max(lll1 * www1, lll2 * www2);
  1107. maxDa = maxxb + maxxa;
  1108. return "" + maxDa;
  1109. }
  1110. }
  1111. /**
  1112. * 正度开数
  1113. *
  1114. * @param length
  1115. * @param width
  1116. * @return
  1117. */
  1118. public static String getZheng(double length, double width) {
  1119. double l1 = Math.floor(1092 / length);
  1120. double w1 = Math.floor(787 / width);
  1121. double l2 = Math.floor(1092 / width);
  1122. double w2 = Math.floor(787 / length);
  1123. int maxZheng = (int) Math.max(l1 * w1, l2 * w2);
  1124. if (w1 != 2) {
  1125. return "+" + maxZheng;
  1126. } else {
  1127. double ll1 = Math.floor(length / length);
  1128. double ww1 = Math.floor(787 / width);
  1129. double ll2 = Math.floor(length / width);
  1130. double ww2 = Math.floor(787 / length);
  1131. int maxxa = (int) Math.max(ll1 * ww1, ll2 * ww2);
  1132. double lll1 = Math.floor((1092 - length) / length);
  1133. double www1 = Math.floor(787 / width);
  1134. double lll2 = Math.floor(length / width);
  1135. double www2 = Math.floor(787 / length);
  1136. int maxxb = (int) Math.max(lll1 * www1, lll2 * www2);
  1137. maxZheng = maxxb + maxxa;
  1138. return "" + maxZheng;
  1139. }
  1140. }
  1141. /**
  1142. * 金属标价格计算 ===>最大印刷面积290*190MM 成品尺寸一边加1.5MM 算大张要几张 起步价90元
  1143. * 10张以内不含10张100+25*(数量-2) 20张以内 数量*24 30张以内 数量*22 超过30张*20
  1144. *
  1145. * @param list
  1146. * @param width
  1147. * @param length
  1148. * @param count
  1149. * @param number
  1150. * @return
  1151. */
  1152. public List<Product> getMetalPrice(List<Product> list, Double width, Double length, int count, Integer number) {
  1153. /*if (length == 1) {
  1154. length = 2.0;
  1155. }
  1156. if (width == 1) {
  1157. width = 2.0;
  1158. }*/
  1159. // 最大尺寸29*19cm ,加出血一边5mm
  1160. double l = 295;
  1161. double w = 195;
  1162. Product pro = new Product();
  1163. // 第一张大纸价格
  1164. double price = 0;
  1165. // 换成毫米每边+3
  1166. length = length * 10 + 2 * 1.5;
  1167. width = width * 10 + 2 * 1.5;
  1168. // 数量*款数就是张数
  1169. // count = count * number;
  1170. if ((length > l || width > w) && (length > w || width > l))
  1171. return null;
  1172. // 一张大纸29*19cm 能做多少个此类尺寸的金属标
  1173. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  1174. Math.floor(l / width) * Math.floor(w / length));
  1175. // 报的数量需要多少张大纸
  1176. int num = (int) Math.ceil((count * number) / max);
  1177. int numUnit = (int) Math.ceil((count) / max);
  1178. boolean isNumnber = false;
  1179. if (numUnit == 1) {
  1180. isNumnber = true;
  1181. }
  1182. double mulit = 1;
  1183. /*
  1184. * if (num > 2) { price = price + 25 * (num - 2); }
  1185. */
  1186. double design = 0;
  1187. if (!isNumnber) {
  1188. if (numUnit <= 2) {
  1189. price = 80;
  1190. } else if (numUnit < 6) {
  1191. price = 80 + 24 * (numUnit - 2);
  1192. } else if (numUnit < 10) {
  1193. price = 80 + 23 * (numUnit - 2);
  1194. } else if (numUnit < 16) {
  1195. price = 80 + 21 * (numUnit - 2);
  1196. } else if (numUnit < 30) {
  1197. price = 200 + 12 * (numUnit - 2);
  1198. } else if (numUnit < 51) {
  1199. price = 280 + 9 * (numUnit - 2);
  1200. } else if (numUnit < 100) {
  1201. price = Math.ceil((numUnit * 9) / 0.64);
  1202. } else if (numUnit < 300) {
  1203. price = Math.ceil((numUnit * 9) / 0.645);
  1204. } else {
  1205. price = Math.ceil((numUnit * 9) / 0.646);
  1206. }
  1207. mulit = number;
  1208. } else {
  1209. price = 80;
  1210. mulit = Math.ceil(num / numUnit);
  1211. }
  1212. price = Math.ceil(price * mulit);
  1213. pro.setCount(count);
  1214. pro.setPrice(Math.ceil(price + design));
  1215. float d = (float) num / (float) 30;
  1216. if (number > 1) {
  1217. d = d * number;
  1218. }
  1219. pro.setWeight(String.valueOf(df.format(d)));
  1220. list.add(pro);
  1221. return list;
  1222. }
  1223. /**
  1224. * UV转印贴
  1225. *
  1226. * @param area
  1227. * @param type
  1228. * @return
  1229. */
  1230. private double f_getUvPrice(double area, int type) {//根据面积获取价格
  1231. double price = 0, lastPrice = 0;
  1232. double areaArr[] = {0.1, 0.12, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 3, 5, 7, 9, 10, 20, 50, 100, 200, 500, 1000, 5000};
  1233. double priceArr[] = {450, 420, 400, 380, 360, 340, 300, 225, 200, 175, 170, 150, 145, 125, 120, 110, 100, 90, 80, 70};
  1234. double lessPriceArr[] = {215, 215, 215, 215, 215, 215, 215, 200, 170, 160, 150, 140, 135, 115, 110, 100, 90, 80, 70, 60};
  1235. double areaArrSmall[] = {0.03, 0.1};
  1236. double priceArrSmall[] = {30, 50};
  1237. for (int i = 0; i < areaArr.length; i++) {
  1238. if (areaArr[i] < area) {
  1239. continue;
  1240. }
  1241. if (i > 0) {
  1242. if (type == 2) {
  1243. lastPrice = Math.ceil(lessPriceArr[i - 1] * areaArr[i - 1]);
  1244. } else {
  1245. lastPrice = Math.ceil(priceArr[i - 1] * areaArr[i - 1]);
  1246. }
  1247. }
  1248. if (type == 2) {
  1249. price = Math.ceil(lessPriceArr[i] * area);
  1250. } else {
  1251. price = Math.ceil(priceArr[i] * area);
  1252. }
  1253. if (lastPrice > price) {
  1254. price = lastPrice;
  1255. }
  1256. break;
  1257. }
  1258. if (type == 3) {
  1259. for (int i = 0; i < areaArrSmall.length; i++) {
  1260. if (areaArrSmall[i] < area) {
  1261. continue;
  1262. }
  1263. if (i > 0) {
  1264. lastPrice = Math.ceil(priceArrSmall[i - 1]);
  1265. }
  1266. price = Math.ceil(priceArrSmall[i]);
  1267. if (lastPrice > price) {
  1268. price = lastPrice;
  1269. }
  1270. break;
  1271. }
  1272. }
  1273. //最低价65
  1274. if (price == 0) {
  1275. price = 65 * area;
  1276. }
  1277. return price;
  1278. }
  1279. public List<Product> UVStickerPrice(double length, double width, int count, int number, String yinse, String[] zhuan) {
  1280. List<Product> list = new ArrayList<Product>();
  1281. int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
  1282. Product pro;
  1283. int oldCount = count;
  1284. int isInArr = 0;
  1285. double price = 0, mqPrice = 0, lastPrice;
  1286. if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))
  1287. && count < 100) {
  1288. // if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
  1289. // 烫金100个起
  1290. count = 100;
  1291. }
  1292. double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
  1293. if (!StringUtils.isEmpty(zhuan)) {
  1294. //工艺价格另算
  1295. area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
  1296. }
  1297. double lastArea = 0;
  1298. int index = Arrays.binarySearch(countArr, oldCount);
  1299. if (index >= 0) {
  1300. isInArr = 1;
  1301. }
  1302. if (isInArr != 1) {
  1303. price = f_getUvPrice(area, 1);
  1304. price = price > 45 ? price : 45;
  1305. if (area <= 0.2) {
  1306. mqPrice = count * 0.05;
  1307. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1308. Math.ceil(price += mqPrice);
  1309. }
  1310. if (!StringUtils.isEmpty(zhuan)) {
  1311. if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
  1312. // 起步价+58元
  1313. price = price + (40 * area);
  1314. price = price > 80 ? price : 80;
  1315. } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
  1316. // 起步价+58元
  1317. price = price + (45 * area);
  1318. price = price > 103 ? price : 103;
  1319. } else if ("双面贴".equals(zhuan[0])) {
  1320. price = price + (40 * area);
  1321. price = price > 80 ? price : 80;
  1322. }
  1323. }
  1324. pro = new Product();
  1325. pro.setPrice(Math.ceil(price));
  1326. pro.setWeight(String.valueOf(df.format(area)));
  1327. pro.setCount(oldCount);
  1328. list.add(pro);
  1329. }
  1330. for (int i = 0; i < countArr.length; i++) {
  1331. if (countArr[i] < count) {
  1332. continue;
  1333. }
  1334. if (list.size() > 2) {
  1335. break;
  1336. } else {
  1337. area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000 * number;
  1338. if (i > 0) {
  1339. lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000 * number;
  1340. }
  1341. if (!StringUtils.isEmpty(zhuan)) {
  1342. //工艺价格另算
  1343. area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000;
  1344. if (i > 0) {
  1345. lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000;
  1346. }
  1347. }
  1348. // 报价面积,平方米(加一边3mm出血)
  1349. price = f_getUvPrice(area, 1);
  1350. price = price > 45 ? price : 45;
  1351. lastPrice = f_getUvPrice(lastArea, 1);
  1352. if (area <= 0.2) {
  1353. mqPrice = countArr[i] * 0.05;
  1354. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1355. Math.ceil(price += mqPrice);
  1356. }
  1357. if (lastArea <= 0.2 && i > 0) {
  1358. mqPrice = countArr[i - 1] * 0.05;
  1359. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1360. Math.ceil(lastPrice += mqPrice);
  1361. }
  1362. if (area > 0.1) {
  1363. if (lastPrice >= price) {//判断上一个尺寸
  1364. price = Math.ceil(lastPrice * 1.1);
  1365. }
  1366. }
  1367. if (!StringUtils.isEmpty(zhuan)) {
  1368. if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
  1369. // 起步价+58元
  1370. price = price + (40 * area);
  1371. price = price > 80 ? price : 80;
  1372. // lastPrice = lastPrice + (45 * area);
  1373. // lastPrice = lastPrice > 103 ? lastPrice : 103;
  1374. } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
  1375. // 起步价+58元
  1376. price = price + (45 * area);
  1377. price = price > 103 ? price : 103;
  1378. // lastPrice = lastPrice + (45 * area);
  1379. // lastPrice = lastPrice > 103 ? lastPrice : 103;
  1380. } else if ("双面贴".equals(zhuan[0])) {
  1381. price = price + (40 * area);
  1382. price = price > 80 ? price : 80;
  1383. }
  1384. }
  1385. pro = new Product();
  1386. pro.setPrice(Math.ceil(price));
  1387. pro.setWeight(String.valueOf(df.format(area)));
  1388. pro.setCount(countArr[i]);
  1389. list.add(pro);
  1390. }
  1391. }
  1392. // if (!StringUtils.isEmpty(zhuan) && ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))) {
  1393. // for (Product product : list) {
  1394. // product.setPrice(Math.ceil(product.getPrice() + 60));
  1395. // }
  1396. // }
  1397. if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
  1398. for (Product product : list) {
  1399. product.setPrice(Math.ceil(product.getPrice() + 80));
  1400. }
  1401. }
  1402. if (length >= 44 || width >= 44) {
  1403. if (width > length) {
  1404. length = width;
  1405. }
  1406. for (Product product : list) {
  1407. product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
  1408. }
  1409. }
  1410. return list;
  1411. }
  1412. public Product getUVCenterPrice(double length, double width, int count, int number, String[] zhuan, Boolean isSmall) {
  1413. double areaArr[] = {0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 3, 5, 7, 9, 10, 20, 50, 100, 200, 500, 1000, 5000};
  1414. int priceArr[] = {50, 60, 76, 108, 136, 150, 225, 600, 875, 1190, 1350, 1450, 2500, 6000, 11000, 20000, 45000, 80000, 350000};
  1415. double areaArrSmall[] = {0.03, 0.1};
  1416. int priceArrSmall[] = {30, 50};
  1417. double mqPrice = 0;
  1418. double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
  1419. if (!StringUtils.isEmpty(zhuan)) {
  1420. //工艺价格另算
  1421. area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
  1422. }
  1423. double price = TablePrice(area, priceArr, areaArr);
  1424. price = price > 45 ? price : 45;
  1425. if (area < 0.1 && area > 0 && isSmall) {
  1426. price = TablePrice(area, priceArrSmall, areaArrSmall);
  1427. if (price == 0) {
  1428. price = Math.ceil(65 * area);
  1429. }
  1430. }
  1431. if (area <= 0.2 && area >= 0.1) {
  1432. mqPrice = count * 0.05;
  1433. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1434. Math.ceil(price += mqPrice);
  1435. }
  1436. if (!StringUtils.isEmpty(zhuan)) {
  1437. if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
  1438. // 起步价+58元
  1439. price = price + (40 * area);
  1440. price = price > 80 ? price : 80;
  1441. } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
  1442. // 起步价+58元
  1443. price = price + (45 * area);
  1444. price = price > 103 ? price : 103;
  1445. } else if ("双面贴".equals(zhuan[0])) {
  1446. price = price + (40 * area);
  1447. price = price > 80 ? price : 80;
  1448. }
  1449. }
  1450. Product pro = new Product();
  1451. pro.setPrice(Math.ceil(price));
  1452. pro.setCount(count);
  1453. return pro;
  1454. }
  1455. public List<Product> UVStickerSmallPriceV2(double length, double width, int count, int number, String yinse, String[] zhuan, Boolean isSmall) {
  1456. List<Product> list = new ArrayList<>();
  1457. int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
  1458. int oldCount = count;
  1459. if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) && count < 100) {
  1460. // 烫金100个起
  1461. count = 100;
  1462. }
  1463. Product firstProduct = getUVCenterPrice(length, width, count, number, zhuan, isSmall);
  1464. firstProduct.setCount(oldCount);
  1465. list.add(firstProduct);
  1466. for (int i = 0; i < countArr.length; i++) {
  1467. if (list.size() > 3) {
  1468. break;
  1469. }
  1470. int currentCount = countArr[i];
  1471. if (currentCount <= count) {
  1472. continue;
  1473. }
  1474. list.add(getUVCenterPrice(length, width, currentCount, number, zhuan, isSmall));
  1475. }
  1476. if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
  1477. for (Product product : list) {
  1478. product.setPrice(Math.ceil(product.getPrice() + 60));
  1479. }
  1480. }
  1481. if (length >= 44 || width >= 44) {
  1482. if (width > length) {
  1483. length = width;
  1484. }
  1485. for (Product product : list) {
  1486. product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
  1487. }
  1488. }
  1489. return list;
  1490. }
  1491. /**
  1492. * 小面积UV转印贴报价:
  1493. *
  1494. * @param length
  1495. * @param width
  1496. * @param count
  1497. * @param zhuan
  1498. * @param yinse 印色
  1499. * @return
  1500. */
  1501. public List<Product> UVStickerSmallPrice(double length, double width, int count, int number, String yinse, String[] zhuan) {
  1502. List<Product> list = new ArrayList<Product>();
  1503. int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
  1504. Product pro;
  1505. int isInArr = 0;
  1506. int oldCount = count;
  1507. double price = 0, mqPrice = 0, lastPrice, list_lastPrice = 0;
  1508. if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))
  1509. && count < 100) {
  1510. // if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
  1511. // 烫金100个起
  1512. count = 100;
  1513. }
  1514. double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
  1515. if (!StringUtils.isEmpty(zhuan)) {
  1516. //工艺价格另算
  1517. area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
  1518. }
  1519. double lastArea = 0;
  1520. int index = Arrays.binarySearch(countArr, oldCount);
  1521. if (index >= 0) {
  1522. isInArr = 1;
  1523. }
  1524. if (isInArr != 1) {
  1525. price = f_getUvPrice(area, 1);
  1526. price = price > 45 ? price : 45;
  1527. if (area < 0.1 && area > 0) {
  1528. price = f_getUvPrice(area, 3);
  1529. }
  1530. if (area <= 0.2 && area >= 0.1) {
  1531. mqPrice = count * 0.05;
  1532. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1533. Math.ceil(price += mqPrice);
  1534. }
  1535. if (!StringUtils.isEmpty(zhuan)) {
  1536. if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
  1537. // 起步价+58元
  1538. price = price + (40 * area);
  1539. price = price > 80 ? price : 80;
  1540. } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
  1541. // 起步价+58元
  1542. price = price + (45 * area);
  1543. price = price > 103 ? price : 103;
  1544. } else if ("双面贴".equals(zhuan[0])) {
  1545. price = price + (40 * area);
  1546. price = price > 80 ? price : 80;
  1547. }
  1548. }
  1549. pro = new Product();
  1550. list_lastPrice = Math.max(Math.ceil(price), list_lastPrice);
  1551. pro.setPrice(list_lastPrice);
  1552. pro.setWeight(String.valueOf(df.format(area)));
  1553. pro.setCount(oldCount);
  1554. list.add(pro);
  1555. }
  1556. for (int i = 0; i < countArr.length; i++) {
  1557. if (countArr[i] < count) {
  1558. continue;
  1559. }
  1560. if (list.size() > 2) {
  1561. break;
  1562. } else {
  1563. area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000 * number;
  1564. if (i > 0) {
  1565. lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000 * number;
  1566. }
  1567. if (!StringUtils.isEmpty(zhuan)) {
  1568. //工艺价格另算
  1569. area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000;
  1570. if (i > 0) {
  1571. lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000;
  1572. }
  1573. }
  1574. // 报价面积,平方米(加一边3mm出血)
  1575. price = f_getUvPrice(area, 1);
  1576. price = price > 45 ? price : 45;
  1577. lastPrice = f_getUvPrice(lastArea, 1);
  1578. if (area < 0.1 && area > 0) {
  1579. price = f_getUvPrice(area, 3);
  1580. lastPrice = f_getUvPrice(lastArea, 3);
  1581. }
  1582. if (area <= 0.2 && area >= 0.1) {
  1583. mqPrice = countArr[i] * 0.05;
  1584. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1585. Math.ceil(price += mqPrice);
  1586. }
  1587. if (lastArea <= 0.2 && area >= 0.1 && i > 0) {
  1588. mqPrice = countArr[i - 1] * 0.05;
  1589. mqPrice = mqPrice > 5 ? mqPrice : 5;
  1590. Math.ceil(lastPrice += mqPrice);
  1591. }
  1592. if (area > 0.1) {
  1593. if (lastPrice >= price) {//判断上一个尺寸
  1594. price = Math.ceil(lastPrice * 1.1);
  1595. }
  1596. }
  1597. if (!StringUtils.isEmpty(zhuan)) {
  1598. if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
  1599. // 起步价+58元
  1600. price = price + (40 * area);
  1601. price = price > 80 ? price : 80;
  1602. // lastPrice = lastPrice + (45 * area);
  1603. // lastPrice = lastPrice > 103 ? lastPrice : 103;
  1604. } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
  1605. // 起步价+58元
  1606. price = price + (45 * area);
  1607. price = price > 103 ? price : 103;
  1608. // lastPrice = lastPrice + (45 * area);
  1609. // lastPrice = lastPrice > 103 ? lastPrice : 103;
  1610. } else if ("双面贴".equals(zhuan[0])) {
  1611. price = price + (40 * area);
  1612. price = price > 80 ? price : 80;
  1613. }
  1614. }
  1615. pro = new Product();
  1616. list_lastPrice = Math.max(Math.ceil(price), list_lastPrice);
  1617. pro.setPrice(list_lastPrice);
  1618. pro.setWeight(String.valueOf(df.format(area)));
  1619. pro.setCount(countArr[i]);
  1620. list.add(pro);
  1621. }
  1622. }
  1623. // if (!StringUtils.isEmpty(zhuan) && ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))) {
  1624. // for (Product product : list) {
  1625. // product.setPrice(Math.ceil(product.getPrice() + 60));
  1626. // }
  1627. // }
  1628. if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
  1629. for (Product product : list) {
  1630. product.setPrice(Math.ceil(product.getPrice() + 60));
  1631. }
  1632. }
  1633. if (length >= 44 || width >= 44) {
  1634. if (width > length) {
  1635. length = width;
  1636. }
  1637. for (Product product : list) {
  1638. product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
  1639. }
  1640. }
  1641. return list;
  1642. }
  1643. /**
  1644. * 少数量(小于10)UV转印贴报价:
  1645. *
  1646. * @param length
  1647. * @param width
  1648. * @param count
  1649. * @param zhuan
  1650. * @param number 印色
  1651. * @return
  1652. */
  1653. public List<Product> UVStickerLessPrice(double length, double width, int count, int number, String[] zhuan) {
  1654. List<Product> list = new ArrayList<Product>();
  1655. Product pro = new Product();
  1656. double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
  1657. if (!StringUtils.isEmpty(zhuan) && count < 25) {
  1658. return list;
  1659. }
  1660. double price = f_getUvPrice(area, 2);
  1661. pro.setPrice(price > 80 ? price : 80);
  1662. pro.setCount(count);
  1663. list.add(pro);
  1664. if (!StringUtils.isEmpty(zhuan)) {
  1665. for (Product product : list) {
  1666. product.setPrice(Math.floor(product.getPrice() + 60 + (30 * area > 15 ? 30 * area : 15)));
  1667. }
  1668. }
  1669. return list;
  1670. }
  1671. /**
  1672. * 条幅
  1673. *
  1674. * @param kind2
  1675. * @param number
  1676. */
  1677. public static List<Product> bannerPrice(String kind2, double length, double width, int count, Integer number, String role) {
  1678. List<Product> list = new ArrayList<Product>();
  1679. Product pro = new Product();
  1680. // 一条条幅的长度
  1681. length = length / 100.0;
  1682. width = width / 100.0;
  1683. double area = length * width * count;
  1684. double price = 0;
  1685. if ("彩色条幅".equals(kind2)) {
  1686. //拼多多价格
  1687. if (role.indexOf("1045") > -1) {
  1688. if (width == 0.5 || length == 0.5) {
  1689. double widthArr[] = {3, 4, 5, 6, 7, 8};
  1690. double unitArr[] = {19, 17.5, 17, 17, 17, 17};
  1691. double baseArr[] = {40, 50, 60, 75, 85, 96};
  1692. for (int i = 0; i < widthArr.length; i++) {
  1693. if (widthArr[i] < width || widthArr[i] < length) {
  1694. continue;
  1695. }
  1696. price = unitArr[i] * area;
  1697. price = price > baseArr[i] ? price : baseArr[i];
  1698. break;
  1699. }
  1700. } else {
  1701. if (area <= 1) {
  1702. price = 45;
  1703. } else if (area <= 2) {
  1704. price = 35 * area;
  1705. } else if (area <= 3) {
  1706. price = 33 * area;
  1707. } else if (area <= 4) {
  1708. price = 32 * area;
  1709. } else if (area <= 5) {
  1710. price = 30 * area;
  1711. } else if (area <= 10) {
  1712. price = 28 * area;
  1713. } else {
  1714. price = 25 * area;
  1715. }
  1716. }
  1717. price = price > 40 ? price : 40;
  1718. } else {
  1719. if (width == 0.5 && length == 3 || width == 3 && length == 0.5) {
  1720. price = 30 * area;
  1721. } else if (width == 0.5 && length == 5 || width == 5 && length == 0.5) {
  1722. price = 24 * area;
  1723. } else if (area <= 1) {
  1724. price = 45;
  1725. } else if (area <= 2) {
  1726. price = 35 * area;
  1727. } else if (area <= 3) {
  1728. price = 33 * area;
  1729. } else if (area <= 4) {
  1730. price = 32 * area;
  1731. } else if (area <= 5) {
  1732. price = 30 * area;
  1733. } else if (area <= 10) {
  1734. price = 28 * area;
  1735. } else {
  1736. price = 25 * area;
  1737. }
  1738. price = price > 45 ? price : 45;
  1739. }
  1740. } else {
  1741. double[] areas = null;
  1742. int[] prices = null;
  1743. double last_price = 0;
  1744. double min_price = 0;
  1745. if ((width == 0.5 && length == 3 && count == 1) || (width == 3 && length == 0.5 && count == 1)) {
  1746. price = 24 * area;
  1747. } else {
  1748. areas = new double[]{1, 2, 3, 4, 5, 10};
  1749. prices = new int[]{35, 30, 24, 21, 18, 16};
  1750. last_price = 13;
  1751. min_price += 40;
  1752. price = Math.max(TableUnitPrice(area, prices, areas, last_price), min_price);
  1753. }
  1754. }
  1755. pro.setCount(count);
  1756. pro.setPrice(Math.ceil(price));
  1757. list.add(pro);
  1758. return list;
  1759. }
  1760. /**
  1761. * 桌贴0.38磨砂背胶价格计算 ======》 最大印刷尺寸40*45CM 最低起步价100元 每增加一张加30元 设计费每款加8元
  1762. * <p>
  1763. * 0.38桌贴(磨砂、哑光、亮光) 最大打印面积 395*445MM 成品最小做到1CM 每边加上1.5MM出血 起步价90元
  1764. * 单面印刷不带胶每增加一张单面加30元 双面打印不带胶每增加一张加36元, 带胶加40元一张 10张以上不分单双面带不带胶 均20元/张
  1765. * 款数不同的每款加上1元的设计费
  1766. *
  1767. * @param list
  1768. * @param width
  1769. * @param length
  1770. * @param count
  1771. * @param number
  1772. * @return
  1773. */
  1774. public List<Product> getDeskSticker(List<Product> list, Double width, Double length, int count, Integer number,
  1775. String craftShua, String craftJiao) {
  1776. // 最大尺寸435*385mm ,加出血一边3mm
  1777. double l = 435;
  1778. double w = 385;
  1779. Product pro = new Product();
  1780. // 价格
  1781. double price = 0;
  1782. // 换成毫米每边+1.5
  1783. length = length * 10 + 2 * 1.5;
  1784. width = width * 10 + 2 * 1.5;
  1785. // 数量*款数就是张数
  1786. count = count * number;
  1787. if ((length > l || width > w) && (length > w || width > l))
  1788. return null;
  1789. // 一张大纸45*40cm 能做多少个此类尺寸的桌贴
  1790. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  1791. Math.floor(l / width) * Math.floor(w / length));
  1792. // 报的数量需要多少张大纸
  1793. int num = (int) Math.ceil(count / max);
  1794. if ("单面".equals(craftShua)) {
  1795. if (num > 10) {
  1796. price = 70 + num * 28 + (number - 1);
  1797. } else {
  1798. price = 80 + num * 30 + (number - 1);
  1799. }
  1800. } else if ("双面".equals(craftShua)) {
  1801. if ("背胶".equals(craftJiao)) {
  1802. price = 100 + num * 40 + (number - 1);
  1803. } else {
  1804. price = 100 + num * 36 + (number - 1);
  1805. }
  1806. }
  1807. pro.setCount(count / number);
  1808. pro.setPrice(price > 90 ? price : 90);
  1809. list.add(pro);
  1810. return list;
  1811. }
  1812. /**
  1813. * 桌贴0.38PVC亮光异型卡片 印刷价格
  1814. *
  1815. * @param list
  1816. * @param width
  1817. * @param length
  1818. * @param count
  1819. * @return
  1820. */
  1821. public List<Product> getDeskSticker(List<Product> list, Double width, Double length, int count) {
  1822. double danjia;
  1823. int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
  1824. for (int i = 0; i < countArr.length; i++) {
  1825. if (countArr[i] < count || list.size() > 3) {
  1826. continue;
  1827. }
  1828. // 面积平方米
  1829. double area = width * length * countArr[i] / 10000;
  1830. Product pro = new Product();
  1831. if (area <= 0.45) {
  1832. danjia = 110;
  1833. } else if (area <= 0.9) {
  1834. danjia = 150;
  1835. } else if (area <= 5) {
  1836. danjia = 100;
  1837. } else if (area <= 10) {
  1838. danjia = 70;
  1839. } else if (area <= 15) {
  1840. danjia = 55;
  1841. } else if (area <= 20) {
  1842. danjia = 50;
  1843. } else if (area <= 30) {
  1844. danjia = 40;
  1845. } else {
  1846. danjia = 30;
  1847. }
  1848. pro = new Product();
  1849. pro.setCount(countArr[i]);
  1850. pro.setPrice(area * danjia > 120 ? area * danjia : 120);
  1851. list.add(pro);
  1852. }
  1853. for (int i = 0; i < list.size() - 1; i++) {
  1854. if (list.get(i + 1).getPrice() - list.get(i).getPrice() < 100) {
  1855. list.get(i + 1).setPrice(list.get(i + 1).getPrice() + 100);
  1856. }
  1857. }
  1858. return list;
  1859. }
  1860. /**
  1861. * 桌贴0.38PVC亮光异型卡片 打印价格
  1862. *
  1863. * @param number
  1864. * @param width
  1865. * @param length
  1866. * @param count
  1867. * @param craftJiao
  1868. * @return 不同款内容的报价:成本核算 有效打印面积 380*420MM 起步价120元 每增加一张单面加30元
  1869. * 双面打印在每增加一张加36元,带胶加每增加一张加40元 10张以上单双面均加22元/张
  1870. */
  1871. public List<Product> getDeskStickerPrint(Double width, Double length, int count, int number, String craftJiao) {
  1872. List<Product> list = new ArrayList<Product>();
  1873. // 有效打印面积 420*380MM,加出血一边3mm
  1874. double l = 426;
  1875. double w = 386;
  1876. Product pro = new Product();
  1877. // 第一张大纸价格
  1878. double price = 120;
  1879. // 换成毫米每边+3
  1880. length = length * 10 + 2 * 3;
  1881. width = width * 10 + 2 * 3;
  1882. // 数量 * 款数就是张数
  1883. count = count * number;
  1884. if ((length > l || width > w) && (length > w || width > l))
  1885. return null;
  1886. // 一张大纸420*380mm 能做多少个此类尺寸的桌贴
  1887. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  1888. Math.floor(l / width) * Math.floor(w / length));
  1889. // 报的数量需要多少张大纸
  1890. int num = (int) Math.ceil(count / max);
  1891. // 价格计算
  1892. if ("背胶".equals(craftJiao)) {
  1893. price = price + (num - 1) * 40;
  1894. } else {
  1895. if (num > 10) {
  1896. price = price + (num - 1) * 22;
  1897. } else {
  1898. // 单面
  1899. if ("单面".equals(craftJiao)) {
  1900. price = price + (num - 1) * 30;
  1901. } else if ("双面".equals(craftJiao)) {// 双面
  1902. price = price + (num - 1) * 36;
  1903. }
  1904. }
  1905. }
  1906. pro.setCount(count / number);
  1907. pro.setPrice(price);
  1908. list.add(pro);
  1909. return list;
  1910. }
  1911. /**
  1912. * 滴塑价格计算======> 滴塑 出血位每边加1.5MM 滴塑最大印刷面积43*30CM 起步价80元 2张100元 3张120元 4张150元
  1913. * 5张180元 10张260元 11张以上*25元
  1914. *
  1915. * @param list
  1916. * @param width
  1917. * @param length
  1918. * @param count
  1919. * @param number
  1920. * @param dto
  1921. * @return
  1922. */
  1923. public static List<Product> getDisuPrice(List<Product> list, Double width, Double length, int count, Integer number, Product dto) {
  1924. List<String> craft = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
  1925. // 最大尺寸43*30cm
  1926. double l = 430;
  1927. double w = 300;
  1928. Product pro = new Product();
  1929. // 第一张大纸价格
  1930. double price = 80;
  1931. if (craft.size() > 0) {//工艺起步价120
  1932. price = 120;
  1933. }
  1934. // 换成毫米每边+3
  1935. length = length * 10 + 2 * 1.5;
  1936. width = width * 10 + 2 * 1.5;
  1937. // 数量*款数就是张数
  1938. count = count * number;
  1939. if ((length > l || width > w) && (length > w || width > l)) {
  1940. return null;
  1941. }
  1942. // 一张大纸43*30 能做多少个此类尺寸的
  1943. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  1944. Math.floor(l / width) * Math.floor(w / length));
  1945. // 报的数量需要多少张大纸
  1946. int num = (int) Math.ceil(count / max);
  1947. if (num <= 10) {
  1948. price = price + (num - 1) * 20;
  1949. } else if (num > 10) {
  1950. price = num * 25;
  1951. }
  1952. price += 10 * craft.size() * num;
  1953. if (dto.getN_mq_num() > 0) {
  1954. price += 10 * dto.getN_mq_num();
  1955. }
  1956. if (number > 1) {
  1957. price *= 1.3;
  1958. }
  1959. pro.setCount(count / number);
  1960. pro.setPrice(price);
  1961. list.add(pro);
  1962. return list;
  1963. }
  1964. /**
  1965. * 毕业证书价格计算
  1966. *
  1967. * @param count
  1968. */
  1969. public List<Product> getDiploma(int count) {
  1970. List<Product> list = new ArrayList<Product>();
  1971. // 数量
  1972. int countArr[] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 500, 1000};
  1973. // 价格
  1974. double priceArray[] = {90, 110, 120, 140, 160, 190, 210, 230, 240, 270, 480, 740, 920, 1200};
  1975. Product pro = new Product();
  1976. for (int i = 0; i < countArr.length; i++) {
  1977. if (countArr[i] < count) {
  1978. continue;
  1979. }
  1980. if (list.size() == 4) {
  1981. return list;
  1982. }
  1983. pro = new Product();
  1984. pro.setCount(countArr[i]);
  1985. pro.setPrice(priceArray[i]);
  1986. list.add(pro);
  1987. }
  1988. return list;
  1989. }
  1990. /**
  1991. * 复印纸价格计算
  1992. *
  1993. * @param count
  1994. * @param kind3
  1995. * @param kind2
  1996. * @param kind
  1997. * @param size
  1998. * @return
  1999. */
  2000. public List<Product> getCopyPaper(String kind, String kind2, String kind3, int count, String size) {
  2001. List<Product> list = new ArrayList<Product>();
  2002. double price = 0;
  2003. if ("彩色".equals(kind)) {
  2004. if ("80克双胶纸".equals(kind2)) {
  2005. if ("19*13".equals(size)) {
  2006. if (count == 10) {
  2007. price = 70;
  2008. } else if (count == 20) {
  2009. price = 90;
  2010. } else if (count == 50) {
  2011. price = 150;
  2012. }
  2013. } else if ("28.5*21".equals(size)) {
  2014. if (count == 10) {
  2015. price = 160;
  2016. } else if (count == 20) {
  2017. price = 320;
  2018. } else if (count == 50) {
  2019. price = 900;
  2020. }
  2021. }
  2022. }
  2023. } else {
  2024. if ("60克双胶纸".equals(kind2)) {
  2025. if ("19*13".equals(size)) {
  2026. if (count == 10) {
  2027. if ("单面".equals(kind3)) {
  2028. price = 50;
  2029. } else {
  2030. price = 70;
  2031. }
  2032. } else if (count == 20) {
  2033. if ("单面".equals(kind3)) {
  2034. price = 60;
  2035. } else {
  2036. price = 90;
  2037. }
  2038. } else if (count == 50) {
  2039. if ("单面".equals(kind3)) {
  2040. price = 110;
  2041. } else {
  2042. price = 150;
  2043. }
  2044. }
  2045. } else if ("28.5*21".equals(size)) {
  2046. if (count == 10) {
  2047. if ("单面".equals(kind3)) {
  2048. price = 110;
  2049. } else {
  2050. price = 150;
  2051. }
  2052. } else if (count == 20) {
  2053. if ("单面".equals(kind3)) {
  2054. price = 160;
  2055. } else {
  2056. price = 220;
  2057. }
  2058. } else if (count == 50) {
  2059. if ("单面".equals(kind3)) {
  2060. price = 380;
  2061. } else {
  2062. price = 520;
  2063. }
  2064. }
  2065. }
  2066. } else if ("80克双胶纸".equals(kind2)) {
  2067. if ("19*13".equals(size)) {
  2068. if (count == 10) {
  2069. if ("单面".equals(kind3)) {
  2070. price = 60;
  2071. } else {
  2072. price = 90;
  2073. }
  2074. } else if (count == 20) {
  2075. if ("单面".equals(kind3)) {
  2076. price = 80;
  2077. } else {
  2078. price = 120;
  2079. }
  2080. } else if (count == 50) {
  2081. if ("单面".equals(kind3)) {
  2082. price = 180;
  2083. } else {
  2084. price = 220;
  2085. }
  2086. }
  2087. } else if ("28.5*21".equals(size)) {
  2088. if (count == 10) {
  2089. if ("单面".equals(kind3)) {
  2090. price = 130;
  2091. } else {
  2092. price = 180;
  2093. }
  2094. } else if (count == 20) {
  2095. if ("单面".equals(kind3)) {
  2096. price = 220;
  2097. } else {
  2098. price = 260;
  2099. }
  2100. } else if (count == 50) {
  2101. if ("单面".equals(kind3)) {
  2102. price = 520;
  2103. } else {
  2104. price = 780;
  2105. }
  2106. }
  2107. }
  2108. }
  2109. }
  2110. Product pro = new Product();
  2111. pro = new Product();
  2112. pro.setCount(count);
  2113. pro.setPrice(Math.ceil(price));
  2114. list.add(pro);
  2115. return list;
  2116. }
  2117. /**
  2118. * 婚礼卡价格计算
  2119. *
  2120. * @param length
  2121. * @param width
  2122. * @param count
  2123. * @param number
  2124. * @param craftMo
  2125. * @param craftShua
  2126. * @return
  2127. */
  2128. public List<Product> getWeddingCardPrice(Double length, Double width, int count, Integer number, String craftMo,
  2129. String craftShua) {
  2130. List<Product> list = new ArrayList<Product>();
  2131. Product pro = new Product();
  2132. double weight = 0;
  2133. if ("直角".equals(craftMo) && count <= 300 && ((length == 13 && width == 5.4) || (length == 5.4 && width == 13))) {
  2134. if ("单面印刷".equals(craftShua)) {
  2135. // 数量
  2136. int countArr[] = {100, 200, 300};
  2137. // 价格
  2138. double priceArray[] = {70, 126, 183};
  2139. for (int i = 0; i < countArr.length; i++) {
  2140. if (countArr[i] < count) {
  2141. continue;
  2142. }
  2143. pro = new Product();
  2144. pro.setCount(countArr[i]);
  2145. pro.setPrice(priceArray[i]);
  2146. list.add(pro);
  2147. }
  2148. // 根据款数重新算价格
  2149. for (Product product : list) {
  2150. product.setWeight(df.format(length * width * product.getCount() / 10000 * 0.3 * number));
  2151. product.setPrice(Math.floor(product.getPrice() * number));
  2152. }
  2153. } else if ("双面印刷".equals(craftShua)) {
  2154. // 数量
  2155. int countArr[] = {100, 200, 300};
  2156. // 价格
  2157. double priceArray[] = {108, 189, 275};
  2158. for (int i = 0; i < countArr.length; i++) {
  2159. if (countArr[i] < count) {
  2160. continue;
  2161. }
  2162. pro = new Product();
  2163. pro.setCount(countArr[i]);
  2164. pro.setPrice(priceArray[i]);
  2165. list.add(pro);
  2166. }
  2167. // 根据款数重新算价格
  2168. for (Product product : list) {
  2169. product.setPrice(Math.floor(product.getPrice() * number));
  2170. }
  2171. }
  2172. } else {
  2173. // 转成毫米
  2174. weight = length * width * count / 10000 * 0.3 * number;
  2175. length = length * 10;
  2176. width = width * 10;
  2177. if (count <= 300) {
  2178. double l = 420;
  2179. double w = 285;
  2180. // 打印的加上出血(一边2毫米)
  2181. length = length + 4;
  2182. width = width + 4;
  2183. double price = 0.0;
  2184. // 5张以内价格
  2185. double fixPrice = 50;
  2186. // 每增加1张多少钱
  2187. double zhang = 6;
  2188. // 设计费
  2189. double designFee = 0.0;
  2190. // 婚礼卡,直角工艺每增加一张5元
  2191. if ("直角".equals(craftMo)) {
  2192. zhang = 5;
  2193. }
  2194. /*
  2195. * 婚礼卡设计费成品尺寸90X54MM以内每款收10元 140X100MM以内每款收15元 210X140MM以内30元 210X285MM以内40元
  2196. * 420X285MM以内60元 大于420X285MM80元
  2197. */
  2198. // 设计费不带出血的尺寸
  2199. if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
  2200. designFee = 10;
  2201. } else if ((length - 4 <= 140 && width - 4 <= 100) || (length - 4 <= 140 && width - 4 <= 100)) {
  2202. designFee = 15;
  2203. } else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
  2204. designFee = 30;
  2205. } else if ((length - 4 <= 285 && width - 4 - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
  2206. designFee = 40;
  2207. } else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
  2208. designFee = 60;
  2209. } else {
  2210. designFee = 80;
  2211. }
  2212. // 一张l/w 大的纸张能做多少个此类尺寸的产品
  2213. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  2214. Math.floor(l / width) * Math.floor(w / length));
  2215. // 报的数量需要多少张大纸
  2216. // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
  2217. int num = (int) Math.ceil(count * number / max);
  2218. // 5张以内价格 + 每张费用(第6张起收)+ 设计费 * 款数 + 0.1 * 总数量 (排号费)
  2219. price = fixPrice + (num - 5 > 0 ? num - 5 : 0) * zhang + designFee * number + 0.1 * count * number;
  2220. Product dto = new Product();
  2221. dto.setCount(count);
  2222. dto.setPrice(price);
  2223. list.add(dto);
  2224. } else {
  2225. // 数量
  2226. int countArr[] = {500, 1000, 2000};
  2227. // 价格
  2228. double priceArray[] = {230, 400, 760};
  2229. for (int i = 0; i < countArr.length; i++) {
  2230. if (countArr[i] < count) {
  2231. continue;
  2232. }
  2233. pro = new Product();
  2234. pro.setCount(countArr[i]);
  2235. pro.setPrice(priceArray[i]);
  2236. list.add(pro);
  2237. }
  2238. // 根据款数重新算价格
  2239. for (Product product : list) {
  2240. product.setWeight(df.format(weight));
  2241. product.setPrice(Math.floor(product.getPrice() * number));
  2242. }
  2243. }
  2244. }
  2245. return list;
  2246. }
  2247. /**
  2248. * 贡缎布产品价格
  2249. */
  2250. public static List<Product> satinClothPrice(String kind2, Double length, Double width, int count, Integer number) {
  2251. List<Product> list = new ArrayList<Product>();
  2252. Product pro = new Product();
  2253. double area = length * width / 10000;
  2254. double price = 0, dj = 0;
  2255. if (area < 0.25) {
  2256. dj = 50;
  2257. } else {
  2258. dj = 40;
  2259. }
  2260. area *= count;
  2261. if ("6".equals(kind2)) {
  2262. price = price + 30;
  2263. }
  2264. price = Math.ceil(area * dj > 58 ? area * dj : 58);
  2265. pro.setCount(count);
  2266. pro.setPrice(price * number);
  2267. list.add(pro);
  2268. return list;
  2269. }
  2270. /**
  2271. * 餐垫纸
  2272. *
  2273. * @param kind
  2274. * @param length
  2275. * @param width
  2276. * @param count
  2277. * @return
  2278. */
  2279. public List<Product> getPlaceMatPrice(String kind, Double length, Double width, int count) {
  2280. List<Product> list = new ArrayList<>();
  2281. length = length * 10;
  2282. width = width * 10;
  2283. // Double priceArr[] = { 40.0, 50.0, 80.0, 120.0, 160.0, 270.0, 480.0 };
  2284. // list = acountInsertCardPrice(count, list, priceArr);
  2285. if ((length <= 285 && width <= 210) || length <= 210 && width <= 285) {
  2286. Double priceArr[] = {46.0, 68.0, 117.0, 157.0, 236.0, 457.0};
  2287. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2288. } else if (length <= 436 && width <= 285 || length <= 285 && width <= 436) {
  2289. Double priceArr[] = {88.0, 122.0, 191.0, 269.0, 457.0, 896.0};
  2290. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2291. } else if (length <= 638 && width <= 285 || length <= 285 && width <= 638) {
  2292. Double priceArr[] = {137.0, 204.0, 350.0, 489.0, 810.0, 1482.0};
  2293. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2294. } else if (length <= 852 && width <= 285 || length <= 285 && width <= 852) {
  2295. Double priceArr[] = {183.0, 272.0, 466.0, 652.0, 975.0, 1681.0};
  2296. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2297. } else if (length <= 1050 && width <= 285 || length <= 285 && width <= 2050) {
  2298. Double priceArr[] = {229.0, 340.0, 582.0, 815.0, 1279.0, 2470.0};
  2299. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2300. } else if (length <= 587 && width <= 428 || length <= 428 && width <= 587) {
  2301. Double priceArr[] = {195.0, 262.0, 408.0, 554.0, 869.0, 1659.0};
  2302. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2303. } else if (length <= 638 && width <= 428 || length <= 428 && width <= 638) {
  2304. Double priceArr[] = {252.0, 352.0, 570.0, 755.0, 1191.0, 2263.0};
  2305. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2306. } else if (length <= 779 && width <= 428 || length <= 428 && width <= 778) {
  2307. Double priceArr[] = {321.0, 430.0, 691.0, 951.0, 1434.0, 2765.0};
  2308. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2309. } else if (length <= 880 && width <= 428 || length <= 428 && width <= 880) {
  2310. Double priceArr[] = {349.0, 484.0, 796.0, 1051.0, 1681.0, 3258.0};
  2311. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2312. } else if (length <= 1050 && width <= 428 || length <= 428 && width <= 1050) {
  2313. Double priceArr[] = {419.0, 587.0, 900.0, 1191.0, 1985.0, 3748.0};
  2314. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2315. } else if (length <= 638 && width <= 574 || length <= 574 && width <= 638) {
  2316. Double priceArr[] = {274.0, 408.0, 699.0, 927.0, 1535.0, 2964.0};
  2317. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2318. } else if (length <= 779 && width <= 529 || length <= 529 && width <= 779) {
  2319. Double priceArr[] = {321.0, 430.0, 691.0, 951.0, 1434.0, 2765.0};
  2320. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2321. } else if (length <= 880 && width <= 580 || length <= 580 && width <= 880) {
  2322. Double priceArr[] = {349.0, 484.0, 796.0, 1051.0, 1681.0, 3258.0};
  2323. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2324. } else if (length <= 863 && width <= 638 || length <= 638 && width <= 863) {
  2325. Double priceArr[] = {411.0, 612.0, 993.0, 1390.0, 2303.0, 4446.0};
  2326. list = acountPlaceMatPrice(kind, count, list, priceArr);
  2327. }
  2328. return list;
  2329. }
  2330. /**
  2331. * 餐垫纸遍历添加价格
  2332. */
  2333. private List<Product> acountPlaceMatPrice(String kind, int count, List<Product> list, Double[] priceArr) {
  2334. int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
  2335. Product pro;
  2336. double beishu = 1;
  2337. for (int i = 0; i < countArr.length; i++) {
  2338. if (countArr[i] < count || list.size() > 3) {
  2339. continue;
  2340. }
  2341. pro = new Product();
  2342. pro.setCount(countArr[i]);
  2343. if (countArr[i] <= 500) {
  2344. beishu = 2.2;
  2345. } else if (countArr[i] <= 3000) {
  2346. beishu = 1.8;
  2347. } else {
  2348. beishu = 1.5;
  2349. }
  2350. // 55克 比80克便宜2分钱一张
  2351. if ("1".equals(kind)) {
  2352. pro.setPrice(Math.ceil(priceArr[i] * beishu - countArr[i] * 0.02));
  2353. } else if ("0".equals(kind)) {// 80克
  2354. pro.setPrice(Math.ceil(priceArr[i] * beishu));
  2355. }
  2356. list.add(pro);
  2357. }
  2358. return list;
  2359. }
  2360. /**
  2361. * 硫酸纸吊牌价格
  2362. *
  2363. * @param count
  2364. */
  2365. public List<Product> getAcidTagsPrice(Double length, Double width, String size1, int count) {
  2366. List<Product> list = new ArrayList<>();
  2367. int countArr[] = {1000, 2000, 5000, 10000};
  2368. if ((length > 6.8 || width > 3) && (length > 3 || width > 6.8)) {
  2369. int priceArr[] = {200, 360, 720, 1300};
  2370. list = acountAcidTagsPrice(count, list, countArr, priceArr);
  2371. } else {
  2372. int priceArr[] = {180, 320, 620, 1100};
  2373. list = acountAcidTagsPrice(count, list, countArr, priceArr);
  2374. }
  2375. return list;
  2376. }
  2377. /**
  2378. * 硫酸纸吊牌价格计算
  2379. *
  2380. * @param count
  2381. * @param list
  2382. * @param countArr
  2383. * @param priceArr
  2384. */
  2385. private List<Product> acountAcidTagsPrice(int count, List<Product> list, int[] countArr, int[] priceArr) {
  2386. Product pro;
  2387. for (int i = 0; i < countArr.length; i++) {
  2388. if (countArr[i] < count || list.size() > 3) {
  2389. continue;
  2390. }
  2391. pro = new Product();
  2392. pro.setCount(countArr[i]);
  2393. pro.setPrice(Math.ceil(priceArr[i]));
  2394. list.add(pro);
  2395. }
  2396. return list;
  2397. }
  2398. /**
  2399. * 号码布价格计算
  2400. *
  2401. * @param kind
  2402. * @param num
  2403. * @param width
  2404. * @param length
  2405. * @param list
  2406. * @param count
  2407. * @return
  2408. */
  2409. public List<Product> getHmbPrice(String kind, int num, Double length, Double width, int count, List<Product> list) {
  2410. Product pro;
  2411. double price = 0;
  2412. if (length == 240 && width == 200 || length == 200 && width == 240) {
  2413. if (kind.equals("春亚布")) {
  2414. price = num * count * 1.8;
  2415. } else {
  2416. price = num * count * 2.5;
  2417. }
  2418. } else if (length == 200 && width == 140 || length == 140 && width == 200) {
  2419. if (kind.equals("春亚布")) {
  2420. price = num * count * 1.5;
  2421. } else {
  2422. price = num * count * 1.3;
  2423. }
  2424. } else {
  2425. if (kind.equals("春亚布")) {
  2426. price = num * count * 1.5;
  2427. } else {
  2428. price = num * count * 1.8;
  2429. }
  2430. }
  2431. pro = new Product();
  2432. pro.setCount(count);
  2433. pro.setPrice(Math.ceil(price) > 50 ? price : 50);
  2434. list.add(pro);
  2435. return list;
  2436. }
  2437. /**
  2438. * 锦旗价格计算
  2439. *
  2440. * @param kind
  2441. * @param num
  2442. * @param width
  2443. * @param length
  2444. * @param list
  2445. * @param count
  2446. * @return
  2447. */
  2448. public List<Product> getJQPrice(String kind, int num, Double length, Double width, int count, List<Product> list) {
  2449. Product pro;
  2450. double price = 0;
  2451. if (length == 60 && width == 90 || length == 90 && width == 60) {
  2452. if (kind.equals("小龙须黄字")) {
  2453. price = num * count * 45;
  2454. } else if (kind.equals("小龙须3d镀金")) {
  2455. price = num * count * 86;
  2456. } else if (kind.equals("大龙须黄字")) {
  2457. price = num * count * 66;
  2458. } else if (kind.equals("大龙须3d镀金")) {
  2459. price = num * count * 88;
  2460. } else {
  2461. price = num * count * 130;
  2462. }
  2463. } else if (length == 70 && width == 110 || length == 110 && width == 70) {
  2464. if (kind.equals("小龙须黄字")) {
  2465. price = num * count * 47;
  2466. } else if (kind.equals("小龙须3d镀金")) {
  2467. price = num * count * 88;
  2468. } else if (kind.equals("大龙须黄字")) {
  2469. price = num * count * 80;
  2470. } else {
  2471. price = num * count * 98;
  2472. }
  2473. } else if (length == 80 && width == 120 || length == 120 && width == 80) {
  2474. if (kind.equals("小龙须黄字")) {
  2475. price = num * count * 85;
  2476. } else if (kind.equals("小龙须3d镀金")) {
  2477. price = num * count * 125;
  2478. } else if (kind.equals("大龙须黄字")) {
  2479. price = num * count * 90;
  2480. } else {
  2481. price = num * count * 140;
  2482. }
  2483. } else if (length == 70 && width == 120 || length == 120 && width == 70) {
  2484. price = num * count * 158;
  2485. } else {
  2486. price = num * count * 220;
  2487. }
  2488. pro = new Product();
  2489. pro.setCount(count);
  2490. pro.setPrice(Math.ceil(price));
  2491. list.add(pro);
  2492. return list;
  2493. }
  2494. /**
  2495. * 彩旗价格计算
  2496. *
  2497. * @param num
  2498. * @param width
  2499. * @param length
  2500. * @param list
  2501. * @param count
  2502. * @return
  2503. */
  2504. public List<Product> getCQPrice(int num, Double length, Double width, int count, List<Product> list) {
  2505. Product pro;
  2506. double price = 0;
  2507. if (length == 40 && width == 80 || length == 80 && width == 40) {
  2508. price = num * count * 80;
  2509. } else if (length == 60 && width == 90 || length == 90 && width == 60) {
  2510. price = num * count * 130;
  2511. } else if (length == 70 && width == 120 || length == 120 && width == 70) {
  2512. price = num * count * 158;
  2513. } else {
  2514. price = num * count * 220;
  2515. }
  2516. pro = new Product();
  2517. pro.setCount(count);
  2518. pro.setPrice(Math.ceil(price));
  2519. list.add(pro);
  2520. return list;
  2521. }
  2522. /**
  2523. * 封口贴铜板不干胶价格计算
  2524. *
  2525. * @param num
  2526. * @param list
  2527. * @return
  2528. */
  2529. public List<Product> getFktPrice(int num, List<Product> list) {
  2530. Product pro;
  2531. double price = 0;
  2532. for (int i = 1; i < countArr.length; i++) {
  2533. if (countArr[i] == 1000) {
  2534. price = 50.0 * num;
  2535. } else if (countArr[i] == 2000) {
  2536. price = 80.0 * num;
  2537. } else if (countArr[i] == 3000) {
  2538. price = 150.0 * num;
  2539. } else if (countArr[i] == 5000) {
  2540. price = 175.0 * num;
  2541. } else if (countArr[i] == 10000) {
  2542. price = 240.0 * num;
  2543. } else {
  2544. price = 450.0 * num;
  2545. }
  2546. pro = new Product();
  2547. pro.setCount(countArr[i]);
  2548. pro.setPrice(Math.ceil(price));
  2549. list.add(pro);
  2550. }
  2551. return list;
  2552. }
  2553. /**
  2554. * PVC亮光异型卡片价格计算
  2555. *
  2556. * @param dto
  2557. * @param number
  2558. * @param width
  2559. * @param length
  2560. * @param area
  2561. * @param count
  2562. * @param priceList
  2563. * @return
  2564. */
  2565. /*public List<Product> getPVCPrice(String kindValue,int count,double width, double length, List<Product> list) {
  2566. Product pro;
  2567. double price = 0,dj = 0, bz = 1;
  2568. double area = (width*length)/10000;
  2569. int countArr[] = { 500, 1000, 2000, 5000, 10000 };
  2570. if(area <= 0.0016) {
  2571. bz = 2.7;
  2572. }else if(area <= 0.0025) {
  2573. bz = 1.8;
  2574. }else if(area <= 0.0036) {
  2575. bz = 1.3;
  2576. }else if(area <= 0.0042) {
  2577. bz = 1.05;
  2578. }
  2579. for(int i = 0; i< countArr.length; i++) {
  2580. if (countArr[i] < count || list.size() > 3) {
  2581. continue;
  2582. }
  2583. if(kindValue.equals("2")) {
  2584. if(countArr[i] == 500) {
  2585. dj = 45;
  2586. }else if(countArr[i] == 1000) {
  2587. dj = 34;
  2588. }else if(countArr[i] == 2000) {
  2589. dj = 31;
  2590. }else if(countArr[i] == 5000) {
  2591. dj = 29;
  2592. }else if(countArr[i] == 10000) {
  2593. dj = 28;
  2594. }
  2595. }else {
  2596. if(countArr[i] == 500) {
  2597. dj = 63;
  2598. }else if(countArr[i] == 1000) {
  2599. dj = 54;
  2600. }else if(countArr[i] == 2000) {
  2601. dj = 50;
  2602. }else if(countArr[i] == 5000) {
  2603. dj = 48;
  2604. }else if(countArr[i] == 10000) {
  2605. dj = 47;
  2606. }
  2607. }
  2608. price = bz*dj*countArr[i]*area;
  2609. pro = new Product();
  2610. pro.setCount(countArr[i]);
  2611. pro.setPrice(price);
  2612. list.add(pro);
  2613. }
  2614. return list;
  2615. }*/
  2616. /**
  2617. * 硫酸纸价格计算
  2618. *
  2619. * @param dto
  2620. * @param width
  2621. * @param length
  2622. * @param count
  2623. * @param list
  2624. * @return
  2625. */
  2626. public List<Product> getLszPrice(Product dto, double width, double length, int count, List<Product> list) {
  2627. double price = 0, dj = 0, area = 0;
  2628. String craft[] = dto.getCraft();
  2629. int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
  2630. for (int i = 0; i < lszCountArr.length; i++) {
  2631. Product pro = new Product();
  2632. if (lszCountArr[i] < count || list.size() > 3) {
  2633. continue;
  2634. }
  2635. if ((width <= 6.8 && length <= 3) || (width <= 6.8 && length <= 3)) {
  2636. if ("直角".equals(craft[0])) {
  2637. dj = 14.5;
  2638. } else {
  2639. dj = 36.5;
  2640. }
  2641. } else if ((width <= 9 && length <= 5) || (width <= 9 && length <= 5)) {
  2642. if ("直角".equals(craft[0])) {
  2643. dj = 14.5;
  2644. } else {
  2645. dj = 36.5;
  2646. }
  2647. } else if ((width <= 10 && length <= 14) || (width <= 14 && length <= 10)) {
  2648. if ("直角".equals(craft[0])) {
  2649. dj = 11.5;
  2650. } else {
  2651. dj = 17.5;
  2652. }
  2653. } else if ((width <= 21 && length <= 14) || (width <= 14 && length <= 21)) {
  2654. if ("直角".equals(craft[0])) {
  2655. dj = 9.6;
  2656. } else {
  2657. dj = 12.1;
  2658. }
  2659. } else if ((width <= 21 && length <= 28.5) || (width <= 28.5 && length <= 21)) {
  2660. if ("直角".equals(craft[0])) {
  2661. dj = 7.6;
  2662. } else {
  2663. dj = 11.1;
  2664. }
  2665. } else {
  2666. if ("直角".equals(craft[0])) {
  2667. dj = 7.2;
  2668. } else {
  2669. dj = 10.7;
  2670. }
  2671. }
  2672. dj *= 2;//按照供应商成本价2倍计算
  2673. if (lszCountArr[i] == 500) {
  2674. area = width * length * 800 / 10000;
  2675. } else {
  2676. area = width * length * lszCountArr[i] / 10000;
  2677. if ((width >= 21 && length >= 28.5) || (width >= 28.5 && length >= 21)) {
  2678. area *= 0.85;
  2679. }
  2680. }
  2681. price = Math.ceil(dj * area);
  2682. pro.setPrice(price > 80 ? price : 80);
  2683. //烫金工艺
  2684. if ("烫金".equals(dto.getCraftTang())) {
  2685. area = length * width / 10000;
  2686. double tangPrice = 0;
  2687. double tangPriceArr[] = new double[4];
  2688. if (area <= 0.005) {
  2689. tangPriceArr = new double[]{90.0, 135.0, 205.0, 255.0, 425, 850, 1700};
  2690. } else if (area <= 0.01) {
  2691. tangPriceArr = new double[]{95.0, 140.0, 225.0, 300.0, 500, 1000, 2000};
  2692. } else if (area <= 0.015) {
  2693. tangPriceArr = new double[]{100.0, 145.0, 245.0, 325.0, 545, 1090, 2180};
  2694. } else if (area <= 0.025) {
  2695. tangPriceArr = new double[]{115.0, 165.0, 280.0, 380.0, 635, 1270, 2540};
  2696. } else if (area <= 0.035) {
  2697. tangPriceArr = new double[]{135.0, 205.0, 335.0, 468.0, 780, 1560, 3120};
  2698. } else {
  2699. tangPriceArr = new double[]{145.0, 225.0, 380.0, 535.0, 895, 1790, 3580};
  2700. }
  2701. tangPrice = tangPriceArr[i] * 1.4 > 135 ? tangPriceArr[i] * 1.4 : 135;
  2702. pro.setPrice(Math.ceil(pro.getPrice() + tangPrice));
  2703. }
  2704. pro.setCount(lszCountArr[i]);
  2705. list.add(pro);
  2706. }
  2707. return list;
  2708. }
  2709. /**
  2710. * 80克硫酸纸价格计算
  2711. *
  2712. * @param dto
  2713. * @param width
  2714. * @param length
  2715. * @param count
  2716. * @param list
  2717. * @return
  2718. */
  2719. public List<Product> get80LszPrice(Product dto, double width, double length, int count, List<Product> list) {
  2720. double dj = 0;
  2721. double l = 420;
  2722. double w = 285;
  2723. length *= 10;
  2724. width *= 10;
  2725. Product pro = new Product();
  2726. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  2727. Math.floor(l / width) * Math.floor(w / length));
  2728. // 报的数量需要多少张大纸
  2729. int num = (int) Math.ceil(count / max);
  2730. // if (count <= 1000) {
  2731. // dj = 150;
  2732. // } else {
  2733. // dj = 150 + Math.ceil(count / 1000) * 20;
  2734. // }
  2735. if (dto.getKindValue().equals("2")) {
  2736. dj = 0.86;
  2737. } else {
  2738. dj = 0.5;
  2739. }
  2740. pro.setPrice(130 + Math.ceil((num + 100) * dj));
  2741. double area = 0;
  2742. if ("烫金".equals(dto.getCraftTang())) {
  2743. int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
  2744. int i = 0;
  2745. for (int j = 0; j < lszCountArr.length; j++) {
  2746. if (lszCountArr[i] > count) {
  2747. break;
  2748. }
  2749. i = j;
  2750. }
  2751. area = length * width / 10000;
  2752. double tangPrice = 0;
  2753. double tangPriceArr[] = new double[4];
  2754. if (area <= 0.005) {
  2755. tangPriceArr = new double[]{135, 189, 287, 357, 595, 1190, 2380};
  2756. } else if (area <= 0.01) {
  2757. tangPriceArr = new double[]{135, 196, 315, 420, 700, 1400, 2800};
  2758. } else if (area <= 0.015) {
  2759. tangPriceArr = new double[]{140, 203, 343, 455, 763, 1526, 3052};
  2760. } else if (area <= 0.025) {
  2761. tangPriceArr = new double[]{161, 231, 392, 532, 889, 1778, 3556};
  2762. } else if (area <= 0.035) {
  2763. tangPriceArr = new double[]{189, 287, 469, 655.2, 1092, 2184, 4368};
  2764. } else {
  2765. tangPriceArr = new double[]{203, 315, 532, 749, 1253, 2506, 5012};
  2766. }
  2767. tangPrice = tangPriceArr[i] * 1.4 > 135 ? tangPriceArr[i] * 1.4 : 135;
  2768. pro.setPrice(Math.ceil(pro.getPrice() + tangPrice));
  2769. }
  2770. pro.setCount(count);
  2771. list.add(pro);
  2772. return list;
  2773. }
  2774. /**
  2775. * 常规刚古水纹超白不干胶计算
  2776. *
  2777. * @param number
  2778. * @param width
  2779. * @param length
  2780. * @param count
  2781. * @return
  2782. */
  2783. public List<Product> getGgSwPrice(double length, double width, int count, int number) {
  2784. double price = 0, area = 0;
  2785. List<Product> list = new ArrayList<Product>();
  2786. Product pro = null;
  2787. for (int i = 0; i < countArr.length; i++) {
  2788. if (countArr[i] < count || list.size() > 3) {
  2789. continue;
  2790. }
  2791. pro = new Product();
  2792. area = (length * width * countArr[i]) / 10000;
  2793. price = 70 * area * number;
  2794. pro.setPrice(Math.ceil(price > 80 ? price : 80));
  2795. pro.setCount(countArr[i]);
  2796. list.add(pro);
  2797. }
  2798. return list;
  2799. }
  2800. /**
  2801. * 帆布计算
  2802. *
  2803. * @param dto
  2804. * @param number
  2805. * @param width
  2806. * @param length
  2807. * @param count
  2808. * @param list
  2809. * @return
  2810. */
  2811. public List<Product> getFbPrice(Product dto, Integer number, Double width, Double length, int count, List<Product> list) {
  2812. Product pro = new Product();
  2813. double price = 0, dj = 0;
  2814. String[] craft = dto.getCraft();
  2815. if (dto.getStickerKind().equals("套餐")) {
  2816. pro.setCount(count);
  2817. pro.setPrice(198.0);
  2818. list.add(pro);
  2819. } else {
  2820. double area = length * width * count / 10000;
  2821. double d = length * width * count / 10000;
  2822. if (length == 100 && width == 45) {
  2823. price = 40 * number * count;
  2824. if (craft != null) {
  2825. for (int i = 0; i < craft.length; i++) {
  2826. if (craft[i].equals("缝兜")) {
  2827. price += number * 10;
  2828. } else {
  2829. continue;
  2830. }
  2831. }
  2832. }
  2833. pro.setCount(count);
  2834. pro.setPrice(price);
  2835. list.add(pro);
  2836. }/*else if(length == 45 && width == 45){
  2837. price = 30 * number * count;
  2838. if(craft != null) {
  2839. for(int i = 0; i< craft.length; i++) {
  2840. if(craft[i].equals("缝兜")) {
  2841. price += number * 10;
  2842. }else {
  2843. continue;
  2844. }
  2845. }
  2846. }
  2847. pro.setPrice(price);
  2848. }*/ else {
  2849. if (d <= 0.2) {
  2850. area *= number;
  2851. }
  2852. if (area <= 0.2) {
  2853. price = 45;
  2854. } else if (area <= 0.5) {
  2855. dj = 80;
  2856. } else if (area <= 0.7) {
  2857. dj = 75;
  2858. } else if (area <= 0.9) {
  2859. dj = 70;
  2860. } else if (area <= 1) {
  2861. dj = 68;
  2862. } else if (area <= 1.9) {
  2863. dj = 65;
  2864. } else if (area <= 3) {
  2865. dj = 60;
  2866. } else {
  2867. dj = 55;
  2868. }
  2869. if (d > 0.2) {
  2870. price = area * dj * number;
  2871. } else {
  2872. if (area <= 0.2) {
  2873. price = 45;
  2874. } else {
  2875. price = area * dj;
  2876. }
  2877. }
  2878. if (craft != null) {
  2879. for (int i = 0; i < craft.length; i++) {
  2880. if (craft[i].equals("缝兜")) {
  2881. price += number * 10;
  2882. } else {
  2883. continue;
  2884. }
  2885. }
  2886. }
  2887. /*if(d > 3 && number > 1) {
  2888. price += (number-1) * 20;
  2889. }*/
  2890. price = Math.ceil(price > 45 ? price : 45);
  2891. double other_price = 0;
  2892. if (length * width < 40 * 50) {
  2893. int total = count * number;
  2894. for (int i = 1; i <= total; i++) {
  2895. other_price = getFBPirce(width, length, i, 1);
  2896. if (other_price > 45) {
  2897. price = 45 + (total - i + 1) * 6;
  2898. break;
  2899. }
  2900. }
  2901. }
  2902. pro.setPrice(price);
  2903. pro.setCount(count);
  2904. pro.setWeight(df.format(area * 0.28 * number));
  2905. list.add(pro);
  2906. }
  2907. }
  2908. return list;
  2909. }
  2910. public double getFBPirce(double length, double width, int count, int number) {
  2911. double area = length * width * count / 10000;
  2912. double d = length * width * count / 10000;
  2913. double price = 0, dj = 0;
  2914. if (length == 100 && width == 45) {
  2915. price = 40 * number * count;
  2916. } else {
  2917. if (d <= 0.2) {
  2918. area *= number;
  2919. }
  2920. if (area <= 0.2) {
  2921. price = 45;
  2922. } else if (area <= 0.5) {
  2923. dj = 80;
  2924. } else if (area <= 0.7) {
  2925. dj = 75;
  2926. } else if (area <= 0.9) {
  2927. dj = 70;
  2928. } else if (area <= 1) {
  2929. dj = 68;
  2930. } else if (area <= 1.9) {
  2931. dj = 65;
  2932. } else if (area <= 3) {
  2933. dj = 60;
  2934. } else {
  2935. dj = 55;
  2936. }
  2937. if (d > 0.2) {
  2938. price = area * dj * number;
  2939. } else {
  2940. if (area <= 0.2) {
  2941. price = 45;
  2942. } else {
  2943. price = area * dj;
  2944. }
  2945. }
  2946. price = Math.ceil(price > 45 ? price : 45);
  2947. }
  2948. return price;
  2949. }
  2950. public double getTestPrice(double length, double width, int count, int number,
  2951. double[] areas, double[] prices, double minPrice, double lastPrice) {
  2952. final int total = count * number;
  2953. for (int i = 1; i <= total; i++) {
  2954. double currentPrice = new PriceUtils().getOptimizedPrice(
  2955. length,
  2956. width,
  2957. i, // 当前数量
  2958. 1, // number 参数固定为1
  2959. areas,
  2960. prices,
  2961. minPrice,
  2962. lastPrice
  2963. );
  2964. if (currentPrice > minPrice) {
  2965. // 计算累加价格:基础价 + 剩余项*6
  2966. return minPrice + (total - i + 1) * 6;
  2967. }
  2968. }
  2969. // 未触发条件时返回基础最低价
  2970. return minPrice;
  2971. }
  2972. public double getOptimizedPrice(double length, double width, int count, int number,
  2973. double[] areas, double[] prices, double minPrice, double lastPrice) {
  2974. final double area = length * width * count / 10000;
  2975. final boolean isSmallArea = area <= 0.2;
  2976. // 计算调整后的面积值
  2977. final double adjustedArea = isSmallArea ? area * number : area;
  2978. // 确定单价基准
  2979. double unitPrice = isSmallArea ? minPrice : lastPrice;
  2980. if (!isSmallArea) {
  2981. for (int i = 0; i < areas.length; i++) {
  2982. if (adjustedArea <= areas[i]) {
  2983. unitPrice = prices[i];
  2984. break;
  2985. }
  2986. }
  2987. }
  2988. // 计算基础价格
  2989. double basePrice = isSmallArea ? minPrice : adjustedArea * unitPrice;
  2990. // 应用数量系数
  2991. double finalPrice = (area > 0.2) ? basePrice * number : basePrice;
  2992. // 确保最低价格并取整
  2993. return Math.ceil(Math.max(finalPrice, minPrice));
  2994. }
  2995. /**
  2996. * 亚克力计算
  2997. *
  2998. * @param dto
  2999. * @param number
  3000. * @param width
  3001. * @param length
  3002. * @param count
  3003. * @param list
  3004. * @return
  3005. */
  3006. public List<Product> getYklPrice(Product dto, Integer number, Double width, Double length, int count, List<
  3007. Product> list) {
  3008. Product pro = new Product();
  3009. double price = 0, dj = 0;
  3010. double l = 1200;
  3011. double w = 2400;
  3012. double area = length * width * count / 10000;
  3013. String kind = dto.getKind2Value();
  3014. length = length * 10;
  3015. width = width * 10;
  3016. if ((length > l || width > w) && (length > w || width > l))
  3017. return null;
  3018. // 一张大纸能做多少个此类尺寸的不干胶
  3019. double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
  3020. Math.floor(l / width) * Math.floor(w / length));
  3021. // 报的数量需要多少张大纸
  3022. int num = (int) Math.ceil(count / max);
  3023. if (num > 1) {
  3024. if (kind.equals("1")) {
  3025. dj = 317;
  3026. } else if (kind.equals("2")) {
  3027. dj = 357;
  3028. } else if (kind.equals("3")) {
  3029. dj = 477;
  3030. } else if (kind.equals("4")) {
  3031. dj = 375;
  3032. } else {
  3033. dj = 415;
  3034. }
  3035. price = dj * 1.8 + dj * 1.5 * (num - 1);
  3036. pro.setPrice(Math.ceil(price));
  3037. } else {
  3038. if (area <= 0.02) {
  3039. dj = 1800;
  3040. } else if (area <= 0.03) {
  3041. dj = 1300;
  3042. } else if (area <= 0.05) {
  3043. dj = 1000;
  3044. } else if (area <= 0.06) {
  3045. dj = 900;
  3046. } else if (area <= 0.07) {
  3047. dj = 800;
  3048. } else if (area <= 0.08) {
  3049. dj = 700;
  3050. } else if (area <= 0.16) {
  3051. dj = 650;
  3052. } else if (area <= 0.25) {
  3053. dj = 550;
  3054. } else if (area <= 0.4) {
  3055. dj = 500;
  3056. } else if (area <= 0.5) {
  3057. dj = 400;
  3058. } else if (area <= 0.6) {
  3059. dj = 350;
  3060. } else if (area <= 0.8) {
  3061. dj = 300;
  3062. } else if (area <= 1) {
  3063. dj = 280;
  3064. } else if (area <= 2) {
  3065. dj = 250;
  3066. } else if (area <= 3) {
  3067. dj = 240;
  3068. } else if (area <= 4) {
  3069. dj = 230;
  3070. } else if (area <= 5) {
  3071. dj = 225;
  3072. }
  3073. price = area * dj * 2.5;
  3074. if (kind.equals("5")) {
  3075. price = price * 1.2;
  3076. } else {
  3077. if (kind.equals("2")) {
  3078. price = price * 1.1;
  3079. } else if (kind.equals("3")) {
  3080. price = price * 1.3;
  3081. }
  3082. }
  3083. }
  3084. double weight = 0;
  3085. if (kind.equals("1") || kind.equals("4")) {
  3086. weight = area * number * 2.26;
  3087. } else if (kind.equals("2") || kind.equals("5")) {
  3088. weight = area * number * 3.06;
  3089. } else if (kind.equals("3")) {
  3090. weight = area * number * 5.11;
  3091. }
  3092. pro.setPrice(Math.ceil(price > 50 ? price : 50));
  3093. pro.setCount(count);
  3094. pro.setWeight(String.valueOf(df.format(weight)));
  3095. list.add(pro);
  3096. return list;
  3097. }
  3098. /**
  3099. * 灯布计算
  3100. *
  3101. * @param width
  3102. * @param length
  3103. * @param count
  3104. * @param list
  3105. * @return
  3106. */
  3107. public List<Product> getDbPrice(String kind, Double width, Double length, int count, List<Product> list, int number) {
  3108. //11-550灯布 12-520灯布 13-550黑底灯布
  3109. Product pro = new Product();
  3110. double price = 0, dj = 0;
  3111. double area = length * width * count / 10000;
  3112. double[] areas = {};
  3113. double[] prices = {};
  3114. double last_price = 0;
  3115. double min_price = 0;
  3116. if ("11".equals(kind)) {
  3117. areas = new double[]{5, 10,};
  3118. prices = new double[]{20, 18};
  3119. last_price = 17;
  3120. min_price = 55 + 15;
  3121. } else if ("12".equals(kind)) {
  3122. areas = new double[]{5, 10,};
  3123. prices = new double[]{16, 12};
  3124. last_price = 10;
  3125. min_price = 50 + 15;
  3126. } else {
  3127. areas = new double[]{5, 10,};
  3128. prices = new double[]{24, 20};
  3129. last_price = 18;
  3130. min_price = 60 + 15;
  3131. }
  3132. if (width * length < 40 * 50) {
  3133. price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
  3134. } else {
  3135. dj = last_price;
  3136. for (int i = 0; i < areas.length; i++) {
  3137. if (area <= areas[i]) {
  3138. dj = prices[i];
  3139. break;
  3140. }
  3141. }
  3142. price = Math.max(area * dj, min_price);
  3143. }
  3144. if (number > 1 && width * length >= 40 * 50) {
  3145. pro.setPrice(Math.ceil(price * number));
  3146. } else {
  3147. pro.setPrice(Math.ceil(price));
  3148. }
  3149. pro.setCount(count);
  3150. list.add(pro);
  3151. return list;
  3152. }
  3153. /**
  3154. * 串旗计算
  3155. *
  3156. * @param width
  3157. * @param length
  3158. * @param count
  3159. * @param num
  3160. * @param list
  3161. * @return
  3162. */
  3163. public List<Product> getCqPrice(Double width, Double length, int count, int num, List<Product> list) {
  3164. Product pro = new Product();
  3165. double price = 0, dj = 0;
  3166. double area = (width * length) / 10000;
  3167. if (area <= 0.042) {
  3168. price = 50 + 5 * count * num;
  3169. } else if (area <= 0.1125) {
  3170. dj = 120;
  3171. } else if (area <= 0.2) {
  3172. dj = 110;
  3173. } else if (area <= 0.5) {
  3174. dj = 100;
  3175. } else if (area <= 0.7) {
  3176. dj = 95;
  3177. } else if (area <= 0.9) {
  3178. dj = 90;
  3179. } else if (area <= 1) {
  3180. dj = 85;
  3181. } else {
  3182. dj = 80;
  3183. }
  3184. if (area > 0.042) {
  3185. price = dj * area * count * num;
  3186. }
  3187. price = Math.ceil(price > 50 ? price : 50);
  3188. double wei = area * 0.29 * count * num;
  3189. pro.setPrice(price);
  3190. pro.setCount(count);
  3191. pro.setWeight(df.format(wei));
  3192. list.add(pro);
  3193. return list;
  3194. }
  3195. /**
  3196. * 桌布
  3197. *
  3198. * @param length
  3199. * @param width
  3200. * @param count
  3201. * @param number
  3202. * @return
  3203. */
  3204. public List<Product> getTableClothPrice(Double length, Double width, int count, Integer
  3205. number, List<Product> priceList) {
  3206. double price = 0, dj = 0;
  3207. if (length <= 0.8 && width <= 0.8) {
  3208. dj = 77;
  3209. } else if ((length <= 0.8 && width <= 1.6) || (length <= 1.6 && width <= 0.8)) {
  3210. dj = 43;
  3211. } else if ((length <= 1.2 && width <= 1.6) || (length <= 1.6 && width <= 1.2)) {
  3212. dj = 29;
  3213. } else if ((length <= 1.4 && width <= 1.6) || (length <= 1.6 && width <= 1.4)) {
  3214. dj = 28;
  3215. } else if ((length <= 1.6 && width <= 2.0) || (length <= 2.0 && width <= 1.6)) {
  3216. dj = 27;
  3217. }/*else if((length <= 1.8 && width <= 2.0) || (length <= 2.0 && width <= 1.8)) {
  3218. dj = 26;
  3219. }else if((length <= 1.6 && width <= 2.5) || (length <= 2.5 && width <= 1.6)) {
  3220. dj = 26;
  3221. }*/ else {
  3222. dj = 26;
  3223. }
  3224. Product pro = new Product();
  3225. List<Product> list = new ArrayList<Product>();
  3226. price = length * width * count * number * dj;
  3227. pro.setCount(count);
  3228. pro.setPrice(Math.ceil(price > 50 ? price : 50));
  3229. pro.setWeight(df.format(0.3 * length * width * count * number));
  3230. list.add(pro);
  3231. return list;
  3232. }
  3233. public List<Product> getShkPrice(String size, int count, Integer number) {
  3234. int[] countArr = {200, 500, 1000, 2000, 5000, 10000};
  3235. double[] priceArr = {};
  3236. List<Product> list = new ArrayList<Product>();
  3237. Product pro = new Product();
  3238. if (size.equals("9*5.4")) {
  3239. priceArr = new double[]{25.0, 26.0, 27.0, 50.0, 110.0, 200.0};
  3240. } else if (size.equals("9*11")) {
  3241. priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
  3242. } else if (size.equals("8*11")) {
  3243. priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
  3244. } else if (size.equals("7*14")) {
  3245. priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
  3246. } else if (size.equals("8*14")) {
  3247. priceArr = new double[]{44.0, 46.0, 72.0, 120.0, 260.0, 500.0};
  3248. } else if (size.equals("10*15")) {
  3249. priceArr = new double[]{44.0, 66.0, 88.0, 150.0, 350.0, 600.0};
  3250. } else if (size.equals("11*18")) {
  3251. priceArr = new double[]{61.0, 83.0, 94.0, 160.0, 400.0, 650.0};
  3252. } else if (size.equals("9*9")) {
  3253. priceArr = new double[]{30.0, 41.0, 44.0, 75.0, 200.0, 400.0};
  3254. } else {
  3255. priceArr = new double[]{44.0, 66.0, 88.0, 120.0, 260.0, 500.0};
  3256. }
  3257. for (int i = 0; i < countArr.length; i++) {
  3258. if (countArr[i] < count) {
  3259. continue;
  3260. }
  3261. if (list.size() > 3) {
  3262. break;
  3263. }
  3264. pro = new Product();
  3265. pro.setCount(countArr[i]);
  3266. pro.setPrice(Math.ceil(number * priceArr[i]));
  3267. list.add(pro);
  3268. }
  3269. return list;
  3270. }
  3271. public List<Product> getSdkPrice(int count, Integer number) {
  3272. int[] countArr = {50, 100, 500, 1000, 2000, 5000, 10000};
  3273. double[] priceArr = new double[]{339, 599, 1800.0, 3000.0, 4800.0, 8000.0, 15000.0};
  3274. Product pro = new Product();
  3275. List<Product> list = new ArrayList<Product>();
  3276. for (int i = 0; i < countArr.length; i++) {
  3277. if (countArr[i] < count) {
  3278. continue;
  3279. }
  3280. if (list.size() > 3) {
  3281. break;
  3282. }
  3283. pro = new Product();
  3284. pro.setCount(countArr[i]);
  3285. pro.setPrice(Math.ceil(number * priceArr[i]));
  3286. list.add(pro);
  3287. }
  3288. return list;
  3289. }
  3290. public double TablePrice(double area, int[] price_list, double[] areas) {
  3291. double price = 0;
  3292. int startIndex = 0;
  3293. int endIndex = 0;
  3294. for (int i = 0; i < areas.length; i++) {
  3295. if (area > areas[i]) {
  3296. startIndex = endIndex;
  3297. endIndex = Math.min(i + 1, areas.length - 1);
  3298. }
  3299. }
  3300. if (startIndex == endIndex && startIndex == 0) {
  3301. price = price_list[endIndex];
  3302. } else if (startIndex == endIndex) {
  3303. price = (price_list[endIndex] / areas[endIndex]) * area;
  3304. } else {
  3305. price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
  3306. }
  3307. return price;
  3308. }
  3309. public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) {
  3310. double price = 0;
  3311. int startIndex = 0;
  3312. int endIndex = 0;
  3313. boolean islast = false;
  3314. for (int i = 0; i < areas.length; i++) {
  3315. if (area > areas[i]) {
  3316. startIndex = endIndex;
  3317. endIndex = Math.min(i + 1, areas.length - 1);
  3318. }
  3319. if (area == areas[i]) {
  3320. endIndex = startIndex = i;
  3321. }
  3322. if (area > areas[i] && i == areas.length - 1) {
  3323. islast = true;
  3324. }
  3325. }
  3326. if (startIndex == endIndex && startIndex == 0) {
  3327. price = price_list[endIndex] * area;
  3328. } else if (startIndex == endIndex) {
  3329. price = (price_list[endIndex] * areas[endIndex] / areas[endIndex]) * area;
  3330. } else {
  3331. double end_price = price_list[endIndex]*areas[endIndex];
  3332. double start_price = price_list[startIndex]*areas[startIndex];
  3333. price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * start_price + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * end_price;
  3334. }
  3335. price = islast ? last_price * area : price;
  3336. return Math.ceil(price);
  3337. }
  3338. public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum) {
  3339. if (craft_list.contains("烫画")) {
  3340. return (int) count * 120;
  3341. }
  3342. double price = 0;
  3343. if (craft_list.contains("冷转印")) {
  3344. double banfei = 200;
  3345. if (countNum > 1) {
  3346. price = 260 * countNum;
  3347. banfei = 0;
  3348. count = Math.abs(count - countNum);
  3349. }
  3350. if (count > 0) {
  3351. if (count <= 5) {
  3352. price += 260;
  3353. } else if (count < 100) {
  3354. price += 14 * count + banfei;
  3355. } else {
  3356. price += 12 * count;
  3357. }
  3358. }
  3359. price = price + (coNumber - 1) * 100;
  3360. }
  3361. return price;
  3362. }
  3363. }