| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587 |
- package lingtao.net.util;
- import lingtao.net.bean.Product;
- import org.springframework.util.StringUtils;
- import java.text.DecimalFormat;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- public class PriceUtils {
- DecimalFormat df = new DecimalFormat("0.00");
- int countArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000};
- /**
- * 卷标标签价格
- *
- * @param kind
- * @param area
- * @param count
- * @param craft
- * @param tang
- * @param yinbai
- * @return
- */
- public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices) {
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- // 最低收费
- double lowerPrice = 0.0;
- // 印工价格
- double yinrPrice = 0.0;
- // 平方单价
- double danjia = 0.0;
- // 总价
- double price = 0.0;
- // 根据报的尺寸、数量算面积(保留2位小数)
- area = Double.valueOf(df.format(area * count));
- if (area <= 20) {
- yinrPrice = 260;
- lowerPrice = 550;
- } else if (area <= 150) {
- yinrPrice = 300;
- lowerPrice = 600;
- }
- switch (kind) {
- /**
- * 0:格底铜版纸卷标 1:格底PP合成纸 2:8丝光白PVC 3:5丝格底透明 4:格底哑金/哑银 5:格底银平光 6:单防热敏纸(底纸白色)
- * 7:三防热敏纸(底纸蓝色)
- */
- case "0":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 8;
- } else if (area <= 150) {
- danjia = 8;
- } else if (area <= 200) {
- danjia = 10.5;
- } else {
- danjia = 10.3;
- }
- break;
- case "1":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 10;
- } else if (area <= 150) {
- danjia = 10;
- } else if (area <= 200) {
- danjia = 12.5;
- } else {
- danjia = 12.3;
- }
- break;
- case "2":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 10;
- } else if (area <= 150) {
- danjia = 10;
- } else if (area <= 200) {
- danjia = 12.5;
- } else {
- danjia = 12.3;
- }
- break;
- case "3":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 10;
- } else if (area <= 150) {
- danjia = 10;
- } else if (area <= 200) {
- danjia = 12.5;
- } else {
- danjia = 12.3;
- }
- break;
- case "4":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 12;
- } else if (area <= 150) {
- danjia = 12;
- } else if (area <= 200) {
- danjia = 15;
- } else {
- danjia = 14.8;
- }
- break;
- case "5":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 12;
- } else if (area <= 150) {
- danjia = 12;
- } else if (area <= 200) {
- danjia = 15;
- } else {
- danjia = 14.8;
- }
- break;
- case "6":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 9;
- } else if (area <= 150) {
- danjia = 9;
- } else if (area <= 200) {
- danjia = 11;
- } else {
- danjia = 10.8;
- }
- break;
- case "7":
- // 根据面积得到单价
- if (area <= 20) {
- danjia = 9.5;
- } else if (area <= 150) {
- danjia = 9.5;
- } else if (area <= 200) {
- danjia = 11.5;
- } else {
- danjia = 11.3;
- }
- break;
- }
- // 加上覆膜的价格 (覆哑膜/亮膜 0.6元/平方, 镭射膜1元/平方)
- if (!StringUtils.isEmpty(craft)) {
- if ("大雪花镭射膜".equals(craft[0])) {
- danjia = danjia + 1;
- } else if ("覆哑膜".equals(craft[0])) {
- danjia = danjia + 0.8;
- } else {
- danjia = danjia + 0.6;
- }
- }
- price = Math.ceil(Math.max(area * danjia + yinrPrice + count * 0.01, lowerPrice));
- // 如果有印白工艺:2元一平方,最低收费200元
- if (!StringUtils.isEmpty(yinbai)) {
- price = price + (area * 2 > 200 ? area * 2 : 200);
- }
- double tang_price = 0;
- if (!StringUtils.isEmpty(tang) && "烫金".equals(tang)) {
- int[] bigCountArr = {500, 1000, 2000, 3000, 5000, 10000};
- for (int i = 0; i < bigCountArr.length; i++) {
- if (count >= bigCountArr[i]) {
- tang_price = price + tangPrices[i];
- }
- }
- }
- pro.setCount(count);
- pro.setPrice(Math.max(tang_price, price));
- list.add(pro);
- /*
- * for (int i = 0; i < countArr.length; i++) { if (countArr[i] < count) {
- * continue; } if (countArr[i] * area <= 150) { danjia = 15; } else if
- * (countArr[i] * area <= 200) { danjia = 14.5; } else { danjia = 14; } if
- * (!StringUtils.isEmpty(craft)) { if (!"大雪花镭射膜".equals(craft[0])) { danjia =
- * danjia + 1; } else { danjia = danjia + 0.6; } } pro = new Product();
- * pro.setCount(countArr[i]); pro.setPrice(Math.ceil(countArr[i] * area * danjia
- * > 550 ? countArr[i] * area * danjia : 550)); list.add(pro); }
- */
- return list;
- }
- /**
- * 合版封套自定义尺寸
- *
- * @param kind
- * @param count
- * @param min
- * @param priceArr
- * @return
- */
- public List<Product> getEnvelope(String kind, int count, int min, int[] priceArr) {
- int countArr[] = {200, 500, 1000, 2000, 5000, 10000};
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(min * priceArr[i] + 80 + 0.05 * countArr[i] + 30 + 0.06 * countArr[i]));
- list.add(pro);
- }
- return list;
- }
- /**
- * 房卡套特殊尺寸
- *
- * @param count
- * @param min
- * @return
- */
- public List<Product> getRoomCard(int count, int min) {
- int countArr[] = {200, 500, 1000, 2000, 5000, 10000};
- int priceArr[] = {40, 50, 70, 90, 160, 300};
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(min * priceArr[i] + 0.05 * countArr[i] + 60 + 30 + 0.06 * countArr[i]));
- list.add(pro);
- }
- return list;
- }
- /**
- * 打印不干胶带纯烫金价格
- *
- * @param kind
- * @param addPrice
- * @param yinbai
- */
- public Product getA(String kind, Double width, Double length, int count, double price, double addPrice,
- Integer number, String craftTang, String yinbai) {
- //List<Product> list = new ArrayList<Product>();
- if ("印白墨".equals(yinbai)) {
- price = 50;
- addPrice = 30;
- } else if ("黑白".equals(yinbai)) {
- price = 40;
- }
- double l = 425;
- double w = 285;
- if ("0".equals(kind) || "4".equals(kind)) {
- l = 430;
- w = 290;
- }
- // 哑金不干胶
- if ("5".equals(kind)) {
- l = 390;
- w = 270;
- }
- Product pro = new Product();
- // 数量*款数就是张数
- count = count * number;
- // 换成毫米每边+2
- length = length * 10 + 4;
- width = width * 10 + 4;
- if ((length > l || width > w) && (length > w || width > l))
- return null;
- // 一张大纸能做多少个此类尺寸的不干胶
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- price = price + (num - 1) * addPrice;
- if ("纯烫金".equals(craftTang) || "彩色印刷+烫金/银".equals(craftTang)) {
- // 一张纸张价格+大纸张数*addPrice + 每张烫金+20块(1张起收)(5*5cm内30元一张)
- if (width < 54 && length < 54) {
- price += num * 60;
- } else {
- price += num * 40;
- }
- }
- if ("彩色印刷+烫金/银".equals(craftTang)) {
- price = price > 80 ? price : 80;
- }
- // if ("印白墨".equals(yinbai)) {
- // // 透明不干胶,印白墨工艺,每张大纸+20(1张起收)
- // price = price + num * 20;
- // }
- // if(number > 1) {
- // price = price + (number - 1) * 15;
- // }
- pro.setCount(count / number);
- pro.setPrice(Math.ceil(price));
- return pro;
- }
- /**
- * 哑银不干胶价格
- *
- * @param kind
- * @param addPrice
- * @param yinbai
- */
- public List<Product> getYy(String kind, Double width, Double length, int count, double price, double addPrice,
- Integer number, String craftTang, String yinbai) {
- List<Product> list = new ArrayList<Product>();
- double l = 420;
- double w = 285;
- // 换成毫米每边+2
- length = length * 10 + 4;
- width = width * 10 + 4;
- if ((length > l || width > w) && (length > w || width > l))
- return null;
- // 一张大纸能做多少个此类尺寸的不干胶
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- if ("印白墨".equals(yinbai)) {
- price = 50;
- addPrice = 30;
- }
- Product pro = new Product();
- // 数量*款数就是张数
- count = countArr[i] * number;
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- if ("纯烫金".equals(craftTang)) {
- // 一张纸张价格+大纸张数*addPrice + 每张烫金+20块(1张起收)(5*5cm内30元一张)
- if (width < 54 && length < 54) {
- price = price + (num - 1) * addPrice + num * 30;
- } else {
- price = price + (num - 1) * addPrice + num * 20;
- }
- } else if ("彩色印刷+烫金/银".equals(craftTang)) {
- if (width <= 154 && length <= 154) {
- price = price + (count * 0.15 + 200 > 200 ? count * 0.15 + 200 : 200);
- } else if (width > 154 || length > 154) {
- price = price + (count * 0.13 + 180 > 210 ? count * 0.13 + 180 : 210);
- }
- } else {
- price = price + (num - 1) * addPrice;
- }
- if (number > 1) {
- price = price + (number - 1) * 5;
- }
- // if ("印白墨".equals(yinbai)) {
- // // 透明不干胶,印白墨工艺,每张大纸+20(1张起收)
- // price = price + num * 20;
- // }
- pro.setCount(count / number);
- /*if (length == 14.0 && width == 14.0) {
- price = price * 2;
- }*/
- pro.setPrice(Math.ceil(price));
- list.add(pro);
- }
- return list;
- }
- // 不干胶常规数量美纹纸价格计算
- public List<Product> getMeiWenZhiPrice(Double length, Double width, int count, Integer number, String craftMo) {
- List<Product> priceList = new ArrayList<>();
- int[][] prices = new int[][]{
- {79, 107, 134, 272, 343, 685, 1030, 1374, 1787, 2322, 2748, 3302, 4351},
- {84, 112, 139, 277, 348, 690, 1035, 1379, 1792, 2327, 2753, 3307, 4356},
- {161, 222, 278, 553, 690, 1377, 2065, 2748, 3584, 4653, 5505, 6614, 8712},
- {318, 443, 552, 1101, 1377, 2753, 4119, 5475, 7128, 9108, 10613, 12435, 13068},
- {475, 661, 828, 1652, 2066, 4129, 6178, 8213, 10692, 13662, 15920, 18652, 19602},
- {788, 1099, 1380, 2743, 3430, 6856, 10272, 13613, 17721, 22275, 25542, 29700, 32670},
- {1575, 2188, 2747, 5485, 6859, 13712, 20543, 27225, 35442, 44550, 51084, 59400, 65340},
- {3150, 4355, 5494, 10930, 13662, 27324, 40887, 54054, 69894, 87120, 99000, 114444, 121968},
- };
- int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000, 20000};
- double[] areas = new double[]{26, 37, 49.6, 82, 127, 171, 231, 295, 361, 451, 600.5, 902, 1199};
- double area = length * width;
- for (int i = 0; i < count_list.length; i++) {
- int count_item = count_list[i];
- if (priceList.size() > 2) {
- break;
- }
- if (count > count_item) {
- continue;
- }
- int count_index = Arrays.binarySearch(count_list, count_item);
- double price = 0;
- if (count_index >= 0) {
- price = new PriceUtils().TablePrice(area, prices[count_index], areas);
- }
- Product product = new Product();
- product.setCount(count_item);
- product.setPrice(Math.ceil(price));
- priceList.add(product);
- }
- return priceList;
- }
- /**
- * 插卡遍历添加价格
- */
- private List<Product> acountInsertCardPrice(int count, List<Product> list, Double[] priceArr) {
- int countArr[] = {200, 500, 1000, 2000, 3000, 5000, 10000};
- Product pro;
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArr[i]);
- list.add(pro);
- }
- return list;
- }
- /**
- * 菱形单面直角插排
- */
- public List<Product> getInsertCard(String size, int count) {
- List<Product> list = new ArrayList<>();
- if ("4.5*4.5".equals(size)) {
- Double priceArr[] = {40.0, 50.0, 80.0, 120.0, 160.0, 270.0, 480.0};
- list = acountInsertCardPrice(count, list, priceArr);
- } else if ("5*5".equals(size)) {
- Double priceArr[] = {50.0, 60.0, 80.0, 130.0, 140.0, 300.0, 520.0};
- list = acountInsertCardPrice(count, list, priceArr);
- } else {
- Double priceArr[] = {40.0, 50.0, 70.0, 110.0, 160.0, 260.0, 480.0};
- list = acountInsertCardPrice(count, list, priceArr);
- }
- return list;
- }
- // 9*5.4cm(一个名片位)以内价格
- public List<Product> oneCradPrice(int count) {
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- int countArr[] = {1000, 2000, 5000, 10000, 20000};
- int priceArr[] = {70, 110, 250, 500, 900};
- if (count <= 20000) {
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(priceArr[i]));
- list.add(pro);
- }
- } else {
- pro = new Product();
- pro.setCount(count);
- pro.setPrice(Math.ceil(count * 0.045));
- list.add(pro);
- }
- return list;
- }
- /**
- * 普通吊牌/服装吊牌 300/350克直角打孔吊牌价格
- *
- * @param dto
- * @param width
- * @param length
- * @param count
- * @param priceList
- * @return
- */
- public List<Product> tags300PriceCraftZhi(Product dto, Double width, Double length, int count,
- List<Product> priceList) {
- double l1;
- double w1;
- double l2;
- double w2;
- int min;
- l1 = Math.ceil(length / 9);
- w1 = Math.ceil(width / 5.4);
- l2 = Math.ceil(width / 9);
- w2 = Math.ceil(length / 5.4);
- // 产品位数
- min = (int) Math.min(l1 * w1, l2 * w2);
- if (min == 1) {
- double priceArr[] = {43, 52, 70, 110, 186, 242, 250, 500};
- priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- } else if (min == 2) {
- double priceArr[] = {48, 70, 75, 110, 180, 230, 270, 520};
- priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- } else if (min == 3) {
- double priceArr[] = {68, 93, 155, 276, 369, 484, 578, 1111};
- priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- } else if (min == 4) {
- double priceArr[] = {80, 100, 186, 333, 496, 617, 736, 1417};
- priceList = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- }
- if (min > 1) {
- for (Product product : priceList) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- if ("不覆膜".equals(dto.getCraftMo())) {
- for (Product product : priceList) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- // 300克的模切材质才有第二尺寸
- // 第二尺寸不为空
- if (!StringUtils.isEmpty(dto.getSize1())) {
- String size1 = dto.getSize1();
- Double length1 = null;
- Double width1 = null;
- List<Product> priceListSecond = new ArrayList<Product>();
- length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
- if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
- width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
- } else {
- width1 = Double
- .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
- }
- length1 = Math.abs(length1);
- width1 = Math.abs(width1);
- l1 = Math.ceil(length1 / 9);
- w1 = Math.ceil(width1 / 5.4);
- l2 = Math.ceil(width1 / 9);
- w2 = Math.ceil(length1 / 5.4);
- // 产品位数
- min = (int) Math.min(l1 * w1, l2 * w2);
- if (min == 1) {
- double priceArr[] = {43, 52, 72, 128, 186, 242, 276, 526};
- priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- } else if (min == 2) {
- double priceArr[] = {48, 78, 110, 202, 283, 351, 419, 805};
- priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- } else if (min == 3) {
- double priceArr[] = {68, 93, 155, 276, 369, 484, 578, 1111};
- priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- } else if (min == 4) {
- double priceArr[] = {80, 100, 186, 333, 496, 617, 736, 1417};
- priceListSecond = new PriceUtils().acountTags300PriceCraftZhi(count, priceArr);
- }
- if (min > 1) {
- for (Product product : priceListSecond) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- if ("不覆膜".equals(dto.getCraftMo())) {
- for (Product product : priceListSecond) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- // 如果俩个价格一样,后一位价格+10
- for (int i = 0; i < priceListSecond.size() - 1; i++) {
- if (priceListSecond.get(i).getPrice().equals(priceListSecond.get(i + 1).getPrice())) {
- priceListSecond.get(i + 1).setPrice(priceListSecond.get(i + 1).getPrice() + 10);
- }
- }
- // 俩个尺寸的价格相加 再*0.96
- for (int i = 0; i < priceList.size(); i++) {
- priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
- }
- }
- return priceList;
- }
- /**
- * 吊牌300克直角打孔价格计算
- */
- public List<Product> acountTags300PriceCraftZhi(int count, double[] priceArr) {
- int countArr[] = {200, 500, 1000, 2000, 3000, 4000, 5000, 10000};
- List<Product> list = new ArrayList<>();
- Product pro = new Product();
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArr[i]);
- list.add(pro);
- }
- return list;
- }
- /**
- * 其他吊牌300克 异形模切价格
- *
- * @param dto
- * @param number
- * @param width
- * @param length
- * @param area
- * @param count
- * @param priceList
- * @return
- */
- public List<Product> tags300PriceCraftMo(Product dto, Integer number, Double width, Double length, Double area,
- int count, List<Product> priceList) {
- if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
- length = 9.0;
- width = 5.4;
- area = length * width / 10000;
- }
- List<Product> priceList2 = new ArrayList<Product>();
- // 有工艺(覆膜)
- if ("双面覆哑膜".equals(dto.getCraftMo())) {
- double priceArr[] = {27, 18, 15, 14, 14, 14};
- priceList = new PriceUtils().acountTags300PriceCraftMo(area, count, number, priceArr);
- priceList2 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
- } else if ("不覆膜".equals(dto.getCraftMo())) {
- double priceArr[] = {26, 17, 14, 13, 13, 13};
- priceList = new PriceUtils().acountTags300PriceCraftMo(area, count, number, priceArr);
- priceList2 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
- }
- // 自定义尺寸和固定尺寸对比价格。
- for (int i = 0; i < priceList.size(); i++) {
- for (int j = 0; j < priceList2.size(); j++) {
- if (priceList.get(j).getPrice() < priceList2.get(j).getPrice()) {
- priceList.get(j).setPrice(priceList2.get(j).getPrice() + 5);
- }
- }
- }
- // 第二尺寸不为空
- if (!StringUtils.isEmpty(dto.getSize1())) {
- String size1 = dto.getSize1();
- Double length1 = null;
- Double width1 = null;
- Double area1 = null;
- List<Product> priceListSecond = new ArrayList<Product>();
- length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
- if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
- width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
- } else {
- width1 = Double
- .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
- }
- length1 = Math.abs(length1);
- width1 = Math.abs(width1);
- if (((length1 <= 9 && width1 <= 5.4) || (length1 <= 5.4 && width1 <= 9))) {
- length1 = 9.0;
- width1 = 5.4;
- area1 = length1 * width1 / 10000;
- }
- List<Product> priceList3 = new ArrayList<Product>();
- // 有工艺(覆膜)
- if ("双面覆哑膜".equals(dto.getCraftMo())) {
- double priceArr[] = {27, 18, 15, 14, 14, 14};
- priceListSecond = new PriceUtils().acountTags300PriceCraftMo(area1, count, number, priceArr);
- priceList3 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
- } else if ("不覆膜".equals(dto.getCraftMo())) {
- double priceArr[] = {26, 17, 14, 13, 13, 13};
- priceListSecond = new PriceUtils().acountTags300PriceCraftMo(area1, count, number, priceArr);
- priceList3 = new PriceUtils().acountTags300PriceCraftMo(0.00486, count, number, priceArr);
- }
- // 自定义尺寸和固定尺寸对比价格。
- for (int i = 0; i < priceListSecond.size(); i++) {
- for (int j = 0; j < priceList3.size(); j++) {
- if (priceListSecond.get(j).getPrice() < priceList3.get(j).getPrice()) {
- priceListSecond.get(j).setPrice(priceList3.get(j).getPrice() + 5);
- }
- }
- }
- // 俩个尺寸的价格相加 再*0.96
- for (int i = 0; i < priceList.size(); i++) {
- priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
- }
- }
- return priceList;
- }
- /**
- * 其他吊牌300克异形模切价格计算===》 不复膜的 计算方法:长*宽*数量500张*22+每款设计费7元+绳子10元
- *
- * @param area
- * @param count
- * @param number
- * @param priceArr
- * @return
- */
- public List<Product> acountTags300PriceCraftMo(Double area, int count, Integer number, double[] priceArr) {
- int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
- // 数量大于1万,单独报价;
- List<Product> list = new ArrayList<>();
- Product pro = new Product();
- // 设计费 7元/款
- double designFee = 7;
- // 绳子 1分5一条
- double shengzi = 0.015;
- if (count > 10000) {
- pro.setCount(count);
- pro.setPrice(Math.ceil(area * count * priceArr[priceArr.length - 1] + designFee + count * shengzi));
- list.add(pro);
- } else {
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + designFee + countArr[i] * shengzi));
- list.add(pro);
- }
- }
- return list;
- }
- /**
- * 服装吊牌 300克异形模切价格
- *
- * @param dto
- * @param number
- * @param width
- * @param length
- * @param area
- * @param count
- * @param priceList
- * @return
- */
- public List<Product> tagClothes300PriceCraftMo(Product dto, Integer number, Double width, Double length, Double area, int count, List<Product> priceList) {
- if (((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9))) {
- priceList = new PriceUtils().oneCradPrice(count);
- if ("不覆膜".equals(dto.getCraftMo())) {
- for (Product product : priceList) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- } else {
- // 有工艺(覆膜)
- if ("双面覆哑膜".equals(dto.getCraftMo())) {
- double priceArr[] = {18, 15, 14, 14};
- // double priceArr[] = { 13, 12, 11.5, 10 };
- priceList = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
- } else if ("不覆膜".equals(dto.getCraftMo())) {
- double priceArr[] = {17, 14, 13, 13};
- // double priceArr[] = { 12, 11, 10.5, 9 };
- priceList = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
- }
- // 对比固定价格
- /*List<Product> priceList2 = new PriceUtils().oneCradPrice(count);
- if ("不覆膜".equals(dto.getCraftMo())) {
- for (Product product : priceList2) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }*/
- /*for (int i = 0; i < priceList.size(); i++) {
- for (int j = 0; j < priceList2.size(); j++) {
- if (priceList.get(j).getPrice() < priceList2.get(j).getPrice()) {
- priceList.get(j).setPrice(priceList2.get(j).getPrice() + 10);
- }
- }
- }*/
- // 末尾变成0
- /*for (Product product : priceList) {
- product.setPrice(product.getPrice() - product.getPrice() % 10);
- }*/
- // 如果俩个价格一样,后一位价格+10
- for (int i = 0; i < priceList.size() - 1; i++) {
- if (priceList.get(i).getPrice().equals(priceList.get(i + 1).getPrice())) {
- priceList.get(i + 1).setPrice(priceList.get(i + 1).getPrice() + 10);
- }
- if (width == 6 && length == 6 && priceList.get(i).getCount() == 1000) {
- priceList.get(i).setPrice(priceList.get(i).getPrice() + 8);
- }
- }
- }
- // 300克的材质才有第二尺寸
- // 第二尺寸不为空
- if (!StringUtils.isEmpty(dto.getSize1())) {
- String size1 = dto.getSize1();
- Double length1 = null;
- Double width1 = null;
- List<Product> priceListSecond = new ArrayList<Product>();
- length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
- if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
- width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
- } else {
- width1 = Double
- .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
- }
- length1 = Math.abs(length1);
- width1 = Math.abs(width1);
- double area1 = length1 * width1 / 10000;
- if (((length1 <= 10.5 && width1 <= 5.5) || (length1 <= 5.5 && width1 <= 10.5))) {
- priceListSecond = new PriceUtils().oneCradPrice(count);
- if ("不覆膜".equals(dto.getCraftMo())) {
- for (Product product : priceListSecond) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- } else {
- // 有工艺(覆膜)
- if ("双面覆哑膜".equals(dto.getCraftMo())) {
- double priceArr[] = {18, 15, 14, 14};
- // double priceArr[] = { 13, 12, 11.5, 10 };
- priceListSecond = new PriceUtils().acountTagClothes300PriceCraftMo(area1, count, number, priceArr);
- } else if ("不覆膜".equals(dto.getCraftMo())) {
- double priceArr[] = {17, 14, 13, 13};
- priceListSecond = new PriceUtils().acountTagClothes300PriceCraftMo(area, count, number, priceArr);
- }
- // 对比固定价格
- List<Product> priceList2 = new PriceUtils().oneCradPrice(count);
- if ("不覆膜".equals(dto.getCraftMo())) {
- for (Product product : priceList2) {
- product.setPrice(Math.floor(product.getPrice() * 0.98));
- }
- }
- for (int i = 0; i < priceListSecond.size(); i++) {
- for (int j = 0; j < priceList2.size(); j++) {
- if (priceListSecond.get(j).getPrice() < priceList2.get(j).getPrice()) {
- priceListSecond.get(j).setPrice(priceList2.get(j).getPrice() + 10);
- }
- }
- }
- // 末尾变成0
- for (Product product : priceListSecond) {
- product.setPrice(product.getPrice() - product.getPrice() % 10);
- }
- // 如果俩个价格一样,后一位价格+10
- for (int i = 0; i < priceListSecond.size() - 1; i++) {
- if (priceListSecond.get(i).getPrice().equals(priceListSecond.get(i + 1).getPrice())) {
- priceListSecond.get(i + 1).setPrice(priceListSecond.get(i + 1).getPrice() + 10);
- }
- }
- }
- // 俩个尺寸的价格相加 再*0.96
- for (int i = 0; i < priceList.size(); i++) {
- priceList.get(i).setPrice((priceList.get(i).getPrice() + priceListSecond.get(i).getPrice()) * 0.95);
- }
- }
- return priceList;
- }
- /**
- * 服装吊牌300克异形模切价格计算===》 不复膜的 计算方法:长*宽*数量500张*22+每款设计费7元+绳子10元
- *
- * @param area
- * @param count
- * @param number
- * @param priceArr
- * @return
- */
- public List<Product> acountTagClothes300PriceCraftMo(Double area, int count, Integer number, double[] priceArr) {
- int countArr[] = {1000, 2000, 5000, 10000};
- // 数量大于1万,单独报价;
- List<Product> list = new ArrayList<>();
- Product pro = new Product();
- // 设计费 7元/款
- double designFee = 7;
- // 绳子 1分5一条
- double shengzi = 0.015;
- if (count > 10000) {
- pro.setCount(count);
- pro.setPrice(Math.ceil(area * count * priceArr[priceArr.length - 1] + number * designFee));
- list.add(pro);
- } else {
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- /* pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + number * designFee
- + countArr[i] * shengzi));*/
- pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i] + designFee));
- list.add(pro);
- }
- }
- return list;
- }
- /**
- * 600克 吊牌
- *
- * @param dto
- * @param kind
- * @param kind2
- * @param area
- * @param count
- * @return
- */
- public List<Product> tags600Price(Product dto, String kind, String kind2, Double area, int count) {
- List<Product> priceList;
- priceList = new PriceUtils().getTag600PriceFirst(kind, kind2, area, count, true);
- // 600克的材质才有第二尺寸
- // 第二尺寸不为空
- if (!StringUtils.isEmpty(dto.getSize1())) {
- String size1 = dto.getSize1();
- Double length1 = null;
- Double width1 = null;
- List<Product> priceList2 = new ArrayList<Product>();
- length1 = Double.valueOf(size1.substring(0, size1.indexOf("*")));
- if (size1.indexOf(("*"), size1.indexOf("*") + 1) == -1) {
- width1 = Double.valueOf(size1.substring(size1.indexOf("*") + 1));
- } else {
- width1 = Double
- .valueOf(size1.substring(size1.indexOf("*") + 1, size1.indexOf(("*"), size1.indexOf("*") + 1)));
- }
- length1 = Math.abs(length1);
- width1 = Math.abs(width1);
- double area1 = length1 * width1 / 10000;
- priceList2 = new PriceUtils().getTag600PriceFirst(kind, kind2, area1, count, false);
- // 俩个尺寸的价格相加
- for (int i = 0; i < priceList.size(); i++) {
- priceList.get(i).setPrice((priceList.get(i).getPrice() + priceList2.get(i).getPrice()) * 0.95);
- }
- }
- return priceList;
- }
- /**
- * 吊牌600/800克自定义尺寸价格
- *
- * @param kind 600克/800克
- * @param kind2 种类
- * @param area 单个产品的面积
- * @param count 报的数量
- * @param flag 是否要加绳子费用
- * @return
- */
- public List<Product> getTag600PriceFirst(String kind, String kind2, double area, int count, boolean flag) {
- // 数量大于1万,单独报价;
- if (count > 10000) {
- return null;
- }
- List<Product> list = new ArrayList<>();
- double shengzi = 0;
- if ("4".equals(kind)) {
- if ("无".equals(kind2)) {
- double priceArr[] = {50, 34, 27, 27, 26, 25};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- } else if ("单面烫黄金".equals(kind2)) {
- double priceArr[] = {68, 48, 37, 36, 35, 34};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- } else if ("击凸".equals(kind2) || "压凹".equals(kind2)) {
- double priceArr[] = {75, 50, 40, 40, 39, 38};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- } else if ("单面烫黄金+凹凸".equals(kind2)) {
- double priceArr[] = {93, 63, 48, 48, 47, 46};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- }
- }
- if ("6".equals(kind)) {
- if ("无".equals(kind2)) {
- double price = 0;
- int[][] prices = {
- {144, 148, 166, 188, 193, 210, 232, 249, 251, 273, 317, 392, 464, 476, 674, 1028, 1802},
- {228, 238, 248, 255, 256, 258, 260, 268, 270, 278, 322, 397, 469, 481, 679, 1033, 1807},
- {330, 345, 350, 380, 386, 390, 420, 428, 430, 465, 538, 665, 780, 800, 1108, 1665, 2920},
- {480, 520, 530, 560, 568, 580, 591, 629, 633, 686, 791, 971, 1141, 1170, 1644, 2486, 4329},
- {800, 820, 860, 870, 880, 900, 955, 1016, 1023, 1107, 1276, 1563, 1838, 1885, 2645, 3997, 6955},
- {1400, 1430, 1450, 1527, 1560, 1690, 1852, 1969, 1982, 2145, 2470, 3022, 3549, 3640, 5102, 7702, 13390}
- };
- int[] count_list = {500, 1000, 2000, 3000, 5000, 10000};
- double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.6, 49, 54, 64, 81, 97.2, 100, 145.8, 225, 400};
- for (int i = 0; i < count_list.length; i++) {
- int count_item = count_list[i];
- if (list.size() > 2) {
- break;
- }
- if (count > count_item) {
- continue;
- }
- int count_index = Arrays.binarySearch(count_list, count_item);
- price = 0;
- if (count_index >= 0) {
- price = new PriceUtils().TablePrice(area * 10000, prices[count_index], areas);
- }
- Product product = new Product();
- product.setCount(count_item);
- product.setPrice(Math.ceil(price));
- list.add(product);
- }
- } else if ("单面烫黄金".equals(kind2)) {
- double priceArr[] = {68, 48, 37, 36, 35, 34};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- } else if ("击凸".equals(kind2) || "压凹".equals(kind2)) {
- double priceArr[] = {75, 50, 40, 40, 39, 38};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- } else if ("单面烫黄金+凹凸".equals(kind2)) {
- double priceArr[] = {93, 63, 48, 48, 47, 46};
- list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
- }
- }
- return list;
- }
- /**
- * 吊牌600/800克价格计算
- *
- * @param area
- * @param count
- * @param priceArr
- * @param shengzi
- * @param flag
- * @return
- */
- private List<Product> acountTag600Price(double area, int count, double[] priceArr, double shengzi, boolean flag,
- List<Product> list) {
- int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
- Product pro = new Product();
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- if (countArr[i] == 500) {
- continue;
- }
- pro = new Product();
- if (countArr[i] == 500) {
- shengzi = 20;
- } else if (countArr[i] == 1000) {
- shengzi = 30;
- } else if (countArr[i] == 2000) {
- shengzi = 50;
- } else {
- shengzi = 0.03;
- }
- pro.setCount(countArr[i]);
- if (flag) {
- pro.setPrice(
- Math.ceil(area * countArr[i] * priceArr[i] + (shengzi > 1 ? shengzi : shengzi * countArr[i])));
- } else {
- pro.setPrice(Math.ceil(area * countArr[i] * priceArr[i]));
- }
- list.add(pro);
- }
- return list;
- }
- /**
- * 异形杯套价格计算
- *
- * @param count
- * @return
- */
- public List<Product> getCupSetPrice(int count) {
- List<Product> list = new ArrayList<>();
- Product pro = new Product();
- int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
- double priceArr[] = {700, 780, 820, 900, 1300, 1800};
- if (count <= 10000) {
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArr[i]);
- list.add(pro);
- }
- } else {
- pro = new Product();
- pro.setCount(count);
- pro.setPrice(Math.ceil(count * 0.25));
- list.add(pro);
- }
- return list;
- }
- /**
- * 手提袋价格计算
- *
- * @param
- * @param kai 产品开数
- * @return 报价:〔数量除以开数+*纸张《正度或者大度》+印工〔1千印X内150元,每超出1千印另加50元计算》+固定刀版收费200元+粘成品工钱.3*数量(小于200元按2⑾0元算〉〉*.5备注:以上报价展开尺寸最大为1000*700KM超出这个尺寸按以上报价*2倍计算
- */
- public List<Product> getPriceHanding(int count, int kai, double price, double m) {
- List<Product> list = new ArrayList<>();
- int countArr[] = {500, 1000, 2000, 4000, 10000, 20000, 30000};
- Product pro = new Product();
- if (count >= 100) {
- if (count < 670) {
- pro.setCount(count);
- pro.setPrice(Math.ceil((count / kai * price + 150 + 200 + 200) * m));
- list.add(pro);
- } else {
- pro.setCount(count);
- pro.setPrice(Math.ceil(
- (count / kai * price + (150 + Math.ceil((count - 1000) / 1000) * 50) + 200 + count * 0.3) * m));
- list.add(pro);
- }
- }
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || countArr[i] == list.get(0).getCount()) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- if (countArr[i] == 500) {
- pro.setPrice(Math.ceil(
- (countArr[i] / kai * price + (150 + Math.ceil((countArr[i] - 1000) / 1000) * 50) + 200 + 200)
- * m));
- } else {
- pro.setPrice(Math.ceil((countArr[i] / kai * price + (150 + Math.ceil((countArr[i] - 1000) / 1000) * 50)
- + 200 + countArr[i] * 0.3) * m));
- }
- list.add(pro);
- }
- return list;
- }
- /**
- * 计算手提袋大度开数
- *
- * @param length
- * @param width
- * @return
- */
- public static String getDa(double length, double width) {
- double l1 = Math.floor(1194 / length);
- double w1 = Math.floor(889 / width);
- double l2 = Math.floor(1194 / width);
- double w2 = Math.floor(889 / length);
- int maxDa = (int) Math.max(l1 * w1, l2 * w2);
- if (w1 != 2) {
- return "" + maxDa;
- } else {
- double ll1 = Math.floor(length / length);
- double ww1 = Math.floor(889 / width);
- double ll2 = Math.floor(length / width);
- double ww2 = Math.floor(889 / length);
- int maxxa = (int) Math.max(ll1 * ww1, ll2 * ww2);
- double lll1 = Math.floor((1194 - length) / length);
- double www1 = Math.floor(889 / width);
- double lll2 = Math.floor(length / width);
- double www2 = Math.floor(889 / length);
- int maxxb = (int) Math.max(lll1 * www1, lll2 * www2);
- maxDa = maxxb + maxxa;
- return "" + maxDa;
- }
- }
- /**
- * 正度开数
- *
- * @param length
- * @param width
- * @return
- */
- public static String getZheng(double length, double width) {
- double l1 = Math.floor(1092 / length);
- double w1 = Math.floor(787 / width);
- double l2 = Math.floor(1092 / width);
- double w2 = Math.floor(787 / length);
- int maxZheng = (int) Math.max(l1 * w1, l2 * w2);
- if (w1 != 2) {
- return "+" + maxZheng;
- } else {
- double ll1 = Math.floor(length / length);
- double ww1 = Math.floor(787 / width);
- double ll2 = Math.floor(length / width);
- double ww2 = Math.floor(787 / length);
- int maxxa = (int) Math.max(ll1 * ww1, ll2 * ww2);
- double lll1 = Math.floor((1092 - length) / length);
- double www1 = Math.floor(787 / width);
- double lll2 = Math.floor(length / width);
- double www2 = Math.floor(787 / length);
- int maxxb = (int) Math.max(lll1 * www1, lll2 * www2);
- maxZheng = maxxb + maxxa;
- return "" + maxZheng;
- }
- }
- /**
- * 金属标价格计算 ===>最大印刷面积290*190MM 成品尺寸一边加1.5MM 算大张要几张 起步价90元
- * 10张以内不含10张100+25*(数量-2) 20张以内 数量*24 30张以内 数量*22 超过30张*20
- *
- * @param list
- * @param width
- * @param length
- * @param count
- * @param number
- * @return
- */
- public List<Product> getMetalPrice(List<Product> list, Double width, Double length, int count, Integer number) {
- /*if (length == 1) {
- length = 2.0;
- }
- if (width == 1) {
- width = 2.0;
- }*/
- // 最大尺寸29*19cm ,加出血一边5mm
- double l = 295;
- double w = 195;
- Product pro = new Product();
- // 第一张大纸价格
- double price = 0;
- // 换成毫米每边+3
- length = length * 10 + 2 * 1.5;
- width = width * 10 + 2 * 1.5;
- // 数量*款数就是张数
- // count = count * number;
- if ((length > l || width > w) && (length > w || width > l))
- return null;
- // 一张大纸29*19cm 能做多少个此类尺寸的金属标
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil((count * number) / max);
- int numUnit = (int) Math.ceil((count) / max);
- boolean isNumnber = false;
- if (numUnit == 1) {
- isNumnber = true;
- }
- double mulit = 1;
- /*
- * if (num > 2) { price = price + 25 * (num - 2); }
- */
- double design = 0;
- if (!isNumnber) {
- if (numUnit <= 2) {
- price = 80;
- } else if (numUnit < 6) {
- price = 80 + 24 * (numUnit - 2);
- } else if (numUnit < 10) {
- price = 80 + 23 * (numUnit - 2);
- } else if (numUnit < 16) {
- price = 80 + 21 * (numUnit - 2);
- } else if (numUnit < 30) {
- price = 200 + 12 * (numUnit - 2);
- } else if (numUnit < 51) {
- price = 280 + 9 * (numUnit - 2);
- } else if (numUnit < 100) {
- price = Math.ceil((numUnit * 9) / 0.64);
- } else if (numUnit < 300) {
- price = Math.ceil((numUnit * 9) / 0.645);
- } else {
- price = Math.ceil((numUnit * 9) / 0.646);
- }
- mulit = number;
- } else {
- price = 80;
- mulit = Math.ceil(num / numUnit);
- }
- price = Math.ceil(price * mulit);
- pro.setCount(count);
- pro.setPrice(Math.ceil(price + design));
- float d = (float) num / (float) 30;
- if (number > 1) {
- d = d * number;
- }
- pro.setWeight(String.valueOf(df.format(d)));
- list.add(pro);
- return list;
- }
- /**
- * UV转印贴
- *
- * @param area
- * @param type
- * @return
- */
- private double f_getUvPrice(double area, int type) {//根据面积获取价格
- double price = 0, lastPrice = 0;
- 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};
- double priceArr[] = {450, 420, 400, 380, 360, 340, 300, 225, 200, 175, 170, 150, 145, 125, 120, 110, 100, 90, 80, 70};
- double lessPriceArr[] = {215, 215, 215, 215, 215, 215, 215, 200, 170, 160, 150, 140, 135, 115, 110, 100, 90, 80, 70, 60};
- double areaArrSmall[] = {0.03, 0.1};
- double priceArrSmall[] = {30, 50};
- for (int i = 0; i < areaArr.length; i++) {
- if (areaArr[i] < area) {
- continue;
- }
- if (i > 0) {
- if (type == 2) {
- lastPrice = Math.ceil(lessPriceArr[i - 1] * areaArr[i - 1]);
- } else {
- lastPrice = Math.ceil(priceArr[i - 1] * areaArr[i - 1]);
- }
- }
- if (type == 2) {
- price = Math.ceil(lessPriceArr[i] * area);
- } else {
- price = Math.ceil(priceArr[i] * area);
- }
- if (lastPrice > price) {
- price = lastPrice;
- }
- break;
- }
- if (type == 3) {
- for (int i = 0; i < areaArrSmall.length; i++) {
- if (areaArrSmall[i] < area) {
- continue;
- }
- if (i > 0) {
- lastPrice = Math.ceil(priceArrSmall[i - 1]);
- }
- price = Math.ceil(priceArrSmall[i]);
- if (lastPrice > price) {
- price = lastPrice;
- }
- break;
- }
- }
- //最低价65
- if (price == 0) {
- price = 65 * area;
- }
- return price;
- }
- public List<Product> UVStickerPrice(double length, double width, int count, int number, String yinse, String[] zhuan) {
- List<Product> list = new ArrayList<Product>();
- int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
- Product pro;
- int oldCount = count;
- int isInArr = 0;
- double price = 0, mqPrice = 0, lastPrice;
- if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))
- && count < 100) {
- // if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
- // 烫金100个起
- count = 100;
- }
- double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
- if (!StringUtils.isEmpty(zhuan)) {
- //工艺价格另算
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
- }
- double lastArea = 0;
- int index = Arrays.binarySearch(countArr, oldCount);
- if (index >= 0) {
- isInArr = 1;
- }
- if (isInArr != 1) {
- price = f_getUvPrice(area, 1);
- price = price > 45 ? price : 45;
- if (area <= 0.2) {
- mqPrice = count * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(price += mqPrice);
- }
- if (!StringUtils.isEmpty(zhuan)) {
- 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])) {
- // 起步价+58元
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
- // 起步价+58元
- price = price + (45 * area);
- price = price > 103 ? price : 103;
- } else if ("双面贴".equals(zhuan[0])) {
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- }
- }
- pro = new Product();
- pro.setPrice(Math.ceil(price));
- pro.setWeight(String.valueOf(df.format(area)));
- pro.setCount(oldCount);
- list.add(pro);
- }
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- if (list.size() > 2) {
- break;
- } else {
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000 * number;
- if (i > 0) {
- lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000 * number;
- }
- if (!StringUtils.isEmpty(zhuan)) {
- //工艺价格另算
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000;
- if (i > 0) {
- lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000;
- }
- }
- // 报价面积,平方米(加一边3mm出血)
- price = f_getUvPrice(area, 1);
- price = price > 45 ? price : 45;
- lastPrice = f_getUvPrice(lastArea, 1);
- if (area <= 0.2) {
- mqPrice = countArr[i] * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(price += mqPrice);
- }
- if (lastArea <= 0.2 && i > 0) {
- mqPrice = countArr[i - 1] * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(lastPrice += mqPrice);
- }
- if (area > 0.1) {
- if (lastPrice >= price) {//判断上一个尺寸
- price = Math.ceil(lastPrice * 1.1);
- }
- }
- if (!StringUtils.isEmpty(zhuan)) {
- 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])) {
- // 起步价+58元
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- // lastPrice = lastPrice + (45 * area);
- // lastPrice = lastPrice > 103 ? lastPrice : 103;
- } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
- // 起步价+58元
- price = price + (45 * area);
- price = price > 103 ? price : 103;
- // lastPrice = lastPrice + (45 * area);
- // lastPrice = lastPrice > 103 ? lastPrice : 103;
- } else if ("双面贴".equals(zhuan[0])) {
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- }
- }
- pro = new Product();
- pro.setPrice(Math.ceil(price));
- pro.setWeight(String.valueOf(df.format(area)));
- pro.setCount(countArr[i]);
- list.add(pro);
- }
- }
- // if (!StringUtils.isEmpty(zhuan) && ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))) {
- // for (Product product : list) {
- // product.setPrice(Math.ceil(product.getPrice() + 60));
- // }
- // }
- if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
- for (Product product : list) {
- product.setPrice(Math.ceil(product.getPrice() + 80));
- }
- }
- if (length >= 44 || width >= 44) {
- if (width > length) {
- length = width;
- }
- for (Product product : list) {
- product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
- }
- }
- return list;
- }
- public Product getUVCenterPrice(double length, double width, int count, int number, String[] zhuan, Boolean isSmall) {
- double areaArr[] = {0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 3, 5, 7, 9, 10, 20, 50, 100, 200, 500, 1000, 5000};
- int priceArr[] = {50, 60, 76, 108, 136, 150, 225, 600, 875, 1190, 1350, 1450, 2500, 6000, 11000, 20000, 45000, 80000, 350000};
- double areaArrSmall[] = {0.03, 0.1};
- int priceArrSmall[] = {30, 50};
- double mqPrice = 0;
- double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
- if (!StringUtils.isEmpty(zhuan)) {
- //工艺价格另算
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
- }
- double price = TablePrice(area, priceArr, areaArr);
- price = price > 45 ? price : 45;
- if (area < 0.1 && area > 0 && isSmall) {
- price = TablePrice(area, priceArrSmall, areaArrSmall);
- if (price == 0) {
- price = Math.ceil(65 * area);
- }
- }
- if (area <= 0.2 && area >= 0.1) {
- mqPrice = count * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(price += mqPrice);
- }
- if (!StringUtils.isEmpty(zhuan)) {
- 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])) {
- // 起步价+58元
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
- // 起步价+58元
- price = price + (45 * area);
- price = price > 103 ? price : 103;
- } else if ("双面贴".equals(zhuan[0])) {
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- }
- }
- Product pro = new Product();
- pro.setPrice(Math.ceil(price));
- pro.setCount(count);
- return pro;
- }
- public List<Product> UVStickerSmallPriceV2(double length, double width, int count, int number, String yinse, String[] zhuan, Boolean isSmall) {
- List<Product> list = new ArrayList<>();
- int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
- int oldCount = count;
- if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) && count < 100) {
- // 烫金100个起
- count = 100;
- }
- Product firstProduct = getUVCenterPrice(length, width, count, number, zhuan, isSmall);
- firstProduct.setCount(oldCount);
- list.add(firstProduct);
- for (int i = 0; i < countArr.length; i++) {
- if (list.size() > 3) {
- break;
- }
- int currentCount = countArr[i];
- if (currentCount <= count) {
- continue;
- }
- list.add(getUVCenterPrice(length, width, currentCount, number, zhuan, isSmall));
- }
- if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
- for (Product product : list) {
- product.setPrice(Math.ceil(product.getPrice() + 60));
- }
- }
- if (length >= 44 || width >= 44) {
- if (width > length) {
- length = width;
- }
- for (Product product : list) {
- product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
- }
- }
- return list;
- }
- /**
- * 小面积UV转印贴报价:
- *
- * @param length
- * @param width
- * @param count
- * @param zhuan
- * @param yinse 印色
- * @return
- */
- public List<Product> UVStickerSmallPrice(double length, double width, int count, int number, String yinse, String[] zhuan) {
- List<Product> list = new ArrayList<Product>();
- int countArr[] = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
- Product pro;
- int isInArr = 0;
- int oldCount = count;
- double price = 0, mqPrice = 0, lastPrice, list_lastPrice = 0;
- if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))
- && count < 100) {
- // if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
- // 烫金100个起
- count = 100;
- }
- double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000 * number;
- if (!StringUtils.isEmpty(zhuan)) {
- //工艺价格另算
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
- }
- double lastArea = 0;
- int index = Arrays.binarySearch(countArr, oldCount);
- if (index >= 0) {
- isInArr = 1;
- }
- if (isInArr != 1) {
- price = f_getUvPrice(area, 1);
- price = price > 45 ? price : 45;
- if (area < 0.1 && area > 0) {
- price = f_getUvPrice(area, 3);
- }
- if (area <= 0.2 && area >= 0.1) {
- mqPrice = count * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(price += mqPrice);
- }
- if (!StringUtils.isEmpty(zhuan)) {
- 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])) {
- // 起步价+58元
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
- // 起步价+58元
- price = price + (45 * area);
- price = price > 103 ? price : 103;
- } else if ("双面贴".equals(zhuan[0])) {
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- }
- }
- pro = new Product();
- list_lastPrice = Math.max(Math.ceil(price), list_lastPrice);
- pro.setPrice(list_lastPrice);
- pro.setWeight(String.valueOf(df.format(area)));
- pro.setCount(oldCount);
- list.add(pro);
- }
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- if (list.size() > 2) {
- break;
- } else {
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000 * number;
- if (i > 0) {
- lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000 * number;
- }
- if (!StringUtils.isEmpty(zhuan)) {
- //工艺价格另算
- area = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i] / 10000;
- if (i > 0) {
- lastArea = (length + 0.3 * 2) * (width + 0.3 * 2) * countArr[i - 1] / 10000;
- }
- }
- // 报价面积,平方米(加一边3mm出血)
- price = f_getUvPrice(area, 1);
- price = price > 45 ? price : 45;
- lastPrice = f_getUvPrice(lastArea, 1);
- if (area < 0.1 && area > 0) {
- price = f_getUvPrice(area, 3);
- lastPrice = f_getUvPrice(lastArea, 3);
- }
- if (area <= 0.2 && area >= 0.1) {
- mqPrice = countArr[i] * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(price += mqPrice);
- }
- if (lastArea <= 0.2 && area >= 0.1 && i > 0) {
- mqPrice = countArr[i - 1] * 0.05;
- mqPrice = mqPrice > 5 ? mqPrice : 5;
- Math.ceil(lastPrice += mqPrice);
- }
- if (area > 0.1) {
- if (lastPrice >= price) {//判断上一个尺寸
- price = Math.ceil(lastPrice * 1.1);
- }
- }
- if (!StringUtils.isEmpty(zhuan)) {
- 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])) {
- // 起步价+58元
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- // lastPrice = lastPrice + (45 * area);
- // lastPrice = lastPrice > 103 ? lastPrice : 103;
- } else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
- // 起步价+58元
- price = price + (45 * area);
- price = price > 103 ? price : 103;
- // lastPrice = lastPrice + (45 * area);
- // lastPrice = lastPrice > 103 ? lastPrice : 103;
- } else if ("双面贴".equals(zhuan[0])) {
- price = price + (40 * area);
- price = price > 80 ? price : 80;
- }
- }
- pro = new Product();
- list_lastPrice = Math.max(Math.ceil(price), list_lastPrice);
- pro.setPrice(list_lastPrice);
- pro.setWeight(String.valueOf(df.format(area)));
- pro.setCount(countArr[i]);
- list.add(pro);
- }
- }
- // if (!StringUtils.isEmpty(zhuan) && ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0]))) {
- // for (Product product : list) {
- // product.setPrice(Math.ceil(product.getPrice() + 60));
- // }
- // }
- if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]))) {
- for (Product product : list) {
- product.setPrice(Math.ceil(product.getPrice() + 60));
- }
- }
- if (length >= 44 || width >= 44) {
- if (width > length) {
- length = width;
- }
- for (Product product : list) {
- product.setPrice(Math.ceil(product.getPrice() + length * 0.6));
- }
- }
- return list;
- }
- /**
- * 少数量(小于10)UV转印贴报价:
- *
- * @param length
- * @param width
- * @param count
- * @param zhuan
- * @param number 印色
- * @return
- */
- public List<Product> UVStickerLessPrice(double length, double width, int count, int number, String[] zhuan) {
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- double area = (length + 0.3 * 2) * (width + 0.3 * 2) * count / 10000;
- if (!StringUtils.isEmpty(zhuan) && count < 25) {
- return list;
- }
- double price = f_getUvPrice(area, 2);
- pro.setPrice(price > 80 ? price : 80);
- pro.setCount(count);
- list.add(pro);
- if (!StringUtils.isEmpty(zhuan)) {
- for (Product product : list) {
- product.setPrice(Math.floor(product.getPrice() + 60 + (30 * area > 15 ? 30 * area : 15)));
- }
- }
- return list;
- }
- /**
- * 条幅
- *
- * @param kind2
- * @param number
- */
- public static List<Product> bannerPrice(String kind2, double length, double width, int count, Integer number, String role) {
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- // 一条条幅的长度
- length = length / 100.0;
- width = width / 100.0;
- double area = length * width * count;
- double price = 0;
- if ("彩色条幅".equals(kind2)) {
- //拼多多价格
- if (role.indexOf("1045") > -1) {
- if (width == 0.5 || length == 0.5) {
- double widthArr[] = {3, 4, 5, 6, 7, 8};
- double unitArr[] = {19, 17.5, 17, 17, 17, 17};
- double baseArr[] = {40, 50, 60, 75, 85, 96};
- for (int i = 0; i < widthArr.length; i++) {
- if (widthArr[i] < width || widthArr[i] < length) {
- continue;
- }
- price = unitArr[i] * area;
- price = price > baseArr[i] ? price : baseArr[i];
- break;
- }
- } else {
- if (area <= 1) {
- price = 45;
- } else if (area <= 2) {
- price = 35 * area;
- } else if (area <= 3) {
- price = 33 * area;
- } else if (area <= 4) {
- price = 32 * area;
- } else if (area <= 5) {
- price = 30 * area;
- } else if (area <= 10) {
- price = 28 * area;
- } else {
- price = 25 * area;
- }
- }
- price = price > 40 ? price : 40;
- } else {
- if (width == 0.5 && length == 3 || width == 3 && length == 0.5) {
- price = 30 * area;
- } else if (width == 0.5 && length == 5 || width == 5 && length == 0.5) {
- price = 24 * area;
- } else if (area <= 1) {
- price = 45;
- } else if (area <= 2) {
- price = 35 * area;
- } else if (area <= 3) {
- price = 33 * area;
- } else if (area <= 4) {
- price = 32 * area;
- } else if (area <= 5) {
- price = 30 * area;
- } else if (area <= 10) {
- price = 28 * area;
- } else {
- price = 25 * area;
- }
- price = price > 45 ? price : 45;
- }
- } else {
- double[] areas = null;
- int[] prices = null;
- double last_price = 0;
- double min_price = 0;
- if ((width == 0.5 && length == 3 && count == 1) || (width == 3 && length == 0.5 && count == 1)) {
- price = 24 * area;
- } else {
- areas = new double[]{1, 2, 3, 4, 5, 10};
- prices = new int[]{35, 30, 24, 21, 18, 16};
- last_price = 13;
- min_price += 40;
- price = Math.max(TableUnitPrice(area, prices, areas, last_price), min_price);
- }
- }
- pro.setCount(count);
- pro.setPrice(Math.ceil(price));
- list.add(pro);
- return list;
- }
- /**
- * 桌贴0.38磨砂背胶价格计算 ======》 最大印刷尺寸40*45CM 最低起步价100元 每增加一张加30元 设计费每款加8元
- * <p>
- * 0.38桌贴(磨砂、哑光、亮光) 最大打印面积 395*445MM 成品最小做到1CM 每边加上1.5MM出血 起步价90元
- * 单面印刷不带胶每增加一张单面加30元 双面打印不带胶每增加一张加36元, 带胶加40元一张 10张以上不分单双面带不带胶 均20元/张
- * 款数不同的每款加上1元的设计费
- *
- * @param list
- * @param width
- * @param length
- * @param count
- * @param number
- * @return
- */
- public List<Product> getDeskSticker(List<Product> list, Double width, Double length, int count, Integer number,
- String craftShua, String craftJiao) {
- // 最大尺寸435*385mm ,加出血一边3mm
- double l = 435;
- double w = 385;
- Product pro = new Product();
- // 价格
- double price = 0;
- // 换成毫米每边+1.5
- length = length * 10 + 2 * 1.5;
- width = width * 10 + 2 * 1.5;
- // 数量*款数就是张数
- count = count * number;
- if ((length > l || width > w) && (length > w || width > l))
- return null;
- // 一张大纸45*40cm 能做多少个此类尺寸的桌贴
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- if ("单面".equals(craftShua)) {
- if (num > 10) {
- price = 70 + num * 28 + (number - 1);
- } else {
- price = 80 + num * 30 + (number - 1);
- }
- } else if ("双面".equals(craftShua)) {
- if ("背胶".equals(craftJiao)) {
- price = 100 + num * 40 + (number - 1);
- } else {
- price = 100 + num * 36 + (number - 1);
- }
- }
- pro.setCount(count / number);
- pro.setPrice(price > 90 ? price : 90);
- list.add(pro);
- return list;
- }
- /**
- * 桌贴0.38PVC亮光异型卡片 印刷价格
- *
- * @param list
- * @param width
- * @param length
- * @param count
- * @return
- */
- public List<Product> getDeskSticker(List<Product> list, Double width, Double length, int count) {
- double danjia;
- int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- // 面积平方米
- double area = width * length * countArr[i] / 10000;
- Product pro = new Product();
- if (area <= 0.45) {
- danjia = 110;
- } else if (area <= 0.9) {
- danjia = 150;
- } else if (area <= 5) {
- danjia = 100;
- } else if (area <= 10) {
- danjia = 70;
- } else if (area <= 15) {
- danjia = 55;
- } else if (area <= 20) {
- danjia = 50;
- } else if (area <= 30) {
- danjia = 40;
- } else {
- danjia = 30;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(area * danjia > 120 ? area * danjia : 120);
- list.add(pro);
- }
- for (int i = 0; i < list.size() - 1; i++) {
- if (list.get(i + 1).getPrice() - list.get(i).getPrice() < 100) {
- list.get(i + 1).setPrice(list.get(i + 1).getPrice() + 100);
- }
- }
- return list;
- }
- /**
- * 桌贴0.38PVC亮光异型卡片 打印价格
- *
- * @param number
- * @param width
- * @param length
- * @param count
- * @param craftJiao
- * @return 不同款内容的报价:成本核算 有效打印面积 380*420MM 起步价120元 每增加一张单面加30元
- * 双面打印在每增加一张加36元,带胶加每增加一张加40元 10张以上单双面均加22元/张
- */
- public List<Product> getDeskStickerPrint(Double width, Double length, int count, int number, String craftJiao) {
- List<Product> list = new ArrayList<Product>();
- // 有效打印面积 420*380MM,加出血一边3mm
- double l = 426;
- double w = 386;
- Product pro = new Product();
- // 第一张大纸价格
- double price = 120;
- // 换成毫米每边+3
- length = length * 10 + 2 * 3;
- width = width * 10 + 2 * 3;
- // 数量 * 款数就是张数
- count = count * number;
- if ((length > l || width > w) && (length > w || width > l))
- return null;
- // 一张大纸420*380mm 能做多少个此类尺寸的桌贴
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- // 价格计算
- if ("背胶".equals(craftJiao)) {
- price = price + (num - 1) * 40;
- } else {
- if (num > 10) {
- price = price + (num - 1) * 22;
- } else {
- // 单面
- if ("单面".equals(craftJiao)) {
- price = price + (num - 1) * 30;
- } else if ("双面".equals(craftJiao)) {// 双面
- price = price + (num - 1) * 36;
- }
- }
- }
- pro.setCount(count / number);
- pro.setPrice(price);
- list.add(pro);
- return list;
- }
- /**
- * 滴塑价格计算======> 滴塑 出血位每边加1.5MM 滴塑最大印刷面积43*30CM 起步价80元 2张100元 3张120元 4张150元
- * 5张180元 10张260元 11张以上*25元
- *
- * @param list
- * @param width
- * @param length
- * @param count
- * @param number
- * @param dto
- * @return
- */
- public static List<Product> getDisuPrice(List<Product> list, Double width, Double length, int count, Integer number, Product dto) {
- List<String> craft = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
- // 最大尺寸43*30cm
- double l = 430;
- double w = 300;
- Product pro = new Product();
- // 第一张大纸价格
- double price = 80;
- if (craft.size() > 0) {//工艺起步价120
- price = 120;
- }
- // 换成毫米每边+3
- length = length * 10 + 2 * 1.5;
- width = width * 10 + 2 * 1.5;
- // 数量*款数就是张数
- count = count * number;
- if ((length > l || width > w) && (length > w || width > l)) {
- return null;
- }
- // 一张大纸43*30 能做多少个此类尺寸的
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- if (num <= 10) {
- price = price + (num - 1) * 20;
- } else if (num > 10) {
- price = num * 25;
- }
- price += 10 * craft.size() * num;
- if (dto.getN_mq_num() > 0) {
- price += 10 * dto.getN_mq_num();
- }
- if (number > 1) {
- price *= 1.3;
- }
- pro.setCount(count / number);
- pro.setPrice(price);
- list.add(pro);
- return list;
- }
- /**
- * 毕业证书价格计算
- *
- * @param count
- */
- public List<Product> getDiploma(int count) {
- List<Product> list = new ArrayList<Product>();
- // 数量
- int countArr[] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 500, 1000};
- // 价格
- double priceArray[] = {90, 110, 120, 140, 160, 190, 210, 230, 240, 270, 480, 740, 920, 1200};
- Product pro = new Product();
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- if (list.size() == 4) {
- return list;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArray[i]);
- list.add(pro);
- }
- return list;
- }
- /**
- * 复印纸价格计算
- *
- * @param count
- * @param kind3
- * @param kind2
- * @param kind
- * @param size
- * @return
- */
- public List<Product> getCopyPaper(String kind, String kind2, String kind3, int count, String size) {
- List<Product> list = new ArrayList<Product>();
- double price = 0;
- if ("彩色".equals(kind)) {
- if ("80克双胶纸".equals(kind2)) {
- if ("19*13".equals(size)) {
- if (count == 10) {
- price = 70;
- } else if (count == 20) {
- price = 90;
- } else if (count == 50) {
- price = 150;
- }
- } else if ("28.5*21".equals(size)) {
- if (count == 10) {
- price = 160;
- } else if (count == 20) {
- price = 320;
- } else if (count == 50) {
- price = 900;
- }
- }
- }
- } else {
- if ("60克双胶纸".equals(kind2)) {
- if ("19*13".equals(size)) {
- if (count == 10) {
- if ("单面".equals(kind3)) {
- price = 50;
- } else {
- price = 70;
- }
- } else if (count == 20) {
- if ("单面".equals(kind3)) {
- price = 60;
- } else {
- price = 90;
- }
- } else if (count == 50) {
- if ("单面".equals(kind3)) {
- price = 110;
- } else {
- price = 150;
- }
- }
- } else if ("28.5*21".equals(size)) {
- if (count == 10) {
- if ("单面".equals(kind3)) {
- price = 110;
- } else {
- price = 150;
- }
- } else if (count == 20) {
- if ("单面".equals(kind3)) {
- price = 160;
- } else {
- price = 220;
- }
- } else if (count == 50) {
- if ("单面".equals(kind3)) {
- price = 380;
- } else {
- price = 520;
- }
- }
- }
- } else if ("80克双胶纸".equals(kind2)) {
- if ("19*13".equals(size)) {
- if (count == 10) {
- if ("单面".equals(kind3)) {
- price = 60;
- } else {
- price = 90;
- }
- } else if (count == 20) {
- if ("单面".equals(kind3)) {
- price = 80;
- } else {
- price = 120;
- }
- } else if (count == 50) {
- if ("单面".equals(kind3)) {
- price = 180;
- } else {
- price = 220;
- }
- }
- } else if ("28.5*21".equals(size)) {
- if (count == 10) {
- if ("单面".equals(kind3)) {
- price = 130;
- } else {
- price = 180;
- }
- } else if (count == 20) {
- if ("单面".equals(kind3)) {
- price = 220;
- } else {
- price = 260;
- }
- } else if (count == 50) {
- if ("单面".equals(kind3)) {
- price = 520;
- } else {
- price = 780;
- }
- }
- }
- }
- }
- Product pro = new Product();
- pro = new Product();
- pro.setCount(count);
- pro.setPrice(Math.ceil(price));
- list.add(pro);
- return list;
- }
- /**
- * 婚礼卡价格计算
- *
- * @param length
- * @param width
- * @param count
- * @param number
- * @param craftMo
- * @param craftShua
- * @return
- */
- public List<Product> getWeddingCardPrice(Double length, Double width, int count, Integer number, String craftMo,
- String craftShua) {
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- double weight = 0;
- if ("直角".equals(craftMo) && count <= 300 && ((length == 13 && width == 5.4) || (length == 5.4 && width == 13))) {
- if ("单面印刷".equals(craftShua)) {
- // 数量
- int countArr[] = {100, 200, 300};
- // 价格
- double priceArray[] = {70, 126, 183};
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArray[i]);
- list.add(pro);
- }
- // 根据款数重新算价格
- for (Product product : list) {
- product.setWeight(df.format(length * width * product.getCount() / 10000 * 0.3 * number));
- product.setPrice(Math.floor(product.getPrice() * number));
- }
- } else if ("双面印刷".equals(craftShua)) {
- // 数量
- int countArr[] = {100, 200, 300};
- // 价格
- double priceArray[] = {108, 189, 275};
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArray[i]);
- list.add(pro);
- }
- // 根据款数重新算价格
- for (Product product : list) {
- product.setPrice(Math.floor(product.getPrice() * number));
- }
- }
- } else {
- // 转成毫米
- weight = length * width * count / 10000 * 0.3 * number;
- length = length * 10;
- width = width * 10;
- if (count <= 300) {
- double l = 420;
- double w = 285;
- // 打印的加上出血(一边2毫米)
- length = length + 4;
- width = width + 4;
- double price = 0.0;
- // 5张以内价格
- double fixPrice = 50;
- // 每增加1张多少钱
- double zhang = 6;
- // 设计费
- double designFee = 0.0;
- // 婚礼卡,直角工艺每增加一张5元
- if ("直角".equals(craftMo)) {
- zhang = 5;
- }
- /*
- * 婚礼卡设计费成品尺寸90X54MM以内每款收10元 140X100MM以内每款收15元 210X140MM以内30元 210X285MM以内40元
- * 420X285MM以内60元 大于420X285MM80元
- */
- // 设计费不带出血的尺寸
- if ((length - 4 <= 90 && width - 4 <= 54) || (length - 4 <= 54 && width - 4 <= 90)) {
- designFee = 10;
- } else if ((length - 4 <= 140 && width - 4 <= 100) || (length - 4 <= 140 && width - 4 <= 100)) {
- designFee = 15;
- } else if ((length - 4 <= 210 && width - 4 <= 140) || (length - 4 <= 140 && width - 4 <= 210)) {
- designFee = 30;
- } else if ((length - 4 <= 285 && width - 4 - 4 <= 210) || (length - 4 <= 210 && width - 4 <= 285)) {
- designFee = 40;
- } else if ((length - 4 <= 420 && width - 4 <= 285) || (length - 4 <= 285 && width - 4 <= 420)) {
- designFee = 60;
- } else {
- designFee = 80;
- }
- // 一张l/w 大的纸张能做多少个此类尺寸的产品
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
- int num = (int) Math.ceil(count * number / max);
- // 5张以内价格 + 每张费用(第6张起收)+ 设计费 * 款数 + 0.1 * 总数量 (排号费)
- price = fixPrice + (num - 5 > 0 ? num - 5 : 0) * zhang + designFee * number + 0.1 * count * number;
- Product dto = new Product();
- dto.setCount(count);
- dto.setPrice(price);
- list.add(dto);
- } else {
- // 数量
- int countArr[] = {500, 1000, 2000};
- // 价格
- double priceArray[] = {230, 400, 760};
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(priceArray[i]);
- list.add(pro);
- }
- // 根据款数重新算价格
- for (Product product : list) {
- product.setWeight(df.format(weight));
- product.setPrice(Math.floor(product.getPrice() * number));
- }
- }
- }
- return list;
- }
- /**
- * 贡缎布产品价格
- */
- public static List<Product> satinClothPrice(String kind2, Double length, Double width, int count, Integer number) {
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- double area = length * width / 10000;
- double price = 0, dj = 0;
- if (area < 0.25) {
- dj = 50;
- } else {
- dj = 40;
- }
- area *= count;
- if ("6".equals(kind2)) {
- price = price + 30;
- }
- price = Math.ceil(area * dj > 58 ? area * dj : 58);
- pro.setCount(count);
- pro.setPrice(price * number);
- list.add(pro);
- return list;
- }
- /**
- * 餐垫纸
- *
- * @param kind
- * @param length
- * @param width
- * @param count
- * @return
- */
- public List<Product> getPlaceMatPrice(String kind, Double length, Double width, int count) {
- List<Product> list = new ArrayList<>();
- length = length * 10;
- width = width * 10;
- // Double priceArr[] = { 40.0, 50.0, 80.0, 120.0, 160.0, 270.0, 480.0 };
- // list = acountInsertCardPrice(count, list, priceArr);
- if ((length <= 285 && width <= 210) || length <= 210 && width <= 285) {
- Double priceArr[] = {46.0, 68.0, 117.0, 157.0, 236.0, 457.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 436 && width <= 285 || length <= 285 && width <= 436) {
- Double priceArr[] = {88.0, 122.0, 191.0, 269.0, 457.0, 896.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 638 && width <= 285 || length <= 285 && width <= 638) {
- Double priceArr[] = {137.0, 204.0, 350.0, 489.0, 810.0, 1482.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 852 && width <= 285 || length <= 285 && width <= 852) {
- Double priceArr[] = {183.0, 272.0, 466.0, 652.0, 975.0, 1681.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 1050 && width <= 285 || length <= 285 && width <= 2050) {
- Double priceArr[] = {229.0, 340.0, 582.0, 815.0, 1279.0, 2470.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 587 && width <= 428 || length <= 428 && width <= 587) {
- Double priceArr[] = {195.0, 262.0, 408.0, 554.0, 869.0, 1659.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 638 && width <= 428 || length <= 428 && width <= 638) {
- Double priceArr[] = {252.0, 352.0, 570.0, 755.0, 1191.0, 2263.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 779 && width <= 428 || length <= 428 && width <= 778) {
- Double priceArr[] = {321.0, 430.0, 691.0, 951.0, 1434.0, 2765.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 880 && width <= 428 || length <= 428 && width <= 880) {
- Double priceArr[] = {349.0, 484.0, 796.0, 1051.0, 1681.0, 3258.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 1050 && width <= 428 || length <= 428 && width <= 1050) {
- Double priceArr[] = {419.0, 587.0, 900.0, 1191.0, 1985.0, 3748.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 638 && width <= 574 || length <= 574 && width <= 638) {
- Double priceArr[] = {274.0, 408.0, 699.0, 927.0, 1535.0, 2964.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 779 && width <= 529 || length <= 529 && width <= 779) {
- Double priceArr[] = {321.0, 430.0, 691.0, 951.0, 1434.0, 2765.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 880 && width <= 580 || length <= 580 && width <= 880) {
- Double priceArr[] = {349.0, 484.0, 796.0, 1051.0, 1681.0, 3258.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- } else if (length <= 863 && width <= 638 || length <= 638 && width <= 863) {
- Double priceArr[] = {411.0, 612.0, 993.0, 1390.0, 2303.0, 4446.0};
- list = acountPlaceMatPrice(kind, count, list, priceArr);
- }
- return list;
- }
- /**
- * 餐垫纸遍历添加价格
- */
- private List<Product> acountPlaceMatPrice(String kind, int count, List<Product> list, Double[] priceArr) {
- int countArr[] = {500, 1000, 2000, 3000, 5000, 10000};
- Product pro;
- double beishu = 1;
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- if (countArr[i] <= 500) {
- beishu = 2.2;
- } else if (countArr[i] <= 3000) {
- beishu = 1.8;
- } else {
- beishu = 1.5;
- }
- // 55克 比80克便宜2分钱一张
- if ("1".equals(kind)) {
- pro.setPrice(Math.ceil(priceArr[i] * beishu - countArr[i] * 0.02));
- } else if ("0".equals(kind)) {// 80克
- pro.setPrice(Math.ceil(priceArr[i] * beishu));
- }
- list.add(pro);
- }
- return list;
- }
- /**
- * 硫酸纸吊牌价格
- *
- * @param count
- */
- public List<Product> getAcidTagsPrice(Double length, Double width, String size1, int count) {
- List<Product> list = new ArrayList<>();
- int countArr[] = {1000, 2000, 5000, 10000};
- if ((length > 6.8 || width > 3) && (length > 3 || width > 6.8)) {
- int priceArr[] = {200, 360, 720, 1300};
- list = acountAcidTagsPrice(count, list, countArr, priceArr);
- } else {
- int priceArr[] = {180, 320, 620, 1100};
- list = acountAcidTagsPrice(count, list, countArr, priceArr);
- }
- return list;
- }
- /**
- * 硫酸纸吊牌价格计算
- *
- * @param count
- * @param list
- * @param countArr
- * @param priceArr
- */
- private List<Product> acountAcidTagsPrice(int count, List<Product> list, int[] countArr, int[] priceArr) {
- Product pro;
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(priceArr[i]));
- list.add(pro);
- }
- return list;
- }
- /**
- * 号码布价格计算
- *
- * @param kind
- * @param num
- * @param width
- * @param length
- * @param list
- * @param count
- * @return
- */
- public List<Product> getHmbPrice(String kind, int num, Double length, Double width, int count, List<Product> list) {
- Product pro;
- double price = 0;
- if (length == 240 && width == 200 || length == 200 && width == 240) {
- if (kind.equals("春亚布")) {
- price = num * count * 1.8;
- } else {
- price = num * count * 2.5;
- }
- } else if (length == 200 && width == 140 || length == 140 && width == 200) {
- if (kind.equals("春亚布")) {
- price = num * count * 1.5;
- } else {
- price = num * count * 1.3;
- }
- } else {
- if (kind.equals("春亚布")) {
- price = num * count * 1.5;
- } else {
- price = num * count * 1.8;
- }
- }
- pro = new Product();
- pro.setCount(count);
- pro.setPrice(Math.ceil(price) > 50 ? price : 50);
- list.add(pro);
- return list;
- }
- /**
- * 锦旗价格计算
- *
- * @param kind
- * @param num
- * @param width
- * @param length
- * @param list
- * @param count
- * @return
- */
- public List<Product> getJQPrice(String kind, int num, Double length, Double width, int count, List<Product> list) {
- Product pro;
- double price = 0;
- if (length == 60 && width == 90 || length == 90 && width == 60) {
- if (kind.equals("小龙须黄字")) {
- price = num * count * 45;
- } else if (kind.equals("小龙须3d镀金")) {
- price = num * count * 86;
- } else if (kind.equals("大龙须黄字")) {
- price = num * count * 66;
- } else if (kind.equals("大龙须3d镀金")) {
- price = num * count * 88;
- } else {
- price = num * count * 130;
- }
- } else if (length == 70 && width == 110 || length == 110 && width == 70) {
- if (kind.equals("小龙须黄字")) {
- price = num * count * 47;
- } else if (kind.equals("小龙须3d镀金")) {
- price = num * count * 88;
- } else if (kind.equals("大龙须黄字")) {
- price = num * count * 80;
- } else {
- price = num * count * 98;
- }
- } else if (length == 80 && width == 120 || length == 120 && width == 80) {
- if (kind.equals("小龙须黄字")) {
- price = num * count * 85;
- } else if (kind.equals("小龙须3d镀金")) {
- price = num * count * 125;
- } else if (kind.equals("大龙须黄字")) {
- price = num * count * 90;
- } else {
- price = num * count * 140;
- }
- } else if (length == 70 && width == 120 || length == 120 && width == 70) {
- price = num * count * 158;
- } else {
- price = num * count * 220;
- }
- pro = new Product();
- pro.setCount(count);
- pro.setPrice(Math.ceil(price));
- list.add(pro);
- return list;
- }
- /**
- * 彩旗价格计算
- *
- * @param num
- * @param width
- * @param length
- * @param list
- * @param count
- * @return
- */
- public List<Product> getCQPrice(int num, Double length, Double width, int count, List<Product> list) {
- Product pro;
- double price = 0;
- if (length == 40 && width == 80 || length == 80 && width == 40) {
- price = num * count * 80;
- } else if (length == 60 && width == 90 || length == 90 && width == 60) {
- price = num * count * 130;
- } else if (length == 70 && width == 120 || length == 120 && width == 70) {
- price = num * count * 158;
- } else {
- price = num * count * 220;
- }
- pro = new Product();
- pro.setCount(count);
- pro.setPrice(Math.ceil(price));
- list.add(pro);
- return list;
- }
- /**
- * 封口贴铜板不干胶价格计算
- *
- * @param num
- * @param list
- * @return
- */
- public List<Product> getFktPrice(int num, List<Product> list) {
- Product pro;
- double price = 0;
- for (int i = 1; i < countArr.length; i++) {
- if (countArr[i] == 1000) {
- price = 50.0 * num;
- } else if (countArr[i] == 2000) {
- price = 80.0 * num;
- } else if (countArr[i] == 3000) {
- price = 150.0 * num;
- } else if (countArr[i] == 5000) {
- price = 175.0 * num;
- } else if (countArr[i] == 10000) {
- price = 240.0 * num;
- } else {
- price = 450.0 * num;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(price));
- list.add(pro);
- }
- return list;
- }
- /**
- * PVC亮光异型卡片价格计算
- *
- * @param dto
- * @param number
- * @param width
- * @param length
- * @param area
- * @param count
- * @param priceList
- * @return
- */
- /*public List<Product> getPVCPrice(String kindValue,int count,double width, double length, List<Product> list) {
- Product pro;
- double price = 0,dj = 0, bz = 1;
- double area = (width*length)/10000;
- int countArr[] = { 500, 1000, 2000, 5000, 10000 };
- if(area <= 0.0016) {
- bz = 2.7;
- }else if(area <= 0.0025) {
- bz = 1.8;
- }else if(area <= 0.0036) {
- bz = 1.3;
- }else if(area <= 0.0042) {
- bz = 1.05;
- }
- for(int i = 0; i< countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- if(kindValue.equals("2")) {
- if(countArr[i] == 500) {
- dj = 45;
- }else if(countArr[i] == 1000) {
- dj = 34;
- }else if(countArr[i] == 2000) {
- dj = 31;
- }else if(countArr[i] == 5000) {
- dj = 29;
- }else if(countArr[i] == 10000) {
- dj = 28;
- }
- }else {
- if(countArr[i] == 500) {
- dj = 63;
- }else if(countArr[i] == 1000) {
- dj = 54;
- }else if(countArr[i] == 2000) {
- dj = 50;
- }else if(countArr[i] == 5000) {
- dj = 48;
- }else if(countArr[i] == 10000) {
- dj = 47;
- }
- }
- price = bz*dj*countArr[i]*area;
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(price);
- list.add(pro);
- }
- return list;
- }*/
- /**
- * 硫酸纸价格计算
- *
- * @param dto
- * @param width
- * @param length
- * @param count
- * @param list
- * @return
- */
- public List<Product> getLszPrice(Product dto, double width, double length, int count, List<Product> list) {
- double price = 0, dj = 0, area = 0;
- String craft[] = dto.getCraft();
- int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
- for (int i = 0; i < lszCountArr.length; i++) {
- Product pro = new Product();
- if (lszCountArr[i] < count || list.size() > 3) {
- continue;
- }
- if ((width <= 6.8 && length <= 3) || (width <= 6.8 && length <= 3)) {
- if ("直角".equals(craft[0])) {
- dj = 14.5;
- } else {
- dj = 36.5;
- }
- } else if ((width <= 9 && length <= 5) || (width <= 9 && length <= 5)) {
- if ("直角".equals(craft[0])) {
- dj = 14.5;
- } else {
- dj = 36.5;
- }
- } else if ((width <= 10 && length <= 14) || (width <= 14 && length <= 10)) {
- if ("直角".equals(craft[0])) {
- dj = 11.5;
- } else {
- dj = 17.5;
- }
- } else if ((width <= 21 && length <= 14) || (width <= 14 && length <= 21)) {
- if ("直角".equals(craft[0])) {
- dj = 9.6;
- } else {
- dj = 12.1;
- }
- } else if ((width <= 21 && length <= 28.5) || (width <= 28.5 && length <= 21)) {
- if ("直角".equals(craft[0])) {
- dj = 7.6;
- } else {
- dj = 11.1;
- }
- } else {
- if ("直角".equals(craft[0])) {
- dj = 7.2;
- } else {
- dj = 10.7;
- }
- }
- dj *= 2;//按照供应商成本价2倍计算
- if (lszCountArr[i] == 500) {
- area = width * length * 800 / 10000;
- } else {
- area = width * length * lszCountArr[i] / 10000;
- if ((width >= 21 && length >= 28.5) || (width >= 28.5 && length >= 21)) {
- area *= 0.85;
- }
- }
- price = Math.ceil(dj * area);
- pro.setPrice(price > 80 ? price : 80);
- //烫金工艺
- if ("烫金".equals(dto.getCraftTang())) {
- area = length * width / 10000;
- double tangPrice = 0;
- double tangPriceArr[] = new double[4];
- if (area <= 0.005) {
- tangPriceArr = new double[]{90.0, 135.0, 205.0, 255.0, 425, 850, 1700};
- } else if (area <= 0.01) {
- tangPriceArr = new double[]{95.0, 140.0, 225.0, 300.0, 500, 1000, 2000};
- } else if (area <= 0.015) {
- tangPriceArr = new double[]{100.0, 145.0, 245.0, 325.0, 545, 1090, 2180};
- } else if (area <= 0.025) {
- tangPriceArr = new double[]{115.0, 165.0, 280.0, 380.0, 635, 1270, 2540};
- } else if (area <= 0.035) {
- tangPriceArr = new double[]{135.0, 205.0, 335.0, 468.0, 780, 1560, 3120};
- } else {
- tangPriceArr = new double[]{145.0, 225.0, 380.0, 535.0, 895, 1790, 3580};
- }
- tangPrice = tangPriceArr[i] * 1.4 > 135 ? tangPriceArr[i] * 1.4 : 135;
- pro.setPrice(Math.ceil(pro.getPrice() + tangPrice));
- }
- pro.setCount(lszCountArr[i]);
- list.add(pro);
- }
- return list;
- }
- /**
- * 80克硫酸纸价格计算
- *
- * @param dto
- * @param width
- * @param length
- * @param count
- * @param list
- * @return
- */
- public List<Product> get80LszPrice(Product dto, double width, double length, int count, List<Product> list) {
- double dj = 0;
- double l = 420;
- double w = 285;
- length *= 10;
- width *= 10;
- Product pro = new Product();
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- // if (count <= 1000) {
- // dj = 150;
- // } else {
- // dj = 150 + Math.ceil(count / 1000) * 20;
- // }
- if (dto.getKindValue().equals("2")) {
- dj = 0.86;
- } else {
- dj = 0.5;
- }
- pro.setPrice(130 + Math.ceil((num + 100) * dj));
- double area = 0;
- if ("烫金".equals(dto.getCraftTang())) {
- int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
- int i = 0;
- for (int j = 0; j < lszCountArr.length; j++) {
- if (lszCountArr[i] > count) {
- break;
- }
- i = j;
- }
- area = length * width / 10000;
- double tangPrice = 0;
- double tangPriceArr[] = new double[4];
- if (area <= 0.005) {
- tangPriceArr = new double[]{135, 189, 287, 357, 595, 1190, 2380};
- } else if (area <= 0.01) {
- tangPriceArr = new double[]{135, 196, 315, 420, 700, 1400, 2800};
- } else if (area <= 0.015) {
- tangPriceArr = new double[]{140, 203, 343, 455, 763, 1526, 3052};
- } else if (area <= 0.025) {
- tangPriceArr = new double[]{161, 231, 392, 532, 889, 1778, 3556};
- } else if (area <= 0.035) {
- tangPriceArr = new double[]{189, 287, 469, 655.2, 1092, 2184, 4368};
- } else {
- tangPriceArr = new double[]{203, 315, 532, 749, 1253, 2506, 5012};
- }
- tangPrice = tangPriceArr[i] * 1.4 > 135 ? tangPriceArr[i] * 1.4 : 135;
- pro.setPrice(Math.ceil(pro.getPrice() + tangPrice));
- }
- pro.setCount(count);
- list.add(pro);
- return list;
- }
- /**
- * 常规刚古水纹超白不干胶计算
- *
- * @param number
- * @param width
- * @param length
- * @param count
- * @return
- */
- public List<Product> getGgSwPrice(double length, double width, int count, int number) {
- double price = 0, area = 0;
- List<Product> list = new ArrayList<Product>();
- Product pro = null;
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count || list.size() > 3) {
- continue;
- }
- pro = new Product();
- area = (length * width * countArr[i]) / 10000;
- price = 70 * area * number;
- pro.setPrice(Math.ceil(price > 80 ? price : 80));
- pro.setCount(countArr[i]);
- list.add(pro);
- }
- return list;
- }
- /**
- * 帆布计算
- *
- * @param dto
- * @param number
- * @param width
- * @param length
- * @param count
- * @param list
- * @return
- */
- public List<Product> getFbPrice(Product dto, Integer number, Double width, Double length, int count, List<Product> list) {
- Product pro = new Product();
- double price = 0, dj = 0;
- String[] craft = dto.getCraft();
- if (dto.getStickerKind().equals("套餐")) {
- pro.setCount(count);
- pro.setPrice(198.0);
- list.add(pro);
- } else {
- double area = length * width * count / 10000;
- double d = length * width * count / 10000;
- if (length == 100 && width == 45) {
- price = 40 * number * count;
- if (craft != null) {
- for (int i = 0; i < craft.length; i++) {
- if (craft[i].equals("缝兜")) {
- price += number * 10;
- } else {
- continue;
- }
- }
- }
- pro.setCount(count);
- pro.setPrice(price);
- list.add(pro);
- }/*else if(length == 45 && width == 45){
- price = 30 * number * count;
- if(craft != null) {
- for(int i = 0; i< craft.length; i++) {
- if(craft[i].equals("缝兜")) {
- price += number * 10;
- }else {
- continue;
- }
- }
- }
- pro.setPrice(price);
- }*/ else {
- if (d <= 0.2) {
- area *= number;
- }
- if (area <= 0.2) {
- price = 45;
- } else if (area <= 0.5) {
- dj = 80;
- } else if (area <= 0.7) {
- dj = 75;
- } else if (area <= 0.9) {
- dj = 70;
- } else if (area <= 1) {
- dj = 68;
- } else if (area <= 1.9) {
- dj = 65;
- } else if (area <= 3) {
- dj = 60;
- } else {
- dj = 55;
- }
- if (d > 0.2) {
- price = area * dj * number;
- } else {
- if (area <= 0.2) {
- price = 45;
- } else {
- price = area * dj;
- }
- }
- if (craft != null) {
- for (int i = 0; i < craft.length; i++) {
- if (craft[i].equals("缝兜")) {
- price += number * 10;
- } else {
- continue;
- }
- }
- }
- /*if(d > 3 && number > 1) {
- price += (number-1) * 20;
- }*/
- price = Math.ceil(price > 45 ? price : 45);
- double other_price = 0;
- if (length * width < 40 * 50) {
- int total = count * number;
- for (int i = 1; i <= total; i++) {
- other_price = getFBPirce(width, length, i, 1);
- if (other_price > 45) {
- price = 45 + (total - i + 1) * 6;
- break;
- }
- }
- }
- pro.setPrice(price);
- pro.setCount(count);
- pro.setWeight(df.format(area * 0.28 * number));
- list.add(pro);
- }
- }
- return list;
- }
- public double getFBPirce(double length, double width, int count, int number) {
- double area = length * width * count / 10000;
- double d = length * width * count / 10000;
- double price = 0, dj = 0;
- if (length == 100 && width == 45) {
- price = 40 * number * count;
- } else {
- if (d <= 0.2) {
- area *= number;
- }
- if (area <= 0.2) {
- price = 45;
- } else if (area <= 0.5) {
- dj = 80;
- } else if (area <= 0.7) {
- dj = 75;
- } else if (area <= 0.9) {
- dj = 70;
- } else if (area <= 1) {
- dj = 68;
- } else if (area <= 1.9) {
- dj = 65;
- } else if (area <= 3) {
- dj = 60;
- } else {
- dj = 55;
- }
- if (d > 0.2) {
- price = area * dj * number;
- } else {
- if (area <= 0.2) {
- price = 45;
- } else {
- price = area * dj;
- }
- }
- price = Math.ceil(price > 45 ? price : 45);
- }
- return price;
- }
- public double getTestPrice(double length, double width, int count, int number,
- double[] areas, double[] prices, double minPrice, double lastPrice) {
- final int total = count * number;
- for (int i = 1; i <= total; i++) {
- double currentPrice = new PriceUtils().getOptimizedPrice(
- length,
- width,
- i, // 当前数量
- 1, // number 参数固定为1
- areas,
- prices,
- minPrice,
- lastPrice
- );
- if (currentPrice > minPrice) {
- // 计算累加价格:基础价 + 剩余项*6
- return minPrice + (total - i + 1) * 6;
- }
- }
- // 未触发条件时返回基础最低价
- return minPrice;
- }
- public double getOptimizedPrice(double length, double width, int count, int number,
- double[] areas, double[] prices, double minPrice, double lastPrice) {
- final double area = length * width * count / 10000;
- final boolean isSmallArea = area <= 0.2;
- // 计算调整后的面积值
- final double adjustedArea = isSmallArea ? area * number : area;
- // 确定单价基准
- double unitPrice = isSmallArea ? minPrice : lastPrice;
- if (!isSmallArea) {
- for (int i = 0; i < areas.length; i++) {
- if (adjustedArea <= areas[i]) {
- unitPrice = prices[i];
- break;
- }
- }
- }
- // 计算基础价格
- double basePrice = isSmallArea ? minPrice : adjustedArea * unitPrice;
- // 应用数量系数
- double finalPrice = (area > 0.2) ? basePrice * number : basePrice;
- // 确保最低价格并取整
- return Math.ceil(Math.max(finalPrice, minPrice));
- }
- /**
- * 亚克力计算
- *
- * @param dto
- * @param number
- * @param width
- * @param length
- * @param count
- * @param list
- * @return
- */
- public List<Product> getYklPrice(Product dto, Integer number, Double width, Double length, int count, List<
- Product> list) {
- Product pro = new Product();
- double price = 0, dj = 0;
- double l = 1200;
- double w = 2400;
- double area = length * width * count / 10000;
- String kind = dto.getKind2Value();
- length = length * 10;
- width = width * 10;
- if ((length > l || width > w) && (length > w || width > l))
- return null;
- // 一张大纸能做多少个此类尺寸的不干胶
- double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
- Math.floor(l / width) * Math.floor(w / length));
- // 报的数量需要多少张大纸
- int num = (int) Math.ceil(count / max);
- if (num > 1) {
- if (kind.equals("1")) {
- dj = 317;
- } else if (kind.equals("2")) {
- dj = 357;
- } else if (kind.equals("3")) {
- dj = 477;
- } else if (kind.equals("4")) {
- dj = 375;
- } else {
- dj = 415;
- }
- price = dj * 1.8 + dj * 1.5 * (num - 1);
- pro.setPrice(Math.ceil(price));
- } else {
- if (area <= 0.02) {
- dj = 1800;
- } else if (area <= 0.03) {
- dj = 1300;
- } else if (area <= 0.05) {
- dj = 1000;
- } else if (area <= 0.06) {
- dj = 900;
- } else if (area <= 0.07) {
- dj = 800;
- } else if (area <= 0.08) {
- dj = 700;
- } else if (area <= 0.16) {
- dj = 650;
- } else if (area <= 0.25) {
- dj = 550;
- } else if (area <= 0.4) {
- dj = 500;
- } else if (area <= 0.5) {
- dj = 400;
- } else if (area <= 0.6) {
- dj = 350;
- } else if (area <= 0.8) {
- dj = 300;
- } else if (area <= 1) {
- dj = 280;
- } else if (area <= 2) {
- dj = 250;
- } else if (area <= 3) {
- dj = 240;
- } else if (area <= 4) {
- dj = 230;
- } else if (area <= 5) {
- dj = 225;
- }
- price = area * dj * 2.5;
- if (kind.equals("5")) {
- price = price * 1.2;
- } else {
- if (kind.equals("2")) {
- price = price * 1.1;
- } else if (kind.equals("3")) {
- price = price * 1.3;
- }
- }
- }
- double weight = 0;
- if (kind.equals("1") || kind.equals("4")) {
- weight = area * number * 2.26;
- } else if (kind.equals("2") || kind.equals("5")) {
- weight = area * number * 3.06;
- } else if (kind.equals("3")) {
- weight = area * number * 5.11;
- }
- pro.setPrice(Math.ceil(price > 50 ? price : 50));
- pro.setCount(count);
- pro.setWeight(String.valueOf(df.format(weight)));
- list.add(pro);
- return list;
- }
- /**
- * 灯布计算
- *
- * @param width
- * @param length
- * @param count
- * @param list
- * @return
- */
- public List<Product> getDbPrice(String kind, Double width, Double length, int count, List<Product> list, int number) {
- //11-550灯布 12-520灯布 13-550黑底灯布
- Product pro = new Product();
- double price = 0, dj = 0;
- double area = length * width * count / 10000;
- double[] areas = {};
- double[] prices = {};
- double last_price = 0;
- double min_price = 0;
- if ("11".equals(kind)) {
- areas = new double[]{5, 10,};
- prices = new double[]{20, 18};
- last_price = 17;
- min_price = 55 + 15;
- } else if ("12".equals(kind)) {
- areas = new double[]{5, 10,};
- prices = new double[]{16, 12};
- last_price = 10;
- min_price = 50 + 15;
- } else {
- areas = new double[]{5, 10,};
- prices = new double[]{24, 20};
- last_price = 18;
- min_price = 60 + 15;
- }
- if (width * length < 40 * 50) {
- price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
- } else {
- dj = last_price;
- for (int i = 0; i < areas.length; i++) {
- if (area <= areas[i]) {
- dj = prices[i];
- break;
- }
- }
- price = Math.max(area * dj, min_price);
- }
- if (number > 1 && width * length >= 40 * 50) {
- pro.setPrice(Math.ceil(price * number));
- } else {
- pro.setPrice(Math.ceil(price));
- }
- pro.setCount(count);
- list.add(pro);
- return list;
- }
- /**
- * 串旗计算
- *
- * @param width
- * @param length
- * @param count
- * @param num
- * @param list
- * @return
- */
- public List<Product> getCqPrice(Double width, Double length, int count, int num, List<Product> list) {
- Product pro = new Product();
- double price = 0, dj = 0;
- double area = (width * length) / 10000;
- if (area <= 0.042) {
- price = 50 + 5 * count * num;
- } else if (area <= 0.1125) {
- dj = 120;
- } else if (area <= 0.2) {
- dj = 110;
- } else if (area <= 0.5) {
- dj = 100;
- } else if (area <= 0.7) {
- dj = 95;
- } else if (area <= 0.9) {
- dj = 90;
- } else if (area <= 1) {
- dj = 85;
- } else {
- dj = 80;
- }
- if (area > 0.042) {
- price = dj * area * count * num;
- }
- price = Math.ceil(price > 50 ? price : 50);
- double wei = area * 0.29 * count * num;
- pro.setPrice(price);
- pro.setCount(count);
- pro.setWeight(df.format(wei));
- list.add(pro);
- return list;
- }
- /**
- * 桌布
- *
- * @param length
- * @param width
- * @param count
- * @param number
- * @return
- */
- public List<Product> getTableClothPrice(Double length, Double width, int count, Integer
- number, List<Product> priceList) {
- double price = 0, dj = 0;
- if (length <= 0.8 && width <= 0.8) {
- dj = 77;
- } else if ((length <= 0.8 && width <= 1.6) || (length <= 1.6 && width <= 0.8)) {
- dj = 43;
- } else if ((length <= 1.2 && width <= 1.6) || (length <= 1.6 && width <= 1.2)) {
- dj = 29;
- } else if ((length <= 1.4 && width <= 1.6) || (length <= 1.6 && width <= 1.4)) {
- dj = 28;
- } else if ((length <= 1.6 && width <= 2.0) || (length <= 2.0 && width <= 1.6)) {
- dj = 27;
- }/*else if((length <= 1.8 && width <= 2.0) || (length <= 2.0 && width <= 1.8)) {
- dj = 26;
- }else if((length <= 1.6 && width <= 2.5) || (length <= 2.5 && width <= 1.6)) {
- dj = 26;
- }*/ else {
- dj = 26;
- }
- Product pro = new Product();
- List<Product> list = new ArrayList<Product>();
- price = length * width * count * number * dj;
- pro.setCount(count);
- pro.setPrice(Math.ceil(price > 50 ? price : 50));
- pro.setWeight(df.format(0.3 * length * width * count * number));
- list.add(pro);
- return list;
- }
- public List<Product> getShkPrice(String size, int count, Integer number) {
- int[] countArr = {200, 500, 1000, 2000, 5000, 10000};
- double[] priceArr = {};
- List<Product> list = new ArrayList<Product>();
- Product pro = new Product();
- if (size.equals("9*5.4")) {
- priceArr = new double[]{25.0, 26.0, 27.0, 50.0, 110.0, 200.0};
- } else if (size.equals("9*11")) {
- priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
- } else if (size.equals("8*11")) {
- priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
- } else if (size.equals("7*14")) {
- priceArr = new double[]{27.0, 37.0, 45.0, 80.0, 210.0, 400.0};
- } else if (size.equals("8*14")) {
- priceArr = new double[]{44.0, 46.0, 72.0, 120.0, 260.0, 500.0};
- } else if (size.equals("10*15")) {
- priceArr = new double[]{44.0, 66.0, 88.0, 150.0, 350.0, 600.0};
- } else if (size.equals("11*18")) {
- priceArr = new double[]{61.0, 83.0, 94.0, 160.0, 400.0, 650.0};
- } else if (size.equals("9*9")) {
- priceArr = new double[]{30.0, 41.0, 44.0, 75.0, 200.0, 400.0};
- } else {
- priceArr = new double[]{44.0, 66.0, 88.0, 120.0, 260.0, 500.0};
- }
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- if (list.size() > 3) {
- break;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(number * priceArr[i]));
- list.add(pro);
- }
- return list;
- }
- public List<Product> getSdkPrice(int count, Integer number) {
- int[] countArr = {50, 100, 500, 1000, 2000, 5000, 10000};
- double[] priceArr = new double[]{339, 599, 1800.0, 3000.0, 4800.0, 8000.0, 15000.0};
- Product pro = new Product();
- List<Product> list = new ArrayList<Product>();
- for (int i = 0; i < countArr.length; i++) {
- if (countArr[i] < count) {
- continue;
- }
- if (list.size() > 3) {
- break;
- }
- pro = new Product();
- pro.setCount(countArr[i]);
- pro.setPrice(Math.ceil(number * priceArr[i]));
- list.add(pro);
- }
- return list;
- }
- public double TablePrice(double area, int[] price_list, double[] areas) {
- double price = 0;
- int startIndex = 0;
- int endIndex = 0;
- for (int i = 0; i < areas.length; i++) {
- if (area > areas[i]) {
- startIndex = endIndex;
- endIndex = Math.min(i + 1, areas.length - 1);
- }
- }
- if (startIndex == endIndex && startIndex == 0) {
- price = price_list[endIndex];
- } else if (startIndex == endIndex) {
- price = (price_list[endIndex] / areas[endIndex]) * area;
- } else {
- price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
- }
- return price;
- }
- public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) {
- double price = 0;
- int startIndex = 0;
- int endIndex = 0;
- boolean islast = false;
- for (int i = 0; i < areas.length; i++) {
- if (area > areas[i]) {
- startIndex = endIndex;
- endIndex = Math.min(i + 1, areas.length - 1);
- }
- if (area == areas[i]) {
- endIndex = startIndex = i;
- }
- if (area > areas[i] && i == areas.length - 1) {
- islast = true;
- }
- }
- if (startIndex == endIndex && startIndex == 0) {
- price = price_list[endIndex] * area;
- } else if (startIndex == endIndex) {
- price = (price_list[endIndex] * areas[endIndex] / areas[endIndex]) * area;
- } else {
- double end_price = price_list[endIndex]*areas[endIndex];
- double start_price = price_list[startIndex]*areas[startIndex];
- price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * start_price + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * end_price;
- }
- price = islast ? last_price * area : price;
- return Math.ceil(price);
- }
- public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum) {
- if (craft_list.contains("烫画")) {
- return (int) count * 120;
- }
- double price = 0;
- if (craft_list.contains("冷转印")) {
- double banfei = 200;
- if (countNum > 1) {
- price = 260 * countNum;
- banfei = 0;
- count = Math.abs(count - countNum);
- }
- if (count > 0) {
- if (count <= 5) {
- price += 260;
- } else if (count < 100) {
- price += 14 * count + banfei;
- } else {
- price += 12 * count;
- }
- }
- price = price + (coNumber - 1) * 100;
- }
- return price;
- }
- }
|