PriceUtils.java 144 KB

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