PriceUtils.java 121 KB

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